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

Unified Diff: frog/lib/core.js

Issue 8467034: Isolates in frog - tweaks in existing js code to make things run (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 9 years, 1 month 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: frog/lib/core.js
diff --git a/frog/lib/core.js b/frog/lib/core.js
index 4e20d4dc89503389f7566b22d7d3ccb9486a2ed7..84bde13f0ad99d39144df4a673dc8fd93b8747f5 100644
--- a/frog/lib/core.js
+++ b/frog/lib/core.js
@@ -329,8 +329,12 @@ function $varMethod(name, methods) {
}
Object.prototype.get$typeName = function() {
- // TODO(vsm): how can we make this go down the fast path for Chrome?
- //(for Chrome: return this.constructor.name;)
+ // TODO(sigmund): find a way to make this work on all browsers, including
+ // checking the typeName on prototype objects (so we can fix dynamic
+ // dispatching on $varMethod).
+ if (window.constructor.name == 'DOMWindow') { // fast-path for Chrome
+ return this.constructor.name;
+ }
var str = Object.prototype.toString.call(this);
return str.substring(8, str.length - 1);
}
@@ -344,5 +348,5 @@ function $patchMethod(obj, name, methods) {
while (obj && !(method = methods[obj.get$typeName()])) {
obj = Object.getPrototypeOf(obj);
}
- Object.defineProperty(proto, name, {value: method || methods['Object']});
+ obj[name] = method || methods['Object'];
}

Powered by Google App Engine
This is Rietveld 408576698