forked from jsantell/firefox-patches
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1109764-fix-button-toggle-perf.patch
81 lines (73 loc) · 3.13 KB
/
1109764-fix-button-toggle-perf.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
From 93237a917f02d06faaca916c2afbff601667a38a Mon Sep 17 00:00:00 2001
From: Jordan Santell <[email protected]>
Date: Wed, 10 Dec 2014 14:32:08 -0800
Subject: [PATCH] Bug 1109764 - Correctly toggle the details view buttons in
the performance tool. r=vp
---
browser/devtools/performance/test/browser_perf-details.js | 14 ++++++--------
browser/devtools/performance/views/details.js | 8 ++++++++
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/browser/devtools/performance/test/browser_perf-details.js b/browser/devtools/performance/test/browser_perf-details.js
index 8dfc289..aad78e3 100644
--- a/browser/devtools/performance/test/browser_perf-details.js
+++ b/browser/devtools/performance/test/browser_perf-details.js
@@ -20,27 +20,25 @@ function spawnTest () {
// Select waterfall view
viewChanged = onceSpread(DetailsView, EVENTS.DETAILS_VIEW_SELECTED);
command($("toolbarbutton[data-view='waterfall']"));
[_, viewName] = yield viewChanged;
is(viewName, "waterfall", "DETAILS_VIEW_SELECTED fired with view name");
checkViews(DetailsView, doc, "waterfall");
-
yield teardown(panel);
finish();
}
function checkViews (DetailsView, doc, currentView) {
- for (let viewName in DetailsView.views) {
- let view = DetailsView.views[viewName].el;
- let button = doc.querySelector("toolbarbutton[data-view='" + viewName + "']");
+ for (let viewName in DetailsView.viewIndexes) {
+ let button = doc.querySelector(`toolbarbutton[data-view="${viewName}"]`);
+ is(DetailsView.el.selectedIndex, DetailsView.viewIndexes[currentView],
+ `DetailsView correctly has ${currentView} selected.`);
if (viewName === currentView) {
- ok(!view.getAttribute("hidden"), view + " view displayed");
- ok(button.getAttribute("checked"), view + " button checked");
+ ok(button.getAttribute("checked"), `${viewName} button checked`);
} else {
- ok(view.getAttribute("hidden"), view + " view hidden");
- ok(!button.getAttribute("checked"), view + " button not checked");
+ ok(!button.getAttribute("checked"), `${viewName} button not checked`);
}
}
}
diff --git a/browser/devtools/performance/views/details.js b/browser/devtools/performance/views/details.js
index 42953ec..4c4f3bf 100644
--- a/browser/devtools/performance/views/details.js
+++ b/browser/devtools/performance/views/details.js
@@ -40,16 +40,24 @@ let DetailsView = {
* Select one of the DetailView's subviews to be rendered,
* hiding the others.
*
* @params {String} selectedView
* Name of the view to be shown.
*/
selectView: function (selectedView) {
this.el.selectedIndex = this.viewIndexes[selectedView];
+
+ for (let button of $$("toolbarbutton[data-view]", $("#details-toolbar"))) {
+ if (button.getAttribute("data-view") === selectedView)
+ button.setAttribute("checked", true);
+ else
+ button.removeAttribute("checked");
+ }
+
this.emit(EVENTS.DETAILS_VIEW_SELECTED, selectedView);
},
/**
* Called when a view button is clicked.
*/
_onViewToggle: function (e) {
this.selectView(e.target.getAttribute("data-view"));
--
1.8.4.2