Closed Bug 1119005 Opened 9 years ago Closed 9 years ago

No need to branch on NewChannel callsites anymore

Categories

(Core :: DOM: Security, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38
Tracking Status
firefox38 --- fixed

People

(Reporter: ckerschb, Assigned: ckerschb)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

As Jonas pointed out:
https://bugzilla.mozilla.org/show_bug.cgi?id=1110469#c3
we should investigate.
Assignee: nobody → mozilla
Blocks: 1006868
Status: NEW → ASSIGNED
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:
http://mxr.mozilla.org/mozilla-central/source/browser/components/about/AboutRedirector.cpp#166

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]
jarchannel_should_not_pass_system.patch

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]
bug_1119005_netutil_changes.patch

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.

Attachment

General

Created:
Updated:
Size: