blob: 5bfacbd301e85423b93d0dd0f2a6752370e4207f [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>Setting `document.domain` to invalid values fails.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function () {
assert_equals(document.domain, '127.0.0.1');
assert_throws('SecurityError',
function () {
document.domain = null;
});
assert_equals(document.domain, '127.0.0.1');
}, 'Setting `document.domain` to null fails.');
test(function () {
assert_equals(document.domain, '127.0.0.1');
assert_throws('SecurityError',
function () {
document.domain = '';
});
assert_equals(document.domain, '127.0.0.1');
}, 'Setting `document.domain` to the empty string fails.');
test(function () {
assert_equals(document.domain, '127.0.0.1');
assert_throws('SecurityError',
function () {
document.domain = '0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.1';
});
assert_equals(document.domain, '127.0.0.1');
}, 'Setting an invalid `document.domain` that looks like an IP address fails.');
</script>
</head>