OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../js/resources/js-test-pre.js"></script> | 4 <script src="../../js/resources/js-test-pre.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <div id="container"></div> | 7 <div id="container"></div> |
8 <script> | 8 <script> |
9 description('Testing document.register() basic behaviors.'); | 9 description('Testing document.register() basic behaviors.'); |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // Bad prototype: prototype is already a built-in interface prototype object | 26 // Bad prototype: prototype is already a built-in interface prototype object |
27 shouldThrow('document.register("x-bad-a", HTMLElement)', '"NotSupportedError: Fa
iled to call \'register\' on \'Document\' for type \'x-bad-a\': prototype is alr
eady in-use as an interface prototype object."'); | 27 shouldThrow('document.register("x-bad-a", HTMLElement)', '"NotSupportedError: Fa
iled to call \'register\' on \'Document\' for type \'x-bad-a\': prototype is alr
eady in-use as an interface prototype object."'); |
28 // Bad prototype: prototype is already a Custom Element interface prototype obje
ct | 28 // Bad prototype: prototype is already a Custom Element interface prototype obje
ct |
29 shouldThrow('document.register("x-bad-b", fooConstructor)', '"NotSupportedError:
Failed to call \'register\' on \'Document\' for type \'x-bad-b\': prototype is
already in-use as an interface prototype object."'); | 29 shouldThrow('document.register("x-bad-b", fooConstructor)', '"NotSupportedError:
Failed to call \'register\' on \'Document\' for type \'x-bad-b\': prototype is
already in-use as an interface prototype object."'); |
30 // Bad prototype: 'constructor' is not configurable | 30 // Bad prototype: 'constructor' is not configurable |
31 var proto = Object.create(HTMLElement.prototype, { | 31 var proto = Object.create(HTMLElement.prototype, { |
32 constructor: {configurable: false, writable: true} | 32 constructor: {configurable: false, writable: true} |
33 }); | 33 }); |
34 shouldThrow('document.register("x-bad-c", { prototype: proto })', '"NotSupported
Error: Failed to call \'register\' on \'Document\' for type \'x-bad-c\': prototy
pe constructor property is not configurable."'); | 34 shouldThrow('document.register("x-bad-c", { prototype: proto })', '"NotSupported
Error: Failed to call \'register\' on \'Document\' for type \'x-bad-c\': prototy
pe constructor property is not configurable."'); |
35 // Bad prototype: missing __proto__ | |
36 shouldThrow('document.register("x-bad-d", { prototype: {} })', '"InvalidStateErr
or: Failed to call \'register\' on \'Document\' for type \'x-bad-d\': the protot
ype does not extend an HTML or SVG element."'); | |
37 // Bad prototype: wrong __proto__ | |
38 shouldThrow('document.register("x-bad-e", { prototype: Object.create(Document.pr
ototype) })', '"InvalidStateError: Failed to call \'register\' on \'Document\' f
or type \'x-bad-e\': the prototype does not extend an HTML or SVG element."'); | |
39 // Call as function | 35 // Call as function |
40 shouldThrow('fooConstructor()', '"TypeError: DOM object constructor cannot be ca
lled as a function."') | 36 shouldThrow('fooConstructor()', '"TypeError: DOM object constructor cannot be ca
lled as a function."') |
41 | 37 |
42 // Constructor initiated instantiation | 38 // Constructor initiated instantiation |
43 var createdFoo = new fooConstructor(); | 39 var createdFoo = new fooConstructor(); |
44 | 40 |
45 // JS built-in properties | 41 // JS built-in properties |
46 shouldBe('createdFoo.__proto__', 'fooConstructor.prototype'); | 42 shouldBe('createdFoo.__proto__', 'fooConstructor.prototype'); |
47 shouldBe('createdFoo.constructor', 'fooConstructor'); | 43 shouldBe('createdFoo.constructor', 'fooConstructor'); |
48 | 44 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 95 |
100 // Constructors shouldn't interfere with each other | 96 // Constructors shouldn't interfere with each other |
101 shouldBe('(new fooConstructor).tagName', '"X-FOO"'); | 97 shouldBe('(new fooConstructor).tagName', '"X-FOO"'); |
102 shouldBe('(new barConstructor).tagName', '"X-BAR"'); | 98 shouldBe('(new barConstructor).tagName', '"X-BAR"'); |
103 shouldBe('(new bazConstructor).tagName', '"X-BAZ"'); | 99 shouldBe('(new bazConstructor).tagName', '"X-BAZ"'); |
104 | 100 |
105 </script> | 101 </script> |
106 <script src="../../js/resources/js-test-post.js"></script> | 102 <script src="../../js/resources/js-test-post.js"></script> |
107 </body> | 103 </body> |
108 </html> | 104 </html> |
OLD | NEW |