Title: [235602] trunk
Revision
235602
Author
[email protected]
Date
2018-09-03 16:17:22 -0700 (Mon, 03 Sep 2018)

Log Message

REGRESSION: Layout Test http/tests/security/bypassing-cors-checks-for-extension-urls.html is Flaky
https://bugs.webkit.org/show_bug.cgi?id=187658
<rdar://problem/42306442>

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Test is flaky as a previous test was setting the isRunningUserScripts state on the Page and it was never reset.
This patch moves this state to the topDocument so that it will be reset for every navigation.
Covered by existing test being no longer flaky.

* dom/Document.h:
(WebCore::Document::setAsRunningUserScripts):
(WebCore::Document::isRunningUserScripts const):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
* page/Frame.cpp:
(WebCore::Frame::injectUserScriptImmediately):
* page/Page.h:
(WebCore::Page::setAsRunningUserScripts): Deleted.
(WebCore::Page::isRunningUserScripts const): Deleted.
* testing/Internals.cpp:
(WebCore::Internals::setAsRunningUserScripts):

LayoutTests:

* platform/mac-wk2/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (235601 => 235602)


--- trunk/LayoutTests/ChangeLog	2018-09-03 19:18:36 UTC (rev 235601)
+++ trunk/LayoutTests/ChangeLog	2018-09-03 23:17:22 UTC (rev 235602)
@@ -1,3 +1,13 @@
+2018-09-03  Youenn Fablet  <[email protected]>
+
+        REGRESSION: Layout Test http/tests/security/bypassing-cors-checks-for-extension-urls.html is Flaky
+        https://bugs.webkit.org/show_bug.cgi?id=187658
+        <rdar://problem/42306442>
+
+        Reviewed by Alexey Proskuryakov.
+
+        * platform/mac-wk2/TestExpectations:
+
 2018-09-03  Andy Estes  <[email protected]>
 
         [Payment Request] Implement the MerchantValidationEvent constructor

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (235601 => 235602)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2018-09-03 19:18:36 UTC (rev 235601)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2018-09-03 23:17:22 UTC (rev 235602)
@@ -833,8 +833,6 @@
 
 webkit.org/b/186425 [ Debug ] inspector/console/webcore-logging.html [ Pass Failure ]
 
-webkit.org/b/187658 http/tests/security/bypassing-cors-checks-for-extension-urls.html [ Pass Failure ]
-
 [ Mojave+ ] fast/canvas/webgl/context-update-on-display-configuration.html [ Pass ]
 
 # skip manual payment-request tests

Modified: trunk/Source/WebCore/ChangeLog (235601 => 235602)


--- trunk/Source/WebCore/ChangeLog	2018-09-03 19:18:36 UTC (rev 235601)
+++ trunk/Source/WebCore/ChangeLog	2018-09-03 23:17:22 UTC (rev 235602)
@@ -1,3 +1,28 @@
+2018-09-03  Youenn Fablet  <[email protected]>
+
+        REGRESSION: Layout Test http/tests/security/bypassing-cors-checks-for-extension-urls.html is Flaky
+        https://bugs.webkit.org/show_bug.cgi?id=187658
+        <rdar://problem/42306442>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Test is flaky as a previous test was setting the isRunningUserScripts state on the Page and it was never reset.
+        This patch moves this state to the topDocument so that it will be reset for every navigation.
+        Covered by existing test being no longer flaky.
+
+        * dom/Document.h:
+        (WebCore::Document::setAsRunningUserScripts):
+        (WebCore::Document::isRunningUserScripts const):
+        * loader/DocumentThreadableLoader.cpp:
+        (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
+        * page/Frame.cpp:
+        (WebCore::Frame::injectUserScriptImmediately):
+        * page/Page.h:
+        (WebCore::Page::setAsRunningUserScripts): Deleted.
+        (WebCore::Page::isRunningUserScripts const): Deleted.
+        * testing/Internals.cpp:
+        (WebCore::Internals::setAsRunningUserScripts):
+
 2018-09-03  Andy Estes  <[email protected]>
 
         [Payment Request] Implement the MerchantValidationEvent constructor

Modified: trunk/Source/WebCore/dom/Document.h (235601 => 235602)


--- trunk/Source/WebCore/dom/Document.h	2018-09-03 19:18:36 UTC (rev 235601)
+++ trunk/Source/WebCore/dom/Document.h	2018-09-03 23:17:22 UTC (rev 235602)
@@ -1486,6 +1486,9 @@
     void updateMainArticleElementAfterLayout();
     bool hasMainArticleElement() const { return !!m_mainArticleElement; }
 
+    void setAsRunningUserScripts() { m_isRunningUserScripts = true; }
+    bool isRunningUserScripts() const { return m_isRunningUserScripts; }
+
 protected:
     enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 };
     Document(Frame*, const URL&, unsigned = DefaultDocumentClass, unsigned constructionFlags = 0);
@@ -2014,6 +2017,8 @@
 #endif
     
     std::unique_ptr<UserGestureIndicator> m_temporaryUserGesture;
+
+    bool m_isRunningUserScripts { false };
 };
 
 Element* eventTargetElementForDocument(Document*);

Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (235601 => 235602)


--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp	2018-09-03 19:18:36 UTC (rev 235601)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp	2018-09-03 23:17:22 UTC (rev 235602)
@@ -146,7 +146,7 @@
     if (shouldSetHTTPHeadersToKeep())
         m_options.httpHeadersToKeep = httpHeadersToKeepFromCleaning(request.httpHeaderFields());
 
-    if (document.page() && document.page()->isRunningUserScripts() && SchemeRegistry::isUserExtensionScheme(request.url().protocol().toStringWithoutCopying())) {
+    if (document.topDocument().isRunningUserScripts() && SchemeRegistry::isUserExtensionScheme(request.url().protocol().toStringWithoutCopying())) {
         m_options.mode = FetchOptions::Mode::NoCors;
         m_options.filteringPolicy = ResponseFilteringPolicy::Disable;
     }

Modified: trunk/Source/WebCore/page/Frame.cpp (235601 => 235602)


--- trunk/Source/WebCore/page/Frame.cpp	2018-09-03 19:18:36 UTC (rev 235601)
+++ trunk/Source/WebCore/page/Frame.cpp	2018-09-03 23:17:22 UTC (rev 235602)
@@ -749,8 +749,8 @@
         return;
     if (!UserContentURLPattern::matchesPatterns(document->url(), script.whitelist(), script.blacklist()))
         return;
-    if (m_page)
-        m_page->setAsRunningUserScripts();
+
+    document->topDocument().setAsRunningUserScripts();
     loader().client().willInjectUserScript(world);
     m_script->evaluateInWorld(ScriptSourceCode(script.source(), script.url()), world);
 }

Modified: trunk/Source/WebCore/page/Page.h (235601 => 235602)


--- trunk/Source/WebCore/page/Page.h	2018-09-03 19:18:36 UTC (rev 235601)
+++ trunk/Source/WebCore/page/Page.h	2018-09-03 23:17:22 UTC (rev 235602)
@@ -453,9 +453,6 @@
     void setResourceUsageOverlayVisible(bool);
 #endif
 
-    void setAsRunningUserScripts() { m_isRunningUserScripts = true; }
-    bool isRunningUserScripts() const { return m_isRunningUserScripts; }
-
     void setDebugger(JSC::Debugger*);
     JSC::Debugger* debugger() const { return m_debugger; }
 
@@ -908,7 +905,6 @@
     std::optional<ApplicationManifest> m_applicationManifest;
 #endif
 
-    bool m_isRunningUserScripts { false };
     bool m_shouldEnableICECandidateFilteringByDefault { true };
 };
 

Modified: trunk/Source/WebCore/testing/Internals.cpp (235601 => 235602)


--- trunk/Source/WebCore/testing/Internals.cpp	2018-09-03 19:18:36 UTC (rev 235601)
+++ trunk/Source/WebCore/testing/Internals.cpp	2018-09-03 23:17:22 UTC (rev 235602)
@@ -4327,8 +4327,7 @@
 
 void Internals::setAsRunningUserScripts(Document& document)
 {
-    if (document.page())
-        document.page()->setAsRunningUserScripts();
+    document.topDocument().setAsRunningUserScripts();
 }
 
 #if ENABLE(WEBGL)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to