Changeset 244321 in webkit
- Timestamp:
- Apr 15, 2019 7:01:32 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r244320 r244321 1 2019-04-15 Chris Dumez <cdumez@apple.com> 2 3 URL set by document.open() is not communicated to the UIProcess 4 https://bugs.webkit.org/show_bug.cgi?id=196941 5 <rdar://problem/49237544> 6 7 Reviewed by Geoffrey Garen. 8 9 Notify the FrameLoaderClient whenever an explicit open was done and provide it with 10 the latest document URL. 11 12 * loader/FrameLoader.cpp: 13 (WebCore::FrameLoader::didExplicitOpen): 14 * loader/FrameLoaderClient.h: 15 1 16 2019-04-15 Eike Rathke <erack@redhat.com> 2 17 -
trunk/Source/WebCore/loader/FrameLoader.cpp
r244161 r244321 593 593 if (!m_stateMachine.committedFirstRealDocumentLoad()) 594 594 m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocumentPostCommit); 595 596 m_client.dispatchDidExplicitOpen(m_frame.document() ? m_frame.document()->url() : URL()); 595 597 596 598 // Prevent window.open(url) -- eg window.open("about:blank") -- from blowing away results -
trunk/Source/WebCore/loader/FrameLoaderClient.h
r244161 r244321 182 182 virtual void dispatchDidFinishDocumentLoad() = 0; 183 183 virtual void dispatchDidFinishLoad() = 0; 184 virtual void dispatchDidExplicitOpen(const URL&) { } 184 185 #if ENABLE(DATA_DETECTION) 185 186 virtual void dispatchDidFinishDataDetection(NSArray *detectionResults) = 0; -
trunk/Source/WebKit/ChangeLog
r244319 r244321 1 2019-04-15 Chris Dumez <cdumez@apple.com> 2 3 URL set by document.open() is not communicated to the UIProcess 4 https://bugs.webkit.org/show_bug.cgi?id=196941 5 <rdar://problem/49237544> 6 7 Reviewed by Geoffrey Garen. 8 9 Whenever the UIProcess is notified of an explicit document.open() call, update the 10 PageLoadState to make sure the URL is up-to-date. Also make sure the page / process 11 knows it committed a load (i.e. It is no longer showing the initially empty document). 12 13 * UIProcess/PageLoadState.cpp: 14 (WebKit::PageLoadState::didExplicitOpen): 15 * UIProcess/PageLoadState.h: 16 * UIProcess/WebPageProxy.cpp: 17 (WebKit::WebPageProxy::didExplicitOpenForFrame): 18 * UIProcess/WebPageProxy.h: 19 * UIProcess/WebPageProxy.messages.in: 20 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 21 (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen): 22 * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 23 1 24 2019-04-15 Alex Christensen <achristensen@webkit.org> 2 25 -
trunk/Source/WebKit/UIProcess/PageLoadState.cpp
r238817 r244321 247 247 } 248 248 249 void PageLoadState::didExplicitOpen(const Transaction::Token& token, const String& url) 250 { 251 ASSERT_UNUSED(token, &token.m_pageLoadState == this); 252 253 m_uncommittedState.state = State::Finished; 254 m_uncommittedState.url = url; 255 m_uncommittedState.provisionalURL = String(); 256 } 257 249 258 void PageLoadState::didStartProvisionalLoad(const Transaction::Token& token, const String& url, const String& unreachableURL) 250 259 { -
trunk/Source/WebKit/UIProcess/PageLoadState.h
r242788 r244321 144 144 145 145 void didStartProvisionalLoad(const Transaction::Token&, const String& url, const String& unreachableURL); 146 void didExplicitOpen(const Transaction::Token&, const String& url); 146 147 void didReceiveServerRedirectForProvisionalLoad(const Transaction::Token&, const String& url); 147 148 void didFailProvisionalLoad(const Transaction::Token&); -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r244307 r244321 3923 3923 } 3924 3924 3925 void WebPageProxy::didExplicitOpenForFrame(uint64_t frameID, URL&& url) 3926 { 3927 auto* frame = m_process->webFrame(frameID); 3928 MESSAGE_CHECK(m_process, frame); 3929 MESSAGE_CHECK_URL(m_process, url); 3930 3931 auto transaction = m_pageLoadState.transaction(); 3932 3933 if (frame->isMainFrame()) 3934 m_pageLoadState.didExplicitOpen(transaction, url); 3935 3936 m_hasCommittedAnyProvisionalLoads = true; 3937 m_process->didCommitProvisionalLoad(); 3938 3939 m_pageLoadState.commitChanges(); 3940 } 3941 3925 3942 void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, ResourceRequest&& request, const UserData& userData) 3926 3943 { -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r244307 r244321 1592 1592 void didSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t sameDocumentNavigationType, URL&&, const UserData&); 1593 1593 void didChangeMainDocument(uint64_t frameID); 1594 void didExplicitOpenForFrame(uint64_t frameID, URL&&); 1594 1595 1595 1596 void didReceiveTitleForFrame(uint64_t frameID, const String&, const UserData&); -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r244307 r244321 141 141 DidDetectXSSForFrame(uint64_t frameID, WebKit::UserData userData) 142 142 DidSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t type, URL url, WebKit::UserData userData) 143 DidChangeMainDocument(uint64_t frameID); 143 DidChangeMainDocument(uint64_t frameID) 144 DidExplicitOpenForFrame(uint64_t frameID, URL url) 144 145 DidDestroyNavigation(uint64_t navigationID) 145 146 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r244212 r244321 459 459 } 460 460 461 void WebFrameLoaderClient::dispatchDidExplicitOpen(const URL& url) 462 { 463 auto* webPage = m_frame->page(); 464 if (!webPage) 465 return; 466 467 // Notify the UIProcess. 468 webPage->send(Messages::WebPageProxy::DidExplicitOpenForFrame(m_frame->frameID(), url)); 469 } 470 461 471 void WebFrameLoaderClient::dispatchDidStartProvisionalLoad() 462 472 { -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
r244161 r244321 117 117 void dispatchDidFinishDocumentLoad() final; 118 118 void dispatchDidFinishLoad() final; 119 void dispatchDidExplicitOpen(const URL&) final; 119 120 120 121 void dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone>) final; -
trunk/Tools/ChangeLog
r244310 r244321 1 2019-04-15 Chris Dumez <cdumez@apple.com> 2 3 URL set by document.open() is not communicated to the UIProcess 4 https://bugs.webkit.org/show_bug.cgi?id=196941 5 <rdar://problem/49237544> 6 7 Reviewed by Geoffrey Garen. 8 9 Add API test coverage. 10 11 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 12 * TestWebKitAPI/Tests/WebKit/open-window-then-write-to-it.html: Added. 13 * TestWebKitAPI/Tests/WebKitCocoa/OpenAndCloseWindow.mm: 14 (-[OpenWindowThenDocumentOpenUIDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]): 15 (TEST): 16 1 17 2019-04-15 Dean Johnson <dean_johnson@apple.com> 2 18 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r244151 r244321 189 189 467C565321B5ED130057516D /* GetSessionCookie.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 467C565121B5ECDF0057516D /* GetSessionCookie.html */; }; 190 190 467C565421B5ED130057516D /* SetSessionCookie.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 467C565221B5ECDF0057516D /* SetSessionCookie.html */; }; 191 468BC45522653A1000A36C96 /* open-window-then-write-to-it.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 468BC454226539C800A36C96 /* open-window-then-write-to-it.html */; }; 191 192 46918EFC2237283C00468DFE /* DeviceOrientation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46918EFB2237283500468DFE /* DeviceOrientation.mm */; }; 192 193 46A911592108E6780078D40D /* CustomUserAgent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46A911582108E66B0078D40D /* CustomUserAgent.mm */; }; … … 1244 1245 CEA6CF2819CCF69D0064F5A7 /* open-and-close-window.html in Copy Resources */, 1245 1246 7CCB99231D3B4A46003922F6 /* open-multiple-external-url.html in Copy Resources */, 1247 468BC45522653A1000A36C96 /* open-window-then-write-to-it.html in Copy Resources */, 1246 1248 290A9BB91735F63800D71BBC /* OpenNewWindow.html in Copy Resources */, 1247 1249 83148B09202AC78D00BADE99 /* override-builtins-test.html in Copy Resources */, … … 1577 1579 467C565121B5ECDF0057516D /* GetSessionCookie.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = GetSessionCookie.html; sourceTree = "<group>"; }; 1578 1580 467C565221B5ECDF0057516D /* SetSessionCookie.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = SetSessionCookie.html; sourceTree = "<group>"; }; 1581 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>"; }; 1579 1582 46918EFB2237283500468DFE /* DeviceOrientation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DeviceOrientation.mm; sourceTree = "<group>"; }; 1580 1583 46A911582108E66B0078D40D /* CustomUserAgent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CustomUserAgent.mm; sourceTree = "<group>"; }; … … 3419 3422 4A410F4D19AF7BEF002EBAB6 /* ondevicechange.html */, 3420 3423 CEA6CF2719CCF69D0064F5A7 /* open-and-close-window.html */, 3424 468BC454226539C800A36C96 /* open-window-then-write-to-it.html */, 3421 3425 83148B08202AC76800BADE99 /* override-builtins-test.html */, 3422 3426 0EBBCC651FFF9DCE00FA42AB /* pop-up-check.html */, -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/OpenAndCloseWindow.mm
r242339 r244321 283 283 openWindowFeatures = nullptr; 284 284 } 285 286 @interface OpenWindowThenDocumentOpenUIDelegate : NSObject <WKUIDelegate> 287 @end 288 289 @implementation OpenWindowThenDocumentOpenUIDelegate 290 291 - (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures 292 { 293 openedWebView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration]); 294 [openedWebView setUIDelegate:sharedUIDelegate.get()]; 295 return openedWebView.get(); 296 } 297 298 @end 299 300 TEST(WebKit, OpenWindowThenDocumentOpen) 301 { 302 resetToConsistentState(); 303 304 auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]); 305 306 auto uiDelegate = adoptNS([[OpenWindowThenDocumentOpenUIDelegate alloc] init]); 307 [webView setUIDelegate:uiDelegate.get()]; 308 [webView configuration].preferences.javaScriptCanOpenWindowsAutomatically = YES; 309 310 NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"open-window-then-write-to-it" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]; 311 [webView loadRequest:request]; 312 313 while (!openedWebView) 314 TestWebKitAPI::Util::sleep(0.1); 315 316 // Both WebViews should have the same URL because of document.open(). 317 while (![[[openedWebView URL] absoluteString] isEqualToString:[[webView URL] absoluteString]]) 318 TestWebKitAPI::Util::sleep(0.1); 319 }
Note: See TracChangeset
for help on using the changeset viewer.