Title: [150206] trunk/Source
Revision
150206
Author
beid...@apple.com
Date
2013-05-16 14:02:11 -0700 (Thu, 16 May 2013)

Log Message

svg/as-image/img-zoom-svg-stylesheet.html crashes with NetworkProcess enabled.
<rdar://problem/13837408> and https://bugs.webkit.org/show_bug.cgi?id=115917

Reviewed by Sam Weinig.

Source/WebCore:

Give WebKit2 the ability to not mis-cast.

* loader/FrameLoaderClient.h:
(WebCore::FrameLoaderClient::isEmptyFrameLoaderClient): Defaults to false, and include a FIXME
  to remove it once https://bugs.webkit.org/show_bug.cgi?id=116233 is resolved.

* loader/EmptyClients.h: Make isEmptyFrameLoaderClient() return true, and add a FIXME to remove it.

Source/WebKit2:

* NetworkProcess/SchedulableLoader.cpp:
(WebKit::SchedulableLoader::SchedulableLoader): ASSERT that either there’s a frame and page ID, or
  that the client cannot be asked for credentials.

* WebProcess/Network/WebResourceLoadScheduler.cpp:
(WebKit::WebResourceLoadScheduler::scheduleLoad): Only cast the FrameLoaderClient and get WebFrame/WebPage
  if that is actually possible. Set the clientCredentialPolicy based on whether or not WebFrame/WebPage are
  available since they are needed to ask the UIProcess for credentials. ASSERT that either there’s both
  a frame and page ID or that the client won’t be asked for credentials.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (150205 => 150206)


--- trunk/Source/WebCore/ChangeLog	2013-05-16 20:50:06 UTC (rev 150205)
+++ trunk/Source/WebCore/ChangeLog	2013-05-16 21:02:11 UTC (rev 150206)
@@ -1,3 +1,18 @@
+2013-05-16  Brady Eidson  <beid...@apple.com>
+
+        svg/as-image/img-zoom-svg-stylesheet.html crashes with NetworkProcess enabled.
+        <rdar://problem/13837408> and https://bugs.webkit.org/show_bug.cgi?id=115917
+
+        Reviewed by Sam Weinig.
+
+        Give WebKit2 the ability to not mis-cast.
+
+        * loader/FrameLoaderClient.h:
+        (WebCore::FrameLoaderClient::isEmptyFrameLoaderClient): Defaults to false, and include a FIXME
+          to remove it once https://bugs.webkit.org/show_bug.cgi?id=116233 is resolved.
+
+        * loader/EmptyClients.h: Make isEmptyFrameLoaderClient() return true, and add a FIXME to remove it.
+
 2013-05-14  Martin Robinson  <mrobin...@igalia.com>
 
         [GTK] Add support for building WebCore to the cmake build

Modified: trunk/Source/WebCore/loader/EmptyClients.h (150205 => 150206)


--- trunk/Source/WebCore/loader/EmptyClients.h	2013-05-16 20:50:06 UTC (rev 150205)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2013-05-16 21:02:11 UTC (rev 150206)
@@ -209,6 +209,8 @@
     virtual bool shouldNotifyOnFormChanges() { return false; }
 };
 
+// FIXME (bug 116233): Get rid of EmptyFrameLoaderClient. It is a travesty.
+
 class EmptyFrameLoaderClient : public FrameLoaderClient {
     WTF_MAKE_NONCOPYABLE(EmptyFrameLoaderClient); WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -373,6 +375,8 @@
 #endif
 
     virtual PassRefPtr<FrameNetworkingContext> createNetworkingContext() OVERRIDE;
+
+    virtual bool isEmptyFrameLoaderClient() OVERRIDE { return true; }
 };
 
 class EmptyTextCheckerClient : public TextCheckerClient {

Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (150205 => 150206)


--- trunk/Source/WebCore/loader/FrameLoaderClient.h	2013-05-16 20:50:06 UTC (rev 150205)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h	2013-05-16 21:02:11 UTC (rev 150206)
@@ -348,6 +348,9 @@
         virtual void dispatchWillInsertBody() { }
 
         virtual void dispatchDidChangeResourcePriority(unsigned long /*identifier*/, ResourceLoadPriority) { }
+
+        // FIXME (bug 116233): We need to get rid of EmptyFrameLoaderClient completely, then this will no longer be needed.
+        virtual bool isEmptyFrameLoaderClient() { return false; }
     };
 
 } // namespace WebCore

Modified: trunk/Source/WebKit2/ChangeLog (150205 => 150206)


--- trunk/Source/WebKit2/ChangeLog	2013-05-16 20:50:06 UTC (rev 150205)
+++ trunk/Source/WebKit2/ChangeLog	2013-05-16 21:02:11 UTC (rev 150206)
@@ -1,3 +1,20 @@
+2013-05-16  Brady Eidson  <beid...@apple.com>
+
+        svg/as-image/img-zoom-svg-stylesheet.html crashes with NetworkProcess enabled.
+        <rdar://problem/13837408> and https://bugs.webkit.org/show_bug.cgi?id=115917
+
+        Reviewed by Sam Weinig.
+
+        * NetworkProcess/SchedulableLoader.cpp:
+        (WebKit::SchedulableLoader::SchedulableLoader): ASSERT that either there’s a frame and page ID, or
+          that the client cannot be asked for credentials.
+
+        * WebProcess/Network/WebResourceLoadScheduler.cpp:
+        (WebKit::WebResourceLoadScheduler::scheduleLoad): Only cast the FrameLoaderClient and get WebFrame/WebPage
+          if that is actually possible. Set the clientCredentialPolicy based on whether or not WebFrame/WebPage are
+          available since they are needed to ask the UIProcess for credentials. ASSERT that either there’s both
+          a frame and page ID or that the client won’t be asked for credentials.
+
 2013-05-16  Timothy Hatcher  <timo...@apple.com>
 
         Make the Find Banner in Safari work again with the docked Web Inspector.

Modified: trunk/Source/WebKit2/NetworkProcess/SchedulableLoader.cpp (150205 => 150206)


--- trunk/Source/WebKit2/NetworkProcess/SchedulableLoader.cpp	2013-05-16 20:50:06 UTC (rev 150205)
+++ trunk/Source/WebKit2/NetworkProcess/SchedulableLoader.cpp	2013-05-16 21:02:11 UTC (rev 150206)
@@ -51,6 +51,11 @@
     , m_isLoadingMainResource(parameters.isMainResource)
     , m_connection(connection)
 {
+    // Either this loader has both a webPageID and webFrameID, or it is not allowed to ask the client for authentication credentials.
+    // FIXME: This is necessary because of the existence of EmptyFrameLoaderClient in WebCore.
+    //        Once bug 116233 is resolved, this ASSERT can just be "m_webPageID && m_webFrameID"
+    ASSERT((m_webPageID && m_webFrameID) || m_clientCredentialPolicy == DoNotAskClientForAnyCredentials);
+
     for (size_t i = 0, count = parameters.requestBodySandboxExtensions.size(); i < count; ++i) {
         if (RefPtr<SandboxExtension> extension = SandboxExtension::create(parameters.requestBodySandboxExtensions[i]))
             m_requestBodySandboxExtensions.append(extension);

Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp (150205 => 150206)


--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp	2013-05-16 20:50:06 UTC (rev 150205)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp	2013-05-16 21:02:11 UTC (rev 150206)
@@ -105,22 +105,32 @@
     StoredCredentials allowStoredCredentials = resourceLoader->shouldUseCredentialStorage() ? AllowStoredCredentials : DoNotAllowStoredCredentials;
     bool privateBrowsingEnabled = resourceLoader->frameLoader()->frame()->settings()->privateBrowsingEnabled();
 
-    WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(resourceLoader->frameLoader()->client())->webFrame();
-    WebPage* webPage = webFrame->page();
+    // FIXME: Some entities in WebCore use WebCore's "EmptyFrameLoaderClient" instead of having a proper WebFrameLoaderClient.
+    // EmptyFrameLoaderClient shouldn't exist and everything should be using a WebFrameLoaderClient,
+    // but in the meantime we have to make sure not to mis-cast.
+    WebFrame* webFrame = 0;
+    WebPage* webPage = 0;
+    if (!resourceLoader->frameLoader()->client()->isEmptyFrameLoaderClient()) {
+        webFrame = static_cast<WebFrameLoaderClient*>(resourceLoader->frameLoader()->client())->webFrame();
+        webPage = webFrame->page();
+    }
 
     NetworkResourceLoadParameters loadParameters;
     loadParameters.identifier = identifier;
-    loadParameters.webPageID = webPage->pageID();
-    loadParameters.webFrameID = webFrame->frameID();
+    loadParameters.webPageID = webPage ? webPage->pageID() : 0;
+    loadParameters.webFrameID = webFrame ? webFrame->frameID() : 0;
     loadParameters.request = resourceLoader->request();
     loadParameters.priority = priority;
     loadParameters.contentSniffingPolicy = contentSniffingPolicy;
     loadParameters.allowStoredCredentials = allowStoredCredentials;
-    loadParameters.clientCredentialPolicy = resourceLoader->clientCredentialPolicy();
+    // If there is no WebFrame then this resource cannot be authenticated with the client.
+    loadParameters.clientCredentialPolicy = (webFrame && webPage) ? resourceLoader->clientCredentialPolicy() : DoNotAskClientForAnyCredentials;
     loadParameters.inPrivateBrowsingMode = privateBrowsingEnabled;
     loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = shouldClearReferrerOnHTTPSToHTTPRedirect;
     loadParameters.isMainResource = resource && resource->type() == CachedResource::MainResource;
 
+    ASSERT((loadParameters.webPageID && loadParameters.webFrameID) || loadParameters.clientCredentialPolicy == DoNotAskClientForAnyCredentials);
+
     if (!WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::ScheduleResourceLoad(loadParameters), 0)) {
         // We probably failed to schedule this load with the NetworkProcess because it had crashed.
         // This load will never succeed so we will schedule it to fail asynchronously.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to