-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1050123 - Profiler Treeview: If arrow is the target of double cli…
…ck, children toggle three times (on click #1, click #2 and dblclick events). Ignore the dblclick on arrow. r=vp UltraBlame original commit: b5345b8463af3140d9c4ca24c40503c35901de93
- Loading branch information
Showing
3 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
browser/devtools/profiler/test/browser_profiler_tree-abstract-04.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
let { AbstractTreeItem } = Cu.import("resource:///modules/devtools/AbstractTreeItem.jsm", {}); | ||
let { Heritage } = Cu.import("resource:///modules/devtools/ViewHelpers.jsm", {}); | ||
|
||
let test = Task.async(function*() { | ||
let container = document.createElement("vbox"); | ||
gBrowser.selectedBrowser.parentNode.appendChild(container); | ||
|
||
|
||
|
||
let treeRoot = new MyCustomTreeItem(gDataSrc, { parent: null }); | ||
treeRoot.attachTo(container); | ||
|
||
let originalTreeRootExpanded = treeRoot.expanded; | ||
info("Double clicking on the root item arrow and waiting for focus event."); | ||
let receivedFocusEvent = treeRoot.once("focus"); | ||
EventUtils.sendMouseEvent({ type: "dblclick" }, treeRoot.target.querySelector(".arrow")); | ||
|
||
yield receivedFocusEvent; | ||
is(treeRoot.expanded, originalTreeRootExpanded, | ||
"A double click on the arrow was ignored."); | ||
|
||
container.remove(); | ||
finish(); | ||
}); | ||
|
||
function MyCustomTreeItem(dataSrc, properties) { | ||
AbstractTreeItem.call(this, properties); | ||
this.itemDataSrc = dataSrc; | ||
} | ||
|
||
MyCustomTreeItem.prototype = Heritage.extend(AbstractTreeItem.prototype, { | ||
_displaySelf: function(document, arrowNode) { | ||
let node = document.createElement("hbox"); | ||
node.MozMarginStart = (this.level * 10) + "px"; | ||
node.appendChild(arrowNode); | ||
node.appendChild(document.createTextNode(this.itemDataSrc.label)); | ||
return node; | ||
}, | ||
_populateSelf: function(children) { | ||
for (let childDataSrc of this.itemDataSrc.children) { | ||
children.push(new MyCustomTreeItem(childDataSrc, { | ||
parent: this, | ||
level: this.level + 1 | ||
})); | ||
} | ||
} | ||
}); | ||
|
||
let gDataSrc = { | ||
label: "root", | ||
children: [{ | ||
label: "foo", | ||
children: [] | ||
}, { | ||
label: "bar", | ||
children: [{ | ||
label: "baz", | ||
children: [] | ||
}] | ||
}] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters