bug #147741 (r=jst, sr=darin) Call nsIContentPolicy for toplevel and subdocuments.

git-svn-id: svn://10.0.0.236/trunk@123825 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rpotts%netscape.com
2002-06-21 22:47:42 +00:00
parent bcded6ff42
commit 3b84d785bc
2 changed files with 20 additions and 0 deletions

View File

@@ -55,6 +55,7 @@
#include "nsDocumentCharsetInfoCID.h"
#include "nsICanvasFrame.h"
#include "nsIPluginViewer.h"
#include "nsContentPolicyUtils.h" // NS_CheckContentLoadPolicy(...)
// Local Includes
#include "nsDocShell.h"
@@ -4484,6 +4485,24 @@ nsDocShell::InternalLoad(nsIURI * aURI,
*aRequest = nsnull;
}
//
// First, notify any nsIContentPolicy listeners about the document load.
// Only abort the load if a content policy listener explicitly vetos it!
//
PRBool bShouldLoad = PR_TRUE;
nsCOMPtr<nsIDOMWindow> domWindow = do_GetInterface((nsIDocShell*)this);
(void) NS_CheckContentLoadPolicy((IsFrame() ? nsIContentPolicy::SUBDOCUMENT
: nsIContentPolicy::DOCUMENT),
aURI,
nsnull,
domWindow,
&bShouldLoad);
if (!bShouldLoad) {
// XXX: There must be a better return code...
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsISupports> owner(aOwner);
//
// Get an owner from the current document if necessary