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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user