Title: [136404] trunk/Source
Revision
136404
Author
[email protected]
Date
2012-12-03 09:01:57 -0800 (Mon, 03 Dec 2012)

Log Message

Document::initSecurityContext() fails to call securityOrigin().grantLoadLocalResources()
https://bugs.webkit.org/show_bug.cgi?id=68711

Reviewed by Adam Barth.

Source/WebCore:

It currently fails since Document::loader() will return 0 until
Frame::setDocument is called and we are doing this check before it happens.

Delay the check and let the FrameLoader take care of doing grantLoadLocalResources()
on the Document along with other header checks in FrameLoader::didBeginDocument.

* dom/Document.cpp:
(WebCore::Document::initSecurityContext):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didBeginDocument):

Source/WebKit/qt:

* tests/qwebpage/tst_qwebpage.cpp:
(tst_QWebPage::testStopScheduledPageRefresh): Unmark the expected failure.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136403 => 136404)


--- trunk/Source/WebCore/ChangeLog	2012-12-03 16:25:29 UTC (rev 136403)
+++ trunk/Source/WebCore/ChangeLog	2012-12-03 17:01:57 UTC (rev 136404)
@@ -1,3 +1,21 @@
+2012-12-03  Jocelyn Turcotte  <[email protected]>
+
+        Document::initSecurityContext() fails to call securityOrigin().grantLoadLocalResources()
+        https://bugs.webkit.org/show_bug.cgi?id=68711
+
+        Reviewed by Adam Barth.
+
+        It currently fails since Document::loader() will return 0 until
+        Frame::setDocument is called and we are doing this check before it happens.
+
+        Delay the check and let the FrameLoader take care of doing grantLoadLocalResources()
+        on the Document along with other header checks in FrameLoader::didBeginDocument.
+
+        * dom/Document.cpp:
+        (WebCore::Document::initSecurityContext):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::didBeginDocument):
+
 2012-12-03  Yong Li  <[email protected]>
 
         ENABLE(IMAGE_DECODER_DOWN_SAMPLING): Should use TURBO_JPEG_RGB_SWIZZLE fast path for non-scaled images

Modified: trunk/Source/WebCore/dom/Document.cpp (136403 => 136404)


--- trunk/Source/WebCore/dom/Document.cpp	2012-12-03 16:25:29 UTC (rev 136403)
+++ trunk/Source/WebCore/dom/Document.cpp	2012-12-03 17:01:57 UTC (rev 136404)
@@ -4556,17 +4556,6 @@
     setSecurityOrigin(isSandboxed(SandboxOrigin) ? SecurityOrigin::createUnique() : SecurityOrigin::create(m_url));
     setContentSecurityPolicy(ContentSecurityPolicy::create(this));
 
-    if (SecurityPolicy::allowSubstituteDataAccessToLocal()) {
-        // 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.
-        
-        DocumentLoader* documentLoader = loader();
-        if (documentLoader && documentLoader->substituteData().isValid())
-            securityOrigin()->grantLoadLocalResources();
-    }
-
     if (Settings* settings = this->settings()) {
         if (!settings->webSecurityEnabled()) {
             // Web security is turned off. We should let this document access every other document. This is used primary by testing

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (136403 => 136404)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2012-12-03 16:25:29 UTC (rev 136403)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2012-12-03 17:01:57 UTC (rev 136404)
@@ -676,6 +676,14 @@
             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();

Modified: trunk/Source/WebKit/qt/ChangeLog (136403 => 136404)


--- trunk/Source/WebKit/qt/ChangeLog	2012-12-03 16:25:29 UTC (rev 136403)
+++ trunk/Source/WebKit/qt/ChangeLog	2012-12-03 17:01:57 UTC (rev 136404)
@@ -1,3 +1,13 @@
+2012-12-03  Jocelyn Turcotte  <[email protected]>
+
+        Document::initSecurityContext() fails to call securityOrigin().grantLoadLocalResources()
+        https://bugs.webkit.org/show_bug.cgi?id=68711
+
+        Reviewed by Adam Barth.
+
+        * tests/qwebpage/tst_qwebpage.cpp:
+        (tst_QWebPage::testStopScheduledPageRefresh): Unmark the expected failure.
+
 2012-12-03  Pierre Rossi  <[email protected]>
 
         [Qt] Use a separate QWEBKITWIDGETS_EXPORT macro for WebKitWidgets

Modified: trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp (136403 => 136404)


--- trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp	2012-12-03 16:25:29 UTC (rev 136403)
+++ trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp	2012-12-03 17:01:57 UTC (rev 136404)
@@ -2932,10 +2932,8 @@
                                 "<meta http-equiv=\"refresh\"content=\"0;URL=""
                                 "</head><body><h1>Page redirects immediately...</h1>"
                                 "</body></html>");
-    QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=63245", Continue);
     QVERIFY(::waitForSignal(&page1, SIGNAL(loadFinished(bool))));
     QTest::qWait(500);
-    QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=63245", Continue);
     QCOMPARE(page1.mainFrame()->url(), QUrl(QLatin1String("qrc:///resources/index.html")));
     
     // With QWebPage::StopScheduledPageRefresh
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to