зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
71ddbd22aa
Коммит
465e2b40ed
|
@ -209,9 +209,14 @@ function xpcWaitForFinishedFrames(callback, numFrames) {
|
|||
}
|
||||
|
||||
function poll() {
|
||||
// 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);
|
||||
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,23 +15,23 @@ window.onload = function () {
|
|||
navigateByOpen("window1_child0");
|
||||
navigateByForm("window2_child0");
|
||||
navigateByHyperlink("window3_child0");
|
||||
|
||||
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.");
|
||||
isInaccessible(window3.frames[0], "Should not be able to navigate off-domain frame by targeted hyperlink.");
|
||||
|
||||
window0.close();
|
||||
window1.close();
|
||||
window2.close();
|
||||
window3.close();
|
||||
|
||||
xpcCleanupWindows();
|
||||
SimpleTest.finish();
|
||||
}, 4);
|
||||
}
|
||||
|
||||
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.");
|
||||
isInaccessible(window3.frames[0], "Should not be able to navigate off-domain frame by targeted hyperlink.");
|
||||
|
||||
window0.close();
|
||||
window1.close();
|
||||
window2.close();
|
||||
window3.close();
|
||||
|
||||
xpcCleanupWindows();
|
||||
SimpleTest.finish();
|
||||
}, 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");
|
||||
var window2 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/parent.html", "window2", "width=10,height=10");
|
||||
|
|
|
@ -9,21 +9,19 @@
|
|||
<script>
|
||||
window.onload = function () {
|
||||
document.getElementById("link0").href = target_url;
|
||||
|
||||
sendMouseEvent({type:"click"}, "link0");
|
||||
|
||||
xpcWaitForFinishedFrames(function() {
|
||||
var array_of_frames = xpcGetFramesByName("window0");
|
||||
is(array_of_frames.length, 1, "Should only open one window using a fancy hyperlink.");
|
||||
|
||||
for (var i=0; i < array_of_frames.length; ++i)
|
||||
array_of_frames[i].close();
|
||||
|
||||
xpcCleanupWindows();
|
||||
SimpleTest.finish();
|
||||
}, 1);
|
||||
}
|
||||
|
||||
xpcWaitForFinishedFrames(function() {
|
||||
var array_of_frames = xpcGetFramesByName("window0");
|
||||
is(array_of_frames.length, 1, "Should only open one window using a fancy hyperlink.");
|
||||
|
||||
for (var i=0; i < array_of_frames.length; ++i)
|
||||
array_of_frames[i].close();
|
||||
|
||||
xpcCleanupWindows();
|
||||
SimpleTest.finish();
|
||||
}, 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,17 +15,17 @@ window.onload = function() {
|
|||
navigateByOpen("child1");
|
||||
navigateByForm("child2");
|
||||
navigateByHyperlink("child3");
|
||||
|
||||
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.");
|
||||
isNavigated(frames[3], "Should be able to navigate off-domain child by targeted hyperlink.");
|
||||
|
||||
xpcCleanupWindows();
|
||||
SimpleTest.finish();
|
||||
}, 4);
|
||||
}
|
||||
|
||||
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.");
|
||||
isNavigated(frames[3], "Should be able to navigate off-domain child by targeted hyperlink.");
|
||||
|
||||
xpcCleanupWindows();
|
||||
SimpleTest.finish();
|
||||
}, 4);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -15,17 +15,17 @@ window.onload = function () {
|
|||
navigateByOpen("child1_child0");
|
||||
navigateByForm("child2_child0");
|
||||
navigateByHyperlink("child3_child0");
|
||||
|
||||
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.");
|
||||
isNavigated(frames[3].frames[0], "Should be able to navigate off-domain grandchild by targeted hyperlink.");
|
||||
|
||||
xpcCleanupWindows();
|
||||
SimpleTest.finish();
|
||||
}, 4);
|
||||
}
|
||||
|
||||
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.");
|
||||
isNavigated(frames[3].frames[0], "Should be able to navigate off-domain grandchild by targeted hyperlink.");
|
||||
|
||||
xpcCleanupWindows();
|
||||
SimpleTest.finish();
|
||||
}, 4);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -15,22 +15,22 @@ window.onload = function () {
|
|||
navigateByOpen("window1");
|
||||
navigateByForm("window2");
|
||||
navigateByHyperlink("window3");
|
||||
|
||||
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.");
|
||||
|
||||
//opener0.close();
|
||||
opener1.close();
|
||||
opener2.close();
|
||||
opener3.close();
|
||||
|
||||
xpcCleanupWindows();
|
||||
SimpleTest.finish();
|
||||
}, 3);
|
||||
}
|
||||
|
||||
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.");
|
||||
|
||||
//opener0.close();
|
||||
opener1.close();
|
||||
opener2.close();
|
||||
opener3.close();
|
||||
|
||||
xpcCleanupWindows();
|
||||
SimpleTest.finish();
|
||||
}, 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");
|
||||
opener2 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window2", "_blank", "width=10,height=10");
|
||||
|
|
|
@ -15,23 +15,23 @@ window.onload = function () {
|
|||
navigateByOpen("window1");
|
||||
navigateByForm("window2");
|
||||
navigateByHyperlink("window3");
|
||||
|
||||
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.");
|
||||
isNavigated(window3, "Should be able to navigate popup by targeted hyperlink.");
|
||||
|
||||
window0.close();
|
||||
window1.close();
|
||||
window2.close();
|
||||
window3.close();
|
||||
|
||||
xpcCleanupWindows();
|
||||
SimpleTest.finish();
|
||||
}, 4);
|
||||
}
|
||||
|
||||
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.");
|
||||
isNavigated(window3, "Should be able to navigate popup by targeted hyperlink.");
|
||||
|
||||
window0.close();
|
||||
window1.close();
|
||||
window2.close();
|
||||
window3.close();
|
||||
|
||||
xpcCleanupWindows();
|
||||
SimpleTest.finish();
|
||||
}, 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");
|
||||
var window2 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/blank.html", "window2", "width=10,height=10");
|
||||
|
|
|
@ -16,17 +16,17 @@ 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() {
|
||||
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.");
|
||||
isNavigated(frames[3], "Should be able to navigate sibling with on-domain parent by targeted hyperlink.");
|
||||
|
||||
xpcCleanupWindows();
|
||||
SimpleTest.finish();
|
||||
}, 4);
|
||||
}
|
||||
|
||||
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.");
|
||||
isNavigated(frames[3], "Should be able to navigate sibling with on-domain parent by targeted hyperlink.");
|
||||
|
||||
xpcCleanupWindows();
|
||||
SimpleTest.finish();
|
||||
}, 4);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -16,17 +16,17 @@ 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() {
|
||||
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.");
|
||||
isBlank(frames[3], "Should not be able to navigate off-domain sibling by targeted hyperlink.");
|
||||
|
||||
xpcCleanupWindows();
|
||||
SimpleTest.finish();
|
||||
}, 4);
|
||||
}
|
||||
|
||||
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.");
|
||||
isBlank(frames[3], "Should not be able to navigate off-domain sibling by targeted hyperlink.");
|
||||
|
||||
xpcCleanupWindows();
|
||||
SimpleTest.finish();
|
||||
}, 4);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
Загрузка…
Ссылка в новой задаче