Bug 1068400 - prevent reopening toolbox during rdm tab dance r=jryans draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Thu, 27 Oct 2016 04:32:47 -0700
changeset 430294 ce7318270533d69d7c54fcc98f6be9888f3b6d81
parent 430291 dc0779cba39491a7d7e7c428cef6370ed52d67cf
child 430295 e49e27635daecb8bd08ee3850896bd4e60f5b4df
push id33795
push userbmo:poirot.alex@gmail.com
push dateThu, 27 Oct 2016 13:32:14 +0000
reviewersjryans
bugs1068400
milestone52.0a1
Bug 1068400 - prevent reopening toolbox during rdm tab dance r=jryans MozReview-Commit-ID: 9lmMNTcPS1A
devtools/client/framework/target.js
devtools/client/framework/test/browser.ini
devtools/client/responsive.html/browser/swap.js
--- a/devtools/client/framework/target.js
+++ b/devtools/client/framework/target.js
@@ -557,16 +557,23 @@ TabTarget.prototype = {
         break;
     }
   },
 
   // Automatically respawn the toolbox when the tab changes between being
   // loaded within the parent process and loaded from a content process.
   // Process change can go in both ways.
   onRemotenessChange: function () {
+    // Responsive design do a crazy dance around tabs and triggers
+    // remotenesschange events. But we should ignore them as at the end
+    // the content doesn't change its remoteness.
+    if (this._tab.hasAttribute("data-responsive-mode")) {
+      return;
+    }
+
     // Save a reference to the tab as it will be nullified on destroy
     let tab = this._tab;
     let onToolboxDestroyed = (event, target) => {
       if (target != this) {
         return;
       }
       gDevTools.off("toolbox-destroyed", target);
 
--- a/devtools/client/framework/test/browser.ini
+++ b/devtools/client/framework/test/browser.ini
@@ -57,16 +57,17 @@ skip-if = true # Bug 1177463 - Temporari
 [browser_toolbox_options_disable_cache-01.js]
 [browser_toolbox_options_disable_cache-02.js]
 [browser_toolbox_options_disable_js.js]
 [browser_toolbox_options_enable_serviceworkers_testing.js]
 # [browser_toolbox_raise.js] # Bug 962258
 # skip-if = os == "win"
 [browser_toolbox_ready.js]
 [browser_toolbox_remoteness_change.js]
+run-if = e10s
 [browser_toolbox_select_event.js]
 skip-if = e10s # Bug 1069044 - destroyInspector may hang during shutdown
 [browser_toolbox_selected_tool_unavailable.js]
 [browser_toolbox_sidebar.js]
 [browser_toolbox_sidebar_events.js]
 [browser_toolbox_sidebar_existing_tabs.js]
 [browser_toolbox_sidebar_overflow_menu.js]
 [browser_toolbox_split_console.js]
--- a/devtools/client/responsive.html/browser/swap.js
+++ b/devtools/client/responsive.html/browser/swap.js
@@ -47,16 +47,18 @@ function swapToInnerBrowser({ tab, conta
       bubbles: true,
     });
     from.dispatchEvent(event);
   };
 
   return {
 
     start: Task.async(function* () {
+      tab.setAttribute("data-responsive-mode", "true");
+
       // Freeze navigation temporarily to avoid "blinking" in the location bar.
       freezeNavigationState(tab);
 
       // 1. Create a temporary, hidden tab to load the tool UI.
       let containerTab = gBrowser.addTab(containerURL, {
         skipAnimation: true,
       });
       gBrowser.hideTab(containerTab);
@@ -145,16 +147,18 @@ function swapToInnerBrowser({ tab, conta
       dispatchDevToolsBrowserSwap(contentBrowser, tab.linkedBrowser);
       gBrowser.swapBrowsersAndCloseOther(tab, contentTab);
       gBrowser = null;
 
       // The focus manager seems to get a little dizzy after all this swapping.  If a
       // content element had been focused inside the viewport before stopping, it will
       // have lost focus.  Activate the frame to restore expected focus.
       tab.linkedBrowser.frameLoader.activateRemoteFrame();
+
+      tab.removeAttribute("data-responsive-mode");
     },
 
   };
 }
 
 /**
  * Browser navigation properties we'll freeze temporarily to avoid "blinking" in the
  * location bar, etc. caused by the containerURL peeking through before the swap is