Bug 1496572 - Fix intermittent devtools/client/inspector/test/browser_inspector_highlighter-eyedropper-xul.js by adding a new emitted event for the inspector toolbar update. r=pbro
authorGabriel Luong <gabriel.luong@gmail.com>
Sat, 13 Oct 2018 06:53:00 +0300
changeset 489493 4afcdb551984b452e41847bc2a2690f46bdbbefe
parent 489492 ec067b17f7d32f9080ed97d8a51414d0a37acf8a
child 489494 6213dd2a20f2c544722ff18d62863cbf6e031b8e
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewerspbro
bugs1496572
milestone64.0a1
Bug 1496572 - Fix intermittent devtools/client/inspector/test/browser_inspector_highlighter-eyedropper-xul.js by adding a new emitted event for the inspector toolbar update. r=pbro
devtools/client/inspector/inspector.js
devtools/client/inspector/test/browser_inspector_highlighter-eyedropper-xul.js
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -1124,16 +1124,18 @@ Inspector.prototype = {
       this.eyeDropperButton.title = INSPECTOR_L10N.getStr("inspector.eyedropper.label");
       this.eyeDropperButton.addEventListener("click", this.onEyeDropperButtonClicked);
     } else {
       const eyeDropperButton =
         this.panelDoc.getElementById("inspector-eyedropper-toggle");
       eyeDropperButton.disabled = true;
       eyeDropperButton.title = INSPECTOR_L10N.getStr("eyedropper.disabled.title");
     }
+
+    this.emit("inspector-toolbar-updated");
   },
 
   teardownToolbar: function() {
     if (this.addNodeButton) {
       this.addNodeButton.removeEventListener("click", this.addNode);
       this.addNodeButton = null;
     }
 
--- a/devtools/client/inspector/test/browser_inspector_highlighter-eyedropper-xul.js
+++ b/devtools/client/inspector/test/browser_inspector_highlighter-eyedropper-xul.js
@@ -30,17 +30,19 @@ add_task(async function() {
   let onColorPickerReady = cPicker.once("ready");
   swatchEl.click();
   await onColorPickerReady;
 
   button = cPicker.tooltip.container.querySelector("#eyedropper-button");
   ok(isDisabled(button), "The button is disabled in the color picker");
 
   info("Navigate to a HTML document");
+  const toolbarUpdated = inspector.once("inspector-toolbar-updated");
   await navigateTo(inspector, TEST_URL_2);
+  await toolbarUpdated;
 
   info("Check the inspector toolbar in HTML document");
   button = inspector.panelDoc.querySelector("#inspector-eyedropper-toggle");
   ok(!isDisabled(button), "The button is enabled in the toolbar");
 
   info("Check the color picker in HTML document");
   // Find the color swatch in the rule-view.
   await selectNode("h1", inspector);