michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/licenses/publicdomain/ michael@0: * Contributor: Bob Clary michael@0: */ michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: // originally reported by Jens Thiele in michael@0: var BUGNUMBER = 240577; michael@0: var summary = 'object.watch execution context'; michael@0: var actual = ''; michael@0: var expect = ''; michael@0: michael@0: printBugNumber(BUGNUMBER); michael@0: printStatus (summary); michael@0: michael@0: var createWatcher = function ( watchlabel ) michael@0: { michael@0: var watcher = function (property, oldvalue, newvalue) michael@0: { michael@0: actual += watchlabel; return newvalue; michael@0: }; michael@0: return watcher; michael@0: }; michael@0: michael@0: var watcher1 = createWatcher('watcher1'); michael@0: michael@0: var object = {property: 'value'}; michael@0: michael@0: object.watch('property', watcher1); michael@0: michael@0: object.property = 'newvalue'; michael@0: michael@0: expect = 'watcher1'; michael@0: michael@0: reportCompare(expect, actual, summary);