Bug 1405370 - [marionette] Avoid usage of "window" for function arguments.
authorHenrik Skupin <mail@hskupin.info>
Tue, 18 Sep 2018 14:51:21 +0200
changeset 493498 e83c5c06595755477dea0163e5c15d57e10c64f9
parent 493497 56671f6f6db4f6adaf2333b413b741ad6b24460b
child 493499 dc0cff38be062f8d5997d2e4fdb074ecae567de9
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1405370, 1311041
milestone64.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 1405370 - [marionette] Avoid usage of "window" for function arguments. To avoid confusion with the global "window" object we should avoid using this name as function argument. Changes for driver.js are left-out and will be done by the patch on bug 1311041.
testing/marionette/action.js
testing/marionette/element.js
testing/marionette/evaluate.js
testing/marionette/sync.js
testing/marionette/test/unit/test_sync.js
--- a/testing/marionette/action.js
+++ b/testing/marionette/action.js
@@ -968,36 +968,36 @@ action.Mouse = class {
  * This is done by creating a Promise for each tick that resolves once
  * all the Promises for individual tick-actions are resolved.  The next
  * tick's actions are not dispatched until the Promise for the current
  * tick is resolved.
  *
  * @param {action.Chain} chain
  *     Actions grouped by tick; each element in |chain| is a sequence of
  *     actions for one tick.
- * @param {WindowProxy} window
+ * @param {WindowProxy} win
  *     Current window global.
  * @param {boolean=} [specCompatPointerOrigin=true] specCompatPointerOrigin
  *     Flag to turn off the WebDriver spec conforming pointer origin
  *     calculation. It has to be kept until all Selenium bindings can
  *     successfully handle the WebDriver spec conforming Pointer Origin
  *     calculation. See https://bugzilla.mozilla.org/show_bug.cgi?id=1429338.
  *
  * @return {Promise}
  *     Promise for dispatching all actions in |chain|.
  */
-action.dispatch = function(chain, window, specCompatPointerOrigin = true) {
+action.dispatch = function(chain, win, specCompatPointerOrigin = true) {
   action.specCompatPointerOrigin = specCompatPointerOrigin;
 
   let chainEvents = (async () => {
     for (let tickActions of chain) {
       await action.dispatchTickActions(
           tickActions,
           action.computeTickDuration(tickActions),
-          window);
+          win);
     }
   })();
   return chainEvents;
 };
 
 /**
  * Dispatch sequence of actions for one tick.
  *
@@ -1008,24 +1008,24 @@ action.dispatch = function(chain, window
  *
  * Note that the tick-actions are dispatched in order, but they may have
  * different durations and therefore may not end in the same order.
  *
  * @param {Array.<action.Action>} tickActions
  *     List of actions for one tick.
  * @param {number} tickDuration
  *     Duration in milliseconds of this tick.
- * @param {WindowProxy} window
+ * @param {WindowProxy} win
  *     Current window global.
  *
  * @return {Promise}
  *     Promise for dispatching all tick-actions and pending DOM events.
  */
-action.dispatchTickActions = function(tickActions, tickDuration, window) {
-  let pendingEvents = tickActions.map(toEvents(tickDuration, window));
+action.dispatchTickActions = function(tickActions, tickDuration, win) {
+  let pendingEvents = tickActions.map(toEvents(tickDuration, win));
   return Promise.all(pendingEvents);
 };
 
 /**
  * Compute tick duration in milliseconds for a collection of actions.
  *
  * @param {Array.<action.Action>} tickActions
  *     List of actions for one tick.
@@ -1080,43 +1080,43 @@ action.computePointerDestination = funct
   return {"x": x, "y": y};
 };
 
 /**
  * Create a closure to use as a map from action definitions to Promise events.
  *
  * @param {number} tickDuration
  *     Duration in milliseconds of this tick.
- * @param {WindowProxy} window
+ * @param {WindowProxy} win
  *     Current window global.
  *
  * @return {function(action.Action): Promise}
  *     Function that takes an action and returns a Promise for dispatching
  *     the event that corresponds to that action.
  */
-function toEvents(tickDuration, window) {
+function toEvents(tickDuration, win) {
   return a => {
     let inputState = action.inputStateMap.get(a.id);
 
     switch (a.subtype) {
       case action.KeyUp:
-        return dispatchKeyUp(a, inputState, window);
+        return dispatchKeyUp(a, inputState, win);
 
       case action.KeyDown:
-        return dispatchKeyDown(a, inputState, window);
+        return dispatchKeyDown(a, inputState, win);
 
       case action.PointerDown:
-        return dispatchPointerDown(a, inputState, window);
+        return dispatchPointerDown(a, inputState, win);
 
       case action.PointerUp:
-        return dispatchPointerUp(a, inputState, window);
+        return dispatchPointerUp(a, inputState, win);
 
       case action.PointerMove:
         return dispatchPointerMove(
-            a, inputState, tickDuration, window);
+            a, inputState, tickDuration, win);
 
       case action.PointerCancel:
         throw new UnsupportedOperationError();
 
       case action.Pause:
         return dispatchPause(a, tickDuration);
     }
 
@@ -1126,89 +1126,89 @@ function toEvents(tickDuration, window) 
 
 /**
  * Dispatch a keyDown action equivalent to pressing a key on a keyboard.
  *
  * @param {action.Action} a
  *     Action to dispatch.
  * @param {action.InputState} inputState
  *     Input state for this action's input source.
- * @param {WindowProxy} window
+ * @param {WindowProxy} win
  *     Current window global.
  *
  * @return {Promise}
  *     Promise to dispatch at least a keydown event, and keypress if
  *     appropriate.
  */
-function dispatchKeyDown(a, inputState, window) {
+function dispatchKeyDown(a, inputState, win) {
   return new Promise(resolve => {
     let keyEvent = new action.Key(a.value);
     keyEvent.repeat = inputState.isPressed(keyEvent.key);
     inputState.press(keyEvent.key);
     if (keyEvent.key in MODIFIER_NAME_LOOKUP) {
       inputState.setModState(keyEvent.key, true);
     }
 
     // Append a copy of |a| with keyUp subtype
     action.inputsToCancel.push(Object.assign({}, a, {subtype: action.KeyUp}));
     keyEvent.update(inputState);
-    event.sendKeyDown(a.value, keyEvent, window);
+    event.sendKeyDown(a.value, keyEvent, win);
 
     resolve();
   });
 }
 
 /**
  * Dispatch a keyUp action equivalent to releasing a key on a keyboard.
  *
  * @param {action.Action} a
  *     Action to dispatch.
  * @param {action.InputState} inputState
  *     Input state for this action's input source.
- * @param {WindowProxy} window
+ * @param {WindowProxy} win
  *     Current window global.
  *
  * @return {Promise}
  *     Promise to dispatch a keyup event.
  */
-function dispatchKeyUp(a, inputState, window) {
+function dispatchKeyUp(a, inputState, win) {
   return new Promise(resolve => {
     let keyEvent = new action.Key(a.value);
 
     if (!inputState.isPressed(keyEvent.key)) {
       resolve();
       return;
     }
 
     if (keyEvent.key in MODIFIER_NAME_LOOKUP) {
       inputState.setModState(keyEvent.key, false);
     }
     inputState.release(keyEvent.key);
     keyEvent.update(inputState);
 
-    event.sendKeyUp(a.value, keyEvent, window);
+    event.sendKeyUp(a.value, keyEvent, win);
     resolve();
   });
 }
 
 /**
  * Dispatch a pointerDown action equivalent to pressing a pointer-device
  * button.
  *
  * @param {action.Action} a
  *     Action to dispatch.
  * @param {action.InputState} inputState
  *     Input state for this action's input source.
- * @param {WindowProxy} window
+ * @param {WindowProxy} win
  *     Current window global.
  *
  * @return {Promise}
  *     Promise to dispatch at least a pointerdown event.
  */
-function dispatchPointerDown(a, inputState, window) {
+function dispatchPointerDown(a, inputState, win) {
   return new Promise(resolve => {
     if (inputState.isPressed(a.button)) {
       resolve();
       return;
     }
 
     inputState.press(a.button);
     // Append a copy of |a| with pointerUp subtype
@@ -1227,26 +1227,26 @@ function dispatchPointerDown(a, inputSta
         } else if (event.DoubleClickTracker.isClicked()) {
           mouseEvent = Object.assign({},
               mouseEvent, {clickCount: 2});
         }
         event.synthesizeMouseAtPoint(
             inputState.x,
             inputState.y,
             mouseEvent,
-            window);
+            win);
         if (event.MouseButton.isSecondary(a.button) ||
             mouseEvent.ctrlKey && Services.appinfo.OS !== "WINNT") {
           let contextMenuEvent = Object.assign({},
               mouseEvent, {type: "contextmenu"});
           event.synthesizeMouseAtPoint(
               inputState.x,
               inputState.y,
               contextMenuEvent,
-              window);
+              win);
         }
         break;
 
       case action.PointerType.Pen:
       case action.PointerType.Touch:
         throw new UnsupportedOperationError("Only 'mouse' pointer type is supported");
 
       default:
@@ -1260,23 +1260,23 @@ function dispatchPointerDown(a, inputSta
 /**
  * Dispatch a pointerUp action equivalent to releasing a pointer-device
  * button.
  *
  * @param {action.Action} a
  *     Action to dispatch.
  * @param {action.InputState} inputState
  *     Input state for this action's input source.
- * @param {WindowProxy} window
+ * @param {WindowProxy} win
  *     Current window global.
  *
  * @return {Promise}
  *     Promise to dispatch at least a pointerup event.
  */
-function dispatchPointerUp(a, inputState, window) {
+function dispatchPointerUp(a, inputState, win) {
   return new Promise(resolve => {
     if (!inputState.isPressed(a.button)) {
       resolve();
       return;
     }
 
     inputState.release(a.button);
 
@@ -1284,17 +1284,17 @@ function dispatchPointerUp(a, inputState
       case action.PointerType.Mouse:
         let mouseEvent = new action.Mouse("mouseup", a.button);
         mouseEvent.update(inputState);
         if (event.DoubleClickTracker.isClicked()) {
           mouseEvent = Object.assign({},
               mouseEvent, {clickCount: 2});
         }
         event.synthesizeMouseAtPoint(
-            inputState.x, inputState.y, mouseEvent, window);
+            inputState.x, inputState.y, mouseEvent, win);
         break;
 
       case action.PointerType.Pen:
       case action.PointerType.Touch:
         throw new UnsupportedOperationError("Only 'mouse' pointer type is supported");
 
       default:
         throw new TypeError(`Unknown pointer type: ${inputState.subtype}`);
@@ -1312,47 +1312,47 @@ function dispatchPointerUp(a, inputState
  * target coordinates.  Otherwise, events are synthesized to mimic a
  * pointer travelling in a discontinuous, approximately straight line,
  * with the pointer coordinates being updated around 60 times per second.
  *
  * @param {action.Action} a
  *     Action to dispatch.
  * @param {action.InputState} inputState
  *     Input state for this action's input source.
- * @param {WindowProxy} window
+ * @param {WindowProxy} win
  *     Current window global.
  *
  * @return {Promise}
  *     Promise to dispatch at least one pointermove event, as well as
  *     mousemove events as appropriate.
  */
-function dispatchPointerMove(a, inputState, tickDuration, window) {
+function dispatchPointerMove(a, inputState, tickDuration, win) {
   const timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
   // interval between pointermove increments in ms, based on common vsync
   const fps60 = 17;
 
   return new Promise((resolve, reject) => {
     const start = Date.now();
     const [startX, startY] = [inputState.x, inputState.y];
 
-    let coords = getElementCenter(a.origin, window);
+    let coords = getElementCenter(a.origin, win);
     let target = action.computePointerDestination(a, inputState, coords);
     const [targetX, targetY] = [target.x, target.y];
 
-    if (!inViewPort(targetX, targetY, window)) {
+    if (!inViewPort(targetX, targetY, win)) {
       throw new MoveTargetOutOfBoundsError(
           `(${targetX}, ${targetY}) is out of bounds of viewport ` +
-          `width (${window.innerWidth}) ` +
-          `and height (${window.innerHeight})`);
+          `width (${win.innerWidth}) ` +
+          `and height (${win.innerHeight})`);
     }
 
     const duration = typeof a.duration == "undefined" ? tickDuration : a.duration;
     if (duration === 0) {
       // move pointer to destination in one step
-      performOnePointerMove(inputState, targetX, targetY, window);
+      performOnePointerMove(inputState, targetX, targetY, win);
       resolve();
       return;
     }
 
     const distanceX = targetX - startX;
     const distanceY = targetY - startY;
     const ONE_SHOT = Ci.nsITimer.TYPE_ONE_SHOT;
     let intermediatePointerEvents = (async () => {
@@ -1360,29 +1360,29 @@ function dispatchPointerMove(a, inputSta
       await new Promise(resolveTimer =>
           timer.initWithCallback(resolveTimer, fps60, ONE_SHOT));
 
       let durationRatio = Math.floor(Date.now() - start) / duration;
       const epsilon = fps60 / duration / 10;
       while ((1 - durationRatio) > epsilon) {
         let x = Math.floor(durationRatio * distanceX + startX);
         let y = Math.floor(durationRatio * distanceY + startY);
-        performOnePointerMove(inputState, x, y, window);
+        performOnePointerMove(inputState, x, y, win);
         // wait |fps60| ms before performing next pointer move
         await new Promise(resolveTimer =>
             timer.initWithCallback(resolveTimer, fps60, ONE_SHOT));
 
         durationRatio = Math.floor(Date.now() - start) / duration;
       }
     })();
 
     // perform last pointer move after all incremental moves are resolved and
     // durationRatio is close enough to 1
     intermediatePointerEvents.then(() => {
-      performOnePointerMove(inputState, targetX, targetY, window);
+      performOnePointerMove(inputState, targetX, targetY, win);
       resolve();
     }).catch(err => {
       reject(err);
     });
   });
 }
 
 function performOnePointerMove(inputState, targetX, targetY, win) {
@@ -1436,17 +1436,17 @@ function capitalize(str) {
 
 function inViewPort(x, y, win) {
   assert.number(x, `Expected x to be finite number`);
   assert.number(y, `Expected y to be finite number`);
   // Viewport includes scrollbars if rendered.
   return !(x < 0 || y < 0 || x > win.innerWidth || y > win.innerHeight);
 }
 
-function getElementCenter(el, window) {
+function getElementCenter(el, win) {
   if (element.isDOMElement(el)) {
     if (action.specCompatPointerOrigin) {
-      return element.getInViewCentrePoint(el.getClientRects()[0], window);
+      return element.getInViewCentrePoint(el.getClientRects()[0], win);
     }
     return element.coordinates(el);
   }
   return {};
 }
--- a/testing/marionette/element.js
+++ b/testing/marionette/element.js
@@ -196,34 +196,34 @@ element.Store = class {
 
   /**
    * Retrieve a DOM {@link Element} or a {@link XULElement} by its
    * unique {@link WebElement} reference.
    *
    * @param {WebElement} webEl
    *     Web element reference to find the associated {@link Element}
    *     of.
-   * @param {WindowProxy} window
+   * @param {WindowProxy} win
    *     Current browsing context, which may differ from the associate
    *     browsing context of <var>el</var>.
    *
    * @returns {(Element|XULElement)}
    *     Element associated with reference.
    *
    * @throws {TypeError}
    *     If <var>webEl</var> is not a {@link WebElement}.
    * @throws {NoSuchElementError}
    *     If the web element reference <var>uuid</var> has not been
    *     seen before.
    * @throws {StaleElementReferenceError}
    *     If the element has gone stale, indicating it is no longer
    *     attached to the DOM, or its node document is no longer the
    *     active document.
    */
-  get(webEl, window) {
+  get(webEl, win) {
     if (!(webEl instanceof WebElement)) {
       throw new TypeError(
           pprint`Expected web element, got: ${webEl}`);
     }
     if (!this.has(webEl)) {
       throw new NoSuchElementError(
           "Web element reference not seen before: " + webEl.uuid);
     }
@@ -231,17 +231,17 @@ element.Store = class {
     let el;
     let ref = this.els[webEl.uuid];
     try {
       el = ref.get();
     } catch (e) {
       delete this.els[webEl.uuid];
     }
 
-    if (element.isStale(el, window)) {
+    if (element.isStale(el, win)) {
       throw new StaleElementReferenceError(
           pprint`The element reference of ${el || webEl.uuid} is stale; ` +
               "either the element is no longer attached to the DOM, " +
               "it is not in the current frame context, " +
               "or the document has been refreshed");
     }
 
     return el;
@@ -715,32 +715,32 @@ element.isCollection = function(seq) {
  * may differ from <var>el</var>'s associated context, an element is
  * considered stale even if it is connected to a living (not discarded)
  * browsing context such as an <tt>&lt;iframe&gt;</tt>.
  *
  * @param {Element=} el
  *     DOM element to check for staleness.  If null, which may be
  *     the case if the element has been unwrapped from a weak
  *     reference, it is always considered stale.
- * @param {WindowProxy=} window
+ * @param {WindowProxy=} win
  *     Current browsing context, which may differ from the associate
  *     browsing context of <var>el</var>.  When retrieving XUL
  *     elements, this is optional.
  *
  * @return {boolean}
  *     True if <var>el</var> is stale, false otherwise.
  */
-element.isStale = function(el, window = undefined) {
-  if (typeof window == "undefined") {
-    window = el.ownerGlobal;
+element.isStale = function(el, win = undefined) {
+  if (typeof win == "undefined") {
+    win = el.ownerGlobal;
   }
 
   if (el === null ||
       !el.ownerGlobal ||
-      el.ownerDocument !== window.document) {
+      el.ownerDocument !== win.document) {
     return true;
   }
 
   return !el.isConnected;
 };
 
 /**
  * Determine if <var>el</var> is selected or not.
@@ -1141,33 +1141,33 @@ element.isObscured = function(el) {
 // https://bugzil.la/1354578
 /**
  * Calculate the in-view centre point of the area of the given DOM client
  * rectangle that is inside the viewport.
  *
  * @param {DOMRect} rect
  *     Element off a DOMRect sequence produced by calling
  *     <code>getClientRects</code> on an {@link Element}.
- * @param {WindowProxy} window
+ * @param {WindowProxy} win
  *     Current window global.
  *
  * @return {Map.<string, number>}
  *     X and Y coordinates that denotes the in-view centre point of
  *     <var>rect</var>.
  */
-element.getInViewCentrePoint = function(rect, window) {
+element.getInViewCentrePoint = function(rect, win) {
   const {max, min} = Math;
 
   let x = {
     left: max(0, min(rect.x, rect.x + rect.width)),
-    right: min(window.innerWidth, max(rect.x, rect.x + rect.width)),
+    right: min(win.innerWidth, max(rect.x, rect.x + rect.width)),
   };
   let y = {
     top: max(0, min(rect.y, rect.y + rect.height)),
-    bottom: min(window.innerHeight, max(rect.y, rect.y + rect.height)),
+    bottom: min(win.innerHeight, max(rect.y, rect.y + rect.height)),
   };
 
   return {
     x: (x.left + x.right) / 2,
     y: (y.top + y.bottom) / 2,
   };
 };
 
--- a/testing/marionette/evaluate.js
+++ b/testing/marionette/evaluate.js
@@ -146,60 +146,60 @@ evaluate.sandbox = function(sb, script, 
  * Convert any web elements in arbitrary objects to DOM elements by
  * looking them up in the seen element store.
  *
  * @param {Object} obj
  *     Arbitrary object containing web elements.
  * @param {element.Store=} seenEls
  *     Known element store to look up web elements from.  If undefined,
  *     the web element references are returned instead.
- * @param {WindowProxy=} window
+ * @param {WindowProxy=} win
  *     Current browsing context, if `seenEls` is provided.
  *
  * @return {Object}
  *     Same object as provided by `obj` with the web elements
  *     replaced by DOM elements.
  *
  * @throws {NoSuchElementError}
  *     If `seenEls` is given and the web element reference has not
  *     been seen before.
  * @throws {StaleElementReferenceError}
  *     If `seenEls` is given and the element has gone stale, indicating
  *     it is no longer attached to the DOM, or its node document
  *     is no longer the active document.
  */
-evaluate.fromJSON = function(obj, seenEls = undefined, window = undefined) {
+evaluate.fromJSON = function(obj, seenEls = undefined, win = undefined) {
   switch (typeof obj) {
     case "boolean":
     case "number":
     case "string":
     default:
       return obj;
 
     case "object":
       if (obj === null) {
         return obj;
 
       // arrays
       } else if (Array.isArray(obj)) {
-        return obj.map(e => evaluate.fromJSON(e, seenEls, window));
+        return obj.map(e => evaluate.fromJSON(e, seenEls, win));
 
       // web elements
       } else if (WebElement.isReference(obj)) {
         let webEl = WebElement.fromJSON(obj);
         if (seenEls) {
-          return seenEls.get(webEl, window);
+          return seenEls.get(webEl, win);
         }
         return webEl;
       }
 
       // arbitrary objects
       let rv = {};
       for (let prop in obj) {
-        rv[prop] = evaluate.fromJSON(obj[prop], seenEls, window);
+        rv[prop] = evaluate.fromJSON(obj[prop], seenEls, win);
       }
       return rv;
   }
 };
 
 /**
  * Marshal arbitrary objects to JSON-safe primitives that can be
  * transported over the Marionette protocol.
@@ -413,63 +413,63 @@ sandbox.augment = function(sb, adapter) 
   }
 
   return sb;
 };
 
 /**
  * Creates a sandbox.
  *
- * @param {Window} window
+ * @param {Window} win
  *     The DOM Window object.
  * @param {nsIPrincipal=} principal
  *     An optional, custom principal to prefer over the Window.  Useful if
  *     you need elevated security permissions.
  *
  * @return {Sandbox}
  *     The created sandbox.
  */
-sandbox.create = function(window, principal = null, opts = {}) {
-  let p = principal || window;
+sandbox.create = function(win, principal = null, opts = {}) {
+  let p = principal || win;
   opts = Object.assign({
-    sameZoneAs: window,
-    sandboxPrototype: window,
+    sameZoneAs: win,
+    sandboxPrototype: win,
     wantComponents: true,
     wantXrays: true,
   }, opts);
   return new Cu.Sandbox(p, opts);
 };
 
 /**
  * Creates a mutable sandbox, where changes to the global scope
  * will have lasting side-effects.
  *
- * @param {Window} window
+ * @param {Window} win
  *     The DOM Window object.
  *
  * @return {Sandbox}
  *     The created sandbox.
  */
-sandbox.createMutable = function(window) {
+sandbox.createMutable = function(win) {
   let opts = {
     wantComponents: false,
     wantXrays: false,
   };
   // Note: We waive Xrays here to match potentially-accidental old behavior.
-  return Cu.waiveXrays(sandbox.create(window, null, opts));
+  return Cu.waiveXrays(sandbox.create(win, null, opts));
 };
 
-sandbox.createSystemPrincipal = function(window) {
+sandbox.createSystemPrincipal = function(win) {
   let principal = Cc["@mozilla.org/systemprincipal;1"]
       .createInstance(Ci.nsIPrincipal);
-  return sandbox.create(window, principal);
+  return sandbox.create(win, principal);
 };
 
-sandbox.createSimpleTest = function(window, harness) {
-  let sb = sandbox.create(window);
+sandbox.createSimpleTest = function(win, harness) {
+  let sb = sandbox.create(win);
   sb = sandbox.augment(sb, harness);
   sb[FINISH] = () => sb[COMPLETE](harness.generate_results());
   return sb;
 };
 
 /**
  * Sandbox storage.  When the user requests a sandbox by a specific name,
  * if one exists in the storage this will be used as long as its window
--- a/testing/marionette/sync.js
+++ b/testing/marionette/sync.js
@@ -266,20 +266,20 @@ function MessageManagerDestroyedPromise(
     Services.obs.addObserver(observe, "message-manager-disconnect");
   });
 }
 
 /**
  * Throttle until the main thread is idle and `window` has performed
  * an animation frame (in that order).
  *
- * @param {ChromeWindow} window
+ * @param {ChromeWindow} win
  *     Window to request the animation frame from.
  *
  * @return Promise
  */
-function IdlePromise(window) {
+function IdlePromise(win) {
   return new Promise(resolve => {
     Services.tm.idleDispatchToMainThread(() => {
-      window.requestAnimationFrame(resolve);
+      win.requestAnimationFrame(resolve);
     });
   });
 }
--- a/testing/marionette/test/unit/test_sync.js
+++ b/testing/marionette/test/unit/test_sync.js
@@ -140,17 +140,17 @@ add_task(async function test_Sleep() {
     Assert.throws(() => new Sleep(type), /TypeError/);
   }
   Assert.throws(() => new Sleep(1.2), /RangeError/);
   Assert.throws(() => new Sleep(-1), /RangeError/);
 });
 
 add_task(async function test_IdlePromise() {
   let called = false;
-  let window = {
+  let win = {
     requestAnimationFrame(callback) {
       called = true;
       callback();
     },
   };
-  await IdlePromise(window);
+  await IdlePromise(win);
   ok(called);
 });