summaryrefslogtreecommitdiffstats
path: root/js/src/tests/js1_8_1/extensions/regress-520572.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/js1_8_1/extensions/regress-520572.js')
-rw-r--r--js/src/tests/js1_8_1/extensions/regress-520572.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/js/src/tests/js1_8_1/extensions/regress-520572.js b/js/src/tests/js1_8_1/extensions/regress-520572.js
new file mode 100644
index 000000000..97f00029a
--- /dev/null
+++ b/js/src/tests/js1_8_1/extensions/regress-520572.js
@@ -0,0 +1,41 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor: Blake Kaplan
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 520572;
+var summary = 'watch should innerize the object being watched';
+var actual = 0;
+var expect = 2;
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ if ("evalcx" in this) {
+ // shell
+ let s = evalcx("lazy");
+ s.n = 0;
+ evalcx('this.watch("x", function(){ n++; }); this.x = 4; x = 6', s);
+ actual = s.n;
+ reportCompare(expect, actual, summary);
+ } else {
+ // browser
+ this.watch('x', function(){ actual++; });
+ this.x = 4;
+ x = 6;
+ reportCompare(expect, actual, summary);
+ }
+
+ exitFunc ('test');
+}