Closed Bug 1119005 Opened 6 years ago Closed 6 years ago

No need to branch on NewChannel callsites anymore


(Core :: DOM: Security, defect)

Not set



Tracking Status
firefox38 --- fixed


(Reporter: ckerschb, Assigned: ckerschb)


(Blocks 1 open bug)



(2 files, 1 obsolete file)

As Jonas pointed out:
we should investigate.
Assignee: nobody → mozilla
Blocks: 1006868
Jonas, I think we should rather use the nullPrincipal instead of just calling NS_NewChannelInternal(loadInfo) in case there is no loadInfo. We might end up creating a channel with no loadInfo within Gecko. I think we should try to avoid that, no?

In comparison to other cases, which I am going to update soon in a different bug:

Basically, wherever we left that comment:
> // Bug 1087720 (and Bug 1099296):
> // Once all callsites have been updated to call NewChannel2()
> // instead of NewChannel() we should have a non-null loadInfo
> // consistently. Until then we have to branch on the loadInfo.
we can then just call NS_NewChannelInternal instead of branching on the loadInfo.
Attachment #8566310 - Flags: review?(jonas)
Comment on attachment 8566310 [details] [diff] [review]

Review of attachment 8566310 [details] [diff] [review]:

If there's no mLoadInfo then the "inner" channel also shouldn't have a loadinfo. So just remove the 'else'.
Attachment #8566310 - Flags: review?(jonas) → review-
If we don't have a loadinfo then it's no more "correct" to just make up information than to clearly indicate that there's no loadinfo.
Summary: Investigate if nsJARChannel passes the right principal when creating a new channel → No need to branch on NewChannel callsites anymore
Since we allow channel creation without a LoadInfo, and now also allow channel redirection without a loadInfo (bug 1134196), we should finally also allow to create a new InputStreamChannel without a loadInfo.
Attachment #8566310 - Attachment is obsolete: true
Attachment #8566685 - Flags: review?(jonas)
Attachment #8566685 - Flags: review?(jduell.mcbugs)
Removing the if condition before calling NewChannelInternal and NewInputStreamChannelInternal since both functions can deal with null loadInfos. Should be a rare case anyway to pass a null loadInfo, since we have update all of the callsites of newChannel within Gecko to provide the necessary arguments.
Attachment #8566688 - Flags: review?(jonas)
Comment on attachment 8566685 [details] [diff] [review]

Review of attachment 8566685 [details] [diff] [review]:

Taking Jason's review and marking r+. Looks sane enough to me.
Attachment #8566685 - Flags: review?(jduell.mcbugs) → review+
You need to log in before you can comment on or make changes to this bug.