mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1229889 - Convert JS callsites to use asyncOpen2 within image/ (r=sicking)
This commit is contained in:
parent
081cb24a23
commit
972c2231e2
@ -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,
|
||||
|
@ -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 = {};
|
||||
|
Loading…
Reference in New Issue
Block a user