blob: d9445dd474f45c9af9d9912c1113bc6e279ab00b [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>alert('" + message + "');<\/script>";
iframe.onload = next;
document.body.appendChild(iframe);
}
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
next();
</script>