Bug 985417 - Fix uncaught promise rejection when running browser_net_simple-request-data.js, r=dcamp
authorVictor Porof <vporof@mozilla.com>
Thu, 12 Jun 2014 12:16:59 -0400
changeset 188435 6c12b36827e082f02d007e9b39fe7e9e9e16540d
parent 188434 9451a90e1b7a4ad6e12cbd9fa475822e969feb9e
child 188436 78abcb1bf52fd5ab4ff54240a172f42bafc83340
push id26955
push userryanvm@gmail.com
push dateThu, 12 Jun 2014 21:21:04 +0000
treeherdermozilla-central@aab3362f97e9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdcamp
bugs985417
milestone33.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 985417 - Fix uncaught promise rejection when running browser_net_simple-request-data.js, r=dcamp
browser/devtools/netmonitor/test/browser_net_simple-init.js
--- a/browser/devtools/netmonitor/test/browser_net_simple-init.js
+++ b/browser/devtools/netmonitor/test/browser_net_simple-init.js
@@ -1,16 +1,21 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Simple check if the network monitor starts up and shuts down properly.
  */
 
 function test() {
+  // These test suite functions are removed from the global scope inside a
+  // cleanup function. However, we still need them.
+  let gInfo = info;
+  let gOk = ok;
+
   initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => {
     info("Starting test... ");
 
     is(aTab.linkedBrowser.contentWindow.wrappedJSObject.location, SIMPLE_URL,
       "The current tab's location is the correct one.");
     is(aDebuggee.location, SIMPLE_URL,
       "The current debuggee's location is the correct one.");
 
@@ -31,30 +36,30 @@ function test() {
         "There should be a client available at this point (" + aTag + ").");
       ok(aMonitor._controller.tabClient,
         "There should be a tabClient available at this point (" + aTag + ").");
       ok(aMonitor._controller.webConsoleClient,
         "There should be a webConsoleClient available at this point (" + aTag + ").");
     }
 
     function checkIfDestroyed(aTag) {
-      info("Checking if destruction is ok.");
+      gInfo("Checking if destruction is ok.");
 
-      ok(aMonitor._view,
+      gOk(aMonitor._view,
         "The network monitor view object still exists (" + aTag + ").");
-      ok(aMonitor._controller,
+      gOk(aMonitor._controller,
         "The network monitor controller object still exists (" + aTag + ").");
-      ok(aMonitor._controller._shutdown,
+      gOk(aMonitor._controller._shutdown,
         "The network monitor controller object still exists and is destroyed (" + aTag + ").");
 
-      ok(!aMonitor._controller.client,
+      gOk(!aMonitor._controller.client,
         "There shouldn't be a client available after destruction (" + aTag + ").");
-      ok(!aMonitor._controller.tabClient,
+      gOk(!aMonitor._controller.tabClient,
         "There shouldn't be a tabClient available after destruction (" + aTag + ").");
-      ok(!aMonitor._controller.webConsoleClient,
+      gOk(!aMonitor._controller.webConsoleClient,
         "There shouldn't be a webConsoleClient available after destruction (" + aTag + ").");
     }
 
     executeSoon(() => {
       checkIfInitialized(1);
 
       aMonitor._controller.startupNetMonitor()
         .then(() => {
@@ -70,19 +75,19 @@ function test() {
         .then(finish);
     });
 
     registerCleanupFunction(() => {
       checkIfDestroyed(1);
 
       aMonitor._controller.shutdownNetMonitor()
         .then(() => {
-          info("Shutting down again shouldn't do anything special.");
+          gInfo("Shutting down again shouldn't do anything special.");
           checkIfDestroyed(2);
           return aMonitor._controller.disconnect();
         })
         .then(() => {
-          info("Disconnecting again shouldn't do anything special.");
+          gInfo("Disconnecting again shouldn't do anything special.");
           checkIfDestroyed(3);
         });
     });
   });
 }