Bug 1087731: Make JS callers of ios.newChannel call ios.newChannel2 in image/ (r=seth)

This commit is contained in:
Christoph Kerschbaumer 2014-10-24 14:54:01 -07:00
parent e868230552
commit 68f34a9814
2 changed files with 19 additions and 3 deletions

View File

@ -12,6 +12,7 @@ const Cu = Components.utils;
const Cr = Components.results;
Cu.import("resource://testing-common/httpd.js");
Cu.import("resource://gre/modules/Services.jsm");
var server = new HttpServer();
server.registerDirectory("/", do_get_file(''));
@ -140,7 +141,12 @@ function checkSecondChannelLoad()
do_test_pending();
var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var channel = ioService.newChannelFromURI(uri);
var channel = ioService.newChannelFromURI2(uri,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
var channellistener = new ChannelListener();
channel.asyncOpen(channellistener, null);
@ -164,7 +170,12 @@ function run_loadImageWithChannel_tests()
do_test_pending();
var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var channel = ioService.newChannelFromURI(uri);
var channel = ioService.newChannelFromURI2(uri,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
var channellistener = new ChannelListener();
channel.asyncOpen(channellistener, null);

View File

@ -53,7 +53,12 @@ var gImgPath = 'http://localhost:' + server.identity.primaryPort + '/image.png';
function setup_chan(path, isPrivate, callback) {
var uri = gIoService.newURI(gImgPath, null, null);
var chan = gIoService.newChannelFromURI(uri);
var chan = gIoService.newChannelFromURI2(uri,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
chan.notificationCallbacks = new NotificationCallbacks(isPrivate);
var channelListener = new ChannelListener();
chan.asyncOpen(channelListener, null);