mirror of
https://github.com/tc39/test262.git
synced 2025-07-28 16:34:27 +02:00
Add cross-realm "argArray not object" test
This commit is contained in:
parent
171b3ef083
commit
6943b289fc
38
test/built-ins/Function/prototype/apply/argarray-not-object-realm.js
vendored
Normal file
38
test/built-ins/Function/prototype/apply/argarray-not-object-realm.js
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// Copyright 2019 Aleksey Shvayka. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-function.prototype.apply
|
||||||
|
description: >
|
||||||
|
Throws a TypeError exception if argArray is not an object
|
||||||
|
(honoring the Realm of the current execution context)
|
||||||
|
info: |
|
||||||
|
Function.prototype.apply ( thisArg, argArray )
|
||||||
|
|
||||||
|
[...]
|
||||||
|
4. Let argList be ? CreateListFromArrayLike(argArray).
|
||||||
|
|
||||||
|
CreateListFromArrayLike ( obj [ , elementTypes ] )
|
||||||
|
|
||||||
|
[...]
|
||||||
|
2. If Type(obj) is not Object, throw a TypeError exception.
|
||||||
|
features: [cross-realm]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var OFunction = $262.createRealm().global.Function;
|
||||||
|
var fn = new OFunction();
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
fn.apply(null, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
fn.apply(null, 1234.5678);
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
fn.apply(null, '');
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
fn.apply(null, Symbol('desc'));
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user