sr=vidur/shaver@mozilla.org on the content policy callsite and implementation mods (81260). Update of the nsIContentPolicy interface to provide more generic context, a nsIURI instead of a URI wstring, and a nsIDOMWindow for window level context. Existing Callsites have been updated to reflect the new changes, and nsIDOMWindows are now passed into the new API.
git-svn-id: svn://10.0.0.236/trunk@95620 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIScriptElement.h"
|
||||
#include "nsIDocShell.h"
|
||||
@@ -357,20 +358,15 @@ nsScriptLoader::ProcessScriptElement(nsIDOMHTMLScriptElement *aElement,
|
||||
}
|
||||
|
||||
// After the security manager, the content-policy stuff gets a veto
|
||||
// For pinkerton: a symphony for string conversion, in 3 parts.
|
||||
nsXPIDLCString urlCString;
|
||||
scriptURI->GetSpec(getter_Copies(urlCString));
|
||||
nsAutoString url;
|
||||
url.AssignWithConversion(urlCString.get());
|
||||
|
||||
PRBool shouldLoad = PR_TRUE;
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
(rv = NS_CheckContentLoadPolicy(nsIContentPolicy::CONTENT_SCRIPT,
|
||||
url, aElement, &shouldLoad),
|
||||
NS_SUCCEEDED(rv)) &&
|
||||
!shouldLoad) {
|
||||
|
||||
return FireErrorNotification(NS_ERROR_NOT_AVAILABLE, aElement, aObserver);
|
||||
if (globalObject) {
|
||||
nsCOMPtr<nsIDOMWindow> domWin(do_QueryInterface(globalObject));
|
||||
|
||||
PRBool shouldLoad = PR_TRUE;
|
||||
rv = NS_CheckContentLoadPolicy(nsIContentPolicy::SCRIPT,
|
||||
scriptURI, aElement, domWin, &shouldLoad);
|
||||
if (NS_SUCCEEDED(rv) && !shouldLoad) {
|
||||
return FireErrorNotification(NS_ERROR_NOT_AVAILABLE, aElement, aObserver);
|
||||
}
|
||||
}
|
||||
|
||||
request->mURI = scriptURI;
|
||||
|
||||
Reference in New Issue
Block a user