Permalink
Browse files

fusejs: Make Fuseboxed constructor's prototype values of the OBJECT__…

…PROTO__ branch conform to ECMA specifications. [jddalton]
  • Loading branch information...
1 parent 75c5fa6 commit 2066e81f731d78cf0d85eca6d7a6fe36a69fa9b8 @jdalton jdalton committed Jan 24, 2010
Showing with 12 additions and 9 deletions.
  1. +2 −0 CHANGELOG
  2. +10 −9 src/lang/fusebox.js
View
@@ -1,3 +1,5 @@
+* Make Fuseboxed constructor's prototype values of the OBJECT__PROTO__ branch conform to ECMA specifications. [jddalton]
+
* Add sandboxed Boolean constructor to Fusebox. [jddalton]
* Add a lot of comments to Fuse.Fusebox() and cleanup its codebase. [jddalton]
View
@@ -88,8 +88,8 @@
throw new Error('Fusebox failed to create a sandbox by iframe.');
}
- result = Fuse[expando];
- delete Fuse[expando];
+ result = global.Fuse[expando];
+ delete global.Fuse[expando];
cache.push(iframe);
return result;
@@ -192,14 +192,15 @@
return result;
};
- // make native wrappers inherit from regular natives
- Array.prototype['__proto__'] = __Array.prototype;
- Date.prototype['__proto__'] = __Date.prototype;
- Function.prototype['__proto__'] = __Function.prototype;
- Number.prototype['__proto__'] = __Number.prototype;
+ // make prototype values conform to ECMA spec and inherit from regular natives
Object.prototype['__proto__'] = __Object.prototype;
- RegExp.prototype['__proto__'] = __RegExp.prototype;
- String.prototype['__proto__'] = __String.prototype;
+ (Array.prototype = [ ])['__proto__'] = __Array.prototype;
+ (Boolean.prototype = new __Boolean)['__proto__'] = __Boolean.prototype;
+ (Date.prototype = new __Date)['__proto__'] = __Date.prototype;
+ (Function.prototype = new __Function)['__proto__'] = __Function.prototype;
+ (Number.prototype = new __Number)['__proto__'] = __Number.prototype;
+ (RegExp.prototype = new __RegExp)['__proto__'] = __RegExp.prototype;
+ (String.prototype = new __String)['__proto__'] = __String.prototype;
}
else {
Array = function Array(length) {

0 comments on commit 2066e81

Please sign in to comment.