Index: src/v8natives.js |
diff --git a/src/v8natives.js b/src/v8natives.js |
index e6669d58aef496483e705b8467de777d0a835b0a..9595ad111386828669737338ff109a1227f498f4 100644 |
--- a/src/v8natives.js |
+++ b/src/v8natives.js |
@@ -162,28 +162,23 @@ function GlobalParseFloat(string) { |
function GlobalEval(x) { |
if (!IS_STRING(x)) return x; |
- var receiver = this; |
var global_receiver = %GlobalReceiver(global); |
- |
- if (receiver == null && !IS_UNDETECTABLE(receiver)) { |
- receiver = global_receiver; |
- } |
- |
- var this_is_global_receiver = (receiver === global_receiver); |
var global_is_detached = (global === global_receiver); |
// For consistency with JSC we require the global object passed to |
// eval to be the global object from which 'eval' originated. This |
// is not mandated by the spec. |
- if (!this_is_global_receiver || global_is_detached) { |
- throw new $EvalError('The "this" object passed to eval must ' + |
+ // We only throw if the global has been detached, since we need the |
+ // receiver as this-value for the call. |
+ if (global_is_detached) { |
+ throw new $EvalError('The "this" value passed to eval must ' + |
'be the global object from which eval originated'); |
} |
var f = %CompileString(x); |
if (!IS_FUNCTION(f)) return f; |
- return %_CallFunction(receiver, f); |
+ return %_CallFunction(global_receiver, f); |
} |