blob: a653934874c16d80cb048ceb647ca95f8586bc9a [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-scripts" + possibleDelimiter + "allow-forms";
var iframe = document.createElement('iframe');
iframe.sandbox = policy;
iframe.src = "data:text/html,<script>alert('" + message + "');<\/script>";
iframe.onload = next;
document.body.appendChild(iframe);
}
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
next();
</script>