Title: [195202] releases/WebKitGTK/webkit-2.10
Revision
195202
Author
[email protected]
Date
2016-01-18 04:05:46 -0800 (Mon, 18 Jan 2016)

Log Message

Merge r194480 - [SOUP] REGRESSION(r192761): Broke resource URIs for applications that use g_resource_load in a web extension
https://bugs.webkit.org/show_bug.cgi?id=152634

Reviewed by Carlos Garcia Campos.

Source/WebKit2:

Load GResource URIs locally, not in the network process. Applications expect calling
g_resource_load in a web extension to make it possible to load resource URIs, but that
doesn't work now that the network process is in use. Loading them locally solves this.

* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoad):

Tools:

* TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp:
(testLoadFromGResource): Added test.
(beforeAll):
* TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp:
(registerGResource): Added.
(webkit_web_extension_initialize_with_user_data): Load the test gresource.
* TestWebKitAPI/Tests/WebKit2Gtk/resources/boring.html: Added.
* TestWebKitAPI/Tests/WebKit2Gtk/resources/webkit2gtk-tests.gresource.xml: Add an HTML file.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.10/Source/WebKit2/ChangeLog (195201 => 195202)


--- releases/WebKitGTK/webkit-2.10/Source/WebKit2/ChangeLog	2016-01-18 11:55:26 UTC (rev 195201)
+++ releases/WebKitGTK/webkit-2.10/Source/WebKit2/ChangeLog	2016-01-18 12:05:46 UTC (rev 195202)
@@ -1,3 +1,17 @@
+2016-01-01  Michael Catanzaro  <[email protected]>
+
+        [SOUP] REGRESSION(r192761): Broke resource URIs for applications that use g_resource_load in a web extension
+        https://bugs.webkit.org/show_bug.cgi?id=152634
+
+        Reviewed by Carlos Garcia Campos.
+
+        Load GResource URIs locally, not in the network process. Applications expect calling
+        g_resource_load in a web extension to make it possible to load resource URIs, but that
+        doesn't work now that the network process is in use. Loading them locally solves this.
+
+        * WebProcess/Network/WebLoaderStrategy.cpp:
+        (WebKit::WebLoaderStrategy::scheduleLoad):
+
 2015-12-09  Mario Sanchez Prada  <[email protected]>
 
         [GTK] Crash in WebProcess when loading large content with custom URI schemes

Modified: releases/WebKitGTK/webkit-2.10/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp (195201 => 195202)


--- releases/WebKitGTK/webkit-2.10/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp	2016-01-18 11:55:26 UTC (rev 195201)
+++ releases/WebKitGTK/webkit-2.10/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp	2016-01-18 12:05:46 UTC (rev 195202)
@@ -155,6 +155,16 @@
     }
 #endif
 
+#if USE(SOUP)
+    // For apps that call g_resource_load in a web extension.
+    // https://blogs.gnome.org/alexl/2012/01/26/resources-in-glib/
+    if (resourceLoader->request().url().protocolIs("resource")) {
+        LOG(NetworkScheduling, "(WebProcess) WebResourceLoadScheduler::scheduleLoad, url '%s' will be handled as a GResource.", resourceLoader->url().string().utf8().data());
+        startLocalLoad(*resourceLoader);
+        return;
+    }
+#endif
+
     LOG(NetworkScheduling, "(WebProcess) WebResourceLoadScheduler::scheduleLoad, url '%s' will be scheduled with the NetworkProcess with priority %u", resourceLoader->url().string().utf8().data(), resourceLoader->request().priority());
 
     ContentSniffingPolicy contentSniffingPolicy = resourceLoader->shouldSniffContent() ? SniffContent : DoNotSniffContent;

Modified: releases/WebKitGTK/webkit-2.10/Tools/ChangeLog (195201 => 195202)


--- releases/WebKitGTK/webkit-2.10/Tools/ChangeLog	2016-01-18 11:55:26 UTC (rev 195201)
+++ releases/WebKitGTK/webkit-2.10/Tools/ChangeLog	2016-01-18 12:05:46 UTC (rev 195202)
@@ -1,3 +1,19 @@
+2016-01-01  Michael Catanzaro  <[email protected]>
+
+        [SOUP] REGRESSION(r192761): Broke resource URIs for applications that use g_resource_load in a web extension
+        https://bugs.webkit.org/show_bug.cgi?id=152634
+
+        Reviewed by Carlos Garcia Campos.
+
+        * TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp:
+        (testLoadFromGResource): Added test.
+        (beforeAll):
+        * TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp:
+        (registerGResource): Added.
+        (webkit_web_extension_initialize_with_user_data): Load the test gresource.
+        * TestWebKitAPI/Tests/WebKit2Gtk/resources/boring.html: Added.
+        * TestWebKitAPI/Tests/WebKit2Gtk/resources/webkit2gtk-tests.gresource.xml: Add an HTML file.
+
 2015-12-21  Michael Catanzaro  <[email protected]>
 
         [GTK] jquery.min.js violates DFSG

Modified: releases/WebKitGTK/webkit-2.10/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp (195201 => 195202)


--- releases/WebKitGTK/webkit-2.10/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp	2016-01-18 11:55:26 UTC (rev 195201)
+++ releases/WebKitGTK/webkit-2.10/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp	2016-01-18 12:05:46 UTC (rev 195202)
@@ -116,6 +116,14 @@
     assertNormalLoadHappened(test->m_loadEvents);
 }
 
+static void testLoadFromGResource(LoadTrackingTest* test, gconstpointer)
+{
+    GRefPtr<WebKitURIRequest> request(webkit_uri_request_new("resource:///org/webkit/webkit2gtk/tests/boring.html"));
+    test->loadRequest(request.get());
+    test->waitUntilLoadFinished();
+    assertNormalLoadHappened(test->m_loadEvents);
+}
+
 class LoadStopTrackingTest : public LoadTrackingTest {
 public:
     MAKE_GLIB_TEST_FIXTURE(LoadStopTrackingTest);
@@ -503,6 +511,7 @@
     LoadTrackingTest::add("WebKitWebView", "load-plain-text", testLoadPlainText);
     LoadTrackingTest::add("WebKitWebView", "load-bytes", testLoadBytes);
     LoadTrackingTest::add("WebKitWebView", "load-request", testLoadRequest);
+    LoadTrackingTest::add("WebKitWebView", "load-gresource", testLoadFromGResource);
     LoadStopTrackingTest::add("WebKitWebView", "stop-loading", testLoadCancelled);
     LoadTrackingTest::add("WebKitWebView", "title", testWebViewTitle);
     LoadTrackingTest::add("WebKitWebView", "progress", testLoadProgress);

Modified: releases/WebKitGTK/webkit-2.10/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp (195201 => 195202)


--- releases/WebKitGTK/webkit-2.10/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp	2016-01-18 11:55:26 UTC (rev 195201)
+++ releases/WebKitGTK/webkit-2.10/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp	2016-01-18 12:05:46 UTC (rev 195202)
@@ -354,11 +354,23 @@
     }
 }
 
+static void registerGResource(void)
+{
+    GUniquePtr<char> resourcesPath(g_build_filename(WEBKIT_EXEC_PATH, "TestWebKitAPI", "WebKit2Gtk", "resources", "webkit2gtk-tests-resources.gresource", nullptr));
+    GResource* resource = g_resource_load(resourcesPath.get(), nullptr);
+    g_assert(resource);
+
+    g_resources_register(resource);
+    g_resource_unref(resource);
+}
+
 extern "C" void webkit_web_extension_initialize_with_user_data(WebKitWebExtension* extension, GVariant* userData)
 {
     g_signal_connect(extension, "page-created", G_CALLBACK(pageCreatedCallback), extension);
     g_signal_connect(webkit_script_world_get_default(), "window-object-cleared", G_CALLBACK(windowObjectCleared), 0);
 
+    registerGResource();
+
     g_assert(userData);
     g_assert(g_variant_is_of_type(userData, G_VARIANT_TYPE_UINT32));
     GUniquePtr<char> busName(g_strdup_printf("org.webkit.gtk.WebExtensionTest%u", g_variant_get_uint32(userData)));

Added: releases/WebKitGTK/webkit-2.10/Tools/TestWebKitAPI/Tests/WebKit2Gtk/resources/boring.html (0 => 195202)


--- releases/WebKitGTK/webkit-2.10/Tools/TestWebKitAPI/Tests/WebKit2Gtk/resources/boring.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.10/Tools/TestWebKitAPI/Tests/WebKit2Gtk/resources/boring.html	2016-01-18 12:05:46 UTC (rev 195202)
@@ -0,0 +1 @@
+<p>This is a boring HTML file.</p>

Modified: releases/WebKitGTK/webkit-2.10/Tools/TestWebKitAPI/Tests/WebKit2Gtk/resources/webkit2gtk-tests.gresource.xml (195201 => 195202)


--- releases/WebKitGTK/webkit-2.10/Tools/TestWebKitAPI/Tests/WebKit2Gtk/resources/webkit2gtk-tests.gresource.xml	2016-01-18 11:55:26 UTC (rev 195201)
+++ releases/WebKitGTK/webkit-2.10/Tools/TestWebKitAPI/Tests/WebKit2Gtk/resources/webkit2gtk-tests.gresource.xml	2016-01-18 12:05:46 UTC (rev 195202)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
   <gresource prefix="/org/webkit/webkit2gtk/tests/">
+    <file alias="boring.html">Tools/TestWebKitAPI/Tests/WebKit2Gtk/resources/boring.html</file>
     <file alias="link-title.js">Tools/TestWebKitAPI/Tests/WebKit2Gtk/resources/link-title.js</file>
   </gresource>
 </gresources>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to