mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-05-13 08:57:27 +00:00
Bug 1087739: Make JS callers of ios.newChannel call ios.newChannel2 in netwerk/ (r=sworkman,tanvi)
This commit is contained in:
parent
cc96f3ae3c
commit
d65c89962c
@ -244,6 +244,8 @@ this.NetUtil = {
|
||||
let channel = aSource;
|
||||
if (!(channel instanceof Ci.nsIChannel)) {
|
||||
channel = this.newChannel2(aSource,
|
||||
"", // aOriginCharset
|
||||
null, // aBaseURI
|
||||
aLoadingNode,
|
||||
aLoadingPrincipal,
|
||||
aTriggeringPrincipal,
|
||||
|
@ -28,12 +28,19 @@ var tests = [
|
||||
|
||||
function test_asyncFetchBadCert() {
|
||||
// Try a load from an untrusted cert, with errors supressed
|
||||
NetUtil.asyncFetch("https://untrusted.example.com", function (aInputStream, aStatusCode, aRequest) {
|
||||
NetUtil.asyncFetch2("https://untrusted.example.com", function (aInputStream, aStatusCode, aRequest) {
|
||||
ok(!Components.isSuccessCode(aStatusCode), "request failed");
|
||||
ok(aRequest instanceof Ci.nsIHttpChannel, "request is an nsIHttpChannel");
|
||||
|
||||
// Now try again with a channel whose notificationCallbacks doesn't suprress errors
|
||||
let channel = NetUtil.newChannel("https://untrusted.example.com");
|
||||
let channel = NetUtil.newChannel2("https://untrusted.example.com",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
channel.notificationCallbacks = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIProgressEventSink,
|
||||
Ci.nsIInterfaceRequestor]),
|
||||
@ -41,22 +48,31 @@ function test_asyncFetchBadCert() {
|
||||
onProgress: function () {},
|
||||
onStatus: function () {}
|
||||
};
|
||||
NetUtil.asyncFetch(channel, function (aInputStream, aStatusCode, aRequest) {
|
||||
NetUtil.asyncFetch2(channel, function (aInputStream, aStatusCode, aRequest) {
|
||||
ok(!Components.isSuccessCode(aStatusCode), "request failed");
|
||||
ok(aRequest instanceof Ci.nsIHttpChannel, "request is an nsIHttpChannel");
|
||||
|
||||
// Now try a valid request
|
||||
NetUtil.asyncFetch("https://example.com", function (aInputStream, aStatusCode, aRequest) {
|
||||
NetUtil.asyncFetch2("https://example.com", function (aInputStream, aStatusCode, aRequest) {
|
||||
info("aStatusCode for valid request: " + aStatusCode);
|
||||
ok(Components.isSuccessCode(aStatusCode), "request succeeded");
|
||||
ok(aRequest instanceof Ci.nsIHttpChannel, "request is an nsIHttpChannel");
|
||||
ok(aRequest.requestSucceeded, "HTTP request succeeded");
|
||||
|
||||
nextTest();
|
||||
});
|
||||
},
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function WindowListener(aURL, aCallback) {
|
||||
|
@ -13,6 +13,7 @@ load(_HTTPD_JS_PATH);
|
||||
// if these tests fail, we'll want the debug output
|
||||
DEBUG = true;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
/**
|
||||
* Constructs a new nsHttpServer instance. This function is intended to
|
||||
@ -35,7 +36,14 @@ function makeChannel(url)
|
||||
{
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(url, null, null)
|
||||
var chan = ios.newChannel2(url,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Ci.nsIHttpChannel);
|
||||
|
||||
return chan;
|
||||
|
@ -2,6 +2,7 @@
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=761228
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
return "http://localhost:" + httpServer.identity.primaryPort;
|
||||
@ -26,7 +27,14 @@ function make_uri(url) {
|
||||
|
||||
function make_channel(url) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(url, null, null).QueryInterface(Ci.nsIHttpChannel);
|
||||
var chan = ios.newChannel2(url,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER).QueryInterface(Ci.nsIHttpChannel);
|
||||
return chan;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
return "http://localhost:" + httpserver.identity.primaryPort;
|
||||
@ -17,7 +18,14 @@ var httpserver = null;
|
||||
function make_channel(url) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
const requestBody = "request body";
|
||||
|
@ -13,6 +13,7 @@ Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
// We need the profile directory so the test harness will clean up our test
|
||||
// files.
|
||||
@ -260,7 +261,7 @@ function test_ioService()
|
||||
function test_asyncFetch_no_channel()
|
||||
{
|
||||
try {
|
||||
NetUtil.asyncFetch(null, function() { });
|
||||
NetUtil.asyncFetch2(null, function() { });
|
||||
do_throw("should throw!");
|
||||
}
|
||||
catch (e) {
|
||||
@ -273,7 +274,7 @@ function test_asyncFetch_no_channel()
|
||||
function test_asyncFetch_no_callback()
|
||||
{
|
||||
try {
|
||||
NetUtil.asyncFetch({ });
|
||||
NetUtil.asyncFetch2({ });
|
||||
do_throw("should throw!");
|
||||
}
|
||||
catch (e) {
|
||||
@ -298,11 +299,18 @@ function test_asyncFetch_with_nsIChannel()
|
||||
|
||||
// Create our channel.
|
||||
let channel = NetUtil.ioService.
|
||||
newChannel("http://localhost:" +
|
||||
server.identity.primaryPort + "/test", null, null);
|
||||
newChannel2("http://localhost:" +
|
||||
server.identity.primaryPort + "/test",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
// Open our channel asynchronously.
|
||||
NetUtil.asyncFetch(channel, function(aInputStream, aResult) {
|
||||
NetUtil.asyncFetch2(channel, function(aInputStream, aResult) {
|
||||
// Check that we had success.
|
||||
do_check_true(Components.isSuccessCode(aResult));
|
||||
|
||||
@ -336,7 +344,7 @@ function test_asyncFetch_with_nsIURI()
|
||||
server.identity.primaryPort + "/test");
|
||||
|
||||
// Open our URI asynchronously.
|
||||
NetUtil.asyncFetch(uri, function(aInputStream, aResult) {
|
||||
NetUtil.asyncFetch2(uri, function(aInputStream, aResult) {
|
||||
// Check that we had success.
|
||||
do_check_true(Components.isSuccessCode(aResult));
|
||||
|
||||
@ -349,7 +357,12 @@ function test_asyncFetch_with_nsIURI()
|
||||
do_check_eq(TEST_DATA, result);
|
||||
|
||||
server.stop(run_next_test);
|
||||
});
|
||||
},
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function test_asyncFetch_with_string()
|
||||
@ -366,7 +379,7 @@ function test_asyncFetch_with_string()
|
||||
server.start(-1);
|
||||
|
||||
// Open our location asynchronously.
|
||||
NetUtil.asyncFetch("http://localhost:" +
|
||||
NetUtil.asyncFetch2("http://localhost:" +
|
||||
server.identity.primaryPort + "/test",
|
||||
function(aInputStream, aResult) {
|
||||
// Check that we had success.
|
||||
@ -381,7 +394,12 @@ function test_asyncFetch_with_string()
|
||||
do_check_eq(TEST_DATA, result);
|
||||
|
||||
server.stop(run_next_test);
|
||||
});
|
||||
},
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function test_asyncFetch_with_nsIFile()
|
||||
@ -405,7 +423,7 @@ function test_asyncFetch_with_nsIFile()
|
||||
do_check_eq(TEST_DATA, getFileContents(file));
|
||||
|
||||
// Open our file asynchronously.
|
||||
NetUtil.asyncFetch(file, function(aInputStream, aResult) {
|
||||
NetUtil.asyncFetch2(file, function(aInputStream, aResult) {
|
||||
// Check that we had success.
|
||||
do_check_true(Components.isSuccessCode(aResult));
|
||||
|
||||
@ -418,7 +436,12 @@ function test_asyncFetch_with_nsIFile()
|
||||
do_check_eq(TEST_DATA, result);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
},
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function test_asyncFetch_with_nsIInputString()
|
||||
@ -429,7 +452,7 @@ function test_asyncFetch_with_nsIInputString()
|
||||
istream.setData(TEST_DATA, TEST_DATA.length);
|
||||
|
||||
// Read the input stream asynchronously.
|
||||
NetUtil.asyncFetch(istream, function(aInputStream, aResult) {
|
||||
NetUtil.asyncFetch2(istream, function(aInputStream, aResult) {
|
||||
// Check that we had success.
|
||||
do_check_true(Components.isSuccessCode(aResult));
|
||||
|
||||
@ -439,17 +462,29 @@ function test_asyncFetch_with_nsIInputString()
|
||||
TEST_DATA);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
},
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function test_asyncFetch_does_not_block()
|
||||
{
|
||||
// Create our channel that has no data.
|
||||
let channel = NetUtil.ioService.
|
||||
newChannel("data:text/plain,", null, null);
|
||||
newChannel2("data:text/plain,",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
// Open our channel asynchronously.
|
||||
NetUtil.asyncFetch(channel, function(aInputStream, aResult) {
|
||||
NetUtil.asyncFetch2(channel, function(aInputStream, aResult) {
|
||||
// Check that we had success.
|
||||
do_check_true(Components.isSuccessCode(aResult));
|
||||
|
||||
@ -473,7 +508,7 @@ function test_asyncFetch_does_not_block()
|
||||
function test_newChannel_no_specifier()
|
||||
{
|
||||
try {
|
||||
NetUtil.newChannel();
|
||||
NetUtil.newChannel2();
|
||||
do_throw("should throw!");
|
||||
}
|
||||
catch (e) {
|
||||
@ -490,8 +525,22 @@ function test_newChannel_with_string()
|
||||
// Check that we get the same URI back from channel the IO service creates and
|
||||
// the channel the utility method creates.
|
||||
let ios = NetUtil.ioService;
|
||||
let iosChannel = ios.newChannel(TEST_SPEC, null, null);
|
||||
let NetUtilChannel = NetUtil.newChannel(TEST_SPEC);
|
||||
let iosChannel = ios.newChannel2(TEST_SPEC,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
let NetUtilChannel = NetUtil.newChannel2(TEST_SPEC,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
do_check_true(iosChannel.URI.equals(NetUtilChannel.URI));
|
||||
|
||||
run_next_test();
|
||||
@ -504,8 +553,20 @@ function test_newChannel_with_nsIURI()
|
||||
// Check that we get the same URI back from channel the IO service creates and
|
||||
// the channel the utility method creates.
|
||||
let uri = NetUtil.newURI(TEST_SPEC);
|
||||
let iosChannel = NetUtil.ioService.newChannelFromURI(uri);
|
||||
let NetUtilChannel = NetUtil.newChannel(uri);
|
||||
let iosChannel = NetUtil.ioService.newChannelFromURI2(uri,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
let NetUtilChannel = NetUtil.newChannel2(uri,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
do_check_true(iosChannel.URI.equals(NetUtilChannel.URI));
|
||||
|
||||
run_next_test();
|
||||
@ -521,8 +582,20 @@ function test_newChannel_with_nsIFile()
|
||||
// Check that we get the same URI back from channel the IO service creates and
|
||||
// the channel the utility method creates.
|
||||
let uri = NetUtil.newURI(file);
|
||||
let iosChannel = NetUtil.ioService.newChannelFromURI(uri);
|
||||
let NetUtilChannel = NetUtil.newChannel(uri);
|
||||
let iosChannel = NetUtil.ioService.newChannelFromURI2(uri,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
let NetUtilChannel = NetUtil.newChannel2(uri,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
do_check_true(iosChannel.URI.equals(NetUtilChannel.URI));
|
||||
|
||||
run_next_test();
|
||||
|
@ -4,6 +4,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const gDashboard = Cc['@mozilla.org/network/dashboard;1']
|
||||
.getService(Ci.nsIDashboard);
|
||||
@ -84,7 +85,12 @@ function run_test() {
|
||||
|
||||
let uri = ioService.newURI("http://localhost:" + gHttpServer.identity.primaryPort,
|
||||
null, null);
|
||||
let channel = ioService.newChannelFromURI(uri);
|
||||
let channel = ioService.newChannelFromURI2(uri,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
channel.open();
|
||||
|
||||
|
@ -11,7 +11,14 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
let unsafeAboutModule = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
|
||||
newChannel: function (aURI) {
|
||||
let chan = Services.io.newChannel("about:blank", null, null);
|
||||
let chan = Services.io.newChannel2("about:blank",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
chan.owner = Services.scriptSecurityManager.getSystemPrincipal();
|
||||
return chan;
|
||||
},
|
||||
@ -38,7 +45,12 @@ function run_test() {
|
||||
registrar.registerFactory(classID, "", "@mozilla.org/network/protocol/about;1?what=unsafe", factory);
|
||||
|
||||
let aboutUnsafeURI = Services.io.newURI("about:unsafe", null, null);
|
||||
let aboutUnsafeChan = Services.io.newChannelFromURI(aboutUnsafeURI);
|
||||
let aboutUnsafeChan = Services.io.newChannelFromURI2(aboutUnsafeURI,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
do_check_null(aboutUnsafeChan.owner, "URI_SAFE_FOR_UNTRUSTED_CONTENT channel has no owner");
|
||||
|
||||
registrar.unregisterFactory(classID, factory);
|
||||
|
@ -1,3 +1,5 @@
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function run_test() {
|
||||
var ioServ = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
@ -7,9 +9,19 @@ function run_test() {
|
||||
var about1 = ioServ.newURI("about:blank", null, null);
|
||||
var about2 = ioServ.newURI("about:blank", null, base);
|
||||
|
||||
var chan1 = ioServ.newChannelFromURI(about1)
|
||||
var chan1 = ioServ.newChannelFromURI2(about1,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Components.interfaces.nsIPropertyBag2);
|
||||
var chan2 = ioServ.newChannelFromURI(about2)
|
||||
var chan2 = ioServ.newChannelFromURI2(about2,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Components.interfaces.nsIPropertyBag2);
|
||||
|
||||
var haveProp = false;
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = new HttpServer();
|
||||
var currentTestIndex = 0;
|
||||
@ -46,7 +47,14 @@ function setupChannel(url)
|
||||
{
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:" + port + url, "", null);
|
||||
var chan = ios.newChannel2("http://localhost:" + port + url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
return chan;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
*/
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const FLAG_RETURN_FALSE = 1 << 0;
|
||||
const FLAG_WRONG_PASSWORD = 1 << 1;
|
||||
@ -214,7 +215,14 @@ function makeChan(url) {
|
||||
url = "http://somesite/";
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(url, null, null)
|
||||
var chan = ios.newChannel2(url,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Ci.nsIHttpChannel);
|
||||
|
||||
return chan;
|
||||
|
@ -2,6 +2,7 @@
|
||||
// TODO NIT use do_check_eq(expected, actual) consistently, not sometimes eq(actual, expected)
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
return "http://localhost:" + httpserv.identity.primaryPort;
|
||||
@ -271,7 +272,14 @@ var listener = {
|
||||
function makeChan(url) {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var chan = ios.newChannel(url, null, null)
|
||||
var chan = ios.newChannel2(url,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
|
||||
return chan;
|
||||
|
@ -5,6 +5,8 @@
|
||||
// - HTTPS
|
||||
// - Proxies
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const nsIAuthInformation = Components.interfaces.nsIAuthInformation;
|
||||
const nsIAuthPromptAdapterFactory = Components.interfaces.nsIAuthPromptAdapterFactory;
|
||||
|
||||
@ -102,7 +104,14 @@ function run_test() {
|
||||
// Also have to make up a channel
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var chan = ios.newChannel("http://" + host, "", null);
|
||||
var chan = ios.newChannel2("http://" + host,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
function do_tests(expectedRV) {
|
||||
var prompt1;
|
||||
@ -199,7 +208,14 @@ function run_test() {
|
||||
info.password = "";
|
||||
|
||||
// 5: FTP
|
||||
var ftpchan = ios.newChannel("ftp://" + host, "", null);
|
||||
var ftpchan = ios.newChannel2("ftp://" + host,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
prompt1 = new Prompt1();
|
||||
prompt1.rv = expectedRV;
|
||||
|
@ -20,6 +20,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||
"resource://gre/modules/Promise.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||
"resource://gre/modules/Task.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Services",
|
||||
"resource://gre/modules/Services.jsm");
|
||||
|
||||
const BackgroundFileSaverOutputStream = Components.Constructor(
|
||||
"@mozilla.org/network/background-file-saver;1?mode=outputstream",
|
||||
@ -105,7 +107,7 @@ function toHex(str) {
|
||||
*/
|
||||
function promiseVerifyContents(aFile, aExpectedContents) {
|
||||
let deferred = Promise.defer();
|
||||
NetUtil.asyncFetch(aFile, function(aInputStream, aStatus) {
|
||||
NetUtil.asyncFetch2(aFile, function(aInputStream, aStatus) {
|
||||
do_check_true(Components.isSuccessCode(aStatus));
|
||||
let contents = NetUtil.readInputStreamToString(aInputStream,
|
||||
aInputStream.available());
|
||||
@ -117,7 +119,13 @@ function promiseVerifyContents(aFile, aExpectedContents) {
|
||||
do_check_true(contents == aExpectedContents);
|
||||
}
|
||||
deferred.resolve();
|
||||
});
|
||||
},
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
*/
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
return "http://localhost:" + httpServer.identity.primaryPort;
|
||||
@ -21,7 +22,14 @@ var httpServer = null;
|
||||
function make_channel(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
const responseBody1 = "response body 1";
|
||||
|
@ -5,6 +5,7 @@
|
||||
// take precedence
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
const BUGID = "203271";
|
||||
|
||||
var httpserver = new HttpServer();
|
||||
@ -96,9 +97,15 @@ function logit(i, data, ctx) {
|
||||
function setupChannel(suffix, value) {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:" +
|
||||
httpserver.identity.primaryPort + suffix,
|
||||
"", null);
|
||||
var chan = ios.newChannel2("http://localhost:" +
|
||||
httpserver.identity.primaryPort + suffix,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var httpChan = chan.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
httpChan.requestMethod = "GET"; // default value, just being paranoid...
|
||||
httpChan.setRequestHeader("x-request", value, false);
|
||||
|
@ -14,7 +14,14 @@ function inChildProcess() {
|
||||
}
|
||||
function makeChan(path) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:" + httpserver.identity.primaryPort + "/" + path, null, null)
|
||||
var chan = ios.newChannel2("http://localhost:" + httpserver.identity.primaryPort + "/" + path,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Ci.nsIHttpChannel);
|
||||
return chan;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var server;
|
||||
const BUGID = "263127";
|
||||
@ -40,8 +41,15 @@ function run_test() {
|
||||
// Initialize downloader
|
||||
var channel = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService)
|
||||
.newChannel("http://localhost:" +
|
||||
server.identity.primaryPort + "/", null, null);
|
||||
.newChannel2("http://localhost:" +
|
||||
server.identity.primaryPort + "/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
var targetFile = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
|
@ -1,3 +1,5 @@
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
|
||||
@ -33,6 +35,11 @@ function run_test() {
|
||||
let file = do_get_file("_NOT_EXIST_.txt", true);
|
||||
do_check_false(file.exists());
|
||||
|
||||
let channel = ios.newChannelFromURI(ios.newFileURI(file));
|
||||
let channel = ios.newChannelFromURI2(ios.newFileURI(file),
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
channel.asyncOpen(listener, null);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var server;
|
||||
const BUGID = "331825";
|
||||
@ -26,8 +27,14 @@ function run_test() {
|
||||
var channel =
|
||||
Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService).
|
||||
newChannel("http://localhost:" + server.identity.primaryPort + "/bug" +
|
||||
BUGID, null, null);
|
||||
newChannel2("http://localhost:" + server.identity.primaryPort + "/bug" + BUGID,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
channel.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
channel.setRequestHeader("If-None-Match", "foobar", false);
|
||||
|
@ -18,7 +18,14 @@ function check_for_exception(spec)
|
||||
getService(Ci.nsIIOService);
|
||||
|
||||
try {
|
||||
var channel = ios.newChannel(spec, null, null);
|
||||
var channel = ios.newChannel2(spec,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
catch (e) {
|
||||
return;
|
||||
|
@ -81,7 +81,14 @@ function storeData(status, entry) {
|
||||
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService);
|
||||
var channel = ios.newChannel(URL, "", null);
|
||||
var channel = ios.newChannel2(URL,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
channel.asyncOpen(new ChannelListener(checkData, null, CL_ALLOW_UNKNOWN_CL), null);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const BUGID = "369787";
|
||||
var server = null;
|
||||
@ -57,8 +58,15 @@ function run_test() {
|
||||
channel =
|
||||
Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService).
|
||||
newChannel("http://localhost:" +
|
||||
server.identity.primaryPort + "/bug" + BUGID, null, null);
|
||||
newChannel2("http://localhost:" +
|
||||
server.identity.primaryPort + "/bug" + BUGID,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
channel.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
channel.asyncOpen(new TestListener(), null);
|
||||
|
@ -1,3 +1,5 @@
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
|
||||
@ -45,7 +47,14 @@ function test1() {
|
||||
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var chan = ios.newChannel("data:text/plain,", null, null);
|
||||
var chan = ios.newChannel2("data:text/plain,",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
chan.asyncOpen(f, null);
|
||||
do_test_pending();
|
||||
}
|
||||
@ -58,7 +67,14 @@ function test2() {
|
||||
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:0/", null, null);
|
||||
var chan = ios.newChannel2("http://localhost:0/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
listener.expect_failure = true;
|
||||
chan.asyncOpen(f, null);
|
||||
do_test_pending();
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
"use strict";
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = null;
|
||||
const noRedirectURI = "/content";
|
||||
@ -35,10 +36,15 @@ function run_test()
|
||||
prefs.setBoolPref("network.http.prompt-temp-redirect", false);
|
||||
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:" +
|
||||
httpserver.identity.primaryPort + "/redirect",
|
||||
"",
|
||||
null);
|
||||
var chan = ios.newChannel2("http://localhost:" +
|
||||
httpserver.identity.primaryPort + "/redirect",
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
chan.QueryInterface(Ci.nsIHttpChannel);
|
||||
chan.setRequestHeader("Accept", acceptType, false);
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserv;
|
||||
|
||||
@ -23,8 +24,15 @@ function run_test() {
|
||||
var channel =
|
||||
Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService).
|
||||
newChannel("http://localhost:" + httpserv.identity.primaryPort +
|
||||
"/bug412945", null, null);
|
||||
newChannel2("http://localhost:" + httpserv.identity.primaryPort +
|
||||
"/bug412945",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
channel.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
channel.requestMethod = "POST";
|
||||
|
@ -1,6 +1,8 @@
|
||||
const isWindows = ("@mozilla.org/windows-registry-key;1" in Cc);
|
||||
const isLinux = ("@mozilla.org/gnome-gconf-service;1" in Cc);
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function getLinkFile()
|
||||
{
|
||||
if (isWindows) {
|
||||
@ -95,7 +97,12 @@ RequestObserver.prototype = {
|
||||
|
||||
function test_cancel()
|
||||
{
|
||||
var chan = ios.newChannelFromURI(linkURI);
|
||||
var chan = ios.newChannelFromURI2(linkURI,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
do_check_eq(chan.URI, linkURI);
|
||||
do_check_eq(chan.originalURI, linkURI);
|
||||
chan.asyncOpen(new RequestObserver(linkURI, newURI, do_test_finished), null);
|
||||
@ -115,7 +122,12 @@ function run_test()
|
||||
|
||||
do_test_pending();
|
||||
|
||||
var chan = ios.newChannelFromURI(linkURI);
|
||||
var chan = ios.newChannelFromURI2(linkURI,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
do_check_eq(chan.URI, linkURI);
|
||||
do_check_eq(chan.originalURI, linkURI);
|
||||
chan.notificationCallbacks = new NotificationCallbacks(linkURI, newURI);
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = new HttpServer();
|
||||
var index = 0;
|
||||
@ -35,8 +36,15 @@ var tests = [
|
||||
function setupChannel(suffix, value, cookie) {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:" +
|
||||
httpserver.identity.primaryPort + suffix, "", null);
|
||||
var chan = ios.newChannel2("http://localhost:" +
|
||||
httpserver.identity.primaryPort + suffix,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var httpChan = chan.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
httpChan.requestMethod = "GET";
|
||||
httpChan.setRequestHeader("x-request", value, false);
|
||||
|
@ -14,6 +14,7 @@
|
||||
// definition of "explicit expiration time" being used here.
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = new HttpServer();
|
||||
var index = 0;
|
||||
@ -57,7 +58,14 @@ function logit(i, data) {
|
||||
function setupChannel(suffix, value) {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:" + httpserver.identity.primaryPort + suffix, "", null);
|
||||
var chan = ios.newChannel2("http://localhost:" + httpserver.identity.primaryPort + suffix,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var httpChan = chan.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
httpChan.requestMethod = "GET";
|
||||
httpChan.setRequestHeader("x-request", value, false);
|
||||
|
@ -1,5 +1,7 @@
|
||||
// test that methods are not normalized
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const testMethods = [
|
||||
["GET"],
|
||||
["get"],
|
||||
@ -41,7 +43,14 @@ function run_test() {
|
||||
Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
|
||||
var chan = ios.newChannel("http://localhost/", null, null)
|
||||
var chan = ios.newChannel2("http://localhost/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
|
||||
for (var i = 0; i < testMethods.length; i++) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserv = null;
|
||||
var test_nr = 0;
|
||||
@ -80,7 +81,14 @@ var results = ["http-on-examine-response",
|
||||
|
||||
function makeChan(url) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(url, null, null).QueryInterface(Ci.nsIHttpChannel);
|
||||
var chan = ios.newChannel2(url,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER).QueryInterface(Ci.nsIHttpChannel);
|
||||
return chan;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,14 @@ function storeData(status, entry) {
|
||||
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService);
|
||||
var channel = ios.newChannel(URL, "", null);
|
||||
var channel = ios.newChannel2(URL,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
channel.asyncOpen(new ChannelListener(checkData, null, CL_ALLOW_UNKNOWN_CL), null);
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
//
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = new HttpServer();
|
||||
var index = 0;
|
||||
@ -44,9 +45,16 @@ function logit(i, data) {
|
||||
function setupChannel(suffix, value) {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:" +
|
||||
httpserver.identity.primaryPort +
|
||||
suffix, "", null);
|
||||
var chan = ios.newChannel2("http://localhost:" +
|
||||
httpserver.identity.primaryPort +
|
||||
suffix,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var httpChan = chan.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
httpChan.requestMethod = "GET";
|
||||
httpChan.setRequestHeader("x-request", value, false);
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = new HttpServer();
|
||||
var index = 0;
|
||||
@ -10,9 +11,16 @@ var tests = [
|
||||
function setupChannel(suffix, value) {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:" +
|
||||
httpserver.identity.primaryPort +
|
||||
suffix, "", null);
|
||||
var chan = ios.newChannel2("http://localhost:" +
|
||||
httpserver.identity.primaryPort +
|
||||
suffix,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var httpChan = chan.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
httpChan.requestMethod = "GET";
|
||||
httpChan.setRequestHeader("x-request", value, false);
|
||||
|
@ -43,7 +43,14 @@ function storeData(status, entry) {
|
||||
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService);
|
||||
var channel = ios.newChannel(URL, "", null);
|
||||
var channel = ios.newChannel2(URL,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
channel.asyncOpen(new ChannelListener(checkData, null, CL_ALLOW_UNKNOWN_CL), null);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const sentCookieVal = "foo=bar";
|
||||
const responseBody = "response body";
|
||||
@ -63,7 +64,14 @@ function run_test()
|
||||
// the channel both to set a cookie (since nsICookieService::setCookieString
|
||||
// requires such a channel in order to successfully set a cookie) and then
|
||||
// to load the pre-redirect URI.
|
||||
var chan = ioService.newChannel(preRedirectURL, "", null).
|
||||
var chan = ioService.newChannel2(preRedirectURL,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER).
|
||||
QueryInterface(Ci.nsIHttpChannel).
|
||||
QueryInterface(Ci.nsIHttpChannelInternal);
|
||||
chan.forceAllowThirdPartyCookie = true;
|
||||
|
@ -2,6 +2,7 @@
|
||||
a simple HTTP case */
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
// This C-L is significantly larger than (U)INT32_MAX, to make sure we do
|
||||
// 64-bit properly.
|
||||
@ -47,8 +48,15 @@ function hugeContentLength(metadata, response) {
|
||||
|
||||
function test_hugeContentLength() {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:" +
|
||||
httpServer.identity.primaryPort + "/", null, null)
|
||||
var chan = ios.newChannel2("http://localhost:" +
|
||||
httpServer.identity.primaryPort + "/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Ci.nsIHttpChannel);
|
||||
chan.asyncOpen(listener, null);
|
||||
}
|
||||
|
@ -61,7 +61,14 @@ function storeData(status, entry) {
|
||||
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService);
|
||||
var channel = ios.newChannel(URL, "", null);
|
||||
var channel = ios.newChannel2(URL,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
channel.asyncOpen(new ChannelListener(checkData, null, CL_ALLOW_UNKNOWN_CL), null);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const SERVER_PORT = 8080;
|
||||
const baseURL = "http://localhost:" + SERVER_PORT + "/";
|
||||
@ -33,7 +34,14 @@ function run_test() {
|
||||
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var chan = ios.newChannel(baseURL, null, null)
|
||||
var chan = ios.newChannel2(baseURL,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
chan.asyncOpen(listener, null);
|
||||
do_test_pending();
|
||||
|
@ -4,6 +4,7 @@
|
||||
//
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = new HttpServer();
|
||||
var iteration = 0;
|
||||
@ -13,8 +14,15 @@ function setupChannel(suffix)
|
||||
var ios =
|
||||
Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:" +
|
||||
httpserver.identity.primaryPort + suffix, "", null);
|
||||
var chan = ios.newChannel2("http://localhost:" +
|
||||
httpserver.identity.primaryPort + suffix,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var httpChan = chan.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
httpChan.requestMethod = "GET";
|
||||
return httpChan;
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserv = null;
|
||||
|
||||
@ -40,7 +41,14 @@ function checkValue(request, data, ctx) {
|
||||
function makeChan(url) {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var chan = ios.newChannel(url, null, null)
|
||||
var chan = ios.newChannel2(url,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
|
||||
return chan;
|
||||
|
@ -1,4 +1,6 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = new HttpServer();
|
||||
|
||||
var expectedOnStopRequests = 3;
|
||||
@ -6,9 +8,16 @@ var expectedOnStopRequests = 3;
|
||||
function setupChannel(suffix, xRequest, flags) {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:" +
|
||||
httpserver.identity.primaryPort +
|
||||
suffix, "", null);
|
||||
var chan = ios.newChannel2("http://localhost:" +
|
||||
httpserver.identity.primaryPort +
|
||||
suffix,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
if (flags)
|
||||
chan.loadFlags |= flags;
|
||||
|
||||
|
@ -12,14 +12,22 @@
|
||||
//
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserv;
|
||||
|
||||
function setupChannel(path) {
|
||||
var ios =
|
||||
Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
return chan = ios.newChannel(path, "", null)
|
||||
.QueryInterface(Ci.nsIHttpChannel);
|
||||
return chan = ios.newChannel2(path,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Ci.nsIHttpChannel);
|
||||
}
|
||||
|
||||
// Verify that Content-Location-URI has been loaded once, load post_target
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const VALUE_HDR_NAME = "X-HTTP-VALUE-HEADER";
|
||||
const VARY_HDR_NAME = "X-HTTP-VARY-HEADER";
|
||||
@ -9,9 +10,17 @@ var httpserver = null;
|
||||
function make_channel(flags, vary, value) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:" +
|
||||
httpserver.identity.primaryPort +
|
||||
"/bug633743", null, null);
|
||||
var chan = ios.newChannel2("http://localhost:" +
|
||||
httpserver.identity.primaryPort +
|
||||
"/bug633743",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
return chan.QueryInterface(Ci.nsIHttpChannel);
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
//
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
do_get_profile();
|
||||
|
||||
@ -22,9 +23,16 @@ function repeatToLargerThan1K(data) {
|
||||
function setupChannel(suffix, value) {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:" +
|
||||
httpserver.identity.primaryPort +
|
||||
suffix, "", null);
|
||||
var chan = ios.newChannel2("http://localhost:" +
|
||||
httpserver.identity.primaryPort +
|
||||
suffix,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var httpChan = chan.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
httpChan.setRequestHeader("x-request", value, false);
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
// This is just a crashtest for a url that is rejected at parse time (port 80,000)
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function completeTest(request, data, ctx)
|
||||
{
|
||||
do_test_finished();
|
||||
@ -9,7 +11,14 @@ function run_test()
|
||||
{
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:80000/", "", null);
|
||||
var chan = ios.newChannel2("http://localhost:80000/",
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var httpChan = chan.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
httpChan.asyncOpen(new ChannelListener(completeTest,
|
||||
httpChan, CL_EXPECT_FAILURE), null);
|
||||
|
@ -7,9 +7,16 @@ function setupChannel(suffix)
|
||||
var ios =
|
||||
Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:" +
|
||||
httpserver.identity.primaryPort +
|
||||
suffix, "", null);
|
||||
var chan = ios.newChannel2("http://localhost:" +
|
||||
httpserver.identity.primaryPort +
|
||||
suffix,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
return chan;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = null;
|
||||
var simplePath = "/simple";
|
||||
@ -16,7 +17,14 @@ XPCOMUtils.defineLazyGetter(this, "uri2", function() {
|
||||
function make_channel(url) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
var listener_proto = {
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpServer = null;
|
||||
var path = "/bug699001";
|
||||
@ -10,7 +11,14 @@ XPCOMUtils.defineLazyGetter(this, "URI", function() {
|
||||
function make_channel(url) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
var fetched;
|
||||
|
@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserv;
|
||||
|
||||
@ -29,8 +30,15 @@ function clearCreds()
|
||||
function makeChan() {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:" +
|
||||
httpserv.identity.primaryPort + "/", null, null)
|
||||
var chan = ios.newChannel2("http://localhost:" +
|
||||
httpserv.identity.primaryPort + "/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Ci.nsIHttpChannel);
|
||||
return chan;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
/*
|
||||
- get 302 with Cache-control: no-store
|
||||
@ -24,7 +25,14 @@ XPCOMUtils.defineLazyGetter(this, "randomURI2", function() {
|
||||
function make_channel(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
const responseBody = "response body";
|
||||
|
@ -25,7 +25,14 @@ LoadContext.prototype = {
|
||||
|
||||
function getChannels() {
|
||||
for (let u of URIs) {
|
||||
yield Services.io.newChannel(u, null, null);
|
||||
yield Services.io.newChannel2(u,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
// passes iff both succeeds.
|
||||
|
||||
Components.utils.import("resource://testing-common/httpd.js");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var notification = "http-on-modify-request";
|
||||
|
||||
@ -97,7 +98,14 @@ var listener = {
|
||||
|
||||
function makeChan(url) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(url, null, null).QueryInterface(Ci.nsIHttpChannel);
|
||||
var chan = ios.newChannel2(url,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER).QueryInterface(Ci.nsIHttpChannel);
|
||||
return chan;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,12 @@ ProtocolHandler.prototype = {
|
||||
var file = do_get_file("test_bug894586.js", false);
|
||||
do_check_true(file.exists());
|
||||
var url = Services.io.newFileURI(file);
|
||||
return Services.io.newChannelFromURI(url).open();
|
||||
return Services.io.newChannelFromURI2(url,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER).open();
|
||||
},
|
||||
asyncOpen: function(aListener, aContext) {
|
||||
throw Components.Exception("Not implemented",
|
||||
|
@ -23,7 +23,14 @@ var httpServer = null;
|
||||
function make_channel(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
const responseBody = "response body";
|
||||
|
@ -25,7 +25,14 @@ var httpServer = null;
|
||||
function make_channel(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
const responseBody = "c\r\ndata reached\r\n3\r\nhej\r\n0\r\n\r\n";
|
||||
|
@ -2,6 +2,7 @@
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=760955
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpServer = null;
|
||||
const testFileName = "test_nsHttpChannel_CacheForOfflineUse-no-store";
|
||||
@ -21,7 +22,14 @@ var appCache = null;
|
||||
function make_channel_for_offline_use(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(url, "", null);
|
||||
var chan = ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
|
||||
getService(Components.interfaces.nsIApplicationCacheService);
|
||||
|
@ -20,7 +20,14 @@ function cached_handler(metadata, response) {
|
||||
|
||||
function makeChan(url, appId, inBrowser) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(url, null, null).QueryInterface(Ci.nsIHttpChannel);
|
||||
var chan = ios.newChannel2(url,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER).QueryInterface(Ci.nsIHttpChannel);
|
||||
chan.notificationCallbacks = {
|
||||
appId: appId,
|
||||
isInBrowserElement: inBrowser,
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = new HttpServer();
|
||||
httpserver.start(-1);
|
||||
@ -40,7 +41,14 @@ PrivateBrowsingLoadContext = new LoadContext(true);
|
||||
function make_channel(url, flags, usePrivateBrowsing) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var req = ios.newChannel(url, null, null);
|
||||
var req = ios.newChannel2(url,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
req.loadFlags = flags;
|
||||
if (usePrivateBrowsing) {
|
||||
req.notificationCallbacks = PrivateBrowsingLoadContext;
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
return "http://localhost:" + httpserver.identity.primaryPort;
|
||||
@ -38,7 +39,14 @@ function run_test() {
|
||||
|
||||
function setupChannel(path) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(URL + path, "", null);
|
||||
var chan = ios.newChannel2(URL + path,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
chan.QueryInterface(Ci.nsIHttpChannel);
|
||||
chan.requestMethod = "GET";
|
||||
return chan;
|
||||
|
@ -6,6 +6,7 @@
|
||||
// Test infrastructure
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
return "http://localhost:" + httpserver.identity.primaryPort;
|
||||
@ -39,7 +40,14 @@ function setupChannel(url)
|
||||
{
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(URL + url, "", null);
|
||||
var chan = ios.newChannel2(URL + url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var httpChan = chan.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
return httpChan;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = new HttpServer();
|
||||
var index = 0;
|
||||
@ -28,8 +29,15 @@ var tests = [
|
||||
function setupChannel(url) {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:" +
|
||||
httpserver.identity.primaryPort + url, "", null);
|
||||
var chan = ios.newChannel2("http://localhost:" +
|
||||
httpserver.identity.primaryPort + url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
return chan;
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
// Test infrastructure
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
return "http://localhost:" + httpserver.identity.primaryPort;
|
||||
@ -46,7 +47,14 @@ function setupChannel(url)
|
||||
{
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(URL + url, "", null);
|
||||
var chan = ios.newChannel2(URL + url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var httpChan = chan.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
return httpChan;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// This file tests nsIContentSniffer, introduced in bug 324985
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const unknownType = "application/x-unknown-content-type";
|
||||
const sniffedType = "application/x-sniffed";
|
||||
@ -72,7 +73,14 @@ var listener = {
|
||||
function makeChan(url) {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var chan = ios.newChannel(url, null, null);
|
||||
var chan = ios.newChannel2(url,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
if (sniffing_enabled)
|
||||
chan.loadFlags |= Components.interfaces.nsIChannel.LOAD_CALL_CONTENT_SNIFFERS;
|
||||
|
||||
|
@ -58,7 +58,14 @@ var listener = {
|
||||
function makeChan() {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var chan = ios.newChannel(URL, null, null)
|
||||
var chan = ios.newChannel2(URL,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
|
||||
return chan;
|
||||
|
@ -49,7 +49,14 @@ var i = 0;
|
||||
function setupChannel(path)
|
||||
{
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(URL + path, "", null);
|
||||
var chan = ios.newChannel2(URL + path,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
chan.notificationCallbacks = tests[i].loadContext;
|
||||
chan.QueryInterface(Ci.nsIHttpChannel);
|
||||
return chan;
|
||||
|
@ -69,7 +69,14 @@ function safebrowsingUpdateHandler(metadata, response) {
|
||||
|
||||
function setupChannel(path, loadContext) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
var channel = ios.newChannel(URL + path, "", null);
|
||||
var channel = ios.newChannel2(URL + path,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
channel.notificationCallbacks = loadContext;
|
||||
channel.QueryInterface(Ci.nsIHttpChannel);
|
||||
return channel;
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* run some tests on the data: protocol handler */
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
// The behaviour wrt spaces is:
|
||||
// - Textual content keeps all spaces
|
||||
@ -39,7 +40,14 @@ function run_test() {
|
||||
for (var i = 0; i < urls.length; ++i) {
|
||||
dump("*** opening channel " + i + "\n");
|
||||
do_test_pending();
|
||||
var chan = ios.newChannel(urls[i][0], "", null);
|
||||
var chan = ios.newChannel2(urls[i][0],
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
chan.contentType = "foo/bar"; // should be ignored
|
||||
chan.asyncOpen(new ChannelListener(on_read_complete, i), null);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
// Test infrastructure
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
return "http://localhost:" + httpserver.identity.primaryPort;
|
||||
@ -40,7 +41,14 @@ function setupChannel(url)
|
||||
{
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(URL + url, "", null);
|
||||
var chan = ios.newChannel2(URL + url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var httpChan = chan.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
return httpChan;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// This file tests channel event sinks (bug 315598 et al)
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
return "http://localhost:" + httpserv.identity.primaryPort;
|
||||
@ -98,7 +99,14 @@ var listener = {
|
||||
function makeChan(url) {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var chan = ios.newChannel(url, null, null)
|
||||
var chan = ios.newChannel2(url,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
|
||||
return chan;
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpServer = null;
|
||||
// Need to randomize, because apparently no one clears our cache
|
||||
@ -13,7 +14,14 @@ var cacheUpdateObserver = null;
|
||||
function make_channel(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function make_uri(url) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpServer = null;
|
||||
// Need to randomize, because apparently no one clears our cache
|
||||
@ -13,7 +14,14 @@ var cacheUpdateObserver = null;
|
||||
function make_channel(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function make_uri(url) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpServer = null;
|
||||
// Need to randomize, because apparently no one clears our cache
|
||||
@ -13,7 +14,14 @@ var cacheUpdateObserver = null;
|
||||
function make_channel(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function make_uri(url) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpServer = null;
|
||||
// Need to randomize, because apparently no one clears our cache
|
||||
@ -13,7 +14,14 @@ var cacheUpdateObserver = null;
|
||||
function make_channel(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function make_uri(url) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpServer = null;
|
||||
// Need to randomize, because apparently no one clears our cache
|
||||
@ -13,7 +14,14 @@ var cacheUpdateObserver = null;
|
||||
function make_channel(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function make_uri(url) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpServer = null;
|
||||
// Need to randomize, because apparently no one clears our cache
|
||||
@ -13,7 +14,14 @@ var cacheUpdateObserver = null;
|
||||
function make_channel(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function make_uri(url) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpServer = null;
|
||||
// Need to randomize, because apparently no one clears our cache
|
||||
@ -13,7 +14,14 @@ var cacheUpdateObserver = null;
|
||||
function make_channel(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function make_uri(url) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpServer = null;
|
||||
// Need to randomize, because apparently no one clears our cache
|
||||
@ -13,7 +14,14 @@ var cacheUpdateObserver = null;
|
||||
function make_channel(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function make_uri(url) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* run some tests on the file:// protocol handler */
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const PR_RDONLY = 0x1; // see prio.h
|
||||
|
||||
const special_type = "application/x-our-special-type";
|
||||
@ -38,7 +40,12 @@ function new_file_channel(file) {
|
||||
var ios =
|
||||
Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannelFromURI(ios.newFileURI(file));
|
||||
return ios.newChannelFromURI2(ios.newFileURI(file),
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,6 +1,7 @@
|
||||
// This is essentially a debug mode crashtest to make sure everything
|
||||
// involved in a reload runs on the right thread. It relies on the
|
||||
// assertions in necko.
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var listener = {
|
||||
onStartRequest: function test_onStartR(request, ctx) {
|
||||
@ -18,7 +19,14 @@ var listener = {
|
||||
function run_test() {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:4444", "", null);
|
||||
var chan = ios.newChannel2("http://localhost:4444",
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
chan.loadFlags = Ci.nsIRequest.LOAD_FRESH_CONNECTION |
|
||||
Ci.nsIChannel.LOAD_INITIAL_DOCUMENT_URI;
|
||||
chan.QueryInterface(Ci.nsIHttpChannel);
|
||||
|
@ -1,4 +1,5 @@
|
||||
// test that things that are expected to be in gre-resources are still there
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"]. getService(Ci.nsIIOService);
|
||||
|
||||
@ -12,7 +13,14 @@ function wrapInputStream(input)
|
||||
}
|
||||
|
||||
function check_file(file) {
|
||||
var channel = ios.newChannel("resource://gre-resources/"+file, null, null);
|
||||
var channel = ios.newChannel2("resource://gre-resources/"+file,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
try {
|
||||
let instr = wrapInputStream(channel.open());
|
||||
do_check_true(instr.read(1024).length > 0)
|
||||
|
@ -12,7 +12,14 @@ const responseBody = [0x1f, 0x8b, 0x08, 0x08, 0xef, 0x70, 0xe6, 0x4c, 0x00, 0x03
|
||||
function make_channel(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
var doRangeResponse = false;
|
||||
|
@ -5,6 +5,7 @@
|
||||
// Note: sets Cc and Ci variables
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
return "http://localhost:" + httpserver.identity.primaryPort;
|
||||
@ -64,7 +65,14 @@ function setup_test() {
|
||||
|
||||
function setupChannel(path) {
|
||||
ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(URL + path, "", null);
|
||||
var chan = ios.newChannel2(URL + path,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
chan.QueryInterface(Ci.nsIHttpChannel);
|
||||
chan.requestMethod = "GET";
|
||||
return chan;
|
||||
|
@ -2,6 +2,8 @@
|
||||
// HTTP Accept-Language header test
|
||||
//
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var testpath = "/bug672448";
|
||||
|
||||
function run_test() {
|
||||
@ -79,7 +81,14 @@ function test_accepted_languages() {
|
||||
|
||||
function setupChannel(path) {
|
||||
let ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
let chan = ios.newChannel("http://localhost:4444" + path, "", null);
|
||||
let chan = ios.newChannel2("http://localhost:4444" + path,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
chan.QueryInterface(Ci.nsIHttpChannel);
|
||||
return chan;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ var lastTest = 4; // set to test of interest when debugging
|
||||
// Note: sets Cc and Ci variables
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
return "http://localhost:" + httpserver.identity.primaryPort;
|
||||
@ -72,7 +73,14 @@ function setupChannel(url)
|
||||
{
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(URL + url, "", null);
|
||||
var chan = ios.newChannel2(URL + url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var httpChan = chan.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
return httpChan;
|
||||
}
|
||||
|
@ -191,7 +191,14 @@ Http2PostListener.prototype.onDataAvailable = function(request, ctx, stream, off
|
||||
|
||||
function makeChan(url) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(url, null, null).QueryInterface(Ci.nsIHttpChannel);
|
||||
var chan = ios.newChannel2(url,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER).QueryInterface(Ci.nsIHttpChannel);
|
||||
|
||||
return chan;
|
||||
}
|
||||
@ -355,6 +362,8 @@ function test_http2_post_big() {
|
||||
}
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserv = null;
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
@ -372,8 +381,15 @@ var altsvcClientListener = {
|
||||
var isHttp2Connection = checkIsHttp2(request);
|
||||
if (!isHttp2Connection) {
|
||||
// not over tls yet - retry. It's all async and transparent to client
|
||||
var chan = ios.newChannel("http://localhost:" + httpserv.identity.primaryPort + "/altsvc1",
|
||||
null, null).QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
var chan = ios.newChannel2("http://localhost:" + httpserv.identity.primaryPort + "/altsvc1",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
chan.asyncOpen(altsvcClientListener, null);
|
||||
} else {
|
||||
do_check_true(isHttp2Connection);
|
||||
@ -396,8 +412,15 @@ function test_http2_altsvc() {
|
||||
httpserv.registerPathHandler("/altsvc1", altsvcHttp1Server);
|
||||
httpserv.start(-1);
|
||||
|
||||
var chan = ios.newChannel("http://localhost:" + httpserv.identity.primaryPort + "/altsvc1",
|
||||
null, null).QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
var chan = ios.newChannel2("http://localhost:" + httpserv.identity.primaryPort + "/altsvc1",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
chan.asyncOpen(altsvcClientListener, null);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
"use strict";
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var baseURL;
|
||||
const kResponseTimeoutPref = "network.http.response.timeout";
|
||||
@ -57,7 +58,14 @@ function testTimeout(timeoutEnabled, expectResponse) {
|
||||
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(baseURL, null, null)
|
||||
var chan = ios.newChannel2(baseURL,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Ci.nsIHttpChannel);
|
||||
var listener = new TimeoutListener(expectResponse);
|
||||
chan.asyncOpen(listener, null);
|
||||
|
@ -1,3 +1,5 @@
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function check_request_header(chan, name, value) {
|
||||
var chanValue;
|
||||
try {
|
||||
@ -11,7 +13,14 @@ function check_request_header(chan, name, value) {
|
||||
function run_test() {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var chan = ios.newChannel("http://www.mozilla.org/", null, null)
|
||||
var chan = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
|
||||
check_request_header(chan, "host", "www.mozilla.org");
|
||||
|
@ -5,6 +5,7 @@
|
||||
// expected: see comments that start with ENSURE_CALLED_BEFORE_CONNECT:
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
@ -72,7 +73,14 @@ var listener = {
|
||||
};
|
||||
|
||||
function makeChan(url) {
|
||||
var chan = ios.newChannel(url, null, null)
|
||||
var chan = ios.newChannel2(url,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
|
||||
// ENSURE_CALLED_BEFORE_CONNECT: set original value
|
||||
|
@ -2,6 +2,7 @@
|
||||
// suspends future notifications correctly.
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
return "http://localhost:" + httpserv.identity.primaryPort;
|
||||
@ -55,7 +56,14 @@ var listener = {
|
||||
|
||||
function makeChan(url) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(url, null, null).QueryInterface(Ci.nsIHttpChannel);
|
||||
var chan = ios.newChannel2(url,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER).QueryInterface(Ci.nsIHttpChannel);
|
||||
return chan;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Perform the async open several times in order to induce exponential
|
||||
// scheduling behavior bugs.
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const CC = Components.Constructor;
|
||||
|
||||
var counter = 0;
|
||||
@ -31,7 +33,14 @@ function run_test() {
|
||||
function execute_test() {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:75000", "", null);
|
||||
var chan = ios.newChannel2("http://localhost:75000",
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
chan.QueryInterface(Ci.nsIHttpChannel);
|
||||
chan.asyncOpen(listener, null);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Tests bug 304414
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const PR_RDONLY = 0x1; // see prio.h
|
||||
|
||||
@ -68,7 +69,12 @@ function stream_from_channel(file) {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var uri = ios.newFileURI(file);
|
||||
return ios.newChannelFromURI(uri).open();
|
||||
return ios.newChannelFromURI2(uri,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER).open();
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
var httpserver = new HttpServer();
|
||||
|
||||
var ios;
|
||||
@ -67,12 +68,19 @@ XPCOMUtils.defineLazyGetter(this, "listener_2", function() {
|
||||
},
|
||||
|
||||
onStopRequest: function test_onStopR(request, ctx, status) {
|
||||
var channel = request.QueryInterface(Ci.nsIHttpChannel);
|
||||
var channel = request.QueryInterface(Ci.nsIHttpChannel);
|
||||
|
||||
var chan = ios.newChannel("http://localhost:" +
|
||||
httpserver.identity.primaryPort +
|
||||
"/test1", "", null);
|
||||
chan.asyncOpen(listener_3, null);
|
||||
var chan = ios.newChannel2("http://localhost:" +
|
||||
httpserver.identity.primaryPort +
|
||||
"/test1",
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
chan.asyncOpen(listener_3, null);
|
||||
}
|
||||
};
|
||||
});
|
||||
@ -101,9 +109,16 @@ XPCOMUtils.defineLazyGetter(this, "listener_1", function() {
|
||||
onStopRequest: function test_onStopR(request, ctx, status) {
|
||||
var channel = request.QueryInterface(Ci.nsIHttpChannel);
|
||||
|
||||
var chan = ios.newChannel("http://localhost:" +
|
||||
httpserver.identity.primaryPort +
|
||||
"/test1", "", null);
|
||||
var chan = ios.newChannel2("http://localhost:" +
|
||||
httpserver.identity.primaryPort +
|
||||
"/test1",
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
chan.asyncOpen(listener_2, null);
|
||||
}
|
||||
};
|
||||
@ -121,7 +136,14 @@ function run_test() {
|
||||
|
||||
var port = httpserver.identity.primaryPort;
|
||||
|
||||
var chan = ios.newChannel("http://localhost:" + port + "/test1", "", null);
|
||||
var chan = ios.newChannel2("http://localhost:" + port + "/test1",
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
chan.asyncOpen(listener_1, null);
|
||||
|
||||
do_test_pending();
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = null;
|
||||
|
||||
@ -9,7 +10,14 @@ XPCOMUtils.defineLazyGetter(this, "uri", function() {
|
||||
function make_channel(url) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
var multipartBody = "--boundary\r\n"+
|
||||
@ -34,7 +42,14 @@ var multipartBody = "--boundary\r\n"+
|
||||
function make_channel(url) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function contentHandler(metadata, response)
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = null;
|
||||
|
||||
@ -9,7 +10,14 @@ XPCOMUtils.defineLazyGetter(this, "uri", function() {
|
||||
function make_channel(url) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
var multipartBody = "--boundary\r\n\r\nSome text\r\n--boundary\r\n\r\n<?xml version='1.0'?><root/>\r\n--boundary--";
|
||||
@ -17,7 +25,14 @@ var multipartBody = "--boundary\r\n\r\nSome text\r\n--boundary\r\n\r\n<?xml vers
|
||||
function make_channel(url) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function contentHandler(metadata, response)
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = null;
|
||||
|
||||
@ -9,7 +10,14 @@ XPCOMUtils.defineLazyGetter(this, "uri", function() {
|
||||
function make_channel(url) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
var multipartBody = "\r\nSome text\r\n--boundary\r\n\r\n<?xml version='1.0'?><root/>\r\n--boundary--";
|
||||
@ -17,7 +25,14 @@ var multipartBody = "\r\nSome text\r\n--boundary\r\n\r\n<?xml version='1.0'?><ro
|
||||
function make_channel(url) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function contentHandler(metadata, response)
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = new HttpServer();
|
||||
var index = 0;
|
||||
@ -17,8 +18,15 @@ var tests = [
|
||||
function setupChannel(url) {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:" +
|
||||
httpserver.identity.primaryPort + url, "", null);
|
||||
var chan = ios.newChannel2("http://localhost:" +
|
||||
httpserver.identity.primaryPort + url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
return chan;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,14 @@ var cacheUpdateObserver = null;
|
||||
function make_channel(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function make_uri(url) {
|
||||
|
@ -19,7 +19,14 @@ var httpServer = null;
|
||||
function make_channel(url, callback, ctx) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel(url, "", null);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
// Have 2kb response (8 * 2 ^ 8)
|
||||
|
@ -76,8 +76,15 @@ function makeChan(headerIdx, bodyIdx) {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var chan =
|
||||
ios.newChannel("http://localhost:" + httpserv.identity.primaryPort +
|
||||
"/" + headerIdx + "/" + bodyIdx, null, null)
|
||||
ios.newChannel2("http://localhost:" + httpserv.identity.primaryPort +
|
||||
"/" + headerIdx + "/" + bodyIdx,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
|
||||
chan.loadFlags |=
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user