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

Side by Side Diff: tools/dom/src/native_DOMImplementation.dart

Issue 30283002: Adding validation that Custom element constructor has zero args (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
« no previous file with comments | « tests/html/custom/created_callback_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of html; 5 part of html;
6 6
7 class _ConsoleVariables { 7 class _ConsoleVariables {
8 Map<String, Object> _data = new Map<String, Object>(); 8 Map<String, Object> _data = new Map<String, Object>();
9 9
10 /** 10 /**
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 } 405 }
406 406
407 static void register(Document document, String tag, Type type, 407 static void register(Document document, String tag, Type type,
408 String extendsTagName) { 408 String extendsTagName) {
409 // TODO(vsm): Move these checks into native code. 409 // TODO(vsm): Move these checks into native code.
410 ClassMirror cls = reflectClass(type); 410 ClassMirror cls = reflectClass(type);
411 if (_isBuiltinType(cls)) { 411 if (_isBuiltinType(cls)) {
412 throw new UnsupportedError("Invalid custom element from $libName."); 412 throw new UnsupportedError("Invalid custom element from $libName.");
413 } 413 }
414 var className = MirrorSystem.getName(cls.simpleName); 414 var className = MirrorSystem.getName(cls.simpleName);
415 if (!cls.constructors.containsKey(new Symbol('$className.created'))) { 415 var createdConstructor = cls.constructors[new Symbol('$className.created')];
416 throw new UnsupportedError('Class is missing constructor $className.create d'); 416 if (createdConstructor == null) {
417 throw new UnsupportedError(
418 'Class is missing constructor $className.created');
419 }
420 if (createdConstructor.parameters.length > 0) {
421 throw new UnsupportedError(
422 'Constructor $className.created must take zero arguments');
417 } 423 }
418 _register(document, tag, type, extendsTagName); 424 _register(document, tag, type, extendsTagName);
419 } 425 }
420 426
421 static void _register(Document document, String tag, Type customType, 427 static void _register(Document document, String tag, Type customType,
422 String extendsTagName) native "Utils_register"; 428 String extendsTagName) native "Utils_register";
423 429
424 static Element createElement(Document document, String tagName) native "Utils_ createElement"; 430 static Element createElement(Document document, String tagName) native "Utils_ createElement";
425 431
426 static void initializeCustomElement(HtmlElement element) native "Utils_initial izeCustomElement"; 432 static void initializeCustomElement(HtmlElement element) native "Utils_initial izeCustomElement";
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 _scheduleImmediateHelper._schedule(callback); 580 _scheduleImmediateHelper._schedule(callback);
575 }; 581 };
576 582
577 get _pureIsolateScheduleImmediateClosure => ((void callback()) => 583 get _pureIsolateScheduleImmediateClosure => ((void callback()) =>
578 throw new UnimplementedError("scheduleMicrotask in background isolates " 584 throw new UnimplementedError("scheduleMicrotask in background isolates "
579 "are not supported in the browser")); 585 "are not supported in the browser"));
580 586
581 void _initializeCustomElement(Element e) { 587 void _initializeCustomElement(Element e) {
582 _Utils.initializeCustomElement(e); 588 _Utils.initializeCustomElement(e);
583 } 589 }
OLDNEW
« no previous file with comments | « tests/html/custom/created_callback_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698