зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1336213 - Part 2: Remove DOMParser::mOriginalPrincipal; r=bzbarsky
This commit is contained in:
Родитель
d250dc8172
Коммит
012ba2217d
|
@ -28,6 +28,7 @@ using namespace mozilla::dom;
|
|||
|
||||
DOMParser::DOMParser()
|
||||
: mAttemptedInit(false)
|
||||
, mOriginalPrincipalWasSystem(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -94,7 +95,7 @@ DOMParser::ParseFromString(const nsAString& str,
|
|||
|
||||
// Keep the XULXBL state in sync with the XML case.
|
||||
|
||||
if (nsContentUtils::IsSystemPrincipal(mOriginalPrincipal)) {
|
||||
if (mOriginalPrincipalWasSystem) {
|
||||
document->ForceEnableXULXBL();
|
||||
}
|
||||
|
||||
|
@ -260,7 +261,7 @@ DOMParser::ParseFromStream(nsIInputStream *stream,
|
|||
|
||||
// Keep the XULXBL state in sync with the HTML case
|
||||
|
||||
if (nsContentUtils::IsSystemPrincipal(mOriginalPrincipal)) {
|
||||
if (mOriginalPrincipalWasSystem) {
|
||||
document->ForceEnableXULXBL();
|
||||
}
|
||||
|
||||
|
@ -339,12 +340,11 @@ DOMParser::Init(nsIPrincipal* principal, nsIURI* documentURI,
|
|||
OriginAttributes attrs;
|
||||
mPrincipal = BasePrincipal::CreateCodebasePrincipal(mDocumentURI, attrs);
|
||||
NS_ENSURE_TRUE(mPrincipal, NS_ERROR_FAILURE);
|
||||
mOriginalPrincipal = mPrincipal;
|
||||
} else {
|
||||
mOriginalPrincipal = mPrincipal;
|
||||
if (nsContentUtils::IsSystemPrincipal(mPrincipal)) {
|
||||
// Don't give DOMParsers the system principal. Use a null
|
||||
// principal instead.
|
||||
mOriginalPrincipalWasSystem = true;
|
||||
mPrincipal = nsNullPrincipal::Create();
|
||||
|
||||
if (!mDocumentURI) {
|
||||
|
@ -357,7 +357,6 @@ DOMParser::Init(nsIPrincipal* principal, nsIURI* documentURI,
|
|||
mBaseURI = baseURI;
|
||||
|
||||
NS_POSTCONDITION(mPrincipal, "Must have principal");
|
||||
NS_POSTCONDITION(mOriginalPrincipal, "Must have original principal");
|
||||
NS_POSTCONDITION(mDocumentURI, "Must have document URI");
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -112,12 +112,12 @@ private:
|
|||
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
nsCOMPtr<nsIPrincipal> mOriginalPrincipal;
|
||||
nsCOMPtr<nsIURI> mDocumentURI;
|
||||
nsCOMPtr<nsIURI> mBaseURI;
|
||||
nsWeakPtr mScriptHandlingObject;
|
||||
|
||||
|
||||
bool mAttemptedInit;
|
||||
bool mOriginalPrincipalWasSystem;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
Загрузка…
Ссылка в новой задаче