From 2fde11dde59bd39ac97d03a57f76c10e0fc399d0 Mon Sep 17 00:00:00 2001 From: Jason Orendorff Date: Fri, 29 Aug 2014 10:59:19 -0500 Subject: [PATCH] Follow-up to bug 1041631 - Make a new test work whether Symbol is defined or not. no_r=me, a=RyanVM on a CLOSED TREE. --- js/src/tests/ecma_6/Class/compPropNames.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/js/src/tests/ecma_6/Class/compPropNames.js b/js/src/tests/ecma_6/Class/compPropNames.js index 32220c88ba7..803b02b9437 100644 --- a/js/src/tests/ecma_6/Class/compPropNames.js +++ b/js/src/tests/ecma_6/Class/compPropNames.js @@ -215,11 +215,13 @@ assertEq(a.hey, 3); assertThrowsValue(() => { a.hey = 5; }, 2); // Symbols with duplicate get and set. -expr = Symbol("hey"); -a = {get [expr]() { return 3; }, set[expr](v) { throw 2; }, - set [expr] (w) { throw 4; }, get[expr](){return 5; }}; -assertEq(a[expr], 5); -assertThrowsValue(() => { a[expr] = 7; }, 4); +if (typeof Symbol === "function") { + expr = Symbol("hey"); + a = {get [expr]() { return 3; }, set[expr](v) { throw 2; }, + set [expr] (w) { throw 4; }, get[expr](){return 5; }}; + assertEq(a[expr], 5); + assertThrowsValue(() => { a[expr] = 7; }, 4); +} // expressions with side effects are called in the right order log = "";