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

Unified Diff: sdk/lib/js/dart2js/js_dart2js.dart

Issue 138723006: Ensure that dart:js does not attempt to load cached proxies from prototypes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 | « no previous file | tests/html/js_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/js/dart2js/js_dart2js.dart
diff --git a/sdk/lib/js/dart2js/js_dart2js.dart b/sdk/lib/js/dart2js/js_dart2js.dart
index b1003d98d1490c92fb6b38e04a45e293a1aa4bad..576cb23451a596c23f569eecca11f7185d2cebbb 100644
--- a/sdk/lib/js/dart2js/js_dart2js.dart
+++ b/sdk/lib/js/dart2js/js_dart2js.dart
@@ -471,6 +471,13 @@ bool _defineProperty(o, String name, value) {
return false;
}
+Object _getOwnProperty(o, String name) {
+ if (JS('bool', 'Object.prototype.hasOwnProperty.call(#, #)', o, name)) {
+ return JS('', '#[#]', o, name);
+ }
+ return null;
+}
+
bool _isLocalObject(o) => JS('bool', '# instanceof Object', o);
dynamic _convertToJS(dynamic o) {
@@ -498,7 +505,7 @@ dynamic _convertToJS(dynamic o) {
}
Object _getJsProxy(o, String propertyName, createProxy(o)) {
- var jsProxy = JS('', '#[#]', o, propertyName);
+ var jsProxy = _getOwnProperty(o, propertyName);
if (jsProxy == null) {
jsProxy = createProxy(o);
_defineProperty(o, propertyName, jsProxy);
@@ -543,7 +550,7 @@ JsObject _wrapToDart(o) {
}
Object _getDartProxy(o, String propertyName, createProxy(o)) {
- var dartProxy = JS('', '#[#]', o, propertyName);
+ var dartProxy = _getOwnProperty(o, propertyName);
// Temporary fix for dartbug.com/15193
// In some cases it's possible to see a JavaScript object that
// came from a different context and was previously proxied to
« no previous file with comments | « no previous file | tests/html/js_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698