Title: [153009] branches/safari-537-branch/Source/WebKit2

Diff

Modified: branches/safari-537-branch/Source/WebKit2/ChangeLog (153008 => 153009)


--- branches/safari-537-branch/Source/WebKit2/ChangeLog	2013-07-22 22:33:15 UTC (rev 153008)
+++ branches/safari-537-branch/Source/WebKit2/ChangeLog	2013-07-22 23:34:44 UTC (rev 153009)
@@ -1,5 +1,34 @@
 2013-07-22  Lucas Forschler  <[email protected]>
 
+        Merge r152862
+
+    2013-07-18  Alexey Proskuryakov  <[email protected]>
+
+            <rdar://problem/13886443> Assertion failures in NetworkProcess in SandboxExtension::revoke when aborting SyncNetworkResourceLoader
+            <rdar://problem/13826348> ASSERT(!m_useCount) fails in NetworkProcess at SandboxExtension::~SandboxExtension
+            https://bugs.webkit.org/show_bug.cgi?id=118855
+
+            Reviewed by Brady Eidson.
+
+            * NetworkProcess/NetworkResourceLoader.cpp:
+            (WebKit::NetworkResourceLoader::cleanup):
+            (WebKit::NetworkResourceLoader::didFinishLoading):
+            (WebKit::NetworkResourceLoader::didFail):
+            Moved sandbox extension invalidation to cleanup() meaning that we won't fail to
+            do this when aborting a loader that currently loading from network.
+
+            * NetworkProcess/SchedulableLoader.cpp:
+            (WebKit::SchedulableLoader::SchedulableLoader):
+            (WebKit::SchedulableLoader::consumeSandboxExtensions):
+            (WebKit::SchedulableLoader::invalidateSandboxExtensions):
+            * NetworkProcess/SchedulableLoader.h:
+            Keep track of whether sandbox extensions are consumed, we don't want to revoke
+            extensions that were never consumed (as used to be the case with sync loaders,
+            and would be with async ones after the above fix). Also, get rid of extensions
+            immediately when invalidating, we won't need them again.
+
+2013-07-22  Lucas Forschler  <[email protected]>
+
         Merge r152824
 
     2013-07-17  Tim Horton  <[email protected]>

Modified: branches/safari-537-branch/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (153008 => 153009)


--- branches/safari-537-branch/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2013-07-22 22:33:15 UTC (rev 153008)
+++ branches/safari-537-branch/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2013-07-22 23:34:44 UTC (rev 153009)
@@ -86,6 +86,8 @@
 {
     ASSERT(isMainThread());
 
+    invalidateSandboxExtensions();
+
     if (FormData* formData = request().httpBody())
         formData->removeGeneratedFilesIfNeeded();
 
@@ -181,7 +183,6 @@
 
     // FIXME (NetworkProcess): For the memory cache we'll need to update the finished status of the cached resource here.
     // Such bookkeeping will need to be thread safe, as this callback is happening on a background thread.
-    invalidateSandboxExtensions();
     send(Messages::WebResourceLoader::DidFinishResourceLoad(finishTime));
     
     cleanup();
@@ -193,7 +194,6 @@
 
     // FIXME (NetworkProcess): For the memory cache we'll need to update the finished status of the cached resource here.
     // Such bookkeeping will need to be thread safe, as this callback is happening on a background thread.
-    invalidateSandboxExtensions();
     send(Messages::WebResourceLoader::DidFailResourceLoad(error));
     cleanup();
 }

Modified: branches/safari-537-branch/Source/WebKit2/NetworkProcess/SchedulableLoader.cpp (153008 => 153009)


--- branches/safari-537-branch/Source/WebKit2/NetworkProcess/SchedulableLoader.cpp	2013-07-22 22:33:15 UTC (rev 153008)
+++ branches/safari-537-branch/Source/WebKit2/NetworkProcess/SchedulableLoader.cpp	2013-07-22 23:34:44 UTC (rev 153009)
@@ -49,6 +49,7 @@
     , m_inPrivateBrowsingMode(parameters.inPrivateBrowsingMode)
     , m_shouldClearReferrerOnHTTPSToHTTPRedirect(parameters.shouldClearReferrerOnHTTPSToHTTPRedirect)
     , m_isLoadingMainResource(parameters.isMainResource)
+    , m_sandboxExtensionsAreConsumed(false)
     , m_connection(connection)
 {
     // Either this loader has both a webPageID and webFrameID, or it is not allowed to ask the client for authentication credentials.
@@ -93,15 +94,23 @@
 
     for (size_t i = 0, count = m_resourceSandboxExtensions.size(); i < count; ++i)
         m_resourceSandboxExtensions[i]->consume();
+
+    m_sandboxExtensionsAreConsumed = true;
 }
 
 void SchedulableLoader::invalidateSandboxExtensions()
 {
-    for (size_t i = 0, count = m_requestBodySandboxExtensions.size(); i < count; ++i)
-        m_requestBodySandboxExtensions[i]->revoke();
+    if (m_sandboxExtensionsAreConsumed) {
+        for (size_t i = 0, count = m_requestBodySandboxExtensions.size(); i < count; ++i)
+            m_requestBodySandboxExtensions[i]->revoke();
+        for (size_t i = 0, count = m_resourceSandboxExtensions.size(); i < count; ++i)
+            m_resourceSandboxExtensions[i]->revoke();
+    }
 
-    for (size_t i = 0, count = m_resourceSandboxExtensions.size(); i < count; ++i)
-        m_resourceSandboxExtensions[i]->revoke();
+    m_requestBodySandboxExtensions.clear();
+    m_resourceSandboxExtensions.clear();
+
+    m_sandboxExtensionsAreConsumed = false;
 }
 
 } // namespace WebKit

Modified: branches/safari-537-branch/Source/WebKit2/NetworkProcess/SchedulableLoader.h (153008 => 153009)


--- branches/safari-537-branch/Source/WebKit2/NetworkProcess/SchedulableLoader.h	2013-07-22 22:33:15 UTC (rev 153008)
+++ branches/safari-537-branch/Source/WebKit2/NetworkProcess/SchedulableLoader.h	2013-07-22 23:34:44 UTC (rev 153009)
@@ -88,6 +88,7 @@
 
     Vector<RefPtr<SandboxExtension>> m_requestBodySandboxExtensions;
     Vector<RefPtr<SandboxExtension>> m_resourceSandboxExtensions;
+    bool m_sandboxExtensionsAreConsumed;
 
     RefPtr<NetworkConnectionToWebProcess> m_connection;
     
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to