|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 const BASE = "http://example.com/browser/browser/devtools/profiler/test/"; |
|
5 const URL = BASE + "mock_profiler_bug_834878_page.html"; |
|
6 const SCRIPT = BASE + "mock_profiler_bug_834878_script.js"; |
|
7 |
|
8 function test() { |
|
9 waitForExplicitFinish(); |
|
10 |
|
11 setUp(URL, function onSetUp(tab, browser, panel) { |
|
12 let data = { uri: SCRIPT, line: 5, isChrome: false }; |
|
13 |
|
14 panel.displaySource(data).then(function onOpen() { |
|
15 let target = TargetFactory.forTab(tab); |
|
16 let dbg = gDevTools.getToolbox(target).getPanel("jsdebugger"); |
|
17 let view = dbg.panelWin.DebuggerView; |
|
18 |
|
19 is(view.Sources.selectedValue, data.uri, "URI is different"); |
|
20 is(view.editor.getCursor().line, data.line - 1, "Line is different"); |
|
21 |
|
22 // Test the case where script is already loaded. |
|
23 view.editor.setCursor({ line: 1, ch: 1 }); |
|
24 gDevTools.showToolbox(target, "jsprofiler").then(function () { |
|
25 panel.displaySource(data).then(function onOpenAgain() { |
|
26 is(view.editor.getCursor().line, data.line - 1, |
|
27 "Line is different"); |
|
28 tearDown(tab); |
|
29 }); |
|
30 }); |
|
31 }); |
|
32 }); |
|
33 } |