Title: [147499] trunk
Revision
147499
Author
mrobin...@webkit.org
Date
2013-04-02 14:24:14 -0700 (Tue, 02 Apr 2013)

Log Message

[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.

Modified Paths

Diff

Modified: trunk/ChangeLog (147498 => 147499)


--- trunk/ChangeLog	2013-04-02 21:23:55 UTC (rev 147498)
+++ trunk/ChangeLog	2013-04-02 21:24:14 UTC (rev 147499)
@@ -1,3 +1,19 @@
+2013-04-02  Martin Robinson  <mrobin...@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....@gmail.com>
 
         Unreviewed, rolling out r147401.

Modified: trunk/Source/WebCore/ChangeLog (147498 => 147499)


--- trunk/Source/WebCore/ChangeLog	2013-04-02 21:23:55 UTC (rev 147498)
+++ trunk/Source/WebCore/ChangeLog	2013-04-02 21:24:14 UTC (rev 147499)
@@ -1,3 +1,16 @@
+2013-04-02  Martin Robinson  <mrobin...@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  <bjone...@adobe.com>
 
         [CSS Exclusions] refactor shape-outside code to use isFloatingWithShapeOutside() helper method

Modified: trunk/Source/WebCore/platform/gtk/GRefPtrGtk.cpp (147498 => 147499)


--- trunk/Source/WebCore/platform/gtk/GRefPtrGtk.cpp	2013-04-02 21:23:55 UTC (rev 147498)
+++ trunk/Source/WebCore/platform/gtk/GRefPtrGtk.cpp	2013-04-02 21:24:14 UTC (rev 147499)
@@ -20,12 +20,14 @@
 #include "config.h"
 #include "GRefPtrGtk.h"
 
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#if ENABLE(CREDENTIAL_STORAGE)
 #define SECRET_WITH_UNSTABLE 1
 #define SECRET_API_SUBJECT_TO_CHANGE 1
-
-#include <glib.h>
-#include <gtk/gtk.h>
 #include <libsecret/secret.h>
+#endif
 
 namespace WTF {
 
@@ -42,6 +44,7 @@
         gtk_target_list_unref(ptr);
 }
 
+#if ENABLE(CREDENTIAL_STORAGE)
 template <> SecretValue* refGPtr(SecretValue* ptr)
 {
     if (ptr)
@@ -54,6 +57,7 @@
     if (ptr)
         secret_value_unref(ptr);
 }
+#endif
 
 #ifdef GTK_API_VERSION_2
 template <> GdkCursor* refGPtr(GdkCursor* ptr)

Modified: trunk/Source/WebCore/platform/gtk/GRefPtrGtk.h (147498 => 147499)


--- trunk/Source/WebCore/platform/gtk/GRefPtrGtk.h	2013-04-02 21:23:55 UTC (rev 147498)
+++ trunk/Source/WebCore/platform/gtk/GRefPtrGtk.h	2013-04-02 21:24:14 UTC (rev 147499)
@@ -30,8 +30,10 @@
 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);

Modified: trunk/Source/WebCore/platform/network/gtk/CredentialBackingStore.cpp (147498 => 147499)


--- trunk/Source/WebCore/platform/network/gtk/CredentialBackingStore.cpp	2013-04-02 21:23:55 UTC (rev 147498)
+++ trunk/Source/WebCore/platform/network/gtk/CredentialBackingStore.cpp	2013-04-02 21:24:14 UTC (rev 147499)
@@ -1,5 +1,5 @@
 /*
- * 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 @@
     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 @@
 
     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 @@
         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 @@
         0, // cancellable
         0, // callback
         0); // data
+#endif // ENABLE(CREDENTIAL_STORAGE)
 }
 
 } // namespace WebCore

Modified: trunk/Source/autotools/FindDependencies.m4 (147498 => 147499)


--- trunk/Source/autotools/FindDependencies.m4	2013-04-02 21:23:55 UTC (rev 147498)
+++ trunk/Source/autotools/FindDependencies.m4	2013-04-02 21:24:14 UTC (rev 147499)
@@ -359,9 +359,11 @@
 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

Modified: trunk/Source/autotools/PrintBuildConfiguration.m4 (147498 => 147499)


--- trunk/Source/autotools/PrintBuildConfiguration.m4	2013-04-02 21:23:55 UTC (rev 147498)
+++ trunk/Source/autotools/PrintBuildConfiguration.m4	2013-04-02 21:24:14 UTC (rev 147499)
@@ -24,6 +24,7 @@
  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
 

Modified: trunk/Source/autotools/ReadCommandLineArguments.m4 (147498 => 147499)


--- trunk/Source/autotools/ReadCommandLineArguments.m4	2013-04-02 21:23:55 UTC (rev 147498)
+++ trunk/Source/autotools/ReadCommandLineArguments.m4	2013-04-02 21:24:14 UTC (rev 147499)
@@ -64,6 +64,13 @@
     [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]]),
     [],

Modified: trunk/Source/autotools/SetupAutoconfHeader.m4 (147498 => 147499)


--- trunk/Source/autotools/SetupAutoconfHeader.m4	2013-04-02 21:23:55 UTC (rev 147498)
+++ trunk/Source/autotools/SetupAutoconfHeader.m4	2013-04-02 21:24:14 UTC (rev 147499)
@@ -115,4 +115,7 @@
     AC_DEFINE([ENABLE_SPELLCHECK], [1], [ ])
 fi
 
+if test "$enable_credential_storage" = "yes"; then
+    AC_DEFINE([WTF_ENABLE_CREDENTIAL_STORAGE], [1], [ ])
+fi
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to