Skip to content

Commit

Permalink
Prevents arguments from leaking
Browse files Browse the repository at this point in the history
  • Loading branch information
twokul committed Aug 20, 2014
1 parent 714fa89 commit 22e886a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/ember-metal/lib/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ function superFunction(){
var func = this.__nextSuper;
var ret;
if (func) {
var args = new Array(arguments.length);
for (var i = 0, l = args.length; i < l; i++) {
args[i] = arguments[i];
}
this.__nextSuper = null;
ret = apply(this, func, arguments);
ret = apply(this, func, args);
this.__nextSuper = func;
}
return ret;
Expand Down
8 changes: 6 additions & 2 deletions packages/ember-metal/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,13 @@ export function metaPath(obj, path, writable) {
export function wrap(func, superFunc) {
function superWrapper() {
var ret;
var sup = this && this.__nextSuper;
var sup = this && this.__nextSuper;
var args = new Array(arguments.length);
for (var i = 0, l = args.length; i < l; i++) {
args[i] = arguments[i];
}
if(this) { this.__nextSuper = superFunc; }
ret = apply(this, func, arguments);
ret = apply(this, func, args);
if(this) { this.__nextSuper = sup; }
return ret;
}
Expand Down

0 comments on commit 22e886a

Please sign in to comment.