Closed Bug 81260 Opened 23 years ago Closed 23 years ago

nsIContentPolicy needs to grow a window context parameter

Categories

(Core :: Layout, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla0.9.1

People

(Reporter: gagan, Assigned: jud)

References

()

Details

Attachments

(3 files)

From bug 69453.
Blocks: 69453
I am so all over this.
Severity: normal → major
Status: NEW → ASSIGNED
Component: Embedding APIs → Layout
OS: Linux → All
Priority: -- → P1
Hardware: PC → All
Summary: need nsIContentPolicy to have an attribute to switch on/off the images → nsIContentPolicy needs to grow a window context parameter
Target Milestone: --- → mozilla0.9.1
That patch is enough to start updating call sites. Jud, can I twist your arm to hack that while I make sure that we don't need to do anything with docshells? Also, is there a bug filed about providing a way to add new content policy objects at runtime (without persisting them in the registry, etc.)? If not, I'll have to file one, because I think Jud needs that as well.
I've attatched... - updated ns[I]ContentPolicy* files (superceed shaver's attatched mods to these files) to use nsIURI instead of nsIURL. - existing callsites of nsIContentPolicy have been updated to reflect the new api. nsIDOMWindows are now passed into the new api.
Required changes: 1) nsScriptLoader::ProcessScriptElement already has a local that holds the global object. Look above the code that you just added. 2) In nsImageFrame::CanLoadImage, do a null check for mContent before starting. 3) Images can be preloaded using the DOM 0 pattern: var i = new Image(); i.src = "myimage.gif"; The load is triggered in nsHTMLImageElement::SetSrcInner. This needs a content policy check as well.
+ nsIURI *contentLocation, nsISupports *context, + nsIDOMWindow *window, PRBool *shouldProceed) etc. Could you do a pass de-tabifying and fixing the indentation, in the areas you've touched? Other than that, it looks good -- and it looks like the use of an nsIURI is going to clean stuff up a little, which always makes me happy. sr=shaver, conditional on the whitespace tidying and adding the check that vidur noted below (thanks for the catch!). (Reassigning to Jud, because it looks like he's going to land this baby.)
Assignee: shaver → valeski
Status: ASSIGNED → NEW
sr=vidur.
checked in.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
* NS_CheckContentLoadPolicy uses nsIURI and nsIDOMWindow in nsContentPolicyUtils.h * nsIContentPolicy.idl calls nsIURI and nsIDOMWindow. They're used in: nsContentPolicy::CheckPolicy() in nsContentPolicy.cpp * In nsImageFrame.cpp, nsImageFrame::CanLoadImage(), checks mContent before calling NS_CheckContentLoadPolicy() * NS_CheckContentLoadPolicy() is called in nsHTMLImageElement.cpp, nsHTMLImageElement::SetSrcInner.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: