Diff
Modified: trunk/Source/WebCore/ChangeLog (251786 => 251787)
--- trunk/Source/WebCore/ChangeLog 2019-10-30 18:32:59 UTC (rev 251786)
+++ trunk/Source/WebCore/ChangeLog 2019-10-30 18:36:22 UTC (rev 251787)
@@ -1,3 +1,18 @@
+2019-10-30 Chris Dumez <[email protected]>
+
+ WKFrameIsDisplayingMarkupDocument() should return true after a window.open/document.write
+ https://bugs.webkit.org/show_bug.cgi?id=203587
+ <rdar://problem/56717726>
+
+ Reviewed by Alex Christensen.
+
+ When doing a document.open(), we were propagating the document's URL to the UIProcess but not its
+ MIME type. WKFrameIsDisplayingMarkupDocument() was relying on this MIME type.
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::didExplicitOpen):
+ * loader/FrameLoaderClient.h:
+
2019-10-30 Antoine Quint <[email protected]>
[Web Animations] Precompute an animation effect's active duration and end time
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (251786 => 251787)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2019-10-30 18:32:59 UTC (rev 251786)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2019-10-30 18:36:22 UTC (rev 251787)
@@ -595,7 +595,8 @@
if (!m_stateMachine.committedFirstRealDocumentLoad())
m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocumentPostCommit);
- m_client.dispatchDidExplicitOpen(m_frame.document() ? m_frame.document()->url() : URL());
+ if (auto* document = m_frame.document())
+ m_client.dispatchDidExplicitOpen(document->url(), document->contentType());
// Prevent window.open(url) -- eg window.open("about:blank") -- from blowing away results
// from a subsequent window.document.open / window.document.write call.
Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (251786 => 251787)
--- trunk/Source/WebCore/loader/FrameLoaderClient.h 2019-10-30 18:32:59 UTC (rev 251786)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h 2019-10-30 18:36:22 UTC (rev 251787)
@@ -178,7 +178,7 @@
virtual void dispatchDidFailLoad(const ResourceError&) = 0;
virtual void dispatchDidFinishDocumentLoad() = 0;
virtual void dispatchDidFinishLoad() = 0;
- virtual void dispatchDidExplicitOpen(const URL&) { }
+ virtual void dispatchDidExplicitOpen(const URL&, const String& /* mimeType */) { }
#if ENABLE(DATA_DETECTION)
virtual void dispatchDidFinishDataDetection(NSArray *detectionResults) = 0;
#endif
Modified: trunk/Source/WebKit/ChangeLog (251786 => 251787)
--- trunk/Source/WebKit/ChangeLog 2019-10-30 18:32:59 UTC (rev 251786)
+++ trunk/Source/WebKit/ChangeLog 2019-10-30 18:36:22 UTC (rev 251787)
@@ -1,5 +1,27 @@
2019-10-30 Chris Dumez <[email protected]>
+ WKFrameIsDisplayingMarkupDocument() should return true after a window.open/document.write
+ https://bugs.webkit.org/show_bug.cgi?id=203587
+ <rdar://problem/56717726>
+
+ Reviewed by Alex Christensen.
+
+ When doing a document.open(), we were propagating the document's URL to the UIProcess but not its
+ MIME type. WKFrameIsDisplayingMarkupDocument() was relying on this MIME type.
+
+ * UIProcess/WebFrameProxy.cpp:
+ (WebKit::WebFrameProxy::didExplicitOpen):
+ * UIProcess/WebFrameProxy.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::didExplicitOpenForFrame):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+
+2019-10-30 Chris Dumez <[email protected]>
+
REGRESSION (r238252): HTTP POST is losing application/x-www-form-urlencoded body if there's a redirect to different host
https://bugs.webkit.org/show_bug.cgi?id=201950
<rdar://problem/55577782>
Modified: trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp (251786 => 251787)
--- trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp 2019-10-30 18:32:59 UTC (rev 251786)
+++ trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp 2019-10-30 18:36:22 UTC (rev 251787)
@@ -146,9 +146,10 @@
m_frameLoadState.didStartProvisionalLoad(url);
}
-void WebFrameProxy::didExplicitOpen(const URL& url)
+void WebFrameProxy::didExplicitOpen(URL&& url, String&& mimeType)
{
- m_frameLoadState.didExplicitOpen(url);
+ m_MIMEType = WTFMove(mimeType);
+ m_frameLoadState.didExplicitOpen(WTFMove(url));
}
void WebFrameProxy::didReceiveServerRedirectForProvisionalLoad(const URL& url)
Modified: trunk/Source/WebKit/UIProcess/WebFrameProxy.h (251786 => 251787)
--- trunk/Source/WebKit/UIProcess/WebFrameProxy.h 2019-10-30 18:32:59 UTC (rev 251786)
+++ trunk/Source/WebKit/UIProcess/WebFrameProxy.h 2019-10-30 18:36:22 UTC (rev 251787)
@@ -111,7 +111,7 @@
void getResourceData(API::URL*, Function<void (API::Data*, CallbackBase::Error)>&&);
void didStartProvisionalLoad(const URL&);
- void didExplicitOpen(const URL&);
+ void didExplicitOpen(URL&&, String&& mimeType);
void didReceiveServerRedirectForProvisionalLoad(const URL&);
void didFailProvisionalLoad();
void didCommitLoad(const String& contentType, WebCertificateInfo&, bool containsPluginDocument);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (251786 => 251787)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-10-30 18:32:59 UTC (rev 251786)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-10-30 18:36:22 UTC (rev 251787)
@@ -4132,7 +4132,7 @@
#endif
}
-void WebPageProxy::didExplicitOpenForFrame(FrameIdentifier frameID, URL&& url)
+void WebPageProxy::didExplicitOpenForFrame(FrameIdentifier frameID, URL&& url, String&& mimeType)
{
auto* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(m_process, frame);
@@ -4143,7 +4143,7 @@
if (frame->isMainFrame())
m_pageLoadState.didExplicitOpen(transaction, url);
- frame->didExplicitOpen(url);
+ frame->didExplicitOpen(WTFMove(url), WTFMove(mimeType));
m_hasCommittedAnyProvisionalLoads = true;
m_process->didCommitProvisionalLoad();
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (251786 => 251787)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-10-30 18:32:59 UTC (rev 251786)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-10-30 18:36:22 UTC (rev 251787)
@@ -1675,7 +1675,7 @@
void didFailLoadForFrame(WebCore::FrameIdentifier, uint64_t navigationID, const WebCore::ResourceError&, const UserData&);
void didSameDocumentNavigationForFrame(WebCore::FrameIdentifier, uint64_t navigationID, uint32_t sameDocumentNavigationType, URL&&, const UserData&);
void didChangeMainDocument(WebCore::FrameIdentifier);
- void didExplicitOpenForFrame(WebCore::FrameIdentifier, URL&&);
+ void didExplicitOpenForFrame(WebCore::FrameIdentifier, URL&&, String&& mimeType);
void didReceiveTitleForFrame(WebCore::FrameIdentifier, const String&, const UserData&);
void didFirstLayoutForFrame(WebCore::FrameIdentifier, const UserData&);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (251786 => 251787)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2019-10-30 18:32:59 UTC (rev 251786)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2019-10-30 18:36:22 UTC (rev 251787)
@@ -142,7 +142,7 @@
DidDetectXSSForFrame(WebCore::FrameIdentifier frameID, WebKit::UserData userData)
DidSameDocumentNavigationForFrame(WebCore::FrameIdentifier frameID, uint64_t navigationID, uint32_t type, URL url, WebKit::UserData userData)
DidChangeMainDocument(WebCore::FrameIdentifier frameID)
- DidExplicitOpenForFrame(WebCore::FrameIdentifier frameID, URL url)
+ DidExplicitOpenForFrame(WebCore::FrameIdentifier frameID, URL url, String mimeType)
DidDestroyNavigation(uint64_t navigationID)
HasInsecureContent() -> (enum:bool WebCore::HasInsecureContent hasInsecureContent) Synchronous
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (251786 => 251787)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2019-10-30 18:32:59 UTC (rev 251786)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2019-10-30 18:36:22 UTC (rev 251787)
@@ -477,7 +477,7 @@
notImplemented();
}
-void WebFrameLoaderClient::dispatchDidExplicitOpen(const URL& url)
+void WebFrameLoaderClient::dispatchDidExplicitOpen(const URL& url, const String& mimeType)
{
auto* webPage = m_frame->page();
if (!webPage)
@@ -484,7 +484,7 @@
return;
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidExplicitOpenForFrame(m_frame->frameID(), url));
+ webPage->send(Messages::WebPageProxy::DidExplicitOpenForFrame(m_frame->frameID(), url, mimeType));
}
void WebFrameLoaderClient::dispatchDidStartProvisionalLoad()
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (251786 => 251787)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2019-10-30 18:32:59 UTC (rev 251786)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2019-10-30 18:36:22 UTC (rev 251787)
@@ -119,7 +119,7 @@
void dispatchDidFailLoad(const WebCore::ResourceError&) final;
void dispatchDidFinishDocumentLoad() final;
void dispatchDidFinishLoad() final;
- void dispatchDidExplicitOpen(const URL&) final;
+ void dispatchDidExplicitOpen(const URL&, const String& mimeType) final;
void dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone>) final;
void dispatchDidLayout() final;
Modified: trunk/Tools/ChangeLog (251786 => 251787)
--- trunk/Tools/ChangeLog 2019-10-30 18:32:59 UTC (rev 251786)
+++ trunk/Tools/ChangeLog 2019-10-30 18:36:22 UTC (rev 251787)
@@ -1,3 +1,20 @@
+2019-10-30 Chris Dumez <[email protected]>
+
+ WKFrameIsDisplayingMarkupDocument() should return true after a window.open/document.write
+ https://bugs.webkit.org/show_bug.cgi?id=203587
+ <rdar://problem/56717726>
+
+ Reviewed by Alex Christensen.
+
+ Add API test coverage.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit/CloseFromWithinCreatePage.cpp:
+ (TestWebKitAPI::createNewPageThenClose):
+ (TestWebKitAPI::TEST):
+ (TestWebKitAPI::createNewPage):
+ * TestWebKitAPI/Tests/WebKit/window-open-then-document-open.html: Added.
+
2019-10-29 Andy Estes <[email protected]>
[Quick Look] Clean up LegacyPreviewLoaderClients
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (251786 => 251787)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2019-10-30 18:32:59 UTC (rev 251786)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2019-10-30 18:36:22 UTC (rev 251787)
@@ -234,6 +234,7 @@
467C565321B5ED130057516D /* GetSessionCookie.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 467C565121B5ECDF0057516D /* GetSessionCookie.html */; };
467C565421B5ED130057516D /* SetSessionCookie.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 467C565221B5ECDF0057516D /* SetSessionCookie.html */; };
468BC45522653A1000A36C96 /* open-window-then-write-to-it.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 468BC454226539C800A36C96 /* open-window-then-write-to-it.html */; };
+ 468F2F942368DAF100F4B864 /* window-open-then-document-open.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 468F2F932368DAA700F4B864 /* window-open-then-document-open.html */; };
46918EFC2237283C00468DFE /* DeviceOrientation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46918EFB2237283500468DFE /* DeviceOrientation.mm */; };
46A911592108E6780078D40D /* CustomUserAgent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46A911582108E66B0078D40D /* CustomUserAgent.mm */; };
46AE5A3720F9066D00E0873E /* SimpleServiceWorkerRegistrations-4.sqlite3 in Copy Resources */ = {isa = PBXBuildFile; fileRef = 4656A75720F9054F0002E21F /* SimpleServiceWorkerRegistrations-4.sqlite3 */; };
@@ -1470,6 +1471,7 @@
5120C83E1E67678F0025B250 /* WebsiteDataStoreCustomPaths.html in Copy Resources */,
2E131C181D83A98A001BA36C /* wide-autoplaying-video-with-audio.html in Copy Resources */,
CE14F1A4181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html in Copy Resources */,
+ 468F2F942368DAF100F4B864 /* window-open-then-document-open.html in Copy Resources */,
A5E2027515B21F6E00C13E14 /* WindowlessWebViewWithMedia.html in Copy Resources */,
);
name = "Copy Resources";
@@ -1752,6 +1754,7 @@
467C565121B5ECDF0057516D /* GetSessionCookie.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = GetSessionCookie.html; sourceTree = "<group>"; };
467C565221B5ECDF0057516D /* SetSessionCookie.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = SetSessionCookie.html; sourceTree = "<group>"; };
468BC454226539C800A36C96 /* open-window-then-write-to-it.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "open-window-then-write-to-it.html"; sourceTree = "<group>"; };
+ 468F2F932368DAA700F4B864 /* window-open-then-document-open.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "window-open-then-document-open.html"; sourceTree = "<group>"; };
46918EFB2237283500468DFE /* DeviceOrientation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DeviceOrientation.mm; sourceTree = "<group>"; };
46A911582108E66B0078D40D /* CustomUserAgent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CustomUserAgent.mm; sourceTree = "<group>"; };
46C519D81D355A7300DAA51A /* LocalStorageNullEntries.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalStorageNullEntries.mm; sourceTree = "<group>"; };
@@ -3840,6 +3843,7 @@
C9C9A91C21DED79400FDE96E /* video-with-play-button.html */,
07CD32F72065B72A0064A4BE /* video.html */,
1C2B81841C8924A200A5529F /* webfont.html */,
+ 468F2F932368DAA700F4B864 /* window-open-then-document-open.html */,
);
name = Resources;
sourceTree = "<group>";
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit/CloseFromWithinCreatePage.cpp (251786 => 251787)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit/CloseFromWithinCreatePage.cpp 2019-10-30 18:32:59 UTC (rev 251786)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/CloseFromWithinCreatePage.cpp 2019-10-30 18:36:22 UTC (rev 251787)
@@ -42,7 +42,7 @@
testDone = true;
}
-static WKPageRef createNewPage(WKPageRef page, WKURLRequestRef urlRequest, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo)
+static WKPageRef createNewPageThenClose(WKPageRef page, WKURLRequestRef urlRequest, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo)
{
EXPECT_TRUE(openedWebView == nullptr);
@@ -71,7 +71,7 @@
memset(&uiClient, 0, sizeof(uiClient));
uiClient.base.version = 5;
- uiClient.createNewPage = createNewPage;
+ uiClient.createNewPage = createNewPageThenClose;
uiClient.runJavaScriptAlert = runJavaScriptAlert;
WKPageSetPageUIClient(webView.page(), &uiClient.base);
@@ -89,6 +89,55 @@
openedWebView = nullptr;
}
+static WKPageRef createNewPage(WKPageRef page, WKURLRequestRef urlRequest, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo)
+{
+ EXPECT_TRUE(openedWebView == nullptr);
+
+ openedWebView = makeUnique<PlatformWebView>(page);
+
+ WKPageUIClientV5 uiClient;
+ memset(&uiClient, 0, sizeof(uiClient));
+
+ uiClient.base.version = 5;
+ uiClient.runJavaScriptAlert = runJavaScriptAlert;
+ WKPageSetPageUIClient(openedWebView->page(), &uiClient.base);
+
+ WKRetain(openedWebView->page());
+ return openedWebView->page();
}
+TEST(WebKit, CreatePageThenDocumentOpenMIMEType)
+{
+ WKRetainPtr<WKContextRef> context = adoptWK(WKContextCreateWithConfiguration(nullptr));
+
+ PlatformWebView webView(context.get());
+
+ WKPageUIClientV5 uiClient;
+ memset(&uiClient, 0, sizeof(uiClient));
+
+ uiClient.base.version = 5;
+ uiClient.createNewPage = createNewPage;
+ uiClient.runJavaScriptAlert = runJavaScriptAlert;
+ WKPageSetPageUIClient(webView.page(), &uiClient.base);
+
+ // Allow file URLs to load non-file resources
+ WKRetainPtr<WKPreferencesRef> preferences = adoptWK(WKPreferencesCreate());
+ WKPageGroupRef pageGroup = WKPageGetPageGroup(webView.page());
+ WKPreferencesSetUniversalAccessFromFileURLsAllowed(preferences.get(), true);
+ WKPageGroupSetPreferences(pageGroup, preferences.get());
+
+ testDone = false;
+ WKRetainPtr<WKURLRef> url = "" "html"));
+ WKPageLoadURL(webView.page(), url.get());
+ Util::run(&testDone);
+
+ auto page = openedWebView->page();
+ auto mainFrame = WKPageGetMainFrame(page);
+ EXPECT_TRUE(WKFrameIsDisplayingMarkupDocument(mainFrame));
+
+ openedWebView = nullptr;
+}
+
+}
+
#endif
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit/window-open-then-document-open.html (0 => 251787)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit/window-open-then-document-open.html (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/window-open-then-document-open.html 2019-10-30 18:36:22 UTC (rev 251787)
@@ -0,0 +1,13 @@
+<html>
+<body>
+<script>
+function runTest()
+{
+ w = window.open("foo.html");
+ w.document.open();
+ w.document.write("<html><body><script>setTimeout(() => { alert('foo'); }, 0);<" + "/script></body></html>");
+}
+</script>
+<body _onload_="runTest()">
+</body>
+</html>