From ca6cc2f23fffacb667d3257c1ad23ce4a059fc95 Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Wed, 5 Apr 2017 02:10:48 +0300 Subject: [PATCH 1/3] Add test for Symbol Object .valueOf() --- tests/ecmascript/test-bi-symbol-object-valueof.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/ecmascript/test-bi-symbol-object-valueof.js diff --git a/tests/ecmascript/test-bi-symbol-object-valueof.js b/tests/ecmascript/test-bi-symbol-object-valueof.js new file mode 100644 index 00000000..49a1e85e --- /dev/null +++ b/tests/ecmascript/test-bi-symbol-object-valueof.js @@ -0,0 +1,14 @@ +/*=== +symbol +object +symbol +true +===*/ + +var symbol = Symbol('foo'); +print(typeof symbol); +var object = Object(symbol); +print(typeof object); +var value = object.valueOf(); +print(typeof value); +print(symbol === value); From c6f9ee155020162c2e063ca892d633075e7a9022 Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Wed, 5 Apr 2017 02:11:10 +0300 Subject: [PATCH 2/3] Fix Symbol object .valueOf() --- src-input/duk_bi_symbol.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src-input/duk_bi_symbol.c b/src-input/duk_bi_symbol.c index 5ad6dc0e..ad598e5d 100644 --- a/src-input/duk_bi_symbol.c +++ b/src-input/duk_bi_symbol.c @@ -125,6 +125,7 @@ DUK_INTERNAL duk_ret_t duk_bi_symbol_tostring_shared(duk_context *ctx) { duk_push_symbol_descriptive_string(ctx, h_str); } else { /* .valueOf() */ + duk_push_hstring(ctx, h_str); } return 1; } From 0ec8c1699ed17a7f27c4e4ffab5236d990613b00 Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Wed, 5 Apr 2017 02:14:25 +0300 Subject: [PATCH 3/3] Releases: Symbol Object valueOf() --- RELEASES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/RELEASES.rst b/RELEASES.rst index 0a2d04ec..1a856cbf 100644 --- a/RELEASES.rst +++ b/RELEASES.rst @@ -2744,6 +2744,9 @@ Planned * Fix potentially stale duk_tval pointer in duk_inspect_value(), also affects Duktape.info() (GH-1453) +* Fix Symbol Object .valueOf() which returned the Symbol Object rather than + the underlying plain Symbol (GH-1459) + * Avoid log2(), log10(), cbrt(), and trunc() on Android and Atari MiNT (GH-1325, GH-1341, GH-1430, GH-1431)