Skip to content

Commit

Permalink
Bug 1113323 - Make sure Protocolhandler sets same instance of loadinf…
Browse files Browse the repository at this point in the history
…o on the newly created channel (r=sicking)
  • Loading branch information
Christoph Kerschbaumer committed Jan 12, 2015
1 parent 053a7d3 commit 1969a22
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
6 changes: 5 additions & 1 deletion netwerk/base/src/nsIOService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,11 @@ nsIOService::NewChannelFromURIWithProxyFlagsInternal(nsIURI* aURI,
// loadinfo on the newly created channel.
nsCOMPtr<nsILoadInfo> loadInfo;
(*result)->GetLoadInfo(getter_AddRefs(loadInfo));
MOZ_ASSERT(loadInfo);
// make sure we have the same instance of loadInfo on the newly created channel
if (aLoadInfo != loadInfo) {
MOZ_ASSERT(false, "newly created channel must have a loadinfo attached");
return NS_ERROR_UNEXPECTED;
}

// If we're sandboxed, make sure to clear any owner the channel
// might already have.
Expand Down
12 changes: 3 additions & 9 deletions netwerk/test/unit/test_about_protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,9 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");

let unsafeAboutModule = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
newChannel: function (aURI) {
let chan = Services.io.newChannel2("about:blank",
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
newChannel: function (aURI, aLoadInfo) {
var uri = Services.io.newURI("about:blank", null, null);
let chan = Services.io.newChannelFromURIWithLoadInfo(uri, aLoadInfo);
chan.owner = Services.scriptSecurityManager.getSystemPrincipal();
return chan;
},
Expand Down

0 comments on commit 1969a22

Please sign in to comment.