From 7a4eeff601f30a12320c27356231a1f707c7d80d Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Wed, 14 Mar 2012 16:25:40 +0100 Subject: [PATCH] Bug 727884 - Make nsWrapperCache::WrapObject take a JSObject scope instead of XPCWrappedNativeScope. r=peterv --- content/base/public/nsDOMFile.h | 2 +- content/base/src/nsContentList.cpp | 5 ++--- content/base/src/nsContentList.h | 6 +++--- content/base/src/nsDOMFile.cpp | 2 +- content/base/src/nsDOMSettableTokenList.cpp | 2 +- content/base/src/nsDOMSettableTokenList.h | 2 +- content/base/src/nsDOMTokenList.cpp | 3 +-- content/base/src/nsDOMTokenList.h | 2 +- content/base/src/nsGenericElement.cpp | 2 +- content/base/src/nsGenericElement.h | 2 +- content/events/src/nsDOMTouchEvent.h | 2 +- content/events/src/nsPaintRequest.h | 2 +- content/html/content/src/nsClientRect.cpp | 3 +-- content/html/content/src/nsClientRect.h | 2 +- content/html/content/src/nsHTMLFormElement.cpp | 2 +- content/html/content/src/nsHTMLSelectElement.cpp | 2 +- content/html/content/src/nsHTMLSelectElement.h | 2 +- content/html/content/src/nsHTMLTableElement.cpp | 2 +- content/svg/content/src/DOMSVGLengthList.cpp | 3 +-- content/svg/content/src/DOMSVGLengthList.h | 2 +- content/svg/content/src/DOMSVGNumberList.cpp | 3 +-- content/svg/content/src/DOMSVGNumberList.h | 2 +- content/svg/content/src/DOMSVGPathSegList.cpp | 3 +-- content/svg/content/src/DOMSVGPathSegList.h | 2 +- content/svg/content/src/DOMSVGPointList.cpp | 3 +-- content/svg/content/src/DOMSVGPointList.h | 2 +- content/svg/content/src/DOMSVGTransformList.cpp | 2 +- content/svg/content/src/DOMSVGTransformList.h | 2 +- content/xbl/src/nsBindingManager.cpp | 2 +- dom/base/nsGlobalWindow.h | 3 +-- dom/base/nsWrapperCache.h | 2 +- js/xpconnect/src/XPCConvert.cpp | 3 ++- js/xpconnect/src/dombindings.cpp | 12 ++++++------ js/xpconnect/src/dombindings.h | 2 +- js/xpconnect/src/dombindingsgen.py | 6 +++--- 35 files changed, 46 insertions(+), 53 deletions(-) diff --git a/content/base/public/nsDOMFile.h b/content/base/public/nsDOMFile.h index c4c67bb5313..58a1c65dbdb 100644 --- a/content/base/public/nsDOMFile.h +++ b/content/base/public/nsDOMFile.h @@ -345,7 +345,7 @@ public: NS_DECL_NSIDOMFILELIST - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap); nsISupports* GetParentObject() diff --git a/content/base/src/nsContentList.cpp b/content/base/src/nsContentList.cpp index f115aaec2ef..2a33a8c5cbc 100644 --- a/content/base/src/nsContentList.cpp +++ b/content/base/src/nsContentList.cpp @@ -192,7 +192,7 @@ NS_IMPL_ADDREF_INHERITED(nsSimpleContentList, nsBaseContentList) NS_IMPL_RELEASE_INHERITED(nsSimpleContentList, nsBaseContentList) JSObject* -nsSimpleContentList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, +nsSimpleContentList::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::NodeList::create(cx, scope, this, triedToWrap); @@ -509,8 +509,7 @@ nsContentList::~nsContentList() } JSObject* -nsContentList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, - bool *triedToWrap) +nsContentList::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::HTMLCollection::create(cx, scope, this, triedToWrap); diff --git a/content/base/src/nsContentList.h b/content/base/src/nsContentList.h index 753a21c0179..a702c86f925 100644 --- a/content/base/src/nsContentList.h +++ b/content/base/src/nsContentList.h @@ -138,7 +138,7 @@ public: virtual PRInt32 IndexOf(nsIContent *aContent, bool aDoFlush); - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) = 0; protected: @@ -162,7 +162,7 @@ public: { return mRoot; } - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap); private: @@ -293,7 +293,7 @@ public: virtual ~nsContentList(); // nsWrapperCache - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap); // nsIDOMHTMLCollection diff --git a/content/base/src/nsDOMFile.cpp b/content/base/src/nsDOMFile.cpp index c80c4c8ea00..1dbc446e7c9 100644 --- a/content/base/src/nsDOMFile.cpp +++ b/content/base/src/nsDOMFile.cpp @@ -630,7 +630,7 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMFileList) NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMFileList) JSObject* -nsDOMFileList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, +nsDOMFileList::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::FileList::create(cx, scope, this, triedToWrap); diff --git a/content/base/src/nsDOMSettableTokenList.cpp b/content/base/src/nsDOMSettableTokenList.cpp index 2bd34a12915..fbb11ce4c2f 100644 --- a/content/base/src/nsDOMSettableTokenList.cpp +++ b/content/base/src/nsDOMSettableTokenList.cpp @@ -80,7 +80,7 @@ nsDOMSettableTokenList::SetValue(const nsAString& aValue) } JSObject* -nsDOMSettableTokenList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, +nsDOMSettableTokenList::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::DOMSettableTokenList::create(cx, scope, this, diff --git a/content/base/src/nsDOMSettableTokenList.h b/content/base/src/nsDOMSettableTokenList.h index 537bbd81a23..9bf0b1ee2f2 100644 --- a/content/base/src/nsDOMSettableTokenList.h +++ b/content/base/src/nsDOMSettableTokenList.h @@ -59,7 +59,7 @@ public: nsDOMSettableTokenList(nsGenericElement* aElement, nsIAtom* aAttrAtom); - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap); protected: diff --git a/content/base/src/nsDOMTokenList.cpp b/content/base/src/nsDOMTokenList.cpp index 0d98f6ac1fb..0b613f8ff04 100644 --- a/content/base/src/nsDOMTokenList.cpp +++ b/content/base/src/nsDOMTokenList.cpp @@ -309,8 +309,7 @@ nsDOMTokenList::ToString(nsAString& aResult) } JSObject* -nsDOMTokenList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, - bool *triedToWrap) +nsDOMTokenList::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::DOMTokenList::create(cx, scope, this, triedToWrap); diff --git a/content/base/src/nsDOMTokenList.h b/content/base/src/nsDOMTokenList.h index df1f41d7d87..624c4c16ec5 100644 --- a/content/base/src/nsDOMTokenList.h +++ b/content/base/src/nsDOMTokenList.h @@ -58,7 +58,7 @@ public: void DropReference(); - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap); nsINode *GetParentObject() diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index 14b359fbc2c..c7dbed660d9 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -1758,7 +1758,7 @@ NS_INTERFACE_TABLE_HEAD(nsChildContentList) NS_INTERFACE_MAP_END JSObject* -nsChildContentList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, +nsChildContentList::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::NodeList::create(cx, scope, this, triedToWrap); diff --git a/content/base/src/nsGenericElement.h b/content/base/src/nsGenericElement.h index 0f6edf69254..55180815f94 100644 --- a/content/base/src/nsGenericElement.h +++ b/content/base/src/nsGenericElement.h @@ -107,7 +107,7 @@ public: NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsChildContentList) // nsWrapperCache - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap); // nsIDOMNodeList interface diff --git a/content/events/src/nsDOMTouchEvent.h b/content/events/src/nsDOMTouchEvent.h index b939565c853..867c22cb997 100644 --- a/content/events/src/nsDOMTouchEvent.h +++ b/content/events/src/nsDOMTouchEvent.h @@ -149,7 +149,7 @@ public: SetIsProxy(); } - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::TouchList::create(cx, scope, this, diff --git a/content/events/src/nsPaintRequest.h b/content/events/src/nsPaintRequest.h index a0428424177..efeb4e538fd 100644 --- a/content/events/src/nsPaintRequest.h +++ b/content/events/src/nsPaintRequest.h @@ -75,7 +75,7 @@ public: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsPaintRequestList) NS_DECL_NSIDOMPAINTREQUESTLIST - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::PaintRequestList::create(cx, scope, this, diff --git a/content/html/content/src/nsClientRect.cpp b/content/html/content/src/nsClientRect.cpp index 5b3a9caa4ff..f1dac63b662 100644 --- a/content/html/content/src/nsClientRect.cpp +++ b/content/html/content/src/nsClientRect.cpp @@ -148,8 +148,7 @@ nsClientRectList::GetItemAt(PRUint32 aIndex) } JSObject* -nsClientRectList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, - bool *triedToWrap) +nsClientRectList::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::ClientRectList::create(cx, scope, this, triedToWrap); diff --git a/content/html/content/src/nsClientRect.h b/content/html/content/src/nsClientRect.h index 001c898f3d0..3d5d30bbfe0 100644 --- a/content/html/content/src/nsClientRect.h +++ b/content/html/content/src/nsClientRect.h @@ -80,7 +80,7 @@ public: NS_DECL_NSIDOMCLIENTRECTLIST - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap); nsISupports* GetParentObject() diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp index 00fc6956607..803d4d5e888 100644 --- a/content/html/content/src/nsHTMLFormElement.cpp +++ b/content/html/content/src/nsHTMLFormElement.cpp @@ -150,7 +150,7 @@ public: nsresult GetSortedControls(nsTArray& aControls) const; // nsWrapperCache - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::HTMLCollection::create(cx, scope, this, diff --git a/content/html/content/src/nsHTMLSelectElement.cpp b/content/html/content/src/nsHTMLSelectElement.cpp index edc2105d981..645bf17e692 100644 --- a/content/html/content/src/nsHTMLSelectElement.cpp +++ b/content/html/content/src/nsHTMLSelectElement.cpp @@ -2061,7 +2061,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsHTMLOptionCollection) JSObject* -nsHTMLOptionCollection::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, +nsHTMLOptionCollection::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::HTMLOptionsCollection::create(cx, scope, this, diff --git a/content/html/content/src/nsHTMLSelectElement.h b/content/html/content/src/nsHTMLSelectElement.h index 48d9778df5a..0a8619082f9 100644 --- a/content/html/content/src/nsHTMLSelectElement.h +++ b/content/html/content/src/nsHTMLSelectElement.h @@ -76,7 +76,7 @@ public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap); // nsIDOMHTMLOptionsCollection interface diff --git a/content/html/content/src/nsHTMLTableElement.cpp b/content/html/content/src/nsHTMLTableElement.cpp index 462233277d5..377c507e249 100644 --- a/content/html/content/src/nsHTMLTableElement.cpp +++ b/content/html/content/src/nsHTMLTableElement.cpp @@ -86,7 +86,7 @@ public: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TableRowsCollection) // nsWrapperCache - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::HTMLCollection::create(cx, scope, this, diff --git a/content/svg/content/src/DOMSVGLengthList.cpp b/content/svg/content/src/DOMSVGLengthList.cpp index f3822a66acf..14af6429842 100644 --- a/content/svg/content/src/DOMSVGLengthList.cpp +++ b/content/svg/content/src/DOMSVGLengthList.cpp @@ -100,8 +100,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGLengthList) NS_INTERFACE_MAP_END JSObject* -DOMSVGLengthList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, - bool *triedToWrap) +DOMSVGLengthList::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::SVGLengthList::create(cx, scope, this, triedToWrap); diff --git a/content/svg/content/src/DOMSVGLengthList.h b/content/svg/content/src/DOMSVGLengthList.h index 51317f9df27..4c6c1a9832d 100644 --- a/content/svg/content/src/DOMSVGLengthList.h +++ b/content/svg/content/src/DOMSVGLengthList.h @@ -102,7 +102,7 @@ public: } }; - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap); nsISupports* GetParentObject() diff --git a/content/svg/content/src/DOMSVGNumberList.cpp b/content/svg/content/src/DOMSVGNumberList.cpp index 2d3d044683d..40d0ce6a63c 100644 --- a/content/svg/content/src/DOMSVGNumberList.cpp +++ b/content/svg/content/src/DOMSVGNumberList.cpp @@ -101,8 +101,7 @@ NS_INTERFACE_MAP_END JSObject* -DOMSVGNumberList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, - bool *triedToWrap) +DOMSVGNumberList::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::SVGNumberList::create(cx, scope, this, triedToWrap); diff --git a/content/svg/content/src/DOMSVGNumberList.h b/content/svg/content/src/DOMSVGNumberList.h index 1b203670d8d..57ff7b2c7d1 100644 --- a/content/svg/content/src/DOMSVGNumberList.h +++ b/content/svg/content/src/DOMSVGNumberList.h @@ -101,7 +101,7 @@ public: } } - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap); nsISupports* GetParentObject() diff --git a/content/svg/content/src/DOMSVGPathSegList.cpp b/content/svg/content/src/DOMSVGPathSegList.cpp index 21f65c7cdf2..d5798adca33 100644 --- a/content/svg/content/src/DOMSVGPathSegList.cpp +++ b/content/svg/content/src/DOMSVGPathSegList.cpp @@ -113,8 +113,7 @@ DOMSVGPathSegList::~DOMSVGPathSegList() } JSObject* -DOMSVGPathSegList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, - bool *triedToWrap) +DOMSVGPathSegList::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::SVGPathSegList::create(cx, scope, this, triedToWrap); diff --git a/content/svg/content/src/DOMSVGPathSegList.h b/content/svg/content/src/DOMSVGPathSegList.h index ae924ed13f0..2d455495259 100644 --- a/content/svg/content/src/DOMSVGPathSegList.h +++ b/content/svg/content/src/DOMSVGPathSegList.h @@ -88,7 +88,7 @@ public: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGPathSegList) NS_DECL_NSIDOMSVGPATHSEGLIST - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap); nsISupports* GetParentObject() diff --git a/content/svg/content/src/DOMSVGPointList.cpp b/content/svg/content/src/DOMSVGPointList.cpp index 347d25dac9c..bd97a804c6b 100644 --- a/content/svg/content/src/DOMSVGPointList.cpp +++ b/content/svg/content/src/DOMSVGPointList.cpp @@ -132,8 +132,7 @@ DOMSVGPointList::~DOMSVGPointList() } JSObject* -DOMSVGPointList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, - bool *triedToWrap) +DOMSVGPointList::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::SVGPointList::create(cx, scope, this, triedToWrap); diff --git a/content/svg/content/src/DOMSVGPointList.h b/content/svg/content/src/DOMSVGPointList.h index 6f34c541f0c..75fb6ea542b 100644 --- a/content/svg/content/src/DOMSVGPointList.h +++ b/content/svg/content/src/DOMSVGPointList.h @@ -88,7 +88,7 @@ public: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGPointList) NS_DECL_NSIDOMSVGPOINTLIST - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap); nsISupports* GetParentObject() diff --git a/content/svg/content/src/DOMSVGTransformList.cpp b/content/svg/content/src/DOMSVGTransformList.cpp index 33cdc79ee39..30d52177663 100644 --- a/content/svg/content/src/DOMSVGTransformList.cpp +++ b/content/svg/content/src/DOMSVGTransformList.cpp @@ -103,7 +103,7 @@ NS_INTERFACE_MAP_END // DOMSVGTransformList methods: JSObject* -DOMSVGTransformList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, +DOMSVGTransformList::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::SVGTransformList::create(cx, scope, this, diff --git a/content/svg/content/src/DOMSVGTransformList.h b/content/svg/content/src/DOMSVGTransformList.h index 5d604f4df7c..5636e995720 100644 --- a/content/svg/content/src/DOMSVGTransformList.h +++ b/content/svg/content/src/DOMSVGTransformList.h @@ -97,7 +97,7 @@ public: } } - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap); nsISupports* GetParentObject() diff --git a/content/xbl/src/nsBindingManager.cpp b/content/xbl/src/nsBindingManager.cpp index 82d9b93467f..03e77653438 100644 --- a/content/xbl/src/nsBindingManager.cpp +++ b/content/xbl/src/nsBindingManager.cpp @@ -113,7 +113,7 @@ public: nsXBLInsertionPoint* GetInsertionPointAt(PRInt32 i) { return static_cast(mElements->ElementAt(i)); } void RemoveInsertionPointAt(PRInt32 i) { mElements->RemoveElementAt(i); } - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { return mozilla::dom::binding::NodeList::create(cx, scope, this, diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index 19ead2fa5bf..6c78ead6c27 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -301,8 +301,7 @@ public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS // nsWrapperCache - JSObject *WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, - bool *triedToWrap) + JSObject *WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { NS_ASSERTION(IsOuterWindow(), "Inner window supports nsWrapperCache, fix WrapObject!"); diff --git a/dom/base/nsWrapperCache.h b/dom/base/nsWrapperCache.h index a8f2f7c57e6..22b8f8680ab 100644 --- a/dom/base/nsWrapperCache.h +++ b/dom/base/nsWrapperCache.h @@ -183,7 +183,7 @@ public: * object doesn't actually support creating a wrapper through its WrapObject * hook. */ - virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope, + virtual JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { *triedToWrap = false; diff --git a/js/xpconnect/src/XPCConvert.cpp b/js/xpconnect/src/XPCConvert.cpp index f3db1b0a236..9250b2cf746 100644 --- a/js/xpconnect/src/XPCConvert.cpp +++ b/js/xpconnect/src/XPCConvert.cpp @@ -919,7 +919,8 @@ XPCConvert::NativeInterface2JSObject(XPCLazyCallContext& lccx, if (!flat) { bool triedToWrap; - flat = cache->WrapObject(lccx.GetJSContext(), xpcscope, + flat = cache->WrapObject(lccx.GetJSContext(), + xpcscope->GetGlobalJSObject(), &triedToWrap); if (!flat && triedToWrap) return false; diff --git a/js/xpconnect/src/dombindings.cpp b/js/xpconnect/src/dombindings.cpp index 3cbb64efca3..154a470d0ca 100644 --- a/js/xpconnect/src/dombindings.cpp +++ b/js/xpconnect/src/dombindings.cpp @@ -534,24 +534,24 @@ ListBase::getPrototype(JSContext *cx, XPCWrappedNativeScope *scope) template JSObject * -ListBase::create(JSContext *cx, XPCWrappedNativeScope *scope, ListType *aList, +ListBase::create(JSContext *cx, JSObject *scope, ListType *aList, nsWrapperCache* aWrapperCache, bool *triedToWrap) { *triedToWrap = true; - JSObject *parent = WrapNativeParent(cx, scope->GetGlobalJSObject(), aList->GetParentObject()); + JSObject *parent = WrapNativeParent(cx, scope, aList->GetParentObject()); if (!parent) return NULL; JSAutoEnterCompartment ac; - if (js::GetGlobalForObjectCrossCompartment(parent) != scope->GetGlobalJSObject()) { + if (js::GetGlobalForObjectCrossCompartment(parent) != scope) { if (!ac.enter(cx, parent)) return NULL; - - scope = XPCWrappedNativeScope::FindInJSObjectScope(cx, parent); } - JSObject *proto = getPrototype(cx, scope, triedToWrap); + XPCWrappedNativeScope *xpcscope = + XPCWrappedNativeScope::FindInJSObjectScope(cx, parent); + JSObject *proto = getPrototype(cx, xpcscope, triedToWrap); if (!proto && !*triedToWrap) aWrapperCache->ClearIsProxy(); if (!proto) diff --git a/js/xpconnect/src/dombindings.h b/js/xpconnect/src/dombindings.h index dbdedbffbc9..5d71edfb783 100644 --- a/js/xpconnect/src/dombindings.h +++ b/js/xpconnect/src/dombindings.h @@ -210,7 +210,7 @@ private: static bool hasPropertyOnPrototype(JSContext *cx, JSObject *proxy, jsid id); public: - static JSObject *create(JSContext *cx, XPCWrappedNativeScope *scope, ListType *list, + static JSObject *create(JSContext *cx, JSObject *scope, ListType *list, nsWrapperCache* cache, bool *triedToWrap); static JSObject *getPrototype(JSContext *cx, XPCWrappedNativeScope *scope, bool *enabled) diff --git a/js/xpconnect/src/dombindingsgen.py b/js/xpconnect/src/dombindingsgen.py index 26543811f72..8904d3026e2 100644 --- a/js/xpconnect/src/dombindingsgen.py +++ b/js/xpconnect/src/dombindingsgen.py @@ -353,7 +353,7 @@ listDefinitionTemplate = ( "class ${name} {\n" "public:\n" " template\n" -" static JSObject *create(JSContext *cx, XPCWrappedNativeScope *scope, I *list, bool *triedToWrap)\n" +" static JSObject *create(JSContext *cx, JSObject *scope, I *list, bool *triedToWrap)\n" " {\n" " return create(cx, scope, list, GetWrapperCache(list), triedToWrap);\n" " }\n" @@ -362,7 +362,7 @@ listDefinitionTemplate = ( " static ${nativeClass} *getNative(JSObject *obj);\n" "\n" "private:\n" -" static JSObject *create(JSContext *cx, XPCWrappedNativeScope *scope, ${nativeClass} *list, nsWrapperCache *cache, bool *triedToWrap);\n" +" static JSObject *create(JSContext *cx, JSObject *scope, ${nativeClass} *list, nsWrapperCache *cache, bool *triedToWrap);\n" "};" "\n" "\n") @@ -573,7 +573,7 @@ listTemplateFooter = ( "template class ListBase<${name}Class>;\n" "\n" "JSObject*\n" -"${name}::create(JSContext *cx, XPCWrappedNativeScope *scope, ${nativeClass} *list, nsWrapperCache *cache, bool *triedToWrap)\n" +"${name}::create(JSContext *cx, JSObject *scope, ${nativeClass} *list, nsWrapperCache *cache, bool *triedToWrap)\n" "{\n" " return ${name}Wrapper::create(cx, scope, list, cache, triedToWrap);\n" "}\n"