Skip to content

Commit

Permalink
fusejs: Make Fuseboxed constructor's prototype values of the OBJECT__…
Browse files Browse the repository at this point in the history
…PROTO__ branch conform to ECMA specifications. [jddalton]
  • Loading branch information
jdalton committed Jan 24, 2010
1 parent 75c5fa6 commit 2066e81
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
@@ -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 sandboxed Boolean constructor to Fusebox. [jddalton]


* Add a lot of comments to Fuse.Fusebox() and cleanup its codebase. [jddalton] * Add a lot of comments to Fuse.Fusebox() and cleanup its codebase. [jddalton]
Expand Down
19 changes: 10 additions & 9 deletions src/lang/fusebox.js
Expand Up @@ -88,8 +88,8 @@
throw new Error('Fusebox failed to create a sandbox by iframe.'); throw new Error('Fusebox failed to create a sandbox by iframe.');
} }


result = Fuse[expando]; result = global.Fuse[expando];
delete Fuse[expando]; delete global.Fuse[expando];


cache.push(iframe); cache.push(iframe);
return result; return result;
Expand Down Expand Up @@ -192,14 +192,15 @@
return result; return result;
}; };


// make native wrappers inherit from regular natives // make prototype values conform to ECMA spec and inherit from regular natives
Array.prototype['__proto__'] = __Array.prototype;
Date.prototype['__proto__'] = __Date.prototype;
Function.prototype['__proto__'] = __Function.prototype;
Number.prototype['__proto__'] = __Number.prototype;
Object.prototype['__proto__'] = __Object.prototype; Object.prototype['__proto__'] = __Object.prototype;
RegExp.prototype['__proto__'] = __RegExp.prototype; (Array.prototype = [ ])['__proto__'] = __Array.prototype;
String.prototype['__proto__'] = __String.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 { else {
Array = function Array(length) { Array = function Array(length) {
Expand Down

0 comments on commit 2066e81

Please sign in to comment.