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

Unified Diff: tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate

Issue 1401703002: Added for registerElement checking (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate b/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
index 03f4b642a8c365fd6f6fad41b3a9be48b2ab36e4..3f651f2044d146020a1983d503f2caaa8c460abe 100644
--- a/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
+++ b/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
@@ -357,6 +357,16 @@ $else
// Figure out which DOM class is being extended from the user's Dart class.
var classMirror = reflectClass(customElementClass);
+
+ var locationUri = classMirror.location.sourceUri.toString();
+ if (locationUri == 'dart:html' || locationUri == 'dart:svg') {
+ throw new DomException.jsInterop("HierarchyRequestError: Cannot register an existing dart:html or dart:svg type.");
+ }
+
+ if (classMirror.isAbstract) {
+ throw new DomException.jsInterop("HierarchyRequestError: Cannot register an abstract class.");
+ }
+
var jsClassName = _getJSClassName(classMirror);
if (jsClassName == null) {
// Only components derived from HTML* can be extended.
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698