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

Unified Diff: tools/dom/templates/html/dartium/html_dartium.darttemplate

Issue 1395723002: Fixed upgrade failures to only throw once not on each wrap_jso (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update to get latest WebKit changes. 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
Index: tools/dom/templates/html/dartium/html_dartium.darttemplate
diff --git a/tools/dom/templates/html/dartium/html_dartium.darttemplate b/tools/dom/templates/html/dartium/html_dartium.darttemplate
index 7d6572c5d0275b1e731f580c5d5d84cca25a9180..cd9f49c4e7aead3e4d1169559f7c8bd79ee9679d 100644
--- a/tools/dom/templates/html/dartium/html_dartium.darttemplate
+++ b/tools/dom/templates/html/dartium/html_dartium.darttemplate
@@ -569,8 +569,9 @@ wrap_jso_custom_element(jsObject) {
// Upgrade a Dart HtmlElement to the user's Dart custom element class.
_upgradeHtmlElement(dartInstance) {
- var dartInstanceMirror = reflect(dartInstance);
- if (dartInstanceMirror.type.qualifiedName == #dart.dom.html.HtmlElement) {
+ // Only try upgrading HtmlElement (Dart class) if there is a failure then
+ // don't try it again - one failure is enough.
+ if (dartInstance.runtimeType == HtmlElement && !dartInstance.isBadUpgrade) {
// Must be exactly HtmlElement not something derived from it.
var jsObject = dartInstance.blink_jsObject;
var localName = dartInstance.localName;
@@ -579,6 +580,8 @@ _upgradeHtmlElement(dartInstance) {
if (customElementClass != null) {
try {
dartInstance = _blink.Blink_Utils.constructElement(customElementClass, jsObject);
+ } catch (e) {
+ dartInstance.badUpgrade();
} finally {
dartInstance.blink_jsObject = jsObject;
jsObject['dart_class'] = dartInstance;
@@ -678,6 +681,7 @@ createCustomUpgrader(Type customElementClass, $this) {
try {
dartClass = _blink.Blink_Utils.constructElement(customElementClass, $this);
} catch (e) {
+ dartClass.badUpgrade();
throw e;
} finally {
// Need to remember the Dart class that was created for this custom so

Powered by Google App Engine
This is Rietveld 408576698