Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <title>Custom Elements: whenDefined with invalid name</title> | |
| 3 <script src="../../resources/testharness.js"></script> | |
| 4 <script src="../../resources/testharness-helpers.js"></script> | |
|
kojii
2016/06/29 03:57:41
Please remove this, this file does not exist. I kn
| |
| 5 <script src="../../resources/testharnessreport.js"></script> | |
| 6 <script src="resources/custom-elements-helpers.js"></script> | |
| 7 <body> | |
| 8 <script> | |
| 9 | |
| 10 'use strict'; | |
| 11 | |
| 12 (() => { | |
| 13 // https://html.spec.whatwg.org/multipage/scripting.html#valid-custom-element- name | |
| 14 let invalid_names = [ | |
| 15 'annotation-xml', | |
| 16 'color-profile', | |
| 17 'font-face', | |
| 18 'font-face-src', | |
| 19 'font-face-uri', | |
| 20 'font-face-format', | |
| 21 'font-face-name', | |
| 22 'missing-glyph', | |
| 23 'div', 'p', | |
| 24 'nothtmlbutnohyphen', | |
| 25 '-not-initial-a-z', '0not-initial-a-z', 'Not-initial-a-z', | |
| 26 'intermediate-UPPERCASE-letters', | |
| 27 'bad-\u00b6', 'bad-\u00b8', 'bad-\u00bf', 'bad-\u00d7', 'bad-\u00f7', | |
| 28 'bad-\u037e', 'bad-\u037e', 'bad-\u2000', 'bad-\u200e', 'bad-\u203e', | |
| 29 'bad-\u2041', 'bad-\u206f', 'bad-\u2190', 'bad-\u2bff', 'bad-\u2ff0', | |
| 30 'bad-\u3000', 'bad-\ud800', 'bad-\uf8ff', 'bad-\ufdd0', 'bad-\ufdef', | |
| 31 'bad-\ufffe', 'bad-\uffff', 'bad-' + String.fromCodePoint(0xf0000) | |
| 32 ]; | |
| 33 | |
| 34 invalid_names.forEach((name) => { | |
| 35 promise_test((t) => { | |
| 36 return create_window_in_test(t) | |
| 37 .then((w) => { | |
| 38 console.log(name); | |
|
kojii
2016/06/29 03:57:41
Remove this.
| |
| 39 return promise_rejects_with_dom_exception_syntax_error(w, t, w.customEle ments.whenDefined(name)); | |
| 40 // return promise_rejects_with_dom_exception_syntax_error(w, t, Promise. reject(new SyntaxError)); | |
|
kojii
2016/06/29 03:57:40
Remove this.
| |
| 41 }); | |
| 42 }, 'whenDefined() called with invalid name ' + name + ' should throw "Syntax Error"DOMEXception'); | |
| 43 }); | |
| 44 | |
| 45 // Since both DOMException syntax error and JavaScript SyntaxError have | |
| 46 // name property set to 'SyntaxError', assert_throws cannot distinguish them. | |
| 47 function promise_rejects_with_dom_exception_syntax_error(global_context, test, promise, description) { | |
| 48 return promise.then(test.unreached_func("Should have rejected: " + descripti on)).catch(function(e) { | |
| 49 assert_true(e instanceof global_context.DOMException); | |
| 50 assert_throws('SYNTAX_ERR', function () { throw e; }); | |
| 51 }); | |
| 52 } | |
| 53 })(); | |
| 54 </script> | |
| 55 </body> | |
| OLD | NEW |