TestController may reuse a view that used window.open(), which prevents process-swapp...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Nov 2019 02:45:05 +0000 (02:45 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Nov 2019 02:45:05 +0000 (02:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=203981

Reviewed by Ryosuke Niwa.

Tools:

Stop reusing WebViews that have created other WebViews (via window.open()) since this prevents process-swapping
and may therefore cause flakiness (see Bug 203965).

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createOtherPage):
(WTR::TestController::ensureViewSupportsOptionsForTest):
* WebKitTestRunner/TestController.h:

LayoutTests:

Drop temporary flakiness workaround that was landed in r252214.

* http/tests/inspector/target/target-events-for-provisional-page.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252228 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/target/target-events-for-provisional-page.html
LayoutTests/platform/wk2/http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-script-in-iframe-expected.txt
Tools/ChangeLog
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h

index 62e9453..e595ee7 100644 (file)
@@ -1,3 +1,14 @@
+2019-11-07  Chris Dumez  <cdumez@apple.com>
+
+        TestController may reuse a view that used window.open(), which prevents process-swapping and causes flakiness
+        https://bugs.webkit.org/show_bug.cgi?id=203981
+
+        Reviewed by Ryosuke Niwa.
+
+        Drop temporary flakiness workaround that was landed in r252214.
+
+        * http/tests/inspector/target/target-events-for-provisional-page.html:
+
 2019-11-07  Justin Fan  <justin_fan@apple.com>
 
         [WebGL] Fixing WebGL tests: Add new baselines for iOS bots
index b9107d2..65a9533 100644 (file)
@@ -2,6 +2,7 @@ main frame - didFinishDocumentLoadForFrame
 frame "<!--frame1-->" - didStartProvisionalLoadForFrame
 frame "<!--frame1-->" - didCommitLoadForFrame
 CONSOLE MESSAGE: Blocked mixed content http://127.0.0.1:8000/security/mixedContent/resources/script.js because 'block-all-mixed-content' appears in the Content Security Policy.
+CONSOLE MESSAGE: Blocked mixed content http://127.0.0.1:8000/security/mixedContent/resources/script.js because 'block-all-mixed-content' appears in the Content Security Policy.
 frame "<!--frame1-->" - didFinishDocumentLoadForFrame
 frame "<!--frame1-->" - didHandleOnloadEventsForFrame
 main frame - didHandleOnloadEventsForFrame
index 227d6d6..6b503c4 100644 (file)
@@ -1,3 +1,18 @@
+2019-11-07  Chris Dumez  <cdumez@apple.com>
+
+        TestController may reuse a view that used window.open(), which prevents process-swapping and causes flakiness
+        https://bugs.webkit.org/show_bug.cgi?id=203981
+
+        Reviewed by Ryosuke Niwa.
+
+        Stop reusing WebViews that have created other WebViews (via window.open()) since this prevents process-swapping
+        and may therefore cause flakiness (see Bug 203965).
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::createOtherPage):
+        (WTR::TestController::ensureViewSupportsOptionsForTest):
+        * WebKitTestRunner/TestController.h:
+
 2019-11-07  Aakash Jain  <aakash_jain@apple.com>
 
         [ews] rename RunJavaScriptCoreTestsToT to RunJSCTestsWithoutPatch
index 9810c88..4e48f27 100644 (file)
@@ -314,6 +314,8 @@ WKPageRef TestController::createOtherPage(PlatformWebView* parentView, WKPageCon
     if (!m_currentInvocation->canOpenWindows())
         return nullptr;
 
+    m_createdOtherPage = true;
+
     PlatformWebView* view = platformCreateOtherPage(parentView, configuration, parentView->options());
     WKPageRef newPage = view->page();
 
@@ -767,7 +769,9 @@ void TestController::ensureViewSupportsOptionsForTest(const TestInvocation& test
     auto options = test.options();
 
     if (m_mainWebView) {
-        if (m_mainWebView->viewSupportsOptions(options))
+        // Having created another page (via window.open()) prevents process swapping on navigation and it may therefore
+        // cause flakiness to reuse the view.
+        if (!m_createdOtherPage && m_mainWebView->viewSupportsOptions(options))
             return;
 
         willDestroyWebView();
@@ -777,6 +781,7 @@ void TestController::ensureViewSupportsOptionsForTest(const TestInvocation& test
         WKPageClose(m_mainWebView->page());
 
         m_mainWebView = nullptr;
+        m_createdOtherPage = false;
     }
 
     createWebViewWithOptions(options);
index 680d2e2..ed169ea 100644 (file)
@@ -496,6 +496,7 @@ private:
     bool m_usingServerMode { false };
     bool m_gcBetweenTests { false };
     bool m_shouldDumpPixelsForAllTests { false };
+    bool m_createdOtherPage { false };
     std::vector<std::string> m_paths;
     std::set<std::string> m_allowedHosts;
     WKRetainPtr<WKStringRef> m_injectedBundlePath;