зеркало из https://github.com/mozilla/pjs.git
Fix for bug 480389 (Remove nsIDocument's cached JS object). r/sr=jst.
--HG-- extra : rebase_source : 7e971c32cc922fb866f12f3e037f8c91c09df3bf
This commit is contained in:
Родитель
cd79d0282b
Коммит
67c9b51850
|
@ -101,8 +101,8 @@ class nsFrameLoader;
|
|||
|
||||
// IID for the nsIDocument interface
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0xdd9bd470, 0x6315, 0x4e67, \
|
||||
{ 0xa8, 0x8a, 0x78, 0xbf, 0x92, 0xb4, 0x5a, 0xdf } }
|
||||
{ 0x6e467d95, 0x9934, 0x422a, \
|
||||
{ 0x81, 0x07, 0x3f, 0xff, 0xe1, 0x38, 0xe6, 0x1e } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
|
@ -125,8 +125,7 @@ public:
|
|||
mCompatMode(eCompatibility_FullStandards),
|
||||
mIsInitialDocumentInWindow(PR_FALSE),
|
||||
mMayStartLayout(PR_TRUE),
|
||||
mPartID(0),
|
||||
mJSObject(nsnull)
|
||||
mPartID(0)
|
||||
{
|
||||
mParentPtrBits |= PARENT_BIT_INDOCUMENT;
|
||||
}
|
||||
|
@ -995,16 +994,6 @@ public:
|
|||
mMayStartLayout = aMayStartLayout;
|
||||
}
|
||||
|
||||
JSObject* GetJSObject() const
|
||||
{
|
||||
return mJSObject;
|
||||
}
|
||||
|
||||
void SetJSObject(JSObject *aJSObject)
|
||||
{
|
||||
mJSObject = aJSObject;
|
||||
}
|
||||
|
||||
// This method should return an addrefed nsIParser* or nsnull. Implementations
|
||||
// should transfer ownership of the parser to the caller.
|
||||
virtual already_AddRefed<nsIParser> GetFragmentParser() {
|
||||
|
@ -1247,12 +1236,6 @@ protected:
|
|||
nsCOMPtr<nsIDocument> mDisplayDocument;
|
||||
|
||||
PRUint32 mEventsSuppressed;
|
||||
|
||||
private:
|
||||
// JSObject cache. Only to be used for performance
|
||||
// optimizations. This will be set once this document is touched
|
||||
// from JS, and it will be unset once the JSObject is finalized.
|
||||
JSObject *mJSObject;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocument, NS_IDOCUMENT_IID)
|
||||
|
|
|
@ -6986,9 +6986,14 @@ nsNodeSH::PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *globalObj,
|
|||
// to wrap here? But that's not always reachable, let's use
|
||||
// globalObj for now...
|
||||
|
||||
if (native_parent == doc && (*parentObj = doc->GetJSObject())) {
|
||||
nsIXPConnectJSObjectHolder *wrapper;
|
||||
if (native_parent == doc &&
|
||||
(wrapper = static_cast<nsIXPConnectJSObjectHolder*>(doc->GetWrapper()))) {
|
||||
wrapper->GetJSObject(parentObj);
|
||||
if(*parentObj) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
jsval v;
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||
|
@ -8251,10 +8256,6 @@ nsDocumentSH::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
// Cache the document's JSObject on the document so we can optimize
|
||||
// nsNodeSH::PreCreate() to avoid nested WrapNative() calls.
|
||||
doc->SetJSObject(obj);
|
||||
|
||||
nsresult rv = nsNodeSH::PostCreate(wrapper, cx, obj);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -8288,20 +8289,6 @@ nsDocumentSH::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocumentSH::Finalize(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryWrappedNative(wrapper);
|
||||
if (!doc) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
doc->SetJSObject(nsnull);
|
||||
|
||||
return nsNodeSH::Finalize(wrapper, cx, obj);
|
||||
}
|
||||
|
||||
// HTMLDocument helper
|
||||
|
||||
// static
|
||||
|
|
|
@ -864,8 +864,6 @@ public:
|
|||
NS_IMETHOD GetFlags(PRUint32* aFlags);
|
||||
NS_IMETHOD PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj);
|
||||
NS_IMETHOD Finalize(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj);
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
* including nsIXPConnect, because we don't want to make everyone require
|
||||
* JS and XPConnect.
|
||||
*/
|
||||
nsISupports* GetWrapper()
|
||||
nsISupports* GetWrapper() const
|
||||
{
|
||||
return reinterpret_cast<nsISupports*>(mWrapperPtrBits & ~kWrapperBitMask);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче