Bug 1229889 - Convert JS callsites to use asyncOpen2 within image/ (r=sicking)

This commit is contained in:
Christoph Kerschbaumer 2015-12-06 20:57:08 -08:00
parent 2714a720a2
commit e0194da0a5
2 changed files with 9 additions and 27 deletions

View File

@ -12,7 +12,7 @@ var Cu = Components.utils;
var Cr = Components.results;
Cu.import("resource://testing-common/httpd.js");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
var server = new HttpServer();
server.registerDirectory("/", do_get_file(''));
@ -125,16 +125,9 @@ function getChannelLoadImageStopCallback(streamlistener, next)
function checkSecondChannelLoad()
{
do_test_pending();
var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var channel = ioService.newChannelFromURI2(uri,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
var channel = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
var channellistener = new ChannelListener();
channel.asyncOpen(channellistener, null);
channel.asyncOpen2(channellistener);
var listener = new ImageListener(null,
getChannelLoadImageStopCallback(channellistener,
@ -154,16 +147,9 @@ function run_loadImageWithChannel_tests()
gCurrentLoader = Cc["@mozilla.org/image/loader;1"].createInstance(Ci.imgILoader);
do_test_pending();
var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var channel = ioService.newChannelFromURI2(uri,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
var channel = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
var channellistener = new ChannelListener();
channel.asyncOpen(channellistener, null);
channel.asyncOpen2(channellistener);
var listener = new ImageListener(null,
getChannelLoadImageStopCallback(channellistener,

View File

@ -4,6 +4,7 @@ var Cr = Components.results;
var Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://testing-common/httpd.js");
var server = new HttpServer();
@ -53,16 +54,11 @@ NotificationCallbacks.prototype = {
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.newChannelFromURI2(uri,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
var uri = NetUtil.newURI(gImgPath);
var chan = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
chan.notificationCallbacks = new NotificationCallbacks(isPrivate);
var channelListener = new ChannelListener();
chan.asyncOpen(channelListener, null);
chan.asyncOpen2(channelListener);
var listener = new ImageListener(null, callback);
var outlistener = {};