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

Unified Diff: test/mjsunit/function-call.js

Issue 433413002: `1..isPrototypeOf.call(null)` should return false, not throw TypeError. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Patch Set 5 Created 6 years, 4 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 | « src/v8natives.js ('k') | test/mjsunit/regress/regress-3483.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/function-call.js
diff --git a/test/mjsunit/function-call.js b/test/mjsunit/function-call.js
index 88df353a60c2ae9f96447c0a765af7e40c482229..fb91dcd879640e61cd0034874da9cfe229c1a60b 100644
--- a/test/mjsunit/function-call.js
+++ b/test/mjsunit/function-call.js
@@ -162,13 +162,10 @@ for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) {
var exception = false;
try {
- // We call all functions with no parameters, which means that essential
- // parameters will have the undefined value.
- // The test for whether the "this" value is null or undefined is always
- // performed before access to the other parameters, so even if the
- // undefined value is an invalid argument value, it mustn't change
- // the result of the test.
- should_throw_on_null_and_undefined[i].call(null);
+ // We need to pass a dummy object argument ({}) to these functions because
+ // of Object.prototype.isPrototypeOf's special behavior, see issue 3483
+ // for more details.
+ should_throw_on_null_and_undefined[i].call(null, {});
} catch (e) {
exception = true;
checkExpectedMessage(e);
@@ -177,7 +174,7 @@ for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) {
exception = false;
try {
- should_throw_on_null_and_undefined[i].call(undefined);
+ should_throw_on_null_and_undefined[i].call(undefined, {});
} catch (e) {
exception = true;
checkExpectedMessage(e);
@@ -186,7 +183,7 @@ for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) {
exception = false;
try {
- should_throw_on_null_and_undefined[i].apply(null);
+ should_throw_on_null_and_undefined[i].apply(null, [{}]);
} catch (e) {
exception = true;
checkExpectedMessage(e);
@@ -195,7 +192,7 @@ for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) {
exception = false;
try {
- should_throw_on_null_and_undefined[i].apply(undefined);
+ should_throw_on_null_and_undefined[i].apply(undefined, [{}]);
} catch (e) {
exception = true;
checkExpectedMessage(e);
@@ -248,7 +245,9 @@ for (var i = 0; i < non_generic.length; i++) {
// Test that we still throw when calling with thisArg null or undefined
// through an array mapping function.
-var array = [1,2,3,4,5];
+// We need to make sure that the elements of `array` are all object values,
+// see issue 3483 for more details.
+var array = [{}, [], new Number, new Map, new WeakSet];
for (var j = 0; j < mapping_functions.length; j++) {
for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) {
exception = false;
« no previous file with comments | « src/v8natives.js ('k') | test/mjsunit/regress/regress-3483.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698