2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/licenses/publicdomain/
6 /* A stock watcher function. */
8 function watcher(id, old, newval) {
13 /* Create an object with a value property. */
17 * Place a watchpoint on the value property. The watchpoint structure holds
18 * the original JavaScript setter, and a pointer to the shape.
20 o.watch('x', watcher);
23 * Put the object in dictionary mode, so that JSObject::putProperty will
24 * mutate its shapes instead of creating new ones.
29 * Replace the value property with a setter.
32 o.__defineSetter__('x', function() { setterCount++; });
35 * Trigger the watchpoint. The watchpoint handler should run, and then the
38 watcherCount = setterCount = 0;
40 assertEq(watcherCount, 1);
41 assertEq(setterCount, 1);
43 reportCompare(true, true);