Bug 1585239 - Return the Promise for the accessibility document in the function runs in the iframe context. r=surkov
authorHiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
Thu, 19 Dec 2019 06:02:44 +0000
changeset 507702 5e8b48c8cd93ae318b2963de1b3c1db0710c0242
parent 507701 46336170cd327a6951aa7b386fa712829b3a488c
child 507703 a7d97d4f05a0b8a5850416719a0a1fa37860007d
push id36931
push useropoprus@mozilla.com
push dateThu, 19 Dec 2019 09:50:06 +0000
treeherdermozilla-central@5e8b48c8cd93 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1585239
milestone73.0a1
first release with
nightly linux32
5e8b48c8cd93 / 73.0a1 / 20191219095006 / files
nightly linux64
5e8b48c8cd93 / 73.0a1 / 20191219095006 / files
nightly mac
5e8b48c8cd93 / 73.0a1 / 20191219095006 / files
nightly win32
5e8b48c8cd93 / 73.0a1 / 20191219095006 / files
nightly win64
5e8b48c8cd93 / 73.0a1 / 20191219095006 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1585239 - Return the Promise for the accessibility document in the function runs in the iframe context. r=surkov Differential Revision: https://phabricator.services.mozilla.com/D57742
accessible/tests/browser/states/head.js
--- a/accessible/tests/browser/states/head.js
+++ b/accessible/tests/browser/states/head.js
@@ -17,18 +17,20 @@ Services.scriptloader.loadSubScript(
 // well as promisified-events.js.
 loadScripts(
   { name: "common.js", dir: MOCHITESTS_DIR },
   { name: "promisified-events.js", dir: MOCHITESTS_DIR }
 );
 
 // This is another version of addA11yLoadEvent for fission.
 async function waitForIFrameA11yReady(iFrameBrowsingContext) {
-  async function waitForReady() {
-    new Promise(resolve => {
+  await SimpleTest.promiseFocus(window);
+
+  await SpecialPowers.spawn(iFrameBrowsingContext, [], () => {
+    return new Promise(resolve => {
       function waitForDocLoad() {
         SpecialPowers.executeSoon(() => {
           const acc = SpecialPowers.Cc[
             "@mozilla.org/accessibilityService;1"
           ].getService(SpecialPowers.Ci.nsIAccessibilityService);
 
           const accDoc = acc.getAccessibleFor(content.document);
           let state = {};
@@ -37,21 +39,17 @@ async function waitForIFrameA11yReady(iF
             SpecialPowers.executeSoon(waitForDocLoad);
             return;
           }
           resolve();
         }, 0);
       }
       waitForDocLoad();
     });
-  }
-
-  await SimpleTest.promiseFocus(window);
-
-  await SpecialPowers.spawn(iFrameBrowsingContext, [], waitForReady);
+  });
 }
 
 // A utility function to make sure the information of scroll position or visible
 // area changes reach to out-of-process iframes.
 async function waitForIFrameUpdates() {
   // Wait for two frames since the information is notified via asynchronous IPC
   // calls.
   await new Promise(resolve => requestAnimationFrame(resolve));