mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1007285 - Length property of the (Weak){Map,Set} constructors should be 1; r=jorendorff
--HG-- extra : rebase_source : 9616ff1999c37c4ec69026b709726a09d88b03f2
This commit is contained in:
parent
821f406512
commit
7a75f61b66
@ -1048,7 +1048,7 @@ InitClass(JSContext *cx, Handle<GlobalObject*> global, const Class *clasp, JSPro
|
||||
return nullptr;
|
||||
proto->setPrivate(nullptr);
|
||||
|
||||
Rooted<JSFunction*> ctor(cx, global->createConstructor(cx, construct, ClassName(key, cx), 0));
|
||||
Rooted<JSFunction*> ctor(cx, global->createConstructor(cx, construct, ClassName(key, cx), 1));
|
||||
if (!ctor ||
|
||||
!LinkConstructorAndPrototype(cx, ctor, proto) ||
|
||||
!DefinePropertiesAndBrand(cx, proto, properties, methods) ||
|
||||
|
@ -9,7 +9,7 @@ assertEq(desc.writable, true);
|
||||
|
||||
assertEq(typeof Map, 'function');
|
||||
assertEq(Object.keys(Map).length, 0);
|
||||
assertEq(Map.length, 0);
|
||||
assertEq(Map.length, 1);
|
||||
assertEq(Map.name, "Map");
|
||||
|
||||
assertEq(Object.getPrototypeOf(Map.prototype), Object.prototype);
|
||||
|
@ -9,7 +9,7 @@ assertEq(desc.writable, true);
|
||||
|
||||
assertEq(typeof Set, 'function');
|
||||
assertEq(Object.keys(Set).length, 0);
|
||||
assertEq(Set.length, 0);
|
||||
assertEq(Set.length, 1);
|
||||
assertEq(Set.name, "Set");
|
||||
|
||||
assertEq(Object.getPrototypeOf(Set.prototype), Object.prototype);
|
||||
|
35
js/src/jit-test/tests/collections/WeakMap-surfaces.js
Normal file
35
js/src/jit-test/tests/collections/WeakMap-surfaces.js
Normal file
@ -0,0 +1,35 @@
|
||||
// WeakMap surfaces
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(this, "WeakMap");
|
||||
assertEq(desc.enumerable, false);
|
||||
assertEq(desc.configurable, true);
|
||||
assertEq(desc.writable, true);
|
||||
|
||||
assertEq(typeof WeakMap, 'function');
|
||||
assertEq(Object.keys(WeakMap).length, 0);
|
||||
assertEq(WeakMap.length, 1);
|
||||
assertEq(WeakMap.name, "WeakMap");
|
||||
|
||||
assertEq(Object.getPrototypeOf(WeakMap.prototype), Object.prototype);
|
||||
assertEq(Object.prototype.toString.call(WeakMap.prototype), "[object WeakMap]");
|
||||
assertEq(Object.prototype.toString.call(new WeakMap), "[object WeakMap]");
|
||||
assertEq(Object.prototype.toString.call(WeakMap()), "[object WeakMap]");
|
||||
assertEq(Object.keys(WeakMap.prototype).join(), "");
|
||||
assertEq(WeakMap.prototype.constructor, WeakMap);
|
||||
|
||||
function checkMethod(name, arity) {
|
||||
var desc = Object.getOwnPropertyDescriptor(WeakMap.prototype, name);
|
||||
assertEq(desc.enumerable, false);
|
||||
assertEq(desc.configurable, true);
|
||||
assertEq(desc.writable, true);
|
||||
assertEq(typeof desc.value, 'function');
|
||||
assertEq(desc.value.name, name);
|
||||
assertEq(desc.value.length, arity);
|
||||
}
|
||||
|
||||
// XXX: WeakMap#get implementation has an undocumented 2nd argument
|
||||
//checkMethod("get", 1);
|
||||
checkMethod("has", 1);
|
||||
checkMethod("set", 2);
|
||||
checkMethod("delete", 1);
|
||||
checkMethod("clear", 0);
|
@ -500,7 +500,7 @@ js_InitWeakMapClass(JSContext *cx, HandleObject obj)
|
||||
return nullptr;
|
||||
|
||||
RootedFunction ctor(cx, global->createConstructor(cx, WeakMap_construct,
|
||||
cx->names().WeakMap, 0));
|
||||
cx->names().WeakMap, 1));
|
||||
if (!ctor)
|
||||
return nullptr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user