Bug 1093947: Make JS callers of ios.newChannel call ios.newChannel2 in uriloader/ (r=smaug,bz)

This commit is contained in:
Christoph Kerschbaumer 2015-01-08 19:00:59 -08:00
parent 95d1074c03
commit db68ff0efe
2 changed files with 18 additions and 6 deletions

View File

@ -2,14 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
////////////////////////////////////////////////////////////////////////////////
//// Constants
const Ci = Components.interfaces;
const Cr = Components.results;
const Cc = Components.classes;
const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
////////////////////////////////////////////////////////////////////////////////
//// nsWebHandler class
@ -80,7 +82,12 @@ nsWebHandlerApp.prototype = {
if (aWindowContext) {
// create a channel from this URI
var channel = ioService.newChannelFromURI(uriToSend);
var channel = ioService.newChannelFromURI2(uriToSend,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
channel.loadFlags = Ci.nsIChannel.LOAD_DOCUMENT_URI;
// load the channel

View File

@ -148,9 +148,14 @@ function runChildTestSet(set)
{
DownloadListener.onFinished = testFinisher(set[2]);
sendCommand('\
let uri = ioservice.newURI("http://localhost:4444' + set[0] + '", null, null);\
let channel = ioservice.newChannelFromURI(uri); \
uriloader.openURI(channel, Ci.nsIURILoader.IS_CONTENT_PREFERRED, new WindowContext()); \
let uri = ioservice.newURI("http://localhost:4444' + set[0] + '", null, null); \
let channel = ioservice.newChannelFromURI2(uri, \
null, /* aLoadingNode */ \
Services.scriptSecurityManager.getSystemPrincipal(), \
null, /* aTriggeringPrincipal */ \
Ci.nsILoadInfo.SEC_NORMAL, \
Ci.nsIContentPolicy.TYPE_OTHER); \
uriloader.openURI(channel, Ci.nsIURILoader.IS_CONTENT_PREFERRED, new WindowContext()); \
');
}