Closed Bug 1067468 Opened 10 years ago Closed 10 years ago

Add newChannel2 to nsIAboutModule so we can attach a LoadInfo to the created channel

Categories

(Core :: DOM: Security, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla36

People

(Reporter: ckerschb, Assigned: ckerschb)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-needed)

Attachments

(2 files, 2 obsolete files)

We should add newChannel2() with the following interface to nsIAboutModule;

> nsIChannel newChannel2(in nsIURI aURI,
>                         in nsIDOMDocument aRequestingDocument,
>                         in nsIPrincipal aRequestingPrincipal,
>                         in unsigned long aSecurityFlags,
>                         in unsigned long aContentPolicyType);

Once that interface is landed we can start migrating consumers to use newChannel2() rather than newChannel() to create a channel.
Blocks: 1006868
Depends on: 1038756
Assignee: nobody → mozilla
Blocks: 1076896
Attached patch aboutmodule_newChannel2.patch (obsolete) — Splinter Review
Similar to Bug 1067471, this patch just adds NewChannel2 and forwards all calls from newChannel to NewChannel2 using a nullptr-loadinfo.
Attachment #8498893 - Flags: review?(jonas)
Comment on attachment 8498893 [details] [diff] [review]
aboutmodule_newChannel2.patch

Review of attachment 8498893 [details] [diff] [review]:
-----------------------------------------------------------------

Is it really worth messing with nsIAboutModule at this point? We can add the loadinfo in nsAboutProtocolHandler::NewChannel2, and we can do security checks in nsAboutProtocolHandler::AsyncOpen2 without having to touch nsIAboutModule.

The only advantage to adding newChannel2 to nsIAboutModule is that it would allow about modules inspect the loadinfo and change the behavior of newChannel in response to it. But we don't have the need for that yet.

In order for any of this code to be used we'll also have to add code to nsAboutProtocolHandler to attempt to call nsIAboutModule.newChannel2, and then fall back to nsIAboutModule.newChannel as needed. And possibly add wrappers if we actually want the various about modules to take responsibility for doing security checks.

Also, I think we can simply add another argument to nsIAboutModule.newChannel. No need to introduce a separate nsIAboutModule.newChannel2. JS implementations will simply ignore the extra argument. And we're not relying on them to do anything important anyway.

In general, it seems simpler to land this stuff after we have more of the other plumbing in place IMHO. But up to you. But if so, don't add newChannel2.
Attachment #8498893 - Flags: review?(jonas) → review-
Blocks: 1087442
Depends on: 1067471
Attached patch shim_1_aboutmodule.patch (obsolete) — Splinter Review
(In reply to Jonas Sicking (:sicking) from comment #2)
> Comment on attachment 8498893 [details] [diff] [review]
> aboutmodule_newChannel2.patch
> 
> Review of attachment 8498893 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Is it really worth messing with nsIAboutModule at this point? We can add the
> loadinfo in nsAboutProtocolHandler::NewChannel2, and we can do security
> checks in nsAboutProtocolHandler::AsyncOpen2 without having to touch
> nsIAboutModule.

We could add the loadInfo in nsAboutProtocolHandler::NewChannel2, but since we are already having a ::NewChannel2 in nsAboutProtocolhandler, why not pass the loadInfo along to nsIAboutModule? The reason I prefer this design is that we (at some point, see bug 1087442) attach the loadInfo at creation time of a channel and immediately can inspect the loadinfo.

> The only advantage to adding newChannel2 to nsIAboutModule is that it would
> allow about modules inspect the loadinfo and change the behavior of
> newChannel in response to it. But we don't have the need for that yet.

Agreed, not yet, but soon :-)

> Also, I think we can simply add another argument to
> nsIAboutModule.newChannel. No need to introduce a separate
> nsIAboutModule.newChannel2. JS implementations will simply ignore the extra
> argument. And we're not relying on them to do anything important anyway.
> 
> In general, it seems simpler to land this stuff after we have more of the
> other plumbing in place IMHO. But up to you. But if so, don't add
> newChannel2.

Agreed, we can simply extend NewChannel with a loadInfo argument. Once that patch has landed, we can attach the loadInfo to the channel in bug 1087442.
Attachment #8498893 - Attachment is obsolete: true
Attachment #8509693 - Flags: review?(jonas)
Carrying over r+. Just forgot to rev the uuid in the idl.
Attachment #8509693 - Attachment is obsolete: true
Attachment #8509970 - Flags: review+
Status: NEW → ASSIGNED
Keywords: dev-doc-needed
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: