Bug 697515 - WeakMap.set should return undefined, not itself. r=jorendorff.

--HG--
extra : rebase_source : 0e01d5899710f05bc1d8379eb1b98df5b40bade5
This commit is contained in:
Stephan Herhut 2011-10-26 14:25:20 -05:00
parent 5874569a99
commit a3f15c8871
3 changed files with 8 additions and 1 deletions

View File

@ -223,9 +223,9 @@ WeakMap_set(JSContext *cx, uintN argc, Value *vp)
obj->setPrivate(map);
}
args.thisv() = UndefinedValue();
if (!map->put(key, value))
goto out_of_memory;
args.rval().setUndefined();
return true;
out_of_memory:

View File

@ -59,3 +59,4 @@ require-or(debugMode,skip) script regress-672804-3.js
skip-if(!xulRuntime.shell) script regress-677589.js
script regress-677924.js
script regress-691746.js
script regress-697515.js

View File

@ -0,0 +1,6 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/
assertEq(new WeakMap().set({}, 0), undefined);
reportCompare(0, 0, 'ok');