Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(656)

Side by Side Diff: LayoutTests/imported/web-platform-tests/custom-elements/instantiating-custom-elements/non-configurable-constructor-property.html

Issue 560893005: First checked-in import of the W3C's test suites. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add new expectations for newly failing w3c tests Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>If prototype has a non-configurable property named constructor, Document. registerElement() throws NotSupportedError</title>
5 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
6 <meta name="assert" content="If PROTOTYPE has a non-configurable property named constructor, throw a NotSupportedError and stop">
7 <link rel="help" href="http://www.w3.org/TR/custom-elements/#instantiating-custo m-elements">
8 <script src="../../../../resources/testharness.js"></script>
9 <script src="../../../../resources/testharnessreport.js"></script>
10 <script src="../testcommon.js"></script>
11 <link rel="stylesheet" href="../../../../resources/testharness.css">
12 </head>
13 <body>
14 <div id="log"></div>
15 <script>
16 test(function() {
17 var doc = newHTMLDocument();
18 var proto = Object.create(HTMLElement.prototype);
19 Object.defineProperty(proto, 'constructor', {configurable: false});
20 assert_throws('NotSupportedError', function() {
21 doc.registerElement('x-a', {prototype: proto});
22 }, 'Exception should be thrown in case of attempt to register element ' +
23 'with a non-configurable property named constructor');
24 }, 'Test Document.registerElement() throws NotSupportedError ' +
25 'if prototype has a non-configurable property named constructor');
26
27
28 test(function() {
29 var doc = newHTMLDocument();
30 var proto = Object.create(HTMLElement.prototype);
31 Object.defineProperty(proto, 'constructor', {configurable: true});
32 try {
33 doc.registerElement('x-b', {prototype: proto});
34 } catch (e) {
35 assert_unreached('Exception should not be thrown in case of attempt to r egister ' +
36 'element with a configurable property named constructor');
37 }
38 }, 'Test Document.registerElement() accepts prototype with a configurable ' +
39 'property named constructor without throwing errors');
40 </script>
41 </body>
42 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698