mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 882054 - Cleanup widgets inheritance model mechanism a bit, r=past
This commit is contained in:
parent
4549fa7759
commit
5d176875e9
@ -1561,9 +1561,6 @@ DebuggerController.Breakpoints = new Breakpoints();
|
||||
* Export some properties to the global scope for easier access.
|
||||
*/
|
||||
Object.defineProperties(window, {
|
||||
"create": {
|
||||
get: function() ViewHelpers.create,
|
||||
},
|
||||
"dispatchEvent": {
|
||||
get: function() ViewHelpers.dispatchEvent,
|
||||
},
|
||||
|
@ -27,14 +27,14 @@ function SourcesView() {
|
||||
this._onConditionalTextboxKeyPress = this._onConditionalTextboxKeyPress.bind(this);
|
||||
}
|
||||
|
||||
create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
SourcesView.prototype = Heritage.extend(WidgetMethods, {
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
initialize: function() {
|
||||
dumpn("Initializing the SourcesView");
|
||||
|
||||
this.node = new SideMenuWidget(document.getElementById("sources"));
|
||||
this.widget = new SideMenuWidget(document.getElementById("sources"));
|
||||
this.emptyText = L10N.getStr("noSourcesText");
|
||||
this.unavailableText = L10N.getStr("noMatchingSourcesText");
|
||||
|
||||
@ -46,8 +46,8 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
|
||||
window.addEventListener("Debugger:EditorLoaded", this._onEditorLoad, false);
|
||||
window.addEventListener("Debugger:EditorUnloaded", this._onEditorUnload, false);
|
||||
this.node.addEventListener("select", this._onSourceSelect, false);
|
||||
this.node.addEventListener("click", this._onSourceClick, false);
|
||||
this.widget.addEventListener("select", this._onSourceSelect, false);
|
||||
this.widget.addEventListener("click", this._onSourceClick, false);
|
||||
this._cbPanel.addEventListener("popupshowing", this._onConditionalPopupShowing, false);
|
||||
this._cbPanel.addEventListener("popupshown", this._onConditionalPopupShown, false);
|
||||
this._cbPanel.addEventListener("popuphiding", this._onConditionalPopupHiding, false);
|
||||
@ -68,8 +68,8 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
|
||||
window.removeEventListener("Debugger:EditorLoaded", this._onEditorLoad, false);
|
||||
window.removeEventListener("Debugger:EditorUnloaded", this._onEditorUnload, false);
|
||||
this.node.removeEventListener("select", this._onSourceSelect, false);
|
||||
this.node.removeEventListener("click", this._onSourceClick, false);
|
||||
this.widget.removeEventListener("select", this._onSourceSelect, false);
|
||||
this.widget.removeEventListener("click", this._onSourceClick, false);
|
||||
this._cbPanel.removeEventListener("popupshowing", this._onConditionalPopupShowing, false);
|
||||
this._cbPanel.removeEventListener("popupshowing", this._onConditionalPopupShown, false);
|
||||
this._cbPanel.removeEventListener("popuphiding", this._onConditionalPopupHiding, false);
|
||||
@ -149,9 +149,9 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
|
||||
// Append a breakpoint child item to the corresponding source item.
|
||||
let breakpointItem = sourceItem.append(breakpointView.container, {
|
||||
attachment: Object.create(aOptions, {
|
||||
view: { value: breakpointView },
|
||||
popup: { value: contextMenu }
|
||||
attachment: Heritage.extend(aOptions, {
|
||||
view: breakpointView,
|
||||
popup: contextMenu
|
||||
}),
|
||||
attributes: [
|
||||
["contextmenu", contextMenu.menupopupId]
|
||||
@ -202,7 +202,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
* The breakpoint source location.
|
||||
* @param number aLineNumber
|
||||
* The breakpoint line number.
|
||||
* @return MenuItem
|
||||
* @return object
|
||||
* The corresponding breakpoint item if found, null otherwise.
|
||||
*/
|
||||
getBreakpoint: function(aSourceLocation, aLineNumber) {
|
||||
@ -370,7 +370,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Marks a breakpoint as selected in this sources container.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* @param object aItem
|
||||
* The breakpoint item to select.
|
||||
*/
|
||||
_selectBreakpoint: function(aItem) {
|
||||
@ -382,7 +382,7 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
this._selectedBreakpoint.target.classList.add("selected");
|
||||
|
||||
// Ensure the currently selected breakpoint is visible.
|
||||
this.node.ensureElementIsVisible(aItem.target);
|
||||
this.widget.ensureElementIsVisible(aItem.target);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -562,8 +562,8 @@ create({ constructor: SourcesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Function called each time a breakpoint item is removed.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* The corresponding menu item.
|
||||
* @param object aItem
|
||||
* The corresponding item.
|
||||
*/
|
||||
_onBreakpointRemoved: function(aItem) {
|
||||
dumpn("Finalizing breakpoint item: " + aItem);
|
||||
@ -1251,19 +1251,18 @@ function WatchExpressionsView() {
|
||||
this._onKeyPress = this._onKeyPress.bind(this);
|
||||
}
|
||||
|
||||
create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
WatchExpressionsView.prototype = Heritage.extend(WidgetMethods, {
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
initialize: function() {
|
||||
dumpn("Initializing the WatchExpressionsView");
|
||||
|
||||
this.node = new ListWidget(document.getElementById("expressions"));
|
||||
this.node.permaText = L10N.getStr("addWatchExpressionText");
|
||||
this.node.itemFactory = this._createItemView;
|
||||
this.node.setAttribute("context", "debuggerWatchExpressionsContextMenu");
|
||||
|
||||
this.node.addEventListener("click", this._onClick, false);
|
||||
this.widget = new ListWidget(document.getElementById("expressions"));
|
||||
this.widget.permaText = L10N.getStr("addWatchExpressionText");
|
||||
this.widget.itemFactory = this._createItemView;
|
||||
this.widget.setAttribute("context", "debuggerWatchExpressionsContextMenu");
|
||||
this.widget.addEventListener("click", this._onClick, false);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1272,7 +1271,7 @@ create({ constructor: WatchExpressionsView, proto: MenuContainer.prototype }, {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the WatchExpressionsView");
|
||||
|
||||
this.node.removeEventListener("click", this._onClick, false);
|
||||
this.widget.removeEventListener("click", this._onClick, false);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1509,19 +1508,19 @@ function GlobalSearchView() {
|
||||
this._onMatchClick = this._onMatchClick.bind(this);
|
||||
}
|
||||
|
||||
create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
GlobalSearchView.prototype = Heritage.extend(WidgetMethods, {
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
initialize: function() {
|
||||
dumpn("Initializing the GlobalSearchView");
|
||||
|
||||
this.node = new ListWidget(document.getElementById("globalsearch"));
|
||||
this.widget = new ListWidget(document.getElementById("globalsearch"));
|
||||
this._splitter = document.querySelector("#globalsearch + .devtools-horizontal-splitter");
|
||||
|
||||
this.node.emptyText = L10N.getStr("noMatchingStringsText");
|
||||
this.node.itemFactory = this._createItemView;
|
||||
this.node.addEventListener("scroll", this._onScroll, false);
|
||||
this.widget.emptyText = L10N.getStr("noMatchingStringsText");
|
||||
this.widget.itemFactory = this._createItemView;
|
||||
this.widget.addEventListener("scroll", this._onScroll, false);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1530,7 +1529,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the GlobalSearchView");
|
||||
|
||||
this.node.removeEventListener("scroll", this._onScroll, false);
|
||||
this.widget.removeEventListener("scroll", this._onScroll, false);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1538,7 +1537,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
* @return boolean
|
||||
*/
|
||||
get hidden()
|
||||
this.node.getAttribute("hidden") == "true" ||
|
||||
this.widget.getAttribute("hidden") == "true" ||
|
||||
this._splitter.getAttribute("hidden") == "true",
|
||||
|
||||
/**
|
||||
@ -1546,7 +1545,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
* @param boolean aFlag
|
||||
*/
|
||||
set hidden(aFlag) {
|
||||
this.node.setAttribute("hidden", aFlag);
|
||||
this.widget.setAttribute("hidden", aFlag);
|
||||
this._splitter.setAttribute("hidden", aFlag);
|
||||
},
|
||||
|
||||
@ -1857,7 +1856,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
return;
|
||||
}
|
||||
let { top, height } = aTarget.getBoundingClientRect();
|
||||
let { clientHeight } = this.node._parent;
|
||||
let { clientHeight } = this.widget._parent;
|
||||
|
||||
if (top - height <= clientHeight || this._forceExpandResults) {
|
||||
sourceResultsItem.instance.expand();
|
||||
@ -1873,7 +1872,7 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
_scrollMatchIntoViewIfNeeded: function(aMatch) {
|
||||
// TODO: Accessing private widget properties. Figure out what's the best
|
||||
// way to expose such things. Bug 876271.
|
||||
let boxObject = this.node._parent.boxObject.QueryInterface(Ci.nsIScrollBoxObject);
|
||||
let boxObject = this.widget._parent.boxObject.QueryInterface(Ci.nsIScrollBoxObject);
|
||||
boxObject.ensureElementIsVisible(aMatch);
|
||||
},
|
||||
|
||||
@ -2245,7 +2244,7 @@ LineResults.prototype.__iterator__ = function() {
|
||||
*/
|
||||
SourceResults.getItemForElement =
|
||||
LineResults.getItemForElement = function(aElement) {
|
||||
return MenuContainer.prototype.getItemForElement.call(this, aElement);
|
||||
return WidgetMethods.getItemForElement.call(this, aElement);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -322,19 +322,19 @@ function ChromeGlobalsView() {
|
||||
this._onClick = this._onClick.bind(this);
|
||||
}
|
||||
|
||||
create({ constructor: ChromeGlobalsView, proto: MenuContainer.prototype }, {
|
||||
ChromeGlobalsView.prototype = Heritage.extend(WidgetMethods, {
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
initialize: function() {
|
||||
dumpn("Initializing the ChromeGlobalsView");
|
||||
|
||||
this.node = document.getElementById("chrome-globals");
|
||||
this.widget = document.getElementById("chrome-globals");
|
||||
this.emptyText = L10N.getStr("noGlobalsText");
|
||||
this.unavailableText = L10N.getStr("noMatchingGlobalsText");
|
||||
|
||||
this.node.addEventListener("select", this._onSelect, false);
|
||||
this.node.addEventListener("click", this._onClick, false);
|
||||
this.widget.addEventListener("select", this._onSelect, false);
|
||||
this.widget.addEventListener("click", this._onClick, false);
|
||||
|
||||
// Show an empty label by default.
|
||||
this.empty();
|
||||
@ -346,8 +346,8 @@ create({ constructor: ChromeGlobalsView, proto: MenuContainer.prototype }, {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the ChromeGlobalsView");
|
||||
|
||||
this.node.removeEventListener("select", this._onSelect, false);
|
||||
this.node.removeEventListener("click", this._onClick, false);
|
||||
this.widget.removeEventListener("select", this._onSelect, false);
|
||||
this.widget.removeEventListener("click", this._onClick, false);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -378,7 +378,7 @@ function StackFramesView() {
|
||||
this._afterScroll = this._afterScroll.bind(this);
|
||||
}
|
||||
|
||||
create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
|
||||
StackFramesView.prototype = Heritage.extend(WidgetMethods, {
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
@ -393,9 +393,9 @@ create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
|
||||
document.getElementById("debuggerPopupset").appendChild(menupopup);
|
||||
document.getElementById("debuggerCommands").appendChild(commandset);
|
||||
|
||||
this.node = new BreadcrumbsWidget(document.getElementById("stackframes"));
|
||||
this.node.addEventListener("select", this._onSelect, false);
|
||||
this.node.addEventListener("scroll", this._onScroll, true);
|
||||
this.widget = new BreadcrumbsWidget(document.getElementById("stackframes"));
|
||||
this.widget.addEventListener("select", this._onSelect, false);
|
||||
this.widget.addEventListener("scroll", this._onScroll, true);
|
||||
window.addEventListener("resize", this._onScroll, true);
|
||||
|
||||
this.autoFocusOnFirstItem = false;
|
||||
@ -408,8 +408,8 @@ create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the StackFramesView");
|
||||
|
||||
this.node.removeEventListener("select", this._onSelect, false);
|
||||
this.node.removeEventListener("scroll", this._onScroll, true);
|
||||
this.widget.removeEventListener("select", this._onSelect, false);
|
||||
this.widget.removeEventListener("scroll", this._onScroll, true);
|
||||
window.removeEventListener("resize", this._onScroll, true);
|
||||
},
|
||||
|
||||
@ -559,8 +559,8 @@ create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Function called each time a stack frame item is removed.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* The corresponding menu item.
|
||||
* @param object aItem
|
||||
* The corresponding item.
|
||||
*/
|
||||
_onStackframeRemoved: function(aItem) {
|
||||
dumpn("Finalizing stackframe item: " + aItem);
|
||||
@ -610,7 +610,7 @@ create({ constructor: StackFramesView, proto: MenuContainer.prototype }, {
|
||||
_afterScroll: function() {
|
||||
// TODO: Accessing private widget properties. Figure out what's the best
|
||||
// way to expose such things. Bug 876271.
|
||||
let list = this.node._list;
|
||||
let list = this.widget._list;
|
||||
let scrollPosition = list.scrollPosition;
|
||||
let scrollWidth = list.scrollWidth;
|
||||
|
||||
@ -939,10 +939,10 @@ FilterView.prototype = {
|
||||
DebuggerView.FilteredSources.syncFileSearch();
|
||||
|
||||
// Hide all the groups with no visible children.
|
||||
view.node.hideEmptyGroups();
|
||||
view.widget.hideEmptyGroups();
|
||||
|
||||
// Ensure the currently selected item is visible.
|
||||
view.node.ensureSelectionIsVisible({ withGroup: true });
|
||||
view.widget.ensureSelectionIsVisible({ withGroup: true });
|
||||
|
||||
// Remember the previously searched file to avoid redundant filtering.
|
||||
this._prevSearchedFile = aFile;
|
||||
@ -1283,7 +1283,7 @@ function FilteredSourcesView() {
|
||||
this._onSelect = this._onSelect.bind(this);
|
||||
}
|
||||
|
||||
create({ constructor: FilteredSourcesView, proto: ResultsPanelContainer.prototype }, {
|
||||
FilteredSourcesView.prototype = Heritage.extend(ResultsPanelContainer.prototype, {
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
@ -1291,8 +1291,8 @@ create({ constructor: FilteredSourcesView, proto: ResultsPanelContainer.prototyp
|
||||
dumpn("Initializing the FilteredSourcesView");
|
||||
|
||||
this.anchor = document.getElementById("searchbox");
|
||||
this.node.addEventListener("select", this._onSelect, false);
|
||||
this.node.addEventListener("click", this._onClick, false);
|
||||
this.widget.addEventListener("select", this._onSelect, false);
|
||||
this.widget.addEventListener("click", this._onClick, false);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1301,8 +1301,8 @@ create({ constructor: FilteredSourcesView, proto: ResultsPanelContainer.prototyp
|
||||
destroy: function() {
|
||||
dumpn("Destroying the FilteredSourcesView");
|
||||
|
||||
this.node.removeEventListener("select", this._onSelect, false);
|
||||
this.node.removeEventListener("click", this._onClick, false);
|
||||
this.widget.removeEventListener("select", this._onSelect, false);
|
||||
this.widget.removeEventListener("click", this._onClick, false);
|
||||
this.anchor = null;
|
||||
},
|
||||
|
||||
@ -1358,7 +1358,7 @@ create({ constructor: FilteredSourcesView, proto: ResultsPanelContainer.prototyp
|
||||
/**
|
||||
* The select listener for this container.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* @param object aItem
|
||||
* The item associated with the element to select.
|
||||
*/
|
||||
_onSelect: function({ detail: locationItem }) {
|
||||
@ -1379,7 +1379,7 @@ function FilteredFunctionsView() {
|
||||
this._onSelect = this._onSelect.bind(this);
|
||||
}
|
||||
|
||||
create({ constructor: FilteredFunctionsView, proto: ResultsPanelContainer.prototype }, {
|
||||
FilteredFunctionsView.prototype = Heritage.extend(ResultsPanelContainer.prototype, {
|
||||
/**
|
||||
* Initialization function, called when the debugger is started.
|
||||
*/
|
||||
@ -1387,8 +1387,8 @@ create({ constructor: FilteredFunctionsView, proto: ResultsPanelContainer.protot
|
||||
dumpn("Initializing the FilteredFunctionsView");
|
||||
|
||||
this.anchor = document.getElementById("searchbox");
|
||||
this.node.addEventListener("select", this._onSelect, false);
|
||||
this.node.addEventListener("click", this._onClick, false);
|
||||
this.widget.addEventListener("select", this._onSelect, false);
|
||||
this.widget.addEventListener("click", this._onClick, false);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1397,8 +1397,8 @@ create({ constructor: FilteredFunctionsView, proto: ResultsPanelContainer.protot
|
||||
destroy: function() {
|
||||
dumpn("Destroying the FilteredFunctionsView");
|
||||
|
||||
this.node.removeEventListener("select", this._onSelect, false);
|
||||
this.node.removeEventListener("click", this._onClick, false);
|
||||
this.widget.removeEventListener("select", this._onSelect, false);
|
||||
this.widget.removeEventListener("click", this._onClick, false);
|
||||
this.anchor = null;
|
||||
},
|
||||
|
||||
|
@ -491,11 +491,11 @@ let DebuggerView = {
|
||||
};
|
||||
|
||||
/**
|
||||
* A stacked list of items, compatible with MenuContainer instances, used for
|
||||
* A stacked list of items, compatible with WidgetMethods instances, used for
|
||||
* displaying views like the watch expressions, filtering or search results etc.
|
||||
*
|
||||
* You should never need to access these methods directly, use the wrapper
|
||||
* MenuContainer instances.
|
||||
* You should never need to access these methods directly, use the wrapped
|
||||
* WidgetMethods instead.
|
||||
*
|
||||
* @param nsIDOMNode aNode
|
||||
* The element associated with the widget.
|
||||
@ -508,7 +508,7 @@ function ListWidget(aNode) {
|
||||
this._parent.appendChild(this._list);
|
||||
|
||||
// Delegate some of the associated node's methods to satisfy the interface
|
||||
// required by MenuContainer instances.
|
||||
// required by WidgetMethods instances.
|
||||
ViewHelpers.delegateWidgetAttributeMethods(this, aNode);
|
||||
ViewHelpers.delegateWidgetEventMethods(this, aNode);
|
||||
}
|
||||
@ -711,12 +711,12 @@ ListWidget.prototype = {
|
||||
|
||||
/**
|
||||
* A custom items container, used for displaying views like the
|
||||
* FilteredSources, FilteredFunctions etc., inheriting the generic MenuContainer.
|
||||
* FilteredSources, FilteredFunctions etc., inheriting the generic WidgetMethods.
|
||||
*/
|
||||
function ResultsPanelContainer() {
|
||||
}
|
||||
|
||||
create({ constructor: ResultsPanelContainer, proto: MenuContainer.prototype }, {
|
||||
ResultsPanelContainer.prototype = Heritage.extend(WidgetMethods, {
|
||||
/**
|
||||
* Sets the anchor node for this container panel.
|
||||
* @param nsIDOMNode aNode
|
||||
@ -734,17 +734,17 @@ create({ constructor: ResultsPanelContainer, proto: MenuContainer.prototype }, {
|
||||
this._panel.setAttribute("noautofocus", "true");
|
||||
document.documentElement.appendChild(this._panel);
|
||||
}
|
||||
if (!this.node) {
|
||||
this.node = new ListWidget(this._panel);
|
||||
this.node.itemType = "vbox";
|
||||
this.node.itemFactory = this._createItemView;
|
||||
if (!this.widget) {
|
||||
this.widget = new ListWidget(this._panel);
|
||||
this.widget.itemType = "vbox";
|
||||
this.widget.itemFactory = this._createItemView;
|
||||
}
|
||||
}
|
||||
// Cleanup the anchor and remove the previously created panel.
|
||||
else {
|
||||
this._panel.remove();
|
||||
this._panel = null;
|
||||
this.node = null;
|
||||
this.widget = null;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -29,7 +29,7 @@ function testAddBreakpoint()
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
|
||||
is(gDebugger.DebuggerController.activeThread.state, "paused",
|
||||
"The debugger statement was reached.");
|
||||
|
@ -85,8 +85,8 @@ function test()
|
||||
ok(!gPane.getBreakpoint("chocolate", 3), "getBreakpoint('chocolate', 3) returns falsey");
|
||||
is(gEditor.getBreakpoints().length, 0, "no breakpoints in the editor");
|
||||
|
||||
gBreakpointsParent = gSources._container._parent;
|
||||
gBreakpointsList = gSources._container._list;
|
||||
gBreakpointsParent = gSources.widget._parent;
|
||||
gBreakpointsList = gSources.widget._list;
|
||||
|
||||
is(gBreakpointsParent.childNodes.length, 1, // one sources list
|
||||
"Found junk in the breakpoints container.");
|
||||
|
@ -100,7 +100,7 @@ function test()
|
||||
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
gWatch._container._parent,
|
||||
gWatch.widget._parent,
|
||||
gDebugger);
|
||||
|
||||
is(gWatch.getAllStrings().length, 1,
|
||||
@ -159,12 +159,10 @@ function test()
|
||||
is(gWatch.getItemForElement(element), gWatch.getItemAtIndex(index),
|
||||
"The correct watch expression item was accessed");
|
||||
|
||||
ok(gWatch.getItemAtIndex(index) instanceof gDebugger.MenuItem,
|
||||
ok(gWatch.widget.getItemAtIndex(index) instanceof XULElement,
|
||||
"The correct watch expression element was accessed (1)");
|
||||
ok(gWatch._container.getItemAtIndex(index) instanceof XULElement,
|
||||
is(element, gWatch.widget.getItemAtIndex(index),
|
||||
"The correct watch expression element was accessed (2)");
|
||||
is(element, gWatch._container.getItemAtIndex(index),
|
||||
"The correct watch expression element was accessed (3)");
|
||||
|
||||
is(gWatch.getItemForElement(element).attachment.arrowNode.hidden, false,
|
||||
"The arrow node should be visible");
|
||||
|
@ -62,9 +62,9 @@ function test()
|
||||
|
||||
function performTest()
|
||||
{
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 0,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 0,
|
||||
"There should be 0 hidden nodes in the watch expressions container");
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 27,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 27,
|
||||
"There should be 27 visible nodes in the watch expressions container");
|
||||
|
||||
test1(function() {
|
||||
@ -90,9 +90,9 @@ function test()
|
||||
|
||||
function finishTest()
|
||||
{
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 0,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 0,
|
||||
"There should be 0 hidden nodes in the watch expressions container");
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 27,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 27,
|
||||
"There should be 27 visible nodes in the watch expressions container");
|
||||
|
||||
closeDebuggerAndFinish();
|
||||
@ -253,9 +253,9 @@ function test()
|
||||
expected_arguments,
|
||||
total)
|
||||
{
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression[hidden=true]").length, total,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, total,
|
||||
"There should be " + total + " hidden nodes in the watch expressions container");
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
"There should be 0 visible nodes in the watch expressions container");
|
||||
|
||||
let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel");
|
||||
|
@ -144,9 +144,9 @@ function test()
|
||||
is(gSources._conditionalPopupVisible, false,
|
||||
"The breakpoint conditional expression popup should not be shown.");
|
||||
|
||||
is(gDebugger.DebuggerView.StackFrames._container._list.querySelectorAll(".dbg-stackframe").length, 0,
|
||||
is(gDebugger.DebuggerView.StackFrames.widget._list.querySelectorAll(".dbg-stackframe").length, 0,
|
||||
"There should be no visible stackframes.");
|
||||
is(gDebugger.DebuggerView.Sources._container._list.querySelectorAll(".dbg-breakpoint").length, 13,
|
||||
is(gDebugger.DebuggerView.Sources.widget._list.querySelectorAll(".dbg-breakpoint").length, 13,
|
||||
"There should be thirteen visible breakpoints.");
|
||||
|
||||
testReload();
|
||||
@ -351,7 +351,7 @@ function test()
|
||||
window.clearInterval(intervalID);
|
||||
return closeDebuggerAndFinish();
|
||||
}
|
||||
if (gSources._container._list.querySelectorAll(".dbg-breakpoint").length != total) {
|
||||
if (gSources.widget._list.querySelectorAll(".dbg-breakpoint").length != total) {
|
||||
return;
|
||||
}
|
||||
// We got all the breakpoints, it's safe to callback.
|
||||
|
@ -345,7 +345,7 @@ function test()
|
||||
function testHighlights2()
|
||||
{
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
gSources._container._list.querySelectorAll(".dbg-breakpoint")[2],
|
||||
gSources.widget._list.querySelectorAll(".dbg-breakpoint")[2],
|
||||
gDebugger);
|
||||
|
||||
waitForCaretPos(13, function() {
|
||||
@ -364,7 +364,7 @@ function test()
|
||||
"The source editor caret position should be at column 0");
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
gSources._container._list.querySelectorAll(".dbg-breakpoint")[1],
|
||||
gSources.widget._list.querySelectorAll(".dbg-breakpoint")[1],
|
||||
gDebugger);
|
||||
|
||||
waitForCaretPos(12, function() {
|
||||
@ -383,7 +383,7 @@ function test()
|
||||
"The source editor caret position should be at column 0");
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
gSources._container._list.querySelectorAll(".dbg-breakpoint")[0],
|
||||
gSources.widget._list.querySelectorAll(".dbg-breakpoint")[0],
|
||||
gDebugger);
|
||||
|
||||
waitForCaretPos(11, function() {
|
||||
|
@ -28,7 +28,7 @@ function testAnonCall() {
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
let frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
let frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
|
||||
is(gDebugger.DebuggerController.activeThread.state, "paused",
|
||||
"Should only be getting stack frames while paused.");
|
||||
@ -50,7 +50,7 @@ function testInferredName() {
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
let frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
let frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
|
||||
is(gDebugger.DebuggerController.activeThread.state, "paused",
|
||||
"Should only be getting stack frames while paused.");
|
||||
|
@ -23,7 +23,7 @@ function test() {
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
let frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
let frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
let childNodes = frames.childNodes;
|
||||
|
||||
is(gDebugger.DebuggerController.activeThread.paused, true,
|
||||
|
@ -48,7 +48,7 @@ function test()
|
||||
}
|
||||
|
||||
function testSimpleCall() {
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list,
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list,
|
||||
childNodes = frames.childNodes;
|
||||
|
||||
is(gDebugger.DebuggerController.activeThread.state, "paused",
|
||||
@ -85,7 +85,7 @@ function testLocationChange()
|
||||
is(gDebugger.editor.getText().length, 0,
|
||||
"The source editor not have any text displayed.");
|
||||
|
||||
let menulist = gDebugger.DebuggerView.Sources._container;
|
||||
let menulist = gDebugger.DebuggerView.Sources.widget;
|
||||
let noScripts = gDebugger.L10N.getStr("noSourcesText");
|
||||
is(menulist.getAttribute("label"), noScripts,
|
||||
"The menulist should display a notice that there are no scripts availalble.");
|
||||
|
@ -35,7 +35,7 @@ function testAddBreakpoint()
|
||||
controller.activeThread.addOneTimeListener("framesadded", function() {
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
|
||||
is(controller.activeThread.state, "paused",
|
||||
"The debugger statement was reached.");
|
||||
|
@ -48,7 +48,7 @@ function test()
|
||||
}
|
||||
|
||||
function testSimpleCall() {
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list,
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list,
|
||||
childNodes = frames.childNodes;
|
||||
|
||||
is(gDebugger.DebuggerController.activeThread.state, "paused",
|
||||
@ -85,7 +85,7 @@ function testLocationChange()
|
||||
isnot(gDebugger.editor.getText().length, 0,
|
||||
"The source editor should have some text displayed.");
|
||||
|
||||
let menulist = gDebugger.DebuggerView.Sources._container;
|
||||
let menulist = gDebugger.DebuggerView.Sources.widget;
|
||||
let noScripts = gDebugger.L10N.getStr("noSourcesText");
|
||||
isnot(menulist.getAttribute("label"), noScripts,
|
||||
"The menulist should not display a notice that there are no scripts availalble.");
|
||||
|
@ -27,7 +27,7 @@ function testSimpleCall() {
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
|
||||
Services.tm.currentThread.dispatch({
|
||||
run: function() {
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list,
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list,
|
||||
childNodes = frames.childNodes;
|
||||
|
||||
is(gDebugger.DebuggerController.activeThread.state, "paused",
|
||||
|
@ -71,7 +71,7 @@ function testWithFrame()
|
||||
gDebugger.removeEventListener("Debugger:FetchedVariables", testB, false);
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list,
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list,
|
||||
scopes = gDebugger.DebuggerView.Variables._list,
|
||||
innerScope = scopes.firstChild,
|
||||
innerNodes = innerScope.querySelector(".variables-view-element-details").childNodes;
|
||||
|
@ -37,7 +37,7 @@ function testPause() {
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("paused", function() {
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
let frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
let frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
let childNodes = frames.childNodes;
|
||||
|
||||
is(gDebugger.DebuggerController.activeThread.paused, true,
|
||||
|
@ -36,7 +36,7 @@ function testlabelshortening() {
|
||||
let vs = gDebugger.DebuggerView.Sources;
|
||||
let ss = gDebugger.DebuggerController.SourceScripts;
|
||||
vs.empty();
|
||||
vs._container.removeEventListener("select", vs._onScriptsChange, false);
|
||||
vs.widget.removeEventListener("select", vs._onScriptsChange, false);
|
||||
|
||||
is(sv.trimUrlQuery("a/b/c.d?test=1&random=4#reference"), "a/b/c.d",
|
||||
"Trimming the url query isn't done properly.");
|
||||
|
@ -29,7 +29,7 @@ function testFrameParameters()
|
||||
gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list,
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list,
|
||||
localScope = gDebugger.DebuggerView.Variables._list.querySelector(".variables-view-scope"),
|
||||
localNodes = localScope.querySelector(".variables-view-element-details").childNodes;
|
||||
|
||||
@ -88,7 +88,7 @@ function resumeAndFinish() {
|
||||
gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() {
|
||||
gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true);
|
||||
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
is(frames.querySelectorAll(".dbg-stackframe").length, 0,
|
||||
"Should have no frames.");
|
||||
|
||||
|
@ -29,7 +29,7 @@ function testFrameParameters()
|
||||
gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list,
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list,
|
||||
localScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[0],
|
||||
localNodes = localScope.querySelector(".variables-view-element-details").childNodes,
|
||||
localNonEnums = localScope.querySelector(".nonenum").childNodes;
|
||||
@ -226,7 +226,7 @@ function resumeAndFinish() {
|
||||
gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() {
|
||||
gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true);
|
||||
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
is(frames.querySelectorAll(".dbg-stackframe").length, 0,
|
||||
"Should have no frames.");
|
||||
|
||||
|
@ -40,7 +40,7 @@ function testFrameParameters()
|
||||
gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list,
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list,
|
||||
globalScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[2],
|
||||
globalNodes = globalScope.querySelector(".variables-view-element-details").childNodes;
|
||||
|
||||
@ -85,7 +85,7 @@ function resumeAndFinish() {
|
||||
gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() {
|
||||
gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true);
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
|
||||
is(frames.querySelectorAll(".dbg-stackframe").length, 0,
|
||||
"Should have no frames.");
|
||||
|
@ -40,7 +40,7 @@ function testWithFrame()
|
||||
gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list,
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list,
|
||||
scopes = gDebugger.DebuggerView.Variables._list,
|
||||
innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
|
||||
globalScope = scopes.querySelectorAll(".variables-view-scope")[4],
|
||||
@ -90,7 +90,7 @@ function resumeAndFinish() {
|
||||
gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() {
|
||||
gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true);
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
|
||||
is(frames.querySelectorAll(".dbg-stackframe").length, 0,
|
||||
"Should have no frames.");
|
||||
|
@ -221,7 +221,7 @@ function resumeAndFinish() {
|
||||
gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() {
|
||||
gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true);
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
let frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
let frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
|
||||
is(frames.querySelectorAll(".dbg-stackframe").length, 0,
|
||||
"Should have no frames.");
|
||||
|
@ -57,9 +57,9 @@ function testFrameEval() {
|
||||
is(varT.querySelector(".value").getAttribute("value"), "\"Browser Debugger Watch Expressions Test\"",
|
||||
"Should have the right initial value for 't'.");
|
||||
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 5,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 5,
|
||||
"There should be 5 hidden nodes in the watch expressions container");
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
"There should be 0 visible nodes in the watch expressions container");
|
||||
|
||||
let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel");
|
||||
@ -330,9 +330,9 @@ function testExprDeletion(aVar, aTest, aCallback, aArgResult,
|
||||
}
|
||||
|
||||
function test1(scope) {
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 5,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 5,
|
||||
"There should be 5 hidden nodes in the watch expressions container");
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
"There should be 0 visible nodes in the watch expressions container");
|
||||
|
||||
ok(scope, "There should be a wach expressions scope in the variables view");
|
||||
@ -361,9 +361,9 @@ function test1(scope) {
|
||||
}
|
||||
|
||||
function test2(scope) {
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 5,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 5,
|
||||
"There should be 5 hidden nodes in the watch expressions container");
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
"There should be 0 visible nodes in the watch expressions container");
|
||||
|
||||
ok(scope, "There should be a wach expressions scope in the variables view");
|
||||
@ -392,9 +392,9 @@ function test2(scope) {
|
||||
}
|
||||
|
||||
function test3(scope) {
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 4,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 4,
|
||||
"There should be 4 hidden nodes in the watch expressions container");
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
"There should be 0 visible nodes in the watch expressions container");
|
||||
|
||||
ok(scope, "There should be a wach expressions scope in the variables view");
|
||||
@ -419,9 +419,9 @@ function test3(scope) {
|
||||
}
|
||||
|
||||
function test4(scope) {
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 3,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 3,
|
||||
"There should be 3 hidden nodes in the watch expressions container");
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
"There should be 0 visible nodes in the watch expressions container");
|
||||
|
||||
ok(scope, "There should be a wach expressions scope in the variables view");
|
||||
@ -442,9 +442,9 @@ function test4(scope) {
|
||||
}
|
||||
|
||||
function test5(scope) {
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 2,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 2,
|
||||
"There should be 2 hidden nodes in the watch expressions container");
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
"There should be 0 visible nodes in the watch expressions container");
|
||||
|
||||
ok(scope, "There should be a wach expressions scope in the variables view");
|
||||
@ -461,9 +461,9 @@ function test5(scope) {
|
||||
}
|
||||
|
||||
function test6(scope) {
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 1,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 1,
|
||||
"There should be 1 hidden nodes in the watch expressions container");
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
"There should be 0 visible nodes in the watch expressions container");
|
||||
|
||||
ok(scope, "There should be a wach expressions scope in the variables view");
|
||||
@ -476,9 +476,9 @@ function test6(scope) {
|
||||
}
|
||||
|
||||
function test7(scope) {
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 0,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 0,
|
||||
"There should be 0 hidden nodes in the watch expressions container");
|
||||
is(gWatch._container._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
|
||||
"There should be 0 visible nodes in the watch expressions container");
|
||||
|
||||
is(scope, undefined, "There should be no watch expressions scope available.");
|
||||
|
@ -315,7 +315,7 @@ function prepareVariables(aCallback)
|
||||
gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list,
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list,
|
||||
scopes = gDebugger.DebuggerView.Variables._list,
|
||||
innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
|
||||
mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
|
||||
|
@ -251,7 +251,7 @@ function prepareVariables(aCallback)
|
||||
gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list,
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list,
|
||||
scopes = gDebugger.DebuggerView.Variables._list,
|
||||
innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
|
||||
mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
|
||||
|
@ -215,7 +215,7 @@ function prepareVariables(aCallback)
|
||||
gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list,
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list,
|
||||
scopes = gDebugger.DebuggerView.Variables._list,
|
||||
innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
|
||||
mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
|
||||
|
@ -185,7 +185,7 @@ function prepareVariables(aCallback)
|
||||
gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list,
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list,
|
||||
scopes = gDebugger.DebuggerView.Variables._list,
|
||||
innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
|
||||
mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
|
||||
|
@ -185,7 +185,7 @@ function prepareVariables(aCallback)
|
||||
gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list,
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list,
|
||||
scopes = gDebugger.DebuggerView.Variables._list,
|
||||
innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
|
||||
mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
|
||||
|
@ -255,7 +255,7 @@ function prepareVariables(aCallback)
|
||||
gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list,
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list,
|
||||
scopes = gDebugger.DebuggerView.Variables._list,
|
||||
innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
|
||||
mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
|
||||
|
@ -60,7 +60,7 @@ function testVariablesExpand()
|
||||
gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
var frames = gDebugger.DebuggerView.StackFrames._container._list,
|
||||
var frames = gDebugger.DebuggerView.StackFrames.widget._list,
|
||||
scopes = gDebugger.DebuggerView.Variables._list,
|
||||
innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
|
||||
mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
|
||||
|
@ -117,35 +117,35 @@ function testScriptSearching() {
|
||||
ok(gEditor.getCaretPosition().line == 8 &&
|
||||
gEditor.getCaretPosition().col == 2 + token.length,
|
||||
"The editor didn't jump to the correct token. (6)");
|
||||
isnot(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
isnot(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should not display a notice that matches are found.");
|
||||
|
||||
write(":13#" + token);
|
||||
ok(gEditor.getCaretPosition().line == 8 &&
|
||||
gEditor.getCaretPosition().col == 2 + token.length,
|
||||
"The editor didn't jump to the correct token. (7)");
|
||||
isnot(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
isnot(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should not display a notice that matches are found.");
|
||||
|
||||
write(":#" + token);
|
||||
ok(gEditor.getCaretPosition().line == 8 &&
|
||||
gEditor.getCaretPosition().col == 2 + token.length,
|
||||
"The editor didn't jump to the correct token. (8)");
|
||||
isnot(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
isnot(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should not display a notice that matches are found.");
|
||||
|
||||
write("::#" + token);
|
||||
ok(gEditor.getCaretPosition().line == 8 &&
|
||||
gEditor.getCaretPosition().col == 2 + token.length,
|
||||
"The editor didn't jump to the correct token. (9)");
|
||||
isnot(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
isnot(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should not display a notice that matches are found.");
|
||||
|
||||
write(":::#" + token);
|
||||
ok(gEditor.getCaretPosition().line == 8 &&
|
||||
gEditor.getCaretPosition().col == 2 + token.length,
|
||||
"The editor didn't jump to the correct token. (10)");
|
||||
isnot(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
isnot(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should not display a notice that matches are found.");
|
||||
|
||||
|
||||
@ -153,35 +153,35 @@ function testScriptSearching() {
|
||||
ok(gEditor.getCaretPosition().line == 8 &&
|
||||
gEditor.getCaretPosition().col == 2 + token.length,
|
||||
"The editor didn't jump to the correct token. (6)");
|
||||
isnot(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
isnot(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should not display a notice that matches are found.");
|
||||
|
||||
write("#" + token + ":13");
|
||||
ok(gEditor.getCaretPosition().line == 8 &&
|
||||
gEditor.getCaretPosition().col == 2 + token.length,
|
||||
"The editor didn't jump to the correct token. (7)");
|
||||
isnot(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
isnot(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should not display a notice that matches are found.");
|
||||
|
||||
write("#" + token + ":");
|
||||
ok(gEditor.getCaretPosition().line == 8 &&
|
||||
gEditor.getCaretPosition().col == 2 + token.length,
|
||||
"The editor didn't jump to the correct token. (8)");
|
||||
isnot(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
isnot(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should not display a notice that matches are found.");
|
||||
|
||||
write("#" + token + "::");
|
||||
ok(gEditor.getCaretPosition().line == 8 &&
|
||||
gEditor.getCaretPosition().col == 2 + token.length,
|
||||
"The editor didn't jump to the correct token. (9)");
|
||||
isnot(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
isnot(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should not display a notice that matches are found.");
|
||||
|
||||
write("#" + token + ":::");
|
||||
ok(gEditor.getCaretPosition().line == 8 &&
|
||||
gEditor.getCaretPosition().col == 2 + token.length,
|
||||
"The editor didn't jump to the correct token. (10)");
|
||||
isnot(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
isnot(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should not display a notice that matches are found.");
|
||||
|
||||
|
||||
@ -189,14 +189,14 @@ function testScriptSearching() {
|
||||
ok(gEditor.getCaretPosition().line == 8 &&
|
||||
gEditor.getCaretPosition().col == 2 + token.length,
|
||||
"The editor didn't remain at the correct token. (11)");
|
||||
isnot(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
isnot(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should not display a notice that matches are found.");
|
||||
|
||||
write("#__i do not exist__");
|
||||
ok(gEditor.getCaretPosition().line == 8 &&
|
||||
gEditor.getCaretPosition().col == 2 + token.length,
|
||||
"The editor didn't remain at the correct token. (12)");
|
||||
isnot(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
isnot(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should not display a notice that matches are found.");
|
||||
|
||||
|
||||
@ -205,7 +205,7 @@ function testScriptSearching() {
|
||||
ok(gEditor.getCaretPosition().line == 2 &&
|
||||
gEditor.getCaretPosition().col == 44 + token.length,
|
||||
"The editor didn't jump to the correct token. (12.1)");
|
||||
isnot(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
isnot(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should not display a notice that matches are found.");
|
||||
|
||||
clear();
|
||||
@ -213,14 +213,14 @@ function testScriptSearching() {
|
||||
ok(gEditor.getCaretPosition().line == 2 &&
|
||||
gEditor.getCaretPosition().col == 44 + token.length,
|
||||
"The editor shouldn't jump to another token. (12.2)");
|
||||
isnot(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
isnot(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should not display a notice that matches are found.");
|
||||
|
||||
EventUtils.sendKey("ENTER", gDebugger);
|
||||
ok(gEditor.getCaretPosition().line == 2 &&
|
||||
gEditor.getCaretPosition().col == 44 + token.length,
|
||||
"The editor shouldn't jump to another token. (12.3)");
|
||||
isnot(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
isnot(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should not display a notice that matches are found.");
|
||||
|
||||
|
||||
@ -266,7 +266,7 @@ function testScriptSearching() {
|
||||
"The editor didn't remain at the correct token. (19)");
|
||||
is(gSources.visibleItems.length, 1,
|
||||
"Not all the scripts are shown after the search. (20)");
|
||||
isnot(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
isnot(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should not display a notice that matches are found.");
|
||||
|
||||
closeDebuggerAndFinish();
|
||||
|
@ -195,7 +195,7 @@ function fourthSearch(i, string, token) {
|
||||
gEditor.getCaretPosition().col == 8 + token.length + i,
|
||||
"The editor didn't remain at the correct token. (6)");
|
||||
|
||||
is(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
is(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should display a notice that no scripts match the searched token.");
|
||||
is(gSources.visibleItems.length, 0,
|
||||
"No scripts should be displayed in the scripts container after a bogus search.");
|
||||
@ -207,7 +207,7 @@ function fourthSearch(i, string, token) {
|
||||
gEditor.getCaretPosition().col == 8 + token.length + i,
|
||||
"The editor didn't remain at the correct token. (7)");
|
||||
|
||||
isnot(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
isnot(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should not display a notice after the searchbox was emptied.");
|
||||
is(gSources.visibleItems.length, 2,
|
||||
"Not all the scripts are shown after the searchbox was emptied.");
|
||||
@ -226,7 +226,7 @@ function noMatchingSourcesSingleCharCheck(token, i) {
|
||||
gEditor.getCaretPosition().col == 8 + token.length + i,
|
||||
"The editor didn't remain at the correct token. (8)");
|
||||
|
||||
is(gSources._container.getAttribute("label"), noMatchingSources,
|
||||
is(gSources.widget.getAttribute("label"), noMatchingSources,
|
||||
"The scripts container should display a notice after no matches are found.");
|
||||
is(gSources.visibleItems.length, 0,
|
||||
"No scripts should be shown after no matches are found.");
|
||||
|
@ -67,9 +67,9 @@ function testScriptSearching() {
|
||||
}
|
||||
|
||||
function firstSearch() {
|
||||
is(gSearchView._container._list.childNodes.length, 0,
|
||||
is(gSearchView.widget._list.childNodes.length, 0,
|
||||
"The global search pane shouldn't have any child nodes yet.");
|
||||
is(gSearchView._container._parent.hidden, true,
|
||||
is(gSearchView.widget._parent.hidden, true,
|
||||
"The global search pane shouldn't be visible yet.");
|
||||
is(gSearchView._splitter.hidden, true,
|
||||
"The global search pane splitter shouldn't be visible yet.");
|
||||
@ -183,9 +183,9 @@ function firstSearch() {
|
||||
}
|
||||
|
||||
function secondSearch() {
|
||||
isnot(gSearchView._container._list.childNodes.length, 0,
|
||||
isnot(gSearchView.widget._list.childNodes.length, 0,
|
||||
"The global search pane should have some child nodes from the previous search.");
|
||||
is(gSearchView._container._parent.hidden, false,
|
||||
is(gSearchView.widget._parent.hidden, false,
|
||||
"The global search pane should be visible from the previous search.");
|
||||
is(gSearchView._splitter.hidden, false,
|
||||
"The global search pane splitter should be visible from the previous search.");
|
||||
@ -289,9 +289,9 @@ function secondSearch() {
|
||||
function testClearView() {
|
||||
gSearchView.clearView();
|
||||
|
||||
is(gSearchView._container._list.childNodes.length, 0,
|
||||
is(gSearchView.widget._list.childNodes.length, 0,
|
||||
"The global search pane shouldn't have any child nodes after clearView().");
|
||||
is(gSearchView._container._parent.hidden, true,
|
||||
is(gSearchView.widget._parent.hidden, true,
|
||||
"The global search pane shouldn't be visible after clearView().");
|
||||
is(gSearchView._splitter.hidden, true,
|
||||
"The global search pane splitter shouldn't be visible after clearView().");
|
||||
|
@ -67,9 +67,9 @@ function testScriptSearching() {
|
||||
}
|
||||
|
||||
function doSearch() {
|
||||
is(gSearchView._container._list.childNodes.length, 0,
|
||||
is(gSearchView.widget._list.childNodes.length, 0,
|
||||
"The global search pane shouldn't have any child nodes yet.");
|
||||
is(gSearchView._container._parent.hidden, true,
|
||||
is(gSearchView.widget._parent.hidden, true,
|
||||
"The global search pane shouldn't be visible yet.");
|
||||
is(gSearchView._splitter.hidden, true,
|
||||
"The global search pane splitter shouldn't be visible yet.");
|
||||
@ -89,9 +89,9 @@ function doSearch() {
|
||||
is(gSources.visibleItems.length, 2,
|
||||
"Not all the scripts are shown after the global search.");
|
||||
|
||||
isnot(gSearchView._container._list.childNodes.length, 0,
|
||||
isnot(gSearchView.widget._list.childNodes.length, 0,
|
||||
"The global search pane should be visible now.");
|
||||
isnot(gSearchView._container._parent.hidden, true,
|
||||
isnot(gSearchView.widget._parent.hidden, true,
|
||||
"The global search pane should be visible now.");
|
||||
isnot(gSearchView._splitter.hidden, true,
|
||||
"The global search pane splitter should be visible now.");
|
||||
@ -231,9 +231,9 @@ function testSearchTokenEmpty() {
|
||||
is(gSources.visibleItems.length, 2,
|
||||
"Not all the correct scripts are shown after the search. (5)");
|
||||
|
||||
is(gSearchView._container._list.childNodes.length, 0,
|
||||
is(gSearchView.widget._list.childNodes.length, 0,
|
||||
"The global search pane shouldn't have any child nodes after clear().");
|
||||
is(gSearchView._container._parent.hidden, true,
|
||||
is(gSearchView.widget._parent.hidden, true,
|
||||
"The global search pane shouldn't be visible after clear().");
|
||||
is(gSearchView._splitter.hidden, true,
|
||||
"The global search pane splitter shouldn't be visible after clear().");
|
||||
|
@ -67,9 +67,9 @@ function testScriptSearching() {
|
||||
}
|
||||
|
||||
function doSearch() {
|
||||
is(gSearchView._container._list.childNodes.length, 0,
|
||||
is(gSearchView.widget._list.childNodes.length, 0,
|
||||
"The global search pane shouldn't have any child nodes yet.");
|
||||
is(gSearchView._container._parent.hidden, true,
|
||||
is(gSearchView.widget._parent.hidden, true,
|
||||
"The global search pane shouldn't be visible yet.");
|
||||
is(gSearchView._splitter.hidden, true,
|
||||
"The global search pane splitter shouldn't be visible yet.");
|
||||
@ -89,9 +89,9 @@ function doSearch() {
|
||||
is(gSources.visibleItems.length, 2,
|
||||
"Not all the scripts are shown after the global search.");
|
||||
|
||||
isnot(gSearchView._container._list.childNodes.length, 0,
|
||||
isnot(gSearchView.widget._list.childNodes.length, 0,
|
||||
"The global search pane should be visible now.");
|
||||
isnot(gSearchView._container._parent.hidden, true,
|
||||
isnot(gSearchView.widget._parent.hidden, true,
|
||||
"The global search pane should be visible now.");
|
||||
isnot(gSearchView._splitter.hidden, true,
|
||||
"The global search pane splitter should be visible now.");
|
||||
@ -114,9 +114,9 @@ function testLocationChange()
|
||||
info("Still attached to the tab.");
|
||||
|
||||
executeSoon(function() {
|
||||
is(gSearchView._container._list.childNodes.length, 0,
|
||||
is(gSearchView.widget._list.childNodes.length, 0,
|
||||
"The global search pane shouldn't have any child nodes after a page navigation.");
|
||||
is(gSearchView._container._parent.hidden, true,
|
||||
is(gSearchView.widget._parent.hidden, true,
|
||||
"The global search pane shouldn't be visible after a page navigation.");
|
||||
is(gSearchView._splitter.hidden, true,
|
||||
"The global search pane splitter shouldn't be visible after a page navigation.");
|
||||
|
@ -65,7 +65,7 @@ function testScriptSearching() {
|
||||
}
|
||||
|
||||
function doSearch() {
|
||||
is(gSearchView._container._parent.hidden, true,
|
||||
is(gSearchView.widget._parent.hidden, true,
|
||||
"The global search pane shouldn't be visible yet.");
|
||||
|
||||
gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) {
|
||||
@ -89,7 +89,7 @@ function doSearch() {
|
||||
|
||||
function testFocusLost()
|
||||
{
|
||||
is(gSearchView._container._parent.hidden, false,
|
||||
is(gSearchView.widget._parent.hidden, false,
|
||||
"The global search pane should be visible after a search.");
|
||||
|
||||
gDebugger.addEventListener("Debugger:GlobalSearch:ViewCleared", function _onEvent(aEvent) {
|
||||
@ -112,7 +112,7 @@ function testFocusLost()
|
||||
}
|
||||
|
||||
function reshowSearch() {
|
||||
is(gSearchView._container._parent.hidden, true,
|
||||
is(gSearchView.widget._parent.hidden, true,
|
||||
"The global search pane shouldn't be visible after the search was stopped.");
|
||||
|
||||
gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) {
|
||||
@ -136,7 +136,7 @@ function reshowSearch() {
|
||||
|
||||
function testEscape()
|
||||
{
|
||||
is(gSearchView._container._parent.hidden, false,
|
||||
is(gSearchView.widget._parent.hidden, false,
|
||||
"The global search pane should be visible after a re-search.");
|
||||
|
||||
gDebugger.addEventListener("Debugger:GlobalSearch:ViewCleared", function _onEvent(aEvent) {
|
||||
@ -160,7 +160,7 @@ function testEscape()
|
||||
|
||||
function finalCheck()
|
||||
{
|
||||
is(gSearchView._container._parent.hidden, true,
|
||||
is(gSearchView.widget._parent.hidden, true,
|
||||
"The global search pane shouldn't be visible after the search was escaped.");
|
||||
|
||||
closeDebuggerAndFinish();
|
||||
|
@ -484,12 +484,12 @@ function clickAndSwitch() {
|
||||
}
|
||||
});
|
||||
|
||||
ok(gFilteredSources._container._parent.querySelectorAll(".results-panel-item")[0]
|
||||
ok(gFilteredSources.widget._parent.querySelectorAll(".results-panel-item")[0]
|
||||
.classList.contains("results-panel-item"),
|
||||
"The first visible item target isn't the correct one.");
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
gFilteredSources._container._parent.querySelectorAll(".results-panel-item")[0],
|
||||
gFilteredSources.widget._parent.querySelectorAll(".results-panel-item")[0],
|
||||
gDebugger);
|
||||
}
|
||||
|
||||
@ -571,12 +571,12 @@ function clickAndSwitchAgain() {
|
||||
}
|
||||
});
|
||||
|
||||
ok(gFilteredSources._container._parent.querySelectorAll(".results-panel-item")[2]
|
||||
ok(gFilteredSources.widget._parent.querySelectorAll(".results-panel-item")[2]
|
||||
.classList.contains("results-panel-item"),
|
||||
"The first visible item target isn't the correct one.");
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
gFilteredSources._container._parent.querySelectorAll(".results-panel-item")[2],
|
||||
gFilteredSources.widget._parent.querySelectorAll(".results-panel-item")[2],
|
||||
gDebugger);
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ function addScriptAndCheckOrder(method, callback) {
|
||||
let sv = gDebugger.SourceUtils;
|
||||
let vs = gDebugger.DebuggerView.Sources;
|
||||
vs.empty();
|
||||
vs._container.removeEventListener("select", vs._onScriptsChange, false);
|
||||
vs.widget.removeEventListener("select", vs._onScriptsChange, false);
|
||||
|
||||
let urls = [
|
||||
{ href: "ici://some.address.com/random/", leaf: "subrandom/" },
|
||||
|
@ -97,7 +97,7 @@ function testSelectLine() {
|
||||
});
|
||||
});
|
||||
|
||||
let frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
let frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
let childNodes = frames.childNodes;
|
||||
|
||||
is(frames.querySelectorAll(".dbg-stackframe").length, 4,
|
||||
|
@ -103,7 +103,7 @@ function testHitBreakpoint() {
|
||||
|
||||
activeThread.addOneTimeListener("framesadded", function (aEvent, aPacket) {
|
||||
// Make sure that we have JavaScript stack frames.
|
||||
let frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
let frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
let childNodes = frames.childNodes;
|
||||
|
||||
is(frames.querySelectorAll(".dbg-stackframe").length, 1,
|
||||
@ -142,7 +142,7 @@ function testToggleOnPause() {
|
||||
"The debugger's editor should have the JS source displayed.");
|
||||
|
||||
// Make sure that we have coffee script stack frames.
|
||||
let frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
let frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
let childNodes = frames.childNodes;
|
||||
|
||||
is(frames.querySelectorAll(".dbg-stackframe").length, 1,
|
||||
|
@ -24,7 +24,7 @@ function testSimpleCall() {
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
let frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
let frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
let childNodes = frames.childNodes;
|
||||
|
||||
is(gDebugger.DebuggerController.activeThread.state, "paused",
|
||||
|
@ -24,7 +24,7 @@ function testEvalCall() {
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
let frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
let frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
let childNodes = frames.childNodes;
|
||||
|
||||
is(gDebugger.DebuggerController.activeThread.state, "paused",
|
||||
|
@ -26,7 +26,7 @@ function testRecurse() {
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
let frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
let frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
let pageSize = gDebugger.gCallStackPageSize;
|
||||
let recurseLimit = gDebuggee.gRecurseLimit;
|
||||
let childNodes = frames.childNodes;
|
||||
|
@ -24,7 +24,7 @@ function testEvalCallResume() {
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
|
||||
let frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
let frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
let childNodes = frames.childNodes;
|
||||
|
||||
is(gDebugger.DebuggerController.activeThread.state, "paused",
|
||||
|
@ -51,7 +51,7 @@ function test() {
|
||||
|
||||
function testRecurse()
|
||||
{
|
||||
let frames = gDebugger.DebuggerView.StackFrames._container._list;
|
||||
let frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
||||
let childNodes = frames.childNodes;
|
||||
|
||||
is(frames.querySelectorAll(".dbg-stackframe").length, 4,
|
||||
|
@ -553,9 +553,6 @@ NetMonitorController.NetworkEventsHandler = new NetworkEventsHandler();
|
||||
* Export some properties to the global scope for easier access.
|
||||
*/
|
||||
Object.defineProperties(window, {
|
||||
"create": {
|
||||
get: function() ViewHelpers.create
|
||||
},
|
||||
"gNetwork": {
|
||||
get: function() NetMonitorController.NetworkEventsHandler
|
||||
}
|
||||
|
@ -270,20 +270,20 @@ function RequestsMenuView() {
|
||||
this._byType = this._byType.bind(this);
|
||||
}
|
||||
|
||||
create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
|
||||
/**
|
||||
* Initialization function, called when the network monitor is started.
|
||||
*/
|
||||
initialize: function() {
|
||||
dumpn("Initializing the RequestsMenuView");
|
||||
|
||||
this.node = new SideMenuWidget($("#requests-menu-contents"), false);
|
||||
this.widget = new SideMenuWidget($("#requests-menu-contents"), false);
|
||||
this._summary = $("#request-menu-network-summary");
|
||||
|
||||
this.node.maintainSelectionVisible = false;
|
||||
this.node.autoscrollWithAppendedItems = true;
|
||||
this.widget.maintainSelectionVisible = false;
|
||||
this.widget.autoscrollWithAppendedItems = true;
|
||||
|
||||
this.node.addEventListener("select", this._onSelect, false);
|
||||
this.widget.addEventListener("select", this._onSelect, false);
|
||||
window.addEventListener("resize", this._onResize, false);
|
||||
},
|
||||
|
||||
@ -293,7 +293,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
destroy: function() {
|
||||
dumpn("Destroying the SourcesView");
|
||||
|
||||
this.node.removeEventListener("select", this._onSelect, false);
|
||||
this.widget.removeEventListener("select", this._onSelect, false);
|
||||
window.removeEventListener("resize", this._onResize, false);
|
||||
},
|
||||
|
||||
@ -496,10 +496,10 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Predicates used when filtering items.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* The filtered menu item.
|
||||
* @param object aItem
|
||||
* The filtered item.
|
||||
* @return boolean
|
||||
* True if the menu item should be visible, false otherwise.
|
||||
* True if the item should be visible, false otherwise.
|
||||
*/
|
||||
_onHtml: function({ attachment: { mimeType } })
|
||||
mimeType && mimeType.contains("/html"),
|
||||
@ -544,10 +544,10 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Predicates used when sorting items.
|
||||
*
|
||||
* @param MenuItem aFirst
|
||||
* The first menu item used in the comparison.
|
||||
* @param MenuItem aSecond
|
||||
* The second menu item used in the comparison.
|
||||
* @param object aFirst
|
||||
* The first item used in the comparison.
|
||||
* @param object aSecond
|
||||
* The second item used in the comparison.
|
||||
* @return number
|
||||
* -1 to sort aFirst to a lower index than aSecond
|
||||
* 0 to leave aFirst and aSecond unchanged with respect to each other
|
||||
@ -768,7 +768,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Updates the information displayed in a network request item view.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* @param object aItem
|
||||
* The network request item in this container.
|
||||
* @param string aKey
|
||||
* The type of information that is to be updated.
|
||||
@ -817,7 +817,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Creates a waterfall representing timing information in a network request item view.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* @param object aItem
|
||||
* The network request item in this container.
|
||||
* @param object aTimings
|
||||
* An object containing timing information.
|
||||
@ -1066,8 +1066,8 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
/**
|
||||
* Function called each time a network request item is removed.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* The corresponding menu item.
|
||||
* @param object aItem
|
||||
* The corresponding item.
|
||||
*/
|
||||
_onRequestItemRemoved: function(aItem) {
|
||||
dumpn("Finalizing network request item: " + aItem);
|
||||
@ -1173,7 +1173,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
* empty set.
|
||||
*
|
||||
* @param array aItemsArray
|
||||
* @return MenuItem
|
||||
* @return object
|
||||
*/
|
||||
_getOldestRequest: function(aItemsArray) {
|
||||
if (!aItemsArray.length) {
|
||||
@ -1188,7 +1188,7 @@ create({ constructor: RequestsMenuView, proto: MenuContainer.prototype }, {
|
||||
* empty set.
|
||||
*
|
||||
* @param array aItemsArray
|
||||
* @return MenuItem
|
||||
* @return object
|
||||
*/
|
||||
_getNewestRequest: function(aItemsArray) {
|
||||
if (!aItemsArray.length) {
|
||||
@ -1246,26 +1246,26 @@ NetworkDetailsView.prototype = {
|
||||
initialize: function() {
|
||||
dumpn("Initializing the RequestsMenuView");
|
||||
|
||||
this.node = $("#details-pane");
|
||||
this.widget = $("#details-pane");
|
||||
|
||||
this._headers = new VariablesView($("#all-headers"),
|
||||
Object.create(GENERIC_VARIABLES_VIEW_SETTINGS, {
|
||||
emptyText: { value: L10N.getStr("headersEmptyText"), enumerable: true },
|
||||
searchPlaceholder: { value: L10N.getStr("headersFilterText"), enumerable: true }
|
||||
Heritage.extend(GENERIC_VARIABLES_VIEW_SETTINGS, {
|
||||
emptyText: L10N.getStr("headersEmptyText"),
|
||||
searchPlaceholder: L10N.getStr("headersFilterText")
|
||||
}));
|
||||
this._cookies = new VariablesView($("#all-cookies"),
|
||||
Object.create(GENERIC_VARIABLES_VIEW_SETTINGS, {
|
||||
emptyText: { value: L10N.getStr("cookiesEmptyText"), enumerable: true },
|
||||
searchPlaceholder: { value: L10N.getStr("cookiesFilterText"), enumerable: true }
|
||||
Heritage.extend(GENERIC_VARIABLES_VIEW_SETTINGS, {
|
||||
emptyText: L10N.getStr("cookiesEmptyText"),
|
||||
searchPlaceholder: L10N.getStr("cookiesFilterText")
|
||||
}));
|
||||
this._params = new VariablesView($("#request-params"),
|
||||
Object.create(GENERIC_VARIABLES_VIEW_SETTINGS, {
|
||||
emptyText: { value: L10N.getStr("paramsEmptyText"), enumerable: true },
|
||||
searchPlaceholder: { value: L10N.getStr("paramsFilterText"), enumerable: true }
|
||||
Heritage.extend(GENERIC_VARIABLES_VIEW_SETTINGS, {
|
||||
emptyText: L10N.getStr("paramsEmptyText"),
|
||||
searchPlaceholder: L10N.getStr("paramsFilterText")
|
||||
}));
|
||||
this._json = new VariablesView($("#response-content-json"),
|
||||
Object.create(GENERIC_VARIABLES_VIEW_SETTINGS, {
|
||||
searchPlaceholder: { value: L10N.getStr("jsonFilterText"), enumerable: true }
|
||||
Heritage.extend(GENERIC_VARIABLES_VIEW_SETTINGS, {
|
||||
searchPlaceholder: L10N.getStr("jsonFilterText")
|
||||
}));
|
||||
|
||||
this._paramsQueryString = L10N.getStr("paramsQueryString");
|
||||
@ -1276,7 +1276,7 @@ NetworkDetailsView.prototype = {
|
||||
this._requestCookies = L10N.getStr("requestCookies");
|
||||
this._responseCookies = L10N.getStr("responseCookies");
|
||||
|
||||
$("tabpanels", this.node).addEventListener("select", this._onTabSelect);
|
||||
$("tabpanels", this.widget).addEventListener("select", this._onTabSelect);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1334,7 +1334,7 @@ NetworkDetailsView.prototype = {
|
||||
*/
|
||||
_onTabSelect: function() {
|
||||
let { src, populated } = this._dataSrc || {};
|
||||
let tab = this.node.selectedIndex;
|
||||
let tab = this.widget.selectedIndex;
|
||||
|
||||
// Make sure the data source is valid and don't populate the same tab twice.
|
||||
if (!src || populated[tab]) {
|
||||
|
@ -270,12 +270,12 @@ ProfileUI.prototype = {
|
||||
|
||||
function SidebarView(el) {
|
||||
EventEmitter.decorate(this);
|
||||
this.node = new SideMenuWidget(el);
|
||||
this.widget = new SideMenuWidget(el);
|
||||
}
|
||||
|
||||
ViewHelpers.create({ constructor: SidebarView, proto: MenuContainer.prototype }, {
|
||||
SidebarView.prototype = Heritage.extend(WidgetMethods, {
|
||||
getItemByProfile: function (profile) {
|
||||
return this.orderedItems.filter((item) => item.attachment.uid === profile.uid)[0];
|
||||
return this.getItemForPredicate(item => item.attachment.uid === profile.uid);
|
||||
},
|
||||
|
||||
setProfileState: function (profile, state) {
|
||||
@ -402,7 +402,7 @@ ProfilerPanel.prototype = {
|
||||
|
||||
this.controller = new ProfilerController(this.target);
|
||||
this.sidebar = new SidebarView(this.document.querySelector("#profiles-list"));
|
||||
this.sidebar.node.addEventListener("select", (ev) => {
|
||||
this.sidebar.widget.addEventListener("select", (ev) => {
|
||||
if (!ev.detail)
|
||||
return;
|
||||
|
||||
|
@ -17,20 +17,7 @@ this.EXPORTED_SYMBOLS = ["BreadcrumbsWidget"];
|
||||
|
||||
/**
|
||||
* A breadcrumb-like list of items.
|
||||
*
|
||||
* You can use this widget alone, but it works great with a MenuContainer!
|
||||
* In that case, you should never need to access the methods in the
|
||||
* BreadcrumbsWidget directly, use the wrapper MenuContainer instance instead.
|
||||
*
|
||||
* @see ViewHelpers.jsm
|
||||
*
|
||||
* function MyView() {
|
||||
* this.node = new BreadcrumbsWidget(document.querySelector(".my-node"));
|
||||
* }
|
||||
* ViewHelpers.create({ constructor: MyView, proto: MenuContainer.prototype }, {
|
||||
* myMethod: function() {},
|
||||
* ...
|
||||
* });
|
||||
* This widget should be used in tandem with the WidgetMethods in ViewHelpers.jsm
|
||||
*
|
||||
* @param nsIDOMNode aNode
|
||||
* The element associated with the widget.
|
||||
|
@ -21,20 +21,7 @@ this.EXPORTED_SYMBOLS = ["SideMenuWidget"];
|
||||
|
||||
/**
|
||||
* A simple side menu, with the ability of grouping menu items.
|
||||
*
|
||||
* You can use this widget alone, but it works great with a MenuContainer!
|
||||
* In that case, you should never need to access the methods in the
|
||||
* SideMenuWidget directly, use the wrapper MenuContainer instance instead.
|
||||
*
|
||||
* @see ViewHelpers.jsm
|
||||
*
|
||||
* function MyView() {
|
||||
* this.node = new SideMenuWidget(document.querySelector(".my-node"));
|
||||
* }
|
||||
* ViewHelpers.create({ constructor: MyView, proto: MenuContainer.prototype }, {
|
||||
* myMethod: function() {},
|
||||
* ...
|
||||
* });
|
||||
* This widget should be used in tandem with the WidgetMethods in ViewHelpers.jsm
|
||||
*
|
||||
* @param nsIDOMNode aNode
|
||||
* The element associated with the widget.
|
||||
|
@ -2051,7 +2051,7 @@ function Variable(aScope, aName, aDescriptor) {
|
||||
this._absoluteName = aScope.name + "[\"" + aName + "\"]";
|
||||
}
|
||||
|
||||
ViewHelpers.create({ constructor: Variable, proto: Scope.prototype }, {
|
||||
Variable.prototype = Heritage.extend(Scope.prototype, {
|
||||
/**
|
||||
* Whether this Scope should be prefetched when it is remoted.
|
||||
*/
|
||||
@ -2776,7 +2776,7 @@ function Property(aVar, aName, aDescriptor) {
|
||||
this._absoluteName = aVar._absoluteName + "[\"" + aName + "\"]";
|
||||
}
|
||||
|
||||
ViewHelpers.create({ constructor: Property, proto: Variable.prototype }, {
|
||||
Property.prototype = Heritage.extend(Variable.prototype, {
|
||||
/**
|
||||
* Initializes this property's id, view and binds event listeners.
|
||||
*
|
||||
|
@ -15,33 +15,35 @@ const PAGE_SIZE_ITEM_COUNT_RATIO = 5;
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["ViewHelpers", "MenuItem", "MenuContainer"];
|
||||
this.EXPORTED_SYMBOLS = ["Heritage", "ViewHelpers", "WidgetMethods"];
|
||||
|
||||
/**
|
||||
* Inheritance helpers from the addon SDK's core/heritage.
|
||||
* Remove these when all devtools are loadered.
|
||||
*/
|
||||
this.Heritage = {
|
||||
/**
|
||||
* @see extend in sdk/core/heritage.
|
||||
*/
|
||||
extend: function(aPrototype, aProperties = {}) {
|
||||
return Object.create(aPrototype, this.getOwnPropertyDescriptors(aProperties));
|
||||
},
|
||||
|
||||
/**
|
||||
* @see getOwnPropertyDescriptors in sdk/core/heritage.
|
||||
*/
|
||||
getOwnPropertyDescriptors: function(aObject) {
|
||||
return Object.getOwnPropertyNames(aObject).reduce((aDescriptor, aName) => {
|
||||
aDescriptor[aName] = Object.getOwnPropertyDescriptor(aObject, aName);
|
||||
return aDescriptor;
|
||||
}, {});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Helpers for creating and messaging between UI components.
|
||||
*/
|
||||
this.ViewHelpers = {
|
||||
/**
|
||||
* Sugar for prototypal inheritance using Object.create.
|
||||
* Creates a new object with the specified prototype object and properties.
|
||||
*
|
||||
* @param object aObject
|
||||
* An object containing the following properties:
|
||||
* - constructor: the function to configure the prototype for
|
||||
* - proto: the prototype to extend
|
||||
* @param object aProperties
|
||||
* The properties extending the prototype.
|
||||
*/
|
||||
create: function({ constructor, proto }, aProperties = {}) {
|
||||
let descriptors = {
|
||||
constructor: { value: constructor }
|
||||
};
|
||||
for (let name in aProperties) {
|
||||
descriptors[name] = Object.getOwnPropertyDescriptor(aProperties, name);
|
||||
}
|
||||
constructor.prototype = Object.create(proto, descriptors);
|
||||
},
|
||||
|
||||
/**
|
||||
* Convenience method, dispatching a custom event.
|
||||
*
|
||||
@ -69,7 +71,6 @@ this.ViewHelpers = {
|
||||
|
||||
/**
|
||||
* Helper delegating some of the DOM attribute methods of a node to a widget.
|
||||
* @see MenuContainer constructor
|
||||
*
|
||||
* @param object aWidget
|
||||
* The widget to assign the methods to.
|
||||
@ -84,7 +85,6 @@ this.ViewHelpers = {
|
||||
|
||||
/**
|
||||
* Helper delegating some of the DOM event methods of a node to a widget.
|
||||
* @see MenuContainer constructor
|
||||
*
|
||||
* @param object aWidget
|
||||
* The widget to assign the methods to.
|
||||
@ -346,7 +346,7 @@ ViewHelpers.Prefs.prototype = {
|
||||
};
|
||||
|
||||
/**
|
||||
* A generic MenuItem is used to describe elements present in a MenuContainer.
|
||||
* A generic Item is used to describe children present in a Widget.
|
||||
* The label, value and description properties are necessarily strings.
|
||||
* Iterable via "for (let childItem in parentItem) { }".
|
||||
*
|
||||
@ -354,11 +354,11 @@ ViewHelpers.Prefs.prototype = {
|
||||
* Some attached primitive/object.
|
||||
* @param nsIDOMNode | nsIDOMDocumentFragment | array aContents [optional]
|
||||
* A prebuilt node, or an array containing the following properties:
|
||||
* - aLabel: the label displayed in the container
|
||||
* - aLabel: the label displayed in the widget
|
||||
* - aValue: the actual internal value of the item
|
||||
* - aDescription: an optional description of the item
|
||||
*/
|
||||
this.MenuItem = function MenuItem(aAttachment, aContents = []) {
|
||||
function Item(aAttachment, aContents = []) {
|
||||
this.attachment = aAttachment;
|
||||
|
||||
// Allow the insertion of prebuilt nodes.
|
||||
@ -366,7 +366,7 @@ this.MenuItem = function MenuItem(aAttachment, aContents = []) {
|
||||
aContents instanceof Ci.nsIDOMDocumentFragment) {
|
||||
this._prebuiltTarget = aContents;
|
||||
}
|
||||
// Delegate the item view creation to a container widget.
|
||||
// Delegate the item view creation to a widget.
|
||||
else {
|
||||
let [aLabel, aValue, aDescription] = aContents;
|
||||
this._label = aLabel + "";
|
||||
@ -377,14 +377,14 @@ this.MenuItem = function MenuItem(aAttachment, aContents = []) {
|
||||
XPCOMUtils.defineLazyGetter(this, "_itemsByElement", () => new Map());
|
||||
};
|
||||
|
||||
MenuItem.prototype = {
|
||||
Item.prototype = {
|
||||
get label() this._label,
|
||||
get value() this._value,
|
||||
get description() this._description,
|
||||
get target() this._target,
|
||||
|
||||
/**
|
||||
* Immediately appends a child item to this menu item.
|
||||
* Immediately appends a child item to this item.
|
||||
*
|
||||
* @param nsIDOMNode aElement
|
||||
* An nsIDOMNode representing the child element to append.
|
||||
@ -392,12 +392,12 @@ MenuItem.prototype = {
|
||||
* Additional options or flags supported by this operation:
|
||||
* - attachment: some attached primitive/object for the item
|
||||
* - attributes: a batch of attributes set to the displayed element
|
||||
* - finalize: function invoked when the child node is removed
|
||||
* @return MenuItem
|
||||
* - finalize: function invoked when the child item is removed
|
||||
* @return Item
|
||||
* The item associated with the displayed element.
|
||||
*/
|
||||
append: function(aElement, aOptions = {}) {
|
||||
let item = new MenuItem(aOptions.attachment);
|
||||
let item = new Item(aOptions.attachment);
|
||||
|
||||
// Entangle the item with the newly inserted child node.
|
||||
this._entangleItem(item, this._target.appendChild(aElement));
|
||||
@ -415,9 +415,9 @@ MenuItem.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Immediately removes the specified child item from this menu item.
|
||||
* Immediately removes the specified child item from this item.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* @param Item aItem
|
||||
* The item associated with the element to remove.
|
||||
*/
|
||||
remove: function(aItem) {
|
||||
@ -431,8 +431,8 @@ MenuItem.prototype = {
|
||||
/**
|
||||
* Entangles an item (model) with a displayed node element (view).
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* The item describing the element.
|
||||
* @param Item aItem
|
||||
* The item describing a target element.
|
||||
* @param nsIDOMNode aElement
|
||||
* The element displaying the item.
|
||||
*/
|
||||
@ -444,8 +444,8 @@ MenuItem.prototype = {
|
||||
/**
|
||||
* Untangles an item (model) from a displayed node element (view).
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* The item describing the element.
|
||||
* @param Item aItem
|
||||
* The item describing a target element.
|
||||
*/
|
||||
_untangleItem: function(aItem) {
|
||||
if (aItem.finalize) {
|
||||
@ -463,8 +463,8 @@ MenuItem.prototype = {
|
||||
/**
|
||||
* Deletes an item from the its parent's storage maps.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* The item to forget.
|
||||
* @param Item aItem
|
||||
* The item describing a target element.
|
||||
*/
|
||||
_unlinkItem: function(aItem) {
|
||||
this._itemsByElement.delete(aItem._target);
|
||||
@ -494,16 +494,27 @@ MenuItem.prototype = {
|
||||
};
|
||||
|
||||
/**
|
||||
* A generic MenuContainer is used for displaying MenuItem instances.
|
||||
* Iterable via "for (let item in menuContainer) { }".
|
||||
* Some generic Widget methods handling Item instances.
|
||||
* Iterable via "for (let childItem in wrappedView) { }".
|
||||
*
|
||||
* Usage:
|
||||
* function MyView() {
|
||||
* this.widget = new MyWidget(document.querySelector(".my-node"));
|
||||
* }
|
||||
*
|
||||
* MyView.prototype = Heritage.extend(WidgetMethods, {
|
||||
* myMethod: function() {},
|
||||
* ...
|
||||
* });
|
||||
*
|
||||
* See https://gist.github.com/victorporof/5749386 for more details.
|
||||
*
|
||||
* Language:
|
||||
* - An "item" is an instance (or compatible interface) of a MenuItem.
|
||||
* - An "item" is an instance of an Item.
|
||||
* - An "element" or "node" is a nsIDOMNode.
|
||||
*
|
||||
* The element node or widget supplied to all instances of this container
|
||||
* can either be a <menulist>, or any other object interfacing the following
|
||||
* methods:
|
||||
* The supplied element node or widget can either be a <xul:menulist>, or any
|
||||
* other object interfacing the following methods:
|
||||
* - function:nsIDOMNode insertItemAt(aIndex:number, aLabel:string, aValue:string)
|
||||
* - function:nsIDOMNode getItemAtIndex(aIndex:number)
|
||||
* - function removeChild(aChild:nsIDOMNode)
|
||||
@ -521,25 +532,25 @@ MenuItem.prototype = {
|
||||
* - "keyPress" -> (aName:string, aEvent:KeyboardEvent)
|
||||
* - "mousePress" -> (aName:string, aEvent:MouseEvent)
|
||||
*/
|
||||
this.MenuContainer = function MenuContainer() {
|
||||
};
|
||||
|
||||
MenuContainer.prototype = {
|
||||
this.WidgetMethods = {
|
||||
/**
|
||||
* Sets the element node or widget associated with this container.
|
||||
* @param nsIDOMNode | object aWidget
|
||||
*/
|
||||
set node(aWidget) {
|
||||
this._container = aWidget;
|
||||
this._itemsByLabel = new Map(); // Can't use a WeakMap for itemsByLabel or
|
||||
this._itemsByValue = new Map(); // itemsByValue because keys are strings,
|
||||
this._itemsByElement = new Map(); // and itemsByElement needs to be iterable.
|
||||
this._stagedItems = [];
|
||||
set widget(aWidget) {
|
||||
this._widget = aWidget;
|
||||
|
||||
// Can't use WeakMaps for itemsByLabel or itemsByValue because
|
||||
// keys are strings, and itemsByElement needs to be iterable.
|
||||
XPCOMUtils.defineLazyGetter(this, "_itemsByLabel", () => new Map());
|
||||
XPCOMUtils.defineLazyGetter(this, "_itemsByValue", () => new Map());
|
||||
XPCOMUtils.defineLazyGetter(this, "_itemsByElement", () => new Map());
|
||||
XPCOMUtils.defineLazyGetter(this, "_stagedItems", () => []);
|
||||
|
||||
// Handle internal events emitted by the widget if necessary.
|
||||
if (ViewHelpers.isEventEmitter(this._container)) {
|
||||
this._container.on("keyPress", this._onWidgetKeyPress.bind(this));
|
||||
this._container.on("mousePress", this._onWidgetMousePress.bind(this));
|
||||
if (ViewHelpers.isEventEmitter(aWidget)) {
|
||||
aWidget.on("keyPress", this._onWidgetKeyPress.bind(this));
|
||||
aWidget.on("mousePress", this._onWidgetMousePress.bind(this));
|
||||
}
|
||||
},
|
||||
|
||||
@ -547,7 +558,7 @@ MenuContainer.prototype = {
|
||||
* Gets the element node or widget associated with this container.
|
||||
* @return nsIDOMNode | object
|
||||
*/
|
||||
get node() this._container,
|
||||
get widget() this._widget,
|
||||
|
||||
/**
|
||||
* Prepares an item to be added to this container. This allows, for example,
|
||||
@ -581,13 +592,13 @@ MenuContainer.prototype = {
|
||||
* - relaxed: true if this container should allow dupes & degenerates
|
||||
* - attachment: some attached primitive/object for the item
|
||||
* - attributes: a batch of attributes set to the displayed element
|
||||
* - finalize: function invokde when the item is untangled (removed)
|
||||
* @return MenuItem
|
||||
* - finalize: function invoked when the item is removed
|
||||
* @return Item
|
||||
* The item associated with the displayed element if an unstaged push,
|
||||
* undefined if the item was staged for a later commit.
|
||||
*/
|
||||
push: function(aContents, aOptions = {}) {
|
||||
let item = new MenuItem(aOptions.attachment, aContents);
|
||||
let item = new Item(aOptions.attachment, aContents);
|
||||
|
||||
// Batch the item to be added later.
|
||||
if (aOptions.staged) {
|
||||
@ -639,23 +650,23 @@ MenuContainer.prototype = {
|
||||
if (!selectedItem) {
|
||||
return false;
|
||||
}
|
||||
this._container.removeAttribute("notice");
|
||||
this._container.setAttribute("label", selectedItem._label);
|
||||
this._container.setAttribute("tooltiptext", selectedItem._value);
|
||||
this._widget.removeAttribute("notice");
|
||||
this._widget.setAttribute("label", selectedItem._label);
|
||||
this._widget.setAttribute("tooltiptext", selectedItem._value);
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Immediately removes the specified item from this container.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* @param Item aItem
|
||||
* The item associated with the element to remove.
|
||||
*/
|
||||
remove: function(aItem) {
|
||||
if (!aItem) {
|
||||
return;
|
||||
}
|
||||
this._container.removeChild(aItem._target);
|
||||
this._widget.removeChild(aItem._target);
|
||||
this._untangleItem(aItem);
|
||||
},
|
||||
|
||||
@ -674,11 +685,11 @@ MenuContainer.prototype = {
|
||||
*/
|
||||
empty: function() {
|
||||
this._preferredValue = this.selectedValue;
|
||||
this._container.selectedItem = null;
|
||||
this._container.removeAllItems();
|
||||
this._container.setAttribute("notice", this.emptyText);
|
||||
this._container.setAttribute("label", this.emptyText);
|
||||
this._container.removeAttribute("tooltiptext");
|
||||
this._widget.selectedItem = null;
|
||||
this._widget.removeAllItems();
|
||||
this._widget.setAttribute("notice", this.emptyText);
|
||||
this._widget.setAttribute("label", this.emptyText);
|
||||
this._widget.removeAttribute("tooltiptext");
|
||||
|
||||
for (let [, item] of this._itemsByElement) {
|
||||
this._untangleItem(item);
|
||||
@ -695,9 +706,9 @@ MenuContainer.prototype = {
|
||||
* current label to signal that it is unavailable and removes the tooltip.
|
||||
*/
|
||||
setUnavailable: function() {
|
||||
this._container.setAttribute("notice", this.unavailableText);
|
||||
this._container.setAttribute("label", this.unavailableText);
|
||||
this._container.removeAttribute("tooltiptext");
|
||||
this._widget.setAttribute("notice", this.unavailableText);
|
||||
this._widget.setAttribute("label", this.unavailableText);
|
||||
this._widget.removeAttribute("tooltiptext");
|
||||
},
|
||||
|
||||
/**
|
||||
@ -715,8 +726,7 @@ MenuContainer.prototype = {
|
||||
* Toggles all the items in this container hidden or visible.
|
||||
*
|
||||
* This does not change the default filtering predicate, so newly inserted
|
||||
* items will always be visible. Use MenuContainer.prototype.filterContents
|
||||
* if you care.
|
||||
* items will always be visible. Use WidgetMethods.filterContents if you care.
|
||||
*
|
||||
* @param boolean aVisibleFlag
|
||||
* Specifies the intended visibility.
|
||||
@ -762,10 +772,10 @@ MenuContainer.prototype = {
|
||||
/**
|
||||
* Visually swaps two items in this container.
|
||||
*
|
||||
* @param MenuItem aFirst
|
||||
* The first menu item to be swapped.
|
||||
* @param MenuItem aSecond
|
||||
* The second menu item to be swapped.
|
||||
* @param Item aFirst
|
||||
* The first item to be swapped.
|
||||
* @param Item aSecond
|
||||
* The second item to be swapped.
|
||||
*/
|
||||
swapItems: function(aFirst, aSecond) {
|
||||
if (aFirst == aSecond) { // We're just dandy, thank you.
|
||||
@ -792,7 +802,7 @@ MenuContainer.prototype = {
|
||||
let j = this._indexOfElement(secondTarget);
|
||||
|
||||
// 2. Remeber the selection index, to reselect an item, if necessary.
|
||||
let selectedTarget = this._container.selectedItem;
|
||||
let selectedTarget = this._widget.selectedItem;
|
||||
let selectedIndex = -1;
|
||||
if (selectedTarget == firstTarget) {
|
||||
selectedIndex = i;
|
||||
@ -801,8 +811,8 @@ MenuContainer.prototype = {
|
||||
}
|
||||
|
||||
// 3. Silently nuke both items, nobody needs to know about this.
|
||||
this._container.removeChild(firstTarget);
|
||||
this._container.removeChild(secondTarget);
|
||||
this._widget.removeChild(firstTarget);
|
||||
this._widget.removeChild(secondTarget);
|
||||
this._unlinkItem(aFirst);
|
||||
this._unlinkItem(aSecond);
|
||||
|
||||
@ -812,9 +822,9 @@ MenuContainer.prototype = {
|
||||
|
||||
// 5. Restore the previous selection, if necessary.
|
||||
if (selectedIndex == i) {
|
||||
this._container.selectedItem = aFirst._target;
|
||||
this._widget.selectedItem = aFirst._target;
|
||||
} else if (selectedIndex == j) {
|
||||
this._container.selectedItem = aSecond._target;
|
||||
this._widget.selectedItem = aSecond._target;
|
||||
}
|
||||
},
|
||||
|
||||
@ -822,9 +832,9 @@ MenuContainer.prototype = {
|
||||
* Visually swaps two items in this container at specific indices.
|
||||
*
|
||||
* @param number aFirst
|
||||
* The index of the first menu item to be swapped.
|
||||
* The index of the first item to be swapped.
|
||||
* @param number aSecond
|
||||
* The index of the second menu item to be swapped.
|
||||
* The index of the second item to be swapped.
|
||||
*/
|
||||
swapItemsAtIndices: function(aFirst, aSecond) {
|
||||
this.swapItems(this.getItemAtIndex(aFirst), this.getItemAtIndex(aSecond));
|
||||
@ -867,10 +877,10 @@ MenuContainer.prototype = {
|
||||
|
||||
/**
|
||||
* Retrieves the item associated with the selected element.
|
||||
* @return MenuItem
|
||||
* @return Item
|
||||
*/
|
||||
get selectedItem() {
|
||||
let selectedElement = this._container.selectedItem;
|
||||
let selectedElement = this._widget.selectedItem;
|
||||
if (selectedElement) {
|
||||
return this._itemsByElement.get(selectedElement);
|
||||
}
|
||||
@ -882,7 +892,7 @@ MenuContainer.prototype = {
|
||||
* @return number
|
||||
*/
|
||||
get selectedIndex() {
|
||||
let selectedElement = this._container.selectedItem;
|
||||
let selectedElement = this._widget.selectedItem;
|
||||
if (selectedElement) {
|
||||
return this._indexOfElement(selectedElement);
|
||||
}
|
||||
@ -894,7 +904,7 @@ MenuContainer.prototype = {
|
||||
* @return string
|
||||
*/
|
||||
get selectedLabel() {
|
||||
let selectedElement = this._container.selectedItem;
|
||||
let selectedElement = this._widget.selectedItem;
|
||||
if (selectedElement) {
|
||||
return this._itemsByElement.get(selectedElement)._label;
|
||||
}
|
||||
@ -906,7 +916,7 @@ MenuContainer.prototype = {
|
||||
* @return string
|
||||
*/
|
||||
get selectedValue() {
|
||||
let selectedElement = this._container.selectedItem;
|
||||
let selectedElement = this._widget.selectedItem;
|
||||
if (selectedElement) {
|
||||
return this._itemsByElement.get(selectedElement)._value;
|
||||
}
|
||||
@ -915,7 +925,7 @@ MenuContainer.prototype = {
|
||||
|
||||
/**
|
||||
* Selects the element with the entangled item in this container.
|
||||
* @param MenuItem | function aItem
|
||||
* @param Item | function aItem
|
||||
*/
|
||||
set selectedItem(aItem) {
|
||||
// A predicate is allowed to select a specific item.
|
||||
@ -926,7 +936,7 @@ MenuContainer.prototype = {
|
||||
|
||||
// A falsy item is allowed to invalidate the current selection.
|
||||
let targetElement = aItem ? aItem._target : null;
|
||||
let prevElement = this._container.selectedItem;
|
||||
let prevElement = this._widget.selectedItem;
|
||||
|
||||
// Make sure the currently selected item's target element is also focused.
|
||||
if (this.autoFocusOnSelection && targetElement) {
|
||||
@ -938,7 +948,7 @@ MenuContainer.prototype = {
|
||||
if (targetElement == prevElement) {
|
||||
return;
|
||||
}
|
||||
this._container.selectedItem = targetElement;
|
||||
this._widget.selectedItem = targetElement;
|
||||
ViewHelpers.dispatchEvent(targetElement || prevElement, "select", aItem);
|
||||
|
||||
// Updates this container to reflect the information provided by the
|
||||
@ -951,7 +961,7 @@ MenuContainer.prototype = {
|
||||
* @param number aIndex
|
||||
*/
|
||||
set selectedIndex(aIndex) {
|
||||
let targetElement = this._container.getItemAtIndex(aIndex);
|
||||
let targetElement = this._widget.getItemAtIndex(aIndex);
|
||||
if (targetElement) {
|
||||
this.selectedItem = this._itemsByElement.get(targetElement);
|
||||
return;
|
||||
@ -1049,7 +1059,7 @@ MenuContainer.prototype = {
|
||||
// command dispatcher mechanism has a relative node to work with.
|
||||
// If there's no selection, just select an item at a corresponding index
|
||||
// (e.g. the first item in this container if aDelta <= 1).
|
||||
let selectedElement = this._container.selectedItem;
|
||||
let selectedElement = this._widget.selectedItem;
|
||||
if (selectedElement) {
|
||||
selectedElement.focus();
|
||||
} else {
|
||||
@ -1104,7 +1114,7 @@ MenuContainer.prototype = {
|
||||
if (this._cachedCommandDispatcher) {
|
||||
return this._cachedCommandDispatcher;
|
||||
}
|
||||
let someElement = this._container.getItemAtIndex(0);
|
||||
let someElement = this._widget.getItemAtIndex(0);
|
||||
if (someElement) {
|
||||
let commandDispatcher = someElement.ownerDocument.commandDispatcher;
|
||||
return this._cachedCommandDispatcher = commandDispatcher;
|
||||
@ -1131,11 +1141,11 @@ MenuContainer.prototype = {
|
||||
*
|
||||
* @param number aIndex
|
||||
* The index used to identify the element.
|
||||
* @return MenuItem
|
||||
* @return Item
|
||||
* The matched item, or null if nothing is found.
|
||||
*/
|
||||
getItemAtIndex: function(aIndex) {
|
||||
return this.getItemForElement(this._container.getItemAtIndex(aIndex));
|
||||
return this.getItemForElement(this._widget.getItemAtIndex(aIndex));
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1143,7 +1153,7 @@ MenuContainer.prototype = {
|
||||
*
|
||||
* @param string aLabel
|
||||
* The label used to identify the element.
|
||||
* @return MenuItem
|
||||
* @return Item
|
||||
* The matched item, or null if nothing is found.
|
||||
*/
|
||||
getItemByLabel: function(aLabel) {
|
||||
@ -1155,7 +1165,7 @@ MenuContainer.prototype = {
|
||||
*
|
||||
* @param string aValue
|
||||
* The value used to identify the element.
|
||||
* @return MenuItem
|
||||
* @return Item
|
||||
* The matched item, or null if nothing is found.
|
||||
*/
|
||||
getItemByValue: function(aValue) {
|
||||
@ -1167,7 +1177,7 @@ MenuContainer.prototype = {
|
||||
*
|
||||
* @param nsIDOMNode aElement
|
||||
* The element used to identify the item.
|
||||
* @return MenuItem
|
||||
* @return Item
|
||||
* The matched item, or null if nothing is found.
|
||||
*/
|
||||
getItemForElement: function(aElement) {
|
||||
@ -1186,7 +1196,7 @@ MenuContainer.prototype = {
|
||||
*
|
||||
* @param function aPredicate
|
||||
* The first item which validates this predicate is returned
|
||||
* @return MenuItem
|
||||
* @return Item
|
||||
* The matched item, or null if nothing is found.
|
||||
*/
|
||||
getItemForPredicate: function(aPredicate, aOwner = this) {
|
||||
@ -1207,7 +1217,7 @@ MenuContainer.prototype = {
|
||||
/**
|
||||
* Finds the index of an item in the container.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* @param Item aItem
|
||||
* The item get the index for.
|
||||
* @return number
|
||||
* The index of the matched item, or -1 if nothing is found.
|
||||
@ -1225,11 +1235,8 @@ MenuContainer.prototype = {
|
||||
* The index of the matched element, or -1 if nothing is found.
|
||||
*/
|
||||
_indexOfElement: function(aElement) {
|
||||
let container = this._container;
|
||||
let itemCount = this._itemsByElement.size;
|
||||
|
||||
for (let i = 0; i < itemCount; i++) {
|
||||
if (container.getItemAtIndex(i) == aElement) {
|
||||
for (let i = 0; i < this._itemsByElement.size; i++) {
|
||||
if (this._widget.getItemAtIndex(i) == aElement) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@ -1237,7 +1244,25 @@ MenuContainer.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the list of labels in this container.
|
||||
* Gets the total number of items in this container.
|
||||
* @return number
|
||||
*/
|
||||
get itemCount() this._itemsByElement.size,
|
||||
|
||||
/**
|
||||
* Returns a list of items in this container, in no particular order.
|
||||
* @return array
|
||||
*/
|
||||
get items() {
|
||||
let items = [];
|
||||
for (let [, item] of this._itemsByElement) {
|
||||
items.push(item);
|
||||
}
|
||||
return items;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a list of labels in this container, in no particular order.
|
||||
* @return array
|
||||
*/
|
||||
get labels() {
|
||||
@ -1249,7 +1274,7 @@ MenuContainer.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the list of values in this container.
|
||||
* Returns a list of values in this container, in no particular order.
|
||||
* @return array
|
||||
*/
|
||||
get values() {
|
||||
@ -1261,16 +1286,19 @@ MenuContainer.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the total number of items in this container.
|
||||
* @return number
|
||||
* Returns a list of all the visible (non-hidden) items in this container,
|
||||
* in no particular order.
|
||||
* @return array
|
||||
*/
|
||||
get itemCount() this._itemsByElement.size,
|
||||
|
||||
/**
|
||||
* Gets the total number of visible (non-hidden) items in this container.
|
||||
* @return number
|
||||
*/
|
||||
get visibleItemsCount() this.visibleItems.length,
|
||||
get visibleItems() {
|
||||
let items = [];
|
||||
for (let [element, item] of this._itemsByElement) {
|
||||
if (!element.hidden) {
|
||||
items.push(item);
|
||||
}
|
||||
}
|
||||
return items;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a list of all items in this container, in the displayed order.
|
||||
@ -1302,21 +1330,6 @@ MenuContainer.prototype = {
|
||||
return items;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a list of all the visible (non-hidden) items in this container,
|
||||
* in no particular order.
|
||||
* @return array
|
||||
*/
|
||||
get visibleItems() {
|
||||
let items = [];
|
||||
for (let [element, item] of this._itemsByElement) {
|
||||
if (!element.hidden) {
|
||||
items.push(item);
|
||||
}
|
||||
}
|
||||
return items;
|
||||
},
|
||||
|
||||
/**
|
||||
* Specifies the required conditions for an item to be considered unique.
|
||||
* Possible values:
|
||||
@ -1330,10 +1343,10 @@ MenuContainer.prototype = {
|
||||
/**
|
||||
* Checks if an item is unique in this container.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* An object containing a label and a value property (at least).
|
||||
* @param Item aItem
|
||||
* The item for which to verify uniqueness.
|
||||
* @return boolean
|
||||
* True if the element is unique, false otherwise.
|
||||
* True if the item is unique, false otherwise.
|
||||
*/
|
||||
isUnique: function(aItem) {
|
||||
switch (this.uniquenessQualifier) {
|
||||
@ -1352,25 +1365,28 @@ MenuContainer.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if an item's label and value are eligible for this container.
|
||||
* Checks if an item is eligible for this container.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* An object containing a label and a value property (at least).
|
||||
* @param Item aItem
|
||||
* The item for which to verify eligibility.
|
||||
* @return boolean
|
||||
* True if the element is eligible, false otherwise.
|
||||
* True if the item is eligible, false otherwise.
|
||||
*/
|
||||
isEligible: function(aItem) {
|
||||
return aItem._prebuiltTarget || (this.isUnique(aItem) &&
|
||||
aItem._label != "undefined" && aItem._label != "null" &&
|
||||
aItem._value != "undefined" && aItem._value != "null");
|
||||
let isUnique = this.isUnique(aItem);
|
||||
let isPrebuilt = !!aItem._prebuiltTarget;
|
||||
let isDegenerate = aItem._label == "undefined" || aItem._label == "null" ||
|
||||
aItem._value == "undefined" || aItem._value == "null";
|
||||
|
||||
return isPrebuilt || (isUnique && !isDegenerate);
|
||||
},
|
||||
|
||||
/**
|
||||
* Finds the expected item index in this container based on the default
|
||||
* sort predicate.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* The item to get the expected index for.
|
||||
* @param Item aItem
|
||||
* The item for which to get the expected index.
|
||||
* @return number
|
||||
* The expected item index.
|
||||
*/
|
||||
@ -1390,7 +1406,7 @@ MenuContainer.prototype = {
|
||||
*
|
||||
* @param number aIndex
|
||||
* The position in the container intended for this item.
|
||||
* @param MenuItem aItem
|
||||
* @param Item aItem
|
||||
* An object containing a label and a value property (at least).
|
||||
* @param object aOptions [optional]
|
||||
* Additional options or flags supported by this operation:
|
||||
@ -1398,7 +1414,7 @@ MenuContainer.prototype = {
|
||||
* - relaxed: true if this container should allow dupes & degenerates
|
||||
* - attributes: a batch of attributes set to the displayed element
|
||||
* - finalize: function when the item is untangled (removed)
|
||||
* @return MenuItem
|
||||
* @return Item
|
||||
* The item associated with the displayed element, null if rejected.
|
||||
*/
|
||||
_insertItemAt: function(aIndex, aItem, aOptions = {}) {
|
||||
@ -1408,7 +1424,7 @@ MenuContainer.prototype = {
|
||||
}
|
||||
|
||||
// Entangle the item with the newly inserted node.
|
||||
this._entangleItem(aItem, this._container.insertItemAt(aIndex,
|
||||
this._entangleItem(aItem, this._widget.insertItemAt(aIndex,
|
||||
aItem._prebuiltTarget || aItem._label, // Allow the insertion of prebuilt nodes.
|
||||
aItem._value,
|
||||
aItem._description,
|
||||
@ -1435,8 +1451,8 @@ MenuContainer.prototype = {
|
||||
/**
|
||||
* Entangles an item (model) with a displayed node element (view).
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* The item describing the element.
|
||||
* @param Item aItem
|
||||
* The item describing a target element.
|
||||
* @param nsIDOMNode aElement
|
||||
* The element displaying the item.
|
||||
*/
|
||||
@ -1450,8 +1466,8 @@ MenuContainer.prototype = {
|
||||
/**
|
||||
* Untangles an item (model) from a displayed node element (view).
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* The item describing the element.
|
||||
* @param Item aItem
|
||||
* The item describing a target element.
|
||||
*/
|
||||
_untangleItem: function(aItem) {
|
||||
if (aItem.finalize) {
|
||||
@ -1469,8 +1485,8 @@ MenuContainer.prototype = {
|
||||
/**
|
||||
* Deletes an item from the its parent's storage maps.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* The item to forget.
|
||||
* @param Item aItem
|
||||
* The item describing a target element.
|
||||
*/
|
||||
_unlinkItem: function(aItem) {
|
||||
this._itemsByLabel.delete(aItem._label);
|
||||
@ -1535,10 +1551,10 @@ MenuContainer.prototype = {
|
||||
* The predicate used when filtering items. By default, all items in this
|
||||
* view are visible.
|
||||
*
|
||||
* @param MenuItem aItem
|
||||
* The filtered menu item.
|
||||
* @param Item aItem
|
||||
* The item passing through the filter.
|
||||
* @return boolean
|
||||
* True if the menu item should be visible, false otherwise.
|
||||
* True if the item should be visible, false otherwise.
|
||||
*/
|
||||
_currentFilterPredicate: function(aItem) {
|
||||
return true;
|
||||
@ -1548,10 +1564,10 @@ MenuContainer.prototype = {
|
||||
* The predicate used when sorting items. By default, items in this view
|
||||
* are sorted by their label.
|
||||
*
|
||||
* @param MenuItem aFirst
|
||||
* The first menu item used in the comparison.
|
||||
* @param MenuItem aSecond
|
||||
* The second menu item used in the comparison.
|
||||
* @param Item aFirst
|
||||
* The first item used in the comparison.
|
||||
* @param Item aSecond
|
||||
* The second item used in the comparison.
|
||||
* @return number
|
||||
* -1 to sort aFirst to a lower index than aSecond
|
||||
* 0 to leave aFirst and aSecond unchanged with respect to each other
|
||||
@ -1561,11 +1577,7 @@ MenuContainer.prototype = {
|
||||
return +(aFirst._label.toLowerCase() > aSecond._label.toLowerCase());
|
||||
},
|
||||
|
||||
_container: null,
|
||||
_stagedItems: null,
|
||||
_itemsByLabel: null,
|
||||
_itemsByValue: null,
|
||||
_itemsByElement: null,
|
||||
_widget: null,
|
||||
_preferredValue: null,
|
||||
_cachedCommandDispatcher: null
|
||||
};
|
||||
@ -1573,8 +1585,8 @@ MenuContainer.prototype = {
|
||||
/**
|
||||
* A generator-iterator over all the items in this container.
|
||||
*/
|
||||
MenuItem.prototype.__iterator__ =
|
||||
MenuContainer.prototype.__iterator__ = function() {
|
||||
Item.prototype.__iterator__ =
|
||||
WidgetMethods.__iterator__ = function() {
|
||||
for (let [, item] of this._itemsByElement) {
|
||||
yield item;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "WebConsoleUtils",
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||
"resource://gre/modules/commonjs/sdk/core/promise.js");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ViewHelpers",
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Heritage",
|
||||
"resource:///modules/devtools/ViewHelpers.jsm");
|
||||
|
||||
let Telemetry = devtools.require("devtools/shared/telemetry");
|
||||
@ -525,7 +525,7 @@ function BrowserConsole()
|
||||
this._telemetry = new Telemetry();
|
||||
}
|
||||
|
||||
ViewHelpers.create({ constructor: BrowserConsole, proto: WebConsole.prototype },
|
||||
BrowserConsole.prototype = Heritage.extend(WebConsole.prototype,
|
||||
{
|
||||
_browserConsole: true,
|
||||
_bc_init: null,
|
||||
|
Loading…
Reference in New Issue
Block a user