Bug 950565 - Fix for intermittent browser_webconsole_bug_782653_CSS_links_in_Style_Editor.js | Test timed out. a=test-only
authorMihai Sucan <mihai.sucan@gmail.com>
Thu, 16 Jan 2014 23:33:02 +0200
changeset 175869 e7e9d99a29650fdddf208d93edb37c5191f8b00a
parent 175868 47837dce0006d9d2313f0c561781fbab53d35dff
child 175870 009513120418c90adb9a1a423a08f083bc994988
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstest-only
bugs950565
milestone28.0a2
Bug 950565 - Fix for intermittent browser_webconsole_bug_782653_CSS_links_in_Style_Editor.js | Test timed out. a=test-only
browser/devtools/webconsole/test/browser_webconsole_bug_782653_CSS_links_in_Style_Editor.js
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_782653_CSS_links_in_Style_Editor.js
+++ b/browser/devtools/webconsole/test/browser_webconsole_bug_782653_CSS_links_in_Style_Editor.js
@@ -102,54 +102,41 @@ function onStyleEditorReady(aPanel)
       });
     });
   }, win);
 }
 
 function checkStyleEditorForSheetAndLine(aHref, aLine, aCallback)
 {
   let foundEditor = null;
-  waitForSuccess({
-    name: "style editor for stylesheet",
-    validatorFn: function()
-    {
-      for (let editor of StyleEditorUI.editors) {
-        if (editor.styleSheet.href == aHref) {
-          foundEditor = editor;
-          return true;
-        }
-      }
-      return false;
-    },
-    successFn: function()
-    {
-      performLineCheck(foundEditor, aLine, aCallback);
-    },
-    failureFn: finishTest,
-  });
+  for (let editor of StyleEditorUI.editors) {
+    if (editor.styleSheet.href == aHref) {
+      foundEditor = editor;
+      break;
+    }
+  }
+
+  ok(foundEditor, "found style editor for " + aHref);
+  performLineCheck(foundEditor, aLine, aCallback);
 }
 
 function performLineCheck(aEditor, aLine, aCallback)
 {
   function checkForCorrectState()
   {
     is(aEditor.sourceEditor.getCursor().line, aLine,
        "correct line is selected");
     is(StyleEditorUI.selectedStyleSheetIndex, aEditor.styleSheet.styleSheetIndex,
        "correct stylesheet is selected in the editor");
 
     aCallback && executeSoon(aCallback);
   }
 
-  waitForSuccess({
-    name: "source editor load",
-    validatorFn: function()
-    {
-      return aEditor.sourceEditor;
-    },
-    successFn: checkForCorrectState,
-    failureFn: function() {
-      info("selectedStyleSheetIndex " + StyleEditorUI.selectedStyleSheetIndex
-           + " expected " + aEditor.styleSheet.styleSheetIndex);
-      finishTest();
-    },
+  info("wait for source editor to load");
+
+  // Get out of the styleeditor-selected event loop.
+  executeSoon(() => {
+    aEditor.getSourceEditor().then(() => {
+      // Get out of the editor's source-editor-load event loop.
+      executeSoon(checkForCorrectState);
+    });
   });
 }