Bug 1367227 - Part 2 - Trigger fullscreen the same way Firefox does. r=ato
authorBrendan Dahl <bdahl@mozilla.com>
Fri, 26 May 2017 14:14:14 -0700
changeset 409850 812a3f2737d4a2674da91a9d60cbfb7268d46f63
parent 409849 8a78af3f02805279a1ac130a9daa336af3a1d65a
child 409851 1de33be170d6683472473765ab2f382c315c6979
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1367227
milestone55.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 1367227 - Part 2 - Trigger fullscreen the same way Firefox does. r=ato
testing/marionette/driver.js
testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -1368,17 +1368,21 @@ GeckoDriver.prototype.getWindowRect = fu
 GeckoDriver.prototype.setWindowRect = function* (cmd, resp) {
   assert.firefox()
   const win = assert.window(this.getCurrentWindow());
   assert.noUserPrompt(this.dialog);
 
   let {x, y, width, height} = cmd.parameters;
 
   if (win.windowState == win.STATE_FULLSCREEN) {
-    win.document.exitFullscreen();
+    yield new Promise(resolve => {
+      win.addEventListener("sizemodechange", resolve, {once: true});
+
+      win.fullScreen = false;
+    });
   }
 
   if (height != null && width != null) {
     assert.positiveInteger(height);
     assert.positiveInteger(width);
 
     if (win.outerWidth != width && win.outerHeight != height) {
       yield new Promise(resolve => {
@@ -2906,23 +2910,19 @@ GeckoDriver.prototype.maximizeWindow = f
  *     A modal dialog is open, blocking this operation.
  */
 GeckoDriver.prototype.fullscreen = function* (cmd, resp) {
   assert.firefox();
   const win = assert.window(this.getCurrentWindow());
   assert.noUserPrompt(this.dialog);
 
   yield new Promise(resolve => {
-    win.addEventListener("resize", resolve, {once: true});
-
-    if (win.windowState == win.STATE_FULLSCREEN) {
-      win.document.exitFullscreen();
-    } else {
-      win.document.documentElement.requestFullscreen();
-    }
+    win.addEventListener("sizemodechange", resolve, {once: true});
+
+    win.fullScreen = !win.fullScreen;
   });
 
   resp.body = {
     x: win.screenX,
     y: win.screenY,
     width: win.outerWidth,
     height: win.outerHeight,
   };
--- a/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini
+++ b/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.ini
@@ -68,19 +68,19 @@ skip-if = appname == 'fennec'
 [test_visibility.py]
 [test_window_handles_chrome.py]
 skip-if = appname == 'fennec'
 [test_window_handles_content.py]
 [test_window_close_chrome.py]
 skip-if = appname == 'fennec'
 [test_window_close_content.py]
 [test_window_rect.py]
-skip-if = appname == 'fennec' || headless # Bug 1367227
+skip-if = appname == 'fennec'
 [test_window_maximize.py]
-skip-if = appname == 'fennec' || headless # Bug 1367227
+skip-if = appname == 'fennec'
 [test_window_status_content.py]
 [test_window_status_chrome.py]
 
 [test_screenshot.py]
 skip-if = headless # Relies on native styling which headless doesn't support.
 [test_cookies.py]
 [test_title.py]
 [test_title_chrome.py]