mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 820170 - merge scope members on nsDocument. r=smaug
This commit is contained in:
parent
f3fbc8f1fa
commit
670b243606
@ -110,8 +110,8 @@ typedef CallbackObjectHolder<NodeFilter, nsIDOMNodeFilter> NodeFilterHolder;
|
||||
} // namespace mozilla
|
||||
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0x699e0649, 0x55f2, 0x47f1, \
|
||||
{ 0x93, 0x38, 0xcd, 0x67, 0xf3, 0x2b, 0x04, 0xe9 } }
|
||||
{ 0x2adedf2, 0x8d85, 0x4a38, \
|
||||
{ 0xb6, 0x38, 0x91, 0xf4, 0xd2, 0xa4, 0x9b, 0x36 } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
@ -2312,6 +2312,8 @@ protected:
|
||||
// document was created entirely in memory
|
||||
bool mHaveInputEncoding;
|
||||
|
||||
bool mHasHadDefaultView;
|
||||
|
||||
// The document's script global object, the object from which the
|
||||
// document can get its script context and scope. This is the
|
||||
// *inner* window object.
|
||||
|
@ -4089,8 +4089,8 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
|
||||
mScriptGlobalObject = aScriptGlobalObject;
|
||||
|
||||
if (aScriptGlobalObject) {
|
||||
mScriptObject = nullptr;
|
||||
mHasHadScriptHandlingObject = true;
|
||||
mHasHadDefaultView = true;
|
||||
// Go back to using the docshell for the layout history state
|
||||
mLayoutHistoryState = nullptr;
|
||||
mScopeObject = do_GetWeakReference(aScriptGlobalObject);
|
||||
@ -4144,9 +4144,12 @@ nsDocument::GetScriptHandlingObjectInternal() const
|
||||
{
|
||||
NS_ASSERTION(!mScriptGlobalObject,
|
||||
"Do not call this when mScriptGlobalObject is set!");
|
||||
if (mHasHadDefaultView) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptHandlingObject =
|
||||
do_QueryReferent(mScriptObject);
|
||||
do_QueryReferent(mScopeObject);
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(scriptHandlingObject);
|
||||
if (win) {
|
||||
NS_ASSERTION(win->IsInnerWindow(), "Should have inner window here!");
|
||||
@ -4166,9 +4169,10 @@ nsDocument::SetScriptHandlingObject(nsIScriptGlobalObject* aScriptObject)
|
||||
"Wrong script object!");
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aScriptObject);
|
||||
NS_ASSERTION(!win || win->IsInnerWindow(), "Should have inner window here!");
|
||||
mScopeObject = mScriptObject = do_GetWeakReference(aScriptObject);
|
||||
mScopeObject = do_GetWeakReference(aScriptObject);
|
||||
if (aScriptObject) {
|
||||
mHasHadScriptHandlingObject = true;
|
||||
mHasHadDefaultView = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1180,11 +1180,6 @@ protected:
|
||||
// Array of observers
|
||||
nsTObserverArray<nsIDocumentObserver*> mObservers;
|
||||
|
||||
// If document is created for example using
|
||||
// document.implementation.createDocument(...), mScriptObject points to
|
||||
// the script global object of the original document.
|
||||
nsWeakPtr mScriptObject;
|
||||
|
||||
// Weak reference to the scope object (aka the script global object)
|
||||
// that, unlike mScriptGlobalObject, is never unset once set. This
|
||||
// is a weak reference to avoid leaks due to circular references.
|
||||
|
Loading…
Reference in New Issue
Block a user