Title: [267860] trunk/Tools
Revision
267860
Author
cdu...@apple.com
Date
2020-10-01 16:41:41 -0700 (Thu, 01 Oct 2020)

Log Message

[DRT] imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/active-processing.https.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=217187

Reviewed by Eric Carlson.

The test sometimes fails with DRT only because window.AudioWorkletNode does not exist. The thing is that
window.AudioWorkletNode only exists in secure contexts. DumpRenderTree::resetWebViewToConsistentState()
was calling [WebFrame globalContext] before each test, which would eagerly create the Window JS wrapper
if it did not exist yet. Because the wrapper would get created too early, its security origin upon
creation was null and we would decide NOT to expose window.AudioWorkletNode.

To address the issue, I updated DumpRenderTree::resetWebViewToConsistentState() to only call
`WebCoreTestSupport::resetInternalsObject([mainFrame globalContext])` after each test, instead of doing
it both before AND after. This new behavior is also more consistent with WebKitTestRunner.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebViewToConsistentState):
(runTest):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (267859 => 267860)


--- trunk/Tools/ChangeLog	2020-10-01 23:21:07 UTC (rev 267859)
+++ trunk/Tools/ChangeLog	2020-10-01 23:41:41 UTC (rev 267860)
@@ -1,3 +1,24 @@
+2020-10-01  Chris Dumez  <cdu...@apple.com>
+
+        [DRT] imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/active-processing.https.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=217187
+
+        Reviewed by Eric Carlson.
+
+        The test sometimes fails with DRT only because window.AudioWorkletNode does not exist. The thing is that
+        window.AudioWorkletNode only exists in secure contexts. DumpRenderTree::resetWebViewToConsistentState()
+        was calling [WebFrame globalContext] before each test, which would eagerly create the Window JS wrapper
+        if it did not exist yet. Because the wrapper would get created too early, its security origin upon
+        creation was null and we would decide NOT to expose window.AudioWorkletNode.
+
+        To address the issue, I updated DumpRenderTree::resetWebViewToConsistentState() to only call
+        `WebCoreTestSupport::resetInternalsObject([mainFrame globalContext])` after each test, instead of doing
+        it both before AND after. This new behavior is also more consistent with WebKitTestRunner.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebViewToConsistentState):
+        (runTest):
+
 2020-10-01  Jonathan Bedard  <jbed...@apple.com>
 
         [webkitscmpy] Support git-svn committers

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (267859 => 267860)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2020-10-01 23:21:07 UTC (rev 267859)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2020-10-01 23:41:41 UTC (rev 267860)
@@ -1825,7 +1825,8 @@
     }
 }
 
-static void resetWebViewToConsistentStateBeforeTesting(const TestOptions& options)
+enum class ResetTime { BeforeTest, AfterTest };
+static void resetWebViewToConsistentState(const TestOptions& options, ResetTime resetTime)
 {
     setJSCOptions(options);
 
@@ -1875,7 +1876,10 @@
     // In the case that a test using the chrome input field failed, be sure to clean up for the next test.
     gTestRunner->removeChromeInputField();
 
-    WebCoreTestSupport::resetInternalsObject([mainFrame globalContext]);
+    // We do not do this before running the test since it may eagerly create the global JS context
+    // if we have not loaded anything yet.
+    if (resetTime == ResetTime::AfterTest)
+        WebCoreTestSupport::resetInternalsObject([mainFrame globalContext]);
 
 #if !PLATFORM(IOS_FAMILY)
     if (WebCore::Frame* frame = [webView _mainCoreFrame])
@@ -1999,7 +2003,7 @@
     gTestRunner->setCustomTimeout(command.timeout);
     gTestRunner->setDumpJSConsoleLogInStdErr(command.dumpJSConsoleLogInStdErr || options.dumpJSConsoleLogInStdErr);
 
-    resetWebViewToConsistentStateBeforeTesting(options);
+    resetWebViewToConsistentState(options, ResetTime::BeforeTest);
 
 #if !PLATFORM(IOS_FAMILY)
     changeWindowScaleIfNeeded(testURL);
@@ -2119,7 +2123,7 @@
             }
         }
 
-        resetWebViewToConsistentStateBeforeTesting(options);
+        resetWebViewToConsistentState(options, ResetTime::AfterTest);
 
         // Loading an empty request synchronously replaces the document with a blank one, which is necessary
         // to stop timers, WebSockets and other activity that could otherwise spill output into next test's results.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to