Commit bbdc4083 authored by mrobinson@webkit.org's avatar mrobinson@webkit.org

[GTK] Make libsecret optional

https://bugs.webkit.org/show_bug.cgi?id=113821

Reviewed by Gustavo Noronha Silva.

.:

Add a configuration option to disable credential storage and thus remove
the libsecret dependency. This should make it possible to build WebKit 2.x
on Windows again.

* Source/autotools/FindDependencies.m4: Only look for libsecret if credential storage is active.
* Source/autotools/PrintBuildConfiguration.m4: Print whether or not credential storage is active.
* Source/autotools/ReadCommandLineArguments.m4: Added an option to control credential storage.
* Source/autotools/SetupAutoconfHeader.m4: Expose credential storage setting to code.

Source/WebCore:

Don't try to use libsecret if credential storage is disabled.

* platform/gtk/GRefPtrGtk.cpp: Protect libsecret sections.
* platform/gtk/GRefPtrGtk.h: Ditto.
* platform/network/gtk/CredentialBackingStore.cpp: Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@147499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7f24eaae
2013-04-02 Martin Robinson <mrobinson@igalia.com>
[GTK] Make libsecret optional
https://bugs.webkit.org/show_bug.cgi?id=113821
Reviewed by Gustavo Noronha Silva.
Add a configuration option to disable credential storage and thus remove
the libsecret dependency. This should make it possible to build WebKit 2.x
on Windows again.
* Source/autotools/FindDependencies.m4: Only look for libsecret if credential storage is active.
* Source/autotools/PrintBuildConfiguration.m4: Print whether or not credential storage is active.
* Source/autotools/ReadCommandLineArguments.m4: Added an option to control credential storage.
* Source/autotools/SetupAutoconfHeader.m4: Expose credential storage setting to code.
2013-04-02 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r147401.
......
2013-04-02 Martin Robinson <mrobinson@igalia.com>
[GTK] Make libsecret optional
https://bugs.webkit.org/show_bug.cgi?id=113821
Reviewed by Gustavo Noronha Silva.
Don't try to use libsecret if credential storage is disabled.
* platform/gtk/GRefPtrGtk.cpp: Protect libsecret sections.
* platform/gtk/GRefPtrGtk.h: Ditto.
* platform/network/gtk/CredentialBackingStore.cpp: Ditto.
2013-04-02 Bem Jones-Bey <bjonesbe@adobe.com>
[CSS Exclusions] refactor shape-outside code to use isFloatingWithShapeOutside() helper method
......@@ -20,12 +20,14 @@
#include "config.h"
#include "GRefPtrGtk.h"
#define SECRET_WITH_UNSTABLE 1
#define SECRET_API_SUBJECT_TO_CHANGE 1
#include <glib.h>
#include <gtk/gtk.h>
#if ENABLE(CREDENTIAL_STORAGE)
#define SECRET_WITH_UNSTABLE 1
#define SECRET_API_SUBJECT_TO_CHANGE 1
#include <libsecret/secret.h>
#endif
namespace WTF {
......@@ -42,6 +44,7 @@ template <> void derefGPtr(GtkTargetList* ptr)
gtk_target_list_unref(ptr);
}
#if ENABLE(CREDENTIAL_STORAGE)
template <> SecretValue* refGPtr(SecretValue* ptr)
{
if (ptr)
......@@ -54,6 +57,7 @@ template <> void derefGPtr(SecretValue* ptr)
if (ptr)
secret_value_unref(ptr);
}
#endif
#ifdef GTK_API_VERSION_2
template <> GdkCursor* refGPtr(GdkCursor* ptr)
......
......@@ -30,8 +30,10 @@ namespace WTF {
template <> GtkTargetList* refGPtr(GtkTargetList* ptr);
template <> void derefGPtr(GtkTargetList* ptr);
#if ENABLE(CREDENTIAL_STORAGE)
template <> SecretValue* refGPtr(SecretValue* ptr);
template <> void derefGPtr(SecretValue* ptr);
#endif
#ifdef GTK_API_VERSION_2
template <> GdkCursor* refGPtr(GdkCursor* ptr);
......
/*
* Copyright (C) 2012 Igalia S.L.
* Copyright (C) 2012, 2013 Igalia S.L.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -26,6 +26,7 @@
#include "config.h"
#include "CredentialBackingStore.h"
#if ENABLE(CREDENTIAL_STORAGE)
#define SECRET_WITH_UNSTABLE 1
#define SECRET_API_SUBJECT_TO_CHANGE 1
#include "AuthenticationChallenge.h"
......@@ -35,6 +36,7 @@
#include <libsoup/soup.h>
#include <wtf/gobject/GOwnPtr.h>
#include <wtf/text/CString.h>
#endif
namespace WebCore {
......@@ -44,6 +46,7 @@ CredentialBackingStore& credentialBackingStore()
return backingStore;
}
#if ENABLE(CREDENTIAL_STORAGE)
static GRefPtr<GHashTable> createAttributeHashTableFromChallenge(const AuthenticationChallenge& challenge, const Credential& credential = Credential())
{
SoupURI* uri = soup_message_get_uri(challenge.soupMessage());
......@@ -95,9 +98,11 @@ static void credentialForChallengeAsyncReadyCallback(SecretService* service, GAs
callback(Credential(user, password, CredentialPersistencePermanent), data);
}
#endif // ENABLE(CREDENTIAL_STORAGE)
void CredentialBackingStore::credentialForChallenge(const AuthenticationChallenge& challenge, CredentialForChallengeCallback callback, void* data)
{
#if ENABLE(CREDENTIAL_STORAGE)
// The default flag only returns the most recent item, not all of them.
SecretSearchFlags searchFlags = static_cast<SecretSearchFlags>(SECRET_SEARCH_UNLOCK | SECRET_SEARCH_LOAD_SECRETS);
CredentialForChallengeAsyncReadyCallbackData* callbackData = new CredentialForChallengeAsyncReadyCallbackData;
......@@ -112,10 +117,14 @@ void CredentialBackingStore::credentialForChallenge(const AuthenticationChalleng
0, // cancellable
reinterpret_cast<GAsyncReadyCallback>(credentialForChallengeAsyncReadyCallback),
callbackData);
#else
callback(Credential(), data);
#endif // ENABLE(CREDENTIAL_STORAGE)
}
void CredentialBackingStore::storeCredentialsForChallenge(const AuthenticationChallenge& challenge, const Credential& credential)
{
#if ENABLE(CREDENTIAL_STORAGE)
CString utf8Password = credential.password().utf8();
GRefPtr<SecretValue> newSecretValue = adoptGRef(secret_value_new(utf8Password.data(), utf8Password.length(), "text/plain"));
......@@ -129,6 +138,7 @@ void CredentialBackingStore::storeCredentialsForChallenge(const AuthenticationCh
0, // cancellable
0, // callback
0); // data
#endif // ENABLE(CREDENTIAL_STORAGE)
}
} // namespace WebCore
......@@ -359,9 +359,11 @@ PKG_CHECK_MODULES([LIBSOUP], [libsoup-2.4 >= libsoup_required_version])
AC_SUBST([LIBSOUP_CFLAGS])
AC_SUBST([LIBSOUP_LIBS])
PKG_CHECK_MODULES([LIBSECRET], [libsecret-1])
AC_SUBST([LIBSECRET_CFLAGS])
AC_SUBST([LIBSECRET_LIBS])
if test "$enable_credential_storage" = "yes"; then
PKG_CHECK_MODULES([LIBSECRET], [libsecret-1])
AC_SUBST([LIBSECRET_CFLAGS])
AC_SUBST([LIBSECRET_LIBS])
fi
# Check if FreeType/FontConfig are available.
if test "$with_target" = "directfb"; then
......
......@@ -24,6 +24,7 @@ Features:
SVG fonts support : $enable_svg_fonts
SVG support : $enable_svg
Spellcheck support : $enable_spellcheck
Credential storage support : $enable_credential_storage
Web Audio support : $enable_web_audio
WebGL : $enable_webgl
......
......@@ -64,6 +64,13 @@ AC_ARG_ENABLE([spellcheck],
[enable_spellcheck="yes"])
AC_MSG_RESULT([$enable_spellcheck])
AC_MSG_CHECKING([whether to enable credential storage])
AC_ARG_ENABLE([credential_storage],
[AS_HELP_STRING([--enable-credential-storage],[enable support for credential storage using libsecret [default=yes]])],
[],
[enable_credential_storage="yes"])
AC_MSG_RESULT([$enable_credential_storage])
AC_ARG_ENABLE(glx,
AC_HELP_STRING([--enable-glx], [enable support for GLX [default=auto]]),
[],
......
......@@ -115,4 +115,7 @@ if test "$enable_spellcheck" = "yes"; then
AC_DEFINE([ENABLE_SPELLCHECK], [1], [ ])
fi
if test "$enable_credential_storage" = "yes"; then
AC_DEFINE([WTF_ENABLE_CREDENTIAL_STORAGE], [1], [ ])
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment