add content-policy hooks to <embed>/<applet>/<object> handling (#37983, r/a=brendan)

This commit is contained in:
shaver%mozilla.org 2000-05-25 13:32:42 +00:00
Родитель 9bd8f8feb5
Коммит c83c4ef076
2 изменённых файлов: 40 добавлений и 0 удалений

Просмотреть файл

@ -53,6 +53,7 @@
#include "nsIDocShellTreeOwner.h"
#include "nsIWebBrowserChrome.h"
#include "nsIDOMElement.h"
#include "nsContentPolicyUtils.h"
// XXX For temporary paint code
#include "nsIStyleContext.h"
@ -861,6 +862,25 @@ nsObjectFrame::InstantiatePlugin(nsIPresContext* aPresContext,
#ifdef XP_UNIX
window->ws_info = nsnull; //XXX need to figure out what this is. MMP
#endif
// Check to see if content-policy wants to veto this
PRBool shouldLoad = PR_TRUE; // default permit
nsresult rv;
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mContent, &rv);
// For pinkerton: a symphony for string conversion, in 3 parts.
nsXPIDLCString urlCString;
aURL->GetSpec(getter_Copies(urlCString));
nsAutoString url;
url.AssignWithConversion((const char *)urlCString);
if (NS_SUCCEEDED(rv) &&
NS_SUCCEEDED(NS_CheckContentLoadPolicy(nsIContentPolicy::CONTENT_OBJECT,
url, element, &shouldLoad)) &&
!shouldLoad) {
return NS_OK;
}
return aPluginHost->InstantiateEmbededPlugin(aMimetype, aURL, mInstanceOwner);
}

Просмотреть файл

@ -53,6 +53,7 @@
#include "nsIDocShellTreeOwner.h"
#include "nsIWebBrowserChrome.h"
#include "nsIDOMElement.h"
#include "nsContentPolicyUtils.h"
// XXX For temporary paint code
#include "nsIStyleContext.h"
@ -861,6 +862,25 @@ nsObjectFrame::InstantiatePlugin(nsIPresContext* aPresContext,
#ifdef XP_UNIX
window->ws_info = nsnull; //XXX need to figure out what this is. MMP
#endif
// Check to see if content-policy wants to veto this
PRBool shouldLoad = PR_TRUE; // default permit
nsresult rv;
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mContent, &rv);
// For pinkerton: a symphony for string conversion, in 3 parts.
nsXPIDLCString urlCString;
aURL->GetSpec(getter_Copies(urlCString));
nsAutoString url;
url.AssignWithConversion((const char *)urlCString);
if (NS_SUCCEEDED(rv) &&
NS_SUCCEEDED(NS_CheckContentLoadPolicy(nsIContentPolicy::CONTENT_OBJECT,
url, element, &shouldLoad)) &&
!shouldLoad) {
return NS_OK;
}
return aPluginHost->InstantiateEmbededPlugin(aMimetype, aURL, mInstanceOwner);
}