Backed out changeset 496971f34128 (bug 946066) for mochitest-bc orange. a=backout
authorRyan VanderMeulen <ryanvm@gmail.com>
Sat, 18 Jan 2014 00:04:54 -0500
changeset 167958 9e922dfba7172a60f31ae4de5eabea5766e495a0
parent 167957 a7728f3c65e0d34a6896a1f0d6a6c00a93707f07
child 167959 f317f70c951bd8d6d87e8cadd42d32ced723022e
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs946066
milestone27.0
backs out496971f341284757e087f6e27b6343914743e1e5
Backed out changeset 496971f34128 (bug 946066) for mochitest-bc orange. a=backout
browser/devtools/webconsole/test/browser_webconsole_bug_658368_time_methods.js
browser/devtools/webconsole/test/head.js
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_658368_time_methods.js
+++ b/browser/devtools/webconsole/test/browser_webconsole_bug_658368_time_methods.js
@@ -6,82 +6,96 @@
 
 // Tests that the Console API implements the time() and timeEnd() methods.
 
 function test() {
   addTab("http://example.com/browser/browser/devtools/webconsole/" +
          "test/test-bug-658368-time-methods.html");
   browser.addEventListener("load", function onLoad() {
     browser.removeEventListener("load", onLoad, true);
-    Task.spawn(runner);
+    openConsole(null, consoleOpened);
   }, true);
-
-  function* runner() {
-    let hud1 = yield openConsole();
+}
 
-    yield waitForMessages({
-      webconsole: hud1,
-      messages: [{
-        name: "aTimer started",
-        consoleTime: "aTimer",
-      }, {
-        name: "aTimer end",
-        consoleTimeEnd: "aTimer",
-      }],
-    });
+function consoleOpened(hud) {
+  outputNode = hud.outputNode;
 
-    let deferred = promise.defer();
+  waitForSuccess({
+    name: "aTimer started",
+    validatorFn: function()
+    {
+      return outputNode.textContent.indexOf("aTimer: timer started") > -1;
+    },
+    successFn: function()
+    {
+      findLogEntry("ms");
+      // The next test makes sure that timers with the same name but in separate
+      // tabs, do not contain the same value.
+      addTab("data:text/html;charset=utf-8,<script type='text/javascript'>" +
+             "console.timeEnd('bTimer');</script>");
+      browser.addEventListener("load", function onLoad() {
+        browser.removeEventListener("load", onLoad, true);
+        openConsole(null, testTimerIndependenceInTabs);
+      }, true);
+    },
+    failureFn: finishTest,
+  });
+}
 
-    // The next test makes sure that timers with the same name but in separate
-    // tabs, do not contain the same value.
-    addTab("data:text/html;charset=utf-8,<script>" +
-           "console.timeEnd('bTimer');</script>");
-    browser.addEventListener("load", function onLoad() {
-      browser.removeEventListener("load", onLoad, true);
-      openConsole().then((hud) => {
-        deferred.resolve(hud);
-      });
-    }, true);
+function testTimerIndependenceInTabs(hud) {
+  outputNode = hud.outputNode;
 
-    let hud2 = yield deferred.promise;
-
-    testLogEntry(hud2.outputNode, "bTimer: timer started",
-                 "bTimer was not started", false, true);
+  executeSoon(function() {
+    testLogEntry(outputNode, "bTimer: timer started", "bTimer was not started",
+                 false, true);
 
     // The next test makes sure that timers with the same name but in separate
     // pages, do not contain the same value.
-    content.location = "data:text/html;charset=utf-8,<script>" +
-                       "console.time('bTimer');</script>";
-
-    yield waitForMessages({
-      webconsole: hud2,
-      messages: [{
-        name: "bTimer started",
-        consoleTime: "bTimer",
-      }],
-    });
-
-    hud2.jsterm.clearOutput();
-
-    deferred = promise.defer();
-
-    // Now the following console.timeEnd() call shouldn't display anything,
-    // if the timers in different pages are not related.
     browser.addEventListener("load", function onLoad() {
       browser.removeEventListener("load", onLoad, true);
-      deferred.resolve(null);
+      executeSoon(testTimerIndependenceInSameTab);
     }, true);
+    content.location = "data:text/html;charset=utf-8,<script type='text/javascript'>" +
+           "console.time('bTimer');</script>";
+  });
+}
 
-    content.location = "data:text/html;charset=utf-8," +
-                       "<script>console.timeEnd('bTimer');</script>";
+function testTimerIndependenceInSameTab() {
+  let hud = HUDService.getHudByWindow(content);
+  outputNode = hud.outputNode;
 
-    yield deferred.promise;
+  waitForSuccess({
+    name: "bTimer started",
+    validatorFn: function()
+    {
+      return outputNode.textContent.indexOf("bTimer: timer started") > -1;
+    },
+    successFn: function() {
+      hud.jsterm.clearOutput();
 
-    testLogEntry(hud2.outputNode, "bTimer: timer started",
-                 "bTimer was not started", false, true);
-
-    yield closeConsole(gBrowser.selectedTab);
+      // Now the following console.timeEnd() call shouldn't display anything,
+      // if the timers in different pages are not related.
+      browser.addEventListener("load", function onLoad() {
+        browser.removeEventListener("load", onLoad, true);
+        executeSoon(testTimerIndependenceInSameTabAgain);
+      }, true);
+      content.location = "data:text/html;charset=utf-8," +
+        "<script type='text/javascript'>" +
+        "console.timeEnd('bTimer');</script>";
+    },
+    failureFn: finishTest,
+  });
+}
 
-    gBrowser.removeCurrentTab();
+function testTimerIndependenceInSameTabAgain() {
+  let hud = HUDService.getHudByWindow(content);
+  outputNode = hud.outputNode;
 
-    executeSoon(finishTest);
-  }
+  executeSoon(function() {
+    testLogEntry(outputNode, "bTimer: timer started", "bTimer was not started",
+                 false, true);
+
+    closeConsole(gBrowser.selectedTab, function() {
+      gBrowser.removeCurrentTab();
+      executeSoon(finishTest);
+    });
+  });
 }
--- a/browser/devtools/webconsole/test/head.js
+++ b/browser/devtools/webconsole/test/head.js
@@ -167,34 +167,34 @@ function openConsole(aTab, aCallback = f
  * Close the Web Console for the given tab.
  *
  * @param nsIDOMElement [aTab]
  *        Optional tab element for which you want close the Web Console. The
  *        default tab is taken from the global variable |tab|.
  * @param function [aCallback]
  *        Optional function to invoke after the Web Console completes
  *        closing (web-console-destroyed).
- * @return object
- *         A promise that is resolved once the web console is closed.
  */
 function closeConsole(aTab, aCallback = function() { })
 {
   let target = TargetFactory.forTab(aTab || tab);
   let toolbox = gDevTools.getToolbox(target);
   if (toolbox) {
     let panel = toolbox.getPanel("webconsole");
     if (panel) {
       let hudId = panel.hud.hudId;
-      return toolbox.destroy().then(aCallback.bind(null, hudId)).then(null, console.debug);
+      toolbox.destroy().then(aCallback.bind(null, hudId)).then(null, console.debug);
     }
-    return toolbox.destroy().then(aCallback.bind(null));
+    else {
+      toolbox.destroy().then(aCallback.bind(null));
+    }
   }
-
-  aCallback();
-  return promise.resolve(null);
+  else {
+    aCallback();
+  }
 }
 
 /**
  * Wait for a context menu popup to open.
  *
  * @param nsIDOMElement aPopup
  *        The XUL popup you expect to open.
  * @param nsIDOMElement aButton
@@ -970,17 +970,17 @@ function waitForMessages(aOptions)
 
     return true;
   }
 
   function checkConsoleTimeEnd(aRule, aElement)
   {
     let elemText = aElement.textContent;
     let time = aRule.consoleTimeEnd;
-    let regex = new RegExp(time + ": -?\\d+([,.]\\d+)?ms");
+    let regex = new RegExp(time + ": -?\\d+ms");
 
     if (!checkText(regex, elemText)) {
       return false;
     }
 
     aRule.category = CATEGORY_WEBDEV;
     aRule.severity = SEVERITY_LOG;