test262/test/built-ins/JSON/stringify/value-array-proxy-revoked.js

38 lines
955 B
JavaScript
Raw Normal View History

2016-06-10 21:07:40 +02:00
// 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-json.stringify
Improve JSON.stringify coverage (#2168) * Rename & improve "length" test * Use verifyProperty in "name" test * Rename & improve property descriptor test * Remove duplicated test https://github.com/tc39/test262/blob/master/test/built-ins/Object/prototype/toString/proxy-array.js * Rename proxy value test * Rename & improve String object unwrapping test * Rename & improve Number object unwrapping test * Rename & improve Boolean object unwrapping test * Rename & merge replacer returns undefined tests * Rename & merge replacer function tests * Rename replacer array revoked proxy test * Add cross-realm replacer array revoked proxy test * Add array proxy replacer test * Add replacer array keys order test * Add empty replacer array test * Add non-finite numbers serialization test * Add replacer array abrupt completion test * Add replacer array with duplicates test * Add replacer array ignores undefined test * Add replacer array unwraps strings test * Add replacer array unwraps numbers test * Rename & merge circular object tests * Add circular array test * Rename & merge top-level primitives tests * Rename string escape tests * Rename BigInt tests * Rename & improve function value test * Add replacer function abrupt test * Rename & merge wrong space type tests * Rename float number space test * Rename & improve Number object space test * Rename & improve String object space test * Rename basic numeric space test * Rename string space slice test * Add replacer array numbers test * Add toJSON abrupt completions test * Add not callable toJSON test * Add toJSON call arguments test * Add replacer array wrong types test * Rename & improve string space test * Rename & improve replacer wrong type test * Add built-in object requirements test * Add basic toJSON result test * Add abrupt array value test * Add abrupt object value test * Rename & merge space number clamp tests * Add replacer function wrapper test * Add symbol value test * Add negative zero value test * Add replacer function & toJSON test * Add circular object from toJSON test * Add circular array from toJSON test * Add circular object from replacer test * Add circular array from replacer test * Add replacer function arguments test * Split & improve proxy value test * Split & improve revoked proxy value test
2019-08-28 22:34:59 +02:00
description: >
Revoked array proxy value produces a TypeError.
2016-06-10 21:07:40 +02:00
info: |
Improve JSON.stringify coverage (#2168) * Rename & improve "length" test * Use verifyProperty in "name" test * Rename & improve property descriptor test * Remove duplicated test https://github.com/tc39/test262/blob/master/test/built-ins/Object/prototype/toString/proxy-array.js * Rename proxy value test * Rename & improve String object unwrapping test * Rename & improve Number object unwrapping test * Rename & improve Boolean object unwrapping test * Rename & merge replacer returns undefined tests * Rename & merge replacer function tests * Rename replacer array revoked proxy test * Add cross-realm replacer array revoked proxy test * Add array proxy replacer test * Add replacer array keys order test * Add empty replacer array test * Add non-finite numbers serialization test * Add replacer array abrupt completion test * Add replacer array with duplicates test * Add replacer array ignores undefined test * Add replacer array unwraps strings test * Add replacer array unwraps numbers test * Rename & merge circular object tests * Add circular array test * Rename & merge top-level primitives tests * Rename string escape tests * Rename BigInt tests * Rename & improve function value test * Add replacer function abrupt test * Rename & merge wrong space type tests * Rename float number space test * Rename & improve Number object space test * Rename & improve String object space test * Rename basic numeric space test * Rename string space slice test * Add replacer array numbers test * Add toJSON abrupt completions test * Add not callable toJSON test * Add toJSON call arguments test * Add replacer array wrong types test * Rename & improve string space test * Rename & improve replacer wrong type test * Add built-in object requirements test * Add basic toJSON result test * Add abrupt array value test * Add abrupt object value test * Rename & merge space number clamp tests * Add replacer function wrapper test * Add symbol value test * Add negative zero value test * Add replacer function & toJSON test * Add circular object from toJSON test * Add circular array from toJSON test * Add circular object from replacer test * Add circular array from replacer test * Add replacer function arguments test * Split & improve proxy value test * Split & improve revoked proxy value test
2019-08-28 22:34:59 +02:00
JSON.stringify ( value [ , replacer [ , space ] ] )
2016-06-10 21:07:40 +02:00
[...]
12. Return ? SerializeJSONProperty(the empty String, wrapper).
Improve JSON.stringify coverage (#2168) * Rename & improve "length" test * Use verifyProperty in "name" test * Rename & improve property descriptor test * Remove duplicated test https://github.com/tc39/test262/blob/master/test/built-ins/Object/prototype/toString/proxy-array.js * Rename proxy value test * Rename & improve String object unwrapping test * Rename & improve Number object unwrapping test * Rename & improve Boolean object unwrapping test * Rename & merge replacer returns undefined tests * Rename & merge replacer function tests * Rename replacer array revoked proxy test * Add cross-realm replacer array revoked proxy test * Add array proxy replacer test * Add replacer array keys order test * Add empty replacer array test * Add non-finite numbers serialization test * Add replacer array abrupt completion test * Add replacer array with duplicates test * Add replacer array ignores undefined test * Add replacer array unwraps strings test * Add replacer array unwraps numbers test * Rename & merge circular object tests * Add circular array test * Rename & merge top-level primitives tests * Rename string escape tests * Rename BigInt tests * Rename & improve function value test * Add replacer function abrupt test * Rename & merge wrong space type tests * Rename float number space test * Rename & improve Number object space test * Rename & improve String object space test * Rename basic numeric space test * Rename string space slice test * Add replacer array numbers test * Add toJSON abrupt completions test * Add not callable toJSON test * Add toJSON call arguments test * Add replacer array wrong types test * Rename & improve string space test * Rename & improve replacer wrong type test * Add built-in object requirements test * Add basic toJSON result test * Add abrupt array value test * Add abrupt object value test * Rename & merge space number clamp tests * Add replacer function wrapper test * Add symbol value test * Add negative zero value test * Add replacer function & toJSON test * Add circular object from toJSON test * Add circular array from toJSON test * Add circular object from replacer test * Add circular array from replacer test * Add replacer function arguments test * Split & improve proxy value test * Split & improve revoked proxy value test
2019-08-28 22:34:59 +02:00
SerializeJSONProperty ( key, holder )
2016-06-10 21:07:40 +02:00
[...]
10. If Type(value) is Object and IsCallable(value) is false, then
Improve JSON.stringify coverage (#2168) * Rename & improve "length" test * Use verifyProperty in "name" test * Rename & improve property descriptor test * Remove duplicated test https://github.com/tc39/test262/blob/master/test/built-ins/Object/prototype/toString/proxy-array.js * Rename proxy value test * Rename & improve String object unwrapping test * Rename & improve Number object unwrapping test * Rename & improve Boolean object unwrapping test * Rename & merge replacer returns undefined tests * Rename & merge replacer function tests * Rename replacer array revoked proxy test * Add cross-realm replacer array revoked proxy test * Add array proxy replacer test * Add replacer array keys order test * Add empty replacer array test * Add non-finite numbers serialization test * Add replacer array abrupt completion test * Add replacer array with duplicates test * Add replacer array ignores undefined test * Add replacer array unwraps strings test * Add replacer array unwraps numbers test * Rename & merge circular object tests * Add circular array test * Rename & merge top-level primitives tests * Rename string escape tests * Rename BigInt tests * Rename & improve function value test * Add replacer function abrupt test * Rename & merge wrong space type tests * Rename float number space test * Rename & improve Number object space test * Rename & improve String object space test * Rename basic numeric space test * Rename string space slice test * Add replacer array numbers test * Add toJSON abrupt completions test * Add not callable toJSON test * Add toJSON call arguments test * Add replacer array wrong types test * Rename & improve string space test * Rename & improve replacer wrong type test * Add built-in object requirements test * Add basic toJSON result test * Add abrupt array value test * Add abrupt object value test * Rename & merge space number clamp tests * Add replacer function wrapper test * Add symbol value test * Add negative zero value test * Add replacer function & toJSON test * Add circular object from toJSON test * Add circular array from toJSON test * Add circular object from replacer test * Add circular array from replacer test * Add replacer function arguments test * Split & improve proxy value test * Split & improve revoked proxy value test
2019-08-28 22:34:59 +02:00
a. Let isArray be ? IsArray(value).
2016-06-10 21:07:40 +02:00
Improve JSON.stringify coverage (#2168) * Rename & improve "length" test * Use verifyProperty in "name" test * Rename & improve property descriptor test * Remove duplicated test https://github.com/tc39/test262/blob/master/test/built-ins/Object/prototype/toString/proxy-array.js * Rename proxy value test * Rename & improve String object unwrapping test * Rename & improve Number object unwrapping test * Rename & improve Boolean object unwrapping test * Rename & merge replacer returns undefined tests * Rename & merge replacer function tests * Rename replacer array revoked proxy test * Add cross-realm replacer array revoked proxy test * Add array proxy replacer test * Add replacer array keys order test * Add empty replacer array test * Add non-finite numbers serialization test * Add replacer array abrupt completion test * Add replacer array with duplicates test * Add replacer array ignores undefined test * Add replacer array unwraps strings test * Add replacer array unwraps numbers test * Rename & merge circular object tests * Add circular array test * Rename & merge top-level primitives tests * Rename string escape tests * Rename BigInt tests * Rename & improve function value test * Add replacer function abrupt test * Rename & merge wrong space type tests * Rename float number space test * Rename & improve Number object space test * Rename & improve String object space test * Rename basic numeric space test * Rename string space slice test * Add replacer array numbers test * Add toJSON abrupt completions test * Add not callable toJSON test * Add toJSON call arguments test * Add replacer array wrong types test * Rename & improve string space test * Rename & improve replacer wrong type test * Add built-in object requirements test * Add basic toJSON result test * Add abrupt array value test * Add abrupt object value test * Rename & merge space number clamp tests * Add replacer function wrapper test * Add symbol value test * Add negative zero value test * Add replacer function & toJSON test * Add circular object from toJSON test * Add circular array from toJSON test * Add circular object from replacer test * Add circular array from replacer test * Add replacer function arguments test * Split & improve proxy value test * Split & improve revoked proxy value test
2019-08-28 22:34:59 +02:00
IsArray ( argument )
2016-06-10 21:07:40 +02:00
[...]
3. If argument is a Proxy exotic object, then
Improve JSON.stringify coverage (#2168) * Rename & improve "length" test * Use verifyProperty in "name" test * Rename & improve property descriptor test * Remove duplicated test https://github.com/tc39/test262/blob/master/test/built-ins/Object/prototype/toString/proxy-array.js * Rename proxy value test * Rename & improve String object unwrapping test * Rename & improve Number object unwrapping test * Rename & improve Boolean object unwrapping test * Rename & merge replacer returns undefined tests * Rename & merge replacer function tests * Rename replacer array revoked proxy test * Add cross-realm replacer array revoked proxy test * Add array proxy replacer test * Add replacer array keys order test * Add empty replacer array test * Add non-finite numbers serialization test * Add replacer array abrupt completion test * Add replacer array with duplicates test * Add replacer array ignores undefined test * Add replacer array unwraps strings test * Add replacer array unwraps numbers test * Rename & merge circular object tests * Add circular array test * Rename & merge top-level primitives tests * Rename string escape tests * Rename BigInt tests * Rename & improve function value test * Add replacer function abrupt test * Rename & merge wrong space type tests * Rename float number space test * Rename & improve Number object space test * Rename & improve String object space test * Rename basic numeric space test * Rename string space slice test * Add replacer array numbers test * Add toJSON abrupt completions test * Add not callable toJSON test * Add toJSON call arguments test * Add replacer array wrong types test * Rename & improve string space test * Rename & improve replacer wrong type test * Add built-in object requirements test * Add basic toJSON result test * Add abrupt array value test * Add abrupt object value test * Rename & merge space number clamp tests * Add replacer function wrapper test * Add symbol value test * Add negative zero value test * Add replacer function & toJSON test * Add circular object from toJSON test * Add circular array from toJSON test * Add circular object from replacer test * Add circular array from replacer test * Add replacer function arguments test * Split & improve proxy value test * Split & improve revoked proxy value test
2019-08-28 22:34:59 +02:00
a. If argument.[[ProxyHandler]] is null, throw a TypeError exception.
2016-06-10 21:07:40 +02:00
features: [Proxy]
---*/
var handle = Proxy.revocable([], {});
handle.revoke();
assert.throws(TypeError, function() {
JSON.stringify(handle.proxy);
}, 'top-level value');
assert.throws(TypeError, function() {
JSON.stringify([[[handle.proxy]]]);
2016-06-10 21:07:40 +02:00
}, 'nested value');