зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1403814 - Update tests for toplevel data URI blocking because we know block after we have received the response. r=smaug
This commit is contained in:
Родитель
8f13729a0f
Коммит
60bd93b916
|
@ -34,15 +34,17 @@ function test_toplevel_data_image_svg() {
|
|||
const DATA_SVG =
|
||||
"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij4KICA8cGF0aCBkPSJNOCwxMkwzLDcsNCw2bDQsNCw0LTQsMSwxWiIgZmlsbD0iIzZBNkE2QSIgLz4KPC9zdmc+Cg==";
|
||||
let win2 = window.open(DATA_SVG);
|
||||
let wrappedWin2 = SpecialPowers.wrap(win2);
|
||||
setTimeout(function () {
|
||||
isnot(wrappedWin2.document.documentElement.localName, "svg",
|
||||
"Loading data:image/svg+xml should be blocked");
|
||||
wrappedWin2.close();
|
||||
// Unfortunately we can't detect whether the window was closed using some event,
|
||||
// hence we are constantly polling till we see that win == null.
|
||||
// Test times out on failure.
|
||||
var win2Closed = setInterval(function() {
|
||||
if (win2 == null || win2.closed) {
|
||||
clearInterval(win2Closed);
|
||||
ok(true, "Loading data:image/svg+xml should be blocked");
|
||||
SimpleTest.finish();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
}, 200);
|
||||
}
|
||||
// fire up the tests
|
||||
test_toplevel_data_image();
|
||||
|
||||
|
|
|
@ -21,16 +21,12 @@ function test1() {
|
|||
// simple data: URI click navigation should be prevented
|
||||
let TEST_FILE = "file_block_toplevel_data_navigation.html";
|
||||
let win1 = window.open(TEST_FILE);
|
||||
var readyStateCheckInterval = setInterval(function() {
|
||||
let state = win1.document.readyState;
|
||||
if (state === "interactive" || state === "complete") {
|
||||
clearInterval(readyStateCheckInterval);
|
||||
ok(win1.document.body.innerHTML.indexOf("test1:") !== -1,
|
||||
setTimeout(function () {
|
||||
ok(SpecialPowers.wrap(win1).document.body.innerHTML.indexOf("test1:") !== -1,
|
||||
"toplevel data: URI navigation through click() should be blocked");
|
||||
win1.close();
|
||||
test2();
|
||||
}
|
||||
}, 200);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function test2() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче