mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 418119 - "nsIContentPolicy not called for external DTDs of XML documents" [p=trev.moz@adblockplus.org (Wladimir Palant) r=sicking sr=peterv a1.9=beltzner a=blocking1.9+]
This commit is contained in:
parent
d2d865f581
commit
374700b955
@ -66,6 +66,10 @@ REQUIRES = xpcom \
|
||||
nkcache \
|
||||
intl \
|
||||
xpconnect \
|
||||
layout \
|
||||
widget \
|
||||
caps \
|
||||
js \
|
||||
$(NULL)
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
|
@ -56,6 +56,9 @@
|
||||
#include "nsCRT.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
#include "nsContentErrors.h"
|
||||
#include "nsXPCOMCIDInternal.h"
|
||||
#include "nsUnicharInputStream.h"
|
||||
|
||||
@ -796,6 +799,24 @@ nsExpatDriver::OpenInputStreamFromExternalDTD(const PRUnichar* aFPIStr,
|
||||
localURI.swap(uri);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContentSink> sink = do_QueryInterface(mSink);
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
if (sink)
|
||||
doc = do_QueryInterface(sink->GetTarget());
|
||||
PRInt16 shouldLoad = nsIContentPolicy::ACCEPT;
|
||||
rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_OTHER,
|
||||
uri,
|
||||
(doc ? doc->NodePrincipal() : nsnull),
|
||||
doc,
|
||||
EmptyCString(), //mime guess
|
||||
nsnull, //extra
|
||||
&shouldLoad);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (NS_CP_REJECTED(shouldLoad)) {
|
||||
// Disallowed by content policy
|
||||
return NS_ERROR_CONTENT_BLOCKED;
|
||||
}
|
||||
|
||||
rv = NS_OpenURI(aStream, uri);
|
||||
|
||||
nsCAutoString absURL;
|
||||
|
Loading…
Reference in New Issue
Block a user