Tightening up custom element registration for dart2js

BUG=14093
R=sra@google.com

Review URL: https://codereview.chromium.org//34203002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29007 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
blois@google.com
2013-10-22 16:40:56 +00:00
parent bcf24e3c00
commit cf9be8e65b
3 changed files with 24 additions and 5 deletions
+12 -1
View File
@@ -32931,7 +32931,18 @@ void _registerCustomElement(context, document, String tag, Type type,
if (baseClassName == null) {
throw new ArgumentError(type);
}
if (baseClassName == 'Element') baseClassName = 'HTMLElement';
if (extendsTagName == null) {
if (baseClassName != 'HTMLElement') {
throw new UnsupportedError('Class must provide extendsTag if base '
'native class is not HTMLElement');
}
} else {
if (!JS('bool', '(#.createElement(#) instanceof window[#])',
document, extendsTagName, baseClassName)) {
throw new UnsupportedError('extendsTag does not match base native class');
}
}
var baseConstructor = JS('=Object', '#[#]', context, baseClassName);
-3
View File
@@ -411,6 +411,3 @@ async_test: Timeout # Issue 13719: Please triage this failure.
dromaeo_smoke_test: Fail # Issue 13719: Please triage this failure.
element_offset_test/offset: Pass, Fail # Issue 13719, 13296
touchevent_test/supported: Fail # Issue 13719: Please triage this failure.
[ $compiler == dart2js ]
custom/document_register_type_extensions_test/registration: Fail # Issue 14093
@@ -75,7 +75,18 @@ void _registerCustomElement(context, document, String tag, Type type,
if (baseClassName == null) {
throw new ArgumentError(type);
}
if (baseClassName == 'Element') baseClassName = 'HTMLElement';
if (extendsTagName == null) {
if (baseClassName != 'HTMLElement') {
throw new UnsupportedError('Class must provide extendsTag if base '
'native class is not HTMLElement');
}
} else {
if (!JS('bool', '(#.createElement(#) instanceof window[#])',
document, extendsTagName, baseClassName)) {
throw new UnsupportedError('extendsTag does not match base native class');
}
}
var baseConstructor = JS('=Object', '#[#]', context, baseClassName);