mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1016875 - Part10: GetPrincipal for imports. r=mrbkap
This commit is contained in:
parent
523e316e7f
commit
52ba548df3
@ -190,14 +190,23 @@ void ImportLoader::ReleaseResources()
|
||||
mImportParent = nullptr;
|
||||
}
|
||||
|
||||
nsIPrincipal*
|
||||
ImportLoader::Principal()
|
||||
{
|
||||
MOZ_ASSERT(mImportParent);
|
||||
nsCOMPtr<nsIDocument> master = mImportParent->MasterDocument();
|
||||
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(master);
|
||||
MOZ_ASSERT(sop);
|
||||
return sop->GetPrincipal();
|
||||
}
|
||||
|
||||
void
|
||||
ImportLoader::Open()
|
||||
{
|
||||
AutoError ae(this, false);
|
||||
// Imports should obey to the master documents CSP.
|
||||
nsCOMPtr<nsIDocument> master = mImportParent->MasterDocument();
|
||||
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(master);
|
||||
nsCOMPtr<nsIPrincipal> principal = sop->GetPrincipal();
|
||||
nsIPrincipal* principal = Principal();
|
||||
|
||||
int16_t shouldLoad = nsIContentPolicy::ACCEPT;
|
||||
nsresult rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_SCRIPT,
|
||||
@ -324,11 +333,7 @@ NS_IMETHODIMP
|
||||
ImportLoader::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
|
||||
{
|
||||
AutoError ae(this);
|
||||
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(mImportParent);
|
||||
nsCOMPtr<nsIPrincipal> principal = sop->GetPrincipal();
|
||||
if (!sop) {
|
||||
return NS_ERROR_DOM_ABORT_ERR;
|
||||
}
|
||||
nsIPrincipal* principal = Principal();
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
|
||||
if (!channel) {
|
||||
|
@ -49,6 +49,7 @@
|
||||
|
||||
class nsIDocument;
|
||||
class nsIChannel;
|
||||
class nsIPrincipal;
|
||||
class nsINode;
|
||||
class AutoError;
|
||||
|
||||
@ -115,6 +116,8 @@ private:
|
||||
void BlockScripts();
|
||||
void UnblockScripts();
|
||||
|
||||
nsIPrincipal* Principal();
|
||||
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIStreamListener> mParserStreamListener;
|
||||
|
Loading…
Reference in New Issue
Block a user