mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 728926 - Intermittent failure in browser_dbg_script-switching.js | The correct script was loaded initially. | The first script is displayed. r=rcampbell
This commit is contained in:
parent
0987eca51d
commit
5844d7a3bc
@ -20,62 +20,80 @@ var gScripts = null;
|
||||
|
||||
function test()
|
||||
{
|
||||
let scriptShown = false;
|
||||
let framesAdded = false;
|
||||
|
||||
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
|
||||
gTab = aTab;
|
||||
gDebuggee = aDebuggee;
|
||||
gPane = aPane;
|
||||
gDebugger = gPane.debuggerWindow;
|
||||
|
||||
testScriptsDisplay();
|
||||
gPane.activeThread.addOneTimeListener("framesadded", function() {
|
||||
framesAdded = true;
|
||||
runTest();
|
||||
});
|
||||
|
||||
gDebuggee.firstCall();
|
||||
});
|
||||
|
||||
window.addEventListener("Debugger:ScriptShown", function _onEvent(aEvent) {
|
||||
let url = aEvent.detail.url;
|
||||
if (url.indexOf("-02.js") != -1) {
|
||||
scriptShown = true;
|
||||
window.removeEventListener(aEvent.type, _onEvent);
|
||||
runTest();
|
||||
}
|
||||
});
|
||||
|
||||
function runTest()
|
||||
{
|
||||
if (scriptShown && framesAdded) {
|
||||
Services.tm.currentThread.dispatch({ run: testScriptsDisplay }, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function testScriptsDisplay() {
|
||||
gPane.activeThread.addOneTimeListener("framesadded", function() {
|
||||
Services.tm.currentThread.dispatch({ run: function() {
|
||||
gScripts = gDebugger.DebuggerView.Scripts._scripts;
|
||||
gScripts = gDebugger.DebuggerView.Scripts._scripts;
|
||||
|
||||
is(gDebugger.StackFrames.activeThread.state, "paused",
|
||||
"Should only be getting stack frames while paused.");
|
||||
is(gDebugger.StackFrames.activeThread.state, "paused",
|
||||
"Should only be getting stack frames while paused.");
|
||||
|
||||
is(gScripts.itemCount, 2, "Found the expected number of scripts.");
|
||||
is(gScripts.itemCount, 2, "Found the expected number of scripts.");
|
||||
|
||||
for (let i = 0; i < gScripts.itemCount; i++) {
|
||||
info("label: " + i + " " + gScripts.getItemAtIndex(i).getAttribute("label"));
|
||||
}
|
||||
for (let i = 0; i < gScripts.itemCount; i++) {
|
||||
info("label: " + i + " " + gScripts.getItemAtIndex(i).getAttribute("label"));
|
||||
}
|
||||
|
||||
let label1 = "test-script-switching-01.js";
|
||||
let label2 = "test-script-switching-02.js";
|
||||
let label1 = "test-script-switching-01.js";
|
||||
let label2 = "test-script-switching-02.js";
|
||||
|
||||
ok(gDebugger.DebuggerView.Scripts.contains(EXAMPLE_URL +
|
||||
label1), "First script url is incorrect.");
|
||||
ok(gDebugger.DebuggerView.Scripts.contains(EXAMPLE_URL +
|
||||
label2), "Second script url is incorrect.");
|
||||
ok(gDebugger.DebuggerView.Scripts.contains(EXAMPLE_URL +
|
||||
label1), "First script url is incorrect.");
|
||||
ok(gDebugger.DebuggerView.Scripts.contains(EXAMPLE_URL +
|
||||
label2), "Second script url is incorrect.");
|
||||
|
||||
ok(gDebugger.DebuggerView.Scripts.containsLabel(
|
||||
label1), "First script label is incorrect.");
|
||||
ok(gDebugger.DebuggerView.Scripts.containsLabel(
|
||||
label2), "Second script label is incorrect.");
|
||||
ok(gDebugger.DebuggerView.Scripts.containsLabel(
|
||||
label1), "First script label is incorrect.");
|
||||
ok(gDebugger.DebuggerView.Scripts.containsLabel(
|
||||
label2), "Second script label is incorrect.");
|
||||
|
||||
ok(gDebugger.editor.getText().search(/debugger/) != -1,
|
||||
"The correct script was loaded initially.");
|
||||
|
||||
ok(gDebugger.editor.getText().search(/debugger/) != -1,
|
||||
"The correct script was loaded initially.");
|
||||
is(gDebugger.editor.getDebugLocation(), 5,
|
||||
"editor debugger location is correct.");
|
||||
|
||||
is(gDebugger.editor.getDebugLocation(), 5,
|
||||
"editor debugger location is correct.");
|
||||
|
||||
gDebugger.editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
|
||||
function onChange() {
|
||||
gDebugger.editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
|
||||
onChange);
|
||||
testSwitchPaused();
|
||||
});
|
||||
gScripts.selectedIndex = 0;
|
||||
gDebugger.SourceScripts.onChange({ target: gScripts });
|
||||
}}, 0);
|
||||
window.addEventListener("Debugger:ScriptShown", function _onEvent(aEvent) {
|
||||
let url = aEvent.detail.url;
|
||||
if (url.indexOf("-01.js") != -1) {
|
||||
window.removeEventListener(aEvent.type, _onEvent);
|
||||
testSwitchPaused();
|
||||
}
|
||||
});
|
||||
|
||||
gDebuggee.firstCall();
|
||||
gDebugger.DebuggerView.Scripts.selectScript(EXAMPLE_URL + label1);
|
||||
}
|
||||
|
||||
function testSwitchPaused()
|
||||
@ -90,14 +108,16 @@ function testSwitchPaused()
|
||||
"editor debugger location has been cleared.");
|
||||
|
||||
gDebugger.StackFrames.activeThread.resume(function() {
|
||||
gDebugger.editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
|
||||
function onSecondChange() {
|
||||
gDebugger.editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
|
||||
onSecondChange);
|
||||
testSwitchRunning();
|
||||
window.addEventListener("Debugger:ScriptShown", function _onEvent(aEvent) {
|
||||
let url = aEvent.detail.url;
|
||||
if (url.indexOf("-02.js") != -1) {
|
||||
window.removeEventListener(aEvent.type, _onEvent);
|
||||
testSwitchRunning();
|
||||
}
|
||||
});
|
||||
gScripts.selectedIndex = 1;
|
||||
gDebugger.SourceScripts.onChange({ target: gScripts });
|
||||
|
||||
gDebugger.DebuggerView.Scripts.selectScript(EXAMPLE_URL +
|
||||
"test-script-switching-02.js");
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user