Bug 1312224: Fix race in browser_ext_browserAction_popup_resize.js. r=me
authorKris Maglione <maglione.k@gmail.com>
Sat, 22 Oct 2016 14:22:43 -0700
changeset 319056 795b9e63823c3750fd9c1a573cdbb0961c994bad
parent 319055 c20146f38762bfc9849ec976ab39b3e63ad5f97e
child 319057 a8cc44c79c30946426314285c6f63c0f4d2b0295
push id30858
push userryanvm@gmail.com
push dateSun, 23 Oct 2016 17:17:41 +0000
treeherdermozilla-central@a9a41b69f3f9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1312224
milestone52.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 1312224: Fix race in browser_ext_browserAction_popup_resize.js. r=me MozReview-Commit-ID: 6pSsJDfNJzO
browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js
browser/components/extensions/test/browser/head.js
--- a/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js
+++ b/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js
@@ -171,16 +171,18 @@ function* testPopupSize(standardsMode, b
       ok(panelRect.bottom, origPanelRect.bottom, "Panel has not moved upwards");
       ok(panelRect.top <= origPanelRect.top, `Panel has not shrunk from original size (${panelRect.top} <= ${origPanelRect.top})`);
 
       let panelTop = browserWin.mozInnerScreenY + panelRect.top;
       ok(panelTop >= browserWin.screen.availTop, `Top of popup should be on-screen. (${panelTop} >= ${browserWin.screen.availTop})`);
     }
   };
 
+  yield awaitBrowserLoaded(browser);
+
   // Wait long enough to make sure the initial resize debouncing timer has
   // expired.
   yield new Promise(resolve => setTimeout(resolve, 100));
 
   let dims = yield promiseContentDimensions(browser);
 
   is(dims.isStandards, standardsMode, "Document has the expected compat mode");
 
--- a/browser/components/extensions/test/browser/head.js
+++ b/browser/components/extensions/test/browser/head.js
@@ -125,29 +125,31 @@ function alterContent(browser, task, arg
 
 function getPanelForNode(node) {
   while (node.localName != "panel") {
     node = node.parentNode;
   }
   return node;
 }
 
+var awaitBrowserLoaded = browser => ContentTask.spawn(browser, null, () => {
+  if (content.document.readyState !== "complete") {
+    return ContentTaskUtils.waitForEvent(content, "load").then(() => {});
+  }
+});
+
 var awaitExtensionPanel = Task.async(function* (extension, win = window, awaitLoad = true) {
   let {originalTarget: browser} = yield BrowserTestUtils.waitForEvent(
     win.document, "WebExtPopupLoaded", true,
     event => event.detail.extension.id === extension.id);
 
   yield Promise.all([
     promisePopupShown(getPanelForNode(browser)),
 
-    awaitLoad && ContentTask.spawn(browser, null, () => {
-      if (content.document.readyState !== "complete") {
-        return ContentTaskUtils.waitForEvent(content, "load").then(() => {});
-      }
-    }),
+    awaitLoad && awaitBrowserLoaded(browser),
   ]);
 
   return browser;
 });
 
 function getBrowserActionWidget(extension) {
   return CustomizableUI.getWidget(makeWidgetId(extension.id) + "-browser-action");
 }