Title: [271514] trunk
Revision
271514
Author
[email protected]
Date
2021-01-15 02:51:27 -0800 (Fri, 15 Jan 2021)

Log Message

Use event loop to set title
https://bugs.webkit.org/show_bug.cgi?id=218496

Patch by Rob Buis <[email protected]> on 2021-01-15
Reviewed by Ryosuke Niwa.

Source/WebCore:

Use event loop to set title to avoid calling WebFrameLoaderClient
within HTMLTitleElement::insertedIntoAncestor.

* dom/Document.cpp:
(WebCore::Document::updateTitle):
* dom/Document.h:

Tools:

Adapt unit tests to wait for title change tasks
to be processed.

* TestWebKitAPI/Tests/WebKit/PageLoadState.cpp:
(TestWebKitAPI::didChangeTitle):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
(TEST):

LayoutTests:

Adapt tests to make sure pending title change tasks
are processed before the test is done.

* fast/dom/title-text-property-2.html:
* fast/dom/title-text-property-assigning-empty-string.html:
* fast/dom/title-text-property.html:
* http/tests/globalhistory/history-delegate-basic-title-expected.txt:
* http/tests/globalhistory/history-delegate-basic-title.html:
* http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt:
* http/tests/loading/basic-auth-load-URL-with-consecutive-slashes.html:
* http/tests/loading/redirect-with-no-location-crash-expected.txt:
* http/tests/loading/redirect-with-no-location-crash.html:
* platform/mac-wk2/TestExpectations:
* platform/win/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt: Copied from LayoutTests/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt.
* platform/wk2/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt:
* platform/wk2/http/tests/loading/redirect-with-no-location-crash-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (271513 => 271514)


--- trunk/LayoutTests/ChangeLog	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/LayoutTests/ChangeLog	2021-01-15 10:51:27 UTC (rev 271514)
@@ -1,3 +1,27 @@
+2021-01-15  Rob Buis  <[email protected]>
+
+        Use event loop to set title
+        https://bugs.webkit.org/show_bug.cgi?id=218496
+
+        Reviewed by Ryosuke Niwa.
+
+        Adapt tests to make sure pending title change tasks
+        are processed before the test is done.
+
+        * fast/dom/title-text-property-2.html:
+        * fast/dom/title-text-property-assigning-empty-string.html:
+        * fast/dom/title-text-property.html:
+        * http/tests/globalhistory/history-delegate-basic-title-expected.txt:
+        * http/tests/globalhistory/history-delegate-basic-title.html:
+        * http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt:
+        * http/tests/loading/basic-auth-load-URL-with-consecutive-slashes.html:
+        * http/tests/loading/redirect-with-no-location-crash-expected.txt:
+        * http/tests/loading/redirect-with-no-location-crash.html:
+        * platform/mac-wk2/TestExpectations:
+        * platform/win/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt: Copied from LayoutTests/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt.
+        * platform/wk2/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt:
+        * platform/wk2/http/tests/loading/redirect-with-no-location-crash-expected.txt:
+
 2021-01-14  Julian Gonzalez  <[email protected]>
 
         Crash from CompositeEditCommand::moveParagraphs() being passed null end

Modified: trunk/LayoutTests/fast/dom/title-text-property-2.html (271513 => 271514)


--- trunk/LayoutTests/fast/dom/title-text-property-2.html	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/LayoutTests/fast/dom/title-text-property-2.html	2021-01-15 10:51:27 UTC (rev 271514)
@@ -1,8 +1,9 @@
 <html>
 <head>
 <script>
-function runTests() {
+function startTest() {
     if (window.testRunner) {
+        testRunner.waitUntilDone();
         testRunner.dumpAsText();
         testRunner.dumpTitleChanges();
     }
@@ -10,11 +11,19 @@
     console.log("Setting document.title to TITLE1");    
     document.title = 'TITLE1';
 
+    internals.queueTask("DOMManipulation", () => continueTest());
+}
+
+function continueTest() {
     title = document.getElementsByTagName('title').item(0);
     
     console.log("Setting title element's text to TITLE2");
     title.text = 'TITLE2';
     
+    internals.queueTask("DOMManipulation", () => endTest());
+}
+
+function endTest() {
     newTitle = document.createElement('title');
     console.log("Should not set title");
     newTitle.appendChild(document.createTextNode('FAIL'));
@@ -28,10 +37,12 @@
         titleElement = titleElements[titleElements.length - 1];
         titleElement.parentNode.removeChild(titleElement);
     }
+
+    internals.queueTask("DOMManipulation", () => testRunner.notifyDone());
 }
 </script>
 <title>Initial title</title>
 </head> 
-<body _onload_="runTests();" >
+<body _onload_="startTest();" >
 </body>
 </html>

Modified: trunk/LayoutTests/fast/dom/title-text-property-assigning-empty-string.html (271513 => 271514)


--- trunk/LayoutTests/fast/dom/title-text-property-assigning-empty-string.html	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/LayoutTests/fast/dom/title-text-property-assigning-empty-string.html	2021-01-15 10:51:27 UTC (rev 271514)
@@ -1,17 +1,23 @@
 <html>
 <head>
 <script>
-function runTests() {
+function startTest() {
     if (window.testRunner) {
+        testRunner.waitUntilDone();
         testRunner.dumpAsText();
         testRunner.dumpTitleChanges();
     }
 
     document.title = 'New non-empty title';
+    internals.queueTask("DOMManipulation", () => endTest())
+}
+
+function endTest() {
     document.title = '';
+    internals.queueTask("DOMManipulation", () => testRunner.notifyDone())
 }
 </script>
 </head>
-<body _onload_='runTests();'>
+<body _onload_='startTest();'>
 </body>
 </html>

Modified: trunk/LayoutTests/fast/dom/title-text-property.html (271513 => 271514)


--- trunk/LayoutTests/fast/dom/title-text-property.html	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/LayoutTests/fast/dom/title-text-property.html	2021-01-15 10:51:27 UTC (rev 271514)
@@ -12,6 +12,7 @@
 
 function runTests() {
     if (window.testRunner) {
+        testRunner.waitUntilDone();
         testRunner.dumpAsText();
         testRunner.dumpTitleChanges();
     }
@@ -24,6 +25,8 @@
     titleElem.text = newTitle;
 
     debugOutput('New title is: \'' + titleElem.text + '\'');
+
+    internals.queueTask("DOMManipulation", () => testRunner.notifyDone());
 }
 </script>
 </head>

Modified: trunk/LayoutTests/http/tests/globalhistory/history-delegate-basic-title-expected.txt (271513 => 271514)


--- trunk/LayoutTests/http/tests/globalhistory/history-delegate-basic-title-expected.txt	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/LayoutTests/http/tests/globalhistory/history-delegate-basic-title-expected.txt	2021-01-15 10:51:27 UTC (rev 271514)
@@ -1,4 +1,3 @@
 WebView navigated to url "http://127.0.0.1:8000/globalhistory/history-delegate-basic-title.html" with title "" with HTTP equivalent method "GET".  The navigation was successful and was not a client redirect.
-WebView updated the title for history URL "http://127.0.0.1:8000/globalhistory/history-delegate-basic-title.html" to "Test Title 1".
 WebView updated the title for history URL "http://127.0.0.1:8000/globalhistory/history-delegate-basic-title.html" to "Test Title 2".
 This test sees if the history delegate is notified of title changes.

Modified: trunk/LayoutTests/http/tests/globalhistory/history-delegate-basic-title.html (271513 => 271514)


--- trunk/LayoutTests/http/tests/globalhistory/history-delegate-basic-title.html	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/LayoutTests/http/tests/globalhistory/history-delegate-basic-title.html	2021-01-15 10:51:27 UTC (rev 271514)
@@ -1,15 +1,20 @@
 <html>
 <head>
 <script>
-if (window.testRunner)
+if (window.testRunner) {
+    testRunner.waitUntilDone();
     testRunner.dumpAsText();
+}
 </script>
 <title>Test Title 1</title>
 </head>
-<body>
+<body _onload_="runTest()">
 This test sees if the history delegate is notified of title changes.
-</body>
 <script>
+function runTest() {
 document.title = "Test Title 2";
+internals.queueTask("DOMManipulation", () => testRunner.notifyDone());
+}
 </script>
+</body>
 </html>

Modified: trunk/LayoutTests/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt (271513 => 271514)


--- trunk/LayoutTests/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/LayoutTests/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt	2021-01-15 10:51:27 UTC (rev 271514)
@@ -5,8 +5,8 @@
 http://127.0.0.1:8000/loading/resources/basic-auth-testing.php?username=webkit&password=rocks - didReceiveAuthenticationChallenge - Responding with webkit:rocks
 frame "<!--frame1-->" - didCommitLoadForFrame
 frame "<!--frame1-->" - didFinishDocumentLoadForFrame
+frame "<!--frame1-->" - didHandleOnloadEventsForFrame
 frame "<!--frame1-->" - willPerformClientRedirectToURL: http://127.0.0.1:8000/a//b/non-existent-file.html
-frame "<!--frame1-->" - didHandleOnloadEventsForFrame
 main frame - didHandleOnloadEventsForFrame
 frame "<!--frame1-->" - didFinishLoadForFrame
 main frame - didFinishLoadForFrame
@@ -15,5 +15,6 @@
 frame "<!--frame1-->" - didCommitLoadForFrame
 frame "<!--frame1-->" - didReceiveTitle: 404 Not Found
 frame "<!--frame1-->" - didFinishDocumentLoadForFrame
-frame "<!--frame1-->" - didFailLoadWithError
+frame "<!--frame1-->" - didHandleOnloadEventsForFrame
+frame "<!--frame1-->" - didFinishLoadForFrame
 PASS did not cause assertion failure.

Modified: trunk/LayoutTests/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes.html (271513 => 271514)


--- trunk/LayoutTests/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes.html	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/LayoutTests/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes.html	2021-01-15 10:51:27 UTC (rev 271514)
@@ -12,9 +12,11 @@
 
 function done()
 {
-    document.body.removeChild(document.getElementById("frame"));
-    if (window.testRunner)
-        testRunner.notifyDone();
+    setTimeout(function() {
+        document.body.removeChild(document.getElementById("frame"));
+        if (window.testRunner)
+            testRunner.notifyDone();
+    }, 500);
 }
 
 function notifyFrameDidLoad(frame)
@@ -24,8 +26,8 @@
 }
 </script>
 </head>
-<body>
-<iframe id="frame" src="" _onload_="notifyFrameDidLoad(this)"></iframe>
+<body _onload_="notifyFrameDidLoad(frame)">
+<iframe id="frame" src="" _onlad_="notifyFrameDidLoad(this)"></iframe>
 <p>PASS did not cause assertion failure.</p>
 </body>
 </html>

Modified: trunk/LayoutTests/http/tests/loading/redirect-with-no-location-crash-expected.txt (271513 => 271514)


--- trunk/LayoutTests/http/tests/loading/redirect-with-no-location-crash-expected.txt	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/LayoutTests/http/tests/loading/redirect-with-no-location-crash-expected.txt	2021-01-15 10:51:27 UTC (rev 271514)
@@ -1,8 +1,8 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
-main frame - didReceiveTitle: Test for https://bugs.webkit.org/show_bug.cgi?id=29293
 frame "<!--frame1-->" - didStartProvisionalLoadForFrame
 main frame - didFinishDocumentLoadForFrame
+main frame - didReceiveTitle: Test for https://bugs.webkit.org/show_bug.cgi?id=29293
 frame "<!--frame1-->" - didCommitLoadForFrame
 frame "<!--frame1-->" - didFinishDocumentLoadForFrame
 frame "<!--frame1-->" - didHandleOnloadEventsForFrame

Modified: trunk/LayoutTests/http/tests/loading/redirect-with-no-location-crash.html (271513 => 271514)


--- trunk/LayoutTests/http/tests/loading/redirect-with-no-location-crash.html	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/LayoutTests/http/tests/loading/redirect-with-no-location-crash.html	2021-01-15 10:51:27 UTC (rev 271514)
@@ -2,11 +2,13 @@
 <head>
     <title>Test for https://bugs.webkit.org/show_bug.cgi?id=29293</title>
     <script>
-        if (window.testRunner)
+        if (window.testRunner) {
             testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
     </script>
 </head>
-<body>
+<body _onload_="setTimeout(function() { if (window.testRunner) testRunner.notifyDone(); })">
   <iframe src=""
 </body>
 <html>

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (271513 => 271514)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2021-01-15 10:51:27 UTC (rev 271514)
@@ -583,7 +583,7 @@
 
 webkit.org/b/163136 http/tests/xmlhttprequest/auth-reject-protection-space.html [ Pass Failure ]
 
-webkit.org/b/163139 http/tests/loading/basic-auth-load-URL-with-consecutive-slashes.html [ Pass Failure ]
+#webkit.org/b/163139 http/tests/loading/basic-auth-load-URL-with-consecutive-slashes.html [ Pass Failure ]
 
 webkit.org/b/162975 http/tests/cache/disk-cache/memory-cache-revalidation-updates-disk-cache.html [ Pass Failure ]
 

Copied: trunk/LayoutTests/platform/win/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt (from rev 271513, trunk/LayoutTests/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt) (0 => 271514)


--- trunk/LayoutTests/platform/win/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/win/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt	2021-01-15 10:51:27 UTC (rev 271514)
@@ -0,0 +1,20 @@
+main frame - didStartProvisionalLoadForFrame
+main frame - didCommitLoadForFrame
+frame "<!--frame1-->" - didStartProvisionalLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+http://127.0.0.1:8000/loading/resources/basic-auth-testing.php?username=webkit&password=rocks - didReceiveAuthenticationChallenge - Responding with webkit:rocks
+frame "<!--frame1-->" - didCommitLoadForFrame
+frame "<!--frame1-->" - didFinishDocumentLoadForFrame
+frame "<!--frame1-->" - didHandleOnloadEventsForFrame
+frame "<!--frame1-->" - willPerformClientRedirectToURL: http://127.0.0.1:8000/a//b/non-existent-file.html
+main frame - didHandleOnloadEventsForFrame
+frame "<!--frame1-->" - didFinishLoadForFrame
+main frame - didFinishLoadForFrame
+frame "<!--frame1-->" - didStartProvisionalLoadForFrame
+frame "<!--frame1-->" - didCancelClientRedirectForFrame
+frame "<!--frame1-->" - didCommitLoadForFrame
+frame "<!--frame1-->" - didFinishDocumentLoadForFrame
+frame "<!--frame1-->" - didHandleOnloadEventsForFrame
+frame "<!--frame1-->" - didFinishLoadForFrame
+frame "<!--frame1-->" - didReceiveTitle: 404 Not Found
+PASS did not cause assertion failure.

Modified: trunk/LayoutTests/platform/wk2/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt (271513 => 271514)


--- trunk/LayoutTests/platform/wk2/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/LayoutTests/platform/wk2/http/tests/loading/basic-auth-load-URL-with-consecutive-slashes-expected.txt	2021-01-15 10:51:27 UTC (rev 271514)
@@ -5,8 +5,8 @@
 127.0.0.1:8000 - didReceiveAuthenticationChallenge - ProtectionSpaceAuthenticationSchemeHTTPBasic - Responding with webkit:rocks
 frame "<!--frame1-->" - didCommitLoadForFrame
 frame "<!--frame1-->" - didFinishDocumentLoadForFrame
+frame "<!--frame1-->" - didHandleOnloadEventsForFrame
 frame "<!--frame1-->" - willPerformClientRedirectToURL: http://127.0.0.1:8000/a//b/non-existent-file.html
-frame "<!--frame1-->" - didHandleOnloadEventsForFrame
 main frame - didHandleOnloadEventsForFrame
 frame "<!--frame1-->" - didFinishLoadForFrame
 main frame - didFinishLoadForFrame
@@ -13,7 +13,8 @@
 frame "<!--frame1-->" - didStartProvisionalLoadForFrame
 frame "<!--frame1-->" - didCancelClientRedirectForFrame
 frame "<!--frame1-->" - didCommitLoadForFrame
+frame "<!--frame1-->" - didFinishDocumentLoadForFrame
+frame "<!--frame1-->" - didHandleOnloadEventsForFrame
+frame "<!--frame1-->" - didFinishLoadForFrame
 frame "<!--frame1-->" - didReceiveTitle: 404 Not Found
-frame "<!--frame1-->" - didFinishDocumentLoadForFrame
-frame "<!--frame1-->" - didFailLoadWithError
 PASS did not cause assertion failure.

Modified: trunk/LayoutTests/platform/wk2/http/tests/loading/redirect-with-no-location-crash-expected.txt (271513 => 271514)


--- trunk/LayoutTests/platform/wk2/http/tests/loading/redirect-with-no-location-crash-expected.txt	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/LayoutTests/platform/wk2/http/tests/loading/redirect-with-no-location-crash-expected.txt	2021-01-15 10:51:27 UTC (rev 271514)
@@ -1,7 +1,7 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
 main frame - didReceiveTitle: Test for https://bugs.webkit.org/show_bug.cgi?id=29293
-main frame - didFinishDocumentLoadForFrame
 frame "<!--frame1-->" - didStartProvisionalLoadForFrame
 frame "<!--frame1-->" - didCommitLoadForFrame
 frame "<!--frame1-->" - didFinishDocumentLoadForFrame

Modified: trunk/Source/WebCore/ChangeLog (271513 => 271514)


--- trunk/Source/WebCore/ChangeLog	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/Source/WebCore/ChangeLog	2021-01-15 10:51:27 UTC (rev 271514)
@@ -1,3 +1,17 @@
+2021-01-15  Rob Buis  <[email protected]>
+
+        Use event loop to set title
+        https://bugs.webkit.org/show_bug.cgi?id=218496
+
+        Reviewed by Ryosuke Niwa.
+
+        Use event loop to set title to avoid calling WebFrameLoaderClient
+        within HTMLTitleElement::insertedIntoAncestor.
+
+        * dom/Document.cpp:
+        (WebCore::Document::updateTitle):
+        * dom/Document.h:
+
 2021-01-15  Philippe Normand  <[email protected]>
 
         [GStreamer] UI<->WebPocess IPC needed for enumerateDevices support

Modified: trunk/Source/WebCore/dom/Document.cpp (271513 => 271514)


--- trunk/Source/WebCore/dom/Document.cpp	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/Source/WebCore/dom/Document.cpp	2021-01-15 10:51:27 UTC (rev 271514)
@@ -1678,8 +1678,14 @@
     m_title.string = canonicalizedTitle(*this, title.string);
     m_title.direction = title.direction;
 
-    if (auto* loader = this->loader())
-        loader->setTitle(m_title);
+    if (!m_updateTitleTaskScheduled) {
+        eventLoop().queueTask(TaskSource::DOMManipulation, [protectedThis = makeRef(*this), this]() mutable {
+            m_updateTitleTaskScheduled = false;
+            if (auto documentLoader = makeRefPtr(loader()))
+                documentLoader->setTitle(m_title);
+        });
+        m_updateTitleTaskScheduled = true;
+    }
 }
 
 void Document::updateTitleFromTitleElement()

Modified: trunk/Source/WebCore/dom/Document.h (271513 => 271514)


--- trunk/Source/WebCore/dom/Document.h	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/Source/WebCore/dom/Document.h	2021-01-15 10:51:27 UTC (rev 271514)
@@ -2114,6 +2114,8 @@
     bool m_didDispatchViewportPropertiesChanged { false };
 #endif
 
+    bool m_updateTitleTaskScheduled { false };
+
     OrientationNotifier m_orientationNotifier;
     mutable RefPtr<Logger> m_logger;
     RefPtr<StringCallback> m_consoleMessageListener;

Modified: trunk/Tools/ChangeLog (271513 => 271514)


--- trunk/Tools/ChangeLog	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/Tools/ChangeLog	2021-01-15 10:51:27 UTC (rev 271514)
@@ -1,3 +1,19 @@
+2021-01-15  Rob Buis  <[email protected]>
+
+        Use event loop to set title
+        https://bugs.webkit.org/show_bug.cgi?id=218496
+
+        Reviewed by Ryosuke Niwa.
+
+        Adapt unit tests to wait for title change tasks
+        to be processed.
+
+        * TestWebKitAPI/Tests/WebKit/PageLoadState.cpp:
+        (TestWebKitAPI::didChangeTitle):
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
+        (TEST):
+
 2021-01-15  Philippe Normand  <[email protected]>
 
         [GStreamer] Clean-up the TextCombiner

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit/PageLoadState.cpp (271513 => 271514)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit/PageLoadState.cpp	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/PageLoadState.cpp	2021-01-15 10:51:27 UTC (rev 271514)
@@ -35,6 +35,7 @@
 namespace TestWebKitAPI {
 
 static bool test1Done;
+static bool titleChangeDone;
 
 struct PageLoadTestState {
     int didChangeActiveURL { 0 };
@@ -112,6 +113,7 @@
 {
     PageLoadTestState* state = reinterpret_cast<PageLoadTestState*>(const_cast<void*>(clientInfo));
     state->didChangeTitle++;
+    titleChangeDone = true;
 }
 
 static void didChangeWebProcessIsResponsive(const void* clientInfo)
@@ -278,14 +280,14 @@
     EXPECT_EQ(state.willChangeCanGoBack, 2);
     EXPECT_EQ(state.willChangeCanGoForward, 1);
 
-    test1Done = false;
+    titleChangeDone = false;
     url = "" "html"));
     WKPageLoadURL(webView.page(), url.get());
-    Util::run(&test1Done);
+    Util::run(&titleChangeDone);
 
     EXPECT_EQ(state.didChangeActiveURL, 4);
-    EXPECT_EQ(state.didChangeTitle, 2);
-    EXPECT_EQ(state.willChangeTitle, 2);
+    EXPECT_EQ(state.didChangeTitle, 1);
+    EXPECT_EQ(state.willChangeTitle, 1);
 
     WKPageSetPageStateClient(webView.page(), nullptr);
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm (271513 => 271514)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm	2021-01-15 09:45:56 UTC (rev 271513)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm	2021-01-15 10:51:27 UTC (rev 271514)
@@ -412,7 +412,7 @@
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
     auto delegate = adoptNS([[PrintDelegate alloc] init]);
     [webView setUIDelegate:delegate.get()];
-    [webView loadHTMLString:@"<head><title>test_title</title></head><body _onload_='print()'>hello world!</body>" baseURL:[NSURL URLWithString:@"http://example.com/"]];
+    [webView loadHTMLString:@"<head><title>test_title</title></head><body _onload_='setTimeout(function() { print() });'>hello world!</body>" baseURL:[NSURL URLWithString:@"http://example.com/"]];
     TestWebKitAPI::Util::run(&done);
 
     NSPrintOperation *operation = [webView _printOperationWithPrintInfo:[NSPrintInfo sharedPrintInfo]];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to