Bug 728926 - Intermittent failure in browser_dbg_script-switching.js | The correct script was loaded initially. | The first script is displayed.; r=past

This commit is contained in:
Victor Porof 2012-04-02 12:34:23 +03:00
parent ca32e1bec9
commit 29c43d4baa
2 changed files with 13 additions and 1 deletions

View File

@ -1093,6 +1093,7 @@ DebuggerView.Scripts = {
while (this._scripts.firstChild) {
this._scripts.removeChild(this._scripts.firstChild);
}
this._scriptsEmpty = true;
},
/**
@ -1185,7 +1186,10 @@ DebuggerView.Scripts = {
script.setAttribute("tooltiptext", aScript.url);
script.setUserData("sourceScript", aScript, null);
this._scripts.selectedItem = script;
if (this._scriptsEmpty) {
this._scriptsEmpty = false;
this._scripts.selectedIndex = 0;
}
return script;
},
@ -1210,6 +1214,12 @@ DebuggerView.Scripts = {
*/
_scripts: null,
/**
* Flag specifying if the scripts menulist is empty.
* This saves us checking for the itemCount value, thus making things faster.
*/
_scriptsEmpty: true,
/**
* Initialization function, called when the debugger is initialized.
*/

View File

@ -58,6 +58,7 @@ function testScriptsDisplay() {
label2), "Second script label is incorrect.");
dump("Debugger editor text:\n" + gDebugger.editor.getText() + "\n");
ok(gDebugger.editor.getText().search(/debugger/) != -1,
"The correct script was loaded initially.");
@ -80,6 +81,7 @@ function testScriptsDisplay() {
function testSwitchPaused()
{
dump("Debugger editor text:\n" + gDebugger.editor.getText() + "\n");
ok(gDebugger.editor.getText().search(/debugger/) == -1,
"The second script is no longer displayed.");