Bug 1306696 part 4 - Add test for this bug. r=smaug
☠☠ backed out by bac997577acd ☠ ☠
authorXidorn Quan <me@upsuper.org>
Thu, 15 Feb 2018 23:57:41 +1100
changeset 403934 ab54d7ef9a6706a485fdf9d3b0117360beca0a57
parent 403933 0784b2fa14b42d540c3f31ffa9334eb433795648
child 403935 77f86d6cf76f9257edb72e9b366a1546cffe90e7
push id99890
push userxquan@mozilla.com
push dateThu, 15 Feb 2018 12:58:52 +0000
treeherdermozilla-inbound@ab54d7ef9a67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1306696
milestone60.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 1306696 part 4 - Add test for this bug. r=smaug MozReview-Commit-ID: 1Pzt6DPif00
dom/html/test/browser.ini
dom/html/test/browser_fullscreen-newtab.js
dom/html/test/file_fullscreen-newtab.html
--- a/dom/html/test/browser.ini
+++ b/dom/html/test/browser.ini
@@ -24,9 +24,12 @@ support-files =
   file_bug1108547-3.html
 [browser_content_contextmenu_userinput.js]
 [browser_DOMDocElementInserted.js]
 [browser_form_post_from_file_to_http.js]
 [browser_fullscreen-api-keys.js]
 tags = fullscreen
 [browser_fullscreen-contextmenu-esc.js]
 tags = fullscreen
+[browser_fullscreen-newtab.js]
+tags = fullscreen
+support-files = file_fullscreen-newtab.html
 [browser_submission_flush.js]
new file mode 100644
--- /dev/null
+++ b/dom/html/test/browser_fullscreen-newtab.js
@@ -0,0 +1,69 @@
+"use strict";
+
+const kPage = "http://example.org/browser/" +
+              "dom/html/test/file_fullscreen-navigate.html";
+
+function* runTest() {
+  yield BrowserTestUtils.withNewTab({ gBrowser, url: kPage }, function* (browser) {
+    yield ContentTask.spawn(browser, null, function() {
+      content.document.addEventListener("fullscreenchange", () => {
+        sendAsyncMessage("Test:FullscreenChange");
+      });
+      content.document.addEventListener("fullscreenerror", () => {
+        sendAsyncMessage("Test:FullscreenError");
+      });
+    });
+    let promiseFsEvents = new Promise(resolve => {
+      let countFsChange = 0;
+      let countFsError = 0;
+      function checkAndResolve() {
+        if (countFsChange > 0 && countFsError > 0) {
+          ok(false, "Got both fullscreenchange and fullscreenerror events");
+        } else if (countFsChange > 2) {
+          ok(false, "Got too many fullscreenchange events");
+        } else if (countFsError > 1) {
+          ok(false, "Got too many fullscreenerror events");
+        } else if (countFsChange == 2 || countFsError == 1) {
+          resolve();
+        }
+      }
+      let mm = browser.messageManager;
+      mm.addMessageListener("Test:FullscreenChange", () => {
+        ++countFsChange;
+        checkAndResolve();
+      });
+      mm.addMessageListener("Test:FullscreenError", () => {
+        ++countFsError;
+        checkAndResolve();
+      });
+    });
+    let promiseNewTab =
+      BrowserTestUtils.waitForNewTab(gBrowser, "about:blank");
+    let promiseSizeMode =
+      BrowserTestUtils.waitForEvent(window, "sizemodechange")
+        .then(() => BrowserTestUtils.waitForEvent(window, "sizemodechange"));
+    yield BrowserTestUtils.synthesizeMouseAtCenter("#link", {}, browser);
+    let [newtab] = yield Promise.all(
+      [promiseNewTab, promiseSizeMode, promiseFsEvents]);
+    yield BrowserTestUtils.removeTab(newtab);
+
+    ok(!window.fullScreen, "The chrome window should not be in fullscreen");
+    ok(!document.fullscreen, "The chrome document should not be in fullscreen");
+  });
+}
+
+add_task(function* () {
+  yield pushPrefs(
+    ["full-screen-api.unprefix.enabled", true],
+    ["full-screen-api.transition-duration.enter", "0 0"],
+    ["full-screen-api.transition-duration.leave", "0 0"]);
+  yield runTest();
+});
+
+add_task(function* () {
+  yield pushPrefs(
+    ["full-screen-api.unprefix.enabled", true],
+    ["full-screen-api.transition-duration.enter", "200 200"],
+    ["full-screen-api.transition-duration.leave", "200 200"]);
+  yield runTest();
+});
new file mode 100644
--- /dev/null
+++ b/dom/html/test/file_fullscreen-newtab.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<a id="link" href="about:blank" target="_blank"
+   onclick="document.body.requestFullscreen()">Click here</a>