Bug 1096328 - Remove nativeOwnership from Bindings.conf, make rooting analysis happy. r=bz.

This commit is contained in:
Peter Van der Beken 2015-01-08 22:56:42 +01:00
parent 352722ff92
commit 00ece8f296
46 changed files with 196 additions and 181 deletions

View File

@ -129,10 +129,11 @@ AnonymousContent::GetElementById(const nsAString& aElementId)
return nullptr;
}
JSObject*
AnonymousContent::WrapObject(JSContext* aCx)
bool
AnonymousContent::WrapObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector)
{
return AnonymousContentBinding::Wrap(aCx, this);
return AnonymousContentBinding::Wrap(aCx, this, aReflector);
}
} // dom namespace

View File

@ -27,7 +27,7 @@ public:
explicit AnonymousContent(Element* aContentNode);
nsCOMPtr<Element> GetContentNode();
void SetContentNode(Element* aContentNode);
JSObject* WrapObject(JSContext* aCx);
bool WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector);
// WebIDL methods
void SetTextContentForElement(const nsAString& aElementId,

View File

@ -288,10 +288,10 @@ void NodeIterator::ContentRemoved(nsIDocument *aDocument,
mWorkingPointer.AdjustAfterRemoval(mRoot, container, aChild, aPreviousSibling);
}
JSObject*
NodeIterator::WrapObject(JSContext *cx)
bool
NodeIterator::WrapObject(JSContext *cx, JS::MutableHandle<JSObject*> aReflector)
{
return NodeIteratorBinding::Wrap(cx, this);
return NodeIteratorBinding::Wrap(cx, this, aReflector);
}
} // namespace dom

View File

@ -69,7 +69,7 @@ public:
}
// The XPCOM Detach() is fine for our purposes
JSObject* WrapObject(JSContext *cx);
bool WrapObject(JSContext *cx, JS::MutableHandle<JSObject*> aReflector);
private:
virtual ~NodeIterator();

View File

@ -450,10 +450,10 @@ TreeWalker::NextSiblingInternal(bool aReversed, ErrorResult& aResult)
}
}
JSObject*
TreeWalker::WrapObject(JSContext *cx)
bool
TreeWalker::WrapObject(JSContext *aCx, JS::MutableHandle<JSObject*> aReflector)
{
return TreeWalkerBinding::Wrap(cx, this);
return TreeWalkerBinding::Wrap(aCx, this, aReflector);
}
} // namespace dom

View File

@ -65,7 +65,7 @@ public:
already_AddRefed<nsINode> PreviousNode(ErrorResult& aResult);
already_AddRefed<nsINode> NextNode(ErrorResult& aResult);
JSObject* WrapObject(JSContext *cx);
bool WrapObject(JSContext *aCx, JS::MutableHandle<JSObject*> aReflector);
private:
nsCOMPtr<nsINode> mCurrentNode;

View File

@ -46,10 +46,10 @@ URL::URL(nsIURI* aURI)
{
}
JSObject*
URL::WrapObject(JSContext* aCx)
bool
URL::WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector)
{
return URLBinding::Wrap(aCx, this);
return URLBinding::Wrap(aCx, this, aReflector);
}
/* static */ already_AddRefed<URL>

View File

@ -43,8 +43,8 @@ public:
explicit URL(nsIURI* aURI);
// WebIDL methods
JSObject*
WrapObject(JSContext* aCx);
bool
WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector);
static already_AddRefed<URL>
Constructor(const GlobalObject& aGlobal, const nsAString& aUrl,

View File

@ -2299,9 +2299,9 @@ CreateNativeGlobalForInner(JSContext* aCx,
uint32_t flags = needComponents ? 0 : nsIXPConnect::OMIT_COMPONENTS_OBJECT;
flags |= nsIXPConnect::DONT_FIRE_ONNEWGLOBALHOOK;
aGlobal.set(WindowBinding::Wrap(aCx, aNewInner, aNewInner, options,
nsJSPrincipals::get(aPrincipal), false));
if (!aGlobal || !xpc::InitGlobalObject(aCx, aGlobal, flags)) {
if (!WindowBinding::Wrap(aCx, aNewInner, aNewInner, options,
nsJSPrincipals::get(aPrincipal), false, aGlobal) ||
!xpc::InitGlobalObject(aCx, aGlobal, flags)) {
return NS_ERROR_FAILURE;
}

View File

@ -1019,11 +1019,9 @@ WrapNewBindingNonWrapperCachedObject(JSContext* cx,
}
MOZ_ASSERT(js::IsObjectInContextCompartment(scope, cx));
obj = value->WrapObject(cx);
}
if (!obj) {
return false;
if (!value->WrapObject(cx, &obj)) {
return false;
}
}
// We can end up here in all sorts of compartments, per above. Make
@ -1067,14 +1065,11 @@ WrapNewBindingNonWrapperCachedObject(JSContext* cx,
}
MOZ_ASSERT(js::IsObjectInContextCompartment(scope, cx));
obj = value->WrapObject(cx);
if (obj) {
value.forget();
if (!value->WrapObject(cx, &obj)) {
return false;
}
}
if (!obj) {
return false;
value.forget();
}
// We can end up here in all sorts of compartments, per above. Make
@ -2767,57 +2762,55 @@ class MOZ_STACK_CLASS BindingJSObjectCreator
{
public:
explicit BindingJSObjectCreator(JSContext* aCx)
: mObject(aCx)
: mReflector(aCx)
{
}
~BindingJSObjectCreator()
{
if (mObject) {
js::SetReservedOrProxyPrivateSlot(mObject, DOM_OBJECT_SLOT,
if (mReflector) {
js::SetReservedOrProxyPrivateSlot(mReflector, DOM_OBJECT_SLOT,
JS::UndefinedValue());
}
}
JS::Rooted<JSObject*>&
void
CreateProxyObject(JSContext* aCx, const js::Class* aClass,
const DOMProxyHandler* aHandler,
JS::Handle<JSObject*> aProto,
JS::Handle<JSObject*> aParent, T* aNative)
JS::Handle<JSObject*> aParent, T* aNative,
JS::MutableHandle<JSObject*> aReflector)
{
js::ProxyOptions options;
options.setClass(aClass);
JS::Rooted<JS::Value> proxyPrivateVal(aCx, JS::PrivateValue(aNative));
mObject = js::NewProxyObject(aCx, aHandler, proxyPrivateVal, aProto,
aParent, options);
if (mObject) {
aReflector.set(js::NewProxyObject(aCx, aHandler, proxyPrivateVal, aProto,
aParent, options));
if (aReflector) {
mNative = aNative;
mReflector = aReflector;
}
return mObject;
}
JS::Rooted<JSObject*>&
void
CreateObject(JSContext* aCx, const JSClass* aClass,
JS::Handle<JSObject*> aProto, JS::Handle<JSObject*> aParent,
T* aNative)
T* aNative, JS::MutableHandle<JSObject*> aReflector)
{
mObject = JS_NewObject(aCx, aClass, aProto, aParent);
if (mObject) {
js::SetReservedSlot(mObject, DOM_OBJECT_SLOT, JS::PrivateValue(aNative));
aReflector.set(JS_NewObject(aCx, aClass, aProto, aParent));
if (aReflector) {
js::SetReservedSlot(aReflector, DOM_OBJECT_SLOT, JS::PrivateValue(aNative));
mNative = aNative;
mReflector = aReflector;
}
return mObject;
}
JSObject*
ForgetObject()
void
InitializationSucceeded()
{
void* dummy;
mNative.forget(&dummy);
JSObject* obj = mObject;
mObject = nullptr;
return obj;
mReflector = nullptr;
}
private:
@ -2843,7 +2836,7 @@ private:
}
};
JS::Rooted<JSObject*> mObject;
JS::Rooted<JSObject*> mReflector;
typename Conditional<IsRefcounted<T>::value, nsRefPtr<T>, OwnedNative>::Type mNative;
};

View File

@ -3064,27 +3064,25 @@ def CreateBindingJSObject(descriptor, properties):
if descriptor.proxy:
create = dedent(
"""
const JS::Rooted<JSObject*>& obj =
creator.CreateProxyObject(aCx, &Class.mBase, DOMProxyHandler::getInstance(),
proto, global, aObject);
if (!obj) {
return nullptr;
creator.CreateProxyObject(aCx, &Class.mBase, DOMProxyHandler::getInstance(),
proto, global, aObject, aReflector);
if (!aReflector) {
return false;
}
""")
if descriptor.interface.getExtendedAttribute('OverrideBuiltins'):
create += dedent("""
js::SetProxyExtra(obj, JSPROXYSLOT_EXPANDO,
js::SetProxyExtra(aReflector, JSPROXYSLOT_EXPANDO,
JS::PrivateValue(&aObject->mExpandoAndGeneration));
""")
else:
create = dedent(
"""
const JS::Rooted<JSObject*>& obj =
creator.CreateObject(aCx, Class.ToJSClass(), proto, global, aObject);
if (!obj) {
return nullptr;
creator.CreateObject(aCx, Class.ToJSClass(), proto, global, aObject, aReflector);
if (!aReflector) {
return false;
}
""")
return objDecl + create
@ -3160,7 +3158,7 @@ def InitUnforgeableProperties(descriptor, properties):
"// by the interface prototype object.\n")
else:
unforgeableProperties = CGWrapper(
InitUnforgeablePropertiesOnObject(descriptor, "obj", properties, "nullptr"),
InitUnforgeablePropertiesOnObject(descriptor, "aReflector", properties, "false"),
pre=(
"// Important: do unforgeable property setup after we have handed\n"
"// over ownership of the C++ object to obj as needed, so that if\n"
@ -3198,9 +3196,9 @@ def InitMemberSlots(descriptor, wrapperCache):
clearWrapper = " aCache->ClearWrapper();\n"
else:
clearWrapper = ""
return ("if (!UpdateMemberSlots(aCx, obj, aObject)) {\n"
return ("if (!UpdateMemberSlots(aCx, aReflector, aObject)) {\n"
"%s"
" return nullptr;\n"
" return false;\n"
"}\n" % clearWrapper)
@ -3214,8 +3212,9 @@ class CGWrapWithCacheMethod(CGAbstractMethod):
assert descriptor.interface.hasInterfacePrototypeObject()
args = [Argument('JSContext*', 'aCx'),
Argument(descriptor.nativeType + '*', 'aObject'),
Argument('nsWrapperCache*', 'aCache')]
CGAbstractMethod.__init__(self, descriptor, 'Wrap', 'JSObject*', args)
Argument('nsWrapperCache*', 'aCache'),
Argument('JS::MutableHandle<JSObject*>', 'aReflector')]
CGAbstractMethod.__init__(self, descriptor, 'Wrap', 'bool', args)
self.properties = properties
def definition_body(self):
@ -3228,33 +3227,31 @@ class CGWrapWithCacheMethod(CGAbstractMethod):
JS::Rooted<JSObject*> parent(aCx, WrapNativeParent(aCx, aObject->GetParentObject()));
if (!parent) {
return nullptr;
return false;
}
// That might have ended up wrapping us already, due to the wonders
// of XBL. Check for that, and bail out as needed. Scope so we don't
// collide with the "obj" we declare in CreateBindingJSObject.
{
JSObject* obj = aCache->GetWrapper();
if (obj) {
return obj;
}
// of XBL. Check for that, and bail out as needed.
aReflector.set(aCache->GetWrapper());
if (aReflector) {
return true;
}
JSAutoCompartment ac(aCx, parent);
JS::Rooted<JSObject*> global(aCx, js::GetGlobalForObjectCrossCompartment(parent));
JS::Handle<JSObject*> proto = GetProtoObjectHandle(aCx, global);
if (!proto) {
return nullptr;
return false;
}
$*{createObject}
$*{unforgeable}
aCache->SetWrapper(obj);
aCache->SetWrapper(aReflector);
$*{slots}
return creator.ForgetObject();
creator.InitializationSucceeded();
return true;
""",
assertion=AssertInheritanceChain(self.descriptor),
createObject=CreateBindingJSObject(self.descriptor, self.properties),
@ -3272,7 +3269,10 @@ class CGWrapMethod(CGAbstractMethod):
inline=True, templateArgs=["class T"])
def definition_body(self):
return "return Wrap(aCx, aObject, aObject);\n"
return dedent("""
JS::Rooted<JSObject*> reflector(aCx);
return Wrap(aCx, aObject, aObject, &reflector) ? reflector.get() : nullptr;
""")
class CGWrapNonWrapperCacheMethod(CGAbstractMethod):
@ -3286,8 +3286,9 @@ class CGWrapNonWrapperCacheMethod(CGAbstractMethod):
# XXX can we wrap if we don't have an interface prototype object?
assert descriptor.interface.hasInterfacePrototypeObject()
args = [Argument('JSContext*', 'aCx'),
Argument(descriptor.nativeType + '*', 'aObject')]
CGAbstractMethod.__init__(self, descriptor, 'Wrap', 'JSObject*', args)
Argument(descriptor.nativeType + '*', 'aObject'),
Argument('JS::MutableHandle<JSObject*>', 'aReflector')]
CGAbstractMethod.__init__(self, descriptor, 'Wrap', 'bool', args)
self.properties = properties
def definition_body(self):
@ -3298,7 +3299,7 @@ class CGWrapNonWrapperCacheMethod(CGAbstractMethod):
JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(aCx));
JS::Handle<JSObject*> proto = GetProtoObjectHandle(aCx, global);
if (!proto) {
return nullptr;
return false;
}
$*{createObject}
@ -3306,7 +3307,8 @@ class CGWrapNonWrapperCacheMethod(CGAbstractMethod):
$*{unforgeable}
$*{slots}
return creator.ForgetObject();
creator.InitializationSucceeded();
return true;
""",
assertions=AssertInheritanceChain(self.descriptor),
createObject=CreateBindingJSObject(self.descriptor, self.properties),
@ -3328,8 +3330,9 @@ class CGWrapGlobalMethod(CGAbstractMethod):
Argument('nsWrapperCache*', 'aCache'),
Argument('JS::CompartmentOptions&', 'aOptions'),
Argument('JSPrincipals*', 'aPrincipal'),
Argument('bool', 'aInitStandardClasses')]
CGAbstractMethod.__init__(self, descriptor, 'Wrap', 'JSObject*', args)
Argument('bool', 'aInitStandardClasses'),
Argument('JS::MutableHandle<JSObject*>', 'aReflector')]
CGAbstractMethod.__init__(self, descriptor, 'Wrap', 'bool', args)
self.descriptor = descriptor
self.properties = properties
@ -3345,7 +3348,7 @@ class CGWrapGlobalMethod(CGAbstractMethod):
if self.descriptor.workers:
fireOnNewGlobal = """// XXXkhuey can't do this yet until workers can lazy resolve.
// JS_FireOnNewGlobalObject(aCx, obj);
// JS_FireOnNewGlobalObject(aCx, aReflector);
"""
else:
fireOnNewGlobal = ""
@ -3356,7 +3359,6 @@ class CGWrapGlobalMethod(CGAbstractMethod):
MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
"nsISupports must be on our primary inheritance chain");
JS::Rooted<JSObject*> obj(aCx);
CreateGlobal<${nativeType}, GetProtoObjectHandle>(aCx,
aObject,
aCache,
@ -3364,24 +3366,24 @@ class CGWrapGlobalMethod(CGAbstractMethod):
aOptions,
aPrincipal,
aInitStandardClasses,
&obj);
if (!obj) {
return nullptr;
aReflector);
if (!aReflector) {
return false;
}
// obj is a new global, so has a new compartment. Enter it
// aReflector is a new global, so has a new compartment. Enter it
// before doing anything with it.
JSAutoCompartment ac(aCx, obj);
JSAutoCompartment ac(aCx, aReflector);
if (!DefineProperties(aCx, obj, ${properties}, ${chromeProperties})) {
return nullptr;
if (!DefineProperties(aCx, aReflector, ${properties}, ${chromeProperties})) {
return false;
}
$*{unforgeable}
$*{slots}
$*{fireOnNewGlobal}
return obj;
return true;
""",
assertions=AssertInheritanceChain(self.descriptor),
nativeType=self.descriptor.nativeType,

View File

@ -32,7 +32,9 @@ ReadStructuredCloneImageData(JSContext* aCx, JSStructuredCloneReader* aReader)
nsRefPtr<ImageData> imageData = new ImageData(width, height,
dataArray.toObject());
// Wrap it in a JS::Value.
result = imageData->WrapObject(aCx);
if (!imageData->WrapObject(aCx, &result)) {
return nullptr;
}
}
return result;
}

View File

@ -90,7 +90,7 @@ class TestNonWrapperCacheInterface : public nsISupports
public:
NS_DECL_ISUPPORTS
virtual JSObject* WrapObject(JSContext* cx);
bool WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector);
};
class OnlyForUseInConstructor : public nsISupports,

View File

@ -108,10 +108,10 @@ ImageData::DropData()
}
}
JSObject*
ImageData::WrapObject(JSContext* cx)
bool
ImageData::WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector)
{
return ImageDataBinding::Wrap(cx, this);
return ImageDataBinding::Wrap(aCx, this, aReflector);
}
} // namespace dom

View File

@ -73,7 +73,7 @@ public:
return mData;
}
JSObject* WrapObject(JSContext* cx);
bool WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector);
private:
void HoldData();

View File

@ -30,9 +30,9 @@ public:
return width;
}
JSObject* WrapObject(JSContext* aCx)
bool WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector)
{
return TextMetricsBinding::Wrap(aCx, this);
return TextMetricsBinding::Wrap(aCx, this, aReflector);
}
private:

View File

@ -11,10 +11,11 @@
namespace mozilla {
JSObject*
WebGLActiveInfo::WrapObject(JSContext* cx)
bool
WebGLActiveInfo::WrapObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector)
{
return dom::WebGLActiveInfoBinding::Wrap(cx, this);
return dom::WebGLActiveInfoBinding::Wrap(aCx, this, aReflector);
}
} // namespace mozilla

View File

@ -35,7 +35,7 @@ public:
retval = mName;
}
JSObject* WrapObject(JSContext* cx);
bool WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector);
NS_INLINE_DECL_REFCOUNTING(WebGLActiveInfo)

View File

@ -10,10 +10,11 @@
namespace mozilla {
JSObject*
WebGLShaderPrecisionFormat::WrapObject(JSContext* cx)
bool
WebGLShaderPrecisionFormat::WrapObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector)
{
return dom::WebGLShaderPrecisionFormatBinding::Wrap(cx, this);
return dom::WebGLShaderPrecisionFormatBinding::Wrap(aCx, this, aReflector);
}
} // namespace mozilla

View File

@ -24,7 +24,7 @@ public:
, mPrecision(precision)
{ }
JSObject* WrapObject(JSContext* cx);
bool WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector);
// WebIDL WebGLShaderPrecisionFormat API
GLint RangeMin() const {

View File

@ -12,10 +12,11 @@
namespace mozilla {
JSObject*
WebGLUniformLocation::WrapObject(JSContext* cx)
bool
WebGLUniformLocation::WrapObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector)
{
return dom::WebGLUniformLocationBinding::Wrap(cx, this);
return dom::WebGLUniformLocationBinding::Wrap(aCx, this, aReflector);
}
WebGLUniformLocation::WebGLUniformLocation(WebGLContext* context,

View File

@ -31,7 +31,7 @@ public:
uint32_t ProgramGeneration() const { return mProgramGeneration; }
int ElementSize() const { return mElementSize; }
JSObject* WrapObject(JSContext* cx);
bool WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector);
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLUniformLocation)
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(WebGLUniformLocation)

View File

@ -29,10 +29,11 @@ DataStoreCursor::Constructor(GlobalObject& aGlobal, ErrorResult& aRv)
return cursor.forget();
}
JSObject*
DataStoreCursor::WrapObject(JSContext* aCx)
bool
DataStoreCursor::WrapObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector)
{
return DataStoreCursorBinding::Wrap(aCx, this);
return DataStoreCursorBinding::Wrap(aCx, this, aReflector);
}
already_AddRefed<DataStore>
@ -72,4 +73,4 @@ DataStoreCursor::SetDataStoreCursorImpl(DataStoreCursorImpl& aCursor)
}
} //namespace dom
} //namespace mozilla
} //namespace mozilla

View File

@ -33,7 +33,7 @@ public:
static already_AddRefed<DataStoreCursor> Constructor(GlobalObject& aGlobal,
ErrorResult& aRv);
JSObject* WrapObject(JSContext *aCx);
bool WrapObject(JSContext *aCx, JS::MutableHandle<JSObject*> aReflector);
// WebIDL (public APIs)
@ -56,4 +56,4 @@ private:
} //namespace dom
} //namespace mozilla
#endif
#endif

View File

@ -49,9 +49,9 @@ public:
MOZ_COUNT_DTOR(TextDecoder);
}
JSObject* WrapObject(JSContext* aCx)
bool WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector)
{
return TextDecoderBinding::Wrap(aCx, this);
return TextDecoderBinding::Wrap(aCx, this, aReflector);
}
/**

View File

@ -42,9 +42,9 @@ public:
~TextEncoder()
{}
JSObject* WrapObject(JSContext* aCx)
bool WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector)
{
return TextEncoderBinding::Wrap(aCx, this);
return TextEncoderBinding::Wrap(aCx, this, aReflector);
}
protected:

View File

@ -166,10 +166,10 @@ TimeRanges::Find(double aTime, double aError /* = 0 */)
return NoIndex;
}
JSObject*
TimeRanges::WrapObject(JSContext* aCx)
bool
TimeRanges::WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector)
{
return TimeRangesBinding::Wrap(aCx, this);
return TimeRangesBinding::Wrap(aCx, this, aReflector);
}
} // namespace dom

View File

@ -50,7 +50,7 @@ public:
// Mutate this TimeRange to be the intersection of this and aOtherRanges.
void Intersection(const TimeRanges* aOtherRanges);
JSObject* WrapObject(JSContext* aCx);
bool WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector);
uint32_t Length() const
{

View File

@ -247,10 +247,10 @@ IDBKeyRange::DropJSObjects()
mozilla::DropJSObjects(this);
}
JSObject*
IDBKeyRange::WrapObject(JSContext* aCx)
bool
IDBKeyRange::WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector)
{
return IDBKeyRangeBinding::Wrap(aCx, this);
return IDBKeyRangeBinding::Wrap(aCx, this, aReflector);
}
void

View File

@ -140,8 +140,8 @@ public:
DropJSObjects();
// WebIDL
JSObject*
WrapObject(JSContext* aCx);
bool
WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector);
nsISupports*
GetParentObject() const

View File

@ -35,10 +35,11 @@ VRFieldOfView::Constructor(const GlobalObject& aGlobal,
aLeftDegrees);
}
JSObject*
VRFieldOfView::WrapObject(JSContext* aCx)
bool
VRFieldOfView::WrapObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector)
{
return VRFieldOfViewBinding::Wrap(aCx, this);
return VRFieldOfViewBinding::Wrap(aCx, this, aReflector);
}
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(VRPositionState, mParent)

View File

@ -68,7 +68,7 @@ public:
double aDownDegrees, double aLeftDegrees,
ErrorResult& aRv);
JSObject* WrapObject(JSContext* aCx);
bool WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector);
void SetUpDegrees(double aVal) { mUpDegrees = aVal; }
void SetRightDegrees(double aVal) { mRightDegrees = aVal; }

View File

@ -40,10 +40,11 @@ WorkerDataStoreCursor::Constructor(GlobalObject& aGlobal, ErrorResult& aRv)
return nullptr;
}
JSObject*
WorkerDataStoreCursor::WrapObject(JSContext* aCx)
bool
WorkerDataStoreCursor::WrapObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector)
{
return DataStoreCursorBinding_workers::Wrap(aCx, this);
return DataStoreCursorBinding_workers::Wrap(aCx, this, aReflector);
}
// A WorkerMainThreadRunnable which holds a reference to DataStoreCursor.

View File

@ -35,7 +35,7 @@ public:
static already_AddRefed<WorkerDataStoreCursor> Constructor(GlobalObject& aGlobal,
ErrorResult& aRv);
JSObject* WrapObject(JSContext *aCx);
bool WrapObject(JSContext *aCx, JS::MutableHandle<JSObject*> aReflector);
// WebIDL (public APIs)

View File

@ -41,10 +41,11 @@ FileReaderSync::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
return frs.forget();
}
JSObject*
FileReaderSync::WrapObject(JSContext* aCx)
bool
FileReaderSync::WrapObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector)
{
return FileReaderSyncBinding_workers::Wrap(aCx, this);
return FileReaderSyncBinding_workers::Wrap(aCx, this, aReflector);
}
void

View File

@ -41,7 +41,7 @@ public:
static already_AddRefed<FileReaderSync>
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
JSObject* WrapObject(JSContext* aCx);
bool WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector);
void ReadAsArrayBuffer(JSContext* aCx, JS::Handle<JSObject*> aScopeObj,
File& aBlob, JS::MutableHandle<JSObject*> aRetval,

View File

@ -572,10 +572,10 @@ URL::~URL()
}
}
JSObject*
URL::WrapObject(JSContext* aCx)
bool
URL::WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector)
{
return URLBinding_workers::Wrap(aCx, this);
return URLBinding_workers::Wrap(aCx, this, aReflector);
}
void

View File

@ -45,8 +45,8 @@ public:
return nullptr;
}
JSObject*
WrapObject(JSContext* aCx);
bool
WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector);
// Methods for WebIDL

View File

@ -6253,8 +6253,10 @@ WorkerPrivate::CreateGlobalScope(JSContext* aCx)
globalScope = new DedicatedWorkerGlobalScope(this);
}
JS::Rooted<JSObject*> global(aCx, globalScope->WrapGlobalObject(aCx));
NS_ENSURE_TRUE(global, nullptr);
JS::Rooted<JSObject*> global(aCx);
if (!globalScope->WrapGlobalObject(aCx, &global)) {
return nullptr;
}
JSAutoCompartment ac(aCx, global);

View File

@ -362,8 +362,9 @@ DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(WorkerPrivate* aWorkerPri
{
}
JSObject*
DedicatedWorkerGlobalScope::WrapGlobalObject(JSContext* aCx)
bool
DedicatedWorkerGlobalScope::WrapGlobalObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector)
{
mWorkerPrivate->AssertIsOnWorkerThread();
MOZ_ASSERT(!mWorkerPrivate->IsSharedWorker());
@ -374,7 +375,7 @@ DedicatedWorkerGlobalScope::WrapGlobalObject(JSContext* aCx)
return DedicatedWorkerGlobalScopeBinding_workers::Wrap(aCx, this, this,
options,
GetWorkerPrincipal(),
true);
true, aReflector);
}
void
@ -393,8 +394,9 @@ SharedWorkerGlobalScope::SharedWorkerGlobalScope(WorkerPrivate* aWorkerPrivate,
{
}
JSObject*
SharedWorkerGlobalScope::WrapGlobalObject(JSContext* aCx)
bool
SharedWorkerGlobalScope::WrapGlobalObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector)
{
mWorkerPrivate->AssertIsOnWorkerThread();
MOZ_ASSERT(mWorkerPrivate->IsSharedWorker());
@ -404,7 +406,7 @@ SharedWorkerGlobalScope::WrapGlobalObject(JSContext* aCx)
return SharedWorkerGlobalScopeBinding_workers::Wrap(aCx, this, this, options,
GetWorkerPrincipal(),
true);
true, aReflector);
}
NS_IMPL_CYCLE_COLLECTION_INHERITED(ServiceWorkerGlobalScope, WorkerGlobalScope,
@ -426,8 +428,9 @@ ServiceWorkerGlobalScope::~ServiceWorkerGlobalScope()
{
}
JSObject*
ServiceWorkerGlobalScope::WrapGlobalObject(JSContext* aCx)
bool
ServiceWorkerGlobalScope::WrapGlobalObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector)
{
mWorkerPrivate->AssertIsOnWorkerThread();
MOZ_ASSERT(mWorkerPrivate->IsServiceWorker());
@ -437,7 +440,7 @@ ServiceWorkerGlobalScope::WrapGlobalObject(JSContext* aCx)
return ServiceWorkerGlobalScopeBinding_workers::Wrap(aCx, this, this, options,
GetWorkerPrincipal(),
true);
true, aReflector);
}
ServiceWorkerClients*

View File

@ -57,8 +57,8 @@ public:
virtual JSObject*
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
virtual JSObject*
WrapGlobalObject(JSContext* aCx) = 0;
virtual bool
WrapGlobalObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector) = 0;
virtual JSObject*
GetGlobalJSObject(void) MOZ_OVERRIDE
@ -148,8 +148,9 @@ class DedicatedWorkerGlobalScope MOZ_FINAL : public WorkerGlobalScope
public:
explicit DedicatedWorkerGlobalScope(WorkerPrivate* aWorkerPrivate);
virtual JSObject*
WrapGlobalObject(JSContext* aCx) MOZ_OVERRIDE;
virtual bool
WrapGlobalObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector) MOZ_OVERRIDE;
void
PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
@ -169,8 +170,9 @@ public:
SharedWorkerGlobalScope(WorkerPrivate* aWorkerPrivate,
const nsCString& aName);
virtual JSObject*
WrapGlobalObject(JSContext* aCx) MOZ_OVERRIDE;
virtual bool
WrapGlobalObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector) MOZ_OVERRIDE;
void GetName(DOMString& aName) const
{
@ -194,8 +196,9 @@ public:
ServiceWorkerGlobalScope(WorkerPrivate* aWorkerPrivate, const nsACString& aScope);
virtual JSObject*
WrapGlobalObject(JSContext* aCx) MOZ_OVERRIDE;
virtual bool
WrapGlobalObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector) MOZ_OVERRIDE;
void
GetScope(DOMString& aScope) const

View File

@ -158,10 +158,11 @@ XPathEvaluator::CreateExpression(const nsAString & aExpression,
return new XPathExpression(Move(expression), mRecycler, aDocument);
}
JSObject*
XPathEvaluator::WrapObject(JSContext* aCx)
bool
XPathEvaluator::WrapObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector)
{
return dom::XPathEvaluatorBinding::Wrap(aCx, this);
return dom::XPathEvaluatorBinding::Wrap(aCx, this, aReflector);
}
/* static */

View File

@ -42,7 +42,7 @@ public:
NS_DECL_NSIDOMXPATHEVALUATOR
// WebIDL API
JSObject* WrapObject(JSContext* aCx);
bool WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector);
nsIDocument* GetParentObject()
{
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);

View File

@ -34,9 +34,9 @@ public:
nsIDocument *aDocument);
~XPathExpression();
JSObject* WrapObject(JSContext* aCx)
bool WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector)
{
return XPathExpressionBinding::Wrap(aCx, this);
return XPathExpressionBinding::Wrap(aCx, this, aReflector);
}
already_AddRefed<XPathResult>

View File

@ -289,10 +289,11 @@ RTCStatsQuery::~RTCStatsQuery() {
NS_IMPL_ISUPPORTS0(PeerConnectionImpl)
#ifdef MOZILLA_INTERNAL_API
JSObject*
PeerConnectionImpl::WrapObject(JSContext* aCx)
bool
PeerConnectionImpl::WrapObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector)
{
return PeerConnectionImplBinding::Wrap(aCx, this);
return PeerConnectionImplBinding::Wrap(aCx, this, aReflector);
}
#endif

View File

@ -251,7 +251,7 @@ public:
NS_DECL_THREADSAFE_ISUPPORTS
#ifdef MOZILLA_INTERNAL_API
virtual JSObject* WrapObject(JSContext* cx);
bool WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector);
#endif
static already_AddRefed<PeerConnectionImpl>