mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Update web-platform-tests to revision 8a2ceb5f18911302b7a5c1cd2791f4ab50ad4326
This commit is contained in:
parent
462c272380
commit
1f531f66ea
5377 changed files with 174916 additions and 84369 deletions
|
@ -35,6 +35,7 @@ t('startOffsetTime'); // added in r5310, replaced with startDate in r7045.
|
|||
t('initialTime'); // added in r5310, removed in r7046.
|
||||
t('audio', 'video'); // added in r5636, replaced with muted in r5991.
|
||||
t('startDate'); // added in r7045, replaced with getStartDate() in r8113.
|
||||
t('mozSrcObject'); // never in the spec
|
||||
|
||||
// TextTrackCue constructor: added in r5723, removed in r7742.
|
||||
test(function() {
|
||||
|
|
|
@ -52,6 +52,9 @@ function type_codecs_test(type, audioCodecs, videoCodecs) {
|
|||
// Spec: Generally, a user agent should never return "probably" for a type
|
||||
// that allows the codecs parameter if that parameter is not present.
|
||||
t(type, 'maybe');
|
||||
t(type + ';', 'maybe');
|
||||
t(type + ';codecs', 'maybe');
|
||||
t(type + ';codecs=', 'maybe');
|
||||
typeSupported = true;
|
||||
}, type + ' (optional)');
|
||||
|
||||
|
@ -87,7 +90,7 @@ function type_codecs_test(type, audioCodecs, videoCodecs) {
|
|||
});
|
||||
});
|
||||
}, type + ' codecs order');
|
||||
}
|
||||
}
|
||||
|
||||
test(function() {
|
||||
t(mime(type, ['bogus']), '');
|
||||
|
|
|
@ -9,11 +9,45 @@ test(function() {
|
|||
assert_equals(v.playbackRate, 1);
|
||||
}, 'playbackRate initial value');
|
||||
|
||||
async_test(function(t) {
|
||||
function testPlaybackRateHelper(t, newPlaybackRate) {
|
||||
var v = document.createElement('video');
|
||||
v.playbackRate = 2;
|
||||
v.addEventListener('ratechange', t.step_func(function() {
|
||||
t.done();
|
||||
var initialRate = v.playbackRate;
|
||||
|
||||
v.addEventListener('ratechange', t.step_func_done(function() {
|
||||
assert_equals(v.playbackRate, newPlaybackRate);
|
||||
}));
|
||||
}, 'setting playbackRate');
|
||||
|
||||
try {
|
||||
v.playbackRate = newPlaybackRate;
|
||||
} catch(e) {
|
||||
assert_equals(e.name, 'NotSupportedError');
|
||||
assert_equals(v.playbackRate, initialRate);
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
|
||||
async_test(function(t) {
|
||||
testPlaybackRateHelper(this, 3);
|
||||
}, "playbackRate set to small positive value");
|
||||
|
||||
async_test(function(t) {
|
||||
testPlaybackRateHelper(this, 100);
|
||||
}, "playbackRate set to large positive value");
|
||||
|
||||
async_test(function(t) {
|
||||
testPlaybackRateHelper(this, -3);
|
||||
}, "playbackRate set to small negative value");
|
||||
|
||||
async_test(function(t) {
|
||||
testPlaybackRateHelper(this, -100);
|
||||
}, "playbackRate set to large negative value");
|
||||
|
||||
async_test(function(t) {
|
||||
testPlaybackRateHelper(this, 0);
|
||||
}, "playbackRate set to 0");
|
||||
|
||||
async_test(function(t) {
|
||||
testPlaybackRateHelper(this, -1);
|
||||
}, "playbackRate set to -1");
|
||||
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Text track cue order</title>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/#text-track-cue-order">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function concat_cuetext(cues) {
|
||||
return Array.prototype.reduce.call(cues, function(acc, value) {
|
||||
return acc + value.text;
|
||||
}, "");
|
||||
}
|
||||
|
||||
setup(function() {
|
||||
window.video = document.createElement('video');
|
||||
});
|
||||
|
||||
test(function() {
|
||||
let track = video.addTextTrack('subtitles');
|
||||
track.addCue(new VTTCue(8, 9, '1'));
|
||||
track.addCue(new VTTCue(4, 5, '2'));
|
||||
track.addCue(new VTTCue(2, 3, '3'));
|
||||
assert_equals(concat_cuetext(track.cues), '321');
|
||||
}, document.title + ', decreasing start times.');
|
||||
|
||||
test(function() {
|
||||
let track = video.addTextTrack('subtitles');
|
||||
track.addCue(new VTTCue(2, 9, '1'));
|
||||
track.addCue(new VTTCue(2, 3, '2'));
|
||||
track.addCue(new VTTCue(2, 5, '3'));
|
||||
assert_equals(concat_cuetext(track.cues), '132');
|
||||
}, document.title + ', equal start times varying end times.');
|
||||
|
||||
test(function() {
|
||||
let track = video.addTextTrack('subtitles');
|
||||
track.addCue(new VTTCue(2, 3, '1'));
|
||||
track.addCue(new VTTCue(2, 3, '2'));
|
||||
track.addCue(new VTTCue(2, 3, '3'));
|
||||
assert_equals(concat_cuetext(track.cues), '123');
|
||||
}, document.title + ', equal start and end times.');
|
||||
|
||||
test(function() {
|
||||
let track = video.addTextTrack('subtitles');
|
||||
track.addCue(new VTTCue(2, 5, '1'));
|
||||
track.addCue(new VTTCue(2, 5, '2'));
|
||||
track.addCue(new VTTCue(2, 5, '3'));
|
||||
assert_equals(concat_cuetext(track.cues), '123', 'initial order');
|
||||
|
||||
let cue = track.cues[0];
|
||||
track.removeCue(cue);
|
||||
assert_equals(concat_cuetext(track.cues), '23', '"1" removed');
|
||||
|
||||
track.addCue(cue);
|
||||
assert_equals(concat_cuetext(track.cues), '231', '"1" reinserted');
|
||||
}, document.title + ', after re-insertion.');
|
||||
|
||||
test(function() {
|
||||
let track = video.addTextTrack('subtitles');
|
||||
track.addCue(new VTTCue(2, 5, '1'));
|
||||
track.addCue(new VTTCue(2, 5, '2'));
|
||||
track.addCue(new VTTCue(2, 5, '3'));
|
||||
assert_equals(concat_cuetext(track.cues), '123', 'initial order');
|
||||
|
||||
track.cues[0].startTime = 4;
|
||||
assert_equals(concat_cuetext(track.cues), '231', '"1" moved last');
|
||||
|
||||
track.cues[2].startTime = 2;
|
||||
assert_equals(concat_cuetext(track.cues), '123', '"1" moved first');
|
||||
}, document.title + ', equal start and end times with startTime mutations.');
|
||||
|
||||
test(function() {
|
||||
let track = video.addTextTrack('subtitles');
|
||||
track.addCue(new VTTCue(2, 5, '1'));
|
||||
track.addCue(new VTTCue(2, 5, '2'));
|
||||
track.addCue(new VTTCue(2, 5, '3'));
|
||||
assert_equals(concat_cuetext(track.cues), '123', 'initial order');
|
||||
|
||||
track.cues[2].endTime = 9;
|
||||
assert_equals(concat_cuetext(track.cues), '312', '"3" moved first');
|
||||
|
||||
track.cues[1].endTime = 3;
|
||||
assert_equals(concat_cuetext(track.cues), '321', '"1" moved last');
|
||||
}, document.title + ', equal start and end times with endTime mutations.');
|
||||
</script>
|
|
@ -0,0 +1,30 @@
|
|||
<!doctype html>
|
||||
<title>track element data: URL</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
[null, "anonymous", "use-credentials"].forEach(function(crossOriginValue) {
|
||||
async_test(function() {
|
||||
var video = document.createElement('video');
|
||||
if (crossOriginValue !== null) {
|
||||
video.setAttribute('crossorigin', crossOriginValue);
|
||||
}
|
||||
document.body.appendChild(video);
|
||||
var t = document.createElement('track');
|
||||
t.onload = this.step_func_done(function() {
|
||||
assert_equals(t.track.cues.length, 1);
|
||||
assert_equals(t.track.cues[0].startTime, 1);
|
||||
assert_equals(t.track.cues[0].endTime, 2);
|
||||
assert_equals(t.track.cues[0].id, 'x');
|
||||
assert_equals(t.track.cues[0].text, 'test');
|
||||
});
|
||||
t.onerror = this.step_func(function() {
|
||||
assert_unreached('got error event');
|
||||
});
|
||||
t.src = 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\nx\n00:00:01.000 --> 00:00:02.000\ntest\n\n');
|
||||
t.track.mode = 'showing';
|
||||
video.appendChild(t);
|
||||
}, document.title + ' ' + (crossOriginValue ? crossOriginValue : 'No CORS'));
|
||||
});
|
||||
</script>
|
|
@ -8,7 +8,7 @@
|
|||
<body class="show_output">
|
||||
|
||||
<h1>security.reset.cross</h1>
|
||||
<p class="desc">Resetting the canvas state does not reset the origin-clean flag</p>
|
||||
<p class="desc">Resetting the canvas state resets the origin-clean flag</p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
|
@ -16,14 +16,16 @@
|
|||
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("Resetting the canvas state does not reset the origin-clean flag");
|
||||
var t = async_test("Resetting the canvas state resets the origin-clean flag");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
canvas.width = 50;
|
||||
ctx.drawImage(document.getElementById('yellow.png'), 0, 0);
|
||||
assert_throws("SECURITY_ERR", function() { canvas.toDataURL(); });
|
||||
canvas.width = 100;
|
||||
assert_throws("SECURITY_ERR", function() { canvas.toDataURL(); });
|
||||
canvas.toDataURL();
|
||||
ctx.getImageData(0, 0, 1, 1);
|
||||
_assert(true, "true"); // okay if there was no exception
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<body class="show_output">
|
||||
|
||||
<h1>security.reset.redirect</h1>
|
||||
<p class="desc">Resetting the canvas state does not reset the origin-clean flag</p>
|
||||
<p class="desc">Resetting the canvas state resets the origin-clean flag</p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
|
@ -16,14 +16,16 @@
|
|||
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("Resetting the canvas state does not reset the origin-clean flag");
|
||||
var t = async_test("Resetting the canvas state resets the origin-clean flag");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
canvas.width = 50;
|
||||
ctx.drawImage(document.getElementById('yellow.png'), 0, 0);
|
||||
assert_throws("SECURITY_ERR", function() { canvas.toDataURL(); });
|
||||
canvas.width = 100;
|
||||
assert_throws("SECURITY_ERR", function() { canvas.toDataURL(); });
|
||||
canvas.toDataURL();
|
||||
ctx.getImageData(0, 0, 1, 1);
|
||||
_assert(true, "true"); // okay if there was no exception
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Check that sandboxed iframe can perform navigation on the top frame
|
||||
when allow-top-navigation is set</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<iframe sandbox="allow-top-navigation allow-scripts"></iframe>
|
||||
<script>
|
||||
if (opener) {
|
||||
// We're the popup (i.e. a top frame). Load into the iframe the page
|
||||
// trying to modifying the top frame and transmit the result to our
|
||||
// opener.
|
||||
onmessage = function(e) {
|
||||
opener.postMessage(e.data, "*")
|
||||
}
|
||||
document.querySelector("iframe").src = "support/iframe-that-performs-top-navigation-on-popup.html";
|
||||
} else {
|
||||
// We are the main test page. Open ourselves as a popup, so that we can
|
||||
// can experiment navigation of the top frame.
|
||||
async_test(t => {
|
||||
window.addEventListener("message", t.step_func_done(e => {
|
||||
assert_equals(e.data, "can navigate");
|
||||
e.source.close();
|
||||
}));
|
||||
window.open(location.href);
|
||||
}, "Frames with `allow-top-navigation` should be able to navigate the top frame.");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Check that sandboxed iframe cannot perform navigation on the top
|
||||
frame when allow-top-navigation is not set</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<iframe sandbox="allow-scripts"></iframe>
|
||||
<script>
|
||||
if (opener) {
|
||||
// We're the popup (i.e. a top frame). Load into the iframe the page
|
||||
// trying to modifying the top frame and transmit the result to our
|
||||
// opener.
|
||||
onmessage = function(e) {
|
||||
opener.postMessage(e.data, "*")
|
||||
}
|
||||
document.querySelector("iframe").src = "support/iframe-that-performs-top-navigation-on-popup.html";
|
||||
} else {
|
||||
// We are the main test page. Open ourselves as a popup, so that we can
|
||||
// can experiment navigation of the top frame.
|
||||
async_test(t => {
|
||||
window.addEventListener("message", t.step_func_done(e => {
|
||||
assert_equals(e.data, "cannot navigate");
|
||||
e.source.close();
|
||||
}));
|
||||
window.open(location.href);
|
||||
}, "Frames without `allow-top-navigation` should not be able to navigate the top frame.");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Check that sandboxed iframe can perform navigation on the top frame
|
||||
when allow-top-navigation is set (even when
|
||||
allow-top-navigation-by-user-activation is set)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Specifying both allow-top-navigation and
|
||||
allow-top-navigation-by-user-activation is a document conformance
|
||||
error: allow-top-navigation-by-user-activation will have no effect. -->
|
||||
<iframe sandbox="allow-top-navigation allow-top-navigation-by-user-activation allow-scripts"></iframe>
|
||||
<script>
|
||||
if (opener) {
|
||||
// We're the popup (i.e. a top frame). Load into the iframe the page
|
||||
// trying to modifying the top frame and transmit the result to our
|
||||
// opener.
|
||||
onmessage = function(e) {
|
||||
opener.postMessage(e.data, "*")
|
||||
}
|
||||
document.querySelector("iframe").src = "support/iframe-that-performs-top-navigation-on-popup.html";
|
||||
} else {
|
||||
// We are the main test page. Open ourselves as a popup, so that we can
|
||||
// can experiment navigation of the top frame.
|
||||
async_test(t => {
|
||||
window.addEventListener("message", t.step_func_done(e => {
|
||||
assert_equals(e.data, "can navigate");
|
||||
e.source.close();
|
||||
}));
|
||||
window.open(location.href);
|
||||
}, "Frames with `allow-top-navigation` should be able to navigate the top frame even when `allow-top-navigation-by-user-activation` is set.");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Check that sandboxed iframe can not navigate their ancestors</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
var t = async_test();
|
||||
onmessage = t.step_func_done(function(e) {
|
||||
assert_equals(e.data, "can not navigate", "Should have the right message");
|
||||
});
|
||||
</script>
|
||||
<iframe sandbox="allow-scripts" src="support/iframe-tried-to-be-navigated-by-its-child.html"></iframe>
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Check that unsandboxed iframe can navigate their ancestors</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
var t = async_test();
|
||||
onmessage = t.step_func_done(function(e) {
|
||||
assert_equals(e.data, "can navigate", "Should have the right message");
|
||||
});
|
||||
</script>
|
||||
<iframe src="support/iframe-tried-to-be-navigated-by-its-child.html"></iframe>
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Check that sandboxed iframe can navigate their descendants</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
var t = async_test();
|
||||
onmessage = t.step_func_done(function(e) {
|
||||
assert_equals(e.data, "can navigate", "Should have the right message");
|
||||
});
|
||||
</script>
|
||||
<iframe sandbox="allow-scripts" src="support/iframe-trying-to-navigate-its-child.html"></iframe>
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Check that sandboxed iframe can navigate itself</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
var t = async_test();
|
||||
onmessage = t.step_func_done(function(e) {
|
||||
assert_equals(e.data, "can navigate", "Should have the right message");
|
||||
});
|
||||
</script>
|
||||
<iframe sandbox="allow-scripts" src="support/iframe-trying-to-navigate-itself.html"></iframe>
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Allow script execution inside iframe with sandbox attribute when sandbox="allow-scripts".</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-scripts-browsing-context-flag" />
|
||||
<meta name="assert" content="Allow script execution inside iframe with sandbox attribute when sandbox='allow-scripts'." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("Allow script execution inside iframe with sandbox attribute when sandbox='allow-scripts'.");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "script ran");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(callback, 8000);
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<iframe src="support/iframe_sandbox_001.htm" sandbox="allow-scripts" style="display: none"></iframe>
|
||||
<div id=log></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Allow autoplay for HTML5 Video inside iframe with sandbox attribute if sandbox='allow-scripts'.</title>
|
||||
<meta name=timeout content=long>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
async_test(function (t) {
|
||||
var callback = t.step_func_done(function(event) {
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "play event fired");
|
||||
});
|
||||
|
||||
window.addEventListener("message", callback, false);
|
||||
}, "Allow autoplay for HTML5 Video inside iframe with sandbox attribute if sandbox='allow-scripts'.");
|
||||
</script>
|
||||
<iframe src="support/iframe_sandbox_002.htm" sandbox="allow-scripts" style="display: none"></iframe>
|
||||
<div id=log></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Block autofocus on form control inside iframe with sandbox attribute.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-automatic-features-browsing-context-flag" />
|
||||
<meta name="assert" content="Block autofocus on form control inside iframe with sandbox attribute." />
|
||||
<script src="support/sandbox_helper.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre>Description: Block autofocus on form controls inside iframe with sandbox attribute.</pre>
|
||||
<table id='testtable' border='1'>
|
||||
<tr>
|
||||
<td>Test Result</td>
|
||||
<td>Test Assertion</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id='test_0_result'>Manual</td>
|
||||
<td id='test_0_assertion'>Test passes if caret (text cursor) is not on the textbox in the below iframe.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<div id="testframe">
|
||||
<pre>iframe with sandbox</pre>
|
||||
<iframe src="support/iframe_sandbox_003.htm" sandbox style="height: 100px; width: 400px;"></iframe>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
DisableTestForNonSupportingBrowsers();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Block plugins inside iframe with sandbox attribute.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-plugins-browsing-context-flag" />
|
||||
<meta name="assert" content="Block plugins inside iframe with sandbox attribute." />
|
||||
<script src="support/sandbox_helper.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre>Description: Block plugins inside iframe with sandbox attribute.</pre>
|
||||
<table id='testtable' border='1'>
|
||||
<tr>
|
||||
<td>Test Result</td>
|
||||
<td>Test Assertion</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id='test_0_result'>Manual</td>
|
||||
<td id='test_0_assertion'>Test passes if you DO NOT see the 'Sample PDF For Testing' pdf below or 'FAIL'.<br>
|
||||
Test requires that a pdf plugin has been installed!</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<div id="testframe">
|
||||
<pre>iframe with sandbox</pre>
|
||||
<iframe sandbox src="support/iframe_sandbox_004.htm" height="400" width ="600"></iframe>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
DisableTestForNonSupportingBrowsers();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Block script execution inside iframe with sandbox attribute.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-scripts-browsing-context-flag" />
|
||||
<meta name="assert" content="Block script execution inside iframe with sandbox attribute." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("Block script execution inside iframe with sandbox attribute.");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_true(!event);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(callback, 4000);
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<iframe src="support/iframe_sandbox_001.htm" sandbox style="display: none"></iframe>
|
||||
<div id=log></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Allow form submission inside sandbox iframe when sandbox='allow-forms'</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-forms-browsing-context-flag" />
|
||||
<meta name="assert" content="Allow form submission inside sandbox iframe when sandbox='allow-forms'." />
|
||||
<script src="support/sandbox_helper.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre>Description: Allow form submission inside iframe with sandbox attribute if sandbox='allow-forms'.</pre>
|
||||
<table id='testtable' border='1'>
|
||||
<tr>
|
||||
<td>Test Result</td>
|
||||
<td>Test Assertion</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id='test_0_result'>Manual</td>
|
||||
<td id='test_0_assertion'>
|
||||
<div>Steps:</div>
|
||||
<div>1. Click button "Submit Form".</div>
|
||||
<br />
|
||||
<div>Test passes if there is no red on the page and if the word "PASS" appears in the below iframe after following the above steps.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<div id="testframe">
|
||||
<pre>iframe with sandbox="allow-forms"</pre>
|
||||
<iframe src="support/iframe_sandbox_006.htm" sandbox="allow-forms" style="height: 100px; width: 300px;"></iframe>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
DisableTestForNonSupportingBrowsers();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Block form submission inside sandbox iframe</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-forms-browsing-context-flag" />
|
||||
<meta name="assert" content="Block form submission inside sandbox iframe." />
|
||||
<script src="support/sandbox_helper.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre>Description: Block form submission inside iframe with sandbox attribute.</pre>
|
||||
<table id='testtable' border='1'>
|
||||
<tr>
|
||||
<td>Test Result</td>
|
||||
<td>Test Assertion</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id='test_0_result'>Manual</td>
|
||||
<td id='test_0_assertion'>
|
||||
<div>Steps:</div>
|
||||
<div>1. Click button "Submit Form".</div>
|
||||
<br />
|
||||
<div>Test passes if there is no red on the page and there is no navigation in the below iframe after following the above steps.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<div id="testframe">
|
||||
<pre>iframe with sandbox="allow-scripts allow-same-origin allow-top-navigation"</pre>
|
||||
<iframe src="support/iframe_sandbox_007.htm" sandbox="allow-scripts allow-same-origin allow-top-navigation" style="height: 100px; width: 300px;"></iframe>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
DisableTestForNonSupportingBrowsers();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Allow sandboxed iframe content to navigate the sandboxed browsing context itself.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-navigation-browsing-context-flag" />
|
||||
<meta name="assert" content="Allow sandboxed iframe content to navigate the sandboxed browsing context itself." />
|
||||
<script src="support/sandbox_helper.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre>Description: Allow sandboxed iframe content to navigate the sandboxed browsing context itself.</pre>
|
||||
<table id='testtable' border='1'>
|
||||
<tr>
|
||||
<td>Test Result</td>
|
||||
<td>Test Assertion</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id='test_0_result'>Manual</td>
|
||||
<td id='test_0_assertion'>
|
||||
<div>Steps:</div>
|
||||
<div>1. Click link "Click here to perform self navigation".</div>
|
||||
<br />
|
||||
<div>Test passes if there is no red on the page and the word "PASS" appears in the below iframe after following the above steps.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<div id="testframe">
|
||||
<pre>iframe with sandbox=""</pre>
|
||||
<iframe id="iframe1" name="iframe1" src="support/iframe_sandbox_008.htm" sandbox="" style="height: 100px; width: 350px;"></iframe>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
DisableTestForNonSupportingBrowsers();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Block window.open() API inside iframe with sandbox attribute.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-navigation-browsing-context-flag" />
|
||||
<meta name="assert" content="Block window.open() API inside iframe with sandbox attribute." />
|
||||
<script src="support/sandbox_helper.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre>Description: Block window.open() API inside iframe with sandbox attribute.</pre>
|
||||
<table id='testtable' border='1'>
|
||||
<tr>
|
||||
<td>Test Result</td>
|
||||
<td>Test Assertion</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id='test_0_result'>Manual</td>
|
||||
<td id='test_0_assertion'>
|
||||
<div>Steps:</div>
|
||||
<div>1. Click button "Click here to call window.open() API".</div>
|
||||
<br />
|
||||
<div>Test passes if there is no red on the page and no new window opens. The user agent may offer the user the option of allowing a new window to open.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<div id="testframe">
|
||||
<pre>iframe with sandbox="allow-scripts allow-same-origin allow-forms allow-top-navigation"</pre>
|
||||
<iframe src="support/iframe_sandbox_010.htm" sandbox="allow-scripts allow-same-origin allow-forms allow-top-navigation" style="height: 100px; width: 450px;"></iframe>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
DisableTestForNonSupportingBrowsers();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,65 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: iframe sandbox attribute value support DOMTokenList interface.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#the-iframe-element" />
|
||||
<meta name="assert" content="iframe sandbox attribute value support DOMTokenList interface." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<iframe id="iframe1" src="about:blank" sandbox="allow-scripts allow-same-origin allow-forms" style="display : none"></iframe>
|
||||
<script type="text/javascript">
|
||||
|
||||
test(function() {
|
||||
var iframeEle = document.getElementById("iframe1");
|
||||
assert_equals(iframeEle.sandbox.length, 3)
|
||||
}, "DOMTokenList length")
|
||||
|
||||
test(function() {
|
||||
var iframeEle = document.getElementById("iframe1");
|
||||
assert_equals(iframeEle.sandbox.item(1), "allow-same-origin")
|
||||
}, "DOMTokenList item(index)")
|
||||
|
||||
test(function() {
|
||||
var iframeEle = document.getElementById("iframe1");
|
||||
assert_true(iframeEle.sandbox.contains("allow-forms"))
|
||||
}, "DOMTokenList contains(DomString)")
|
||||
|
||||
test(function() {
|
||||
var iframeEle = document.getElementById("iframe1");
|
||||
iframeEle.sandbox.add("ALLOW-SANDBOX");
|
||||
assert_true(iframeEle.sandbox.contains("ALLOW-SANDBOX"))
|
||||
}, "DOMTokenList add(DomString)")
|
||||
|
||||
test(function() {
|
||||
var iframeEle = document.getElementById("iframe1");
|
||||
iframeEle.sandbox.remove("ALLOW-SANDBOX");
|
||||
assert_false(iframeEle.sandbox.contains("ALLOW-SANDBOX"))
|
||||
}, "DOMTokenList remove(DomString)")
|
||||
|
||||
test(function() {
|
||||
var iframeEle = document.getElementById("iframe1");
|
||||
iframeEle.sandbox.remove("ALLOW-SANDBOX");
|
||||
assert_true(
|
||||
iframeEle.sandbox.toggle("allow-top-navigation") && iframeEle.sandbox.contains("allow-top-navigation") &&
|
||||
!iframeEle.sandbox.toggle("allow-top-navigation") && !iframeEle.sandbox.contains("allow-top-navigation")
|
||||
)
|
||||
}, "DOMTokenList toggle(DomString) - Returns true if token is now present (it was added); returns false if it is not (it was removed).")
|
||||
|
||||
test(function() {
|
||||
var iframeEle = document.getElementById("iframe1");
|
||||
assert_equals(iframeEle.sandbox.value, iframeEle.sandbox.toString())
|
||||
}, "DOMTokenList sandbox.toString()")
|
||||
|
||||
test(function() {
|
||||
var iframeEle = document.getElementById("iframe1");
|
||||
iframeEle.sandbox.remove("ALLOW-SANDBOX");
|
||||
assert_true(iframeEle.sandbox.contains("allow-scripts") != iframeEle.sandbox.contains("Allow-SCRIPTS"))
|
||||
}, "DOMTokenList case sensitivity")
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: value of sandbox attribute must be an unordered set of unique space-separated tokens.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
|
||||
<meta name="assert" content="value of sandbox attribute must be an unordered set of unique space-separated tokens." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("value of sandbox attribute must be an unordered set of unique space-separated tokens.");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "cookies are R/W");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(callback, 4000);
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<div id=log></div>
|
||||
|
||||
<iframe style="display:none" src="support/iframe_sandbox_012.htm" sandbox=" Allow-Scripts Allow-Same-Origin "></iframe>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: value of sandbox attribute must be an unordered set of unique space-separated tokens.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
|
||||
<meta name="assert" content="value of sandbox attribute must be an unordered set of unique space-separated tokens." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("value of sandbox attribute must be an unordered set of unique space-separated tokens.");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "cookies are R/W");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(callback, 4000);
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<div id=log></div>
|
||||
|
||||
<iframe style="display:none" src="support/iframe_sandbox_012.htm" sandbox="
|
||||
allow-scripts
|
||||
allow-same-origin
|
||||
"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: value of sandbox attribute must be an unordered set of unique space-separated tokens.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
|
||||
<meta name="assert" content="value of sandbox attribute must be an unordered set of unique space-separated tokens." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("value of sandbox attribute must be an unordered set of unique space-separated tokens.");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "cookies are R/W");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(callback, 4000);
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<div id=log></div>
|
||||
|
||||
<iframe style="display:none" src="support/iframe_sandbox_012.htm" sandbox=" allow-scripts allow-same-origin "></iframe>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: value of sandbox attribute must be an unordered set of unique space-separated tokens.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
|
||||
<meta name="assert" content="value of sandbox attribute must be an unordered set of unique space-separated tokens." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("value of sandbox attribute must be an unordered set of unique space-separated tokens.");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "cookies are R/W");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(callback, 4000);
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<div id=log></div>
|
||||
|
||||
<iframe style="display:none" src="support/iframe_sandbox_012.htm" sandbox=" ALLOW-SCRIPTS allow-same-origin "></iframe>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: value of sandbox attribute must be an unordered set of unique space-separated tokens.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
|
||||
<meta name="assert" content="value of sandbox attribute must be an unordered set of unique space-separated tokens." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("value of sandbox attribute must be an unordered set of unique space-separated tokens.");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function() {
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "cookies are R/W");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<div id=log></div>
|
||||
|
||||
<iframe style="display:none" src="support/iframe_sandbox_012.htm" sandbox="
ALLOW-SCRIPTS
allow-same-origin
"></iframe>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: value of sandbox attribute must be an unordered set of unique space-separated tokens.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
|
||||
<meta name="assert" content="value of sandbox attribute must be an unordered set of unique space-separated tokens." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("value of sandbox attribute must be an unordered set of unique space-separated tokens.");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "cookies are R/W");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(callback, 4000);
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<div id=log></div>
|
||||
|
||||
<iframe style="display:none" src="support/iframe_sandbox_012.htm" sandbox="ALLOW-SCRIPTSallow-same-origin"></iframe>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: value of sandbox attribute must be an unordered set of unique space-separated tokens.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
|
||||
<meta name="assert" content="value of sandbox attribute must be an unordered set of unique space-separated tokens." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("value of sandbox attribute must be an unordered set of unique space-separated tokens.");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "cookies are R/W");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(callback, 4000);
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<div id=log></div>
|
||||
|
||||
<iframe style="display:none" src="support/iframe_sandbox_012.htm" sandbox="
ALLOW-SCRIPTS
allow-same-origin
"></iframe>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: value of sandbox attribute must be an unordered set of unique space-separated tokens.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
|
||||
<meta name="assert" content="value of sandbox attribute must be an unordered set of unique space-separated tokens." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("value of sandbox attribute must be an unordered set of unique space-separated tokens.");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "cookies are R/W");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(callback, 4000);
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<div id=log></div>
|
||||
|
||||
<iframe style="display:none" src="support/iframe_sandbox_012.htm" sandbox="	ALLOW-SCRIPTS	allow-same-origin	"></iframe>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Nested iframes cannot have less sandbox restrictions than their most restrictive ancestor iframe.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
|
||||
<meta name="assert" content="Nested iframes cannot have less sandbox restrictions than their most restrictive ancestor iframe." />
|
||||
<script src="support/sandbox_helper.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre>Description: Nested iframes cannot have less sandbox restrictions than their most restrictive ancestor iframe.</pre>
|
||||
<div>This test is to verify script is blocked inside nested iframes if the top-most sandbox iframe has no 'allow-scripts' token.</div>
|
||||
<br />
|
||||
<table id='testtable' border='1'>
|
||||
<tr>
|
||||
<td>Test Result</td>
|
||||
<td>Test Assertion</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id='test_0_result'>Manual</td>
|
||||
<td id='test_0_assertion'>Test passes if there is no red on the page.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<div id="testframe">
|
||||
<div style="font-weight:bold">Top-most iframe with sandbox=""</div>
|
||||
<iframe id="iframe1" name="iframe1" src="support/iframe_sandbox_020.htm" sandbox="" style="height: 330px; width: 400px;"></iframe>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
DisableTestForNonSupportingBrowsers();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,44 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Nested iframes cannot have less sandbox restrictions than their most restrictive ancestor iframe.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox" />
|
||||
<meta name="assert" content="Nested iframes cannot have less sandbox restrictions than their most restrictive ancestor iframe." />
|
||||
<script src="support/sandbox_helper.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre>Description: Nested iframes cannot have less sandbox restrictions than their most restrictive ancestor iframe.</pre>
|
||||
<div>This test is to verify script is allowed inside nested iframes if any of the conditions below are true</div>
|
||||
<div>1. both parent sandbox and child sandbox have 'allow-scripts' token.</div>
|
||||
<div>2. parent sandbox has 'allow-scripts' token and nested child iframe has no sandbox attribute.</div>
|
||||
<div>3. parent iframe has no sandbox attribute and child iframe has sandbox='allow-scripts' token.</div>
|
||||
<div>4. both parent and child iframes have no sandbox attribute.</div>
|
||||
<br />
|
||||
<table id='testtable' border='1'>
|
||||
<tr>
|
||||
<td>Test Result</td>
|
||||
<td>Test Assertion</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id='test_0_result'>Manual</td>
|
||||
<td id='test_0_assertion'>Test passes if there is no red on the page.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<div id="testframe">
|
||||
<div style="float: left; border: 1px solid; padding: 5px;">
|
||||
<div style="font-weight: bold">Top-most iframe with sandbox="allow-scripts"</div>
|
||||
<iframe id="iframe1" src="support/iframe_sandbox_021.htm" sandbox="allow-scripts" style="height: 330px; width: 400px;"></iframe>
|
||||
</div>
|
||||
<div style="float: left; border: 1px solid; padding: 5px; margin-left: 20px;">
|
||||
<div style="font-weight: bold">Top-most iframe without sandbox attribute</div>
|
||||
<iframe id="iframe2" src="support/iframe_sandbox_021.htm" style="height: 330px; width: 400px;"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
DisableTestForNonSupportingBrowsers();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: allow sandbox iframe to navigate their top-level browsing context if sandbox="allow-top-navigation".</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-scripts-browsing-context-flag" />
|
||||
<meta name="assert" content="Allow sandbox iframe to navigate their top-level browsing context if sandbox='allow-top-navigation'." />
|
||||
<script src="support/sandbox_helper.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre>Description: Allow sandbox iframe to navigate its top-level browsing context if sandbox='allow-top-navigation'.</pre>
|
||||
<table id='testtable' border='1'>
|
||||
<tr>
|
||||
<td>Test Result</td>
|
||||
<td>Test Assertion</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id='test_0_result'>Manual</td>
|
||||
<td id='test_0_assertion'>
|
||||
<div>Steps:</div>
|
||||
<div>1. Click link "Open the link in top window".</div>
|
||||
<br />
|
||||
<div>Test passes if there is no red on the page and no top-level navigation after following the above steps.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<div id="testframe">
|
||||
<pre>iframe with sandbox="allow-top-navigation"</pre>
|
||||
<iframe src="support/iframe_sandbox_022.htm" sandbox="allow-top-navigation" style="height: 100px; width: 450px;"></iframe>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
DisableTestForNonSupportingBrowsers();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Allow sandbox iframe to access other content from the same origin if sandbox="allow-same-origin".</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
|
||||
<meta name="assert" content=" Allow sandbox iframe to access other content from the same origin if sandbox='allow-same-origin'." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("Allow sandbox iframe to access other content from the same origin if sandbox='allow-same-origin'");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "window.parent.document");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(callback, 4000);
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<iframe src="support/iframe_sandbox_023.htm" sandbox="allow-scripts allow-same-origin" style="display:none"></iframe>
|
||||
<div id=log></div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: document.cookie access is allowed inside iframe with sandbox="allow-same-origin".</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
|
||||
<meta name="assert" content="document.cookie access is allowed inside iframe with sandbox='allow-same-origin'." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("document.cookie access is allowed inside iframe with sandbox='allow-same-origin'.");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "cookies are R/W");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(callback, 4000);
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<div id=log></div>
|
||||
<iframe src="support/iframe_sandbox_024.htm" sandbox="allow-scripts allow-same-origin" style="display:none"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Allow parent content to access sandbox child iframe content when sandbox='allow-same-origin</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
|
||||
<meta name="assert" content="Allow parent content to access sandbox child iframe content when sandbox='allow-same-origin'" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("Allow parent content to access sandbox child iframe content when sandbox='allow-same-origin'");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(document.getElementById('sandboxIframe').contentDocument.title, "Page with a message");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
<div id=log></div>
|
||||
|
||||
<iframe id='sandboxIframe' src="support/standalone-iframe-content.htm" sandbox="allow-same-origin" onload="callback()" style="display : none"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Allow localStorage and sessionStorage access inside iframe with sandbox='allow-same-origin allow-scripts'.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
|
||||
<meta name="assert" content="Allow localStorage and sessionStorage access inside iframe with sandbox='allow-same-origin allow-scripts'." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("Allow localStorage and sessionStorage access inside iframe with sandbox='allow-same-origin allow-scripts'");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "access to window.localStorage and window.sessionStorage");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(callback, 4000);
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<div id=log></div>
|
||||
<iframe src="support/iframe_sandbox_026.htm" sandbox="allow-scripts allow-same-origin" style="display : none"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Allow XMLHttpRequest inside iframe with the sandbox attribute if sandbox='allow-same-origin'.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
|
||||
<meta name="assert" content="Allow XMLHttpRequest in an iframe with the sandbox attribute if sandbox='allow-same-origin'." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("Allow XMLHttpRequest in an iframe with the sandbox attribute if sandbox='allow-same-origin'.");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "access to window.XMLHttpRequest");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(callback, 4000);
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<div id=log></div>
|
||||
<iframe src="support/iframe_sandbox_027.htm" sandbox="allow-scripts allow-same-origin" style="display : none"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Block sandbox iframe from accessing other content from the same origin.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
|
||||
<meta name="assert" content="Block sandbox iframe from accessing other content from the same origin." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("Block sandbox iframe from accessing other content from the same origin.");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "!window.parent.document");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(callback, 4000);
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<iframe src="support/iframe_sandbox_028.htm" sandbox="allow-scripts" style="display:none"></iframe>
|
||||
<div id=log></div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Block document.cookie inside iframe with the sandbox attribute.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
|
||||
<meta name="assert" content="Block document.cookie inside iframe with the sandbox attribute." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("Block document.cookie inside iframe with the sandbox attribute.");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "cookies are not R/W");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(callback, 4000);
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<div id=log></div>
|
||||
<iframe src="support/iframe_sandbox_029.htm" sandbox="allow-scripts" style="display:none"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Block parent content to access sandbox child iframe content when sandbox attribute exists</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
|
||||
<meta name="assert" content="Block parent content to access sandbox child iframe content when sandbox attribute exists" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("Block parent content to access sandbox child iframe content when sandbox attribute exists");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
try { document.getElementById('sandboxIframe').contentDocument.title; assert_true(false);}
|
||||
catch(e) {assert_true(true);}
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
<div id=log></div>
|
||||
|
||||
<iframe id='sandboxIframe' src="support/standalone-iframe-content.htm" sandbox onload="callback()" style="display : none"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Block localStorage and sessionStorage inside iframe with the sandbox attribute.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
|
||||
<meta name="assert" content="Block localStorage and sessionStorage inside iframe with the sandbox attribute." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("Block localStorage and sessionStorage inside iframe with the sandbox attribute.");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "no access to window.localStorage and window.sessionStorage");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(callback, 4000);
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<div id=log></div>
|
||||
<iframe src="support/iframe_sandbox_031.htm" sandbox="allow-scripts" style="display : none"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Sandbox: Block XMLHttpRequest in an iframe with the sandbox attribute.</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="http://dev.w3.org/html5/spec/Overview.html#sandboxed-origin-browsing-context-flag" />
|
||||
<meta name="assert" content="Block XMLHttpRequest inside sandbox iframe." />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var t = async_test("Block XMLHttpRequest in an iframe with the sandbox attribute.");
|
||||
|
||||
function callback(event)
|
||||
{
|
||||
t.step(function(){
|
||||
assert_true('sandbox' in document.createElement('iframe'));
|
||||
assert_equals(event.data, "no access to window.XMLHttpRequest");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(callback, 4000);
|
||||
window.addEventListener("message", callback, false);
|
||||
</script>
|
||||
<div id=log></div>
|
||||
<iframe src="support/iframe_sandbox_032.htm" sandbox="allow-scripts" style="display : none"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -1 +1 @@
|
|||
<html></html>
|
||||
<html></html>
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
try {
|
||||
top.location = "data:text/html,\u003c!DOCTYPE html\u003e\u003cscript\u003eopener.postMessage('can navigate', '*');\u003c/script\u003e";
|
||||
} catch(e) {
|
||||
top.postMessage("cannot navigate", "*");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<p>This is a frame that tries to navigate its parent.</p>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
try {
|
||||
parent.location.href = "data:text/html,\u003c!DOCTYPE html\u003e\u003cp\u003eIf this message appears, then this frame has been navigated by its child.\u003c/p\u003e\u003cscript\u003eparent.postMessage('can navigate', '*');\u003c/script\u003e";
|
||||
} catch(e) {
|
||||
parent.parent.postMessage("can not navigate", "*");
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<p>If this message appears, then this frame has not been navigated by its child.</p>
|
||||
<iframe src="iframe-that-tries-to-navigate-parent-and-sends-result-to-grandparent.html">
|
||||
</iframe>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<iframe src="data:text/html,If this message appears, then this frame has not been navigated by its parent."></iframe>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
try {
|
||||
document.querySelector("iframe").contentWindow.location.href = "data:text/html,\u003c!DOCTYPE html\u003e\u003cp\u003eIf this message appears, then this frame has been navigated by its parent.\u003c/p\u003e\u003cscript\u003eparent.parent.postMessage('can navigate', '*');\u003c/script\u003e";
|
||||
} catch(e) {
|
||||
parent.postMessage("can not navigate", "*");
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<p>If this message appears, then this frame has not been navigated.</p>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
try {
|
||||
location.href = "data:text/html,\u003c!DOCTYPE html\u003e\u003cp\u003eIf this message appears, then this frame has been navigated.\u003c/p\u003e\u003cscript\u003eparent.postMessage('can navigate', '*');\u003c/script\u003e";
|
||||
} catch(e) {
|
||||
parent.postMessage("can not navigate", "*");
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page with script</title>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
parent.window.postMessage("script ran", "*");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 video with autoplay attribute.</title>
|
||||
<script src="/common/media.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
function do_play(event) {
|
||||
parent.window.postMessage("play event fired", "*");
|
||||
}
|
||||
|
||||
document.write(
|
||||
"<video id='video0' src='" + getVideoURI("/media/green-at-15") + "'" +
|
||||
" autoplay onplay='do_play(event);'>"
|
||||
);
|
||||
</script>
|
||||
Your browser does not support HTML5 video.
|
||||
</video>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>autofocus on form control</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>Below form control has autofocus attribute set.</div><br />
|
||||
<form action="">
|
||||
<span>Textbox: </span><input autofocus="autofocus" type="text" name="movie" />
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>object tag</title>
|
||||
</head>
|
||||
<body>
|
||||
<object width="400" height="600" data="sandbox.pdf">
|
||||
</object>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Form submission</title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" action="standalone-pass.htm">
|
||||
<span>Name: </span><input type="text" name="name" value="browser" /><br />
|
||||
<input id="submitButton" type="submit" value="Submit Form" />
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Form submission</title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" action="standalone-fail.htm">
|
||||
<span>Name: </span><input type="text" name="name" value="browser" /><br />
|
||||
<input id="submitButton" type="submit" value="Submit Form" />
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page with hyperlink and target set to self</title>
|
||||
</head>
|
||||
<body>
|
||||
<a id="hyperlink" href="standalone-pass.htm" target="_self">Click here to perform self navigation</a>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page with window.open()</title>
|
||||
</head>
|
||||
<body>
|
||||
<button type="button" onclick="javascript:window.open('standalone-fail.htm')">Click here to call window.open() API</button>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page with access to document.cookie</title>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
cookie = document.cookie;
|
||||
document.cookie = "name=browser";
|
||||
parent.window.postMessage("cookies are R/W", "*");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page with iframes</title>
|
||||
</head>
|
||||
<body>
|
||||
<table cellpadding="5" cellspacing="10">
|
||||
<tr>
|
||||
<td>
|
||||
<span>child iframe with sandbox="allow-scripts" attribute</span><br />
|
||||
<iframe id="Iframe1" src="iframe_sandbox_020a.htm" sandbox="allow-scripts" style="height: 50px; width: 250px;"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<span>child iframe with sandbox="" attribute</span><br />
|
||||
<iframe id="Iframe2" src="iframe_sandbox_020a.htm" sandbox="" style="height: 50px; width: 250px;"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<span>child iframe without sandbox attribute</span><br />
|
||||
<iframe id="Iframe3" src="iframe_sandbox_020a.htm" style="height: 50px; width: 250px;"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page with script</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>Script Execution: <span id="scriptExecute" style="Color: Green">Blocked</span></div>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("scriptExecute").innerHTML = "Not Blocked";
|
||||
document.getElementById("scriptExecute").style.color = "Red";
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page with iframes</title>
|
||||
</head>
|
||||
<body>
|
||||
<table cellpadding="5" cellspacing="10">
|
||||
<tr>
|
||||
<td>
|
||||
<span>child iframe with sandbox="allow-scripts" attribute</span><br />
|
||||
<iframe id="Iframe1" src="iframe_sandbox_021a.htm" sandbox="allow-scripts" style="height: 50px; width: 250px;"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<span>child iframe with sandbox="" attribute</span><br />
|
||||
<iframe id="Iframe2" src="iframe_sandbox_020a.htm" sandbox="" style="height: 50px; width: 250px;"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<span>child iframe without sandbox attribute</span><br />
|
||||
<iframe id="Iframe3" src="iframe_sandbox_021a.htm" style="height: 50px; width: 250px;"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page with script</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>Script Execution: <span id="scriptExecute" style="Color: Red">Blocked</span></div>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("scriptExecute").innerHTML = "Allowed";
|
||||
document.getElementById("scriptExecute").style.color = "Green";
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>target=_top</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>hyperlink with target=_top</div>
|
||||
<br />
|
||||
<a href="standalone-pass.htm" target="_top">Open the link in top window</a>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title>Access parent dom</title>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
if (window.parent.document)
|
||||
{
|
||||
parent.window.postMessage("window.parent.document", "*");
|
||||
}else{
|
||||
parent.window.postMessage("!window.parent.document", "*");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title>Page with access to document.cookie</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>Cookie Read: <span id="readCookie"></span></div>
|
||||
<script type="text/javascript">
|
||||
cookie = document.cookie;
|
||||
document.cookie = "name=browser";
|
||||
parent.window.postMessage("cookies are R/W", "*");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title>Page with access to localStorage and sessionStorage</title>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
if (window.localStorage && window.sessionStorage) {
|
||||
parent.window.postMessage("access to window.localStorage and window.sessionStorage", "*");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title>XMLHttpRequest</title>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
xhrRequest = new XMLHttpRequest();
|
||||
|
||||
xhrRequest.onreadystatechange = function () {
|
||||
if (xhrRequest.readyState == 4 && xhrRequest.status == 200) {
|
||||
//xhr successful
|
||||
parent.window.postMessage("access to window.XMLHttpRequest", "*");
|
||||
}
|
||||
}
|
||||
|
||||
xhrRequest.open("GET", "standalone-pass.htm", true);
|
||||
xhrRequest.send();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title>Access parent dom</title>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
try
|
||||
{
|
||||
if (window.parent.document)
|
||||
{
|
||||
parent.window.postMessage("window.parent.document", "*");
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
parent.window.postMessage("!window.parent.document", "*");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title>Page with access to document.cookie</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>Cookie Read: <span id="readCookie"></span></div>
|
||||
<script type="text/javascript">
|
||||
try
|
||||
{
|
||||
cookie = document.cookie;
|
||||
document.cookie = "name=browser";
|
||||
parent.window.postMessage("cookies are R/W", "*");
|
||||
}catch(e)
|
||||
{
|
||||
parent.window.postMessage("cookies are not R/W", "*");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title>Page with access to localStorage and sessionStorage</title>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
try
|
||||
{
|
||||
if (window.localStorage && window.sessionStorage) {
|
||||
parent.window.postMessage("access to window.localStorage and window.sessionStorage", "*");
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
parent.window.postMessage("no access to window.localStorage and window.sessionStorage", "*");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title>XMLHttpRequest</title>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
try
|
||||
{
|
||||
xhrRequest = new XMLHttpRequest();
|
||||
|
||||
xhrRequest.onreadystatechange = function () {
|
||||
if (xhrRequest.readyState == 4 && xhrRequest.status == 200) {
|
||||
//xhr successful
|
||||
parent.window.postMessage("access to window.XMLHttpRequest", "*");
|
||||
}
|
||||
}
|
||||
|
||||
xhrRequest.open("GET", "standalone-pass.htm", true);
|
||||
xhrRequest.send();
|
||||
|
||||
}catch(e){}
|
||||
|
||||
parent.window.postMessage("no access to window.XMLHttpRequest", "*");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
|
@ -0,0 +1,14 @@
|
|||
function IsSandboxSupported() {
|
||||
if ('sandbox' in document.createElement('iframe')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function DisableTestForNonSupportingBrowsers() {
|
||||
//check if sandbox is supported by the browser
|
||||
if (!IsSandboxSupported()) {
|
||||
document.getElementById('testframe').innerHTML = "FAIL: Your browser does not support the sandbox attribute on the iframe element.";
|
||||
document.getElementById('testframe').style.color = "Red";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page with FAIL message</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="color: Red">FAIL!!!</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page with a message</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>Hello World.</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page with PASS message</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="color: Green">PASS!!!</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,91 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Adopting an image updates the image data</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
|
||||
<!-- tests -->
|
||||
|
||||
<div id="adoptTest1"></div>
|
||||
<picture id="adoptTest2">
|
||||
<source srcset="/images/green-2x2.png">
|
||||
</picture>
|
||||
|
||||
<script>
|
||||
function resolve(url) {
|
||||
if (url === "") {
|
||||
return url;
|
||||
}
|
||||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
return a.href;
|
||||
}
|
||||
|
||||
function t(desc, data, expect) {
|
||||
async_test(function(t) {
|
||||
var d = (new DOMParser()).parseFromString(data, 'text/html');
|
||||
var i = d.querySelector('img');
|
||||
i.onerror = this.unreached_func('got unexpected error event');
|
||||
i.onload = this.step_func_done(function() {
|
||||
assert_equals(i.currentSrc, resolve(expect));
|
||||
});
|
||||
var n = d.querySelector('[adopt-node]');
|
||||
document.adoptNode(n);
|
||||
}, desc);
|
||||
}
|
||||
|
||||
onload = function() {
|
||||
|
||||
t('img (src only)',
|
||||
'<img src="/images/green-1x1.png" adopt-node>',
|
||||
'/images/green-1x1.png');
|
||||
|
||||
t('img (src only), parent is picture',
|
||||
'<picture adopt-node><img src="/images/green-1x1.png"></picture>',
|
||||
'/images/green-1x1.png');
|
||||
|
||||
t('img (src only), previous sibling is source',
|
||||
'<picture adopt-node><source srcset="/images/green-1x1.png"><img src="/images/green-2x2.png"></picture>',
|
||||
'/images/green-1x1.png');
|
||||
|
||||
t('img (srcset 1 cand)',
|
||||
'<img srcset="/images/green-1x1.png" adopt-node>',
|
||||
'/images/green-1x1.png');
|
||||
|
||||
t('img (srcset 1 cand), parent is picture',
|
||||
'<picture adopt-node><img srcset="/images/green-1x1.png"></picture>',
|
||||
'/images/green-1x1.png');
|
||||
|
||||
t('img (srcset 1 cand), previous sibling is source',
|
||||
'<picture adopt-node><source srcset="/images/green-1x1.png"><img srcset="/images/green-2x2.png"></picture>',
|
||||
'/images/green-1x1.png');
|
||||
|
||||
async_test(function(t) {
|
||||
var d = (new DOMParser()).parseFromString('<template><img src="/images/green-1x1.png"></template>', 'text/html');
|
||||
var i = d.querySelector('template').content.querySelector('img').cloneNode(1);
|
||||
i.onerror = this.unreached_func('got unexpected error event');
|
||||
i.onload = this.step_func_done(function() {
|
||||
assert_equals(i.currentSrc, resolve('/images/green-1x1.png'));
|
||||
});
|
||||
|
||||
document.getElementById('adoptTest1').appendChild(i);
|
||||
}, 'adopt a cloned img in template');
|
||||
|
||||
async_test(function(t) {
|
||||
var preload = new Image();
|
||||
preload.src = '/images/green-1x1.png?' + Math.random();
|
||||
preload.onload = t.step_func(function() {
|
||||
var d = (new DOMParser()).parseFromString('<img src="' + preload.src + '">', 'text/html');
|
||||
var i = d.querySelector('img');
|
||||
i.onerror = this.unreached_func('got unexpected error event');
|
||||
i.onload = this.step_func_done(function() {
|
||||
assert_equals(i.currentSrc, resolve("/images/green-2x2.png"));
|
||||
});
|
||||
|
||||
var p = document.getElementById('adoptTest2');
|
||||
p.appendChild(i);
|
||||
});
|
||||
}, 'adoption is from appendChild');
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,54 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<meta name="timeout" content="long">
|
||||
<title>HTMLImageElement.prototype.decode(), iframe tests.</title>
|
||||
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
|
||||
<link rel=help href="https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-decode">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<iframe id="frame_loaded" srcdoc="iframe"></iframe>
|
||||
<iframe id="frame_notloaded" srcdoc="iframe"></iframe>
|
||||
<iframe id="frame_notloaded2" srcdoc="iframe"></iframe>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
promise_test(function() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var frame = document.getElementById("frame_loaded");
|
||||
var img = frame.contentDocument.createElement("img");
|
||||
img.src = "/images/green.png";
|
||||
img.onload = function() {
|
||||
// At this point the frame which created the img is removed, so decode() should fail.
|
||||
frame.parentNode.removeChild(frame);
|
||||
img.decode().then(function() {
|
||||
assert_false(true, "Unexpected success");
|
||||
}, function() {
|
||||
resolve();
|
||||
});
|
||||
};
|
||||
});
|
||||
}, document.title + " Decode from removed iframe fails (loaded img)");
|
||||
|
||||
promise_test(function(t) {
|
||||
var frame = document.getElementById("frame_notloaded");
|
||||
var img = frame.contentDocument.createElement("img");
|
||||
img.src = "/images/green.png";
|
||||
frame.parentNode.removeChild(frame);
|
||||
var promise = img.decode();
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " Decode from removed iframe fails (img not loaded)");
|
||||
|
||||
promise_test(function(t) {
|
||||
var frame = document.getElementById("frame_notloaded2");
|
||||
var img = frame.contentDocument.createElement("img");
|
||||
img.src = "/images/green.png";
|
||||
// First request a promise, then remove the iframe.
|
||||
var promise = img.decode();
|
||||
frame.parentNode.removeChild(frame);
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " Decode from iframe, later removed, fails (img not loaded)");
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<meta name="timeout" content="long">
|
||||
<title>SVGImageElement.prototype.decode(), href mutation tests.</title>
|
||||
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
// src tests
|
||||
// -------------------
|
||||
promise_test(function(t) {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.png");
|
||||
var promise = img.decode();
|
||||
img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.svg");
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " xlink:href changes fail decode.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttribute('href', "/images/green.png");
|
||||
var promise = img.decode();
|
||||
img.setAttribute('href', "/images/green.svg");
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " href changes fail decode.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.png");
|
||||
var first_promise = img.decode();
|
||||
img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.svg");
|
||||
var second_promise = img.decode();
|
||||
assert_not_equals(first_promise, second_promise);
|
||||
return Promise.all([
|
||||
promise_rejects(t, "EncodingError", first_promise),
|
||||
second_promise
|
||||
]);
|
||||
}, document.title + " xlink:href changes fail decode; following good decode succeeds.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttribute('href', "/images/green.png");
|
||||
var first_promise = img.decode();
|
||||
img.setAttribute('href', "/images/green.svg");
|
||||
var second_promise = img.decode();
|
||||
assert_not_equals(first_promise, second_promise);
|
||||
return Promise.all([
|
||||
promise_rejects(t, "EncodingError", first_promise),
|
||||
second_promise
|
||||
]);
|
||||
}, document.title + " href changes fail decode; following good decode succeeds.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.png");
|
||||
var first_promise = img.decode();
|
||||
img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/non/existent/path.png");
|
||||
var second_promise = img.decode();
|
||||
assert_not_equals(first_promise, second_promise);
|
||||
return Promise.all([
|
||||
promise_rejects(t, "EncodingError", first_promise),
|
||||
promise_rejects(t, "EncodingError", second_promise)
|
||||
]);
|
||||
}, document.title + " xlink:href changes fail decode; following bad decode fails.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttribute('href', "/images/green.png");
|
||||
var first_promise = img.decode();
|
||||
img.setAttribute('href', "/non/existent/path.png");
|
||||
var second_promise = img.decode();
|
||||
assert_not_equals(first_promise, second_promise);
|
||||
return Promise.all([
|
||||
promise_rejects(t, "EncodingError", first_promise),
|
||||
promise_rejects(t, "EncodingError", second_promise)
|
||||
]);
|
||||
}, document.title + " href changes fail decode; following bad decode fails.");
|
||||
|
||||
</script>
|
|
@ -0,0 +1,121 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<meta name="timeout" content="long">
|
||||
<title>HTMLImageElement.prototype.decode(), src/srcset mutation tests.</title>
|
||||
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
|
||||
<link rel=help href="https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-decode">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
// src tests
|
||||
// -------------------
|
||||
promise_test(function(t) {
|
||||
var img = new Image();
|
||||
img.src = "/images/green.png";
|
||||
var promise = img.decode();
|
||||
img.src = "/images/green.svg";
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " src changes fail decode.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = new Image();
|
||||
img.src = "/images/green.png";
|
||||
var first_promise = img.decode();
|
||||
img.src = "/images/blue.png";
|
||||
var second_promise = img.decode();
|
||||
assert_not_equals(first_promise, second_promise);
|
||||
return Promise.all([
|
||||
promise_rejects(t, "EncodingError", first_promise),
|
||||
second_promise
|
||||
]);
|
||||
}, document.title + " src changes fail decode; following good png decode succeeds.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = new Image();
|
||||
img.src = "/images/green.png";
|
||||
var first_promise = img.decode();
|
||||
img.src = "/images/green.svg";
|
||||
var second_promise = img.decode();
|
||||
assert_not_equals(first_promise, second_promise);
|
||||
return Promise.all([
|
||||
promise_rejects(t, "EncodingError", first_promise),
|
||||
second_promise
|
||||
]);
|
||||
}, document.title + " src changes fail decode; following good svg decode succeeds.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = new Image();
|
||||
img.src = "/images/green.png";
|
||||
var first_promise = img.decode();
|
||||
img.src = "/non/existent/path.png";
|
||||
var second_promise = img.decode();
|
||||
assert_not_equals(first_promise, second_promise);
|
||||
return Promise.all([
|
||||
promise_rejects(t, "EncodingError", first_promise),
|
||||
promise_rejects(t, "EncodingError", second_promise)
|
||||
]);
|
||||
}, document.title + " src changes fail decode; following bad decode fails.");
|
||||
|
||||
promise_test(function(t) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var img = new Image();
|
||||
// We wait for an onload, since the "Updating the image data" spec states
|
||||
// that if a new microtask is scheduled, the old one is canceled so
|
||||
// without the onload, the first decode request would be requested when the
|
||||
// img.src is empty. With an onload, we ensure that the img.src is set and
|
||||
// the image exists before issuing the first decode, then we verify that the
|
||||
// src change to the same value does not prevent that request from
|
||||
// succeeding.
|
||||
img.onload = t.step_func(function() {
|
||||
img.onload = null;
|
||||
|
||||
var first_promise = img.decode();
|
||||
img.src = "/images/green.png";
|
||||
var second_promise = img.decode();
|
||||
assert_not_equals(first_promise, second_promise);
|
||||
resolve(Promise.all([first_promise, second_promise]));
|
||||
});
|
||||
img.src = "/images/green.png";
|
||||
});
|
||||
}, document.title + " src changes to the same path succeed.");
|
||||
|
||||
// srcset tests
|
||||
// -------------------
|
||||
promise_test(function(t) {
|
||||
var img = new Image();
|
||||
img.srcset = "/images/green.png 100w";
|
||||
var promise = img.decode();
|
||||
img.srcset = "/images/green.svg 100w";
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " srcset changes fail decode.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = new Image();
|
||||
img.srcset = "/images/green.png 100w";
|
||||
var first_promise = img.decode();
|
||||
img.srcset = "/images/green.svg 100w";
|
||||
var second_promise = img.decode();
|
||||
assert_not_equals(first_promise, second_promise);
|
||||
return Promise.all([
|
||||
promise_rejects(t, "EncodingError", first_promise),
|
||||
second_promise
|
||||
]);
|
||||
}, document.title + " srcset changes fail decode; following good decode succeeds.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = new Image();
|
||||
img.srcset = "/images/green.png 100w";
|
||||
var first_promise = img.decode();
|
||||
img.srcset = "/non/existent/path.png 100w";
|
||||
var second_promise = img.decode();
|
||||
assert_not_equals(first_promise, second_promise);
|
||||
return Promise.all([
|
||||
promise_rejects(t, "EncodingError", first_promise),
|
||||
promise_rejects(t, "EncodingError", second_promise)
|
||||
]);
|
||||
}, document.title + " srcset changes fail decode; following bad decode fails.");
|
||||
|
||||
</script>
|
|
@ -0,0 +1,133 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<meta name="timeout" content="long">
|
||||
<title>HTMLImageElement.prototype.decode(), picture tests.</title>
|
||||
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
|
||||
<link rel=help href="https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-decode">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<picture>
|
||||
<source srcset="/images/green.png">
|
||||
<source srcset="/images/blue.png">
|
||||
<img id="testimg">
|
||||
</picture>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
promise_test(function() {
|
||||
var picture = document.createElement("picture");
|
||||
var source = document.createElement("source");
|
||||
var img = document.createElement("img");
|
||||
|
||||
picture.appendChild(source);
|
||||
picture.appendChild(img);
|
||||
|
||||
source.srcset = "/images/green.png";
|
||||
|
||||
return img.decode().then(function(arg) {
|
||||
assert_equals(arg, undefined);
|
||||
});
|
||||
}, document.title + " Image with PNG source decodes with undefined.");
|
||||
|
||||
promise_test(function() {
|
||||
var img = document.getElementById("testimg");
|
||||
return img.decode().then(function(arg) {
|
||||
assert_equals(arg, undefined);
|
||||
});
|
||||
}, document.title + " Image with multiple sources decodes with undefined.");
|
||||
|
||||
promise_test(function() {
|
||||
var picture = document.createElement("picture");
|
||||
var source = document.createElement("source");
|
||||
var img = document.createElement("img");
|
||||
|
||||
picture.appendChild(source);
|
||||
picture.appendChild(img);
|
||||
|
||||
source.srcset = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIA" +
|
||||
"AAD91JpzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QUSEioKsy" +
|
||||
"AgywAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAW" +
|
||||
"SURBVAjXY9y3bx8DAwPL58+fGRgYACktBRltLfebAAAAAElFTkSuQmCC";
|
||||
|
||||
return img.decode().then(function(arg) {
|
||||
assert_equals(arg, undefined);
|
||||
});
|
||||
}, document.title + " Image with PNG data URL source decodes with undefined.");
|
||||
|
||||
promise_test(function() {
|
||||
var picture = document.createElement("picture");
|
||||
var source = document.createElement("source");
|
||||
var img = document.createElement("img");
|
||||
|
||||
picture.appendChild(source);
|
||||
picture.appendChild(img);
|
||||
|
||||
source.srcset = "/images/green.svg";
|
||||
|
||||
return img.decode().then(function(arg) {
|
||||
assert_equals(arg, undefined);
|
||||
});
|
||||
}, document.title + " Image with SVG source decodes with undefined.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var picture = document.createElement("picture");
|
||||
var source = document.createElement("source");
|
||||
var img = document.createElement("img");
|
||||
|
||||
picture.appendChild(source);
|
||||
picture.appendChild(img);
|
||||
|
||||
source.srcset = "/non/existent/path.png";
|
||||
|
||||
var promise = img.decode();
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " Non-existent source fails decode.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var picture = document.createElement("picture");
|
||||
var source = document.createElement("source");
|
||||
var img = document.createElement("img");
|
||||
|
||||
picture.appendChild(source);
|
||||
picture.appendChild(img);
|
||||
|
||||
source.srcset = "data:image/png;base64,iVBO00PDR0BADBEEF00KGg";
|
||||
|
||||
var promise = img.decode();
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " Corrupt image in src fails decode.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var picture = document.createElement("picture");
|
||||
var source = document.createElement("source");
|
||||
var img = document.createElement("img");
|
||||
|
||||
picture.appendChild(source);
|
||||
picture.appendChild(img);
|
||||
|
||||
var promise = img.decode();
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " Image without srcset fails decode.");
|
||||
|
||||
promise_test(function() {
|
||||
var picture = document.createElement("picture");
|
||||
var source = document.createElement("source");
|
||||
var img = document.createElement("img");
|
||||
|
||||
picture.appendChild(source);
|
||||
picture.appendChild(img);
|
||||
|
||||
source.srcset = "/images/green.png";
|
||||
|
||||
var first_promise = img.decode();
|
||||
var second_promise = img.decode();
|
||||
assert_not_equals(first_promise, second_promise);
|
||||
return Promise.all([
|
||||
first_promise,
|
||||
second_promise
|
||||
]);
|
||||
}, document.title + " Multiple decodes for images with src succeed.");
|
||||
|
||||
</script>
|
|
@ -0,0 +1,128 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<meta name="timeout" content="long">
|
||||
<title>SVGImageElement.prototype.decode(), basic tests.</title>
|
||||
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
// src tests
|
||||
// -------------------
|
||||
promise_test(function() {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.png");
|
||||
return img.decode().then(function(arg) {
|
||||
assert_equals(arg, undefined);
|
||||
});
|
||||
}, document.title + " Image with PNG xlink:href decodes with undefined.");
|
||||
|
||||
promise_test(function() {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttribute('href', "/images/green.png");
|
||||
return img.decode().then(function(arg) {
|
||||
assert_equals(arg, undefined);
|
||||
});
|
||||
}, document.title + " Image with PNG href decodes with undefined.");
|
||||
|
||||
promise_test(function() {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href',
|
||||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAA" +
|
||||
"D91JpzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QUSEioKsyAgyw" +
|
||||
"AAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAWSURBVA" +
|
||||
"jXY9y3bx8DAwPL58+fGRgYACktBRltLfebAAAAAElFTkSuQmCC");
|
||||
return img.decode().then(function(arg) {
|
||||
assert_equals(arg, undefined);
|
||||
});
|
||||
}, document.title + " Image with PNG data URL xlink:href decodes with undefined.");
|
||||
|
||||
promise_test(function() {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttribute('href',
|
||||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAA" +
|
||||
"D91JpzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QUSEioKsyAgyw" +
|
||||
"AAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAWSURBVA" +
|
||||
"jXY9y3bx8DAwPL58+fGRgYACktBRltLfebAAAAAElFTkSuQmCC");
|
||||
return img.decode().then(function(arg) {
|
||||
assert_equals(arg, undefined);
|
||||
});
|
||||
}, document.title + " Image with PNG data URL href decodes with undefined.");
|
||||
|
||||
promise_test(function() {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.svg");
|
||||
return img.decode().then(function(arg) {
|
||||
assert_equals(arg, undefined);
|
||||
});
|
||||
}, document.title + " Image with SVG xlink:href decodes with undefined.");
|
||||
|
||||
promise_test(function() {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttribute('href', "/images/green.svg");
|
||||
return img.decode().then(function(arg) {
|
||||
assert_equals(arg, undefined);
|
||||
});
|
||||
}, document.title + " Image with SVG href decodes with undefined.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/non/existent/path.png");
|
||||
var promise = img.decode();
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " Non-existent xlink:href fails decode.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttribute('href', "/non/existent/path.png");
|
||||
var promise = img.decode();
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " Non-existent href fails decode.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "data:image/png;base64,iVBO00PDR0BADBEEF00KGg");
|
||||
var promise = img.decode();
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " Corrupt image in xlink:href fails decode.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttribute('href', "data:image/png;base64,iVBO00PDR0BADBEEF00KGg");
|
||||
var promise = img.decode();
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " Corrupt image in href fails decode.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
var promise = img.decode();
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " Image without xlink:href or href fails decode.");
|
||||
|
||||
promise_test(function() {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.png");
|
||||
var first_promise = img.decode();
|
||||
var second_promise = img.decode();
|
||||
assert_not_equals(first_promise, second_promise);
|
||||
return Promise.all([
|
||||
first_promise,
|
||||
second_promise
|
||||
]);
|
||||
}, document.title + " Multiple decodes with a xlink:href succeed.");
|
||||
|
||||
promise_test(function() {
|
||||
var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
||||
img.setAttribute('href', "/images/green.png");
|
||||
var first_promise = img.decode();
|
||||
var second_promise = img.decode();
|
||||
assert_not_equals(first_promise, second_promise);
|
||||
return Promise.all([
|
||||
first_promise,
|
||||
second_promise
|
||||
]);
|
||||
}, document.title + " Multiple decodes with a href succeed.");
|
||||
|
||||
</script>
|
|
@ -0,0 +1,138 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<meta name="timeout" content="long">
|
||||
<title>HTMLImageElement.prototype.decode(), basic tests.</title>
|
||||
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
|
||||
<link rel=help href="https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-decode">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
// src tests
|
||||
// -------------------
|
||||
promise_test(function() {
|
||||
var img = new Image();
|
||||
img.src = "/images/green.png";
|
||||
return img.decode().then(function(arg) {
|
||||
assert_equals(arg, undefined);
|
||||
});
|
||||
}, document.title + " Image with PNG src decodes with undefined.");
|
||||
|
||||
promise_test(function() {
|
||||
var img = new Image();
|
||||
img.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAA" +
|
||||
"D91JpzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QUSEioKsyAgyw" +
|
||||
"AAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAWSURBVA" +
|
||||
"jXY9y3bx8DAwPL58+fGRgYACktBRltLfebAAAAAElFTkSuQmCC";
|
||||
return img.decode().then(function(arg) {
|
||||
assert_equals(arg, undefined);
|
||||
});
|
||||
}, document.title + " Image with PNG data URL src decodes with undefined.");
|
||||
|
||||
promise_test(function() {
|
||||
var img = new Image();
|
||||
img.src = "/images/green.svg";
|
||||
return img.decode().then(function(arg) {
|
||||
assert_equals(arg, undefined);
|
||||
});
|
||||
}, document.title + " Image with SVG src decodes with undefined.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = new Image();
|
||||
img.src = "/non/existent/path.png";
|
||||
var promise = img.decode();
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " Non-existent src fails decode.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var inactive_doc = document.implementation.createHTMLDocument();
|
||||
var img = inactive_doc.createElement("img");
|
||||
img.src = "/images/green.png";
|
||||
var promise = img.decode();
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " Inactive document fails decode.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var inactive_doc = document.implementation.createHTMLDocument();
|
||||
var img = document.createElement("img");
|
||||
img.src = "/images/green.png";
|
||||
var promise = img.decode();
|
||||
inactive_doc.body.appendChild(img);
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " Adopted active image into inactive document fails decode.");
|
||||
|
||||
promise_test(function() {
|
||||
var inactive_doc = document.implementation.createHTMLDocument();
|
||||
var img = inactive_doc.createElement("img");
|
||||
img.src = "/images/green.png";
|
||||
document.body.appendChild(img);
|
||||
return img.decode().then(function(arg) {
|
||||
assert_equals(arg, undefined);
|
||||
});
|
||||
}, document.title + " Adopted inactive image into active document succeeds.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = new Image();
|
||||
img.src = "data:image/png;base64,iVBO00PDR0BADBEEF00KGg";
|
||||
var promise = img.decode();
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " Corrupt image in src fails decode.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = new Image();
|
||||
var promise = img.decode();
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " Image without src/srcset fails decode.");
|
||||
|
||||
promise_test(function() {
|
||||
var img = new Image();
|
||||
img.src = "/images/green.png";
|
||||
var first_promise = img.decode();
|
||||
var second_promise = img.decode();
|
||||
assert_not_equals(first_promise, second_promise);
|
||||
return Promise.all([
|
||||
first_promise,
|
||||
second_promise
|
||||
]);
|
||||
}, document.title + " Multiple decodes for images with src succeed.");
|
||||
|
||||
// srcset tests
|
||||
// -------------------
|
||||
promise_test(function() {
|
||||
var img = new Image();
|
||||
img.srcset = "/images/green.png 100w";
|
||||
return img.decode().then(function(arg) {
|
||||
assert_equals(arg, undefined);
|
||||
});
|
||||
}, document.title + " Image with PNG srcset decodes with undefined.");
|
||||
|
||||
promise_test(function() {
|
||||
var img = new Image();
|
||||
img.srcset = "/images/green.svg 100w";
|
||||
return img.decode().then(function(arg) {
|
||||
assert_equals(arg, undefined);
|
||||
});
|
||||
}, document.title + " Image with SVG srcset decodes with undefined.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var img = new Image();
|
||||
img.srcset = "/non/existent/path.png 100w";
|
||||
var promise = img.decode();
|
||||
return promise_rejects(t, "EncodingError", promise);
|
||||
}, document.title + " Non-existent srcset fails decode.");
|
||||
|
||||
promise_test(function() {
|
||||
var img = new Image();
|
||||
img.srcset = "/images/green.png 100w";
|
||||
var first_promise = img.decode();
|
||||
var second_promise = img.decode();
|
||||
assert_not_equals(first_promise, second_promise);
|
||||
return Promise.all([
|
||||
first_promise,
|
||||
second_promise
|
||||
]);
|
||||
}, document.title + " Multiple decodes for images with srcset succeed.");
|
||||
|
||||
</script>
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Detached image blocks load</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
var img_loaded = false;
|
||||
|
||||
var img = new Image();
|
||||
img.onload = function() {
|
||||
img_loaded = true;
|
||||
};
|
||||
img.src = "/images/blue.png?pipe=trickle(d2)";
|
||||
|
||||
test(function() {
|
||||
assert_false(img_loaded);
|
||||
}, "setting img.src is async");
|
||||
|
||||
async_test(function(t) {
|
||||
document.addEventListener("DOMContentLoaded", t.step_func_done(function() {
|
||||
assert_false(img_loaded);
|
||||
}));
|
||||
}, "DOMContentLoaded doesn't wait for images");
|
||||
|
||||
async_test(function(t) {
|
||||
window.addEventListener("load", t.step_func_done(function() {
|
||||
assert_true(img_loaded);
|
||||
}));
|
||||
}, "load waits for images");
|
||||
</script>
|
|
@ -1,17 +1,26 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Image element delays window's load event</title>
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Inline image element blocks load</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<img src="resources/cat.jpg?pipe=trickle(d2)">
|
||||
<script>
|
||||
async_test(function(t) {
|
||||
var saw_img_load = false;
|
||||
document.querySelector('img').onload = t.step_func(function() {
|
||||
saw_img_load = true;
|
||||
});
|
||||
addEventListener('load', t.step_func_done(function() {
|
||||
assert_true(saw_img_load);
|
||||
}));
|
||||
});
|
||||
var img_loaded = false;
|
||||
</script>
|
||||
<img src="/images/blue.png?pipe=trickle(d2)" onload="img_loaded = true;">
|
||||
<script>
|
||||
test(function() {
|
||||
assert_false(img_loaded);
|
||||
}, "script execution doesn't wait for the image to load");
|
||||
|
||||
async_test(function(t) {
|
||||
document.addEventListener("DOMContentLoaded", t.step_func_done(function() {
|
||||
assert_false(img_loaded);
|
||||
}));
|
||||
}, "DOMContentLoaded doesn't wait for images");
|
||||
|
||||
async_test(function(t) {
|
||||
window.addEventListener("load", t.step_func_done(function() {
|
||||
assert_true(img_loaded);
|
||||
}));
|
||||
}, "Image element delays window's load event");
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>img in non-active document should not perform loads</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
|
||||
<!-- Per load the image so that any loads in this test would be cached. -->
|
||||
<img src=/images/green-1x1.png>
|
||||
|
||||
<!-- tests -->
|
||||
<template>
|
||||
<img>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
onload = function() {
|
||||
async_test(function(t) {
|
||||
var p = new DOMParser();
|
||||
var d = p.parseFromString('<img>', 'text/html');
|
||||
var i = d.querySelector('img');
|
||||
i.onerror = t.unreached_func('got unexpected error event');
|
||||
i.onload = t.unreached_func('got unexpected load event');
|
||||
i.src = '/images/green-1x1.png';
|
||||
// delay to ensure there is no load/error event fired.
|
||||
t.step_timeout(t.step_func_done(), 0);
|
||||
}, "DOMParser");
|
||||
|
||||
async_test(function(t) {
|
||||
var d = document.implementation.createHTMLDocument('');
|
||||
d.body.innerHTML = '<img>';
|
||||
var i = d.querySelector('img');
|
||||
i.onerror = this.unreached_func('got unexpected error event');
|
||||
i.onload = this.unreached_func('got unexpected load event');
|
||||
i.src = '/images/green-1x1.png';
|
||||
// delay to ensure there is no load/error event fired.
|
||||
t.step_timeout(t.step_func_done(), 0);
|
||||
}, "createHTMLDocument");
|
||||
|
||||
async_test(function(t) {
|
||||
var template = document.querySelector('template');
|
||||
var i = template.content.querySelector('img');
|
||||
i.onerror = this.unreached_func('got unexpected error event');
|
||||
i.onload = this.unreached_func('got unexpected load event');
|
||||
i.src = '/images/green-1x1.png';
|
||||
// delay to ensure there is no load/error event fired.
|
||||
t.step_timeout(t.step_func_done(), 0);
|
||||
}, "<template>");
|
||||
};
|
||||
|
||||
</script>
|
|
@ -8,54 +8,54 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<img src="/images/threecolors.png" usemap="#sanityCheck" width="100" height="100">
|
||||
<map name="sanityCheck"><area shape="rect" coords="0,0,100,100"></map>
|
||||
|
||||
<img src="/images/threecolors.png" usemap="#sImPlE" width="100" height="100">
|
||||
<map name="simple"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="SIMPLE"><area shape="rect" coords="0,0,100,100"></map>
|
||||
|
||||
<img src="/images/threecolors.png" usemap="#paSSfield-killroyß" width="100" height="100">
|
||||
<map name="passfield-killroyß"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="PASSFIELD-KILLROYß"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="paſſfield-killroyß"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="passfield-Killroyß"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="paßfield-killroyß"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="paẞfield-killroyß"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="passfield-killroyẞ"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="passfield-killroyß"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="passfıeld-killroyß"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="passfİeld-killroyß"><area shape="rect" coords="0,0,100,100"></map>
|
||||
|
||||
<img src="/images/threecolors.png" usemap="#глупый" width="100" height="100">
|
||||
<map name="глупый"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="ГЛУПЫЙ"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="ГЛУПЫЙ"><area shape="rect" coords="0,0,100,100"></map>
|
||||
|
||||
<img src="/images/threecolors.png" usemap="#åωk" width="100" height="100">
|
||||
<map name="ÅΩK"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="Åωk"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="åΩk"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="åωK"><area shape="rect" coords="0,0,100,100"></map>
|
||||
|
||||
<img src="/images/threecolors.png" usemap="#blah1" width="100" height="100">
|
||||
<map name="blah①"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="blⒶh1"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="blⓐh1"><area shape="rect" coords="0,0,100,100"></map>
|
||||
|
||||
<img src="/images/threecolors.png" usemap="#tÉdz5アパートFi" width="100" height="100">
|
||||
<map name="TÉDZ5アパートFi"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="TéDZ⁵アパートFi"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="tÉdz5㄀Fi"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="tÉdz5アパートFi"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="TÉDZ⁵アパートFi"><area shape="rect" coords="0,0,100,100"></map>
|
||||
<map name="TÉDZ5アパートfi"><area shape="rect" coords="0,0,100,100"></map>
|
||||
|
||||
<img src="/images/threecolors.png" usemap="#ΣΣ" width="100" height="100">
|
||||
<map name="σς"><area shape="rect" coords="0,0,100,100"></map>
|
||||
|
||||
<div id="log"></div>
|
||||
|
||||
<img src="/images/threecolors.png" usemap="#sanityCheck" width="300" height="300">
|
||||
<map name="sanityCheck"><area shape="rect" coords="0,0,300,300"></map>
|
||||
|
||||
<img src="/images/threecolors.png" usemap="#sImPlE" width="300" height="300">
|
||||
<map name="simple"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="SIMPLE"><area shape="rect" coords="0,0,300,300"></map>
|
||||
|
||||
<img src="/images/threecolors.png" usemap="#paSSfield-killroyß" width="300" height="300">
|
||||
<map name="passfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="PASSFIELD-KILLROYß"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="paſſfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="passfield-Killroyß"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="paßfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="paẞfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="passfield-killroyẞ"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="passfield-killroyß"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="passfıeld-killroyß"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="passfİeld-killroyß"><area shape="rect" coords="0,0,300,300"></map>
|
||||
|
||||
<img src="/images/threecolors.png" usemap="#глупый" width="300" height="300">
|
||||
<map name="глупый"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="ГЛУПЫЙ"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="ГЛУПЫЙ"><area shape="rect" coords="0,0,300,300"></map>
|
||||
|
||||
<img src="/images/threecolors.png" usemap="#åωk" width="300" height="300">
|
||||
<map name="ÅΩK"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="Åωk"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="åΩk"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="åωK"><area shape="rect" coords="0,0,300,300"></map>
|
||||
|
||||
<img src="/images/threecolors.png" usemap="#blah1" width="300" height="300">
|
||||
<map name="blah①"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="blⒶh1"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="blⓐh1"><area shape="rect" coords="0,0,300,300"></map>
|
||||
|
||||
<img src="/images/threecolors.png" usemap="#tÉdz5アパートFi" width="300" height="300">
|
||||
<map name="TÉDZ5アパートFi"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="TéDZ⁵アパートFi"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="tÉdz5㌀Fi"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="tÉdz5アパートFi"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="TÉDZ⁵アパートFi"><area shape="rect" coords="0,0,300,300"></map>
|
||||
<map name="TÉDZ5アパートfi"><area shape="rect" coords="0,0,300,300"></map>
|
||||
|
||||
<img src="/images/threecolors.png" usemap="#ΣΣ" width="300" height="300">
|
||||
<map name="σς"><area shape="rect" coords="0,0,300,300"></map>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
setup({ explicit_done: true });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue