Bug 1374944 - rewrite mochitest-3 tests for using data: URI. r=smaug

This commit is contained in:
Yoshi Huang 2017-06-21 15:21:15 +08:00
Родитель e0674ba40d
Коммит 8ebd97f178
21 изменённых файлов: 35 добавлений и 24 удалений

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

@ -0,0 +1 @@
<iframe id='f' style='position:absolute; border:none; width:100%; height:100%; left:0; top:0' srcdoc='<input>'>

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

@ -0,0 +1,3 @@
<!DOCTYPE html>
<div id="scrollbox" style="height: 100px; overflow: auto;">
<div style="height: 1000px;"></div></div>

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

@ -0,0 +1,3 @@
<!DOCTYPE html>
<div id="scrollbox" style="height: 100px; overflow: auto;">
<div style="height: 1000px;"></div> </div>

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

@ -5,6 +5,9 @@ support-files =
bug299673.js
bug322588-popup.html
bug426082.html
bug545268.html
bug574663.html
bug607464.html
bug656379-1.html
bug418986-3.js
error_event_worker.js

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

@ -0,0 +1 @@
<body><div id='target' style='width: 50px; height: 50px; background: green'></div></body>

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

@ -129,4 +129,6 @@ support-files =
pointerevent_touch-action-pan-right-css_touch-manual.html
pointerevent_touch-action-pan-up-css_touch-manual.html
[test_trigger_fullscreen_by_pointer_events.html]
support-files =
file_test_trigger_fullscreen.html
[test_trigger_popup_by_pointer_events.html]

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

@ -12,7 +12,7 @@
SimpleTest.waitForExplicitFinish();
function startTest() {
let win = window.open("data:text/html,<body><div id='target' style='width: 50px; height: 50px; background: green'></div></body>", "_blank");
let win = window.open("file_test_trigger_fullscreen.html", "_blank");
win.addEventListener("load", () => {
let target = win.document.getElementById("target");
target.addEventListener("pointerdown", () => {

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

@ -132,7 +132,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=545268
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("untriaged");
win = window.open("data:text/html,<iframe id='f' style='position:absolute; border:none; width:100%; height:100%; left:0; top:0' src='data:text/html,&lt;input&gt;'>", "" , "");
win = window.open("bug545268.html", "" , "");
win.onload = doTest;
</script>

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

@ -97,10 +97,7 @@ function sendTouchpadScrollMotion(scrollbox, direction, ctrl, momentum, callback
}
function runTest() {
var win = open('data:text/html,<!DOCTYPE html>\n' +
'<div id="scrollbox" style="height: 100px; overflow: auto;">' +
' <div style="height: 1000px;"></div>' +
'</div>', '_blank', 'width=300,height=300');
var win = open('bug574663.html', '_blank', 'width=300,height=300');
SimpleTest.waitForFocus(function () {
var scrollbox = win.document.getElementById("scrollbox");
let winUtils = SpecialPowers.getDOMWindowUtils(win);

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

@ -45,10 +45,7 @@ function scrollDown150PxWithPixelScrolling(scrollbox) {
}
function runTest() {
var win = open('data:text/html,<!DOCTYPE html>\n' +
'<div id="scrollbox" style="height: 100px; overflow: auto;">' +
' <div style="height: 1000px;"></div>' +
'</div>', '_blank', 'width=300,height=300');
var win = open('bug607464.html', '_blank', 'width=300,height=300');
SimpleTest.waitForFocus(function () {
var scrollbox = win.document.getElementById("scrollbox");
let scrollTopBefore = scrollbox.scrollTop;

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

@ -28,7 +28,7 @@ function runTest() {
</pre>
<p id="text">Normal text</p>
<iframe src="data:text/plain,text in iframe"></iframe>
<iframe srcdoc="text in iframe"></iframe>
<p id="text2">Normal text</p>
</body>

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

@ -24,7 +24,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=944011
ok(true, "Got onclick");
SimpleTest.finish();
}
$('ifr').setAttribute('src', 'data:text/html,<html><body>Second frame</body></html>');
$('ifr').setAttribute('srcdoc', '<html><body>Second frame</body></html>');
break;
case 2:
ok(true, "Got second load");
@ -43,7 +43,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=944011
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=944011">Mozilla Bug 944011</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe id="ifr" onload="loaded();" src="data:text/html,<html><body>foo</body></html>"></iframe>
<iframe id="ifr" onload="loaded();" srcdoc="<html><body>foo</body></html>"></iframe>
<div name="testTarget"></div>
</div>
<pre id="test">

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

@ -28,7 +28,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1007790
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1007790">Mozilla Bug 1007790</a>
<p id="display"></p>
<div id="content" style="display: none" onerror="">
<iframe src="data:text/html,<body onerror=''>"></iframe>
<iframe srcdoc="<body onerror=''>"></iframe>
</div>
<pre id="test">
</pre>

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

@ -10,7 +10,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=697636
</head>
<body>
<iframe id="f" src="data:text/html,<body text=green>1" allowfullscreen></iframe>
<iframe id="f" srcdoc="<body text=green>1" allowfullscreen></iframe>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=697636">Mozilla Bug 697636</a>
<p id="display"></p>
@ -27,9 +27,10 @@ var e1;
function begin()
{
frameWin = document.getElementById("f").contentWindow;
var f = document.getElementById("f");
frameWin = f.contentWindow;
e1 = frameWin.document.documentElement;
frameWin.location = "data:text/html,<body text=blue onload='parent.b2()'>2";
f.srcdoc = "<body text=blue onload='parent.b2()'>2";
}
function b2()

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

@ -10,7 +10,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=685402
</head>
<body style="background-color: gray;">
<iframe id="f" src="data:text/html,<body text=green>1" allowfullscreen></iframe>
<iframe id="f" srcdoc="<body text=green>1" allowfullscreen></iframe>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=685402">Mozilla Bug 685402</a>
<p id="display"></p>
@ -29,11 +29,12 @@ var prevTrusted;
function begin()
{
frameWin = document.getElementById("f").contentWindow;
var f = document.getElementById("f");
frameWin = f.contentWindow;
e1 = frameWin.document.body;
document.addEventListener("fullscreenchange", function() {
opener.ok(document.fullscreenElement, "[navigation] Request should be granted");
frameWin.location = "data:text/html,<body text=blue onload='parent.b2()'>2";
f.srcdoc = "<body text=blue onload='parent.b2()'>2";
}, {once: true});
e1.requestFullscreen();

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

@ -26,7 +26,7 @@ Tests:
<div id="fse">
<div id="fse-inner">
<iframe id="subdoc" allowfullscreen src="data:text/html,<html><body bgcolor='black'></body></html>"></iframe>
<iframe id="subdoc" allowfullscreen srcdoc="<html><body bgcolor='black'></body></html>"></iframe>
</div>
</div>

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

@ -9,7 +9,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=802895
<iframe id="iframe1" src="about:mozilla"
srcdoc="Goodbye World"></iframe>
<iframe id="iframe2" srcdoc="Peeking test" sandbox=""></iframe>
<iframe id="iframe3" src="data:text/html;charset=US-ASCII,Gone"
<iframe id="iframe3" src="file_srcdoc_iframe3.html"
srcdoc="Going"></iframe>
</body>

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

@ -0,0 +1 @@
Gone

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

@ -169,6 +169,7 @@ support-files =
file_iframe_sandbox_worker.js
file_srcdoc-2.html
file_srcdoc.html
file_srcdoc_iframe3.html
file_window_open_close_outer.html
file_window_open_close_inner.html
formSubmission_chrome.js

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

@ -53,7 +53,7 @@ const ACTION_FUNCS = [
function navigate(win) {
info("About to navigate to another page");
var deferred = new Deferred();
win.location = "data:text/html,<html>";
win.location = "dummy_page.html";
setTimeout(() => {
SimpleTest.waitForFocus(() => {
checkIsChromeFullscreen(win, false).then(() => {

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

@ -84,7 +84,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=802895
// Test srcdoc attribute removal
iframe3.onload = function () {
var innerDoc3 = iframe3.contentDocument;
is(innerDoc3.body.innerHTML, "Gone", "Bad srcdoc attribute removal");
is(innerDoc3.body.innerText, "Gone", "Bad srcdoc attribute removal");
finish3 = true;
if (finish && finish1 && finish3) {
SimpleTest.finish();