зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1453869 part 13. Make DOMParser store an nsIGlobalObject* as mOwner. r=mrbkap
Incidentally, we can remove mScriptHandlingObject, because mOwner is always the same object anyway. MozReview-Commit-ID: 1txkjkKvBsi
This commit is contained in:
Родитель
32b5faa035
Коммит
9c8b0407da
|
@ -28,7 +28,7 @@
|
|||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
DOMParser::DOMParser(nsISupports* aOwner, nsIPrincipal* aDocPrincipal)
|
||||
DOMParser::DOMParser(nsIGlobalObject* aOwner, nsIPrincipal* aDocPrincipal)
|
||||
: mOwner(aOwner)
|
||||
, mPrincipal(aDocPrincipal)
|
||||
, mAttemptedInit(false)
|
||||
|
@ -254,7 +254,6 @@ DOMParser::Init(nsIURI* documentURI, nsIURI* baseURI,
|
|||
}
|
||||
}
|
||||
|
||||
mScriptHandlingObject = do_GetWeakReference(aScriptObject);
|
||||
mBaseURI = baseURI;
|
||||
|
||||
MOZ_ASSERT(mPrincipal, "Must have principal");
|
||||
|
@ -289,10 +288,9 @@ DOMParser::Constructor(const GlobalObject& aOwner,
|
|||
}
|
||||
}
|
||||
|
||||
RefPtr<DOMParser> domParser = new DOMParser(aOwner.GetAsSupports(),
|
||||
docPrincipal);
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aOwner.GetAsSupports());
|
||||
RefPtr<DOMParser> domParser = new DOMParser(global, docPrincipal);
|
||||
|
||||
rv = domParser->Init(documentURI, baseURI, global);
|
||||
if (rv.Failed()) {
|
||||
return nullptr;
|
||||
|
@ -303,13 +301,13 @@ DOMParser::Constructor(const GlobalObject& aOwner,
|
|||
already_AddRefed<nsIDocument>
|
||||
DOMParser::SetUpDocument(DocumentFlavor aFlavor, ErrorResult& aRv)
|
||||
{
|
||||
// We should really QI to nsIGlobalObject here, but nsDocument gets confused
|
||||
// We should really just use mOwner here, but nsDocument gets confused
|
||||
// if we pass it a scriptHandlingObject that doesn't QI to
|
||||
// nsIScriptGlobalObject, and test_isequalnode.js (an xpcshell test without
|
||||
// a window global) breaks. The correct solution is just to wean nsDocument
|
||||
// off of nsIScriptGlobalObject, but that's a yak to shave another day.
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptHandlingObject =
|
||||
do_QueryReferent(mScriptHandlingObject);
|
||||
do_QueryInterface(mOwner);
|
||||
|
||||
// Try to inherit a style backend.
|
||||
NS_ASSERTION(mPrincipal, "Must have principal by now");
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "mozilla/dom/TypedArray.h"
|
||||
|
||||
class nsIDocument;
|
||||
class nsIGlobalObject;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -67,7 +68,7 @@ public:
|
|||
mForceEnableXULXBL = true;
|
||||
}
|
||||
|
||||
nsISupports* GetParentObject() const
|
||||
nsIGlobalObject* GetParentObject() const
|
||||
{
|
||||
return mOwner;
|
||||
}
|
||||
|
@ -78,7 +79,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
DOMParser(nsISupports* aOwner, nsIPrincipal* aDocPrincipal);
|
||||
DOMParser(nsIGlobalObject* aOwner, nsIPrincipal* aDocPrincipal);
|
||||
|
||||
/**
|
||||
* Initialize the principal and document and base URIs that the parser should
|
||||
|
@ -118,11 +119,10 @@ private:
|
|||
bool* mAttemptedInit;
|
||||
};
|
||||
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
nsCOMPtr<nsIGlobalObject> mOwner;
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
nsCOMPtr<nsIURI> mDocumentURI;
|
||||
nsCOMPtr<nsIURI> mBaseURI;
|
||||
nsWeakPtr mScriptHandlingObject;
|
||||
|
||||
bool mAttemptedInit;
|
||||
bool mForceEnableXULXBL;
|
||||
|
|
Загрузка…
Ссылка в новой задаче