mirror of
https://github.com/tc39/test262.git
synced 2025-05-11 10:20:35 +02:00
* Add tests for prototype realm inference * Add tests for miscellaneous realm concerns * Add tests for realm of spec-created Errors In some cases, Error objects produced by the specification are observable from ECMAScript code. Among these cases, some are further differentiated in that they occur outside of any built-in function and may be triggered through syntactic production directly. The current realm record is commonly interpreted incorrectly under these circumstances. Add tests asserting that the expected realm record is used when constructing such Error objects. * Add tests for realm use in ArraySpeciesCreate * Add tests for function realm retrieval * Add tests for cross-realm behaviors of Symbols * Add tests for GetValue and PutValue * Add tests for realm of spec-created Arrays In some cases, Arrays produced by CreateArrayFromList are observable from ECMAScript code. Among these cases, two occur outside of any built-in function and may be triggered through syntactic production directly. The current realm record is commonly interpreted incorrectly under these circumstances. Add tests asserting that the expected realm record is used when constructing arrays. * Add test for spec-created object * fixup! Add tests for realm of spec-created Errors * fixup! Add tests for realm of spec-created Errors * fixup! Add tests for prototype realm inference * fixup! Add tests for miscellaneous realm concerns
44 lines
1.5 KiB
JavaScript
44 lines
1.5 KiB
JavaScript
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
/*---
|
|
esid: sec-ecmascript-function-objects-call-thisargument-argumentslist
|
|
es6id: 9.2.1
|
|
description: The "this" value is wrapped in an object using the callee realm
|
|
info: >
|
|
[...]
|
|
6. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument).
|
|
[...]
|
|
|
|
9.2.1.2OrdinaryCallBindThis ( F, calleeContext, thisArgument )#
|
|
|
|
[...]
|
|
5. If thisMode is strict, let thisValue be thisArgument.
|
|
6. Else,
|
|
a. If thisArgument is null or undefined, then
|
|
[...]
|
|
b. Else,
|
|
i. Let thisValue be ! ToObject(thisArgument).
|
|
ii. NOTE ToObject produces wrapper objects using calleeRealm.
|
|
[...]
|
|
---*/
|
|
|
|
var other = $.createRealm().global;
|
|
var func = new other.Function('return this;');
|
|
var subject;
|
|
|
|
subject = func.call(true);
|
|
assert.sameValue(subject.constructor, other.Boolean, 'boolean constructor');
|
|
assert(subject instanceof other.Boolean, 'boolean instanceof');
|
|
|
|
subject = func.call(1);
|
|
assert.sameValue(subject.constructor, other.Number, 'number constructor');
|
|
assert(subject instanceof other.Number, 'number instanceof');
|
|
|
|
subject = func.call('');
|
|
assert.sameValue(subject.constructor, other.String, 'string constructor');
|
|
assert(subject instanceof other.String, 'string instanceof');
|
|
|
|
subject = func.call({});
|
|
assert.sameValue(subject.constructor, Object, 'object constructor');
|
|
assert(subject instanceof Object, 'object instanceof');
|