Title: [259696] branches/safari-610.1.9-branch
- Revision
- 259696
- Author
- repst...@apple.com
- Date
- 2020-04-07 17:43:15 -0700 (Tue, 07 Apr 2020)
Log Message
Cherry-pick r259650. rdar://problem/61419505
WKUserScripts deferred from injection are not injected if -[WKWebView _notifyUserScripts] is called early.
https://bugs.webkit.org/show_bug.cgi?id=210131
rdar://problem/61368446
Reviewed by Brady Eidson.
Source/WebCore:
If Page::notifyToInjectUserScripts() is called early, before Frame::injectUserScripts() happens,
m_hasBeenNotifiedToInjectUserScripts will be false, allowing scripts to build up in m_userScriptsAwaitingNotification
and never being injected (since Page::notifyToInjectUserScripts() will not be called again).
* page/Page.cpp:
(WebCore::Page::notifyToInjectUserScripts): Set m_hasBeenNotifiedToInjectUserScripts to true when called.
Tools:
* TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm:
(TEST):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259650 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-610.1.9-branch/Source/WebCore/ChangeLog (259695 => 259696)
--- branches/safari-610.1.9-branch/Source/WebCore/ChangeLog 2020-04-08 00:43:11 UTC (rev 259695)
+++ branches/safari-610.1.9-branch/Source/WebCore/ChangeLog 2020-04-08 00:43:15 UTC (rev 259696)
@@ -1,3 +1,45 @@
+2020-04-07 Alan Coon <alanc...@apple.com>
+
+ Cherry-pick r259650. rdar://problem/61419505
+
+ WKUserScripts deferred from injection are not injected if -[WKWebView _notifyUserScripts] is called early.
+ https://bugs.webkit.org/show_bug.cgi?id=210131
+ rdar://problem/61368446
+
+ Reviewed by Brady Eidson.
+
+ Source/WebCore:
+
+ If Page::notifyToInjectUserScripts() is called early, before Frame::injectUserScripts() happens,
+ m_hasBeenNotifiedToInjectUserScripts will be false, allowing scripts to build up in m_userScriptsAwaitingNotification
+ and never being injected (since Page::notifyToInjectUserScripts() will not be called again).
+
+ * page/Page.cpp:
+ (WebCore::Page::notifyToInjectUserScripts): Set m_hasBeenNotifiedToInjectUserScripts to true when called.
+
+ Tools:
+
+ * TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm:
+ (TEST):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259650 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-04-07 Timothy Hatcher <timo...@apple.com>
+
+ WKUserScripts deferred from injection are not injected if -[WKWebView _notifyUserScripts] is called early.
+ https://bugs.webkit.org/show_bug.cgi?id=210131
+ rdar://problem/61368446
+
+ Reviewed by Brady Eidson.
+
+ If Page::notifyToInjectUserScripts() is called early, before Frame::injectUserScripts() happens,
+ m_hasBeenNotifiedToInjectUserScripts will be false, allowing scripts to build up in m_userScriptsAwaitingNotification
+ and never being injected (since Page::notifyToInjectUserScripts() will not be called again).
+
+ * page/Page.cpp:
+ (WebCore::Page::notifyToInjectUserScripts): Set m_hasBeenNotifiedToInjectUserScripts to true when called.
+
2020-04-04 Rob Buis <rb...@igalia.com>
Remove LockHistory parameter from loadWithNavigationAction
Modified: branches/safari-610.1.9-branch/Source/WebCore/page/Page.cpp (259695 => 259696)
--- branches/safari-610.1.9-branch/Source/WebCore/page/Page.cpp 2020-04-08 00:43:11 UTC (rev 259695)
+++ branches/safari-610.1.9-branch/Source/WebCore/page/Page.cpp 2020-04-08 00:43:15 UTC (rev 259696)
@@ -2479,10 +2479,13 @@
void Page::notifyToInjectUserScripts()
{
+ m_hasBeenNotifiedToInjectUserScripts = true;
+
for (auto* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
for (const auto& pair : m_userScriptsAwaitingNotification)
frame->injectUserScriptImmediately(pair.first, pair.second.get());
}
+
m_userScriptsAwaitingNotification.clear();
}
Modified: branches/safari-610.1.9-branch/Tools/ChangeLog (259695 => 259696)
--- branches/safari-610.1.9-branch/Tools/ChangeLog 2020-04-08 00:43:11 UTC (rev 259695)
+++ branches/safari-610.1.9-branch/Tools/ChangeLog 2020-04-08 00:43:15 UTC (rev 259696)
@@ -1,3 +1,41 @@
+2020-04-07 Alan Coon <alanc...@apple.com>
+
+ Cherry-pick r259650. rdar://problem/61419505
+
+ WKUserScripts deferred from injection are not injected if -[WKWebView _notifyUserScripts] is called early.
+ https://bugs.webkit.org/show_bug.cgi?id=210131
+ rdar://problem/61368446
+
+ Reviewed by Brady Eidson.
+
+ Source/WebCore:
+
+ If Page::notifyToInjectUserScripts() is called early, before Frame::injectUserScripts() happens,
+ m_hasBeenNotifiedToInjectUserScripts will be false, allowing scripts to build up in m_userScriptsAwaitingNotification
+ and never being injected (since Page::notifyToInjectUserScripts() will not be called again).
+
+ * page/Page.cpp:
+ (WebCore::Page::notifyToInjectUserScripts): Set m_hasBeenNotifiedToInjectUserScripts to true when called.
+
+ Tools:
+
+ * TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm:
+ (TEST):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259650 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-04-07 Timothy Hatcher <timo...@apple.com>
+
+ WKUserScripts deferred from injection are not injected if -[WKWebView _notifyUserScripts] is called early.
+ https://bugs.webkit.org/show_bug.cgi?id=210131
+ rdar://problem/61368446
+
+ Reviewed by Brady Eidson.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm:
+ (TEST):
+
2020-04-04 Wenson Hsieh <wenson_hs...@apple.com>
Add a fourth round of logging to help diagnose <webkit.org/b/209685>
Modified: branches/safari-610.1.9-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm (259695 => 259696)
--- branches/safari-610.1.9-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm 2020-04-08 00:43:11 UTC (rev 259695)
+++ branches/safari-610.1.9-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm 2020-04-08 00:43:15 UTC (rev 259696)
@@ -843,4 +843,15 @@
[webView2 loadTestPageNamed:@"simple"];
EXPECT_WK_STREQ([delegate waitForAlert], "waited for notification");
EXPECT_WK_STREQ([delegate waitForAlert], "document parsing ended");
+
+ TestWKWebView *webView3 = [[TestWKWebView new] autorelease];
+ EXPECT_TRUE(webView3._deferrableUserScriptsNeedNotification);
+ [webView3.configuration.userContentController addUserScript:waitsForNotification];
+ [webView3.configuration.userContentController addUserScript:documentEnd];
+ webView3.UIDelegate = delegate;
+ [webView3 loadTestPageNamed:@"simple"];
+ [webView3 _notifyUserScripts];
+ EXPECT_FALSE(webView3._deferrableUserScriptsNeedNotification);
+ EXPECT_WK_STREQ([delegate waitForAlert], "waited for notification");
+ EXPECT_WK_STREQ([delegate waitForAlert], "document parsing ended");
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes