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

Side by Side Diff: pkg/polymer/lib/polymer_element.dart

Issue 23618008: Suppressing exceptions in Dartium's dart:js usage (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« no previous file with comments | « no previous file | sdk/lib/js/dartium/js_dartium.dart » ('j') | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library polymer.polymer_element; 5 library polymer.polymer_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'dart:mirrors'; 9 import 'dart:mirrors';
10 import 'dart:js' as dartJs; 10 import 'dart:js' as dartJs;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 return new _PolymerBinding(this, name, model, path, propObserver); 169 return new _PolymerBinding(this, name, model, path, propObserver);
170 } 170 }
171 return super.createBinding(name, model, path); 171 return super.createBinding(name, model, path);
172 } 172 }
173 173
174 /** 174 /**
175 * Using Polymer's platform/src/ShadowCSS.js passing the style tag's content. 175 * Using Polymer's platform/src/ShadowCSS.js passing the style tag's content.
176 */ 176 */
177 void _shimCss(ShadowRoot root, String localName, String extendsName) { 177 void _shimCss(ShadowRoot root, String localName, String extendsName) {
178 // TODO(terry): Need to detect if ShadowCSS.js has been loaded. Under 178 // TODO(terry): Need to detect if ShadowCSS.js has been loaded. Under
179 // Dartium this wouldn't exist. However, dart:js isn't robust 179 // Dartium this wouldn't exist. However, dart:js isn't robust
blois 2013/08/27 20:29:30 Not sure if there are additional changes I should
180 // to use to detect in both Dartium and dart2js if Platform is 180 // to use to detect in both Dartium and dart2js if Platform is
181 // defined. Instead in Dartium it throws an exception but in 181 // defined. This bug is described in
182 // dart2js it works enough to know if Platform is defined (just
183 // can't be used for further derefs). This bug is described
184 // https://code.google.com/p/dart/issues/detail?id=12548 182 // https://code.google.com/p/dart/issues/detail?id=12548
185 // When fixed only use dart:js. This is necessary under 183 // When fixed only use dart:js. This is necessary under
186 // Dartium (no compile) we want to run w/o the JS polyfill. 184 // Dartium (no compile) we want to run w/o the JS polyfill.
187 try { 185 if (dartJs.context == null || !dartJs.context.hasProperty('Platform')) {
188 if (dartJs.context["Platform"] == null) { return; } 186 return;
terry 2013/08/27 23:30:09 Nice to eliminate the try/catch.
189 } on NoSuchMethodError catch (e) { return; } 187 }
190 188
191 var platform = js.context["Platform"]; 189 var platform = js.context["Platform"];
192 if (platform == null) return; 190 if (platform == null) return;
193 var shadowCss = platform.ShadowCSS; 191 var shadowCss = platform.ShadowCSS;
194 if (shadowCss == null) return; 192 if (shadowCss == null) return;
195 193
196 // TODO(terry): Remove calls to shimShadowDOMStyling2 and replace with 194 // TODO(terry): Remove calls to shimShadowDOMStyling2 and replace with
197 // shimShadowDOMStyling when we support unwrapping dart:html 195 // shimShadowDOMStyling when we support unwrapping dart:html
198 // Element to a JS DOM node. 196 // Element to a JS DOM node.
199 var shimShadowDOMStyling2 = shadowCss.shimShadowDOMStyling2; 197 var shimShadowDOMStyling2 = shadowCss.shimShadowDOMStyling2;
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 'onKeyMessage': MediaElement.keyMessageEvent, 555 'onKeyMessage': MediaElement.keyMessageEvent,
558 'onNeedKey': MediaElement.needKeyEvent, 556 'onNeedKey': MediaElement.needKeyEvent,
559 'onWebGlContextLost': CanvasElement.webGlContextLostEvent, 557 'onWebGlContextLost': CanvasElement.webGlContextLostEvent,
560 'onWebGlContextRestored': CanvasElement.webGlContextRestoredEvent, 558 'onWebGlContextRestored': CanvasElement.webGlContextRestoredEvent,
561 'onPointerLockChange': Document.pointerLockChangeEvent, 559 'onPointerLockChange': Document.pointerLockChangeEvent,
562 'onPointerLockError': Document.pointerLockErrorEvent, 560 'onPointerLockError': Document.pointerLockErrorEvent,
563 'onReadyStateChange': Document.readyStateChangeEvent, 561 'onReadyStateChange': Document.readyStateChangeEvent,
564 'onSelectionChange': Document.selectionChangeEvent, 562 'onSelectionChange': Document.selectionChangeEvent,
565 'onSecurityPolicyViolation': Document.securityPolicyViolationEvent, 563 'onSecurityPolicyViolation': Document.securityPolicyViolationEvent,
566 }; 564 };
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/js/dartium/js_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698