Bug 1341061 - Test. (r=arai)
☠☠ backed out by 39be2cc943a7 ☠ ☠
authorShu-yu Guo <shu@rfrn.org>
Fri, 24 Feb 2017 12:52:13 -0800
changeset 373916 456c1dcfe087675f3ee80ce68ccb88ce56021cbc
parent 373915 559f43c4336928f676bc2a35b196932984d2b498
child 373917 cc682c2db247433a4aad347f0d20ddbc968eb26b
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai
bugs1341061
milestone54.0a1
Bug 1341061 - Test. (r=arai) Will remove once https://github.com/tc39/test262/pull/869 merges and we sync.
js/src/tests/test262/local/browser.js
js/src/tests/test262/local/shell.js
js/src/tests/test262/local/unscopables-inc-dec.js
new file mode 100644
new file mode 100644
new file mode 100644
--- /dev/null
+++ b/js/src/tests/test262/local/unscopables-inc-dec.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description:
+  @@unscopables should be looked up exactly once for inc/dec.
+info: |
+  UpdateExpression : LeftHandSideExpression ++
+  1. Let lhs be the result of evaluating LeftHandSideExpression.
+
+  GetIdentifierReference ( lex, name, strict )
+  [...]
+  3. Let exists be ? envRec.HasBinding(name).
+
+  HasBinding ( N )
+  [...]
+  6. Let unscopables be ? Get(bindings, @@unscopables).
+flags: [noStrict]
+features: [Symbol.unscopables]
+---*/
+
+var unscopablesGetterCalled = 0;
+var a, b, flag = true;
+with (a = { x: 7 }) {
+  with (b = { x: 4, get [Symbol.unscopables]() {
+                      unscopablesGetterCalled++;
+                      return { x: flag=!flag };
+                    } }) {
+    x++;
+  }
+}
+
+assert.sameValue(unscopablesGetterCalled, 1);
+assert.sameValue(a.x, 7);
+assert.sameValue(b.x, 5);
+
+flag = true;
+with (a = { x: 7 }) {
+  with (b = { x: 4, get [Symbol.unscopables]() {
+                      unscopablesGetterCalled++;
+                      return { x: flag=!flag };
+                    } }) {
+    x--;
+  }
+}
+
+assert.sameValue(unscopablesGetterCalled, 2);
+assert.sameValue(a.x, 7);
+assert.sameValue(b.x, 3);
+
+reportCompare(0,0);