more work on content-policy, r=brendan

git-svn-id: svn://10.0.0.236/trunk@69884 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
shaver%mozilla.org
2000-05-15 22:05:45 +00:00
parent 3b6e26c2c5
commit 8494d1230c
2 changed files with 34 additions and 0 deletions

View File

@@ -56,6 +56,8 @@
#include "nsIServiceManager.h"
#include "nsBoxLayoutState.h"
#include "nsIBox.h"
#include "nsIDOMElement.h"
#include "nsContentPolicyUtils.h"
#ifdef _WIN32
#include <windows.h>
@@ -906,6 +908,21 @@ nsPresContext::StartLoadImage(const nsString& aURL,
return NS_OK;
}
}
// Check with the content-policy things to make sure this load is permitted.
PRBool shouldLoad = PR_TRUE; // default permit
nsCOMPtr<nsIContent> content;
nsCOMPtr<nsIDOMElement> element;
if (aTargetFrame &&
NS_SUCCEEDED(aTargetFrame->GetContent(getter_AddRefs(content)))) {
element = do_QueryInterface(content);
}
if (NS_SUCCEEDED(NS_CheckContentLoadPolicy(nsIContentPolicy::CONTENT_IMAGE,
aURL, element, &shouldLoad))
&& !shouldLoad) {
return NS_OK;
}
// Create image group if needed
nsresult rv;

View File

@@ -56,6 +56,8 @@
#include "nsIServiceManager.h"
#include "nsBoxLayoutState.h"
#include "nsIBox.h"
#include "nsIDOMElement.h"
#include "nsContentPolicyUtils.h"
#ifdef _WIN32
#include <windows.h>
@@ -906,6 +908,21 @@ nsPresContext::StartLoadImage(const nsString& aURL,
return NS_OK;
}
}
// Check with the content-policy things to make sure this load is permitted.
PRBool shouldLoad = PR_TRUE; // default permit
nsCOMPtr<nsIContent> content;
nsCOMPtr<nsIDOMElement> element;
if (aTargetFrame &&
NS_SUCCEEDED(aTargetFrame->GetContent(getter_AddRefs(content)))) {
element = do_QueryInterface(content);
}
if (NS_SUCCEEDED(NS_CheckContentLoadPolicy(nsIContentPolicy::CONTENT_IMAGE,
aURL, element, &shouldLoad))
&& !shouldLoad) {
return NS_OK;
}
// Create image group if needed
nsresult rv;