Bug 559970. browser/components/sessionstore/test/browser/browser_463205.js depends on the order in which the load and domcontentedloaded events get dispatched for subframes. r(sort of)=Simon Bunzli

This commit is contained in:
Timothy Nikkel 2010-05-01 13:42:47 -05:00
Родитель 50b2d22dee
Коммит e1d25d274c
1 изменённых файлов: 72 добавлений и 4 удалений

Просмотреть файл

@ -41,13 +41,47 @@ function test() {
let testURL = "chrome://mochikit/content/browser/" +
"browser/components/sessionstore/test/browser/browser_463205_sample.html";
let doneURL = "done";
let mainURL = testURL;
let frame1URL = "data:text/html,<input%20id='original'>";
let frame2URL = "chrome://mochikit/content/browser/" +
"browser/components/sessionstore/test/browser/browser_463205_helper.html";
let frame3URL = "data:text/html,mark2";
let frameCount = 0;
var frameCount = 0;
let tab = gBrowser.addTab(testURL);
tab.linkedBrowser.addEventListener("load", function(aEvent) {
// wait for all frames to load completely
if (frameCount++ < 3)
if (frame1URL != doneURL && aEvent.target.location.href == frame1URL) {
frame1URL = doneURL;
if (frameCount++ < 3) {
return;
}
}
if (frame2URL != doneURL && aEvent.target.location.href == frame2URL) {
frame2URL = doneURL;
if (frameCount++ < 3) {
return;
}
}
if (frame3URL != doneURL && aEvent.target.location.href == frame3URL) {
frame3URL = doneURL;
if (frameCount++ < 3) {
return;
}
}
if (mainURL != doneURL && aEvent.target.location.href == mainURL) {
mainURL = doneURL;
if (frameCount++ < 3) {
return;
}
}
if (frameCount < 3) {
return;
}
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
function typeText(aTextField, aValue) {
@ -62,13 +96,47 @@ function test() {
let win = tab.linkedBrowser.contentWindow;
typeText(win.frames[0].document.getElementById("original"), uniqueValue);
typeText(win.frames[1].document.getElementById("original"), uniqueValue);
mainURL = testURL;
frame1URL = "http://mochi.test:8888/browser/" +
"browser/components/sessionstore/test/browser/browser_463205_helper.html";
frame2URL = "chrome://mochikit/content/browser/" +
"browser/components/sessionstore/test/browser/browser_463205_helper.html";
frame3URL = "data:text/html,mark2";
frameCount = 0;
let tab2 = gBrowser.duplicateTab(tab);
tab2.linkedBrowser.addEventListener("load", function(aEvent) {
// wait for all frames to load (and reload!) completely
if (frameCount++ < 4)
if (frame1URL != doneURL && aEvent.target.location.href == frame1URL) {
frame1URL = doneURL;
if (frameCount++ < 3) {
return;
}
}
if (frame2URL != doneURL && (aEvent.target.location.href == frame2URL ||
aEvent.target.location.href == frame2URL + "#original")) {
frame2URL = doneURL;
if (frameCount++ < 3) {
return;
}
}
if (frame3URL != doneURL && aEvent.target.location.href == frame3URL) {
frame3URL = doneURL;
if (frameCount++ < 3) {
return;
}
}
if (mainURL != doneURL && aEvent.target.location.href == mainURL) {
mainURL = doneURL;
if (frameCount++ < 3) {
return;
}
}
if (frameCount < 3) {
return;
}
tab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
let win = tab2.linkedBrowser.contentWindow;