Diff
Modified: trunk/LayoutTests/ChangeLog (229348 => 229349)
--- trunk/LayoutTests/ChangeLog 2018-03-07 01:02:09 UTC (rev 229348)
+++ trunk/LayoutTests/ChangeLog 2018-03-07 01:15:37 UTC (rev 229349)
@@ -1,3 +1,15 @@
+2018-03-06 Youenn Fablet <[email protected]>
+
+ didReceiveServerRedirectForProvisionalNavigation is not called in case of document redirection with service worker registration change
+ https://bugs.webkit.org/show_bug.cgi?id=183299
+ <rdar://problem/37547029>
+
+ Reviewed by Alex Christensen.
+
+ * http/wpt/service-workers/navigation-redirect-main-frame-worker.js: Added.
+ * http/wpt/service-workers/navigation-redirect-main-frame.https-expected.txt: Added.
+ * http/wpt/service-workers/navigation-redirect-main-frame.https.html: Added.
+
2018-03-06 Chris Dumez <[email protected]>
http/wpt/html/browsers/history/the-location-interface/location-protocol-setter-non-broken-async-delegate.html is flaky
Added: trunk/LayoutTests/http/wpt/service-workers/navigation-redirect-main-frame-worker.js (0 => 229349)
--- trunk/LayoutTests/http/wpt/service-workers/navigation-redirect-main-frame-worker.js (rev 0)
+++ trunk/LayoutTests/http/wpt/service-workers/navigation-redirect-main-frame-worker.js 2018-03-07 01:15:37 UTC (rev 229349)
@@ -0,0 +1,3 @@
+addEventListener("fetch", async (e) => {
+ e.respondWith(Response.redirect("/WebKit/service-workers/navigation-redirect-main-frame.https.html#redirected"));
+});
Added: trunk/LayoutTests/http/wpt/service-workers/navigation-redirect-main-frame.https-expected.txt (0 => 229349)
--- trunk/LayoutTests/http/wpt/service-workers/navigation-redirect-main-frame.https-expected.txt (rev 0)
+++ trunk/LayoutTests/http/wpt/service-workers/navigation-redirect-main-frame.https-expected.txt 2018-03-07 01:15:37 UTC (rev 229349)
@@ -0,0 +1 @@
+PASS
Added: trunk/LayoutTests/http/wpt/service-workers/navigation-redirect-main-frame.https.html (0 => 229349)
--- trunk/LayoutTests/http/wpt/service-workers/navigation-redirect-main-frame.https.html (rev 0)
+++ trunk/LayoutTests/http/wpt/service-workers/navigation-redirect-main-frame.https.html 2018-03-07 01:15:37 UTC (rev 229349)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<title>Service Worker redirections and callbacks</title>
+</head>
+<body>
+<script>
+async function doTest()
+{
+ if (window.location.hash === "#redirected") {
+ if (window.testRunner)
+ document.body.innerHTML = testRunner.didReceiveServerRedirectForProvisionalNavigation ? "PASS" : "FAIL";
+ else
+ document.body.innerHTML = "PASS";
+ if (window.testRunner) {
+ testRunner.clearDidReceiveServerRedirectForProvisionalNavigation();
+ testRunner.notifyDone();
+ }
+ return;
+ }
+ var registration = await navigator.serviceWorker.register("navigation-redirect-main-frame-worker.js", { scope : "resources" });
+ var activeWorker = registration.active;
+ if (!activeWorker) {
+ activeWorker = registration.installing;
+ await new Promise(resolve => {
+ activeWorker.addEventListener('statechange', () => {
+ if (activeWorker.state === "activated")
+ resolve(registration);
+ });
+ });
+ }
+ window.location = "resources";
+}
+
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+doTest();
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (229348 => 229349)
--- trunk/Source/WebCore/ChangeLog 2018-03-07 01:02:09 UTC (rev 229348)
+++ trunk/Source/WebCore/ChangeLog 2018-03-07 01:15:37 UTC (rev 229349)
@@ -1,3 +1,21 @@
+2018-03-06 Youenn Fablet <[email protected]>
+
+ didReceiveServerRedirectForProvisionalNavigation is not called in case of document redirection with service worker registration change
+ https://bugs.webkit.org/show_bug.cgi?id=183299
+ <rdar://problem/37547029>
+
+ Reviewed by Alex Christensen.
+
+ In case of redirection with service worker registration change, we cancel the load and create a new one.
+ This prevent ResourceLoader::willSendRequestInternal to call the didReceiveServerRedirectForProvisionalNavigation
+ callback. We thus explictly call this callback after restarting the load with the new service worker step.
+ We only call this callback if the main resource is there as we do not want to call it if it was blocked by content extension.
+
+ Test: http/wpt/service-workers/navigation-redirect-main-frame.https.html
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::restartLoadingDueToServiceWorkerRegistrationChange):
+
2018-03-06 Basuke Suzuki <[email protected]>
[Curl] Remove unnecessary copied ResourceRequest member variable.
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (229348 => 229349)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2018-03-07 01:02:09 UTC (rev 229348)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2018-03-07 01:15:37 UTC (rev 229349)
@@ -695,8 +695,12 @@
{
clearMainResource();
+ ASSERT(!isCommitted());
m_serviceWorkerRegistrationData = WTFMove(registrationData);
loadMainResource(WTFMove(request));
+
+ if (m_mainResource)
+ frameLoader()->client().dispatchDidReceiveServerRedirectForProvisionalLoad();
}
#endif
Modified: trunk/Tools/ChangeLog (229348 => 229349)
--- trunk/Tools/ChangeLog 2018-03-07 01:02:09 UTC (rev 229348)
+++ trunk/Tools/ChangeLog 2018-03-07 01:15:37 UTC (rev 229349)
@@ -1,3 +1,29 @@
+2018-03-06 Youenn Fablet <[email protected]>
+
+ didReceiveServerRedirectForProvisionalNavigation is not called in case of document redirection with service worker registration change
+ https://bugs.webkit.org/show_bug.cgi?id=183299
+ <rdar://problem/37547029>
+
+ Reviewed by Alex Christensen.
+
+ Add support for checking whether this callback is called.
+ Used in the added layout test.
+
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::didReceiveServerRedirectForProvisionalNavigation const):
+ (WTR::TestRunner::clearDidReceiveServerRedirectForProvisionalNavigation):
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::createOtherPage):
+ (WTR::TestController::resetStateToConsistentValues):
+ (WTR::TestController::didReceiveServerRedirectForProvisionalNavigation):
+ * WebKitTestRunner/TestController.h:
+ (WTR::TestController::didReceiveServerRedirectForProvisionalNavigation const):
+ (WTR::TestController::clearDidReceiveServerRedirectForProvisionalNavigation):
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+
2018-03-06 Chris Dumez <[email protected]>
fast/loader/redirect-to-invalid-url-using-meta-refresh-disallowed.html fails with async policy delegates
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (229348 => 229349)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2018-03-07 01:02:09 UTC (rev 229348)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2018-03-07 01:15:37 UTC (rev 229349)
@@ -163,6 +163,9 @@
void setDefersLoading(boolean flag);
void setStopProvisionalFrameLoads();
+ readonly attribute boolean didReceiveServerRedirectForProvisionalNavigation;
+ void clearDidReceiveServerRedirectForProvisionalNavigation();
+
// Focus testing.
void addChromeInputField(object callback);
void removeChromeInputField(object callback);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (229348 => 229349)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2018-03-07 01:02:09 UTC (rev 229348)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2018-03-07 01:15:37 UTC (rev 229349)
@@ -620,6 +620,21 @@
WKBundlePageSetDefersLoading(InjectedBundle::singleton().page()->page(), shouldDeferLoading);
}
+bool TestRunner::didReceiveServerRedirectForProvisionalNavigation() const
+{
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("DidReceiveServerRedirectForProvisionalNavigation"));
+ WKTypeRef returnData = 0;
+
+ WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), messageName.get(), 0, &returnData);
+ return WKBooleanGetValue(static_cast<WKBooleanRef>(returnData));
+}
+
+void TestRunner::clearDidReceiveServerRedirectForProvisionalNavigation()
+{
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("ClearDidReceiveServerRedirectForProvisionalNavigation"));
+ WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), messageName.get(), 0, nullptr);
+}
+
void TestRunner::setPageVisibility(JSStringRef state)
{
InjectedBundle::singleton().setHidden(JSStringIsEqualToUTF8CString(state, "hidden") || JSStringIsEqualToUTF8CString(state, "prerender"));
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (229348 => 229349)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2018-03-07 01:02:09 UTC (rev 229348)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2018-03-07 01:15:37 UTC (rev 229349)
@@ -215,6 +215,9 @@
bool isPolicyDelegateEnabled() const { return m_policyDelegateEnabled; }
bool isPolicyDelegatePermissive() const { return m_policyDelegatePermissive; }
+ bool didReceiveServerRedirectForProvisionalNavigation() const;
+ void clearDidReceiveServerRedirectForProvisionalNavigation();
+
bool waitToDump() const { return m_waitToDump; }
void waitToDumpWatchdogTimerFired();
void invalidateWaitToDumpWatchdogTimer();
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (229348 => 229349)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2018-03-07 01:02:09 UTC (rev 229348)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2018-03-07 01:15:37 UTC (rev 229349)
@@ -304,7 +304,7 @@
decidePolicyForNavigationResponse,
decidePolicyForPluginLoad,
0, // didStartProvisionalNavigation
- 0, // didReceiveServerRedirectForProvisionalNavigation
+ didReceiveServerRedirectForProvisionalNavigation,
0, // didFailProvisionalNavigation
0, // didCommitNavigation
0, // didFinishNavigation
@@ -578,7 +578,7 @@
decidePolicyForNavigationResponse,
decidePolicyForPluginLoad,
0, // didStartProvisionalNavigation
- 0, // didReceiveServerRedirectForProvisionalNavigation
+ didReceiveServerRedirectForProvisionalNavigation,
0, // didFailProvisionalNavigation
didCommitNavigation,
didFinishNavigation,
@@ -864,6 +864,8 @@
statisticsResetToConsistentState();
+ m_didReceiveServerRedirectForProvisionalNavigation = false;
+
// Reset main page back to about:blank
m_doneResetting = false;
WKPageLoadURL(m_mainWebView->page(), blankURL());
@@ -1621,6 +1623,11 @@
static_cast<TestController*>(const_cast<void*>(clientInfo))->didFinishNavigation(page, navigation);
}
+void TestController::didReceiveServerRedirectForProvisionalNavigation(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData, const void* clientInfo)
+{
+ static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveServerRedirectForProvisionalNavigation(page, navigation, userData);
+}
+
bool TestController::canAuthenticateAgainstProtectionSpace(WKPageRef page, WKProtectionSpaceRef protectionSpace, const void* clientInfo)
{
return static_cast<TestController*>(const_cast<void*>(clientInfo))->canAuthenticateAgainstProtectionSpace(page, protectionSpace);
@@ -1726,6 +1733,12 @@
mainWebView()->focus();
}
+void TestController::didReceiveServerRedirectForProvisionalNavigation(WKPageRef page, WKNavigationRef navigation, WKTypeRef userData)
+{
+ m_didReceiveServerRedirectForProvisionalNavigation = true;
+ return;
+}
+
bool TestController::canAuthenticateAgainstProtectionSpace(WKPageRef page, WKProtectionSpaceRef protectionSpace)
{
if (m_shouldLogCanAuthenticateAgainstProtectionSpace)
Modified: trunk/Tools/WebKitTestRunner/TestController.h (229348 => 229349)
--- trunk/Tools/WebKitTestRunner/TestController.h 2018-03-07 01:02:09 UTC (rev 229348)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2018-03-07 01:15:37 UTC (rev 229349)
@@ -208,6 +208,9 @@
bool hasDOMCache(WKStringRef origin);
uint64_t domCacheSize(WKStringRef origin);
+ bool didReceiveServerRedirectForProvisionalNavigation() const { return m_didReceiveServerRedirectForProvisionalNavigation; }
+ void clearDidReceiveServerRedirectForProvisionalNavigation() { m_didReceiveServerRedirectForProvisionalNavigation = false; }
+
private:
WKRetainPtr<WKPageConfigurationRef> generatePageConfiguration(WKContextConfigurationRef);
WKRetainPtr<WKContextConfigurationRef> generateContextConfiguration() const;
@@ -312,6 +315,9 @@
static void unavailablePluginButtonClicked(WKPageRef, WKPluginUnavailabilityReason, WKDictionaryRef, const void*);
+ static void didReceiveServerRedirectForProvisionalNavigation(WKPageRef, WKNavigationRef, WKTypeRef, const void*);
+ void didReceiveServerRedirectForProvisionalNavigation(WKPageRef, WKNavigationRef, WKTypeRef);
+
static bool canAuthenticateAgainstProtectionSpace(WKPageRef, WKProtectionSpaceRef, const void*);
bool canAuthenticateAgainstProtectionSpace(WKPageRef, WKProtectionSpaceRef);
@@ -418,6 +424,8 @@
bool m_shouldDecideNavigationPolicyAfterDelay { false };
bool m_shouldDecideResponsePolicyAfterDelay { false };
+ bool m_didReceiveServerRedirectForProvisionalNavigation { false };
+
WKRetainPtr<WKArrayRef> m_openPanelFileURLs;
std::unique_ptr<EventSenderProxy> m_eventSenderProxy;
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (229348 => 229349)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2018-03-07 01:02:09 UTC (rev 229348)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2018-03-07 01:15:37 UTC (rev 229349)
@@ -802,6 +802,16 @@
return result;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "DidReceiveServerRedirectForProvisionalNavigation")) {
+ WKRetainPtr<WKBooleanRef> result(AdoptWK, WKBooleanCreate(TestController::singleton().didReceiveServerRedirectForProvisionalNavigation()));
+ return result;
+ }
+
+ if (WKStringIsEqualToUTF8CString(messageName, "ClearDidReceiveServerRedirectForProvisionalNavigation")) {
+ TestController::singleton().clearDidReceiveServerRedirectForProvisionalNavigation();
+ return nullptr;
+ }
+
if (WKStringIsEqualToUTF8CString(messageName, "SecureEventInputIsEnabled")) {
#if PLATFORM(MAC) && !PLATFORM(IOS)
WKRetainPtr<WKBooleanRef> result(AdoptWK, WKBooleanCreate(IsSecureEventInputEnabled()));