Bug 818436 - [toolbox] We should not be able to dock a toolbox if the target is Remote or Win, r=paul
authorGirish Sharma <scrapmachines@gmail.com>
Sat, 15 Dec 2012 06:40:43 +0530
changeset 125532 a72eedce6602b984ad3fc9c02f0cd0ff29b7c124
parent 125531 cbaacd40709b64ea7e7254833f6853a372bed3d4
child 125533 e64c17c9baffc4cf723c5bc8e681983ba4778042
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaul
bugs818436
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 818436 - [toolbox] We should not be able to dock a toolbox if the target is Remote or Win, r=paul
browser/devtools/framework/Target.jsm
browser/devtools/framework/Toolbox.jsm
--- a/browser/devtools/framework/Target.jsm
+++ b/browser/devtools/framework/Target.jsm
@@ -196,16 +196,20 @@ TabTarget.prototype = {
   get url() {
     return this._tab.linkedBrowser.contentDocument.location.href;
   },
 
   get isRemote() {
     return false;
   },
 
+  get isLocalTab() {
+    return true;
+  },
+
   /**
    * Listen to the different tabs events.
    */
   _setupListeners: function TabTarget__setupListeners() {
     this._webProgressListener = new TabWebProgressListener(this);
     this.tab.linkedBrowser.addProgressListener(this._webProgressListener);
     this.tab.addEventListener("TabClose", this);
     this.tab.parentNode.addEventListener("TabSelect", this);
@@ -324,16 +328,20 @@ WindowTarget.prototype = {
   get url() {
     return this._window.document.location.href;
   },
 
   get isRemote() {
     return false;
   },
 
+  get isLocalTab() {
+    return false;
+  },
+
   /**
    * Target is not alive anymore.
    */
   destroy: function() {
     if (!this._destroyed) {
       this._destroyed = true;
 
       this.emit("close");
@@ -379,16 +387,18 @@ RemoteTarget.prototype = {
   get name() this._form._title,
 
   get url() this._form._url,
 
   get client() this._client,
 
   get form() this._form,
 
+  get isLocalTab() false,
+
   /**
    * Target is not alive anymore.
    */
   destroy: function RT_destroy() {
     // If several things call destroy then we give them all the same
     // destruction promise so we're sure to destroy only once
     if (this._destroyer) {
       return this._destroyer.promise;
--- a/browser/devtools/framework/Toolbox.jsm
+++ b/browser/devtools/framework/Toolbox.jsm
@@ -265,16 +265,20 @@ Toolbox.prototype = {
    */
   _buildDockButtons: function TBOX_createDockButtons() {
     let dockBox = this.doc.getElementById("toolbox-dock-buttons");
 
     while (dockBox.firstChild) {
       dockBox.removeChild(dockBox.firstChild);
     }
 
+    if (!this._target.isLocalTab) {
+      return;
+    }
+
     let sideEnabled = Services.prefs.getBoolPref(this._prefs.SIDE_ENABLED);
 
     for each (let position in this.HostType) {
       if (position == this.hostType ||
          (!sideEnabled && position == this.HostType.SIDE)) {
         continue;
       }
 
@@ -471,16 +475,20 @@ Toolbox.prototype = {
    * @param {string} hostType
    *        The host type of the new host object
    */
   switchHost: function TBOX_switchHost(hostType) {
     if (hostType == this._host.type) {
       return;
     }
 
+    if (!this._target.isLocalTab) {
+      return;
+    }
+
     let newHost = this._createHost(hostType);
     return newHost.open().then(function(iframe) {
       // change toolbox document's parent to the new host
       iframe.QueryInterface(Ci.nsIFrameLoaderOwner);
       iframe.swapFrameLoaders(this.frame);
 
       this._host.off("window-closed", this.destroy);
       this._host.destroy();