Bug 866381 - allow inspector to be used on chrome windows, r=dcamp
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 29 Apr 2013 19:32:12 +0200
changeset 130231 e7a1bfbd1335a35b8f30a1e16288c7d94159eb98
parent 130180 7dbc698ed9b63c56e389521fed5031a43a0746da
child 130232 2e489dff994535a79ad1ce046c33688334f2bd07
push id24607
push userttaubert@mozilla.com
push dateTue, 30 Apr 2013 08:38:21 +0000
treeherdermozilla-central@6a3e2fb5b0f2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdcamp
bugs866381
milestone23.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 866381 - allow inspector to be used on chrome windows, r=dcamp
browser/devtools/inspector/inspector-panel.js
--- a/browser/devtools/inspector/inspector-panel.js
+++ b/browser/devtools/inspector/inspector-panel.js
@@ -179,28 +179,34 @@ InspectorPanel.prototype = {
   markDirty: function InspectorPanel_markDirty() {
     this.isDirty = true;
   },
 
   /**
    * Hooks the searchbar to show result and auto completion suggestions.
    */
   setupSearchBox: function InspectorPanel_setupSearchBox() {
+    let searchDoc;
+    if (this.target.isLocalTab) {
+      searchDoc = this.browser.contentDocument;
+    } else if (this.target.window) {
+      searchDoc = this.target.window.document;
+    } else {
+      return;
+    }
     // Initiate the selectors search object.
     let setNodeFunction = function(node) {
       this.selection.setNode(node, "selectorsearch");
     }.bind(this);
     if (this.searchSuggestions) {
       this.searchSuggestions.destroy();
       this.searchSuggestions = null;
     }
     this.searchBox = this.panelDoc.getElementById("inspector-searchbox");
-    this.searchSuggestions = new SelectorSearch(this.browser.contentDocument,
-                                                this.searchBox,
-                                                setNodeFunction);
+    this.searchSuggestions = new SelectorSearch(searchDoc, this.searchBox, setNodeFunction);
   },
 
   /**
    * Build the sidebar.
    */
   setupSidebar: function InspectorPanel_setupSidebar() {
     let tabbox = this.panelDoc.querySelector("#inspector-sidebar");
     this.sidebar = new ToolSidebar(tabbox, this);