Bug 1464929 [wpt PR 11207] - Support promises for fullscreen API., a=testonly
authorDave Tapuska <dtapuska@chromium.org>
Wed, 06 Jun 2018 17:11:54 +0000
changeset 476455 f358c4244803f63e45e1cb2dad992fefab5e23b7
parent 476454 894e5375ee56e1282e0a74dafa70cb3fd74e8e4e
child 476456 fce683b036b771243298b15919965f260fd5a891
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1464929, 11207, 383813, 1075711, 562946
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1464929 [wpt PR 11207] - Support promises for fullscreen API., a=testonly Automatic update from web-platform-testsSupport promises for fullscreen API. Add ability to store the promises in the pending requests and exits. Adjust tests to ensure they work correctly with promises. BUG=383813 Change-Id: I81e4780d5ea25b3a1ac7fef54b1fbc9c0d31897a Reviewed-on: https://chromium-review.googlesource.com/1075711 Commit-Queue: Dave Tapuska <dtapuska@chromium.org> Reviewed-by: Philip J├Ągenstedt <foolip@chromium.org> Cr-Commit-Position: refs/heads/master@{#562946} -- wpt-commits: 0fae4aa0c51c6193ef1b2b74a61352b832d95cfa wpt-pr: 11207
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/fullscreen/api/document-onfullscreenerror.html
testing/web-platform/tests/fullscreen/api/element-request-fullscreen-not-allowed.html
testing/web-platform/tests/fullscreen/api/element-request-fullscreen-timing-manual.html
testing/web-platform/tests/fullscreen/api/promises-reject.html
testing/web-platform/tests/fullscreen/api/promises-resolve-manual.html
testing/web-platform/tests/fullscreen/trusted-click.js
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -11354,16 +11354,22 @@
     ]
    ],
    "fullscreen/api/element-request-fullscreen-two-iframes-manual.html": [
     [
      "/fullscreen/api/element-request-fullscreen-two-iframes-manual.html",
      {}
     ]
    ],
+   "fullscreen/api/promises-resolve-manual.html": [
+    [
+     "/fullscreen/api/promises-resolve-manual.html",
+     {}
+    ]
+   ],
    "fullscreen/model/move-to-fullscreen-iframe-manual.html": [
     [
      "/fullscreen/model/move-to-fullscreen-iframe-manual.html",
      {}
     ]
    ],
    "fullscreen/model/move-to-iframe-manual.html": [
     [
@@ -265971,16 +265977,21 @@
      {}
     ]
    ],
    "css/tools/OWNERS": [
     [
      {}
     ]
    ],
+   "css/tools/README.md": [
+    [
+     {}
+    ]
+   ],
    "css/tools/apiclient/.gitignore": [
     [
      {}
     ]
    ],
    "css/tools/apiclient/.hgignore": [
     [
      {}
@@ -266031,61 +266042,16 @@
      {}
     ]
    ],
    "css/tools/build.py": [
     [
      {}
     ]
    ],
-   "css/tools/html2xhtml.py": [
-    [
-     {}
-    ]
-   ],
-   "css/tools/list-all.pl": [
-    [
-     {}
-    ]
-   ],
-   "css/tools/list-all.sh": [
-    [
-     {}
-    ]
-   ],
-   "css/tools/make-html.py": [
-    [
-     {}
-    ]
-   ],
-   "css/tools/supportprop.py": [
-    [
-     {}
-    ]
-   ],
-   "css/tools/templates/filename-list.tmpl": [
-    [
-     {}
-    ]
-   ],
-   "css/tools/travis/LICENSE": [
-    [
-     {}
-    ]
-   ],
-   "css/tools/travis/build.py": [
-    [
-     {}
-    ]
-   ],
-   "css/tools/travis/vcs.py": [
-    [
-     {}
-    ]
-   ],
    "css/tools/w3ctestlib/.hgignore": [
     [
      {}
     ]
    ],
    "css/tools/w3ctestlib/Groups.py": [
     [
      {}
@@ -330823,16 +330789,22 @@
     ]
    ],
    "fullscreen/api/historical.html": [
     [
      "/fullscreen/api/historical.html",
      {}
     ]
    ],
+   "fullscreen/api/promises-reject.html": [
+    [
+     "/fullscreen/api/promises-reject.html",
+     {}
+    ]
+   ],
    "fullscreen/interfaces.html": [
     [
      "/fullscreen/interfaces.html",
      {}
     ]
    ],
    "gamepad/idlharness.html": [
     [
@@ -398645,17 +398617,17 @@
    "e2322808739a5977e90896b4755cfc20f4ab2046",
    "support"
   ],
   "./.gitignore": [
    "551fbbbbeb5571fc8dfec671e248125097947728",
    "support"
   ],
   "./.gitmodules": [
-   "525f7d93f00f11086aabc1f652cf06623e21986c",
+   "6a203e28d43909d7513daf8761281b351d2b2bd7",
    "support"
   ],
   "./.pyup.yml": [
    "a276808f4f41f6243ca69600d8f9b78ca7f9ed96",
    "support"
   ],
   "./.taskcluster.yml": [
    "8dd65b38b4cc39e5f42920c97573889abc401ebd",
@@ -489741,17 +489713,17 @@
    "51ece733973b3891c20a73509eeced07677eed75",
    "support"
   ],
   "css/WOFF2/valid-008.xht": [
    "f0351a814f37471d2a58d8fd8e20c086ebe324d2",
    "reftest"
   ],
   "css/build-css-testsuites.sh": [
-   "0f1d955402449b61d134265ea5962d6ed93836f4",
+   "f08c6940dff13aad1b6c5fc81c08abcaa8aafc67",
    "support"
   ],
   "css/compositing/Blending_in_a_group_with_filter-ref.html": [
    "2b177f7129b9b634b4daac12cbf3e3957bbfb125",
    "support"
   ],
   "css/compositing/Blending_in_a_group_with_filter.html": [
    "b447cee6fbe788196f0b4b751152ef6e9c7a14fa",
@@ -544584,16 +544556,20 @@
   "css/support/test-tr.png": [
    "078e1dd6dd61d36cec239ed75d02051f61fe60a5",
    "support"
   ],
   "css/tools/OWNERS": [
    "7301f0ec4d66b71a92818aa3d532c5eca718f677",
    "support"
   ],
+  "css/tools/README.md": [
+   "17dc12660a62726b5975e125cefb1cc42b007b6f",
+   "support"
+  ],
   "css/tools/apiclient/.gitignore": [
    "4f8c72d787595386529108512329027d424dad47",
    "support"
   ],
   "css/tools/apiclient/.hgignore": [
    "3980f51a91c5d319a98078099c43e359578b305d",
    "support"
   ],
@@ -544632,52 +544608,16 @@
   "css/tools/apiclient/test/extensions.json": [
    "e5f35ad0f733e76a3431db529c80544e8cbb13ec",
    "support"
   ],
   "css/tools/build.py": [
    "9dc0b6f869b328886b153eee2dd0b0053cd712e2",
    "support"
   ],
-  "css/tools/html2xhtml.py": [
-   "abaf4dec00fa3b29f556f35700410775acd63395",
-   "support"
-  ],
-  "css/tools/list-all.pl": [
-   "27670ddc5a347fa2d0608483875294f8f4957b07",
-   "support"
-  ],
-  "css/tools/list-all.sh": [
-   "040b805bb924cd18077cc07f7a449067d7fc0cd7",
-   "support"
-  ],
-  "css/tools/make-html.py": [
-   "3fb558bb57627987e143d415d8677508a2dfbaf2",
-   "support"
-  ],
-  "css/tools/supportprop.py": [
-   "92973da4c183e497ef7b4a888ca929216073f9ea",
-   "support"
-  ],
-  "css/tools/templates/filename-list.tmpl": [
-   "ddcb87e03b20a95d9b10ad00bbb1228e3fd5a9ba",
-   "support"
-  ],
-  "css/tools/travis/LICENSE": [
-   "0ea78bfe20b327310471cc22618f7c921c6e0481",
-   "support"
-  ],
-  "css/tools/travis/build.py": [
-   "470c482e0463459a3d0b48af0107a2429a281db8",
-   "support"
-  ],
-  "css/tools/travis/vcs.py": [
-   "715959f81edaae4a2ac5ad6a16dbb045c199074f",
-   "support"
-  ],
   "css/tools/w3ctestlib/.hgignore": [
    "68a4744eda8cfd5d6313a91e1468cffacf37b61f",
    "support"
   ],
   "css/tools/w3ctestlib/Groups.py": [
    "464be399ed661409a0c22d9e58cd75421f740b95",
    "support"
   ],
@@ -544689,17 +544629,17 @@
    "7c34093692123e09035e8d322757d1a1865603ce",
    "support"
   ],
   "css/tools/w3ctestlib/OutputFormats.py": [
    "139429c3a3a0f8f115cf386b2937073fb74cdb94",
    "support"
   ],
   "css/tools/w3ctestlib/Sources.py": [
-   "36436dff53c614783778a373223c07be4f70fc1d",
+   "1541268bf0bec6fcbf1c9e5ce60c31878f29314e",
    "support"
   ],
   "css/tools/w3ctestlib/Suite.py": [
    "f77a2569f113df6385ed419cf88f48e90e402e4f",
    "support"
   ],
   "css/tools/w3ctestlib/Utils.py": [
    "a9dd27cfe6174439013d3b1659eca756a53a329b",
@@ -544745,17 +544685,17 @@
    "3516bba907a985193bf0e1c7b4107385e053633e",
    "support"
   ],
   "css/tools/w3ctestlib/templates/implementation-report-TEMPLATE.data.tmpl": [
    "d280220881b4537bc0fc5420f43272cf4c3cae83",
    "support"
   ],
   "css/tools/w3ctestlib/templates/index.content.tmpl": [
-   "c9195c8e9ed930d37c3a64f65c0b43f1cb3d6fc0",
+   "cf6c10649767fbd6cd52672b14f1176537499c44",
    "support"
   ],
   "css/tools/w3ctestlib/templates/index.htm.tmpl": [
    "3eb39b12671c9f0c35429896c87839366fa94c91",
    "support"
   ],
   "css/tools/w3ctestlib/templates/index.xht.tmpl": [
    "d1a9699ca808770fb686c249568d958b69cc7704",
@@ -560681,17 +560621,17 @@
    "dd76a7198bdc882285bbc01e8ee6379c52237350",
    "testharness"
   ],
   "fullscreen/api/document-onfullscreenchange-manual.html": [
    "1d9e6efc4bdf6e8d29b995167192fbc05933e72d",
    "manual"
   ],
   "fullscreen/api/document-onfullscreenerror.html": [
-   "ed8836f302fffdaa407bf9bf7799effa17fb6823",
+   "1dd69713aaa8030892e68cfb0fec2fccb8863723",
    "testharness"
   ],
   "fullscreen/api/element-ready-check-allowed-cross-origin-manual.sub.html": [
    "f62f912aeff6cd173e6e43aa9634568e32c0104c",
    "manual"
   ],
   "fullscreen/api/element-ready-check-containing-iframe-manual.html": [
    "96f14dfff180ed3a78dd5df378c712800a8e1fd8",
@@ -560753,17 +560693,17 @@
    "ed7683b3c4a7134b640e07a7329a21361b122402",
    "manual"
   ],
   "fullscreen/api/element-request-fullscreen-non-top-manual.html": [
    "c346255bb659b952d8d27b2ab136e7815c1161d9",
    "manual"
   ],
   "fullscreen/api/element-request-fullscreen-not-allowed.html": [
-   "8991e8df530fa7c24a9e084f2ab17fa9c70fb120",
+   "5eac634c56810200d4c6a8b1c3c6f547ba1e7dc9",
    "testharness"
   ],
   "fullscreen/api/element-request-fullscreen-null-ns-manual.html": [
    "5fe4a901e450a2f3e52866bc61324571866fb879",
    "manual"
   ],
   "fullscreen/api/element-request-fullscreen-same-manual.html": [
    "10b6ff2c859c50516209735dd1bdc3ea4d24f330",
@@ -560773,17 +560713,17 @@
    "2efd96350b1c3de0efc1e2b3d1aa603cfe7e7738",
    "manual"
   ],
   "fullscreen/api/element-request-fullscreen-svg-svg-manual.html": [
    "907c13b799d1f726e397d2899452321b585cb444",
    "manual"
   ],
   "fullscreen/api/element-request-fullscreen-timing-manual.html": [
-   "4ecd76a2ef773172d45f656f52a7358be2a4568d",
+   "48df66c401edcba47d1336313833a24d5e3d211d",
    "manual"
   ],
   "fullscreen/api/element-request-fullscreen-top-manual.html": [
    "53ad260cb1cd2951d7cacfbc73c2c49837c1ebd4",
    "manual"
   ],
   "fullscreen/api/element-request-fullscreen-twice-manual.html": [
    "c6a85dc45d161ae2c3aaff333b54ae7572167f77",
@@ -560796,16 +560736,24 @@
   "fullscreen/api/element-request-fullscreen-two-iframes-manual.html": [
    "d3b6a2795bebb8f903b9491fd5f0a80f9aca02c9",
    "manual"
   ],
   "fullscreen/api/historical.html": [
    "9d9bec938f185b2461da4d00a5683ad5d07ee577",
    "testharness"
   ],
+  "fullscreen/api/promises-reject.html": [
+   "2bc121b4bc0a397f2f25c5fca1aa32fa8727b776",
+   "testharness"
+  ],
+  "fullscreen/api/promises-resolve-manual.html": [
+   "ec9276eb2b2ab279a84aa06a644b4333e46e970d",
+   "manual"
+  ],
   "fullscreen/api/resources/attempt-fullscreen.html": [
    "33e277b3f06677f14eed442ecce76b408e7e006e",
    "support"
   ],
   "fullscreen/api/resources/report-fullscreen-enabled.html": [
    "ba59db02939bc5ba00825befe4777c66cee64b4c",
    "support"
   ],
@@ -560853,17 +560801,17 @@
    "0cdfe5cf8321b6c46a75a2f75f6224970368d4ae",
    "support"
   ],
   "fullscreen/rendering/ua-style-iframe-manual.html": [
    "5264e24899d4cf72c54edd39d47715beebebe355",
    "manual"
   ],
   "fullscreen/trusted-click.js": [
-   "e401e8e8bcd97446991398d6021a9bd712c923c5",
+   "069f4d40fbcb4e933d4f651d3220820836615660",
    "support"
   ],
   "gamepad/OWNERS": [
    "7ef5aa4880ca0d8c1d02e4c730d0c2317219d7e8",
    "support"
   ],
   "gamepad/events-manual.html": [
    "3a3873da02cde40cd459bcb4d692546f1d862d3d",
--- a/testing/web-platform/tests/fullscreen/api/document-onfullscreenerror.html
+++ b/testing/web-platform/tests/fullscreen/api/document-onfullscreenerror.html
@@ -2,17 +2,28 @@
 <title>Document#onfullscreenerror</title>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <div id="log"></div>
 <script>
 async_test(function(t)
 {
     var sync = true;
+    var promise_executed = false;
     assert_equals(document.onfullscreenerror, null, "initial onfullscreenerror");
     document.onfullscreenerror = t.step_func_done(function(event) {
+        assert_true(promise_executed);
         assert_false(sync);
     });
     var e = document.createElement('span');
-    e.requestFullscreen();
+    var promise = e.requestFullscreen();
+    if (promise) {
+        promise.catch(()=> {
+            assert_false(sync);
+            promise_executed = true;
+        });
+    } else {
+        // If promises aren't supported just treat it as already done.
+        promise_executed = true;
+    }
     sync = false;
 });
 </script>
--- a/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-not-allowed.html
+++ b/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-not-allowed.html
@@ -1,19 +1,29 @@
 <!DOCTYPE html>
 <title>Element#requestFullscreen() when not allowed to request fullscreen</title>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <div id="log"></div>
 <script>
 async_test(t => {
   const div = document.querySelector("div");
+  var promise_executed = false;
 
   document.addEventListener("fullscreenerror", t.step_func_done(event => {
     assert_equals(event.target, div, "event.target");
     assert_true(event.bubbles, "event.bubbles");
     assert_false(event.cancelable, "event.cancelable");
     assert_true(event.composed, "event.composed");
+    assert_true(promise_executed, "promise executed");
   }));
 
-  div.requestFullscreen();
+  var promise = div.requestFullscreen();
+  if (promise) {
+    promise.catch(()=> {
+      promise_executed = true;
+    });
+  } else {
+    // If promises aren't supported just treat it as already done.
+    promise_executed = true;
+  }
 });
 </script>
--- a/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-timing-manual.html
+++ b/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-timing-manual.html
@@ -23,18 +23,26 @@ async_test(t => {
         assert_array_equals(events, ['resize', 'fullscreenchange'], 'event order');
       }));
     }
   });
   document.onfullscreenchange = window.onresize = callback;
 }, 'Timing of fullscreenchange and resize events');
 
 async_test(t => {
-  document.createElement('a').requestFullscreen();
+  var promise = document.createElement('a').requestFullscreen();
+  var promise_executed = false;
+  if (promise) {
+    promise.catch(()=>{promise_executed = true; });
+  } else {
+    // if promises aren't supported treat it as executed.
+    promise_executed = true;
+  }
 
   // If fullscreenerror is an animation frame event, then animation frame
   // callbacks should be run after it is fired, before the timer callback.
   document.onfullscreenerror = t.step_func(() => {
+    assert_true(promise_executed, "promise executed");
     step_timeout(t.unreached_func('timer callback'));
     requestAnimationFrame(t.step_func_done());
   });
 }, 'Timing of fullscreenerror event');
 </script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/promises-reject.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<title>Promises#reject</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+async_test(function(t)
+{
+    var e = document.createElement('span');
+    e.requestFullscreen().catch(t.step_func_done());
+});
+async_test(function(t)
+{
+    var e = document.createElement('span');
+    document.exitFullscreen().catch(t.step_func_done());
+});
+</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/fullscreen/api/promises-resolve-manual.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<title>Promises#resolve</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../trusted-click.js"></script>
+<div id="log"></div>
+<script>
+async_test(function(t)
+{
+    var div = document.querySelector("div");
+    trusted_request_with_promise(t, div, document.body,
+    () => {
+        assert_equals(document.fullscreenElement, div, "fullscreenElement before exitFullscreen()");
+        document.exitFullscreen().then(()=> {
+          assert_equals(document.fullscreenElement, null, "fullscreenElement after exiting fullscreen");
+          t.done();
+        });
+        assert_equals(document.fullscreenElement, div, "fullscreenElement after exitFullscreen()");
+    }, t.unreached_func("Request fullscreen failed"));
+});
+</script>
--- a/testing/web-platform/tests/fullscreen/trusted-click.js
+++ b/testing/web-platform/tests/fullscreen/trusted-click.js
@@ -14,10 +14,25 @@ function trusted_click(test, callback, c
         container.removeChild(button);
     });
     container.appendChild(button);
 }
 
 // Invokes element.requestFullscreen() from a trusted click.
 function trusted_request(test, element, container)
 {
-    trusted_click(test, () => element.requestFullscreen(), container || element.parentNode);
+    trusted_click(test, () => {
+        var promise = element.requestFullscreen();
+        if (promise) {
+            // Keep the promise resolution silent. Otherwise unhandledrejection
+            // may fire for the failure test cases.
+            promise.then(() => {}, () => {});
+        }
+    }, container || element.parentNode);
 }
+
+// Invokes element.requestFullscreen() from a trusted click.
+function trusted_request_with_promise(test, element, container, resolve, reject)
+{
+    trusted_click(test, () => {
+        element.requestFullscreen().then(resolve, reject);
+    }, container || element.parentNode);
+}