OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <link rel="help" href="http://url.spec.whatwg.org/#dom-url"> | 2 <link rel="help" href="http://url.spec.whatwg.org/#dom-url"> |
3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 <script> | 5 <script> |
6 function assert_type_error(func, expected) { | 6 function assert_type_error(func, expected) { |
7 try { | 7 try { |
8 func(); | 8 func(); |
9 } catch (ex) { | 9 } catch (ex) { |
10 assert_true(ex instanceof TypeError); | 10 assert_true(ex instanceof TypeError); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 assert_type_error( | 46 assert_type_error( |
47 function() { new URL('http:///www.domain.com/', 'abc'); }, | 47 function() { new URL('http:///www.domain.com/', 'abc'); }, |
48 'TypeError: Failed to construct \'URL\': Invalid base URL'); | 48 'TypeError: Failed to construct \'URL\': Invalid base URL'); |
49 assert_type_error( | 49 assert_type_error( |
50 function() { new URL('http:///www.domain.com/', null); }, | 50 function() { new URL('http:///www.domain.com/', null); }, |
51 'TypeError: Failed to construct \'URL\': Invalid base URL'); | 51 'TypeError: Failed to construct \'URL\': Invalid base URL'); |
52 assert_type_error( | 52 assert_type_error( |
53 function() { new URL('//abc', null); }, | 53 function() { new URL('//abc', null); }, |
54 'TypeError: Failed to construct \'URL\': Invalid base URL'); | 54 'TypeError: Failed to construct \'URL\': Invalid base URL'); |
55 }, 'Invalid URL parameters'); | 55 }, 'Invalid URL parameters'); |
| 56 |
| 57 test(function() { |
| 58 function assert_enumerable(p) { |
| 59 assert_true(p in URL.prototype); |
| 60 assert_true(URL.prototype.propertyIsEnumerable(p)); |
| 61 } |
| 62 |
| 63 assert_true('URL' in self); |
| 64 |
| 65 // TODO: uncomment when implemented. |
| 66 // assert_true('domainToASCII' in URL); |
| 67 // assert_true('domainToUnicode' in URL); |
| 68 |
| 69 // Arguably better failure stacks to spell them out this way.. |
| 70 assert_enumerable('toString'); |
| 71 assert_enumerable('origin'); |
| 72 assert_enumerable('protocol'); |
| 73 assert_enumerable('username'); |
| 74 assert_enumerable('password'); |
| 75 assert_enumerable('host'); |
| 76 assert_enumerable('hostname'); |
| 77 assert_enumerable('port'); |
| 78 assert_enumerable('pathname'); |
| 79 assert_enumerable('search'); |
| 80 assert_enumerable('searchParams'); |
| 81 assert_enumerable('hash'); |
| 82 }, 'URL interface'); |
56 </script> | 83 </script> |
OLD | NEW |