Bug 1501393 - Remove the await call to block on markuploaded. r=yzen
☠☠ backed out by 25132db0240f ☠ ☠
authorGabriel Luong <gabriel.luong@gmail.com>
Thu, 25 Oct 2018 11:14:53 -0400
changeset 491323 84d5f2504bcafc4bd142ad168616acbd6e55018b
parent 491322 6d897bc50f753ff04a58d8fae3e7996b72a5e81d
child 491324 9e5694d74ffb6dba5066173561310fb0ca7f258e
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersyzen
bugs1501393
milestone65.0a1
Bug 1501393 - Remove the await call to block on markuploaded. r=yzen
devtools/client/accessibility/test/browser/browser_accessibility_context_menu_inspector.js
devtools/client/inspector/inspector.js
--- a/devtools/client/accessibility/test/browser/browser_accessibility_context_menu_inspector.js
+++ b/devtools/client/accessibility/test/browser/browser_accessibility_context_menu_inspector.js
@@ -9,16 +9,17 @@ const TEST_URI = `
   <span id="span-1">text</span>
   <span id="span-2">
     IamaverylongtextwhichdoesntfitinInlineTextChildReallyIdontIamtoobig
   </span>`;
 
 async function openContextMenuForNode({ toolbox }, selector) {
   info("Selecting Inspector tab and opening a context menu");
   const inspector = await toolbox.selectTool("inspector");
+  await inspector._isMarkupLoaded;
 
   if (!selector) {
     ok(inspector.selection.isBodyNode(), "Default selection is a body node.");
   } else if (typeof selector === "string") {
     await selectNode(selector, inspector, "test");
   } else {
     const updated = inspector.once("inspector-updated");
     inspector.selection.setNodeFront(selector, { reason: "test" });
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* global window, BrowserLoader */
 
 "use strict";
 
 const Services = require("Services");
 const promise = require("promise");
-const flags = require("devtools/shared/flags");
 const EventEmitter = require("devtools/shared/event-emitter");
 const {executeSoon} = require("devtools/shared/DevToolsUtils");
 const {Toolbox} = require("devtools/client/framework/toolbox");
 const ReflowTracker = require("devtools/client/inspector/shared/reflow-tracker");
 const Store = require("devtools/client/inspector/store");
 const InspectorStyleChangeTracker = require("devtools/client/inspector/shared/style-change-tracker");
 
 // Use privileged promise in panel documents to prevent having them to freeze
@@ -287,20 +286,16 @@ Inspector.prototype = {
     // We can display right panel with: tab bar, markup view and breadbrumb. Right after
     // the splitter set the right and left panel sizes, in order to avoid resizing it
     // during load of the inspector.
     this.panelDoc.getElementById("inspector-main-content").style.visibility = "visible";
 
     // Setup the sidebar panels.
     this.setupSidebar();
 
-    if (flags.testing) {
-      await this.once("markuploaded");
-    }
-
     this.isReady = true;
 
     // All the components are initialized. Take care of the remaining initialization
     // and setup.
     this.breadcrumbs = new HTMLBreadcrumbs(this);
     this.setupExtensionSidebars();
     this.setupSearchBox();
     await this.setupToolbar();
@@ -1483,16 +1478,17 @@ Inspector.prototype = {
     this.styleChangeTracker.destroy();
 
     if (this.changesManager) {
       this.changesManager.destroy();
     }
 
     this._is3PaneModeChromeEnabled = null;
     this._is3PaneModeEnabled = null;
+    this._isMarkupLoaded = null;
     this._markupBox = null;
     this._markupFrame = null;
     this._notificationBox = null;
     this._target = null;
     this._toolbox = null;
     this.breadcrumbs = null;
     this.panelDoc = null;
     this.panelWin.inspector = null;
@@ -1953,16 +1949,19 @@ Inspector.prototype = {
       linkFollow.label = INSPECTOR_L10N.getFormatStr(
         "inspector.menu.selectElement.label", popupNode.dataset.link);
     }
 
     return [linkFollow, linkCopy];
   },
 
   _initMarkup: function() {
+    // This is used in accessibility tests to ensure the markup is loaded.
+    this._isMarkupLoaded = this.once("markuploaded");
+
     if (!this._markupFrame) {
       this._markupFrame = this.panelDoc.createElement("iframe");
       this._markupFrame.setAttribute("aria-label",
         INSPECTOR_L10N.getStr("inspector.panelLabel.markupView"));
       this._markupFrame.setAttribute("flex", "1");
       // This is needed to enable tooltips inside the iframe document.
       this._markupFrame.setAttribute("tooltip", "aHTMLTooltip");
       this._markupFrame.addEventListener("contextmenu", this._onContextMenu);