Bug 416622 - "docshell navigation tests intermittently failing with NS_ERROR_XPC_BAD_OP_ON_WN_PROTO" (Tolerate partially-constructed windows) [p=hk9565@gmail.com (Adam Barth) r=bzbarsky]

This commit is contained in:
reed@reedloden.com 2008-02-11 20:35:19 -08:00
Родитель 71ddbd22aa
Коммит 465e2b40ed
10 изменённых файлов: 111 добавлений и 108 удалений

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

@ -209,9 +209,14 @@ function xpcWaitForFinishedFrames(callback, numFrames) {
}
function poll() {
try {
// This only gives us UniversalXPConnect for the current stack frame
// We're using setInterval, so the main page's privileges are still normal
xpcEnumerateContentWindows(searchForFinishedFrames);
} catch(ex) {
// We might be accessing windows before they are fully constructed,
// which can throw. We'll find those frames on our next poll().
}
}
var frameWaitInterval = setInterval(poll, 500);

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

@ -15,9 +15,8 @@ window.onload = function () {
navigateByOpen("window1_child0");
navigateByForm("window2_child0");
navigateByHyperlink("window3_child0");
}
xpcWaitForFinishedFrames(function() {
xpcWaitForFinishedFrames(function() {
isInaccessible(window0.frames[0], "Should not be able to navigate off-domain frame by setting location.");
isInaccessible(window1.frames[0], "Should not be able to navigate off-domain frame by calling window.open.");
isInaccessible(window2.frames[0], "Should not be able to navigate off-domain frame by submitting form.");
@ -30,7 +29,8 @@ xpcWaitForFinishedFrames(function() {
xpcCleanupWindows();
SimpleTest.finish();
}, 4);
}, 4);
}
var window0 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/parent.html", "window0", "width=10,height=10");
var window1 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/parent.html", "window1", "width=10,height=10");

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

@ -9,11 +9,9 @@
<script>
window.onload = function () {
document.getElementById("link0").href = target_url;
sendMouseEvent({type:"click"}, "link0");
}
xpcWaitForFinishedFrames(function() {
xpcWaitForFinishedFrames(function() {
var array_of_frames = xpcGetFramesByName("window0");
is(array_of_frames.length, 1, "Should only open one window using a fancy hyperlink.");
@ -22,8 +20,8 @@ xpcWaitForFinishedFrames(function() {
xpcCleanupWindows();
SimpleTest.finish();
}, 1);
}, 1);
}
</script>
</head>
<body>

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

@ -13,6 +13,14 @@ window.onload = function () {
sendMouseEvent({type:"click"}, "link0");
sendMouseEvent({type:"click"}, "link1");
xpcWaitForFinishedFrames(function() {
countAndClose("window0", 1);
countAndClose("window1", 1);
xpcCleanupWindows();
SimpleTest.finish();
}, 2);
}
function countAndClose(name, expected_count) {
@ -24,14 +32,6 @@ function countAndClose(name, expected_count) {
for (var i=0; i < array_of_frames.length; ++i)
array_of_frames[i].close();
}
xpcWaitForFinishedFrames(function() {
countAndClose("window0", 1);
countAndClose("window1", 1);
xpcCleanupWindows();
SimpleTest.finish();
}, 2);
</script>
</head>
<body>

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

@ -15,9 +15,8 @@ window.onload = function() {
navigateByOpen("child1");
navigateByForm("child2");
navigateByHyperlink("child3");
}
xpcWaitForFinishedFrames(function() {
xpcWaitForFinishedFrames(function() {
isNavigated(frames[0], "Should be able to navigate off-domain child by setting location.");
isNavigated(frames[1], "Should be able to navigate off-domain child by calling window.open.");
isNavigated(frames[2], "Should be able to navigate off-domain child by submitting form.");
@ -25,7 +24,8 @@ xpcWaitForFinishedFrames(function() {
xpcCleanupWindows();
SimpleTest.finish();
}, 4);
}, 4);
}
</script>
</head>
<body>

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

@ -15,9 +15,8 @@ window.onload = function () {
navigateByOpen("child1_child0");
navigateByForm("child2_child0");
navigateByHyperlink("child3_child0");
}
xpcWaitForFinishedFrames(function() {
xpcWaitForFinishedFrames(function() {
isNavigated(frames[0].frames[0], "Should be able to navigate off-domain grandchild by setting location.");
isNavigated(frames[1].frames[0], "Should be able to navigate off-domain grandchild by calling window.open.");
isNavigated(frames[2].frames[0], "Should be able to navigate off-domain grandchild by submitting form.");
@ -25,7 +24,8 @@ xpcWaitForFinishedFrames(function() {
xpcCleanupWindows();
SimpleTest.finish();
}, 4);
}, 4);
}
</script>
</head>
<body>

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

@ -15,9 +15,8 @@ window.onload = function () {
navigateByOpen("window1");
navigateByForm("window2");
navigateByHyperlink("window3");
}
xpcWaitForFinishedFrames(function() {
xpcWaitForFinishedFrames(function() {
is(xpcGetFramesByName("window1").length, 2, "Should not be able to navigate popup's popup by calling window.open.");
is(xpcGetFramesByName("window2").length, 2, "Should not be able to navigate popup's popup by submitting form.");
is(xpcGetFramesByName("window3").length, 2, "Should not be able to navigate popup's popup by targeted hyperlink.");
@ -29,7 +28,8 @@ xpcWaitForFinishedFrames(function() {
xpcCleanupWindows();
SimpleTest.finish();
}, 3);
}, 3);
}
//opener0 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window0", "_blank", "width=10,height=10");
opener1 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window1", "_blank", "width=10,height=10");

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

@ -15,9 +15,8 @@ window.onload = function () {
navigateByOpen("window1");
navigateByForm("window2");
navigateByHyperlink("window3");
}
xpcWaitForFinishedFrames(function() {
xpcWaitForFinishedFrames(function() {
isNavigated(window0, "Should be able to navigate popup by setting location.");
isNavigated(window1, "Should be able to navigate popup by calling window.open.");
isNavigated(window2, "Should be able to navigate popup by submitting form.");
@ -30,7 +29,8 @@ xpcWaitForFinishedFrames(function() {
xpcCleanupWindows();
SimpleTest.finish();
}, 4);
}, 4);
}
var window0 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/blank.html", "window0", "width=10,height=10");
var window1 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/blank.html", "window1", "width=10,height=10");

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

@ -16,9 +16,8 @@ window.onload = function () {
'<iframe src="navigate.html#child1,open"></iframe>' +
'<iframe src="navigate.html#child2,form"></iframe>' +
'<iframe src="navigate.html#child3,hyperlink"></iframe>';
}
xpcWaitForFinishedFrames(function() {
xpcWaitForFinishedFrames(function() {
isNavigated(frames[0], "Should be able to navigate sibling with on-domain parent by setting location.");
isNavigated(frames[1], "Should be able to navigate sibling with on-domain parent by calling window.open.");
isNavigated(frames[2], "Should be able to navigate sibling with on-domain parent by submitting form.");
@ -26,7 +25,8 @@ xpcWaitForFinishedFrames(function() {
xpcCleanupWindows();
SimpleTest.finish();
}, 4);
}, 4);
}
</script>
</head>
<body>

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

@ -16,9 +16,8 @@ window.onload = function () {
'<iframe src="http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#child1,open"></iframe>' +
'<iframe src="http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#child2,form"></iframe>' +
'<iframe src="http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#child3,hyperlink"></iframe>';
}
xpcWaitForFinishedFrames(function() {
xpcWaitForFinishedFrames(function() {
isBlank(frames[0], "Should not be able to navigate off-domain sibling by setting location.");
isBlank(frames[1], "Should not be able to navigate off-domain sibling by calling window.open.");
isBlank(frames[2], "Should not be able to navigate off-domain sibling by submitting form.");
@ -26,7 +25,8 @@ xpcWaitForFinishedFrames(function() {
xpcCleanupWindows();
SimpleTest.finish();
}, 4);
}, 4);
}
</script>
</head>
<body>