author | Tom Schuster <evilpies@gmail.com> |
Sat, 31 Jan 2015 16:18:51 +0100 | |
changeset 226933 | 87f2bd784f4151468734471fac6efd91e35bd68e |
parent 226932 | 5c4b7be30f7d300f8259dd8b7f4a3a3f1180e8a6 |
child 226934 | 3f806794d466fdd76c002103f0cc6006fa2d0ecd |
push id | 28212 |
push user | philringnalda@gmail.com |
push date | Sun, 01 Feb 2015 17:17:22 +0000 |
treeherder | mozilla-central@2ed663b8bc05 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1127443 |
milestone | 38.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -6149,17 +6149,17 @@ nsDocument::RegisterElement(JSContext* a JS::Handle<JSObject*> htmlProto( HTMLElementBinding::GetProtoObjectHandle(aCx, global)); if (!htmlProto) { rv.Throw(NS_ERROR_OUT_OF_MEMORY); return; } if (!aOptions.mPrototype) { - protoObject = JS_NewObject(aCx, nullptr, htmlProto, JS::NullPtr()); + protoObject = JS_NewObjectWithGivenProto(aCx, nullptr, htmlProto, JS::NullPtr()); if (!protoObject) { rv.Throw(NS_ERROR_UNEXPECTED); return; } } else { protoObject = aOptions.mPrototype; // We are already operating on the document's (/global's) compartment. Let's
--- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -476,18 +476,18 @@ CreateInterfaceObject(JSContext* cx, JS: JS::Handle<JSObject*> proto, const NativeProperties* properties, const NativeProperties* chromeOnlyProperties, const char* name, bool defineOnGlobal) { JS::Rooted<JSObject*> constructor(cx); if (constructorClass) { MOZ_ASSERT(constructorProto); - constructor = JS_NewObject(cx, Jsvalify(constructorClass), constructorProto, - global); + constructor = JS_NewObjectWithGivenProto(cx, Jsvalify(constructorClass), + constructorProto, global); } else { MOZ_ASSERT(constructorNative); MOZ_ASSERT(constructorProto == JS_GetFunctionPrototype(cx, global)); constructor = CreateConstructor(cx, global, name, constructorNative, ctorNargs); } if (!constructor) { return nullptr;
--- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -2793,17 +2793,17 @@ public: } } void CreateObject(JSContext* aCx, const JSClass* aClass, JS::Handle<JSObject*> aProto, JS::Handle<JSObject*> aParent, T* aNative, JS::MutableHandle<JSObject*> aReflector) { - aReflector.set(JS_NewObject(aCx, aClass, aProto, aParent)); + aReflector.set(JS_NewObjectWithGivenProto(aCx, aClass, aProto, aParent)); if (aReflector) { js::SetReservedSlot(aReflector, DOM_OBJECT_SLOT, JS::PrivateValue(aNative)); mNative = aNative; mReflector = aReflector; } } void
--- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -904,17 +904,17 @@ InitCTypeClass(JSContext* cx, HandleObje RootedObject ctor(cx, JS_GetFunctionObject(fun)); RootedObject fnproto(cx); if (!JS_GetPrototype(cx, ctor, &fnproto)) return nullptr; MOZ_ASSERT(ctor); MOZ_ASSERT(fnproto); // Set up ctypes.CType.prototype. - RootedObject prototype(cx, JS_NewObject(cx, &sCTypeProtoClass, fnproto, parent)); + RootedObject prototype(cx, JS_NewObjectWithGivenProto(cx, &sCTypeProtoClass, fnproto, parent)); if (!prototype) return nullptr; if (!JS_DefineProperty(cx, ctor, "prototype", prototype, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)) return nullptr; if (!JS_DefineProperty(cx, prototype, "constructor", ctor, @@ -1024,17 +1024,17 @@ InitTypeConstructor(JSContext* cx, if (!fun) return false; RootedObject obj(cx, JS_GetFunctionObject(fun)); if (!obj) return false; // Set up the .prototype and .prototype.constructor properties. - typeProto.set(JS_NewObject(cx, &sCTypeProtoClass, CTypeProto, parent)); + typeProto.set(JS_NewObjectWithGivenProto(cx, &sCTypeProtoClass, CTypeProto, parent)); if (!typeProto) return false; // Define property before proceeding, for GC safety. if (!JS_DefineProperty(cx, obj, "prototype", typeProto, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)) return false; @@ -1051,17 +1051,17 @@ InitTypeConstructor(JSContext* cx, // Stash ctypes.{Pointer,Array,Struct}Type.prototype on a reserved slot of // the type constructor, for faster lookup. js::SetFunctionNativeReserved(obj, SLOT_FN_CTORPROTO, OBJECT_TO_JSVAL(typeProto)); // Create an object to serve as the common ancestor for all CData objects // created from the given type constructor. This has ctypes.CData.prototype // as its prototype, such that it inherits the properties and functions // common to all CDatas. - dataProto.set(JS_NewObject(cx, &sCDataProtoClass, CDataProto, parent)); + dataProto.set(JS_NewObjectWithGivenProto(cx, &sCDataProtoClass, CDataProto, parent)); if (!dataProto) return false; // Define functions and properties on the 'dataProto' object that are common // to all CData objects created from this type constructor. (These will // become functions and properties on CData objects created from this type.) if (instanceFns && !JS_DefineFunctions(cx, dataProto, instanceFns)) return false; @@ -3296,32 +3296,32 @@ CType::Create(JSContext* cx, // * [[Class]] "CDataProto" // * __proto__ === 'dataProto'; an object containing properties and // functions common to all CData objects of types derived from // 'typeProto'. (For instance, this could be ctypes.CData.prototype // for simple types, or something representing structs for StructTypes.) // * 'constructor' property === 't' // * Additional properties specified by 'ps', as appropriate for the // specific type instance 't'. - RootedObject typeObj(cx, JS_NewObject(cx, &sCTypeClass, typeProto, parent)); + RootedObject typeObj(cx, JS_NewObjectWithGivenProto(cx, &sCTypeClass, typeProto, parent)); if (!typeObj) return nullptr; // Set up the reserved slots. JS_SetReservedSlot(typeObj, SLOT_TYPECODE, INT_TO_JSVAL(type)); if (ffiType) JS_SetReservedSlot(typeObj, SLOT_FFITYPE, PRIVATE_TO_JSVAL(ffiType)); if (name) JS_SetReservedSlot(typeObj, SLOT_NAME, STRING_TO_JSVAL(name)); JS_SetReservedSlot(typeObj, SLOT_SIZE, size); JS_SetReservedSlot(typeObj, SLOT_ALIGN, align); if (dataProto) { // Set up the 'prototype' and 'prototype.constructor' properties. - RootedObject prototype(cx, JS_NewObject(cx, &sCDataProtoClass, dataProto, parent)); + RootedObject prototype(cx, JS_NewObjectWithGivenProto(cx, &sCDataProtoClass, dataProto, parent)); if (!prototype) return nullptr; if (!JS_DefineProperty(cx, prototype, "constructor", typeObj, JSPROP_READONLY | JSPROP_PERMANENT)) return nullptr; // Set the 'prototype' object. @@ -4863,17 +4863,17 @@ StructType::DefineInternal(JSContext* cx // ctypes.CType.prototype. RootedObject dataProto(cx, CType::GetProtoFromType(cx, typeObj, SLOT_STRUCTDATAPROTO)); if (!dataProto) return false; // Set up the 'prototype' and 'prototype.constructor' properties. // The prototype will reflect the struct fields as properties on CData objects // created from this type. - RootedObject prototype(cx, JS_NewObject(cx, &sCDataProtoClass, dataProto, NullPtr())); + RootedObject prototype(cx, JS_NewObjectWithGivenProto(cx, &sCDataProtoClass, dataProto, NullPtr())); if (!prototype) return false; if (!JS_DefineProperty(cx, prototype, "constructor", typeObj, JSPROP_READONLY | JSPROP_PERMANENT)) return false; // Create a FieldInfoHash to stash on the type object, and an array to root @@ -6372,17 +6372,17 @@ CData::Create(JSContext* cx, // Get the 'prototype' property from the type. jsval slot = JS_GetReservedSlot(typeObj, SLOT_PROTO); MOZ_ASSERT(slot.isObject()); RootedObject proto(cx, &slot.toObject()); RootedObject parent(cx, JS_GetParent(typeObj)); MOZ_ASSERT(parent); - RootedObject dataObj(cx, JS_NewObject(cx, &sCDataClass, proto, parent)); + RootedObject dataObj(cx, JS_NewObjectWithGivenProto(cx, &sCDataClass, proto, parent)); if (!dataObj) return nullptr; // set the CData's associated type JS_SetReservedSlot(dataObj, SLOT_CTYPE, OBJECT_TO_JSVAL(typeObj)); // Stash the referent object, if any, for GC safety. if (refObj) @@ -6953,17 +6953,18 @@ CDataFinalizer::Construct(JSContext* cx, RootedObject objProto(cx); if (!GetObjectProperty(cx, objSelf, "prototype", &objProto)) { JS_ReportError(cx, "CDataFinalizer.prototype does not exist"); return false; } // Get arguments if (args.length() == 0) { // Special case: the empty (already finalized) object - JSObject *objResult = JS_NewObject(cx, &sCDataFinalizerClass, objProto, NullPtr()); + JSObject *objResult = JS_NewObjectWithGivenProto(cx, &sCDataFinalizerClass, objProto, + NullPtr()); args.rval().setObject(*objResult); return true; } if (args.length() != 2) { JS_ReportError(cx, "CDataFinalizer takes 2 arguments"); return false; } @@ -7052,17 +7053,17 @@ CDataFinalizer::Construct(JSContext* cx, ScopedJSFreePtr<void> rvalue; if (CType::GetTypeCode(returnType) != TYPE_void_t) { rvalue = malloc(Align(CType::GetSize(returnType), sizeof(ffi_arg))); } //Otherwise, simply do not allocate // 5. Create |objResult| - JSObject *objResult = JS_NewObject(cx, &sCDataFinalizerClass, objProto, NullPtr()); + JSObject *objResult = JS_NewObjectWithGivenProto(cx, &sCDataFinalizerClass, objProto, NullPtr()); if (!objResult) { return false; } // If our argument is a CData, it holds a type. // This is the type that we should capture, not that // of the function, which may be less precise. JSObject *objBestArgType = objArgType; @@ -7352,17 +7353,17 @@ CDataFinalizer::Cleanup(CDataFinalizer:: JSObject* Int64Base::Construct(JSContext* cx, HandleObject proto, uint64_t data, bool isUnsigned) { const JSClass* clasp = isUnsigned ? &sUInt64Class : &sInt64Class; RootedObject parent(cx, JS_GetParent(proto)); - RootedObject result(cx, JS_NewObject(cx, clasp, proto, parent)); + RootedObject result(cx, JS_NewObjectWithGivenProto(cx, clasp, proto, parent)); if (!result) return nullptr; // attach the Int64's data uint64_t* buffer = cx->new_<uint64_t>(data); if (!buffer) { JS_ReportOutOfMemory(cx); return nullptr;
--- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -5087,17 +5087,17 @@ dom_constructor(JSContext* cx, unsigned return false; if (!protov.isObject()) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_PROTOTYPE, "FakeDOMObject"); return false; } RootedObject proto(cx, &protov.toObject()); - RootedObject domObj(cx, JS_NewObject(cx, &dom_class, proto, JS::NullPtr())); + RootedObject domObj(cx, JS_NewObjectWithGivenProto(cx, &dom_class, proto, JS::NullPtr())); if (!domObj) return false; InitDOMObject(domObj); args.rval().setObject(*domObj); return true; }
--- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -803,17 +803,17 @@ XPCWrappedNative::Init(HandleObject pare RootedObject protoJSObject(cx, HasProto() ? GetProto()->GetJSProtoObject() : JS_GetObjectPrototype(cx, parent)); if (!protoJSObject) { return false; } - mFlatJSObject = JS_NewObject(cx, jsclazz, protoJSObject, parent); + mFlatJSObject = JS_NewObjectWithGivenProto(cx, jsclazz, protoJSObject, parent); if (!mFlatJSObject) { mFlatJSObject.unsetFlags(FLAT_JS_OBJECT_VALID); return false; } mFlatJSObject.setFlags(FLAT_JS_OBJECT_VALID); JS_SetPrivate(mFlatJSObject, this); @@ -1568,19 +1568,18 @@ XPCWrappedNative::InitTearOff(XPCWrapped } bool XPCWrappedNative::InitTearOffJSObject(XPCWrappedNativeTearOff* to) { AutoJSContext cx; RootedObject parent(cx, mFlatJSObject); - RootedObject proto(cx, JS_GetObjectPrototype(cx, parent)); JSObject* obj = JS_NewObject(cx, Jsvalify(&XPC_WN_Tearoff_JSClass), - proto, parent); + JS::NullPtr(), parent); if (!obj) return false; JS_SetPrivate(obj, to); to->SetJSObject(obj); return true; }