mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 773732 - After reloading a page, the selected script and line should remain the same. r=robcee
This commit is contained in:
parent
b5e1dafad4
commit
02275585c4
@ -934,6 +934,12 @@ SourceScripts.prototype = {
|
||||
// ..or the first entry if there's not one selected yet.
|
||||
else if (!DebuggerView.Scripts.selected) {
|
||||
DebuggerView.Scripts.selectIndex(0);
|
||||
// Selecting a script would make it "preferred", which is a lie here,
|
||||
// because we're only displaying a script to make sure there's always
|
||||
// something available in the SourceEditor and the scripts menulist.
|
||||
// Hence the need revert back to the initial preferred script, just
|
||||
// in case it will be available soon.
|
||||
DebuggerView.Scripts.preferredScriptUrl = preferredScriptUrl;
|
||||
}
|
||||
|
||||
// If there are any stored breakpoints for this script, display them again,
|
||||
|
@ -966,6 +966,12 @@ ScriptsView.prototype = {
|
||||
get preferredScriptUrl()
|
||||
this._preferredScriptUrl ? this._preferredScriptUrl : null,
|
||||
|
||||
/**
|
||||
* Sets the most recently selected script url.
|
||||
* @param string
|
||||
*/
|
||||
set preferredScriptUrl(value) this._preferredScriptUrl = value,
|
||||
|
||||
/**
|
||||
* Gets the script in the container having the specified label.
|
||||
*
|
||||
|
@ -35,7 +35,7 @@ MOCHITEST_BROWSER_TESTS = \
|
||||
browser_dbg_propertyview-09.js \
|
||||
browser_dbg_propertyview-10.js \
|
||||
browser_dbg_propertyview-edit.js \
|
||||
$(warning browser_dbg_reload-same-script.js temporarily disabled due to oranges, see bug 780198 & bug 782179) \
|
||||
browser_dbg_reload-same-script.js \
|
||||
browser_dbg_pane-collapse.js \
|
||||
browser_dbg_panesize.js \
|
||||
browser_dbg_panesize-inner.js \
|
||||
|
@ -16,7 +16,8 @@ let gView = null;
|
||||
function test()
|
||||
{
|
||||
let step = 0;
|
||||
let scriptShown = false;
|
||||
let expectedScript = "";
|
||||
let expectedScriptShown = false;
|
||||
let scriptShownUrl = null;
|
||||
let resumed = false;
|
||||
let testStarted = false;
|
||||
@ -29,27 +30,34 @@ function test()
|
||||
gView = gDebugger.DebuggerView;
|
||||
resumed = true;
|
||||
|
||||
executeSoon(startTest);
|
||||
startTest();
|
||||
});
|
||||
|
||||
function onScriptShown(aEvent)
|
||||
{
|
||||
scriptShown = aEvent.detail.url.indexOf("-01.js") != -1;
|
||||
expectedScriptShown = aEvent.detail.url.indexOf("-01.js") != -1;
|
||||
scriptShownUrl = aEvent.detail.url;
|
||||
executeSoon(startTest);
|
||||
startTest();
|
||||
}
|
||||
|
||||
function onUlteriorScriptShown(aEvent)
|
||||
{
|
||||
ok(expectedScript,
|
||||
"The expected script to show up should have been specified.");
|
||||
|
||||
info("The expected script for this ScriptShown event is: " + expectedScript);
|
||||
info("The current script for this ScriptShown event is: " + aEvent.detail.url);
|
||||
|
||||
expectedScriptShown = aEvent.detail.url.indexOf(expectedScript) != -1;
|
||||
scriptShownUrl = aEvent.detail.url;
|
||||
executeSoon(testScriptShown);
|
||||
testScriptShown();
|
||||
}
|
||||
|
||||
window.addEventListener("Debugger:ScriptShown", onScriptShown);
|
||||
|
||||
function startTest()
|
||||
{
|
||||
if (scriptShown && resumed && !testStarted) {
|
||||
if (expectedScriptShown && resumed && !testStarted) {
|
||||
window.removeEventListener("Debugger:ScriptShown", onScriptShown);
|
||||
window.addEventListener("Debugger:ScriptShown", onUlteriorScriptShown);
|
||||
testStarted = true;
|
||||
@ -59,7 +67,7 @@ function test()
|
||||
|
||||
function finishTest()
|
||||
{
|
||||
if (scriptShown && resumed && testStarted) {
|
||||
if (expectedScriptShown && resumed && testStarted) {
|
||||
window.removeEventListener("Debugger:ScriptShown", onUlteriorScriptShown);
|
||||
closeDebuggerAndFinish();
|
||||
}
|
||||
@ -68,29 +76,79 @@ function test()
|
||||
function performTest()
|
||||
{
|
||||
testCurrentScript("-01.js", step);
|
||||
step = 1;
|
||||
expectedScript = "-01.js";
|
||||
reloadPage();
|
||||
}
|
||||
|
||||
function testScriptShown()
|
||||
{
|
||||
if (!expectedScriptShown) {
|
||||
return;
|
||||
}
|
||||
step++;
|
||||
|
||||
if (step === 1) {
|
||||
testCurrentScript("-01.js", step);
|
||||
step = 2;
|
||||
expectedScript = "-01.js";
|
||||
reloadPage();
|
||||
}
|
||||
else if (step === 2) {
|
||||
testCurrentScript("-01.js", step);
|
||||
step = 3;
|
||||
expectedScript = "-02.js";
|
||||
gView.Scripts.selectScript(gView.Scripts.scriptLocations[1]);
|
||||
}
|
||||
else if (step === 3) {
|
||||
testCurrentScript("-02.js", step);
|
||||
step = 4;
|
||||
expectedScript = "-02.js";
|
||||
reloadPage();
|
||||
}
|
||||
else if (step === 4) {
|
||||
testCurrentScript("-02.js", step);
|
||||
expectedScript = "-01.js";
|
||||
gView.Scripts.selectScript(gView.Scripts.scriptLocations[0]);
|
||||
}
|
||||
else if (step === 5) {
|
||||
testCurrentScript("-01.js", step);
|
||||
expectedScript = "-01.js";
|
||||
reloadPage();
|
||||
}
|
||||
else if (step === 6) {
|
||||
testCurrentScript("-01.js", step);
|
||||
expectedScript = "-01.js";
|
||||
reloadPage();
|
||||
}
|
||||
else if (step === 7) {
|
||||
testCurrentScript("-01.js", step);
|
||||
expectedScript = "-01.js";
|
||||
reloadPage();
|
||||
}
|
||||
else if (step === 8) {
|
||||
testCurrentScript("-01.js", step);
|
||||
expectedScript = "-02.js";
|
||||
gView.Scripts.selectScript(gView.Scripts.scriptLocations[1]);
|
||||
}
|
||||
else if (step === 9) {
|
||||
testCurrentScript("-02.js", step);
|
||||
expectedScript = "-02.js";
|
||||
reloadPage();
|
||||
}
|
||||
else if (step === 10) {
|
||||
testCurrentScript("-02.js", step);
|
||||
expectedScript = "-02.js";
|
||||
reloadPage();
|
||||
}
|
||||
else if (step === 11) {
|
||||
testCurrentScript("-02.js", step);
|
||||
expectedScript = "-02.js";
|
||||
reloadPage();
|
||||
}
|
||||
else if (step === 12) {
|
||||
testCurrentScript("-02.js", step);
|
||||
expectedScript = "-01.js";
|
||||
gView.Scripts.selectScript(gView.Scripts.scriptLocations[0]);
|
||||
}
|
||||
else if (step === 13) {
|
||||
testCurrentScript("-01.js", step);
|
||||
finishTest();
|
||||
}
|
||||
}
|
||||
@ -110,9 +168,7 @@ function test()
|
||||
|
||||
function reloadPage()
|
||||
{
|
||||
executeSoon(function() {
|
||||
gDebuggee.location.reload();
|
||||
});
|
||||
gDebuggee.location.reload();
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
|
Loading…
Reference in New Issue
Block a user