Source/WebCore/ChangeLog

 12020-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 NOBODY (OOPS!).
 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 Tests: imported/w3c/web-platform-tests/page-visibility/idlharness.window.html
 14 imported/w3c/web-platform-tests/page-visibility/iframe-unload.html
 15 imported/w3c/web-platform-tests/page-visibility/onvisibilitychange.html
 16 imported/w3c/web-platform-tests/page-visibility/test_attributes_exist.html
 17 imported/w3c/web-platform-tests/page-visibility/test_child_document.html
 18 imported/w3c/web-platform-tests/page-visibility/test_default_view.html
 19 imported/w3c/web-platform-tests/page-visibility/test_read_only.html
 20 imported/w3c/web-platform-tests/page-visibility/unload-bubbles.html
 21 imported/w3c/web-platform-tests/page-visibility/unload.html
 22
 23 * dom/Document.cpp:
 24 (WebCore::Document::visibilityState const):
 25 * dom/Document.h:
 26 (WebCore::Document::setVisibilityStateOverride):
 27 * loader/FrameLoader.cpp:
 28 (WebCore::FrameLoader::dispatchUnloadEvents):
 29
1302020-09-25 Peng Liu <peng.liu6@apple.com>
231
332 Clean up VideoLayerManagerObjC

Source/WebCore/dom/Document.cpp

@@VisibilityState Document::visibilityState() const
17741774 // https://w3c.github.io/page-visibility/#visibilitystate-attribute
17751775 if (!m_frame || !m_frame->page())
17761776 return VisibilityState::Hidden;
 1777
 1778 if (m_visibilityStateOverride)
 1779 return *m_visibilityStateOverride;
 1780
17771781 return m_frame->page()->visibilityState();
17781782}
17791783

Source/WebCore/dom/Document.h

@@public:
484484 String documentURI() const { return m_documentURI; }
485485 WEBCORE_EXPORT void setDocumentURI(const String&);
486486
 487 void setVisibilityStateOverride(Optional<VisibilityState> visibilityState) { m_visibilityStateOverride = visibilityState; }
487488 WEBCORE_EXPORT VisibilityState visibilityState() const;
488489 void visibilityStateChanged();
489490 WEBCORE_EXPORT bool hidden() const;

@@private:
18391840 HashSet<Element*> m_articleElements;
18401841
18411842 HashSet<VisibilityChangeClient*> m_visibilityStateCallbackClients;
 1843 Optional<VisibilityState> m_visibilityStateOverride;
18421844
18431845 std::unique_ptr<HashMap<String, Element*, ASCIICaseInsensitiveHash>> m_accessKeyCache;
18441846

Source/WebCore/loader/FrameLoader.cpp

@@void FrameLoader::dispatchUnloadEvents(UnloadEventPolicy unloadEventPolicy)
32753275 if (is<HTMLInputElement>(currentFocusedElement))
32763276 downcast<HTMLInputElement>(*currentFocusedElement).endEditing();
32773277 if (m_pageDismissalEventBeingDispatched == PageDismissalType::None) {
 3278 // Dispatch visibilitychange event.
 3279 m_frame.document()->setVisibilityStateOverride(VisibilityState::Hidden);
 3280 m_frame.document()->dispatchEvent(Event::create(eventNames().visibilitychangeEvent, Event::CanBubble::Yes, Event::IsCancelable::No));
 3281
32783282 if (unloadEventPolicy == UnloadEventPolicyUnloadAndPageHide) {
32793283 m_pageDismissalEventBeingDispatched = PageDismissalType::PageHide;
32803284 m_frame.document()->domWindow()->dispatchEvent(PageTransitionEvent::create(eventNames().pagehideEvent, m_frame.document()->backForwardCacheState() == Document::AboutToEnterBackForwardCache), m_frame.document());
32813285 }
32823286
3283  // FIXME: update Page Visibility state here.
3284  // https://bugs.webkit.org/show_bug.cgi?id=116770
3285 
32863287 if (m_frame.document()->backForwardCacheState() == Document::NotInBackForwardCache) {
32873288 Ref<Event> unloadEvent(Event::create(eventNames().unloadEvent, Event::CanBubble::No, Event::IsCancelable::No));
32883289 // The DocumentLoader (and thus its LoadTiming) might get destroyed

LayoutTests/imported/w3c/ChangeLog

 12020-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 NOBODY (OOPS!).
 8
 9 Import page-visibility WPT tests from upstream.
 10
 11 * resources/import-expectations.json:
 12 * web-platform-tests/page-visibility/META.yml: Added.
 13 * web-platform-tests/page-visibility/idlharness.window-expected.txt: Added.
 14 * web-platform-tests/page-visibility/idlharness.window.html: Added.
 15 * web-platform-tests/page-visibility/idlharness.window.js: Added.
 16 * web-platform-tests/page-visibility/iframe-unload-expected.txt: Added.
 17 * web-platform-tests/page-visibility/iframe-unload.html: Added.
 18 * web-platform-tests/page-visibility/onvisibilitychange-expected.txt: Added.
 19 * web-platform-tests/page-visibility/onvisibilitychange.html: Added.
 20 * web-platform-tests/page-visibility/resources/blank_page_green.html: Added.
 21 * web-platform-tests/page-visibility/resources/iframe-with-subframes.html: Added.
 22 * web-platform-tests/page-visibility/resources/iframe.html: Added.
 23 * web-platform-tests/page-visibility/resources/pagevistestharness.js: Added.
 24 (pv_test):
 25 (test_feature_exists):
 26 (test_equals):
 27 (add_async_result):
 28 (add_async_result_assert):
 29 (TabSwitch):
 30 * web-platform-tests/page-visibility/resources/unload-bubbles.html: Added.
 31 * web-platform-tests/page-visibility/resources/unload.html: Added.
 32 * web-platform-tests/page-visibility/resources/w3c-import.log: Added.
 33 * web-platform-tests/page-visibility/test_attributes_exist-expected.txt: Added.
 34 * web-platform-tests/page-visibility/test_attributes_exist.html: Added.
 35 * web-platform-tests/page-visibility/test_child_document-expected.txt: Added.
 36 * web-platform-tests/page-visibility/test_child_document.html: Added.
 37 * web-platform-tests/page-visibility/test_default_view-expected.txt: Added.
 38 * web-platform-tests/page-visibility/test_default_view.html: Added.
 39 * web-platform-tests/page-visibility/test_read_only-expected.txt: Added.
 40 * web-platform-tests/page-visibility/test_read_only.html: Added.
 41 * web-platform-tests/page-visibility/unload-bubbles-expected.txt: Added.
 42 * web-platform-tests/page-visibility/unload-bubbles.html: Added.
 43 * web-platform-tests/page-visibility/unload-expected.txt: Added.
 44 * web-platform-tests/page-visibility/unload.html: Added.
 45 * web-platform-tests/page-visibility/w3c-import.log: Added.
 46
1472020-09-25 Antoine Quint <graouts@webkit.org>
248
349 Reduce the reliance on PseudoElement in the animation code

LayoutTests/imported/w3c/resources/import-expectations.json

336336 "web-platform-tests/old-tests": "skip",
337337 "web-platform-tests/orientation-event": "skip",
338338 "web-platform-tests/orientation-sensor": "skip",
339  "web-platform-tests/page-visibility": "skip",
 339 "web-platform-tests/page-visibility": "import",
340340 "web-platform-tests/paint-timing": "skip",
341341 "web-platform-tests/payment-handler": "skip",
342342 "web-platform-tests/payment-method-basic-card": "skip",

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

 1CONSOLE MESSAGE: Error: assert_equals: expected no popup during visibilitychange expected null but got object "[object Window]"
12CONSOLE MESSAGE: Error: assert_equals: expected no popup during pagehide expected null but got object "[object Window]"
23CONSOLE MESSAGE: Error: assert_equals: expected no popup during unload expected null but got object "[object Window]"
34

LayoutTests/imported/w3c/web-platform-tests/page-visibility/META.yml

 1spec: https://w3c.github.io/page-visibility/
 2suggested_reviewers:
 3 - plehegar
 4 - igrigorik

LayoutTests/imported/w3c/web-platform-tests/page-visibility/idlharness.window-expected.txt

 1
 2PASS idl_test setup
 3PASS idl_test validation
 4PASS Partial interface Document: original interface defined
 5PASS Partial interface Document: member names are unique
 6PASS Partial interface Document[2]: member names are unique
 7PASS Partial interface Document[3]: member names are unique
 8PASS Document includes NonElementParentNode: member names are unique
 9PASS Document includes ParentNode: member names are unique
 10PASS Document includes XPathEvaluatorBase: member names are unique
 11PASS Document includes GlobalEventHandlers: member names are unique
 12PASS Document includes DocumentAndElementEventHandlers: member names are unique
 13PASS Document interface: attribute hidden
 14PASS Document interface: attribute visibilityState
 15PASS Document interface: attribute onvisibilitychange
 16PASS Document interface: document must inherit property "hidden" with the proper type
 17PASS Document interface: document must inherit property "visibilityState" with the proper type
 18PASS Document interface: document must inherit property "onvisibilitychange" with the proper type
 19

LayoutTests/imported/w3c/web-platform-tests/page-visibility/idlharness.window.html

 1<!-- This file is required for WebKit test infrastructure to run the templated test -->
02\ No newline at end of file

LayoutTests/imported/w3c/web-platform-tests/page-visibility/idlharness.window.js

 1// META: script=/resources/WebIDLParser.js
 2// META: script=/resources/idlharness.js
 3// META: timeout=long
 4
 5'use strict';
 6
 7// https://w3c.github.io/page-visibility/
 8
 9idl_test(
 10 ['page-visibility'],
 11 ['dom', 'html'],
 12 idl_array => {
 13 idl_array.add_objects({
 14 Document: ['document'],
 15 });
 16 }
 17);

LayoutTests/imported/w3c/web-platform-tests/page-visibility/iframe-unload-expected.txt

 1
 2PASS visibilitychange fires on unload with iframes
 3

LayoutTests/imported/w3c/web-platform-tests/page-visibility/iframe-unload.html

 1<html>
 2<title>visibilitychange fires on unload with iframes</title>
 3<script src="/resources/testharness.js"></script>
 4<script src="/resources/testharnessreport.js"></script>
 5<div id="log"></div>
 6<script>
 7
 8var frameDocs = [];
 9var docsLoaded = 0;
 10var numFrames = 3;
 11
 12var ast = new async_test("visibilitychange fires on unload with iframes");
 13
 14function startTest() {
 15 if (++docsLoaded < numFrames)
 16 return;
 17
 18 ast.step(function () {
 19 frameDocs.push(window[0].document);
 20 frameDocs.push(window[0][0].document);
 21 frameDocs.push(window[0][1].document);
 22
 23 for (var i = 0; i < frameDocs.length; ++i) {
 24 frameDocs[i].addEventListener(
 25 "visibilitychange",
 26 onVisibilityChange.bind(null, i), false);
 27 }
 28
 29 document.body.removeChild(document.getElementById("frame1"));
 30 });
 31}
 32
 33var checkedFrames = 0;
 34
 35function onVisibilityChange(i) {
 36 ast.step(function () {
 37 assert_equals(frameDocs[i].visibilityState, "hidden");
 38 });
 39 if (++checkedFrames >= numFrames) {
 40 ast.done();
 41 }
 42}
 43
 44
 45
 46</script>
 47<iframe id="frame1" src="resources/iframe-with-subframes.html"></iframe>
 48</body>
 49</html>

LayoutTests/imported/w3c/web-platform-tests/page-visibility/onvisibilitychange-expected.txt

 1
 2PASS onvisibilitychange attribute is a proper event handler
 3

LayoutTests/imported/w3c/web-platform-tests/page-visibility/onvisibilitychange.html

 1<!doctype html>
 2<title>onvisibilitychange attribute is a proper event handler</title>
 3<script src="/resources/testharness.js"></script>
 4<script src="/resources/testharnessreport.js"></script>
 5<div id="log"></div>
 6<script>
 7var ast = new async_test("onvisibilitychange attribute is a proper event handler");
 8function startTest() {
 9 var iframe1 = document.getElementById("frame1");
 10 iframe1.contentWindow.document.onvisibilitychange = ast.step_func(function() {
 11 ast.done();
 12 });
 13 frame1.parentNode.removeChild(frame1);
 14}
 15</script>
 16<iframe id="frame1" src='resources/iframe.html'></iframe>

LayoutTests/imported/w3c/web-platform-tests/page-visibility/resources/blank_page_green.html

 1<!DOCTYPE HTML>
 2<html>
 3 <head>
 4 <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
 5 <title>Green Test Page</title>
 6 </head>
 7 <body style="background-color:#00FF00;">
 8 <h1>Placeholder</h1>
 9 </body>
 10</html>

LayoutTests/imported/w3c/web-platform-tests/page-visibility/resources/iframe-with-subframes.html

 1<html>
 2<body onload="parent.startTest()">
 3<iframe id="subIframe1" onload="parent.parent.startTest()"></iframe>
 4<iframe id="subIframe2" onload="parent.parent.startTest()"></iframe>
 5</body>
 6</html>

LayoutTests/imported/w3c/web-platform-tests/page-visibility/resources/iframe.html

 1<!doctype html>
 2<html>
 3<head><title>Document</title></head>
 4<body>
 5<h1>Document</h1>
 6<script>
 7onload = function() {
 8 parent.startTest();
 9}
 10</script>
 11</body>
 12</html>

LayoutTests/imported/w3c/web-platform-tests/page-visibility/resources/pagevistestharness.js

 1/*
 2Distributed under both the W3C Test Suite License [1] and the W3C
 33-clause BSD License [2]. To contribute to a W3C Test Suite, see the
 4policies and contribution forms [3].
 5
 6[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
 7[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
 8[3] http://www.w3.org/2004/10/27-testcases
 9*/
 10
 11//
 12// Helper Functions for PageVisibility W3C tests
 13//
 14var VISIBILITY_STATES =
 15{
 16 HIDDEN: "hidden",
 17 VISIBLE: "visible"
 18};
 19
 20var feature_check = false;
 21
 22//
 23// All test() functions in the WebPerf PageVis test suite should use pv_test() instead.
 24//
 25// pv_test() validates the document.hidden and document.visibilityState attributes
 26// exist prior to running tests and immediately shows a failure if they do not.
 27//
 28
 29function pv_test(func, msg, doc)
 30{
 31 if (!doc)
 32 {
 33 doc = document;
 34 }
 35
 36 // only run the feature check once, unless func == null, in which case,
 37 // this call is intended as a feature check
 38 if (!feature_check)
 39 {
 40 feature_check = true;
 41
 42 var hiddenVal = doc.hidden;
 43 var visStateVal = doc.visibilityState;
 44
 45 // show a single error that the Page Visibility feature is undefined
 46 test(function()
 47 {
 48 assert_true(hiddenVal !== undefined && hiddenVal != null,
 49 "document.hidden is defined and not null.");},
 50 "document.hidden is defined and not null.");
 51
 52 test(function()
 53 {
 54 assert_true(visStateVal !== undefined && hiddenVal != null,
 55 "document.visibilityState is defined and not null.");},
 56 "document.visibilityState is defined and not null.");
 57
 58 }
 59
 60 if (func)
 61 {
 62 test(func, msg);
 63 }
 64}
 65
 66
 67function test_feature_exists(doc, msg)
 68{
 69 if (!msg)
 70 {
 71 msg = "";
 72 }
 73 var hiddenMsg = "document.hidden is defined" + msg + ".";
 74 var stateMsg = "document.visibilityState is defined" + msg + ".";
 75 pv_test(function(){assert_true(document.hidden !== undefined, hiddenMsg);}, hiddenMsg, doc);
 76 pv_test(function(){assert_true(document.visibilityState !== undefined, stateMsg);}, stateMsg, doc);
 77}
 78
 79//
 80// Common helper functions
 81//
 82
 83function test_true(value, msg)
 84{
 85 pv_test(function() { assert_true(value, msg); }, msg);
 86}
 87
 88function test_equals(value, equals, msg)
 89{
 90 pv_test(function() { assert_equals(value, equals, msg); }, msg);
 91}
 92
 93//
 94// asynchronous test helper functions
 95//
 96
 97function add_async_result(test_obj, pass_state)
 98{
 99 // add assertion to manual test for the pass state
 100 test_obj.step(function() { assert_true(pass_state) });
 101
 102 // end manual test
 103 test_obj.done();
 104}
 105
 106function add_async_result_assert(test_obj, func)
 107{
 108 // add assertion to manual test for the pass state
 109 test_obj.step(func);
 110
 111 // end manual test
 112 test_obj.done();
 113}
 114
 115var open_link;
 116function TabSwitch()
 117{
 118 //var open_link = window.open("http://www.bing.com");
 119 open_link = window.open('', '_blank');
 120 step_timeout(function() { open_link.close(); }, 2000);
 121}

LayoutTests/imported/w3c/web-platform-tests/page-visibility/resources/unload-bubbles.html

 1<!doctype html>
 2<html>
 3<head><title>Document</title></head>
 4<body>
 5<h1>Document</h1>
 6<script>
 7window.addEventListener("load", function() {
 8 window.addEventListener("visibilitychange", function() {
 9 opener.postMessage(document.visibilityState, "*");
 10 });
 11 opener.postMessage("close", "*");
 12});
 13</script>
 14</body>
 15</html>

LayoutTests/imported/w3c/web-platform-tests/page-visibility/resources/unload.html

 1<!doctype html>
 2<html>
 3<head><title>Document</title></head>
 4<body>
 5<h1>Document</h1>
 6<script>
 7onload = function() {
 8 document.addEventListener("visibilitychange", onVisibilityChange, false);
 9 opener.postMessage("close", "*");
 10}
 11
 12function onVisibilityChange() {
 13 opener.postMessage(document.visibilityState, "*");
 14}
 15</script>
 16</body>
 17</html>

LayoutTests/imported/w3c/web-platform-tests/page-visibility/resources/w3c-import.log

 1The tests in this directory were imported from the W3C repository.
 2Do NOT modify these tests directly in WebKit.
 3Instead, create a pull request on the WPT github:
 4 https://github.com/web-platform-tests/wpt
 5
 6Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
 7
 8Do NOT modify or remove this file.
 9
 10------------------------------------------------------------------------
 11Properties requiring vendor prefixes:
 12None
 13Property values requiring vendor prefixes:
 14None
 15------------------------------------------------------------------------
 16List of files:
 17/LayoutTests/imported/w3c/web-platform-tests/page-visibility/resources/blank_page_green.html
 18/LayoutTests/imported/w3c/web-platform-tests/page-visibility/resources/iframe-with-subframes.html
 19/LayoutTests/imported/w3c/web-platform-tests/page-visibility/resources/iframe.html
 20/LayoutTests/imported/w3c/web-platform-tests/page-visibility/resources/pagevistestharness.js
 21/LayoutTests/imported/w3c/web-platform-tests/page-visibility/resources/unload-bubbles.html
 22/LayoutTests/imported/w3c/web-platform-tests/page-visibility/resources/unload.html

LayoutTests/imported/w3c/web-platform-tests/page-visibility/test_attributes_exist-expected.txt

 1Description
 2
 3This test validates that all of the attributes associated with the Page Visibility feature exist (but does not validate that their values are correct).
 4
 5
 6PASS document.hidden is defined and not null.
 7PASS document.visibilityState is defined and not null.
 8PASS document.hidden is defined.
 9PASS document.visibilityState is defined.
 10

LayoutTests/imported/w3c/web-platform-tests/page-visibility/test_attributes_exist.html

 1<!DOCTYPE html>
 2<html>
 3 <head>
 4 <meta charset="utf-8" />
 5 <title>Page Visibility API Definition</title>
 6
 7 <script type="text/javascript" src="/resources/testharness.js"></script>
 8 <script src="/resources/testharnessreport.js"></script>
 9 <script type="text/javascript" src="resources/pagevistestharness.js"></script>
 10 </head>
 11 <body>
 12 <h1>Description</h1>
 13 <p>This test validates that all of the attributes associated with the Page Visibility feature exist
 14 (but does not validate that their values are correct).</p>
 15
 16 <div id="log"></div>
 17
 18 <script type="text/javascript" >
 19 test_feature_exists();
 20 </script>
 21 </body>
 22</html>

LayoutTests/imported/w3c/web-platform-tests/page-visibility/test_child_document-expected.txt

 1Description
 2
 3This test validates that, within child documents, all of the Page Visibility API attributes exist, are read-only, and match the value of the attributes within the parent document.
 4
 5
 6PASS document.hidden is defined and not null.
 7PASS document.visibilityState is defined and not null.
 8PASS Page Visibility API Child Document Test
 9PASS document.hidden is defined for frame with no style attribute.
 10PASS document.visibilityState is defined for frame with no style attribute.
 11PASS document.visibilityState for frame with no style attribute == visible
 12PASS Page Visibility API Child Document Test 1
 13PASS document.hidden is defined for frame with 'display:none' style.
 14PASS document.visibilityState is defined for frame with 'display:none' style.
 15PASS document.visibilityState for frame with 'display:none' style == visible
 16PASS Page Visibility API Child Document Test 2
 17PASS document.hidden is defined for frame with 'visibility:hidden' style.
 18PASS document.visibilityState is defined for frame with 'visibility:hidden' style.
 19PASS document.visibilityState for frame with 'visibility:hidden' style == visible
 20
 21IFrame with no style attribute
 22IFrame with "display:none" style
 23IFrame with "visibility:hidden" style
 24

LayoutTests/imported/w3c/web-platform-tests/page-visibility/test_child_document.html

 1<!DOCTYPE html>
 2<html>
 3 <head>
 4 <meta charset="utf-8" />
 5 <title>Page Visibility API Child Document Test</title>
 6
 7 <script src="/resources/testharness.js"></script>
 8 <script src="/resources/testharnessreport.js"></script>
 9 <script type="text/javascript" src="resources/pagevistestharness.js"></script>
 10
 11 <style type="text/css">
 12 iframe
 13 {
 14 width:250px;
 15 height:250px;
 16 margin-left:5px;
 17 }
 18
 19 div.docs
 20 {
 21 position:relative;
 22 float:left;
 23 text-align:center;
 24 margin:10px;
 25 border:solid 1px black;
 26 padding:3px;
 27 }
 28 </style>
 29
 30 <script type="text/javascript" >
 31 setup({explicit_done: true});
 32
 33 function onload_test()
 34 {
 35 pv_test();
 36
 37 var frames = document.getElementsByTagName("iframe");
 38 var doc, doc_name;
 39
 40 for (var i = 0; i < frames.length; i++)
 41 {
 42 doc = frames[i].contentDocument;
 43 doc_name = "IFrame with " + frames[i].id;
 44
 45 pv_test(function()
 46 {
 47 test_feature_exists(doc, " for frame with " + frames[i].id);
 48 });
 49
 50 test_equals(doc.visibilityState, VISIBILITY_STATES.VISIBLE,
 51 "document.visibilityState for frame with " +
 52 frames[i].id + " == " +
 53 VISIBILITY_STATES.VISIBLE);
 54 }
 55
 56 done();
 57 }
 58 </script>
 59 </head>
 60 <body onload="onload_test()">
 61 <h1>Description</h1>
 62 <p>This test validates that, within child documents, all of the Page Visibility API attributes exist,
 63 are read-only, and match the value of the attributes within the parent document.</p>
 64
 65 <div id="log"></div>
 66
 67 <br/>
 68
 69 <div class="docs">
 70 IFrame with no style attribute
 71 <br/>
 72 <iframe id="no style attribute" src="resources/blank_page_green.html">
 73 iframes unsupported
 74 </iframe>
 75 </div>
 76
 77 <div class="docs">
 78 IFrame with "display:none" style<br/>
 79 <iframe id="'display:none' style" style="display:none"
 80 src="resources/blank_page_green.html">
 81 iframes unsupported
 82 </iframe>
 83 </div>
 84
 85 <div class="docs">
 86 IFrame with "visibility:hidden" style
 87 <br/>
 88 <iframe id="'visibility:hidden' style" style="visibility:hidden"
 89 src="resources/blank_page_green.html">
 90 iframes unsupported
 91 </iframe>
 92 </div>
 93 </body>
 94</html>

LayoutTests/imported/w3c/web-platform-tests/page-visibility/test_default_view-expected.txt

 1Description
 2
 3This test validates that document.hidden == false and document.visibilityState == "visible" for windowless subdocuments.
 4
 5
 6PASS document.hidden is defined and not null.
 7PASS document.visibilityState is defined and not null.
 8PASS windowless subdocument generated for test has a null default view
 9PASS document.hidden is definedwindowless subdocument.
 10PASS document.visibilityState is definedwindowless subdocument.
 11PASS hidden == true for windowless subdocuments with a null default view
 12PASS visibilityState == hidden for windowless subdocuments with a null default view
 13

LayoutTests/imported/w3c/web-platform-tests/page-visibility/test_default_view.html

 1<!DOCTYPE html>
 2<html>
 3 <head>
 4 <meta charset="utf-8" />
 5 <title>Page Visibility Null Default View Test</title>
 6 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
 7
 8 <script src="/resources/testharness.js"></script>
 9 <script src="/resources/testharnessreport.js"></script>
 10 <script type="text/javascript" src="resources/pagevistestharness.js"></script>
 11
 12 <script type="text/javascript" >
 13 setup({explicit_done: true});
 14
 15 function onload_test()
 16 {
 17 // inject a windowless subdocument as a child of the root document <html> element
 18 var subDoc = document.implementation.createDocument('resources/blank_page_green.html', 'html', null);
 19
 20 // Test precondition: ensure subdocument has a null default view
 21 test_true(subDoc.defaultView == null, "windowless subdocument generated for test has a null default view");
 22
 23 // check that feature exists within subdocument
 24 test_feature_exists(subDoc, 'windowless subdocument');
 25
 26 // check that the subdocument has a hidden visibility state
 27 test_true(subDoc.hidden,
 28 "hidden == true for windowless subdocuments with a null default view");
 29 test_equals(subDoc.visibilityState, VISIBILITY_STATES.HIDDEN,
 30 "visibilityState == " + VISIBILITY_STATES.HIDDEN +
 31 " for windowless subdocuments with a null default view");
 32
 33 done();
 34 }
 35 </script>
 36 </head>
 37 <body onload="onload_test()">
 38 <h1>Description</h1>
 39 <p>This test validates that document.hidden == false and
 40 document.visibilityState == "visible" for windowless subdocuments.</p>
 41 <div id="log"></div>
 42 </body>
 43</html>

LayoutTests/imported/w3c/web-platform-tests/page-visibility/test_read_only-expected.txt

 1Description
 2
 3This test validates that the Page Visibility attributes are read only.
 4
 5
 6PASS document.hidden is defined and not null.
 7PASS document.visibilityState is defined and not null.
 8PASS document.hidden is read only.
 9PASS document.visibilityState is read only.
 10

LayoutTests/imported/w3c/web-platform-tests/page-visibility/test_read_only.html

 1<!DOCTYPE html>
 2<html>
 3 <head>
 4 <meta charset="utf-8" />
 5 <title>Page Visibility API is Read Only</title>
 6
 7 <script src="/resources/testharness.js"></script>
 8 <script src="/resources/testharnessreport.js"></script>
 9 <script type="text/javascript" src="resources/pagevistestharness.js"></script>
 10
 11 <script type="text/javascript">
 12 setup({ explicit_done: true });
 13 function onload_test()
 14 {
 15 //check for feature definition first before attempting to overwrite
 16 pv_test();
 17
 18 //Check document.hidden
 19 document.hidden = "new value";
 20 test_true(document.hidden !== "new value", 'document.hidden is read only.');
 21
 22 //Check document.visibilityState
 23 document.visibilityState = "new value";
 24 test_true(document.visibilityState !== "new value",
 25 "document.visibilityState is read only.");
 26
 27 done();
 28 }
 29 </script>
 30 </head>
 31 <body onload="onload_test();">
 32 <h1>Description</h1>
 33 <p>This test validates that the Page Visibility attributes are read only.</p>
 34
 35 <div id="log"></div>
 36 </body>
 37</html>

LayoutTests/imported/w3c/web-platform-tests/page-visibility/unload-bubbles-expected.txt

 1
 2PASS visibilitychange event bubbles when fired on unload
 3

LayoutTests/imported/w3c/web-platform-tests/page-visibility/unload-bubbles.html

 1<!doctype html>
 2<title>visibilitychange event bubbles when fired on unload</title>
 3<script src="/resources/testharness.js"></script>
 4<script src="/resources/testharnessreport.js"></script>
 5<div id="log"></div>
 6<script>
 7async_test(function(t) {
 8 var w = window.open("resources/unload-bubbles.html");
 9 window.onmessage = t.step_func(function(event) {
 10 if (event.data === "close") {
 11 w.close();
 12 return;
 13 }
 14 assert_equals(event.data, "hidden");
 15 t.done();
 16 });
 17});
 18</script>

LayoutTests/imported/w3c/web-platform-tests/page-visibility/unload-expected.txt

 1
 2PASS visibilitychange fires on unload
 3

LayoutTests/imported/w3c/web-platform-tests/page-visibility/unload.html

 1<!doctype html>
 2<title>visibilitychange fires on unload</title>
 3<script src="/resources/testharness.js"></script>
 4<script src="/resources/testharnessreport.js"></script>
 5<div id="log"></div>
 6<script>
 7async_test(function(t) {
 8 var w = window.open("resources/unload.html");
 9 window.onmessage = t.step_func(function(event) {
 10 if (event.data === "close") {
 11 w.close();
 12 return;
 13 }
 14 assert_equals(event.data, "hidden");
 15 t.done();
 16 });
 17});
 18</script>

LayoutTests/imported/w3c/web-platform-tests/page-visibility/w3c-import.log

 1The tests in this directory were imported from the W3C repository.
 2Do NOT modify these tests directly in WebKit.
 3Instead, create a pull request on the WPT github:
 4 https://github.com/web-platform-tests/wpt
 5
 6Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
 7
 8Do NOT modify or remove this file.
 9
 10------------------------------------------------------------------------
 11Properties requiring vendor prefixes:
 12None
 13Property values requiring vendor prefixes:
 14None
 15------------------------------------------------------------------------
 16List of files:
 17/LayoutTests/imported/w3c/web-platform-tests/page-visibility/META.yml
 18/LayoutTests/imported/w3c/web-platform-tests/page-visibility/idlharness.window.js
 19/LayoutTests/imported/w3c/web-platform-tests/page-visibility/iframe-unload.html
 20/LayoutTests/imported/w3c/web-platform-tests/page-visibility/onvisibilitychange.html
 21/LayoutTests/imported/w3c/web-platform-tests/page-visibility/test_attributes_exist.html
 22/LayoutTests/imported/w3c/web-platform-tests/page-visibility/test_child_document.html
 23/LayoutTests/imported/w3c/web-platform-tests/page-visibility/test_default_view.html
 24/LayoutTests/imported/w3c/web-platform-tests/page-visibility/test_read_only.html
 25/LayoutTests/imported/w3c/web-platform-tests/page-visibility/unload-bubbles.html
 26/LayoutTests/imported/w3c/web-platform-tests/page-visibility/unload.html