Bug 1108930 - Part 7: Warn when Map/Set/WeakMap are called without new. r=evilpie

This commit is contained in:
Tooru Fujisawa
2015-02-05 00:59:16 +09:00
parent 321292f4df
commit 5acf337ec2
5 changed files with 38 additions and 2 deletions

View File

@@ -20,6 +20,7 @@
#include "jsobjinlines.h"
#include "vm/Interpreter-inl.h"
#include "vm/NativeObject-inl.h"
using namespace js;
using namespace js::gc;
@@ -526,7 +527,12 @@ WeakMap_construct(JSContext *cx, unsigned argc, Value *vp)
if (!obj)
return false;
// ES6 23.3.1.1 steps 5-6, 11.
// ES6 draft rev 31 (15 Jan 2015) 23.3.1.1 step 1.
// FIXME: bug 1083752
if (!WarnIfNotConstructing(cx, args, "WeakMap"))
return false;
// Steps 5-6, 11.
if (!args.get(0).isNullOrUndefined()) {
// Steps 7a-b.
RootedValue adderVal(cx);