Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / security / document-domain-invalid.html
blob5bfacbd301e85423b93d0dd0f2a6752370e4207f
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Setting `document.domain` to invalid values fails.</title>
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 <script>
8 test(function () {
9 assert_equals(document.domain, '127.0.0.1');
10 assert_throws('SecurityError',
11 function () {
12 document.domain = null;
13 });
14 assert_equals(document.domain, '127.0.0.1');
15 }, 'Setting `document.domain` to null fails.');
17 test(function () {
18 assert_equals(document.domain, '127.0.0.1');
19 assert_throws('SecurityError',
20 function () {
21 document.domain = '';
22 });
23 assert_equals(document.domain, '127.0.0.1');
24 }, 'Setting `document.domain` to the empty string fails.');
26 test(function () {
27 assert_equals(document.domain, '127.0.0.1');
28 assert_throws('SecurityError',
29 function () {
30 document.domain = '0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.1';
31 });
32 assert_equals(document.domain, '127.0.0.1');
33 }, 'Setting an invalid `document.domain` that looks like an IP address fails.');
34 </script>
35 </head>