NS_IMETHODIMP nsNoDataProtocolContentPolicy::ShouldProcess(nsIURI* aContentLocation, nsILoadInfo* aLoadInfo, const nsACString& aMimeGuess, int16_t* aDecision) { return ShouldLoad(aContentLocation, aLoadInfo, aMimeGuess, aDecision); }
NS_IMETHODIMP nsContentBlocker::ShouldProcess(uint32_t aContentType, nsIURI *aContentLocation, nsIURI *aRequestingLocation, nsISupports *aRequestingContext, const nsACString &aMimeGuess, nsISupports *aExtra, nsIPrincipal *aRequestPrincipal, int16_t *aDecision) { // For loads where aRequestingContext is chrome, we should just // accept. Those are most likely toplevel loads in windows, and // chrome generally knows what it's doing anyway. nsCOMPtr<nsIDocShellTreeItem> item = do_QueryInterface(NS_CP_GetDocShellFromContext(aRequestingContext)); if (item) { int32_t type; item->GetItemType(&type); if (type == nsIDocShellTreeItem::typeChrome) { *aDecision = nsIContentPolicy::ACCEPT; return NS_OK; } } // For objects, we only check policy in shouldProcess, as the final type isn't // determined until the channel is open -- We don't want to block images in // object tags because plugins are disallowed. // NOTE that this bypasses the aContentLocation checks in ShouldLoad - this is // intentional, as aContentLocation may be null for plugins that load by type // (e.g. java) if (aContentType == nsIContentPolicy::TYPE_OBJECT) { *aDecision = nsIContentPolicy::ACCEPT; bool shouldLoad, fromPrefs; nsresult rv = TestPermission(aContentLocation, aRequestingLocation, aContentType, &shouldLoad, &fromPrefs); NS_ENSURE_SUCCESS(rv, rv); if (!shouldLoad) { if (fromPrefs) { *aDecision = nsIContentPolicy::REJECT_TYPE; } else { *aDecision = nsIContentPolicy::REJECT_SERVER; } } return NS_OK; } // This isn't a load from chrome or an object tag - Just do a ShouldLoad() // check -- we want the same answer here return ShouldLoad(aContentType, aContentLocation, aRequestingLocation, aRequestingContext, aMimeGuess, aExtra, aRequestPrincipal, aDecision); }
NS_IMETHODIMP nsNoDataProtocolContentPolicy::ShouldProcess(PRUint32 aContentType, nsIURI *aContentLocation, nsIURI *aRequestingLocation, nsISupports *aRequestingContext, const nsACString &aMimeGuess, nsISupports *aExtra, PRInt16 *aDecision) { return ShouldLoad(aContentType, aContentLocation, aRequestingLocation, aRequestingContext, aMimeGuess, aExtra, aDecision); }
NS_IMETHODIMP nsDataDocumentContentPolicy::ShouldProcess(uint32_t aContentType, nsIURI *aContentLocation, nsIURI *aRequestingLocation, nsISupports *aRequestingContext, const nsACString &aMimeGuess, nsISupports *aExtra, nsIPrincipal *aRequestPrincipal, int16_t *aDecision) { return ShouldLoad(aContentType, aContentLocation, aRequestingLocation, aRequestingContext, aMimeGuess, aExtra, aRequestPrincipal, aDecision); }