2012-07-15 00:06:02 -07:00
|
|
|
/* vim:set ts=2 sw=2 sts=2 et: */
|
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Make sure that changing the tab location URL to a page with no scripts works.
|
|
|
|
*/
|
|
|
|
|
|
|
|
var gPane = null;
|
|
|
|
var gTab = null;
|
|
|
|
var gDebuggee = null;
|
|
|
|
var gDebugger = null;
|
|
|
|
|
|
|
|
function test()
|
|
|
|
{
|
2012-11-02 00:32:31 -07:00
|
|
|
let scriptShown = false;
|
|
|
|
let framesAdded = false;
|
|
|
|
|
2012-07-15 00:06:02 -07:00
|
|
|
debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
|
|
|
|
gTab = aTab;
|
|
|
|
gDebuggee = aDebuggee;
|
|
|
|
gPane = aPane;
|
|
|
|
gDebugger = gPane.contentWindow;
|
|
|
|
|
2012-11-02 00:32:31 -07:00
|
|
|
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();
|
|
|
|
}
|
2012-07-15 00:06:02 -07:00
|
|
|
});
|
2012-11-02 00:32:31 -07:00
|
|
|
|
|
|
|
function runTest()
|
|
|
|
{
|
|
|
|
if (scriptShown && framesAdded) {
|
|
|
|
Services.tm.currentThread.dispatch({ run: testSimpleCall }, 0);
|
|
|
|
}
|
|
|
|
}
|
2012-07-15 00:06:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function testSimpleCall() {
|
2012-11-02 00:32:31 -07:00
|
|
|
var frames = gDebugger.DebuggerView.StackFrames._container._list,
|
|
|
|
childNodes = frames.childNodes;
|
2012-07-15 00:06:02 -07:00
|
|
|
|
2012-11-02 00:32:31 -07:00
|
|
|
is(gDebugger.DebuggerController.activeThread.state, "paused",
|
|
|
|
"Should only be getting stack frames while paused.");
|
2012-07-15 00:06:02 -07:00
|
|
|
|
2012-11-02 00:32:31 -07:00
|
|
|
is(frames.querySelectorAll(".dbg-stackframe").length, 1,
|
|
|
|
"Should have only one frame.");
|
2012-07-15 00:06:02 -07:00
|
|
|
|
2012-11-02 00:32:31 -07:00
|
|
|
is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length,
|
|
|
|
"All children should be frames.");
|
2012-07-15 00:06:02 -07:00
|
|
|
|
2012-11-02 00:32:31 -07:00
|
|
|
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...'");
|
2012-07-15 00:06:02 -07:00
|
|
|
|
2012-11-02 00:32:31 -07:00
|
|
|
testLocationChange();
|
2012-07-15 00:06:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function testLocationChange()
|
|
|
|
{
|
|
|
|
gDebugger.DebuggerController.activeThread.resume(function() {
|
|
|
|
gDebugger.DebuggerController.client.addOneTimeListener("tabNavigated", function(aEvent, aPacket) {
|
|
|
|
ok(true, "tabNavigated event was fired.");
|
2012-08-24 00:41:02 -07:00
|
|
|
info("Still attached to the tab.");
|
|
|
|
|
|
|
|
gDebugger.addEventListener("Debugger:AfterScriptsAdded", function _onEvent(aEvent) {
|
|
|
|
gDebugger.removeEventListener(aEvent.type, _onEvent);
|
|
|
|
|
2012-10-26 10:10:17 -07:00
|
|
|
is(gDebugger.DebuggerView.Sources.selectedValue, null,
|
2012-08-24 00:41:02 -07:00
|
|
|
"There should be no selected script.");
|
|
|
|
is(gDebugger.editor.getText().length, 0,
|
|
|
|
"The source editor not have any text displayed.");
|
|
|
|
|
2012-10-26 10:10:17 -07:00
|
|
|
let menulist = gDebugger.DebuggerView.Sources._container;
|
2012-08-24 00:41:02 -07:00
|
|
|
let noScripts = gDebugger.L10N.getStr("noScriptsText");
|
|
|
|
is(menulist.getAttribute("label"), noScripts,
|
|
|
|
"The menulist should display a notice that there are no scripts availalble.");
|
|
|
|
is(menulist.getAttribute("tooltiptext"), "",
|
|
|
|
"The menulist shouldn't have any tooltip text attributed when there are no scripts available.");
|
|
|
|
|
|
|
|
closeDebuggerAndFinish();
|
2012-07-15 00:06:02 -07:00
|
|
|
});
|
|
|
|
});
|
|
|
|
content.location = "about:blank";
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
registerCleanupFunction(function() {
|
|
|
|
removeTab(gTab);
|
|
|
|
gPane = null;
|
|
|
|
gTab = null;
|
|
|
|
gDebuggee = null;
|
|
|
|
gDebugger = null;
|
|
|
|
});
|