| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Custom Elements: Element definition</title> | 2 <title>Custom Elements: Element definition</title> |
| 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 <body> | 5 <body> |
| 6 <div id="log"></div> | 6 <div id="log"></div> |
| 7 <iframe id="iframe"></iframe> | 7 <iframe id="iframe"></iframe> |
| 8 <script> | 8 <script> |
| 9 'use strict'; | 9 'use strict'; |
| 10 (() => { | 10 (() => { |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 }); | 207 }); |
| 208 }, 'If Type(constructor.prototype) is undefined, should throw a TypeError'); | 208 }, 'If Type(constructor.prototype) is undefined, should throw a TypeError'); |
| 209 test(() => { | 209 test(() => { |
| 210 function c() {}; | 210 function c() {}; |
| 211 c.prototype = 'string'; | 211 c.prototype = 'string'; |
| 212 assert_throws(expectTypeError, () => { | 212 assert_throws(expectTypeError, () => { |
| 213 customElements.define('test-define-constructor-prototype-string', c); | 213 customElements.define('test-define-constructor-prototype-string', c); |
| 214 }); | 214 }); |
| 215 }, 'If Type(constructor.prototype) is string, should throw a TypeError'); | 215 }, 'If Type(constructor.prototype) is string, should throw a TypeError'); |
| 216 | 216 |
| 217 // 13.4. Let connectedCallbackValue be Get(prototype, "connectedCallback"). | 217 // 13.3. Let lifecycleCallbacks be a map with the four keys "connectedCallback
", |
| 218 // Rethrow any exceptions. | 218 // "disconnectedCallback", "adoptedCallback", and "attributeChangedCallback", |
| 219 // 13.5. If connectedCallbackValue is not undefined, then set connectedCallbac
k | 219 // each of which belongs to an entry whose value is null. |
| 220 // to the result of converting connectedCallbackValue to the Web IDL Function
callback type. | 220 // 13.4. For each of the four keys callbackName in lifecycleCallbacks: |
| 221 // Rethrow any exceptions. | 221 // 13.4.1. Let callbackValue be Get(prototype, callbackName). Rethrow any exce
ptions. |
| 222 // 13.6. Let disconnectedCallbackValue be Get(prototype, "disconnectedCallback
"). | 222 // 13.4.2. If callbackValue is not undefined, then set the value of the entry
in |
| 223 // Rethrow any exceptions. | 223 // lifecycleCallbacks with key callbackName to the result of converting callba
ckValue |
| 224 // 13.7. If disconnectedCallbackValue is not undefined, then set disconnectedC
allback | 224 // to the Web IDL Function callback type. Rethrow any exceptions from the conv
ersion. |
| 225 // to the result of converting disconnectedCallbackValue to the Web IDL Functi
on callback type. | |
| 226 // Rethrow any exceptions. | |
| 227 // 13.8. Let attributeChangedCallbackValue be Get(prototype, "attributeChanged
Callback"). | |
| 228 // Rethrow any exceptions. | |
| 229 // 13.9. If attributeChangedCallbackValue is not undefined, then set attribute
ChangedCallback | |
| 230 // to the result of converting attributeChangedCallbackValue to the Web IDL Fu
nction callback type. | |
| 231 // Rethrow any exceptions. | |
| 232 [ | 225 [ |
| 233 'connectedCallback', | 226 'connectedCallback', |
| 234 'disconnectedCallback', | 227 'disconnectedCallback', |
| 228 'adoptedCallback', |
| 235 'attributeChangedCallback', | 229 'attributeChangedCallback', |
| 236 ].forEach(name => { | 230 ].forEach(name => { |
| 237 test(() => { | 231 test(() => { |
| 238 class C { | 232 class C { |
| 239 get [name]() { throw_rethrown_error(); } | 233 get [name]() { throw_rethrown_error(); } |
| 240 } | 234 } |
| 241 assert_rethrown(() => { | 235 assert_rethrown(() => { |
| 242 customElements.define(`test-define-${name.toLowerCase()}-rethrow`, C); | 236 customElements.define(`test-define-${name.toLowerCase()}-rethrow`, C); |
| 243 }); | 237 }); |
| 244 }, `If constructor.prototype.${name} throws, should rethrow`); | 238 }, `If constructor.prototype.${name} throws, should rethrow`); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 259 assert_throws(expectTypeError, () => { | 253 assert_throws(expectTypeError, () => { |
| 260 customElements.define(`test-define-${name.toLowerCase()}-${data.name
}`, C); | 254 customElements.define(`test-define-${name.toLowerCase()}-${data.name
}`, C); |
| 261 }); | 255 }); |
| 262 } | 256 } |
| 263 }, `If constructor.prototype.${name} is ${data.name}, should ${data.succes
s ? 'succeed' : 'throw a TypeError'}`); | 257 }, `If constructor.prototype.${name} is ${data.name}, should ${data.succes
s ? 'succeed' : 'throw a TypeError'}`); |
| 264 }); | 258 }); |
| 265 }); | 259 }); |
| 266 })(); | 260 })(); |
| 267 </script> | 261 </script> |
| 268 </body> | 262 </body> |
| OLD | NEW |