Title: [186099] trunk/Source
Revision
186099
Author
beid...@apple.com
Date
2015-06-29 17:32:20 -0700 (Mon, 29 Jun 2015)

Log Message

Flag sync XHRs from the network process so they can be handled appropriately.
<rdar://problem/21579162> and https://bugs.webkit.org/show_bug.cgi?id=146441

Reviewed by Darin Adler.

Source/WebCore:

* platform/network/ResourceHandleClient.h:
(WebCore::ResourceHandleClient::loadingSynchronousXHR): Added so clients of asynchronous
  loads can signal they should be treated like synchronous loads at the platform level.

* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::ResourceHandle::start): Adjust SchedulingBehavior based on the client.

* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::start): Adjust SchedulingBehavior based on the client.

Source/WebKit2:

* NetworkProcess/NetworkResourceLoader.h:
(WebKit::NetworkResourceLoader::loadingSynchronousXHR): Return isSynchronous().

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (186098 => 186099)


--- trunk/Source/WebCore/ChangeLog	2015-06-30 00:27:29 UTC (rev 186098)
+++ trunk/Source/WebCore/ChangeLog	2015-06-30 00:32:20 UTC (rev 186099)
@@ -1,3 +1,20 @@
+2015-06-29  Brady Eidson  <beid...@apple.com>
+
+        Flag sync XHRs from the network process so they can be handled appropriately.
+        <rdar://problem/21579162> and https://bugs.webkit.org/show_bug.cgi?id=146441
+
+        Reviewed by Darin Adler.
+
+        * platform/network/ResourceHandleClient.h:
+        (WebCore::ResourceHandleClient::loadingSynchronousXHR): Added so clients of asynchronous
+          loads can signal they should be treated like synchronous loads at the platform level.
+
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::ResourceHandle::start): Adjust SchedulingBehavior based on the client.
+
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::start): Adjust SchedulingBehavior based on the client.
+
 2015-06-29  Chris Fleizach  <cfleiz...@apple.com>
 
         AX: PlatformSpeechSynthesizer code doesn't catch Objective-C exceptions

Modified: trunk/Source/WebCore/platform/network/ResourceHandleClient.h (186098 => 186099)


--- trunk/Source/WebCore/platform/network/ResourceHandleClient.h	2015-06-30 00:27:29 UTC (rev 186098)
+++ trunk/Source/WebCore/platform/network/ResourceHandleClient.h	2015-06-30 00:32:20 UTC (rev 186099)
@@ -84,6 +84,8 @@
 
         virtual bool usesAsyncCallbacks() { return false; }
 
+        virtual bool loadingSynchronousXHR() { return false; }
+
         // Client will pass an updated request using ResourceHandle::continueWillSendRequest() when ready.
         WEBCORE_EXPORT virtual void willSendRequestAsync(ResourceHandle*, const ResourceRequest&, const ResourceResponse& redirectResponse);
 

Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (186098 => 186099)


--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2015-06-30 00:27:29 UTC (rev 186098)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2015-06-30 00:32:20 UTC (rev 186099)
@@ -256,8 +256,10 @@
     setCollectsTimingData();
 #endif
 
-    createCFURLConnection(shouldUseCredentialStorage, d->m_shouldContentSniff, SchedulingBehavior::Asynchronous, client()->connectionProperties(this).get());
+    SchedulingBehavior schedulingBehavior = client()->loadingSynchronousXHR() ? SchedulingBehavior::Synchronous : SchedulingBehavior::Asynchronous;
 
+    createCFURLConnection(shouldUseCredentialStorage, d->m_shouldContentSniff, schedulingBehavior, client()->connectionProperties(this).get());
+
     d->m_connectionDelegate->setupConnectionScheduling(d->m_connection.get());
     CFURLConnectionStart(d->m_connection.get());
 

Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (186098 => 186099)


--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2015-06-30 00:27:29 UTC (rev 186098)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2015-06-30 00:32:20 UTC (rev 186099)
@@ -246,18 +246,20 @@
     // FIXME: Do not use the sync version of shouldUseCredentialStorage when the client returns true from usesAsyncCallbacks.
     bool shouldUseCredentialStorage = !client() || client()->shouldUseCredentialStorage(this);
 
+    SchedulingBehavior schedulingBehavior = client() && client()->loadingSynchronousXHR() ? SchedulingBehavior::Synchronous : SchedulingBehavior::Asynchronous;
+
 #if !PLATFORM(IOS)
     createNSURLConnection(
         ResourceHandle::makeDelegate(shouldUseCredentialStorage),
         shouldUseCredentialStorage,
         d->m_shouldContentSniff || d->m_context->localFileContentSniffingEnabled(),
-        SchedulingBehavior::Asynchronous);
+        schedulingBehavior);
 #else
     createNSURLConnection(
         ResourceHandle::makeDelegate(shouldUseCredentialStorage),
         shouldUseCredentialStorage,
         d->m_shouldContentSniff || d->m_context->localFileContentSniffingEnabled(),
-        SchedulingBehavior::Asynchronous,
+        schedulingBehavior,
         (NSDictionary *)client()->connectionProperties(this).get());
 #endif
 

Modified: trunk/Source/WebKit2/ChangeLog (186098 => 186099)


--- trunk/Source/WebKit2/ChangeLog	2015-06-30 00:27:29 UTC (rev 186098)
+++ trunk/Source/WebKit2/ChangeLog	2015-06-30 00:32:20 UTC (rev 186099)
@@ -1,3 +1,13 @@
+2015-06-29  Brady Eidson  <beid...@apple.com>
+
+        Flag sync XHRs from the network process so they can be handled appropriately.
+        <rdar://problem/21579162> and https://bugs.webkit.org/show_bug.cgi?id=146441
+
+        Reviewed by Darin Adler.
+
+        * NetworkProcess/NetworkResourceLoader.h:
+        (WebKit::NetworkResourceLoader::loadingSynchronousXHR): Return isSynchronous().
+
 2015-06-29  Anders Carlsson  <ander...@apple.com>
 
         Remove an empty group from the Xcode project.

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h (186098 => 186099)


--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h	2015-06-30 00:27:29 UTC (rev 186098)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h	2015-06-30 00:32:20 UTC (rev 186099)
@@ -132,6 +132,8 @@
     virtual void didCancelAuthenticationChallenge(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) override;
     virtual void receivedCancellation(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) override;
     virtual bool usesAsyncCallbacks() override { return true; }
+    virtual bool loadingSynchronousXHR() override { return isSynchronous(); }
+
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     virtual void canAuthenticateAgainstProtectionSpaceAsync(WebCore::ResourceHandle*, const WebCore::ProtectionSpace&) override;
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to