Skip to content

Commit

Permalink
#438 Also Support Nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
fflorent committed Nov 16, 2015
1 parent f523996 commit 7d57355
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions lib/inspector/inspector-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const { Locale } = require("firebug.sdk/lib/core/locale.js");
const { devtools, safeRequire } = require("firebug.sdk/lib/core/devtools.js");

// https://bugzilla.mozilla.org/show_bug.cgi?id=912121
const { SelectorSearch } = safeRequire(devtools,
const { SelectorSearch, InspectorSearch } = safeRequire(devtools,
"devtools/client/inspector/inspector-search",
"devtools/client/inspector/selector-search",
"devtools/inspector/selector-search");

Expand Down Expand Up @@ -160,8 +161,13 @@ const InspectorOverlay = Class(

overlay.searchBox.setValue(searchInput.value);

this.panel.setupSearchBox = this.setupSearchBox.bind(
this.panel, overlay.searchBox);
if (SelectorSearch) {
this.panel.setupSearchBox = this.setupSelectorSearchBox.bind(
this.panel, overlay.searchBox);
} else if (InspectorSearch) {
this.panel.setupSearchBox = this.setupInspectorSearchBox.bind(
this.panel, overlay.searchBox);
}
} else {
this.panel.setupSearchBox = this.originalsetupSearchBox;
}
Expand All @@ -175,10 +181,12 @@ const InspectorOverlay = Class(
},

/**
* xxxHonza: monkey patch for the {@InspectorPanel} that connects
* Monkey patch for the {@InspectorPanel} that connects
* the panel to the shared search box UI.
*
* For Firefox < 45
*/
setupSearchBox: function(searchBox) {
setupSelectorSearchBox: function(searchBox) {
// Initiate the selectors search object.
if (this.searchSuggestions) {
this.searchSuggestions.destroy();
Expand All @@ -192,7 +200,27 @@ const InspectorOverlay = Class(
}

this.searchSuggestions = new SelectorSearch(this, this.searchBox);
}
},

/**
* Monkey patch for the {@InspectorPanel} that connects
* the panel to the shared search box UI.
*
* For Firefox >= 45
*/
setupInspectorSearchBox: function(searchBox) {
this.searchBox = searchBox.getInputBox();

// xxxFlorent: This is used to displayed the result index over the number
// of results (like "1 of 15"). We probably want to take advantage of this
// feature.
this.searchResultsLabel =
this.panelDoc.getElementById("inspector-searchlabel");

this.search = new InspectorSearch(this, this.searchBox);
this.search.on("search-cleared", this._updateSearchResultsLabel);
this.search.on("search-result", this._updateSearchResultsLabel);
},
});

// Exports from this module
Expand Down

0 comments on commit 7d57355

Please sign in to comment.