mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Backed out changeset 7459e0c97939 (bug 1234596) for test_protocolproxyservice.js failures in xpcshell CLOSED TREE
--HG-- extra : commitid : FXbwzdhNjgj
This commit is contained in:
parent
88f6089e06
commit
c9ba10fdd9
@ -11,7 +11,7 @@ load(_HTTPD_JS_PATH.path);
|
||||
// if these tests fail, we'll want the debug output
|
||||
DEBUG = true;
|
||||
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
/**
|
||||
* Constructs a new nsHttpServer instance. This function is intended to
|
||||
@ -32,8 +32,19 @@ function createServer()
|
||||
*/
|
||||
function makeChannel(url)
|
||||
{
|
||||
return NetUtil.newChannel({uri: url, loadUsingSystemPrincipal: true})
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -286,7 +297,7 @@ function runHttpTests(testArray, done)
|
||||
}
|
||||
|
||||
listener._channel = ch;
|
||||
ch.asyncOpen2(listener);
|
||||
ch.asyncOpen(listener, null);
|
||||
}
|
||||
|
||||
/** Index of the test being run. */
|
||||
|
@ -233,7 +233,7 @@ function HTTPTestLoader(path, start, stop)
|
||||
this._stop = stop;
|
||||
|
||||
var channel = makeChannel(path);
|
||||
channel.asyncOpen2(this);
|
||||
channel.asyncOpen(this, null);
|
||||
}
|
||||
HTTPTestLoader.prototype =
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
var h2Port;
|
||||
@ -122,10 +123,17 @@ function addCertFromFile(certdb, filename, trustString) {
|
||||
}
|
||||
|
||||
function makeChan(origin) {
|
||||
return NetUtil.newChannel({
|
||||
uri: origin + "altsvc-test",
|
||||
loadUsingSystemPrincipal: true
|
||||
}).QueryInterface(Ci.nsIHttpChannel);
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel2(origin + "altsvc-test",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER).QueryInterface(Ci.nsIHttpChannel);
|
||||
|
||||
return chan;
|
||||
}
|
||||
|
||||
var origin;
|
||||
@ -204,7 +212,7 @@ function doTest()
|
||||
}
|
||||
chan.loadFlags = Ci.nsIRequest.LOAD_FRESH_CONNECTION |
|
||||
Ci.nsIChannel.LOAD_INITIAL_DOCUMENT_URI;
|
||||
chan.asyncOpen2(listener);
|
||||
chan.asyncOpen(listener, null);
|
||||
}
|
||||
|
||||
// xaltsvc is overloaded to do two things..
|
||||
|
@ -1,5 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = new HttpServer();
|
||||
var currentTestIndex = 0;
|
||||
@ -45,17 +45,24 @@ var domBranch;
|
||||
|
||||
function setupChannel(url)
|
||||
{
|
||||
return NetUtil.newChannel({
|
||||
uri: "http://localhost:" + port + url,
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
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;
|
||||
}
|
||||
|
||||
function startIter()
|
||||
{
|
||||
var channel = setupChannel(tests[currentTestIndex].url);
|
||||
channel.asyncOpen2(new ChannelListener(completeIter,
|
||||
channel, tests[currentTestIndex].flags));
|
||||
channel.asyncOpen(new ChannelListener(completeIter,
|
||||
channel, tests[currentTestIndex].flags), null);
|
||||
}
|
||||
|
||||
function completeIter(request, data, ctx)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
"use strict";
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = null;
|
||||
const noRedirectURI = "/content";
|
||||
@ -35,14 +35,21 @@ function run_test()
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
prefs.setBoolPref("network.http.prompt-temp-redirect", false);
|
||||
|
||||
var chan = NetUtil.newChannel({
|
||||
uri: "http://localhost:" + httpserver.identity.primaryPort + "/redirect",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
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);
|
||||
|
||||
chan.asyncOpen2(new ChannelListener(dummyHandler, null));
|
||||
chan.asyncOpen(new ChannelListener(dummyHandler, null), null);
|
||||
|
||||
do_test_pending();
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function getLinkFile()
|
||||
{
|
||||
@ -94,13 +94,15 @@ RequestObserver.prototype = {
|
||||
|
||||
function test_cancel()
|
||||
{
|
||||
var chan = NetUtil.newChannel({
|
||||
uri: linkURI,
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
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.asyncOpen2(new RequestObserver(linkURI, newURI, do_test_finished));
|
||||
chan.asyncOpen(new RequestObserver(linkURI, newURI, do_test_finished), null);
|
||||
do_check_true(chan.isPending());
|
||||
chan.cancel(Cr.NS_ERROR_ABORT);
|
||||
do_check_true(chan.isPending());
|
||||
@ -116,13 +118,16 @@ function run_test()
|
||||
linkURI = ios.newFileURI(link);
|
||||
|
||||
do_test_pending();
|
||||
var chan = NetUtil.newChannel({
|
||||
uri: linkURI,
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
|
||||
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);
|
||||
chan.asyncOpen2(new RequestObserver(linkURI, newURI, test_cancel));
|
||||
chan.asyncOpen(new RequestObserver(linkURI, newURI, test_cancel), null);
|
||||
do_check_true(chan.isPending());
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const sentCookieVal = "foo=bar";
|
||||
const responseBody = "response body";
|
||||
@ -64,11 +64,16 @@ 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 = NetUtil.newChannel({
|
||||
uri: preRedirectURL,
|
||||
loadUsingSystemPrincipal: true
|
||||
}).QueryInterface(Ci.nsIHttpChannel)
|
||||
.QueryInterface(Ci.nsIHttpChannelInternal);
|
||||
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;
|
||||
|
||||
// Set a cookie on one of the URIs. It doesn't matter which one, since
|
||||
@ -79,7 +84,7 @@ function run_test()
|
||||
setCookieString(postRedirectURI, null, sentCookieVal, chan);
|
||||
|
||||
// Load the pre-redirect URI.
|
||||
chan.asyncOpen2(new ChannelListener(finish_test, null));
|
||||
chan.asyncOpen(new ChannelListener(finish_test, null), null);
|
||||
do_test_pending();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const VALUE_HDR_NAME = "X-HTTP-VALUE-HEADER";
|
||||
const VARY_HDR_NAME = "X-HTTP-VARY-HEADER";
|
||||
@ -8,10 +8,19 @@ const CACHECTRL_HDR_NAME = "X-CACHE-CONTROL-HEADER";
|
||||
var httpserver = null;
|
||||
|
||||
function make_channel(flags, vary, value) {
|
||||
var chan = NetUtil.newChannel({
|
||||
uri: "http://localhost:" + httpserver.identity.primaryPort + "/bug633743",
|
||||
loadUsingSystemPrincipal: true
|
||||
}).QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -58,7 +67,7 @@ Test.prototype = {
|
||||
if (this._cacheHdr)
|
||||
channel.setRequestHeader(CACHECTRL_HDR_NAME, this._cacheHdr, false);
|
||||
|
||||
channel.asyncOpen2(this);
|
||||
channel.asyncOpen(this, null);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
//
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
do_get_profile();
|
||||
|
||||
@ -21,10 +21,18 @@ function repeatToLargerThan1K(data) {
|
||||
}
|
||||
|
||||
function setupChannel(suffix, value) {
|
||||
var chan = NetUtil.newChannel({
|
||||
uri: "http://localhost:" + httpserver.identity.primaryPort + suffix,
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
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);
|
||||
|
||||
@ -101,7 +109,9 @@ function InitializeCacheDevices(memDevice, diskDevice) {
|
||||
}
|
||||
}
|
||||
var channel = setupChannel("/bug650995", "Initial value");
|
||||
channel.asyncOpen2(new ChannelListener(nextTest, null));
|
||||
channel.asyncOpen(new ChannelListener(
|
||||
nextTest, null),
|
||||
null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,14 +128,14 @@ function TestCacheEntrySize(setSizeFunc, firstRequest, secondRequest, secondExpe
|
||||
this.start = function() {
|
||||
setSizeFunc();
|
||||
var channel = setupChannel("/bug650995", firstRequest);
|
||||
channel.asyncOpen2(new ChannelListener(this.initialLoad, this));
|
||||
channel.asyncOpen(new ChannelListener(this.initialLoad, this), null);
|
||||
},
|
||||
|
||||
this.initialLoad = function(request, data, ctx) {
|
||||
do_check_eq(firstRequest, data);
|
||||
var channel = setupChannel("/bug650995", secondRequest);
|
||||
do_execute_soon(function() {
|
||||
channel.asyncOpen2(new ChannelListener(ctx.testAndTriggerNext, ctx));
|
||||
channel.asyncOpen(new ChannelListener(ctx.testAndTriggerNext, ctx), null);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
var httpServer = null;
|
||||
// Need to randomize, because apparently no one clears our cache
|
||||
@ -14,7 +13,16 @@ var cacheUpdateObserver = null;
|
||||
var systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
|
||||
|
||||
function make_channel(url, callback, ctx) {
|
||||
return NetUtil.newChannel({uri: url, loadUsingSystemPrincipal: true});
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
systemPrincipal,
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
function make_uri(url) {
|
||||
@ -97,7 +105,7 @@ function run_test()
|
||||
var chan = make_channel(randomURI);
|
||||
var chanac = chan.QueryInterface(Ci.nsIApplicationCacheChannel);
|
||||
chanac.chooseApplicationCache = true;
|
||||
chan.asyncOpen2(new ChannelListener(finish_test));
|
||||
chan.asyncOpen(new ChannelListener(finish_test), null);
|
||||
});
|
||||
}}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Test getLocalHost/getLocalPort and getRemoteHost/getRemotePort.
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = new HttpServer();
|
||||
httpserver.start(-1);
|
||||
@ -46,10 +46,17 @@ CheckGetHostListener.prototype = {
|
||||
}
|
||||
|
||||
function make_channel(url) {
|
||||
return NetUtil.newChannel({
|
||||
uri: url,
|
||||
loadUsingSystemPrincipal: true
|
||||
}).QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel2(url,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||
}
|
||||
|
||||
function test_handler(metadata, response) {
|
||||
@ -63,6 +70,6 @@ function run_test() {
|
||||
httpserver.registerPathHandler("/testdir", test_handler);
|
||||
|
||||
var channel = make_channel("http://localhost:" + PORT + "/testdir");
|
||||
channel.asyncOpen2(new CheckGetHostListener());
|
||||
channel.asyncOpen(new CheckGetHostListener(), null);
|
||||
do_test_pending();
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
// Note: sets Cc and Ci variables
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
return "http://localhost:" + httpserver.identity.primaryPort;
|
||||
@ -64,28 +64,33 @@ function setup_test() {
|
||||
setOK = channel.getRequestHeader("MergeWithEmpty");
|
||||
do_check_eq(setOK, "foo");
|
||||
|
||||
var uri = NetUtil.newURI("http://foo1.invalid:80");
|
||||
var uri = ios.newURI("http://foo1.invalid:80", null, null);
|
||||
channel.referrer = uri;
|
||||
do_check_true(channel.referrer.equals(uri));
|
||||
setOK = channel.getRequestHeader("Referer");
|
||||
do_check_eq(setOK, "http://foo1.invalid/");
|
||||
|
||||
uri = NetUtil.newURI("http://foo2.invalid:90/bar");
|
||||
uri = ios.newURI("http://foo2.invalid:90/bar", null, null);
|
||||
channel.referrer = uri;
|
||||
setOK = channel.getRequestHeader("Referer");
|
||||
do_check_eq(setOK, "http://foo2.invalid:90/bar");
|
||||
|
||||
// ChannelListener defined in head_channels.js
|
||||
channel.asyncOpen2(new ChannelListener(checkRequestResponse, channel));
|
||||
channel.asyncOpen(new ChannelListener(checkRequestResponse, channel), null);
|
||||
|
||||
if (dbg) { print("============== setup_test: out"); }
|
||||
}
|
||||
|
||||
function setupChannel(path) {
|
||||
var chan = NetUtil.newChannel({
|
||||
uri: URL + path,
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
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;
|
||||
|
@ -22,7 +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/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
return "http://localhost:" + httpserver.identity.primaryPort;
|
||||
@ -65,16 +65,22 @@ function run_test_number(num)
|
||||
|
||||
var channel = setupChannel(testPath);
|
||||
flags = test_flags[num]; // OK if flags undefined for test
|
||||
channel.asyncOpen2(new ChannelListener(eval("completeTest" + num),
|
||||
channel, flags));
|
||||
channel.asyncOpen(new ChannelListener(eval("completeTest" + num),
|
||||
channel, flags), null);
|
||||
}
|
||||
|
||||
function setupChannel(url)
|
||||
{
|
||||
var chan = NetUtil.newChannel({
|
||||
uri: URL + url,
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
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;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
// suspends future notifications correctly.
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
return "http://localhost:" + httpserv.identity.primaryPort;
|
||||
@ -55,8 +55,16 @@ var listener = {
|
||||
};
|
||||
|
||||
function makeChan(url) {
|
||||
return NetUtil.newChannel({uri: url, loadUsingSystemPrincipal: true})
|
||||
.QueryInterface(Ci.nsIHttpChannel);
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
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;
|
||||
}
|
||||
|
||||
var httpserv = null;
|
||||
@ -68,7 +76,7 @@ function run_test() {
|
||||
|
||||
var chan = makeChan(URL + "/woo");
|
||||
chan.QueryInterface(Ci.nsIRequest);
|
||||
chan.asyncOpen2(listener);
|
||||
chan.asyncOpen(listener, null);
|
||||
|
||||
do_test_pending();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
// run_myipaddress_test();
|
||||
// run_failed_script_test();
|
||||
// run_isresolvable_test();
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
@ -172,10 +172,14 @@ resolveCallback.prototype = {
|
||||
};
|
||||
|
||||
function run_filter_test() {
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
// Verify initial state
|
||||
var cb = new resolveCallback();
|
||||
@ -198,10 +202,14 @@ function filter_test0_1(pi) {
|
||||
|
||||
var cb = new resolveCallback();
|
||||
cb.nextFunction = filter_test0_2;
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var req = pps.asyncResolve(channel, 0, cb);
|
||||
}
|
||||
|
||||
@ -214,10 +222,14 @@ function filter_test0_2(pi)
|
||||
|
||||
var cb = new resolveCallback();
|
||||
cb.nextFunction = filter_test0_3;
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var req = pps.asyncResolve(channel, 0, cb);
|
||||
}
|
||||
|
||||
@ -232,10 +244,14 @@ function filter_test0_3(pi)
|
||||
|
||||
var cb = new resolveCallback();
|
||||
cb.nextFunction = filter_test0_4;
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var req = pps.asyncResolve(channel, 0, cb);
|
||||
}
|
||||
|
||||
@ -248,10 +264,14 @@ function filter_test0_4(pi)
|
||||
pps.registerChannelFilter(filter03, 10);
|
||||
var cb = new resolveCallback();
|
||||
cb.nextFunction = filter_test0_5;
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var req = pps.asyncResolve(channel, 0, cb);
|
||||
}
|
||||
|
||||
@ -333,10 +353,14 @@ function run_filter_test2() {
|
||||
|
||||
var cb = new resolveCallback();
|
||||
cb.nextFunction = filter_test1_1;
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var req = pps.asyncResolve(channel, 0, cb);
|
||||
}
|
||||
|
||||
@ -348,10 +372,14 @@ function filter_test1_1(pi) {
|
||||
|
||||
var cb = new resolveCallback();
|
||||
cb.nextFunction = filter_test1_2;
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var req = pps.asyncResolve(channel, 0, cb);
|
||||
}
|
||||
|
||||
@ -364,10 +392,14 @@ function filter_test1_2(pi) {
|
||||
|
||||
var cb = new resolveCallback();
|
||||
cb.nextFunction = filter_test1_3;
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var req = pps.asyncResolve(channel, 0, cb);
|
||||
}
|
||||
|
||||
@ -379,10 +411,15 @@ function filter_test1_3(pi) {
|
||||
var filter_3_1;
|
||||
|
||||
function run_filter_test3() {
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
// Push a filter and verify the results asynchronously
|
||||
|
||||
filter_3_1 = new TestFilter("http", "foo", 8080, 0, 10);
|
||||
@ -400,10 +437,15 @@ function filter_test3_1(pi) {
|
||||
}
|
||||
|
||||
function run_pref_test() {
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
// Verify 'direct' setting
|
||||
|
||||
prefs.setIntPref("network.proxy.type", 0);
|
||||
@ -422,10 +464,14 @@ function pref_test1_1(pi)
|
||||
|
||||
var cb = new resolveCallback();
|
||||
cb.nextFunction = pref_test1_2;
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var req = pps.asyncResolve(channel, 0, cb);
|
||||
}
|
||||
|
||||
@ -440,10 +486,14 @@ function pref_test1_2(pi)
|
||||
|
||||
var cb = new resolveCallback();
|
||||
cb.nextFunction = pref_test1_3;
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var req = pps.asyncResolve(channel, 0, cb);
|
||||
}
|
||||
|
||||
@ -460,10 +510,14 @@ function pref_test1_3(pi)
|
||||
|
||||
var cb = new resolveCallback();
|
||||
cb.nextFunction = pref_test1_4;
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var req = pps.asyncResolve(channel, 0, cb);
|
||||
}
|
||||
|
||||
@ -521,10 +575,15 @@ function run_pac_test() {
|
||||
'function FindProxyForURL(url, host) {' +
|
||||
' return "PROXY foopy:8080; DIRECT";' +
|
||||
'}';
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
// Configure PAC
|
||||
|
||||
prefs.setIntPref("network.proxy.type", 2);
|
||||
@ -537,10 +596,15 @@ function run_pac2_test() {
|
||||
'function FindProxyForURL(url, host) {' +
|
||||
' return "HTTPS foopy:8080; DIRECT";' +
|
||||
'}';
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
// Configure PAC
|
||||
originalTLSProxy = prefs.getBoolPref("network.proxy.proxy_over_tls");
|
||||
|
||||
@ -555,10 +619,15 @@ function run_pac3_test() {
|
||||
'function FindProxyForURL(url, host) {' +
|
||||
' return "HTTPS foopy:8080; DIRECT";' +
|
||||
'}';
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
// Configure PAC
|
||||
prefs.setCharPref("network.proxy.autoconfig_url", pac);
|
||||
prefs.setBoolPref("network.proxy.proxy_over_tls", false);
|
||||
@ -593,10 +662,14 @@ function run_pac4_test() {
|
||||
' && myAppOrigin() == "' + appOrigin + '")' +
|
||||
' return "PROXY foopy:8080; DIRECT";' +
|
||||
'}';
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
channel.notificationCallbacks =
|
||||
AppsUtils.createLoadContext(appId, isInBrowser);
|
||||
|
||||
@ -640,10 +713,15 @@ TestResolveCancelationCallback.prototype = {
|
||||
};
|
||||
|
||||
function run_pac_cancel_test() {
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
// Configure PAC
|
||||
var pac = 'data:text/plain,' +
|
||||
'function FindProxyForURL(url, host) {' +
|
||||
@ -683,10 +761,15 @@ function check_host_filters_cb()
|
||||
function check_host_filter(i) {
|
||||
var uri;
|
||||
dump("*** uri=" + hostList[i] + " bShouldBeFiltered=" + bShouldBeFiltered + "\n");
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: hostList[i],
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2(hostList[i],
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
var cb = new resolveCallback();
|
||||
cb.nextFunction = host_filter_cb;
|
||||
var req = pps.asyncResolve(channel, 0, cb);
|
||||
@ -789,10 +872,15 @@ function run_myipaddress_test()
|
||||
|
||||
// no traffic to this IP is ever sent, it is just a public IP that
|
||||
// does not require DNS to determine a route.
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://192.0.43.10/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://192.0.43.10/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
prefs.setIntPref("network.proxy.type", 2);
|
||||
prefs.setCharPref("network.proxy.autoconfig_url", pac);
|
||||
|
||||
@ -827,10 +915,14 @@ function run_myipaddress_test_2()
|
||||
' return "PROXY " + myaddr + ":5678";' +
|
||||
'}';
|
||||
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
prefs.setIntPref("network.proxy.type", 2);
|
||||
prefs.setCharPref("network.proxy.autoconfig_url", pac);
|
||||
|
||||
@ -859,10 +951,15 @@ function run_failed_script_test()
|
||||
var pac = 'data:text/plain,' +
|
||||
'\nfor(;\n';
|
||||
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
prefs.setIntPref("network.proxy.type", 2);
|
||||
prefs.setCharPref("network.proxy.autoconfig_url", pac);
|
||||
|
||||
@ -888,11 +985,15 @@ function failed_script_callback(pi)
|
||||
obs = obs.QueryInterface(Components.interfaces.nsIObserverService);
|
||||
obs.addObserver(directFilterListener, "http-on-modify-request", false);
|
||||
|
||||
var chan = NetUtil.newChannel({
|
||||
uri: "http://127.0.0.1:7247",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
chan.asyncOpen2(directFilterListener);
|
||||
var chan = ios.newChannel2("http://127.0.0.1:7247",
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
chan.asyncOpen(directFilterListener, chan);
|
||||
}
|
||||
|
||||
var directFilterListener = {
|
||||
@ -937,10 +1038,15 @@ function run_isresolvable_test()
|
||||
' return "PROXY 127.0.0.1:1234";' +
|
||||
'}';
|
||||
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "http://www.mozilla.org/",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannel2("http://www.mozilla.org/",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
prefs.setIntPref("network.proxy.type", 2);
|
||||
prefs.setCharPref("network.proxy.autoconfig_url", pac);
|
||||
|
||||
|
@ -1,13 +1,19 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpServer = null;
|
||||
|
||||
function make_channel(url, callback, ctx) {
|
||||
return NetUtil.newChannel({
|
||||
uri: url,
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
const responseBody = "response body";
|
||||
@ -48,6 +54,6 @@ function run_test()
|
||||
var chan = make_channel("http://localhost:" +
|
||||
httpServer.identity.primaryPort + "/content");
|
||||
chan.notificationCallbacks = nc;
|
||||
chan.asyncOpen2(new ChannelListener(finish_test, null, CL_EXPECT_FAILURE));
|
||||
chan.asyncOpen(new ChannelListener(finish_test, null, CL_EXPECT_FAILURE), null);
|
||||
do_test_pending();
|
||||
}
|
||||
|
@ -1,13 +1,19 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpServer = null;
|
||||
|
||||
function make_channel(url, callback, ctx) {
|
||||
return NetUtil.newChannel({
|
||||
uri: url,
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
const responseBody = "response body";
|
||||
@ -49,7 +55,7 @@ function run_test()
|
||||
|
||||
var chan = make_channel("http://localhost:" +
|
||||
httpServer.identity.primaryPort + "/content");
|
||||
chan.asyncOpen2(new ChannelListener(finish_test, null, CL_EXPECT_FAILURE));
|
||||
chan.asyncOpen(new ChannelListener(finish_test, null, CL_EXPECT_FAILURE), null);
|
||||
chan.cancel(Cr.NS_BINDING_ABORTED);
|
||||
do_test_pending();
|
||||
}
|
||||
|
@ -1,10 +1,19 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpServer = null;
|
||||
|
||||
function make_channel(url, callback, ctx) {
|
||||
return NetUtil.newChannel({uri: url, loadUsingSystemPrincipal: true});
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
const responseBody = "response body";
|
||||
@ -38,6 +47,6 @@ function run_test()
|
||||
|
||||
var chan = make_channel("http://localhost:" +
|
||||
httpServer.identity.primaryPort + "/content");
|
||||
chan.asyncOpen2(new ChannelListener(finish_test, null));
|
||||
chan.asyncOpen(new ChannelListener(finish_test, null), null);
|
||||
do_test_pending();
|
||||
}
|
||||
|
@ -1,10 +1,19 @@
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var httpserver = null;
|
||||
|
||||
function make_channel(url, callback, ctx) {
|
||||
return NetUtil.newChannel({uri: url, loadUsingSystemPrincipal: true});
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
return ios.newChannel2(url,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
const responseBody = "response body";
|
||||
@ -67,13 +76,13 @@ function finish_test() {
|
||||
function start_cache_read() {
|
||||
var chan = make_channel("http://localhost:" +
|
||||
httpserver.identity.primaryPort + "/cached/test.gz");
|
||||
chan.asyncOpen2(new ChannelListener(finish_test, null));
|
||||
chan.asyncOpen(new ChannelListener(finish_test, null), null);
|
||||
}
|
||||
|
||||
function start_canceler() {
|
||||
var chan = make_channel("http://localhost:" +
|
||||
httpserver.identity.primaryPort + "/cached/test.gz");
|
||||
chan.asyncOpen2(new Canceler(start_cache_read));
|
||||
chan.asyncOpen(new Canceler(start_cache_read), null);
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
@ -83,6 +92,6 @@ function run_test() {
|
||||
|
||||
var chan = make_channel("http://localhost:" +
|
||||
httpserver.identity.primaryPort + "/cached/test.gz");
|
||||
chan.asyncOpen2(new ChannelListener(start_canceler, null));
|
||||
chan.asyncOpen(new ChannelListener(start_canceler, null), null);
|
||||
do_test_pending();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user