Bug 1501393 - Remove the await call to block on markuploaded. r=yzen
☠☠ backed out by f93013d0b826 ☠ ☠
authorGabriel Luong <gabriel.luong@gmail.com>
Thu, 25 Oct 2018 11:14:53 -0400
changeset 491297 f650d97859402d9d0787907e514da3592f0960ca
parent 491296 4896323e685bbf01aae997920d3176b845fd7b6f
child 491298 f93013d0b826fb2377fd5fa4f5b9abec8e03fb1e
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
@@ -287,20 +287,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 +1479,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 +1950,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);