Commit 95e54931 authored by Sandor Molnar's avatar Sandor Molnar
Browse files

Backed out 4 changesets (bug 1631735) for causing bug 1806355 CLOSED TREE

Backed out changeset 781c1031c032 (bug 1631735)
Backed out changeset a6d345a47718 (bug 1631735)
Backed out changeset 4b8cc0917731 (bug 1631735)
Backed out changeset fe09769d7d5a (bug 1631735)
parent 64255dcb
Loading
Loading
Loading
Loading
+32 −1
Original line number Diff line number Diff line
@@ -10,6 +10,37 @@ const { AppMenuNotifications } = ChromeUtils.importESModule(
  "resource://gre/modules/AppMenuNotifications.sys.mjs"
);

function waitForDocshellActivated() {
  return SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function() {
    // Setting docshell activated/deactivated will trigger visibility state
    // changes to relevant state ("visible" or "hidden"). AFAIK, there is no
    // such event notifying docshell is being activated, so I use
    // "visibilitychange" event rather than polling the isActive flag.
    await ContentTaskUtils.waitForEvent(
      content.document,
      "visibilitychange",
      true /* capture */,
      aEvent => {
        return content.browsingContext.isActive;
      }
    );
  });
}

function waitForFullscreen() {
  return Promise.all([
    BrowserTestUtils.waitForEvent(window, "fullscreen"),
    // In the platforms that support reporting occlusion state (e.g. Mac),
    // enter/exit fullscreen mode will trigger docshell being set to non-activate
    // and then set to activate back again. For those platforms, we should wait
    // until the docshell has been activated again before starting next test,
    // otherwise, the fullscreen request might be denied.
    Services.appinfo.OS === "Darwin"
      ? waitForDocshellActivated()
      : Promise.resolve(),
  ]);
}

add_task(async function testFullscreen() {
  if (Services.appinfo.OS !== "Darwin") {
    await SpecialPowers.pushPrefEnv({
@@ -51,7 +82,7 @@ add_task(async function testFullscreen() {
    "PanelUI is displaying the update-manual notification."
  );

  let fullscreenPromise = BrowserTestUtils.waitForEvent(window, "fullscreen");
  let fullscreenPromise = waitForFullscreen();
  EventUtils.synthesizeKey("KEY_F11");
  await fullscreenPromise;
  isnot(
+0 −74
Original line number Diff line number Diff line
<!DOCTYPE HTML>
<html>
<!--

Open one window, focus it and enter fullscreen, then exit fullscreen.

-->
<head>
  <title>Simple Fullscreen Enter and Exit Test</title>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="application/javascript" src="file_fullscreen-utils.js"></script>
</head>
<body>

<div id="fullscreen-div"><p>Fullscreen div</p></div>

<script type="application/javascript">

function ok(condition, msg) {
  opener.ok(condition, "[single] " + msg);
}

function info(msg) {
  opener.info("[single] " + msg);
}

function is(a, b, msg) {
  opener.is(a, b, "[single] " + msg);
}

function windowResized() {
  info(`window resized to width: ${window.innerWidth}, height: ${window.innerHeight}`);
}

async function begin() {
  window.addEventListener('resize', windowResized);

  info(`starting window width: ${window.innerWidth}, height: ${window.innerHeight}`);
  let windowedWidth = window.innerWidth;
  let windowedHeight = window.innerHeight;

  info("requesting fullscreen");
  let entryPromise = document.getElementById('fullscreen-div').requestFullscreen()
  info("fullscreen requested, waiting for promise to resolve");

  entryPromise.then(() => {
    info("element.requestFullscreen() promise resolved");
    info(`fullscreen window width: ${window.innerWidth}, height: ${window.innerHeight}`);
    ok(document.fullscreenElement != null, "document.fullscreenElement");
    ok(window.fullScreen, "window.fullScreen");
    ok(windowedWidth != window.innerWidth, "window width changed");
    ok(windowedHeight != window.innerHeight, "window height changed");

    info("requesting fullscreen exit");
    let exitPromise = document.exitFullscreen()
    info("fullscreen exit requested, waiting for promise to resolve");

    exitPromise.then(() => {
      info("document.exitFullscreen() promise resolved");
      info(`restored window width: ${window.innerWidth}, height: ${window.innerHeight}`);
      ok(document.fullscreenElement == null, "!document.fullscreenElement");
      ok(!window.fullScreen, "!window.fullScreen");
      ok(window.innerWidth == windowedWidth, "window width restored");
      ok(window.innerHeight == windowedHeight, "window height restored");
      opener.nextTest();
    });
  });
}

</script>
</pre>
</body>
</html>
+0 −1
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ support-files =
  file_fullscreen-scrollbar.html
  file_fullscreen-selector.html
  file_fullscreen-shadowdom.html
  file_fullscreen-single.html
  file_fullscreen-sub-iframe.html
  file_fullscreen-svg-element.html
  file_fullscreen-table.html
+10 −2
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ SimpleTest.requestFlakyTimeout("untriaged");
// run in an iframe, which by default will not have the allowfullscreen
// attribute set, so full-screen won't work.
var gTestWindows = [
  { test: "file_fullscreen-single.html" },
  { test: "file_fullscreen-multiple.html",
    prefs: [["full-screen-api.exit-on.windowRaise", false],
            ["full-screen-api.exit-on.windowOpen", false]] },
@@ -73,7 +72,6 @@ function nextTest() {
      info("main window focused, starting next test");
      SimpleTest.executeSoon(runNextTest);
    }, {once: true});
    info("testWindow.close()");
    testWindow.close();
  } else {
    SimpleTest.executeSoon(runNextTest);
@@ -106,6 +104,16 @@ function runNextTest() {
      waitForLoadAndPaint(testWindow, function() {
        SimpleTest.waitForFocus(function() {
          info("Were focused");
          // For the platforms that support reporting occlusion state (e.g. Mac),
          // we should wait until the docshell has been activated again,
          // otherwise, the fullscreen request might be denied.
          if (testWindow.document.hidden) {
            info("Waiting for document to unhide");
            waitForEvent(testWindow.document, "visibilitychange", (event) => {
              return !testWindow.document.hidden;
            }, testWindow.begin);
            return;
          }
          testWindow.begin();
        }, testWindow);
      });
+0 −14
Original line number Diff line number Diff line
@@ -4,11 +4,8 @@

from __future__ import absolute_import, print_function

import sys

from marionette_driver.errors import InvalidArgumentException
from marionette_harness import MarionetteTestCase
from unittest import skipIf


class TestWindowRect(MarionetteTestCase):
@@ -302,17 +299,6 @@ class TestWindowRect(MarionetteTestCase):
        self.assertEqual(result_size["width"], expected_size["width"])
        self.assertEqual(result_size["height"], expected_size["height"])

    # marionette attempts to exit fullscreen before minimizing the window.
    # To do this, it waits on a sizemode event, but that event is sent at
    # the beginning of the fullscreen transition. For macOS native
    # fullscreen, it's rejected to try to minimize the window during the
    # transition, and there is *no* event sent at the end of transition.
    # This puts marionette in an impossible position. So for now, we
    # skip this test on macOS. Bug 1802192.
    @skipIf(
        sys.platform.startswith("darwin"),
        "Bug 1802192 - macOS fullscreen windows can't be resized.",
    )
    def test_resize_while_fullscreen(self):
        self.marionette.fullscreen()
        expected_size = self.marionette.set_window_rect(
Loading