Bug 1321216 - Remove legacy generator from devtools/. r=jryans
authorTooru Fujisawa <arai_a@mac.com>
Thu, 01 Dec 2016 18:04:50 +0900
changeset 324981 7dc7e58f62f4f837410f92527e70c2eaa543b50b
parent 324980 ad9064b5fe9a0da54cc820482a61759a730a1c0b
child 324982 43472882f637c01e43e3ecbfd37c1ffff7fabfa1
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersjryans
bugs1321216
milestone53.0a1
Bug 1321216 - Remove legacy generator from devtools/. r=jryans
devtools/client/canvasdebugger/test/browser_profiling-webgl.js
devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-new-script.js
devtools/client/debugger/test/mochitest/browser_dbg_host-layout.js
devtools/client/storage/test/storage-listings.html
devtools/server/tests/mochitest/test_inspector-dead-nodes.html
devtools/shared/qrcode/tests/mochitest/test_decode.html
--- a/devtools/client/canvasdebugger/test/browser_profiling-webgl.js
+++ b/devtools/client/canvasdebugger/test/browser_profiling-webgl.js
@@ -72,20 +72,16 @@ function* ifTestingSupported() {
   is(animationOverview.primitive.points, 4, "The count of points is correct.");
   is(animationOverview.primitive.lines, 8, "The count of lines is correct.");
   
   yield removeTab(target.tab);
   finish();
 }
 
 function testFunctionCallTimestamp(functionCalls, currentTime) {
-
   info("Check the timestamps of function calls");
 
   for ( let i = 0; i < functionCalls.length-1; i += 2 ) {
     ok( functionCalls[i].timestamp > 0, "The timestamp of the called function is larger than 0." );
     ok( functionCalls[i].timestamp < currentTime, "The timestamp has been minus the frame start time." );
     ok( functionCalls[i+1].timestamp > functionCalls[i].timestamp, "The timestamp of the called function is correct." );
   }
-
-  yield removeTab(target.tab);
-  finish();
 }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-new-script.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-new-script.js
@@ -68,25 +68,25 @@ function test() {
       });
 
       EventUtils.sendMouseEvent({ type: "mousedown" },
                                 gDebugger.document.getElementById("resume"),
                                 gDebugger);
       return deferred.promise;
     }
 
-    Task.spawn(function(){
+    (async function(){
       let onCaretUpdated = waitForCaretAndScopes(gPanel, 16);
       callInTab(gTab, "runDebuggerStatement");
-      yield onCaretUpdated;
+      await onCaretUpdated;
 
       is(gDebugger.gThreadClient.state, "paused",
          "The debugger statement was reached.");
       ok(isCaretPos(gPanel, 16),
          "The source editor caret position is incorrect (1).");
 
-      yield actions.addBreakpoint({ actor: getSourceActor(gSources, TAB_URL), line: 20 });
-      yield testResume();
-      yield testBreakpointHit();
+      await actions.addBreakpoint({ actor: getSourceActor(gSources, TAB_URL), line: 20 });
+      await testResume();
+      await testBreakpointHit();
       resumeDebuggerThenCloseAndFinish(gPanel);
-    });
+    })();
   });
 }
--- a/devtools/client/debugger/test/mochitest/browser_dbg_host-layout.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_host-layout.js
@@ -11,106 +11,100 @@
 "use strict";
 
 var gDefaultHostType = Services.prefs.getCharPref("devtools.toolbox.host");
 
 function test() {
   // test is too slow on some platforms due to the number of test cases
   requestLongerTimeout(3);
 
-  Task.spawn(function*() {
-    yield testHosts(["bottom", "side", "window:big"], ["horizontal", "vertical", "horizontal"]);
-    yield testHosts(["side", "bottom", "side"], ["vertical", "horizontal", "vertical"]);
-    yield testHosts(["bottom", "side", "bottom"], ["horizontal", "vertical", "horizontal"]);
-    yield testHosts(["side", "window:big", "side"], ["vertical", "horizontal", "vertical"]);
-    yield testHosts(["window:big", "side", "window:big"], ["horizontal", "vertical", "horizontal"]);
-    yield testHosts(["window:small", "bottom", "side"], ["vertical", "horizontal", "vertical"]);
-    yield testHosts(["window:small", "window:big", "window:small"], ["vertical", "horizontal", "vertical"]);
+  (async function() {
+    await testHosts(["bottom", "side", "window:big"], ["horizontal", "vertical", "horizontal"]);
+    await testHosts(["side", "bottom", "side"], ["vertical", "horizontal", "vertical"]);
+    await testHosts(["bottom", "side", "bottom"], ["horizontal", "vertical", "horizontal"]);
+    await testHosts(["side", "window:big", "side"], ["vertical", "horizontal", "vertical"]);
+    await testHosts(["window:big", "side", "window:big"], ["horizontal", "vertical", "horizontal"]);
+    await testHosts(["window:small", "bottom", "side"], ["vertical", "horizontal", "vertical"]);
+    await testHosts(["window:small", "window:big", "window:small"], ["vertical", "horizontal", "vertical"]);
     finish();
-  });
+  })();
 }
 
-function testHosts(aHostTypes, aLayoutTypes) {
+async function testHosts(aHostTypes, aLayoutTypes) {
   let [firstHost, secondHost, thirdHost] = aHostTypes;
   let [firstLayout, secondLayout, thirdLayout] = aLayoutTypes;
 
   Services.prefs.setCharPref("devtools.toolbox.host", getHost(firstHost));
 
-  return Task.spawn(function*() {
-    let [tab, debuggee, panel] = yield initDebugger();
-    if (getHost(firstHost) === "window") {
-      yield resizeToolboxWindow(panel, firstHost);
-    }
+  let [tab, debuggee, panel] = await initDebugger();
+  if (getHost(firstHost) === "window") {
+    await resizeToolboxWindow(panel, firstHost);
+  }
 
-    yield testHost(panel, getHost(firstHost), firstLayout);
-    yield switchAndTestHost(tab, panel, secondHost, secondLayout);
-    yield switchAndTestHost(tab, panel, thirdHost, thirdLayout);
-    yield teardown(panel);
-  });
+  await testHost(panel, getHost(firstHost), firstLayout);
+  await switchAndTestHost(tab, panel, secondHost, secondLayout);
+  await switchAndTestHost(tab, panel, thirdHost, thirdLayout);
+  await teardown(panel);
 }
 
-function switchAndTestHost(aTab, aPanel, aHostType, aLayoutType) {
+async function switchAndTestHost(aTab, aPanel, aHostType, aLayoutType) {
   let gToolbox = aPanel._toolbox;
   let gDebugger = aPanel.panelWin;
 
-  return Task.spawn(function*() {
-    let layoutChanged = waitEventOnce(gDebugger, gDebugger.EVENTS.LAYOUT_CHANGED);
-    let hostChanged = gToolbox.switchHost(getHost(aHostType));
+  let layoutChanged = waitEventOnce(gDebugger, gDebugger.EVENTS.LAYOUT_CHANGED);
+  let hostChanged = gToolbox.switchHost(getHost(aHostType));
 
-    yield hostChanged;
-    info("The toolbox's host has changed.");
+  await hostChanged;
+  info("The toolbox's host has changed.");
 
-    if (getHost(aHostType) === "window") {
-      yield resizeToolboxWindow(aPanel, aHostType);
-    }
+  if (getHost(aHostType) === "window") {
+    await resizeToolboxWindow(aPanel, aHostType);
+  }
 
-    yield layoutChanged;
-    info("The debugger's layout has changed.");
+  await layoutChanged;
+  info("The debugger's layout has changed.");
 
-    yield testHost(aPanel, getHost(aHostType), aLayoutType);
-  });
+  await testHost(aPanel, getHost(aHostType), aLayoutType);
 }
 
 function waitEventOnce(aTarget, aEvent) {
-  let deferred = promise.defer();
-  aTarget.once(aEvent, deferred.resolve);
-  return deferred.promise;
+  return new Promise(resolve => aTarget.once(aEvent, resolve));
 }
 
 function getHost(host) {
   if (host.indexOf("window") == 0) {
     return "window";
   }
   return host;
 }
 
-function resizeToolboxWindow(panel, host) {
+async function resizeToolboxWindow(panel, host) {
   let sizeOption = host.split(":")[1];
   let win = panel._toolbox.win.parent;
 
   // should be the same value as BREAKPOINT_SMALL_WINDOW_WIDTH in debugger-view.js
   let breakpoint = 850;
 
   if (sizeOption == "big" && win.outerWidth <= breakpoint) {
-    yield resizeAndWaitForLayoutChange(panel, breakpoint + 300);
+    await resizeAndWaitForLayoutChange(panel, breakpoint + 300);
   } else if (sizeOption == "small" && win.outerWidth >= breakpoint) {
-    yield resizeAndWaitForLayoutChange(panel, breakpoint - 300);
+    await resizeAndWaitForLayoutChange(panel, breakpoint - 300);
   } else {
     info("Window resize unnecessary for host " + host);
   }
 }
 
-function resizeAndWaitForLayoutChange(panel, width) {
-    info("Updating toolbox window width to " + width);
+async function resizeAndWaitForLayoutChange(panel, width) {
+  info("Updating toolbox window width to " + width);
 
-    let win = panel._toolbox.win.parent;
-    let gDebugger = panel.panelWin;
+  let win = panel._toolbox.win.parent;
+  let gDebugger = panel.panelWin;
 
-    win.resizeTo(width, window.screen.availHeight);
-    yield waitEventOnce(gDebugger, gDebugger.EVENTS.LAYOUT_CHANGED);
+  win.resizeTo(width, window.screen.availHeight);
+  await waitEventOnce(gDebugger, gDebugger.EVENTS.LAYOUT_CHANGED);
 }
 
 function testHost(aPanel, aHostType, aLayoutType) {
   let gDebugger = aPanel.panelWin;
   let gView = gDebugger.DebuggerView;
 
   is(gView._hostType, aHostType,
     "The default host type should've been set on the panel window (1).");
--- a/devtools/client/storage/test/storage-listings.html
+++ b/devtools/client/storage/test/storage-listings.html
@@ -23,94 +23,94 @@ document.cookie = "c3=foobar-2; expires=
   new Date(cookieExpiresTime2).toGMTString() + "; path=/";
 // ... and some local storage items ..
 localStorage.setItem("ls1", "foobar");
 localStorage.setItem("ls2", "foobar-2");
 // ... and finally some session storage items too
 sessionStorage.setItem("ss1", "foobar-3");
 dump("added cookies and storage from main page\n");
 
-let idbGenerator = function*() {
+let idbGenerator = async function() {
   let request = indexedDB.open("idb1", 1);
   request.onerror = function() {
     throw new Error("error opening db connection");
   };
-  let db = yield new Promise(done => {
+  let db = await new Promise(done => {
     request.onupgradeneeded = event => {
       let db = event.target.result;
       let store1 = db.createObjectStore("obj1", { keyPath: "id" });
       store1.createIndex("name", "name", { unique: false });
       store1.createIndex("email", "email", { unique: true });
       let store2 = db.createObjectStore("obj2", { keyPath: "id2" });
       store1.transaction.oncomplete = () => {
         done(db);
       };
     };
   });
 
   // Prevents AbortError
-  yield new Promise(done => {
+  await new Promise(done => {
     request.onsuccess = done;
   });
 
   let transaction = db.transaction(["obj1", "obj2"], "readwrite");
   let store1 = transaction.objectStore("obj1");
   let store2 = transaction.objectStore("obj2");
   store1.add({id: 1, name: "foo", email: "foo@bar.com"});
   store1.add({id: 2, name: "foo2", email: "foo2@bar.com"});
   store1.add({id: 3, name: "foo2", email: "foo3@bar.com"});
   store2.add({
     id2: 1,
     name: "foo",
     email: "foo@bar.com",
     extra: "baz"
   });
   // Prevents AbortError during close()
-  yield new Promise(success => {
+  await new Promise(success => {
     transaction.oncomplete = success;
   });
 
   db.close();
 
   request = indexedDB.open("idb2", 1);
-  let db2 = yield new Promise(done => {
+  let db2 = await new Promise(done => {
     request.onupgradeneeded = event => {
       let db2 = event.target.result;
       let store3 = db2.createObjectStore("obj3", { keyPath: "id3" });
       store3.createIndex("name2", "name2", { unique: true });
       store3.transaction.oncomplete = () => {
         done(db2);
       }
     };
   });
   // Prevents AbortError during close()
-  yield new Promise(done => {
+  await new Promise(done => {
     request.onsuccess = done;
   });
   db2.close();
 
   dump("added indexedDB from main page\n");
 };
 
 function deleteDB(dbName) {
   return new Promise(resolve => {
     dump("removing database " + dbName + " from " + document.location + "\n");
     indexedDB.deleteDatabase(dbName).onsuccess = resolve;
   });
 }
 
-function fetchPut(cache, url) {
-  let response = yield fetch(url);
-  yield cache.put(url, response);
+async function fetchPut(cache, url) {
+  let response = await fetch(url);
+  await cache.put(url, response);
 }
 
-let cacheGenerator = function*() {
-  let cache = yield caches.open("plop");
-  yield fetchPut(cache, "404_cached_file.js");
-  yield fetchPut(cache, "browser_storage_basic.js");
+let cacheGenerator = async function() {
+  let cache = await caches.open("plop");
+  await fetchPut(cache, "404_cached_file.js");
+  await fetchPut(cache, "browser_storage_basic.js");
 };
 
 window.setup = function*() {
   yield idbGenerator();
   yield cacheGenerator();
 };
 
 window.clear = function*() {
--- a/devtools/server/tests/mochitest/test_inspector-dead-nodes.html
+++ b/devtools/server/tests/mochitest/test_inspector-dead-nodes.html
@@ -15,221 +15,221 @@ const inspector = require("devtools/shar
 
 window.onload = function() {
   SimpleTest.waitForExplicitFinish();
   runNextTest();
 }
 
 var gWalker, gDoc;
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   let url = document.getElementById("inspectorContent").href;
 
   let def = promise.defer();
   attachURL(url, function(err, client, tab, doc) {
     def.resolve({client, tab, doc});
   });
   let {client, tab, doc} = yield def.promise;
   gDoc = doc;
 
   let {InspectorFront} = require("devtools/shared/fronts/inspector");
   let inspector = InspectorFront(client, tab);
   gWalker = yield inspector.getWalker();
 
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.parents(nodeFront) before the load completes shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.parents(nodeFront);
   yield newRoot;
 
   ok(true, "The call to walker.parents() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.children(nodeFront) before the load completes shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "body");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.children(nodeFront);
   yield newRoot;
 
   ok(true, "The call to walker.children() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.siblings(nodeFront) before the load completes shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.siblings(nodeFront);
   yield newRoot;
 
   ok(true, "The call to walker.siblings() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.nextSibling(nodeFront) before the load completes shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.nextSibling(nodeFront);
   yield newRoot;
 
   ok(true, "The call to walker.nextSibling() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.previousSibling(nodeFront) before the load completes shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.previousSibling(nodeFront);
   yield newRoot;
 
   ok(true, "The call to walker.previousSibling() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.addPseudoClassLock(nodeFront) before the load completes " +
     "shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.addPseudoClassLock(nodeFront, ":hover");
   yield newRoot;
 
   ok(true, "The call to walker.addPseudoClassLock() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.removePseudoClassLock(nodeFront) before the load completes " +
     "shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.removePseudoClassLock(nodeFront, ":hover");
   yield newRoot;
 
   ok(true, "The call to walker.removePseudoClassLock() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.clearPseudoClassLocks(nodeFront) before the load completes " +
     "shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.clearPseudoClassLocks(nodeFront);
   yield newRoot;
 
   ok(true, "The call to walker.clearPseudoClassLocks() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.innerHTML(nodeFront) before the load completes shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.innerHTML(nodeFront);
   yield newRoot;
 
   ok(true, "The call to walker.innerHTML() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.setInnerHTML(nodeFront) before the load completes shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.setInnerHTML(nodeFront, "<span>innerHTML changed</span>");
   yield newRoot;
 
   ok(true, "The call to walker.setInnerHTML() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.outerHTML(nodeFront) before the load completes shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.outerHTML(nodeFront);
   yield newRoot;
 
   ok(true, "The call to walker.outerHTML() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.setOuterHTML(nodeFront) before the load completes shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.setOuterHTML(nodeFront, "<h1><span>innerHTML changed</span></h1>");
   yield newRoot;
 
   ok(true, "The call to walker.setOuterHTML() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.insertAdjacentHTML(nodeFront) before the load completes shouldn't " +
     "fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.insertAdjacentHTML(nodeFront, "afterEnd",
     "<span>new adjacent HTML</span>");
   yield newRoot;
 
   ok(true, "The call to walker.insertAdjacentHTML() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.removeNode(nodeFront) before the load completes should throw");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   let hasThrown = false;
   try {
@@ -238,17 +238,17 @@ addAsyncTest(function() {
     hasThrown = true;
   }
   yield newRoot;
 
   ok(hasThrown, "The call to walker.removeNode() threw");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.removeNodes([nodeFront]) before the load completes should throw");
 
   let nodeFront1 = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let nodeFront2 = yield gWalker.querySelector(gWalker.rootNode, "#longstring");
   let nodeFront3 = yield gWalker.querySelector(gWalker.rootNode, "#shortstring");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
@@ -259,106 +259,106 @@ addAsyncTest(function() {
     hasThrown = true;
   }
   yield newRoot;
 
   ok(hasThrown, "The call to walker.removeNodes() threw");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.insertBefore(nodeFront, parent, null) before the load completes " +
     "shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newParentFront = yield gWalker.querySelector(gWalker.rootNode, "#longlist");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.insertBefore(nodeFront, newParentFront);
   yield newRoot;
 
   ok(true, "The call to walker.insertBefore() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.insertBefore(nodeFront, parent, sibling) before the load completes " +
     "shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newParentFront = yield gWalker.querySelector(gWalker.rootNode, "#longlist");
   let siblingFront = yield gWalker.querySelector(gWalker.rootNode, "#b");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.insertBefore(nodeFront, newParentFront, siblingFront);
   yield newRoot;
 
   ok(true, "The call to walker.insertBefore() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.editTagName(nodeFront) before the load completes shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.editTagName(nodeFront, "h2");
   yield newRoot;
 
   ok(true, "The call to walker.editTagName() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.hideNode(nodeFront) before the load completes shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.hideNode(nodeFront);
   yield newRoot;
 
   ok(true, "The call to walker.hideNode() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.unhideNode(nodeFront) before the load completes shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.unhideNode(nodeFront);
   yield newRoot;
 
   ok(true, "The call to walker.unhideNode() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.releaseNode(nodeFront) before the load completes shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "h1");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.releaseNode(nodeFront);
   yield newRoot;
 
   ok(true, "The call to walker.releaseNode() didn't fail");
   runNextTest();
 });
 
-addAsyncTest(function() {
+addAsyncTest(function*() {
   info("Getting a nodeFront, reloading the page, and calling " +
     "walker.querySelector(nodeFront) before the load completes shouldn't fail");
 
   let nodeFront = yield gWalker.querySelector(gWalker.rootNode, "body");
   let newRoot = waitForMutation(gWalker, isNewRoot);
   gDoc.defaultView.location.reload();
   yield gWalker.querySelector(nodeFront, "h1");
   yield newRoot;
--- a/devtools/shared/qrcode/tests/mochitest/test_decode.html
+++ b/devtools/shared/qrcode/tests/mochitest/test_decode.html
@@ -8,57 +8,53 @@ Test decoding a simple message
   <title>Test decoding a simple message</title>
 
   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
   <script type="application/javascript;version=1.8">
 window.onload = function() {
   const { utils: Cu } = Components;
   const { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
-  const { Task } = require("devtools/shared/task");
-  const promise = require("promise");
-  const defer = require("devtools/shared/defer");
 
   const QR = require("devtools/shared/qrcode/index");
 
   SimpleTest.waitForExplicitFinish();
 
   const testImage =
     "data:image/gif;base64,R0lGODdhOgA6AIAAAAAAAP///ywAAAAAOgA6AAAC" +
     "/4yPqcvtD6OctNqLs968+w+G4gKU5nkaKKquLuW+QVy2tAkDTj3rfQts8CRDko" +
     "+HPPoYRUgy9YsyldDm44mLWhHYZM6W7WaDqyCRGkZDySxpRGw2sqvLt1q5w/fo" +
     "XyE6vnUQOJUHBlinMGh046V1F5PDqNcoqcgBOWKBKbK2N+aY+Ih49VkmqMcl2l" +
     "dkhZUK1umE6jZXJ2ZJaujZaRqH4bpb2uZrJxvIt4Ebe9qoYYrJOsw8apz2bCut" +
     "m9kqDcw52uuImyr5Oh1KXH1jrn2anuunywtODU/o2c6teceW39ZcLFg/fNMo1b" +
     "t3jVw2dwTPwJq1KYG3gAklCgu37yGxeScYKyiCc+7DR34hPVQiuQ7UhJMagyEb" +
     "lymmzJk0a9q8iTOnzp0NCgAAOw==";
 
-  Task.spawn(function() {
-    let result = yield QR.decodeFromURI(testImage);
+  (async function() {
+    let result = await QR.decodeFromURI(testImage);
     is(result, "HELLO", "Decoded data URI result matches");
-    let canvas = yield drawToCanvas(testImage);
+    let canvas = await drawToCanvas(testImage);
     result = QR.decodeFromCanvas(canvas);
     is(result, "HELLO", "Decoded canvas result matches");
-  }).then(SimpleTest.finish, ok.bind(null, false));
+  })().then(SimpleTest.finish, ok.bind(null, false));
 
   function drawToCanvas(src) {
-    let deferred = defer();
-    let canvas = document.createElement("canvas");
-    let context = canvas.getContext("2d");
-    let image = new Image();
+    return new Promise(resolve => {
+      let canvas = document.createElement("canvas");
+      let context = canvas.getContext("2d");
+      let image = new Image();
 
-    image.onload = () => {
-      canvas.width = image.width;
-      canvas.height = image.height;
-      context.drawImage(image, 0, 0);
-      deferred.resolve(canvas);
-    };
-    image.src = src;
-
-    return deferred.promise;
+      image.onload = () => {
+        canvas.width = image.width;
+        canvas.height = image.height;
+        context.drawImage(image, 0, 0);
+        resolve(canvas);
+      };
+      image.src = src;
+    });
   }
 };
   </script>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none">
 </div>