diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/tests/ecma_5/extensions/watchpoint-deletes-JSPropertyOp-setter.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/ecma_5/extensions/watchpoint-deletes-JSPropertyOp-setter.js')
-rw-r--r-- | js/src/tests/ecma_5/extensions/watchpoint-deletes-JSPropertyOp-setter.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/js/src/tests/ecma_5/extensions/watchpoint-deletes-JSPropertyOp-setter.js b/js/src/tests/ecma_5/extensions/watchpoint-deletes-JSPropertyOp-setter.js new file mode 100644 index 000000000..85410bbd4 --- /dev/null +++ b/js/src/tests/ecma_5/extensions/watchpoint-deletes-JSPropertyOp-setter.js @@ -0,0 +1,56 @@ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + */ + +function make_watcher(name) { + return function (id, oldv, newv) { + print("watched " + name + "[0]"); + }; +} + +var o, p; +function f(flag) { + if (flag) { + o = arguments; + } else { + p = arguments; + o.watch(0, make_watcher('o')); + p.watch(0, make_watcher('p')); + + /* + * Previously, the watchpoint implementation actually substituted its magic setter + * functions for the setters of shared shapes, and then 1) carefully ignored calls + * to its magic setter from unrelated objects, and 2) avoided restoring the + * original setter until all watchpoints on that shape had been removed. + * + * However, when the watchpoint code began using JSObject::changeProperty and + * js_ChangeNativePropertyAttrs to change shapes' setters, the shape tree code + * became conscious of the presence of watchpoints, and shared shapes between + * objects only when their watchpoint nature coincided. Clearing the magic setter + * from one object's shape would not affect other objects, because the + * watchpointed and non-watchpointed shapes were distinct if they were shared. + * + * Thus, the first unwatch call must go ahead and fix p's shape, even though a + * watchpoint exists on the same shape in o. o's watchpoint's presence shouldn't + * cause 'unwatch' to leave p's magic setter in place. + */ + + /* DropWatchPointAndUnlock would see o's watchpoint, and not change p's property. */ + p.unwatch(0); + + /* DropWatchPointAndUnlock would fix o's property, but not p's; p's setter would be gone. */ + o.unwatch(0); + + /* This would fail to invoke the arguments object's setter. */ + p[0] = 4; + + /* And the formal parameter would not get updated. */ + assertEq(flag, 4); + } +} + +f(true); +f(false); + +reportCompare(true, true); |