blob: 841362b7a64daeeff2982a029fd235129dbd82a4 (
plain)
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
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Evaluating two functions on the same line and checking for correct hit count
* for both of them in CodeMirror's gutter.
*/
const TAB_URL = EXAMPLE_URL + "doc_same-line-functions.html";
const CODE_URL = "code_same-line-functions.js";
let gTab, gPanel, gDebugger;
let gEditor;
function test() {
Task.async(function* () {
yield pushPrefs(["devtools.debugger.tracer", true]);
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gEditor = gDebugger.DebuggerView.editor;
Task.async(function* () {
yield waitForSourceShown(gPanel, CODE_URL);
yield startTracing(gPanel);
clickButton();
yield waitForClientEvents(aPanel, "traces");
testHitCounts();
yield stopTracing(gPanel);
yield popPrefs();
yield closeDebuggerAndFinish(gPanel);
})();
});
})().catch(e => {
ok(false, "Got an error: " + e.message + "\n" + e.stack);
});
}
function clickButton() {
sendMouseClickToTab(gTab, content.document.querySelector("button"));
}
function testHitCounts() {
let marker = gEditor.getMarker(0, 'hit-counts');
is(marker.innerHTML, "1\u00D7|1\u00D7",
"Both functions should be hit only once.");
}
registerCleanupFunction(function() {
gTab = null;
gPanel = null;
gDebugger = null;
gEditor = null;
});
|