Changeset 267614 in webkit
- Timestamp:
- Sep 25, 2020 5:50:00 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 32 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r267613 r267614 1 2020-09-25 Chris Dumez <cdumez@apple.com> 2 3 visibilitychange:hidden doesn't fire during page navigations 4 https://bugs.webkit.org/show_bug.cgi?id=151234 5 <rdar://problem/23688763> 6 7 Reviewed by Ryosuke Niwa. 8 9 Add test coverage for the visibilitychange event and document.visibilitystate when entering 10 and coming out of the back/forward cache. 11 12 * fast/history/back-forward-cache-visibility-state-expected.txt: Added. 13 * fast/history/back-forward-cache-visibility-state.html: Added. 14 1 15 2020-09-25 James Darpinian <jdarpinian@chromium.org> 2 16 -
trunk/LayoutTests/imported/w3c/ChangeLog
r267593 r267614 1 2020-09-25 Chris Dumez <cdumez@apple.com> 2 3 visibilitychange:hidden doesn't fire during page navigations 4 https://bugs.webkit.org/show_bug.cgi?id=151234 5 <rdar://problem/23688763> 6 7 Reviewed by Ryosuke Niwa. 8 9 Import page-visibility WPT tests from upstream. 10 11 * resources/import-expectations.json: 12 * web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/no_window_open_when_term_nesting_level_nonzero.window-expected.txt: 13 * web-platform-tests/page-visibility/*: Added. 14 1 15 2020-09-25 Chris Dumez <cdumez@apple.com> 2 16 -
trunk/LayoutTests/imported/w3c/resources/import-expectations.json
r267593 r267614 337 337 "web-platform-tests/orientation-event": "skip", 338 338 "web-platform-tests/orientation-sensor": "skip", 339 "web-platform-tests/page-visibility": " skip",339 "web-platform-tests/page-visibility": "import", 340 340 "web-platform-tests/paint-timing": "skip", 341 341 "web-platform-tests/payment-handler": "skip", -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/no_window_open_when_term_nesting_level_nonzero.window-expected.txt
r267593 r267614 1 1 CONSOLE MESSAGE: Error: assert_equals: expected no popup during pagehide expected null but got object "[object Window]" 2 CONSOLE MESSAGE: Error: assert_equals: expected no popup during visibilitychange expected null but got object "[object Window]" 2 3 CONSOLE MESSAGE: Error: assert_equals: expected no popup during unload expected null but got object "[object Window]" 3 4 -
trunk/Source/WebCore/ChangeLog
r267613 r267614 1 2020-09-25 Chris Dumez <cdumez@apple.com> 2 3 visibilitychange:hidden doesn't fire during page navigations 4 https://bugs.webkit.org/show_bug.cgi?id=151234 5 <rdar://problem/23688763> 6 7 Reviewed by Ryosuke Niwa. 8 9 Fire a visibilitychange during document unload, as per the specification: 10 - https://www.w3.org/TR/page-visibility/#reacting-to-visibilitychange-changes 11 - https://html.spec.whatwg.org/multipage/browsing-the-web.html#unloading-document-visibility-change-steps 12 13 Note that the specification currently says to fire the visibilitychange event before the pagehide event. 14 However, Both Chrome and Firefox fire the pagehide event then the visibilitychange event. This change 15 aligns our behavior with both Chrome and Firefox. The following bug has been filed against the 16 specification: 17 - https://github.com/w3c/page-visibility/issues/67 18 19 We also fire a visibilitychange event when coming out of the back/forward cache. This makes sense given 20 that we fire one when the document enters the back/forward cache. This is also Firefox's behavior. 21 I have verified that the new fast/history/back-forward-cache-visibility-state.html layout test is passing 22 in Firefox. 23 24 Tests: fast/history/back-forward-cache-visibility-state.html 25 imported/w3c/web-platform-tests/page-visibility/idlharness.window.html 26 imported/w3c/web-platform-tests/page-visibility/iframe-unload.html 27 imported/w3c/web-platform-tests/page-visibility/onvisibilitychange.html 28 imported/w3c/web-platform-tests/page-visibility/test_attributes_exist.html 29 imported/w3c/web-platform-tests/page-visibility/test_child_document.html 30 imported/w3c/web-platform-tests/page-visibility/test_default_view.html 31 imported/w3c/web-platform-tests/page-visibility/test_read_only.html 32 imported/w3c/web-platform-tests/page-visibility/unload-bubbles.html 33 imported/w3c/web-platform-tests/page-visibility/unload.html 34 35 * dom/Document.cpp: 36 (WebCore::Document::visibilityState const): 37 (WebCore::Document::setHiddenDueToDismissal): 38 * dom/Document.h: 39 * history/CachedPage.cpp: 40 (WebCore::firePageShowAndPopStateEvents): 41 * loader/FrameLoader.cpp: 42 (WebCore::FrameLoader::dispatchUnloadEvents): 43 1 44 2020-09-25 James Darpinian <jdarpinian@chromium.org> 2 45 -
trunk/Source/WebCore/dom/Document.cpp
r267611 r267614 1773 1773 // that the page is hidden, as specified by the spec: 1774 1774 // https://w3c.github.io/page-visibility/#visibilitystate-attribute 1775 if (!m_frame || !m_frame->page() )1775 if (!m_frame || !m_frame->page() || m_visibilityHiddenDueToDismissal) 1776 1776 return VisibilityState::Hidden; 1777 1777 return m_frame->page()->visibilityState(); … … 3258 3258 } 3259 3259 3260 void Document::setVisibilityHiddenDueToDismissal(bool hiddenDueToDismissal) 3261 { 3262 if (m_visibilityHiddenDueToDismissal == hiddenDueToDismissal) 3263 return; 3264 3265 m_visibilityHiddenDueToDismissal = hiddenDueToDismissal; 3266 dispatchEvent(Event::create(eventNames().visibilitychangeEvent, Event::CanBubble::Yes, Event::IsCancelable::No)); 3267 } 3268 3260 3269 Seconds Document::domTimerAlignmentInterval(bool hasReachedMaxNestingLevel) const 3261 3270 { -
trunk/Source/WebCore/dom/Document.h
r267593 r267614 492 492 bool isTimerThrottlingEnabled() const { return m_isTimerThrottlingEnabled; } 493 493 494 void setVisibilityHiddenDueToDismissal(bool); 495 494 496 WEBCORE_EXPORT ExceptionOr<Ref<Node>> adoptNode(Node& source); 495 497 … … 2129 2131 bool m_hasVisuallyNonEmptyCustomContent { false }; 2130 2132 2133 bool m_visibilityHiddenDueToDismissal { false }; 2134 2131 2135 Ref<UndoManager> m_undoManager; 2132 2136 #if PLATFORM(IOS_FAMILY) -
trunk/Source/WebCore/history/CachedPage.cpp
r266061 r267614 93 93 continue; 94 94 95 // FIXME: Update Page Visibility state here. 96 // https://bugs.webkit.org/show_bug.cgi?id=116770 95 // This takes care of firing the visibilitychange event and making sure the document is reported as visible. 96 document->setVisibilityHiddenDueToDismissal(false); 97 97 98 document->dispatchPageshowEvent(PageshowEventPersisted); 98 99 -
trunk/Source/WebCore/loader/FrameLoader.cpp
r267593 r267614 3281 3281 } 3282 3282 3283 // FIXME: update Page Visibility state here.3284 // https://bugs.webkit.org/show_bug.cgi?id=1167703283 // This takes care of firing the visibilitychange event and making sure the document is reported as hidden. 3284 m_frame.document()->setVisibilityHiddenDueToDismissal(true); 3285 3285 3286 3286 if (m_frame.document()->backForwardCacheState() == Document::NotInBackForwardCache) {
Note: See TracChangeset
for help on using the changeset viewer.