mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1232783 - Convert JS callsites to use open2 within modules/ (r=sicking)
This commit is contained in:
parent
f631460d98
commit
07093baa68
@ -3,7 +3,7 @@
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
const path = "data/test_bug589292.zip";
|
||||
|
||||
@ -11,15 +11,8 @@ function run_test() {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var spec = "jar:" + ios.newFileURI(do_get_file(path)).spec + "!/foo.txt";
|
||||
var channel = ios.newChannel2(spec,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
instr = channel.open();
|
||||
var channel = NetUtil.newChannel({uri: spec, loadUsingSystemPrincipal: true});
|
||||
instr = channel.open2();
|
||||
var val;
|
||||
try {
|
||||
val = channel.contentDisposition;
|
||||
|
@ -5,7 +5,7 @@
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
// Check that reading non existant inner jars results in the right error
|
||||
|
||||
@ -16,31 +16,17 @@ function run_test() {
|
||||
var outerJarBase = "jar:" + ios.newFileURI(file).spec + "!/";
|
||||
var goodSpec = "jar:" + outerJarBase + "inner.jar!/hello";
|
||||
var badSpec = "jar:" + outerJarBase + "jar_that_isnt_in_the.jar!/hello";
|
||||
var goodChannel = ios.newChannel2(goodSpec,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var badChannel = ios.newChannel2(badSpec,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var goodChannel = NetUtil.newChannel({uri: goodSpec, loadUsingSystemPrincipal: true});
|
||||
var badChannel = NetUtil.newChannel({uri: badSpec, loadUsingSystemPrincipal: true});
|
||||
|
||||
try {
|
||||
instr = goodChannel.open();
|
||||
instr = goodChannel.open2();
|
||||
} catch (e) {
|
||||
do_throw("Failed to open file in inner jar");
|
||||
}
|
||||
|
||||
try {
|
||||
instr = badChannel.open();
|
||||
instr = badChannel.open2();
|
||||
do_throw("Failed to report that file doesn't exist");
|
||||
} catch (e) {
|
||||
do_check_true(e.name == "NS_ERROR_FILE_NOT_FOUND");
|
||||
|
@ -5,7 +5,7 @@
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
// Check that the zip cache can expire entries from nested jars
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
@ -13,15 +13,8 @@ var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
|
||||
function open_inner_zip(base, idx) {
|
||||
var spec = "jar:" + base + "inner" + idx + ".zip!/foo";
|
||||
var channel = ios.newChannel2(spec,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var stream = channel.open();
|
||||
var channel = NetUtil.newChannel({uri: spec, loadUsingSystemPrincipal: true});
|
||||
var stream = channel.open2();
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
|
@ -5,7 +5,7 @@
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
// Check that we don't crash on reading a directory entry signature
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
@ -14,17 +14,10 @@ var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
function run_test() {
|
||||
var file = do_get_file("data/test_bug658093.zip");
|
||||
var spec = "jar:" + ios.newFileURI(file).spec + "!/0000";
|
||||
var channel = ios.newChannel2(spec,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var channel = NetUtil.newChannel({uri: spec, loadUsingSystemPrincipal: true});
|
||||
var failed = false;
|
||||
try {
|
||||
var stream = channel.open();
|
||||
var stream = channel.open2();
|
||||
} catch (e) {
|
||||
failed = true;
|
||||
}
|
||||
|
@ -4,23 +4,19 @@ var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
const path = "data/test_bug333423.zip";
|
||||
|
||||
function run_test() {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var spec = "jar:" + ios.newFileURI(do_get_file(path)).spec + "!/";
|
||||
var channel = ios.newChannel2(spec + "file_that_isnt_in.archive",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: spec + "file_that_isnt_in.archive",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
try {
|
||||
instr = channel.open();
|
||||
instr = channel.open2();
|
||||
do_throw("Failed to report that file doesn't exist")
|
||||
} catch (e) {
|
||||
do_check_true(e.name == "NS_ERROR_FILE_NOT_FOUND")
|
||||
|
Loading…
Reference in New Issue
Block a user