add content-policy hooks to <script> handling (#37983, r/a=brendan)
git-svn-id: svn://10.0.0.236/trunk@70832 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -105,6 +105,7 @@
|
||||
#include "nsITimerCallback.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsIScrollable.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
|
||||
#ifdef ALLOW_ASYNCH_STYLE_SHEETS
|
||||
const PRBool kBlockByDefault=PR_FALSE;
|
||||
@@ -4614,6 +4615,25 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode)
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// After the security manager, the content-policy stuff gets a veto
|
||||
// For pinkerton: a symphony for string conversion, in 3 parts.
|
||||
nsXPIDLCString urlCString;
|
||||
mScriptURI->GetSpec(getter_Copies(urlCString));
|
||||
nsAutoString url;
|
||||
url.AssignWithConversion((const char *)urlCString);
|
||||
nsCOMPtr<nsIDOMElement> DOMElement = do_QueryInterface(element, &rv);
|
||||
|
||||
PRBool shouldLoad = PR_TRUE;
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
(rv = NS_CheckContentLoadPolicy(nsIContentPolicy::CONTENT_SCRIPT,
|
||||
url, DOMElement, &shouldLoad),
|
||||
NS_SUCCEEDED(rv)) &&
|
||||
!shouldLoad) {
|
||||
|
||||
// content-policy veto causes silent failure
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
nsIStreamLoader* loader;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user