@@ -4996,21 +4996,6 @@ DictionaryHandle dictionary_handle(JSObject *obj) {
4996
4996
return DictionaryHandle{static_cast <uint32_t >(val.toInt32 ())};
4997
4997
}
4998
4998
4999
- JSObject *create (JSContext *cx, const char *name, size_t name_len);
5000
-
5001
- bool constructor (JSContext *cx, unsigned argc, Value *vp) {
5002
- REQUEST_HANDLER_ONLY (" The Dictionary builtin" );
5003
- CTOR_HEADER (" Dictionary" , 1 );
5004
-
5005
- size_t name_len;
5006
- UniqueChars name = encode (cx, args[0 ], &name_len);
5007
- RootedObject dictionary (cx, create (cx, name.get (), name_len));
5008
- if (!dictionary)
5009
- return false ;
5010
- args.rval ().setObject (*dictionary);
5011
- return true ;
5012
- }
5013
-
5014
4999
const unsigned ctor_length = 1 ;
5015
5000
5016
5001
bool check_receiver (JSContext *cx, HandleValue receiver, const char *method_name);
@@ -5046,20 +5031,25 @@ bool get(JSContext *cx, unsigned argc, Value *vp) {
5046
5031
const JSFunctionSpec methods[] = {JS_FN (" get" , get, 1 , JSPROP_ENUMERATE), JS_FS_END};
5047
5032
5048
5033
const JSPropertySpec properties[] = {JS_PS_END};
5049
-
5034
+ bool constructor (JSContext *cx, unsigned argc, Value *vp);
5050
5035
CLASS_BOILERPLATE (Dictionary)
5051
5036
5052
- JSObject *create (JSContext *cx, const char *name, size_t name_len) {
5053
- RootedObject dict (cx, JS_NewObjectWithGivenProto (cx, &class_, proto_obj));
5054
- if (!dict)
5055
- return nullptr ;
5056
- DictionaryHandle dict_handle = {INVALID_HANDLE};
5057
- if (!HANDLE_RESULT (cx, xqd_dictionary_open (name, name_len, &dict_handle)))
5058
- return nullptr ;
5037
+ bool constructor (JSContext *cx, unsigned argc, Value *vp) {
5038
+ REQUEST_HANDLER_ONLY (" The Dictionary builtin" );
5039
+ CTOR_HEADER (" Dictionary" , 1 );
5059
5040
5060
- JS::SetReservedSlot (dict, Slots::Dictionary, JS::Int32Value ((int )dict_handle.handle ));
5041
+ size_t name_len;
5042
+ UniqueChars name = encode (cx, args[0 ], &name_len);
5043
+ RootedObject dictionary (cx, JS_NewObjectForConstructor (cx, &class_, args));
5044
+ DictionaryHandle dict_handle = {INVALID_HANDLE};
5045
+ if (!HANDLE_RESULT (cx, xqd_dictionary_open (name.get (), name_len, &dict_handle)))
5046
+ return false ;
5061
5047
5062
- return dict;
5048
+ JS::SetReservedSlot (dictionary, Slots::Dictionary, JS::Int32Value ((int )dict_handle.handle ));
5049
+ if (!dictionary)
5050
+ return false ;
5051
+ args.rval ().setObject (*dictionary);
5052
+ return true ;
5063
5053
}
5064
5054
} // namespace Dictionary
5065
5055
0 commit comments