Bug 1504157 - Don't share window object between 2 tests; r=smaug
authorLiang-Heng Chen <xeonchen@gmail.com>
Thu, 14 Feb 2019 19:53:24 +0000
changeset 459509 a2bc4dbac66aa7d73dff232216a89f3eeb1754a3
parent 459508 63430292f0f1469df18181384321e5fb102c3857
child 459510 b39035332029d51402f076823d7b7643dbb10161
push id111964
push usercsabou@mozilla.com
push dateFri, 15 Feb 2019 18:54:44 +0000
treeherdermozilla-inbound@db3c4f905082 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1504157
milestone67.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 1504157 - Don't share window object between 2 tests; r=smaug using one window to test resize event twice with 2 separated event listener might potentially action on incorrect resize event. Differential Revision: https://phabricator.services.mozilla.com/D19790
browser/components/resistfingerprinting/test/browser/head.js
--- a/browser/components/resistfingerprinting/test/browser/head.js
+++ b/browser/components/resistfingerprinting/test/browser/head.js
@@ -200,16 +200,26 @@ async function testWindowSizeSetting(aBr
 
         if (input.testOuter) {
           win.outerWidth = input.settingWidth;
         } else {
           win.innerWidth = input.settingWidth;
         }
       });
 
+      win.close();
+      // Open a new window and wait until it loads.
+      await new Promise(resolve => {
+        // Given a initial window size which should be different from target
+        // size. We need this to trigger 'onresize' event.
+        let initWinFeatures = "width=" + input.initWidth + ",height=" + input.initHeight;
+        win = content.open("http://example.net/", "", initWinFeatures);
+        win.onload = () => resolve();
+      });
+
       // Test inner/outerHeight.
       await new Promise(resolve => {
         win.addEventListener("resize", () => {
           is(win.screen.height, input.targetHeight,
             "The screen.height has a correct rounded value");
           is(win.innerHeight, input.targetHeight,
             "The window.innerHeight has a correct rounded value");