зеркало из https://github.com/mozilla/gecko-dev.git
Bug 796135 - Provide some obvious UI for scripts filtering, r=past
This commit is contained in:
Родитель
6b34181b5c
Коммит
6e1dc8418f
|
@ -1455,8 +1455,12 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
|||
* Called when all the sources have been fetched.
|
||||
*/
|
||||
_onFetchSourcesFinished: function DVGS__onFetchSourcesFinished() {
|
||||
if (!this._sourcesCount) {
|
||||
return;
|
||||
}
|
||||
// All sources are fetched and stored in the cache, we can start searching.
|
||||
this._performGlobalSearch();
|
||||
this._sourcesCount = 0;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -713,7 +713,7 @@ FilterView.prototype = {
|
|||
*/
|
||||
clearSearch: function DVF_clearSearch() {
|
||||
this._searchbox.value = "";
|
||||
this._onSearch();
|
||||
this._searchboxPanel.hidePopup();
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -767,6 +767,9 @@ FilterView.prototype = {
|
|||
view.setUnavailable();
|
||||
}
|
||||
}
|
||||
// Synchronize with the view's filtered sources container.
|
||||
DebuggerView.FilteredSources.syncFileSearch();
|
||||
|
||||
this._prevSearchedFile = aFile;
|
||||
},
|
||||
|
||||
|
@ -830,6 +833,7 @@ FilterView.prototype = {
|
|||
// or hide the corresponding pane otherwise.
|
||||
if (isGlobal) {
|
||||
DebuggerView.GlobalSearch.scheduleSearch(token);
|
||||
this._prevSearchedToken = token;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -837,6 +841,7 @@ FilterView.prototype = {
|
|||
// variables view instance.
|
||||
if (isVariable) {
|
||||
DebuggerView.Variables.scheduleSearch(token);
|
||||
this._prevSearchedToken = token;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -854,8 +859,15 @@ FilterView.prototype = {
|
|||
e.char = String.fromCharCode(e.charCode);
|
||||
|
||||
let [file, line, token, isGlobal, isVariable] = this.searchboxInfo;
|
||||
let isDifferentToken, isReturnKey, action = -1;
|
||||
let isFileSearch, isLineSearch, isDifferentToken, isReturnKey;
|
||||
let action = -1;
|
||||
|
||||
if (file && !line && !token) {
|
||||
isFileSearch = true;
|
||||
}
|
||||
if (line && !token) {
|
||||
isLineSearch = true;
|
||||
}
|
||||
if (this._prevSearchedToken != token) {
|
||||
isDifferentToken = true;
|
||||
}
|
||||
|
@ -890,13 +902,27 @@ FilterView.prototype = {
|
|||
DebuggerView.editor.focus();
|
||||
return;
|
||||
}
|
||||
if (action == -1 || (token.length == 0 && line == 0)) {
|
||||
if (action == -1 || (!file && !line && !token)) {
|
||||
DebuggerView.FilteredSources.hidden = true;
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// Select the next or previous file search entry.
|
||||
if (isFileSearch) {
|
||||
if (isReturnKey) {
|
||||
DebuggerView.FilteredSources.hidden = true;
|
||||
DebuggerView.editor.focus();
|
||||
this.clearSearch();
|
||||
} else {
|
||||
DebuggerView.FilteredSources[["focusNext", "focusPrev"][action]]();
|
||||
}
|
||||
this._prevSearchedFile = file;
|
||||
return;
|
||||
}
|
||||
|
||||
// Perform a global search based on the specified operator.
|
||||
if (isGlobal) {
|
||||
if (isReturnKey && (isDifferentToken || DebuggerView.GlobalSearch.hidden)) {
|
||||
|
@ -912,6 +938,7 @@ FilterView.prototype = {
|
|||
if (isVariable) {
|
||||
if (isReturnKey && isDifferentToken) {
|
||||
DebuggerView.Variables.performSearch(token);
|
||||
} else {
|
||||
DebuggerView.Variables.expandFirstSearchResults();
|
||||
}
|
||||
this._prevSearchedToken = token;
|
||||
|
@ -919,7 +946,7 @@ FilterView.prototype = {
|
|||
}
|
||||
|
||||
// Increment or decrement the specified line.
|
||||
if (!isReturnKey && token.length == 0 && line > 0) {
|
||||
if (isLineSearch && !isReturnKey) {
|
||||
line += action == 0 ? 1 : -1;
|
||||
let lineCount = DebuggerView.editor.getLineCount();
|
||||
let lineTarget = line < 1 ? 1 : line > lineCount ? lineCount : line;
|
||||
|
@ -1019,6 +1046,168 @@ FilterView.prototype = {
|
|||
_prevSearchedToken: ""
|
||||
};
|
||||
|
||||
/**
|
||||
* Functions handling the filtered sources UI.
|
||||
*/
|
||||
function FilteredSourcesView() {
|
||||
MenuContainer.call(this);
|
||||
this._onClick = this._onClick.bind(this);
|
||||
}
|
||||
|
||||
create({ constructor: FilteredSourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
initialize: function DVFS_initialize() {
|
||||
dumpn("Initializing the FilteredSourcesView");
|
||||
|
||||
let panel = this._panel = document.createElement("panel");
|
||||
panel.id = "filtered-sources-panel";
|
||||
panel.setAttribute("noautofocus", "true");
|
||||
panel.setAttribute("position", FILTERED_SOURCES_POPUP_POSITION);
|
||||
document.documentElement.appendChild(panel);
|
||||
|
||||
this._searchbox = document.getElementById("searchbox");
|
||||
this._container = new StackList(panel);
|
||||
|
||||
this._container.itemFactory = this._createItemView;
|
||||
this._container.itemType = "vbox";
|
||||
this._container.addEventListener("click", this._onClick, false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Destruction function, called when the debugger is closed.
|
||||
*/
|
||||
destroy: function DVFS_destroy() {
|
||||
dumpn("Destroying the FilteredSourcesView");
|
||||
document.documentElement.removeChild(this._panel);
|
||||
this._container.removeEventListener("click", this._onClick, false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the files container hidden or visible. It's hidden by default.
|
||||
* @param boolean aFlag
|
||||
*/
|
||||
set hidden(aFlag) {
|
||||
if (aFlag) {
|
||||
this._container._parent.hidePopup();
|
||||
} else {
|
||||
this._container._parent.openPopup(this._searchbox);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the list of sources displayed in this container.
|
||||
*/
|
||||
syncFileSearch: function DVFS_syncFileSearch() {
|
||||
this.empty();
|
||||
|
||||
// If there's no currently searched file, or there are no matches found,
|
||||
// hide the popup.
|
||||
if (!DebuggerView.Filtering.searchedFile ||
|
||||
!DebuggerView.Sources.visibleItems.length) {
|
||||
this.hidden = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the currently visible items in the sources container.
|
||||
let visibleItems = DebuggerView.Sources.visibleItems;
|
||||
let displayedItems = visibleItems.slice(0, FILTERED_SOURCES_MAX_RESULTS);
|
||||
|
||||
for (let item of displayedItems) {
|
||||
// Append a location item item to this container.
|
||||
let trimmedLabel = SourceUtils.trimUrlLength(item.label);
|
||||
let trimmedValue = SourceUtils.trimUrlLength(item.value);
|
||||
|
||||
let locationItem = this.push(trimmedLabel, trimmedValue, {
|
||||
forced: true,
|
||||
relaxed: true,
|
||||
unsorted: true,
|
||||
attachment: {
|
||||
fullLabel: item.label,
|
||||
fullValue: item.value
|
||||
}
|
||||
});
|
||||
|
||||
let element = locationItem.target;
|
||||
element.className = "dbg-source-item list-item";
|
||||
element.labelNode.className = "dbg-source-item-name plain";
|
||||
element.valueNode.className = "dbg-source-item-details plain";
|
||||
}
|
||||
|
||||
this._updateSelection(this.getItemAtIndex(0));
|
||||
this.hidden = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Focuses the next found match in this container.
|
||||
*/
|
||||
focusNext: function DVFS_focusNext() {
|
||||
let nextIndex = this.selectedIndex + 1;
|
||||
if (nextIndex >= this.totalItems) {
|
||||
nextIndex = 0;
|
||||
}
|
||||
this._updateSelection(this.getItemAtIndex(nextIndex));
|
||||
},
|
||||
|
||||
/**
|
||||
* Focuses the previously found match in this container.
|
||||
*/
|
||||
focusPrev: function DVFS_focusPrev() {
|
||||
let prevIndex = this.selectedIndex - 1;
|
||||
if (prevIndex < 0) {
|
||||
prevIndex = this.totalItems - 1;
|
||||
}
|
||||
this._updateSelection(this.getItemAtIndex(prevIndex));
|
||||
},
|
||||
|
||||
/**
|
||||
* The click listener for this container.
|
||||
*/
|
||||
_onClick: function DVFS__onClick(e) {
|
||||
let locationItem = this.getItemForElement(e.target);
|
||||
if (locationItem) {
|
||||
this._updateSelection(locationItem);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the selected item in this container and other views.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* The item associated with the element to select.
|
||||
*/
|
||||
_updateSelection: function DVFS__updateSelection(aItem) {
|
||||
this.selectedItem = aItem;
|
||||
DebuggerView.Filtering._target.selectedValue = aItem.attachment.fullValue;
|
||||
},
|
||||
|
||||
/**
|
||||
* Customization function for creating an item's UI.
|
||||
*
|
||||
* @param string aLabel
|
||||
* The item's label.
|
||||
* @param string aValue
|
||||
* The item's value.
|
||||
*/
|
||||
_createItemView: function DVFS__createItemView(aElementNode, aLabel, aValue) {
|
||||
let labelNode = document.createElement("label");
|
||||
let valueNode = document.createElement("label");
|
||||
|
||||
labelNode.setAttribute("value", aLabel);
|
||||
valueNode.setAttribute("value", aValue);
|
||||
|
||||
aElementNode.appendChild(labelNode);
|
||||
aElementNode.appendChild(valueNode);
|
||||
|
||||
aElementNode.labelNode = labelNode;
|
||||
aElementNode.valueNode = valueNode;
|
||||
},
|
||||
|
||||
_panel: null,
|
||||
_searchbox: null
|
||||
});
|
||||
|
||||
/**
|
||||
* Preliminary setup for the DebuggerView object.
|
||||
*/
|
||||
|
@ -1027,3 +1216,4 @@ DebuggerView.Options = new OptionsView();
|
|||
DebuggerView.ChromeGlobals = new ChromeGlobalsView();
|
||||
DebuggerView.Sources = new SourcesView();
|
||||
DebuggerView.Filtering = new FilterView();
|
||||
DebuggerView.FilteredSources = new FilteredSourcesView();
|
||||
|
|
|
@ -11,8 +11,10 @@ const PANES_APPEARANCE_DELAY = 50; // ms
|
|||
const BREAKPOINT_LINE_TOOLTIP_MAX_LENGTH = 1000; // chars
|
||||
const BREAKPOINT_CONDITIONAL_POPUP_POSITION = "after_start";
|
||||
const BREAKPOINT_CONDITIONAL_POPUP_OFFSET = 50; // px
|
||||
const GLOBAL_SEARCH_LINE_MAX_LENGTH = 300; // chars
|
||||
const FILTERED_SOURCES_POPUP_POSITION = "before_start";
|
||||
const FILTERED_SOURCES_MAX_RESULTS = 10;
|
||||
const GLOBAL_SEARCH_EXPAND_MAX_RESULTS = 50;
|
||||
const GLOBAL_SEARCH_LINE_MAX_LENGTH = 300; // chars
|
||||
const GLOBAL_SEARCH_ACTION_MAX_DELAY = 1500; // ms
|
||||
const SEARCH_GLOBAL_FLAG = "!";
|
||||
const SEARCH_TOKEN_FLAG = "#";
|
||||
|
@ -40,6 +42,7 @@ let DebuggerView = {
|
|||
this.ChromeGlobals.initialize();
|
||||
this.Sources.initialize();
|
||||
this.Filtering.initialize();
|
||||
this.FilteredSources.initialize();
|
||||
this.StackFrames.initialize();
|
||||
this.Breakpoints.initialize();
|
||||
this.WatchExpressions.initialize();
|
||||
|
@ -70,6 +73,7 @@ let DebuggerView = {
|
|||
this.ChromeGlobals.destroy();
|
||||
this.Sources.destroy();
|
||||
this.Filtering.destroy();
|
||||
this.FilteredSources.destroy();
|
||||
this.StackFrames.destroy();
|
||||
this.Breakpoints.destroy();
|
||||
this.WatchExpressions.destroy();
|
||||
|
@ -470,6 +474,7 @@ let DebuggerView = {
|
|||
|
||||
if (this.editor) {
|
||||
this.editor.setText("");
|
||||
this.editor.focus();
|
||||
this._editorSource = null;
|
||||
}
|
||||
},
|
||||
|
@ -936,7 +941,7 @@ MenuContainer.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Gets the total items in this container.
|
||||
* Gets the total number of items in this container.
|
||||
* @return number
|
||||
*/
|
||||
get totalItems() {
|
||||
|
@ -944,15 +949,17 @@ MenuContainer.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Gets the total visible (non-hidden) items in this container.
|
||||
* @return number
|
||||
* Returns a list of all the visible (non-hidden) items in this container.
|
||||
* @return array
|
||||
*/
|
||||
get visibleItems() {
|
||||
let count = 0;
|
||||
for (let [element] of this._itemsByElement) {
|
||||
count += element.hidden ? 0 : 1;
|
||||
let items = [];
|
||||
for (let [element, item] of this._itemsByElement) {
|
||||
if (!element.hidden) {
|
||||
items.push(item);
|
||||
}
|
||||
}
|
||||
return count;
|
||||
return items;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1134,8 +1141,6 @@ MenuContainer.prototype = {
|
|||
* set itemType(aType:string)
|
||||
* set itemFactory(aCallback:function)
|
||||
*
|
||||
* TODO: Use this in #796135 - "Provide some obvious UI for scripts filtering".
|
||||
*
|
||||
* @param nsIDOMNode aAssociatedNode
|
||||
* The element associated with the displayed container.
|
||||
*/
|
||||
|
|
|
@ -219,9 +219,11 @@
|
|||
tabindex="0"/>
|
||||
</hbox>
|
||||
<menulist id="chrome-globals"
|
||||
class="devtools-menulist" hidden="true"/>
|
||||
class="devtools-menulist"
|
||||
sizetopopup="none" hidden="true"/>
|
||||
<menulist id="sources"
|
||||
class="devtools-menulist"/>
|
||||
class="devtools-menulist"
|
||||
sizetopopup="none"/>
|
||||
<textbox id="searchbox"
|
||||
class="devtools-searchinput" type="search"/>
|
||||
<spacer flex="1"/>
|
||||
|
|
|
@ -66,6 +66,7 @@ MOCHITEST_BROWSER_TESTS = \
|
|||
browser_dbg_scripts-searching-06.js \
|
||||
browser_dbg_scripts-searching-07.js \
|
||||
browser_dbg_scripts-searching-08.js \
|
||||
browser_dbg_scripts-searching-files_ui.js \
|
||||
browser_dbg_scripts-searching-popup.js \
|
||||
browser_dbg_pause-resume.js \
|
||||
browser_dbg_update-editor-mode.js \
|
||||
|
|
|
@ -143,9 +143,9 @@ function test()
|
|||
is(gBreakpointsPane._popupShown, false,
|
||||
"The breakpoint conditional expression popup should not be shown.");
|
||||
|
||||
is(gDebugger.DebuggerView.StackFrames.visibleItems, 0,
|
||||
is(gDebugger.DebuggerView.StackFrames.visibleItems.length, 0,
|
||||
"There should be no visible stackframes.");
|
||||
is(gDebugger.DebuggerView.Breakpoints.visibleItems, 13,
|
||||
is(gDebugger.DebuggerView.Breakpoints.visibleItems.length, 13,
|
||||
"There should be thirteen visible breakpoints.");
|
||||
|
||||
testReload();
|
||||
|
@ -341,7 +341,7 @@ function test()
|
|||
window.clearInterval(intervalID);
|
||||
return closeDebuggerAndFinish();
|
||||
}
|
||||
if (gBreakpointsPane.visibleItems != total) {
|
||||
if (gBreakpointsPane.visibleItems.length != total) {
|
||||
return;
|
||||
}
|
||||
// We got all the breakpoints, it's safe to callback.
|
||||
|
|
|
@ -25,7 +25,6 @@ function test()
|
|||
gDebuggee = aDebuggee;
|
||||
gPane = aPane;
|
||||
gDebugger = gPane.panelWin;
|
||||
gDebugger.SourceResults.prototype.alwaysExpand = false;
|
||||
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
|
||||
framesAdded = true;
|
||||
|
@ -283,7 +282,7 @@ function testScriptSearching() {
|
|||
ok(gEditor.getCaretPosition().line == 19 &&
|
||||
gEditor.getCaretPosition().col == 4 + token.length,
|
||||
"The editor didn't remain at the correct token. (19)");
|
||||
is(gScripts.visibleItems, 1,
|
||||
is(gScripts.visibleItems.length, 1,
|
||||
"Not all the scripts are shown after the search. (20)");
|
||||
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||
"The menulist should not display a notice that matches are found.");
|
||||
|
|
|
@ -27,7 +27,6 @@ function test()
|
|||
gDebuggee = aDebuggee;
|
||||
gPane = aPane;
|
||||
gDebugger = gPane.panelWin;
|
||||
gDebugger.SourceResults.prototype.alwaysExpand = false;
|
||||
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
|
||||
framesAdded = true;
|
||||
|
@ -79,7 +78,7 @@ function firstSearch() {
|
|||
ok(gEditor.getCaretPosition().line == 4 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor didn't jump to the correct line. (1)");
|
||||
is(gScripts.visibleItems, 1,
|
||||
is(gScripts.visibleItems.length, 1,
|
||||
"Not all the correct scripts are shown after the search. (1)");
|
||||
|
||||
secondSearch();
|
||||
|
@ -107,7 +106,7 @@ function secondSearch() {
|
|||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 8 + token.length,
|
||||
"The editor didn't jump to the correct line. (2)");
|
||||
is(gScripts.visibleItems, 1,
|
||||
is(gScripts.visibleItems.length, 1,
|
||||
"Not all the correct scripts are shown after the search. (2)");
|
||||
|
||||
waitForFirstScript();
|
||||
|
@ -150,7 +149,7 @@ function thirdSearch() {
|
|||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 8 + token.length,
|
||||
"The editor didn't jump to the correct line. (3)");
|
||||
is(gScripts.visibleItems, 1,
|
||||
is(gScripts.visibleItems.length, 1,
|
||||
"Not all the correct scripts are shown after the search. (3)");
|
||||
|
||||
fourthSearch(0, "ugger;", token);
|
||||
|
@ -181,7 +180,7 @@ function fourthSearch(i, string, token) {
|
|||
executeSoon(function() {
|
||||
let noMatchingScripts = gDebugger.L10N.getStr("noMatchingScriptsText");
|
||||
|
||||
is(gScripts.visibleItems, 2,
|
||||
is(gScripts.visibleItems.length, 2,
|
||||
"Not all the scripts are shown after the searchbox was emptied.");
|
||||
is(gMenulist.selectedIndex, 1,
|
||||
"The menulist should have retained its selected index after the searchbox was emptied.");
|
||||
|
@ -193,7 +192,7 @@ function fourthSearch(i, string, token) {
|
|||
|
||||
is(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||
"The menulist should display a notice that no scripts match the searched token.");
|
||||
is(gScripts.visibleItems, 0,
|
||||
is(gScripts.visibleItems.length, 0,
|
||||
"No scripts should be displayed in the menulist after a bogus search.");
|
||||
is(gMenulist.selectedIndex, 1,
|
||||
"The menulist should retain its selected index after a bogus search.");
|
||||
|
@ -205,7 +204,7 @@ function fourthSearch(i, string, token) {
|
|||
|
||||
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||
"The menulist should not display a notice after the searchbox was emptied.");
|
||||
is(gScripts.visibleItems, 2,
|
||||
is(gScripts.visibleItems.length, 2,
|
||||
"Not all the scripts are shown after the searchbox was emptied.");
|
||||
is(gMenulist.selectedIndex, 1,
|
||||
"The menulist should have retained its selected index after the searchbox was emptied of a bogus search.");
|
||||
|
@ -224,7 +223,7 @@ function noMatchingScriptsSingleCharCheck(token, i) {
|
|||
|
||||
is(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||
"The menulist should display a notice after no matches are found.");
|
||||
is(gScripts.visibleItems, 0,
|
||||
is(gScripts.visibleItems.length, 0,
|
||||
"No scripts should be shown after no matches are found.");
|
||||
is(gMenulist.selectedIndex, 1,
|
||||
"The menulist should have retained its selected index after no matches are found.");
|
||||
|
|
|
@ -86,7 +86,7 @@ function firstSearch() {
|
|||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor shouldn't have jumped to a matching line yet.");
|
||||
is(gScripts.visibleItems, 2,
|
||||
is(gScripts.visibleItems.length, 2,
|
||||
"Not all the scripts are shown after the global search.");
|
||||
|
||||
let scriptResults = gDebugger.document.querySelectorAll(".dbg-source-results");
|
||||
|
@ -202,7 +202,7 @@ function secondSearch() {
|
|||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor shouldn't have jumped to a matching line yet.");
|
||||
is(gScripts.visibleItems, 2,
|
||||
is(gScripts.visibleItems.length, 2,
|
||||
"Not all the scripts are shown after the global search.");
|
||||
|
||||
let scriptResults = gDebugger.document.querySelectorAll(".dbg-source-results");
|
||||
|
|
|
@ -86,7 +86,7 @@ function doSearch() {
|
|||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor shouldn't have jumped to a matching line yet.");
|
||||
is(gScripts.visibleItems, 2,
|
||||
is(gScripts.visibleItems.length, 2,
|
||||
"Not all the scripts are shown after the global search.");
|
||||
|
||||
isnot(gSearchView._container._list.childNodes.length, 0,
|
||||
|
@ -120,7 +120,7 @@ function doFirstJump() {
|
|||
ok(gEditor.getCaretPosition().line == 4 &&
|
||||
gEditor.getCaretPosition().col == 6,
|
||||
"The editor didn't jump to the correct line. (1)");
|
||||
is(gScripts.visibleItems, 2,
|
||||
is(gScripts.visibleItems.length, 2,
|
||||
"Not all the correct scripts are shown after the search. (1)");
|
||||
|
||||
doSecondJump();
|
||||
|
@ -147,7 +147,7 @@ function doSecondJump() {
|
|||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 6,
|
||||
"The editor didn't jump to the correct line. (2)");
|
||||
is(gScripts.visibleItems, 2,
|
||||
is(gScripts.visibleItems.length, 2,
|
||||
"Not all the correct scripts are shown after the search. (2)");
|
||||
|
||||
doWrapAroundJump();
|
||||
|
@ -174,7 +174,7 @@ function doWrapAroundJump() {
|
|||
ok(gEditor.getCaretPosition().line == 4 &&
|
||||
gEditor.getCaretPosition().col == 6,
|
||||
"The editor didn't jump to the correct line. (3)");
|
||||
is(gScripts.visibleItems, 2,
|
||||
is(gScripts.visibleItems.length, 2,
|
||||
"Not all the correct scripts are shown after the search. (3)");
|
||||
|
||||
doBackwardsWrapAroundJump();
|
||||
|
@ -201,7 +201,7 @@ function doBackwardsWrapAroundJump() {
|
|||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 6,
|
||||
"The editor didn't jump to the correct line. (4)");
|
||||
is(gScripts.visibleItems, 2,
|
||||
is(gScripts.visibleItems.length, 2,
|
||||
"Not all the correct scripts are shown after the search. (4)");
|
||||
|
||||
testSearchTokenEmpty();
|
||||
|
@ -228,7 +228,7 @@ function testSearchTokenEmpty() {
|
|||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 6,
|
||||
"The editor didn't remain at the correct line. (5)");
|
||||
is(gScripts.visibleItems, 2,
|
||||
is(gScripts.visibleItems.length, 2,
|
||||
"Not all the correct scripts are shown after the search. (5)");
|
||||
|
||||
is(gSearchView._container._list.childNodes.length, 0,
|
||||
|
|
|
@ -86,7 +86,7 @@ function doSearch() {
|
|||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor shouldn't have jumped to a matching line yet.");
|
||||
is(gScripts.visibleItems, 2,
|
||||
is(gScripts.visibleItems.length, 2,
|
||||
"Not all the scripts are shown after the global search.");
|
||||
|
||||
isnot(gSearchView._container._list.childNodes.length, 0,
|
||||
|
|
|
@ -79,7 +79,7 @@ function doSearch() {
|
|||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor shouldn't have jumped to a matching line yet.");
|
||||
is(gScripts.visibleItems, 2,
|
||||
is(gScripts.visibleItems.length, 2,
|
||||
"Not all the scripts are shown after the global search.");
|
||||
|
||||
testSearchMatchNotFound();
|
||||
|
@ -106,7 +106,7 @@ function testSearchMatchNotFound() {
|
|||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor didn't remain at the correct line.");
|
||||
is(gScripts.visibleItems, 2,
|
||||
is(gScripts.visibleItems.length, 2,
|
||||
"Not all the correct scripts are shown after the search.");
|
||||
|
||||
closeDebuggerAndFinish();
|
||||
|
|
|
@ -182,7 +182,7 @@ function testClickLineToJump(scriptResults, callbacks) {
|
|||
ok(gEditor.getCaretPosition().line == 0 &&
|
||||
gEditor.getCaretPosition().col == 4,
|
||||
"The editor didn't jump to the correct line. (1)");
|
||||
is(gScripts.visibleItems, 2,
|
||||
is(gScripts.visibleItems.length, 2,
|
||||
"Not all the correct scripts are shown after the search. (1)");
|
||||
|
||||
callbacks[0](scriptResults, callbacks.slice(1));
|
||||
|
@ -217,7 +217,7 @@ function testClickMatchToJump(scriptResults, callbacks) {
|
|||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 5,
|
||||
"The editor didn't jump to the correct line. (1)");
|
||||
is(gScripts.visibleItems, 2,
|
||||
is(gScripts.visibleItems.length, 2,
|
||||
"Not all the correct scripts are shown after the search. (1)");
|
||||
|
||||
callbacks[0]();
|
||||
|
|
|
@ -0,0 +1,604 @@
|
|||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "browser_dbg_update-editor-mode.html";
|
||||
|
||||
/**
|
||||
* Tests basic functionality of scripts filtering (file search) helper UI.
|
||||
*/
|
||||
|
||||
var gPane = null;
|
||||
var gTab = null;
|
||||
var gDebuggee = null;
|
||||
var gDebugger = null;
|
||||
var gEditor = null;
|
||||
var gScripts = null;
|
||||
var gSearchBox = null;
|
||||
var gFilteredSources = null;
|
||||
var gMenulist = null;
|
||||
|
||||
function test()
|
||||
{
|
||||
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
|
||||
gTab = aTab;
|
||||
gDebuggee = aDebuggee;
|
||||
gPane = aPane;
|
||||
gDebugger = gPane.panelWin;
|
||||
});
|
||||
|
||||
window.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
|
||||
window.removeEventListener(aEvent.type, _onEvent);
|
||||
Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0);
|
||||
});
|
||||
}
|
||||
|
||||
function testScriptSearching() {
|
||||
gEditor = gDebugger.DebuggerView.editor;
|
||||
gScripts = gDebugger.DebuggerView.Sources;
|
||||
gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
|
||||
gFilteredSources = gDebugger.DebuggerView.FilteredSources;
|
||||
gMenulist = gScripts._container;
|
||||
|
||||
firstSearch();
|
||||
}
|
||||
|
||||
function firstSearch() {
|
||||
window.addEventListener("popupshown", function _onEvent(aEvent) {
|
||||
window.removeEventListener(aEvent.type, _onEvent);
|
||||
info("Current script url:\n" + gScripts.selectedValue + "\n");
|
||||
info("Debugger editor text:\n" + gEditor.getText() + "\n");
|
||||
|
||||
is(gFilteredSources.totalItems, 3,
|
||||
"The filtered sources view should have 3 items available.");
|
||||
is(gFilteredSources.visibleItems.length, 3,
|
||||
"The filtered sources view should have 3 items visible.");
|
||||
|
||||
for (let i = 0; i < gFilteredSources.totalItems; i++) {
|
||||
is(gFilteredSources.labels[i],
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.labels[i]),
|
||||
"The filtered sources view should have the correct labels.");
|
||||
is(gFilteredSources.values[i],
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.values[i]),
|
||||
"The filtered sources view should have the correct values.");
|
||||
|
||||
is(gFilteredSources.visibleItems[i].label,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.labels[i]),
|
||||
"The filtered sources view should have the correct labels.");
|
||||
is(gFilteredSources.visibleItems[i].value,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.values[i]),
|
||||
"The filtered sources view should have the correct values.");
|
||||
|
||||
is(gFilteredSources.visibleItems[i].attachment.fullLabel, gScripts.labels[i],
|
||||
"The filtered sources view should have the correct labels.");
|
||||
is(gFilteredSources.visibleItems[i].attachment.fullValue, gScripts.values[i],
|
||||
"The filtered sources view should have the correct values.");
|
||||
}
|
||||
|
||||
is(gFilteredSources.selectedValue,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedValue),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
is(gFilteredSources.selectedLabel,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedLabel),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
|
||||
let url = gScripts.selectedValue;
|
||||
if (url.indexOf("update-editor-mode.html") != -1) {
|
||||
|
||||
executeSoon(function() {
|
||||
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
||||
ok(gEditor.getCaretPosition().line == 0 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor didn't jump to the correct line.");
|
||||
is(gScripts.visibleItems.length, 3,
|
||||
"Not all the correct scripts are shown after the search.");
|
||||
|
||||
secondSearch();
|
||||
});
|
||||
} else {
|
||||
ok(false, "How did you get here?");
|
||||
}
|
||||
});
|
||||
write(".");
|
||||
}
|
||||
|
||||
function secondSearch() {
|
||||
let sourceshown = false;
|
||||
let popupshown = false;
|
||||
let proceeded = false;
|
||||
|
||||
window.addEventListener("Debugger:SourceShown", function _onEvent1(aEvent) {
|
||||
window.removeEventListener(aEvent.type, _onEvent1);
|
||||
sourceshown = true;
|
||||
executeSoon(proceed);
|
||||
});
|
||||
window.addEventListener("popupshown", function _onEvent2(aEvent) {
|
||||
window.removeEventListener(aEvent.type, _onEvent2);
|
||||
popupshown = true;
|
||||
executeSoon(proceed);
|
||||
});
|
||||
|
||||
function proceed() {
|
||||
if (!sourceshown || !popupshown || proceeded) {
|
||||
return;
|
||||
}
|
||||
proceeded = true;
|
||||
info("Current script url:\n" + gScripts.selectedValue + "\n");
|
||||
info("Debugger editor text:\n" + gEditor.getText() + "\n");
|
||||
|
||||
is(gFilteredSources.totalItems, 1,
|
||||
"The filtered sources view should have 1 items available.");
|
||||
is(gFilteredSources.visibleItems.length, 1,
|
||||
"The filtered sources view should have 1 items visible.");
|
||||
|
||||
for (let i = 0; i < gFilteredSources.totalItems; i++) {
|
||||
is(gFilteredSources.labels[i],
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.visibleItems[i].label),
|
||||
"The filtered sources view should have the correct labels.");
|
||||
is(gFilteredSources.values[i],
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.visibleItems[i].value),
|
||||
"The filtered sources view should have the correct values.");
|
||||
|
||||
is(gFilteredSources.visibleItems[i].label,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.visibleItems[i].label),
|
||||
"The filtered sources view should have the correct labels.");
|
||||
is(gFilteredSources.visibleItems[i].value,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.visibleItems[i].value),
|
||||
"The filtered sources view should have the correct values.");
|
||||
|
||||
is(gFilteredSources.visibleItems[i].attachment.fullLabel, gScripts.visibleItems[i].label,
|
||||
"The filtered sources view should have the correct labels.");
|
||||
is(gFilteredSources.visibleItems[i].attachment.fullValue, gScripts.visibleItems[i].value,
|
||||
"The filtered sources view should have the correct values.");
|
||||
}
|
||||
|
||||
is(gFilteredSources.selectedValue,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedValue),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
is(gFilteredSources.selectedLabel,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedLabel),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
|
||||
let url = gScripts.selectedValue;
|
||||
if (url.indexOf("test-script-switching-01.js") != -1) {
|
||||
|
||||
executeSoon(function() {
|
||||
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
||||
ok(gEditor.getCaretPosition().line == 0 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor didn't jump to the correct line.");
|
||||
is(gScripts.visibleItems.length, 1,
|
||||
"Not all the correct scripts are shown after the search.");
|
||||
|
||||
thirdSearch();
|
||||
});
|
||||
} else {
|
||||
ok(false, "How did you get here?");
|
||||
}
|
||||
}
|
||||
append("-0")
|
||||
}
|
||||
|
||||
function thirdSearch() {
|
||||
let sourceshown = false;
|
||||
let popupshown = false;
|
||||
let proceeded = false;
|
||||
|
||||
window.addEventListener("Debugger:SourceShown", function _onEvent1(aEvent) {
|
||||
window.removeEventListener(aEvent.type, _onEvent1);
|
||||
sourceshown = true;
|
||||
executeSoon(proceed);
|
||||
});
|
||||
window.addEventListener("popupshown", function _onEvent2(aEvent) {
|
||||
window.removeEventListener(aEvent.type, _onEvent2);
|
||||
popupshown = true;
|
||||
executeSoon(proceed);
|
||||
});
|
||||
|
||||
function proceed() {
|
||||
if (!sourceshown || !popupshown || proceeded) {
|
||||
return;
|
||||
}
|
||||
proceeded = true;
|
||||
info("Current script url:\n" + gScripts.selectedValue + "\n");
|
||||
info("Debugger editor text:\n" + gEditor.getText() + "\n");
|
||||
|
||||
is(gFilteredSources.totalItems, 3,
|
||||
"The filtered sources view should have 3 items available.");
|
||||
is(gFilteredSources.visibleItems.length, 3,
|
||||
"The filtered sources view should have 3 items visible.");
|
||||
|
||||
for (let i = 0; i < gFilteredSources.totalItems; i++) {
|
||||
is(gFilteredSources.labels[i],
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.visibleItems[i].label),
|
||||
"The filtered sources view should have the correct labels.");
|
||||
is(gFilteredSources.values[i],
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.visibleItems[i].value),
|
||||
"The filtered sources view should have the correct values.");
|
||||
|
||||
is(gFilteredSources.visibleItems[i].label,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.visibleItems[i].label),
|
||||
"The filtered sources view should have the correct labels.");
|
||||
is(gFilteredSources.visibleItems[i].value,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.visibleItems[i].value),
|
||||
"The filtered sources view should have the correct values.");
|
||||
|
||||
is(gFilteredSources.visibleItems[i].attachment.fullLabel, gScripts.visibleItems[i].label,
|
||||
"The filtered sources view should have the correct labels.");
|
||||
is(gFilteredSources.visibleItems[i].attachment.fullValue, gScripts.visibleItems[i].value,
|
||||
"The filtered sources view should have the correct values.");
|
||||
}
|
||||
|
||||
is(gFilteredSources.selectedValue,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedValue),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
is(gFilteredSources.selectedLabel,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedLabel),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
|
||||
let url = gScripts.selectedValue;
|
||||
if (url.indexOf("update-editor-mode.html") != -1) {
|
||||
|
||||
executeSoon(function() {
|
||||
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
||||
ok(gEditor.getCaretPosition().line == 0 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor didn't jump to the correct line.");
|
||||
is(gScripts.visibleItems.length, 3,
|
||||
"Not all the correct scripts are shown after the search.");
|
||||
|
||||
goDown();
|
||||
});
|
||||
} else {
|
||||
ok(false, "How did you get here?");
|
||||
}
|
||||
}
|
||||
backspace(1)
|
||||
}
|
||||
|
||||
function goDown() {
|
||||
window.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
|
||||
info("Current script url:\n" + gScripts.selectedValue + "\n");
|
||||
info("Debugger editor text:\n" + gEditor.getText() + "\n");
|
||||
|
||||
is(gFilteredSources.totalItems, 3,
|
||||
"The filtered sources view should have 3 items available.");
|
||||
is(gFilteredSources.visibleItems.length, 3,
|
||||
"The filtered sources view should have 3 items visible.");
|
||||
|
||||
is(gFilteredSources.selectedValue,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedValue),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
is(gFilteredSources.selectedLabel,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedLabel),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
|
||||
let url = gScripts.selectedValue;
|
||||
if (url.indexOf("test-editor-mode") != -1) {
|
||||
window.removeEventListener(aEvent.type, _onEvent);
|
||||
|
||||
executeSoon(function() {
|
||||
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
||||
ok(gEditor.getCaretPosition().line == 0 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor didn't jump to the correct line.");
|
||||
is(gScripts.visibleItems.length, 3,
|
||||
"Not all the correct scripts are shown after the search.");
|
||||
|
||||
goDownAgain();
|
||||
});
|
||||
} else {
|
||||
ok(false, "How did you get here?");
|
||||
}
|
||||
});
|
||||
EventUtils.sendKey("DOWN");
|
||||
}
|
||||
|
||||
function goDownAgain() {
|
||||
window.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
|
||||
info("Current script url:\n" + gScripts.selectedValue + "\n");
|
||||
info("Debugger editor text:\n" + gEditor.getText() + "\n");
|
||||
|
||||
is(gFilteredSources.totalItems, 3,
|
||||
"The filtered sources view should have 3 items available.");
|
||||
is(gFilteredSources.visibleItems.length, 3,
|
||||
"The filtered sources view should have 3 items visible.");
|
||||
|
||||
is(gFilteredSources.selectedValue,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedValue),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
is(gFilteredSources.selectedLabel,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedLabel),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
|
||||
let url = gScripts.selectedValue;
|
||||
if (url.indexOf("test-script-switching-01.js") != -1) {
|
||||
window.removeEventListener(aEvent.type, _onEvent);
|
||||
|
||||
executeSoon(function() {
|
||||
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
||||
ok(gEditor.getCaretPosition().line == 0 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor didn't jump to the correct line.");
|
||||
is(gScripts.visibleItems.length, 3,
|
||||
"Not all the correct scripts are shown after the search.");
|
||||
|
||||
goDownAndWrap();
|
||||
});
|
||||
} else {
|
||||
ok(false, "How did you get here?");
|
||||
}
|
||||
});
|
||||
EventUtils.synthesizeKey("g", { metaKey: true });
|
||||
}
|
||||
|
||||
function goDownAndWrap() {
|
||||
window.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
|
||||
info("Current script url:\n" + gScripts.selectedValue + "\n");
|
||||
info("Debugger editor text:\n" + gEditor.getText() + "\n");
|
||||
|
||||
is(gFilteredSources.totalItems, 3,
|
||||
"The filtered sources view should have 3 items available.");
|
||||
is(gFilteredSources.visibleItems.length, 3,
|
||||
"The filtered sources view should have 3 items visible.");
|
||||
|
||||
is(gFilteredSources.selectedValue,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedValue),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
is(gFilteredSources.selectedLabel,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedLabel),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
|
||||
let url = gScripts.selectedValue;
|
||||
if (url.indexOf("update-editor-mode.html") != -1) {
|
||||
window.removeEventListener(aEvent.type, _onEvent);
|
||||
|
||||
executeSoon(function() {
|
||||
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
||||
ok(gEditor.getCaretPosition().line == 0 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor didn't jump to the correct line.");
|
||||
is(gScripts.visibleItems.length, 3,
|
||||
"Not all the correct scripts are shown after the search.");
|
||||
|
||||
goUpAndWrap();
|
||||
});
|
||||
} else {
|
||||
ok(false, "How did you get here?");
|
||||
}
|
||||
});
|
||||
EventUtils.synthesizeKey("n", { ctrlKey: true });
|
||||
}
|
||||
|
||||
function goUpAndWrap() {
|
||||
window.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
|
||||
info("Current script url:\n" + gScripts.selectedValue + "\n");
|
||||
info("Debugger editor text:\n" + gEditor.getText() + "\n");
|
||||
|
||||
is(gFilteredSources.totalItems, 3,
|
||||
"The filtered sources view should have 3 items available.");
|
||||
is(gFilteredSources.visibleItems.length, 3,
|
||||
"The filtered sources view should have 3 items visible.");
|
||||
|
||||
is(gFilteredSources.selectedValue,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedValue),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
is(gFilteredSources.selectedLabel,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedLabel),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
|
||||
let url = gScripts.selectedValue;
|
||||
if (url.indexOf("test-script-switching-01.js") != -1) {
|
||||
window.removeEventListener(aEvent.type, _onEvent);
|
||||
|
||||
executeSoon(function() {
|
||||
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
||||
ok(gEditor.getCaretPosition().line == 0 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor didn't jump to the correct line.");
|
||||
is(gScripts.visibleItems.length, 3,
|
||||
"Not all the correct scripts are shown after the search.");
|
||||
|
||||
clickAndSwitch();
|
||||
});
|
||||
} else {
|
||||
ok(false, "How did you get here?");
|
||||
}
|
||||
});
|
||||
EventUtils.sendKey("UP");
|
||||
}
|
||||
|
||||
function clickAndSwitch() {
|
||||
window.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
|
||||
info("Current script url:\n" + gScripts.selectedValue + "\n");
|
||||
info("Debugger editor text:\n" + gEditor.getText() + "\n");
|
||||
|
||||
is(gFilteredSources.totalItems, 3,
|
||||
"The filtered sources view should have 3 items available.");
|
||||
is(gFilteredSources.visibleItems.length, 3,
|
||||
"The filtered sources view should have 3 items visible.");
|
||||
|
||||
is(gFilteredSources.selectedValue,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedValue),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
is(gFilteredSources.selectedLabel,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedLabel),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
|
||||
let url = gScripts.selectedValue;
|
||||
if (url.indexOf("update-editor-mode.html") != -1) {
|
||||
window.removeEventListener(aEvent.type, _onEvent);
|
||||
|
||||
executeSoon(function() {
|
||||
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
||||
ok(gEditor.getCaretPosition().line == 0 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor didn't jump to the correct line.");
|
||||
is(gScripts.visibleItems.length, 3,
|
||||
"Not all the correct scripts are shown after the search.");
|
||||
|
||||
clickAndSwitchAgain();
|
||||
});
|
||||
} else {
|
||||
ok(false, "How did you get here?");
|
||||
}
|
||||
});
|
||||
EventUtils.sendMouseEvent({ type: "click" }, gFilteredSources.visibleItems[0].target);
|
||||
}
|
||||
|
||||
function clickAndSwitchAgain() {
|
||||
window.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
|
||||
info("Current script url:\n" + gScripts.selectedValue + "\n");
|
||||
info("Debugger editor text:\n" + gEditor.getText() + "\n");
|
||||
|
||||
is(gFilteredSources.totalItems, 3,
|
||||
"The filtered sources view should have 3 items available.");
|
||||
is(gFilteredSources.visibleItems.length, 3,
|
||||
"The filtered sources view should have 3 items visible.");
|
||||
|
||||
is(gFilteredSources.selectedValue,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedValue),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
is(gFilteredSources.selectedLabel,
|
||||
gDebugger.SourceUtils.trimUrlLength(gScripts.selectedLabel),
|
||||
"The correct item should be selected in the filtered sources view");
|
||||
|
||||
let url = gScripts.selectedValue;
|
||||
if (url.indexOf("test-script-switching-01.js") != -1) {
|
||||
window.removeEventListener(aEvent.type, _onEvent);
|
||||
|
||||
executeSoon(function() {
|
||||
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
||||
ok(gEditor.getCaretPosition().line == 0 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor didn't jump to the correct line.");
|
||||
is(gScripts.visibleItems.length, 3,
|
||||
"Not all the correct scripts are shown after the search.");
|
||||
|
||||
switchFocusWithEscape();
|
||||
});
|
||||
} else {
|
||||
ok(false, "How did you get here?");
|
||||
}
|
||||
});
|
||||
EventUtils.sendMouseEvent({ type: "click" }, gFilteredSources.visibleItems[2].target);
|
||||
}
|
||||
|
||||
function switchFocusWithEscape() {
|
||||
window.addEventListener("popuphidden", function _onEvent(aEvent) {
|
||||
window.removeEventListener(aEvent.type, _onEvent);
|
||||
|
||||
info("Current script url:\n" + gScripts.selectedValue + "\n");
|
||||
info("Debugger editor text:\n" + gEditor.getText() + "\n");
|
||||
|
||||
let url = gScripts.selectedValue;
|
||||
if (url.indexOf("test-script-switching-01.js") != -1) {
|
||||
|
||||
executeSoon(function() {
|
||||
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
||||
ok(gEditor.getCaretPosition().line == 0 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor didn't jump to the correct line.");
|
||||
is(gScripts.visibleItems.length, 3,
|
||||
"Not all the correct scripts are shown after the search.");
|
||||
|
||||
focusAgainAfterEscape();
|
||||
});
|
||||
} else {
|
||||
ok(false, "How did you get here?");
|
||||
}
|
||||
});
|
||||
EventUtils.sendKey("ESCAPE");
|
||||
}
|
||||
|
||||
function focusAgainAfterEscape() {
|
||||
window.addEventListener("popupshown", function _onEvent(aEvent) {
|
||||
window.removeEventListener(aEvent.type, _onEvent);
|
||||
|
||||
info("Current script url:\n" + gScripts.selectedValue + "\n");
|
||||
info("Debugger editor text:\n" + gEditor.getText() + "\n");
|
||||
|
||||
let url = gScripts.selectedValue;
|
||||
if (url.indexOf("test-script-switching-01.js") != -1) {
|
||||
|
||||
executeSoon(function() {
|
||||
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
||||
ok(gEditor.getCaretPosition().line == 0 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor didn't jump to the correct line.");
|
||||
is(gScripts.visibleItems.length, 1,
|
||||
"Not all the correct scripts are shown after the search.");
|
||||
|
||||
switchFocusWithReturn();
|
||||
});
|
||||
} else {
|
||||
ok(false, "How did you get here?");
|
||||
}
|
||||
});
|
||||
append("0");
|
||||
}
|
||||
|
||||
function switchFocusWithReturn() {
|
||||
window.addEventListener("popuphidden", function _onEvent(aEvent) {
|
||||
window.removeEventListener(aEvent.type, _onEvent);
|
||||
|
||||
info("Current script url:\n" + gScripts.selectedValue + "\n");
|
||||
info("Debugger editor text:\n" + gEditor.getText() + "\n");
|
||||
|
||||
let url = gScripts.selectedValue;
|
||||
if (url.indexOf("test-script-switching-01.js") != -1) {
|
||||
|
||||
executeSoon(function() {
|
||||
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
||||
ok(gEditor.getCaretPosition().line == 0 &&
|
||||
gEditor.getCaretPosition().col == 0,
|
||||
"The editor didn't jump to the correct line.");
|
||||
is(gScripts.visibleItems.length, 3,
|
||||
"Not all the correct scripts are shown after the search.");
|
||||
|
||||
closeDebuggerAndFinish();
|
||||
});
|
||||
} else {
|
||||
ok(false, "How did you get here?");
|
||||
}
|
||||
});
|
||||
EventUtils.sendKey("RETURN");
|
||||
}
|
||||
|
||||
function clear() {
|
||||
gSearchBox.focus();
|
||||
gSearchBox.value = "";
|
||||
}
|
||||
|
||||
function write(text) {
|
||||
clear();
|
||||
append(text);
|
||||
}
|
||||
|
||||
function backspace(times) {
|
||||
for (let i = 0; i < times; i++) {
|
||||
EventUtils.sendKey("BACK_SPACE")
|
||||
}
|
||||
}
|
||||
|
||||
function append(text) {
|
||||
gSearchBox.focus();
|
||||
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
EventUtils.sendChar(text[i]);
|
||||
}
|
||||
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
removeTab(gTab);
|
||||
gPane = null;
|
||||
gTab = null;
|
||||
gDebuggee = null;
|
||||
gDebugger = null;
|
||||
gEditor = null;
|
||||
gScripts = null;
|
||||
gSearchBox = null;
|
||||
gFilteredSources = null;
|
||||
gMenulist = null;
|
||||
});
|
|
@ -13,7 +13,7 @@
|
|||
*/
|
||||
|
||||
#chrome-globals, #sources {
|
||||
min-width: 150px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,6 +44,11 @@
|
|||
|
||||
#globalsearch {
|
||||
background-color: white;
|
||||
min-height: 10px;
|
||||
}
|
||||
|
||||
#globalsearch > vbox:not(:empty) {
|
||||
min-height: 10px;
|
||||
max-height: 150px;
|
||||
}
|
||||
|
||||
|
@ -101,6 +106,10 @@
|
|||
transform: scale(1.75, 1.75);
|
||||
}
|
||||
|
||||
/**
|
||||
* Searchbox panel
|
||||
*/
|
||||
|
||||
#searchbox-panel .description {
|
||||
margin: -6px 0 8px 0;
|
||||
}
|
||||
|
@ -117,6 +126,50 @@
|
|||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filtered sources panel
|
||||
*/
|
||||
|
||||
#filtered-sources-panel {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.dbg-source-item {
|
||||
background: #f4f4f4;
|
||||
border: 1px solid #ddd;
|
||||
border-top-color: #fff;
|
||||
}
|
||||
|
||||
.dbg-source-item.selected {
|
||||
background: #cddae5;
|
||||
}
|
||||
|
||||
.dbg-source-item:first-of-type {
|
||||
border-top-color: #ddd;
|
||||
border-radius: 4px 4px 0 0;
|
||||
}
|
||||
|
||||
.dbg-source-item:last-of-type {
|
||||
border-radius: 0 0 4px 4px;
|
||||
}
|
||||
|
||||
.dbg-source-item:only-of-type {
|
||||
border-radius: 4px 4px 4px 4px;
|
||||
}
|
||||
|
||||
.dbg-source-item:not(:hover) {
|
||||
text-shadow: 0 1px #fff;
|
||||
}
|
||||
|
||||
.dbg-source-item-name {
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.dbg-source-item-details {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stack frames and breakpoints pane
|
||||
*/
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#chrome-globals, #sources {
|
||||
min-width: 150px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,6 +46,11 @@
|
|||
|
||||
#globalsearch {
|
||||
background-color: white;
|
||||
min-height: 10px;
|
||||
}
|
||||
|
||||
#globalsearch > vbox:not(:empty) {
|
||||
min-height: 10px;
|
||||
max-height: 150px;
|
||||
}
|
||||
|
||||
|
@ -103,6 +108,10 @@
|
|||
transform: scale(1.75, 1.75);
|
||||
}
|
||||
|
||||
/**
|
||||
* Searchbox panel
|
||||
*/
|
||||
|
||||
#searchbox-panel .description {
|
||||
margin: -6px 0 8px 0;
|
||||
}
|
||||
|
@ -119,6 +128,50 @@
|
|||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filtered sources panel
|
||||
*/
|
||||
|
||||
#filtered-sources-panel {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.dbg-source-item {
|
||||
background: #f4f4f4;
|
||||
border: 1px solid #ddd;
|
||||
border-top-color: #fff;
|
||||
}
|
||||
|
||||
.dbg-source-item.selected {
|
||||
background: #cddae5;
|
||||
}
|
||||
|
||||
.dbg-source-item:first-of-type {
|
||||
border-top-color: #ddd;
|
||||
border-radius: 4px 4px 0 0;
|
||||
}
|
||||
|
||||
.dbg-source-item:last-of-type {
|
||||
border-radius: 0 0 4px 4px;
|
||||
}
|
||||
|
||||
.dbg-source-item:only-of-type {
|
||||
border-radius: 4px 4px 4px 4px;
|
||||
}
|
||||
|
||||
.dbg-source-item:not(.selected):not(:hover) {
|
||||
text-shadow: 0 1px #fff;
|
||||
}
|
||||
|
||||
.dbg-source-item-name {
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.dbg-source-item-details {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stack frames and breakpoints pane
|
||||
*/
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*/
|
||||
|
||||
#chrome-globals, #sources {
|
||||
min-width: 150px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,6 +52,11 @@
|
|||
|
||||
#globalsearch {
|
||||
background-color: white;
|
||||
min-height: 10px;
|
||||
}
|
||||
|
||||
#globalsearch > vbox:not(:empty) {
|
||||
min-height: 10px;
|
||||
max-height: 150px;
|
||||
}
|
||||
|
||||
|
@ -109,6 +114,10 @@
|
|||
transform: scale(1.75, 1.75);
|
||||
}
|
||||
|
||||
/**
|
||||
* Searchbox panel
|
||||
*/
|
||||
|
||||
#searchbox-panel .description {
|
||||
margin: -6px 0 8px 0;
|
||||
}
|
||||
|
@ -125,6 +134,50 @@
|
|||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filtered sources panel
|
||||
*/
|
||||
|
||||
#filtered-sources-panel {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.dbg-source-item {
|
||||
background: #f4f4f4;
|
||||
border: 1px solid #ddd;
|
||||
border-top-color: #fff;
|
||||
}
|
||||
|
||||
.dbg-source-item.selected {
|
||||
background: #cddae5;
|
||||
}
|
||||
|
||||
.dbg-source-item:first-of-type {
|
||||
border-top-color: #ddd;
|
||||
border-radius: 4px 4px 0 0;
|
||||
}
|
||||
|
||||
.dbg-source-item:last-of-type {
|
||||
border-radius: 0 0 4px 4px;
|
||||
}
|
||||
|
||||
.dbg-source-item:only-of-type {
|
||||
border-radius: 4px 4px 4px 4px;
|
||||
}
|
||||
|
||||
.dbg-source-item:not(:hover) {
|
||||
text-shadow: 0 1px #fff;
|
||||
}
|
||||
|
||||
.dbg-source-item-name {
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.dbg-source-item-details {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stack frames and breakpoints pane
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче