Title: [147165] trunk
Revision
147165
Author
[email protected]
Date
2013-03-28 14:58:19 -0700 (Thu, 28 Mar 2013)

Log Message

Source/WebCore: Don't grant local content permissions for appcache loads.
https://bugs.webkit.org/show_bug.cgi?id=112542

Reviewed by Antti Koivisto.

No new tests, fixing http/tests/appcache/local-content.html

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::DocumentLoader):
(WebCore::DocumentLoader::commitData): Don't grant local load permissions
    to all SubstituteData loads, only give them to loads that were SubstituteData
    loads at the time of DocumentLoader construction. This constitutes all
    SubstituteData loads except those triggered by appcache.
* loader/DocumentLoader.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didBeginDocument): Move granting local load
    permissions for SubstituteData loads to DocumentLoader::commitData().

LayoutTests: Remove expected failure for https://bugs.webkit.org/show_bug.cgi?id=112542

Reviewed by Antti Koivisto.

* platform/qt-5.0-wk1/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (147164 => 147165)


--- trunk/LayoutTests/ChangeLog	2013-03-28 21:56:07 UTC (rev 147164)
+++ trunk/LayoutTests/ChangeLog	2013-03-28 21:58:19 UTC (rev 147165)
@@ -1,3 +1,11 @@
+2013-03-28  Nate Chapin  <[email protected]>
+
+        Remove expected failure for https://bugs.webkit.org/show_bug.cgi?id=112542
+
+        Reviewed by Antti Koivisto.
+
+        * platform/qt-5.0-wk1/TestExpectations:
+
 2013-03-28  Mike West  <[email protected]>
 
         X-Frame-Options: Blocked resources should fire load events.

Modified: trunk/LayoutTests/platform/qt-5.0-wk1/TestExpectations (147164 => 147165)


--- trunk/LayoutTests/platform/qt-5.0-wk1/TestExpectations	2013-03-28 21:56:07 UTC (rev 147164)
+++ trunk/LayoutTests/platform/qt-5.0-wk1/TestExpectations	2013-03-28 21:58:19 UTC (rev 147165)
@@ -160,6 +160,3 @@
 webkit.org/b/112333 css3/compositing/blend-mode-property.html [ Skip ]
 webkit.org/b/112333 css3/compositing/should-have-compositing-layer.html [ Skip ]
 webkit.org/b/112333 transitions/blendmode-transitions.html  [ Skip ]
-
-# [Qt][WK1] REGRESSION(r145973): http/tests/appcache/local-content.html fails
-webkit.org/b/112542 http/tests/appcache/local-content.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (147164 => 147165)


--- trunk/Source/WebCore/ChangeLog	2013-03-28 21:56:07 UTC (rev 147164)
+++ trunk/Source/WebCore/ChangeLog	2013-03-28 21:58:19 UTC (rev 147165)
@@ -1,3 +1,23 @@
+2013-03-28  Nate Chapin  <[email protected]>
+
+        Don't grant local content permissions for appcache loads.
+        https://bugs.webkit.org/show_bug.cgi?id=112542
+
+        Reviewed by Antti Koivisto.
+
+        No new tests, fixing http/tests/appcache/local-content.html
+
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::DocumentLoader):
+        (WebCore::DocumentLoader::commitData): Don't grant local load permissions
+            to all SubstituteData loads, only give them to loads that were SubstituteData
+            loads at the time of DocumentLoader construction. This constitutes all
+            SubstituteData loads except those triggered by appcache.
+        * loader/DocumentLoader.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::didBeginDocument): Move granting local load
+            permissions for SubstituteData loads to DocumentLoader::commitData().
+
 2013-03-28  Mike West  <[email protected]>
 
         X-Frame-Options: Blocked resources should fire load events.

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (147164 => 147165)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2013-03-28 21:56:07 UTC (rev 147164)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2013-03-28 21:58:19 UTC (rev 147165)
@@ -54,6 +54,7 @@
 #include "ProgressTracker.h"
 #include "ResourceBuffer.h"
 #include "SchemeRegistry.h"
+#include "SecurityPolicy.h"
 #include "Settings.h"
 #include "SubresourceLoader.h"
 #include "TextResourceDecoder.h"
@@ -103,6 +104,7 @@
     , m_substituteData(substituteData)
     , m_originalRequestCopy(req)
     , m_request(req)
+    , m_originalSubstituteDataWasValid(substituteData.isValid())
     , m_committed(false)
     , m_isStopping(false)
     , m_gotFirstByte(false)
@@ -760,6 +762,14 @@
         m_writer.begin(documentURL(), false);
         m_writer.setDocumentWasLoadedAsPartOfNavigation();
 
+        if (SecurityPolicy::allowSubstituteDataAccessToLocal() && m_originalSubstituteDataWasValid) {
+            // If this document was loaded with substituteData, then the document can
+            // load local resources. See https://bugs.webkit.org/show_bug.cgi?id=16756
+            // and https://bugs.webkit.org/show_bug.cgi?id=19760 for further
+            // discussion.
+            m_frame->document()->securityOrigin()->grantLoadLocalResources();
+        }
+
         if (frameLoader()->stateMachine()->creatingInitialEmptyDocument())
             return;
         

Modified: trunk/Source/WebCore/loader/DocumentLoader.h (147164 => 147165)


--- trunk/Source/WebCore/loader/DocumentLoader.h	2013-03-28 21:56:07 UTC (rev 147164)
+++ trunk/Source/WebCore/loader/DocumentLoader.h	2013-03-28 21:58:19 UTC (rev 147165)
@@ -343,6 +343,7 @@
     
         ResourceError m_mainDocumentError;    
 
+        bool m_originalSubstituteDataWasValid;
         bool m_committed;
         bool m_isStopping;
         bool m_gotFirstByte;

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (147164 => 147165)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2013-03-28 21:56:07 UTC (rev 147164)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2013-03-28 21:58:19 UTC (rev 147165)
@@ -683,14 +683,6 @@
             if (!headerContentLanguage.isEmpty())
                 m_frame->document()->setContentLanguage(headerContentLanguage);
         }
-
-        if (SecurityPolicy::allowSubstituteDataAccessToLocal() && m_documentLoader->substituteData().isValid()) {
-            // If this document was loaded with substituteData, then the document can
-            // load local resources. See https://bugs.webkit.org/show_bug.cgi?id=16756
-            // and https://bugs.webkit.org/show_bug.cgi?id=19760 for further
-            // discussion.
-            m_frame->document()->securityOrigin()->grantLoadLocalResources();
-        }
     }
 
     history()->restoreDocumentState();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to