Backout experimental changes to randomly failing sessionstore browser tests (uneffective)

This commit is contained in:
Marco Bonardo 2009-10-17 14:37:35 +02:00
parent 39d97011a4
commit 36397bbd2a
3 changed files with 50 additions and 55 deletions

View File

@ -92,10 +92,9 @@ function test() {
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no", testURL_A);
newWin.addEventListener("load", function(aEvent) {
newWin.removeEventListener("load", arguments.callee, false);
info("New window has been opened");
newWin.gBrowser.addEventListener("pageshow", function(aEvent) {
newWin.gBrowser.removeEventListener("pageshow", arguments.callee, true);
info("Content has been loaded");
newWin.gBrowser.addEventListener("load", function(aEvent) {
newWin.gBrowser.removeEventListener("load", arguments.callee, true);
info("Window has been loaded");
executeSoon(function() {
newWin.gBrowser.addTab();
executeSoon(function() {
@ -127,8 +126,8 @@ function test() {
let pbWin = openDialog(location, "_blank", "chrome,all,dialog=no", testURL_B);
pbWin.addEventListener("load", function(aEvent) {
pbWin.removeEventListener("load", arguments.callee, false);
pbWin.gBrowser.addEventListener("pageshow", function(aEvent) {
pbWin.gBrowser.removeEventListener("pageshow", arguments.callee, true);
pbWin.gBrowser.addEventListener("load", function(aEvent) {
pbWin.gBrowser.removeEventListener("load", arguments.callee, true);
executeSoon(function() {
// Add another tab, though it's not strictly needed

View File

@ -56,37 +56,35 @@ function test() {
frameCount = 0;
let tab2 = gBrowser.duplicateTab(tab);
executeSoon(function() {
tab2.linkedBrowser.addEventListener("load", function(aEvent) {
// wait for all frames to load (and reload!) completely
if (frameCount++ < 2)
return;
this.removeEventListener("load", arguments.callee, true);
tab2.linkedBrowser.addEventListener("load", function(aEvent) {
// wait for all frames to load (and reload!) completely
if (frameCount++ < 2)
return;
this.removeEventListener("load", arguments.callee, true);
let maxWait = Date.now() + 1000;
executeSoon(function() {
let iframes = tab2.linkedBrowser.contentWindow.frames;
if (iframes[1].document.body.innerHTML != uniqueValue && Date.now() < maxWait) {
executeSoon(arguments.callee);
return;
}
is(iframes[1].document.body.innerHTML, uniqueValue,
"rich textarea's content correctly duplicated");
let innerDomain = null;
try {
innerDomain = iframes[0].document.domain;
}
catch (ex) { /* throws for chrome: documents */ }
is(innerDomain, "localhost", "XSS exploit prevented!");
// clean up
gBrowser.removeTab(tab2);
gBrowser.removeTab(tab);
finish();
});
}, true);
});
let maxWait = Date.now() + 1000;
executeSoon(function() {
let iframes = tab2.linkedBrowser.contentWindow.frames;
if (iframes[1].document.body.innerHTML != uniqueValue && Date.now() < maxWait) {
executeSoon(arguments.callee);
return;
}
is(iframes[1].document.body.innerHTML, uniqueValue,
"rich textarea's content correctly duplicated");
let innerDomain = null;
try {
innerDomain = iframes[0].document.domain;
}
catch (ex) { /* throws for chrome: documents */ }
is(innerDomain, "localhost", "XSS exploit prevented!");
// clean up
gBrowser.removeTab(tab2);
gBrowser.removeTab(tab);
finish();
});
}, true);
}, true);
}

View File

@ -47,25 +47,23 @@ function test() {
this.removeEventListener("load", arguments.callee, true);
executeSoon(function() {
let tab2 = gBrowser.duplicateTab(tab);
executeSoon(function() {
tab2.linkedBrowser.addEventListener("461743", function(aEvent) {
tab2.linkedBrowser.removeEventListener("461743", arguments.callee, true);
is(aEvent.data, "done", "XSS injection was attempted");
tab2.linkedBrowser.addEventListener("461743", function(aEvent) {
tab2.linkedBrowser.removeEventListener("461743", arguments.callee, true);
is(aEvent.data, "done", "XSS injection was attempted");
executeSoon(function() {
let iframes = tab2.linkedBrowser.contentWindow.frames;
let innerHTML = iframes[1].document.body.innerHTML;
isnot(innerHTML, Components.utils.reportError.toString(),
"chrome access denied!");
executeSoon(function() {
let iframes = tab2.linkedBrowser.contentWindow.frames;
let innerHTML = iframes[1].document.body.innerHTML;
isnot(innerHTML, Components.utils.reportError.toString(),
"chrome access denied!");
// clean up
gBrowser.removeTab(tab2);
gBrowser.removeTab(tab);
finish();
});
}, true, true);
});
// clean up
gBrowser.removeTab(tab2);
gBrowser.removeTab(tab);
finish();
});
}, true, true);
});
}, true);
}