Backed out 4 changesets (bug 1230221, bug 1230220, bug 1229890) for m-e10s(2) permafails in test_window_open_close.html CLOSED TREE

Backed out changeset a1cd28ddbfa2 (bug 1230221)
Backed out changeset 7e89f5020ac7 (bug 1230220)
Backed out changeset 91f6e72fa9f4 (bug 1229890)
Backed out changeset 7e717a810420 (bug 1229890)

--HG--
extra : commitid : BinvCloSNFx
extra : amend_source : 94dfb9ebf66c6e73b1b407e93d8475724d2ae7a2
This commit is contained in:
Wes Kocher 2015-12-04 15:58:40 -08:00
Родитель 18c24e60a0
Коммит d2615415f5
8 изменённых файлов: 172 добавлений и 58 удалений

Просмотреть файл

@ -28,7 +28,7 @@ const Cu = Components.utils;
SimpleTest.waitForExplicitFinish();
Cu.import("resource://testing-common/httpd.js");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/Services.jsm");
var httpserver = new HttpServer();
var cookieSetPath = "/setcookie";
@ -94,8 +94,15 @@ function cookieCheckHandler(metadata, response) {
}
function setupChannel(path) {
var url = NetUtil.newURI("http://localhost:4444" + path);
var chan = NetUtil.newChannel({uri: url, loadUsingSystemPrincipal: true});
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var chan = ios.newChannel2("http://localhost:4444" + path,
"",
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
chan.notificationCallbacks = cookies[counter].loadContext;
chan.QueryInterface(Ci.nsIHttpChannel);
return chan;
@ -104,7 +111,7 @@ function setupChannel(path) {
function setCookie() {
var channel = setupChannel(cookieSetPath);
channel.setRequestHeader("foo-set-cookie", cookies[counter].cookieName, false);
channel.asyncOpen2(new ChannelListener(setNextCookie, null));
channel.asyncOpen(new ChannelListener(setNextCookie, null), null);
}
function setNextCookie(request, data, context) {

Просмотреть файл

@ -12,7 +12,7 @@ var Cu = Components.utils;
var Cr = Components.results;
Cu.import("resource://testing-common/httpd.js");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/Services.jsm");
var server = new HttpServer();
server.registerDirectory("/", do_get_file(''));
@ -125,9 +125,16 @@ function getChannelLoadImageStopCallback(streamlistener, next)
function checkSecondChannelLoad()
{
do_test_pending();
var channel = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
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 channellistener = new ChannelListener();
channel.asyncOpen2(channellistener);
channel.asyncOpen(channellistener, null);
var listener = new ImageListener(null,
getChannelLoadImageStopCallback(channellistener,
@ -147,9 +154,16 @@ function run_loadImageWithChannel_tests()
gCurrentLoader = Cc["@mozilla.org/image/loader;1"].createInstance(Ci.imgILoader);
do_test_pending();
var channel = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
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 channellistener = new ChannelListener();
channel.asyncOpen2(channellistener);
channel.asyncOpen(channellistener, null);
var listener = new ImageListener(null,
getChannelLoadImageStopCallback(channellistener,

Просмотреть файл

@ -4,7 +4,6 @@ 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();
@ -54,11 +53,16 @@ NotificationCallbacks.prototype = {
var gImgPath = 'http://localhost:' + server.identity.primaryPort + '/image.png';
function setup_chan(path, isPrivate, callback) {
var uri = NetUtil.newURI(gImgPath);
var chan = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
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);
chan.notificationCallbacks = new NotificationCallbacks(isPrivate);
var channelListener = new ChannelListener();
chan.asyncOpen2(channelListener);
chan.asyncOpen(channelListener, null);
var listener = new ImageListener(null, callback);
var outlistener = {};

Просмотреть файл

@ -1,7 +1,7 @@
var Cc = Components.classes;
var Ci = Components.interfaces;
var Cu = Components.utils;
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/Services.jsm");
// Regression test for bug 370103 - crash when passing a null listener to
// nsIChannel.asyncOpen
@ -14,11 +14,18 @@ function run_test() {
url = "jar:" + url + "!/test_bug370103";
// Try opening channel with null listener
var channel = NetUtil.newChannel({uri: url, loadUsingSystemPrincipal: true});
var channel = ioService.newChannel2(url,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
var exception = false;
try {
channel.asyncOpen2(null);
channel.asyncOpen(null, null);
}
catch(e) {
exception = true;

Просмотреть файл

@ -5,7 +5,6 @@ var Cc = Components.classes;
var Ci = Components.interfaces;
var Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
// XXX: NS_ERROR_UNKNOWN_HOST is not in Components.results
const NS_ERROR_UNKNOWN_HOST = 0x804B001E;
@ -33,10 +32,18 @@ var listener = {
function run_test() {
Services.prefs.setBoolPref("network.jar.block-remote-files", false);
var channel = NetUtil.newChannel({
uri: "jar:http://test.invalid/test.jar!/index.html",
loadUsingSystemPrincipal: true}
);
channel.asyncOpen2(listener);
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var channel = ios.newChannel2("jar:http://test.invalid/test.jar!/index.html",
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
channel.asyncOpen(listener, null);
do_test_pending();
}

Просмотреть файл

@ -15,7 +15,6 @@ const {classes: Cc,
} = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
const ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
@ -76,16 +75,23 @@ Listener.prototype = {
*/
function testAsync() {
var uri = jarBase + "/inner40.zip";
var chan = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
var chan = ios.newChannel2(uri,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
do_check_true(chan.contentLength < 0);
chan.asyncOpen2(new Listener(function(l) {
chan.asyncOpen(new Listener(function(l) {
do_check_true(chan.contentLength > 0);
do_check_true(l.gotStartRequest);
do_check_true(l.gotStopRequest);
do_check_eq(l.available, chan.contentLength);
run_next_test();
}));
}), null);
}
add_test(testAsync);
@ -98,8 +104,15 @@ add_test(testAsync);
*/
function testZipEntry() {
var uri = jarBase + "/inner40.zip";
var chan = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true})
.QueryInterface(Ci.nsIJARChannel);
var chan = ios.newChannel2(uri,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER)
.QueryInterface(Ci.nsIJARChannel);
var entry = chan.zipEntry;
do_check_true(entry.CRC32 == 0x8b635486);
do_check_true(entry.realSize == 184);
@ -119,8 +132,15 @@ if (!inChild) {
*/
add_test(function testSync() {
var uri = jarBase + "/inner40.zip";
var chan = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
var stream = chan.open2();
var chan = ios.newChannel2(uri,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
var stream = chan.open();
do_check_true(chan.contentLength > 0);
do_check_eq(stream.available(), chan.contentLength);
stream.close();
@ -135,8 +155,15 @@ if (!inChild) {
*/
add_test(function testSyncNested() {
var uri = "jar:" + jarBase + "/inner40.zip!/foo";
var chan = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
var stream = chan.open2();
var chan = ios.newChannel2(uri,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
var stream = chan.open();
do_check_true(chan.contentLength > 0);
do_check_eq(stream.available(), chan.contentLength);
stream.close();
@ -150,15 +177,22 @@ if (!inChild) {
*/
add_test(function testAsyncNested(next) {
var uri = "jar:" + jarBase + "/inner40.zip!/foo";
var chan = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
chan.asyncOpen2(new Listener(function(l) {
var chan = ios.newChannel2(uri,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
chan.asyncOpen(new Listener(function(l) {
do_check_true(chan.contentLength > 0);
do_check_true(l.gotStartRequest);
do_check_true(l.gotStopRequest);
do_check_eq(l.available, chan.contentLength);
run_next_test();
}));
}), null);
});
/**
@ -169,9 +203,17 @@ if (!inChild) {
var copy = tmpDir.clone();
copy.append(fileBase);
file.copyTo(copy.parent, copy.leafName);
var uri = "jar:" + ios.newFileURI(copy).spec + "!/inner40.zip";
var chan = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
var stream = chan.open2();
var chan = ios.newChannel2(uri,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
var stream = chan.open();
do_check_true(chan.contentLength > 0);
stream.close();
@ -198,9 +240,15 @@ if (!inChild) {
file.copyTo(copy.parent, copy.leafName);
var uri = "jar:" + ios.newFileURI(copy).spec + "!/inner40.zip";
var chan = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
chan.asyncOpen2(new Listener(function (l) {
var chan = ios.newChannel2(uri,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
chan.asyncOpen(new Listener(function (l) {
do_check_true(chan.contentLength > 0);
// Drop any jar caches
@ -214,7 +262,7 @@ if (!inChild) {
}
run_next_test();
}));
}), null);
});
} // if !inChild
@ -233,15 +281,32 @@ if (inChild) {
var num = 10;
var chan = [];
for (var i = 0; i < num; i++) {
chan[i] = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true})
.QueryInterface(Ci.nsIJARChannel);
chan[i].asyncOpen2(new Listener(function(l) {}));
chan[i] = ios.newChannel2(uri,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER)
.QueryInterface(Ci.nsIJARChannel);
chan[i].asyncOpen(new Listener(function(l) {
}), null);
}
// Open the last channel
var chan_last = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true})
.QueryInterface(Ci.nsIJARChannel);
chan_last.asyncOpen2(new Listener(function(l) { run_next_test(); }));
var chan_last = ios.newChannel2(uri,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER)
.QueryInterface(Ci.nsIJARChannel);
chan_last.asyncOpen(new Listener(function(l) {
run_next_test();
}), null);
});
} // if inChild

Просмотреть файл

@ -16,7 +16,6 @@ this.EXPORTED_SYMBOLS = [
Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://services-common/utils.js");
@ -306,9 +305,14 @@ RESTRequest.prototype = {
}
// Create and initialize HTTP channel.
let channel = NetUtil.newChannel({uri: this.uri, loadUsingSystemPrincipal: true})
.QueryInterface(Ci.nsIRequest)
.QueryInterface(Ci.nsIHttpChannel);
let channel = Services.io.newChannelFromURI2(this.uri,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER)
.QueryInterface(Ci.nsIRequest)
.QueryInterface(Ci.nsIHttpChannel);
this.channel = channel;
channel.loadFlags |= this.loadFlags;
channel.notificationCallbacks = this;
@ -354,7 +358,7 @@ RESTRequest.prototype = {
// Blast off!
try {
channel.asyncOpen2(this);
channel.asyncOpen(this, null);
} catch (ex) {
// asyncOpen can throw in a bunch of cases -- e.g., a forbidden port.
this._log.warn("Caught an error in asyncOpen: " + CommonUtils.exceptionStr(ex));

Просмотреть файл

@ -13,7 +13,6 @@ var Cr = Components.results;
var Cu = Components.utils;
Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://services-common/async.js");
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://services-common/observers.js");
@ -149,9 +148,16 @@ AsyncResource.prototype = {
// to obtain a request channel.
//
_createRequest: function Res__createRequest(method) {
let channel = NetUtil.newChannel({uri: this.spec, loadUsingSystemPrincipal: true})
.QueryInterface(Ci.nsIRequest)
.QueryInterface(Ci.nsIHttpChannel);
let channel = Services.io.newChannel2(this.spec,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER)
.QueryInterface(Ci.nsIRequest)
.QueryInterface(Ci.nsIHttpChannel);
channel.loadFlags |= DEFAULT_LOAD_FLAGS;
@ -224,9 +230,9 @@ AsyncResource.prototype = {
this._log, this.ABORT_TIMEOUT);
channel.requestMethod = action;
try {
channel.asyncOpen2(listener);
channel.asyncOpen(listener, null);
} catch (ex) {
// asyncOpen2 can throw in a bunch of cases -- e.g., a forbidden port.
// asyncOpen can throw in a bunch of cases -- e.g., a forbidden port.
this._log.warn("Caught an error in asyncOpen: " + CommonUtils.exceptionStr(ex));
CommonUtils.nextTick(callback.bind(this, ex));
}