mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1087730: Make JS callers of ios.newChannel call ios.newChannel2 in extensions/ (r=mmc)
This commit is contained in:
parent
63c60857b5
commit
80e49c0256
@ -28,6 +28,7 @@ const Cu = Components.utils;
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
var httpserver = new HttpServer();
|
||||
|
||||
var cookieSetPath = "/setcookie";
|
||||
@ -94,7 +95,14 @@ function cookieCheckHandler(metadata, response) {
|
||||
|
||||
function setupChannel(path) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel("http://localhost:4444" + path, "", null);
|
||||
var chan = ios.newChannel2("http://localhost:4444" + path,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
chan.notificationCallbacks = cookies[counter].loadContext;
|
||||
chan.QueryInterface(Ci.nsIHttpChannel);
|
||||
return chan;
|
||||
|
@ -29,8 +29,22 @@ function do_run_test() {
|
||||
var spec2 = "http://bar.com/bar.html";
|
||||
var uri1 = NetUtil.newURI(spec1);
|
||||
var uri2 = NetUtil.newURI(spec2);
|
||||
var channel1 = NetUtil.newChannel(uri1);
|
||||
var channel2 = NetUtil.newChannel(uri2);
|
||||
var channel1 = NetUtil.newChannel2(uri1,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var channel2 = NetUtil.newChannel2(uri2,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
// Force the channel URI to be used when determining the originating URI of
|
||||
// the channel.
|
||||
|
@ -19,7 +19,14 @@ function finish_test() {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,22 @@ function run_test() {
|
||||
var spec2 = "http://bar.com/bar.html";
|
||||
var uri1 = NetUtil.newURI(spec1);
|
||||
var uri2 = NetUtil.newURI(spec2);
|
||||
var channel1 = NetUtil.newChannel(uri1);
|
||||
var channel2 = NetUtil.newChannel(uri2);
|
||||
var channel1 = NetUtil.newChannel2(uri1,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var channel2 = NetUtil.newChannel2(uri2,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
// test with cookies enabled
|
||||
Services.prefs.setIntPref("network.cookie.cookieBehavior", 0);
|
||||
|
@ -29,8 +29,22 @@ function do_run_test() {
|
||||
var spec2 = "http://bar.com/bar.html";
|
||||
var uri1 = NetUtil.newURI(spec1);
|
||||
var uri2 = NetUtil.newURI(spec2);
|
||||
var channel1 = NetUtil.newChannel(uri1);
|
||||
var channel2 = NetUtil.newChannel(uri2);
|
||||
var channel1 = NetUtil.newChannel2(uri1,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var channel2 = NetUtil.newChannel2(uri2,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
// Force the channel URI to be used when determining the originating URI of
|
||||
// the channel.
|
||||
|
Loading…
Reference in New Issue
Block a user