Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: src/v8natives.js

Issue 1103473003: Revert of [es6] don't throw if argument is non-object (O.freeze, O.seal, O.preventExtensions) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/messages.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 9eaf5d4ba057a84a09ef9bb8cd8de858c88eeb4d..8ff6f40461f4d4cc6c67079325247c794f3b1a35 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -1255,7 +1255,9 @@
// ES5 section 15.2.3.8.
function ObjectSealJS(obj) {
- if (!IS_SPEC_OBJECT(obj)) return obj;
+ if (!IS_SPEC_OBJECT(obj)) {
+ throw MakeTypeError(kCalledOnNonObject, "Object.seal");
+ }
var isProxy = %_IsJSProxy(obj);
if (isProxy || %HasSloppyArgumentsElements(obj) || %IsObserved(obj)) {
if (isProxy) {
@@ -1282,7 +1284,9 @@
// ES5 section 15.2.3.9.
function ObjectFreezeJS(obj) {
- if (!IS_SPEC_OBJECT(obj)) return obj;
+ if (!IS_SPEC_OBJECT(obj)) {
+ throw MakeTypeError(kCalledOnNonObject, "Object.freeze");
+ }
var isProxy = %_IsJSProxy(obj);
if (isProxy || %HasSloppyArgumentsElements(obj) || %IsObserved(obj)) {
if (isProxy) {
@@ -1310,7 +1314,9 @@
// ES5 section 15.2.3.10
function ObjectPreventExtension(obj) {
- if (!IS_SPEC_OBJECT(obj)) return obj;
+ if (!IS_SPEC_OBJECT(obj)) {
+ throw MakeTypeError(kCalledOnNonObject, "Object.preventExtension");
+ }
if (%_IsJSProxy(obj)) {
ProxyFix(obj);
}
@@ -1321,7 +1327,9 @@
// ES5 section 15.2.3.11
function ObjectIsSealed(obj) {
- if (!IS_SPEC_OBJECT(obj)) return true;
+ if (!IS_SPEC_OBJECT(obj)) {
+ throw MakeTypeError(kCalledOnNonObject, "Object.isSealed");
+ }
if (%_IsJSProxy(obj)) {
return false;
}
@@ -1342,7 +1350,9 @@
// ES5 section 15.2.3.12
function ObjectIsFrozen(obj) {
- if (!IS_SPEC_OBJECT(obj)) return true;
+ if (!IS_SPEC_OBJECT(obj)) {
+ throw MakeTypeError(kCalledOnNonObject, "Object.isFrozen");
+ }
if (%_IsJSProxy(obj)) {
return false;
}
@@ -1362,7 +1372,9 @@
// ES5 section 15.2.3.13
function ObjectIsExtensible(obj) {
- if (!IS_SPEC_OBJECT(obj)) return false;
+ if (!IS_SPEC_OBJECT(obj)) {
+ throw MakeTypeError(kCalledOnNonObject, "Object.isExtensible");
+ }
if (%_IsJSProxy(obj)) {
return true;
}
« no previous file with comments | « no previous file | test/mjsunit/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698