Index: src/v8natives.js |
diff --git a/src/v8natives.js b/src/v8natives.js |
index 469059ba21a3981a8e1c6b9d5e9db057f74f098d..d22e94d85ee5416bfdab7d48ae5e23b469084858 100644 |
--- a/src/v8natives.js |
+++ b/src/v8natives.js |
@@ -56,7 +56,7 @@ function InstallFunctions(object, attributes, functions) { |
%FunctionSetName(f, key); |
%FunctionRemovePrototype(f); |
%SetProperty(object, key, f, attributes); |
- %SetNativeFlag(f); |
+ %SetES5Flag(f); |
} |
%ToFastProperties(object); |
} |
@@ -132,19 +132,10 @@ 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 this_is_global_receiver = (this === 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 ' + |
'be the global object from which eval originated'); |
@@ -153,7 +144,7 @@ function GlobalEval(x) { |
var f = %CompileString(x); |
if (!IS_FUNCTION(f)) return f; |
- return %_CallFunction(receiver, f); |
+ return %_CallFunction(this, f); |
} |
@@ -255,9 +246,8 @@ function ObjectPropertyIsEnumerable(V) { |
// Extensions for providing property getters and setters. |
function ObjectDefineGetter(name, fun) { |
- var receiver = this; |
- if (receiver == null && !IS_UNDETECTABLE(receiver)) { |
- receiver = %GlobalReceiver(global); |
+ if (this == null && !IS_UNDETECTABLE(this)) { |
+ throw new $TypeError('Object.prototype.__defineGetter__: this is Null'); |
} |
if (!IS_FUNCTION(fun)) { |
throw new $TypeError('Object.prototype.__defineGetter__: Expecting function'); |
@@ -266,23 +256,21 @@ function ObjectDefineGetter(name, fun) { |
desc.setGet(fun); |
desc.setEnumerable(true); |
desc.setConfigurable(true); |
- DefineOwnProperty(ToObject(receiver), ToString(name), desc, false); |
+ DefineOwnProperty(ToObject(this), ToString(name), desc, false); |
} |
function ObjectLookupGetter(name) { |
- var receiver = this; |
- if (receiver == null && !IS_UNDETECTABLE(receiver)) { |
- receiver = %GlobalReceiver(global); |
+ if (this == null && !IS_UNDETECTABLE(this)) { |
+ throw new $TypeError('Object.prototype.__lookupGetter__: this is Null'); |
} |
- return %LookupAccessor(ToObject(receiver), ToString(name), GETTER); |
+ return %LookupAccessor(ToObject(this), ToString(name), GETTER); |
} |
function ObjectDefineSetter(name, fun) { |
- var receiver = this; |
- if (receiver == null && !IS_UNDETECTABLE(receiver)) { |
- receiver = %GlobalReceiver(global); |
+ if (this == null && !IS_UNDETECTABLE(this)) { |
+ throw new $TypeError('Object.prototype.__defineSetter__: this is Null'); |
} |
if (!IS_FUNCTION(fun)) { |
throw new $TypeError( |
@@ -292,16 +280,15 @@ function ObjectDefineSetter(name, fun) { |
desc.setSet(fun); |
desc.setEnumerable(true); |
desc.setConfigurable(true); |
- DefineOwnProperty(ToObject(receiver), ToString(name), desc, false); |
+ DefineOwnProperty(ToObject(this), ToString(name), desc, false); |
} |
function ObjectLookupSetter(name) { |
- var receiver = this; |
- if (receiver == null && !IS_UNDETECTABLE(receiver)) { |
- receiver = %GlobalReceiver(global); |
+ if (this == null && !IS_UNDETECTABLE(this)) { |
+ throw new $TypeError('Object.prototype.__lookupSetter__: this is Null'); |
} |
- return %LookupAccessor(ToObject(receiver), ToString(name), SETTER); |
+ return %LookupAccessor(ToObject(this), ToString(name), SETTER); |
} |