Bug 806748 - Intermittent browser_dbg_location-changes-blank.js | The source editor not have any text displayed. - Got 546, expected 0, r=rcampbell

This commit is contained in:
Victor Porof 2012-11-02 09:32:31 +02:00
parent e0fab10863
commit e0501e8f86
2 changed files with 80 additions and 44 deletions

View File

@ -13,43 +13,61 @@ var gDebugger = null;
function test()
{
let scriptShown = false;
let framesAdded = false;
debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
gTab = aTab;
gDebuggee = aDebuggee;
gPane = aPane;
gDebugger = gPane.contentWindow;
testSimpleCall();
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
framesAdded = true;
runTest();
});
gDebuggee.simpleCall();
});
window.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
let url = aEvent.detail.url;
if (url.indexOf("browser_dbg_stack") != -1) {
scriptShown = true;
window.removeEventListener(aEvent.type, _onEvent);
runTest();
}
});
function runTest()
{
if (scriptShown && framesAdded) {
Services.tm.currentThread.dispatch({ run: testSimpleCall }, 0);
}
}
}
function testSimpleCall() {
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
Services.tm.currentThread.dispatch({
run: function() {
var frames = gDebugger.DebuggerView.StackFrames._container._list,
childNodes = frames.childNodes;
var frames = gDebugger.DebuggerView.StackFrames._container._list,
childNodes = frames.childNodes;
is(gDebugger.DebuggerController.activeThread.state, "paused",
"Should only be getting stack frames while paused.");
is(gDebugger.DebuggerController.activeThread.state, "paused",
"Should only be getting stack frames while paused.");
is(frames.querySelectorAll(".dbg-stackframe").length, 1,
"Should have only one frame.");
is(frames.querySelectorAll(".dbg-stackframe").length, 1,
"Should have only one frame.");
is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length,
"All children should be frames.");
is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length,
"All children should be frames.");
isnot(gDebugger.DebuggerView.Sources.selectedValue, null,
"There should be a selected script.");
isnot(gDebugger.editor.getText().length, 0,
"The source editor should have some text displayed.");
isnot(gDebugger.DebuggerView.Sources.selectedValue, null,
"There should be a selected script.");
isnot(gDebugger.editor.getText().length, 0,
"The source editor should have some text displayed.");
isnot(gDebugger.editor.getText(), gDebugger.L10N.getStr("loadingText"),
"The source editor text should not be 'Loading...'");
testLocationChange();
}
}, 0);
});
gDebuggee.simpleCall();
testLocationChange();
}
function testLocationChange()

View File

@ -13,43 +13,61 @@ var gDebugger = null;
function test()
{
let scriptShown = false;
let framesAdded = false;
debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
gTab = aTab;
gDebuggee = aDebuggee;
gPane = aPane;
gDebugger = gPane.contentWindow;
testSimpleCall();
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
framesAdded = true;
runTest();
});
gDebuggee.simpleCall();
});
window.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
let url = aEvent.detail.url;
if (url.indexOf("browser_dbg_stack") != -1) {
scriptShown = true;
window.removeEventListener(aEvent.type, _onEvent);
runTest();
}
});
function runTest()
{
if (scriptShown && framesAdded) {
Services.tm.currentThread.dispatch({ run: testSimpleCall }, 0);
}
}
}
function testSimpleCall() {
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
Services.tm.currentThread.dispatch({
run: function() {
var frames = gDebugger.DebuggerView.StackFrames._container._list,
childNodes = frames.childNodes;
var frames = gDebugger.DebuggerView.StackFrames._container._list,
childNodes = frames.childNodes;
is(gDebugger.DebuggerController.activeThread.state, "paused",
"Should only be getting stack frames while paused.");
is(gDebugger.DebuggerController.activeThread.state, "paused",
"Should only be getting stack frames while paused.");
is(frames.querySelectorAll(".dbg-stackframe").length, 1,
"Should have only one frame.");
is(frames.querySelectorAll(".dbg-stackframe").length, 1,
"Should have only one frame.");
is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length,
"All children should be frames.");
is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length,
"All children should be frames.");
isnot(gDebugger.DebuggerView.Sources.selectedValue, null,
"There should be a selected script.");
isnot(gDebugger.editor.getText().length, 0,
"The source editor should have some text displayed.");
isnot(gDebugger.DebuggerView.Sources.selectedValue, null,
"There should be a selected script.");
isnot(gDebugger.editor.getText().length, 0,
"The source editor should have some text displayed.");
isnot(gDebugger.editor.getText(), gDebugger.L10N.getStr("loadingText"),
"The source editor text should not be 'Loading...'");
testLocationChange();
}
}, 0);
});
gDebuggee.simpleCall();
testLocationChange();
}
function testLocationChange()