blob: c05c1aafd0148941b80a1214b4ff789d82a8d597 [file] [log] [blame]
This tests whether we correct parse various space characters in the sandbox attribute.<br>
<script>
var testCases = [
[' ', 'PASS: Space is a delimiter character.'],
['\t', 'PASS: Tab is a delimiter.'],
['x', 'FAIL: x is not a delimiter.'],
['\r', 'PASS: Return is a delimiter.'],
['\n', 'PASS: Newline is a delimiter.'],
['\v', 'FAIL: Vertical tab is not a delimiter.'],
['\f', 'PASS: Form feed is a delimiter.'],
]
function next() {
if (testCases.length) {
var testCase = testCases.pop();
testCharacter.apply(null, testCase);
return;
}
if (window.testRunner)
testRunner.notifyDone();
}
function testCharacter(possibleDelimiter, message) {
var policy = "allow-modals allow-scripts" + possibleDelimiter + "allow-forms";
var iframe = document.createElement('iframe');
iframe.sandbox = policy;
iframe.src = "data:text/html,<script>console.log('" + message + "');<\/script>";
iframe.onload = next;
document.body.appendChild(iframe);
}
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
next();
</script>