Changeset 246456 in webkit
- Timestamp:
- Jun 14, 2019 8:20:42 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r246452 r246456 1 2019-06-14 Devin Rousso <drousso@apple.com> 2 3 waitForNavigationToComplete may be called before WebPageProxy knows it's loading 4 https://bugs.webkit.org/show_bug.cgi?id=198741 5 <rdar://problem/31164316> 6 7 Reviewed by Joseph Pecoraro. 8 9 There's a potential race in `WebAutomationSession::waitForNavigationToCompleteOnPage` when 10 querying for the `WebPageProxy`'s loading state (via `PageLoadingState::isLoading`), in that 11 a pending load may be committed _after_ the `WebAutomationSession` checks it's value. This 12 makes the automation session think that it isn't loading, so it will continue running 13 commands, which can lead to a JavaScript error ("Callback was not called before the unload 14 event") as any injected scripts will be cleared by the impending navigation, leaving the 15 script evaluation callbacks "dangling". 16 17 Expose more information from `PageLoadState` about whether it thinks there _may_ be a 18 navigation currently happening, which the `WebAutomationSession` can use to delay commands. 19 20 In the best case, no navigations are "missed". 21 22 In the worst case, the automation session will wait `pageLoadTimeout` before continuing. 23 24 * UIProcess/Automation/WebAutomationSession.cpp: 25 (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage): 26 27 * UIProcess/PageLoadState.h: 28 * UIProcess/PageLoadState.cpp: 29 (WebKit::PageLoadState::hasUncommittedLoad const): Added. 30 1 31 2019-06-14 Youenn Fablet <youenn@apple.com> 2 32 -
trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
r245796 r246456 485 485 { 486 486 ASSERT(!m_loadTimer.isActive()); 487 if (loadStrategy == Inspector::Protocol::Automation::PageLoadStrategy::None || !page.pageLoadState().isLoading()) {487 if (loadStrategy == Inspector::Protocol::Automation::PageLoadStrategy::None || (!page.pageLoadState().isLoading() && !page.pageLoadState().hasUncommittedLoad())) { 488 488 callback->sendSuccess(JSON::Object::create()); 489 489 return; -
trunk/Source/WebKit/UIProcess/PageLoadState.cpp
r244361 r246456 173 173 } 174 174 175 bool PageLoadState::hasUncommittedLoad() const 176 { 177 return isLoading(m_uncommittedState); 178 } 179 175 180 String PageLoadState::activeURL(const Data& data) 176 181 { -
trunk/Source/WebKit/UIProcess/PageLoadState.h
r244361 r246456 126 126 bool isFinished() const { return m_committedState.state == State::Finished; } 127 127 128 bool hasUncommittedLoad() const; 129 128 130 const String& provisionalURL() const { return m_committedState.provisionalURL; } 129 131 const String& url() const { return m_committedState.url; }
Note: See TracChangeset
for help on using the changeset viewer.