mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1239107 - Convert JS tests to use open2 within addon-sdk/ (r=sicking)
This commit is contained in:
parent
ca51f1ac3d
commit
8f772c5f42
@ -26,7 +26,7 @@ const appInfo = Cc["@mozilla.org/xre/app-info;1"].
|
||||
const vc = Cc["@mozilla.org/xpcom/version-comparator;1"].
|
||||
getService(Ci.nsIVersionComparator);
|
||||
|
||||
const { Services } = Cu.import("resource://gre/modules/Services.jsm");
|
||||
const { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
const REASON = [ 'unknown', 'startup', 'shutdown', 'enable', 'disable',
|
||||
'install', 'uninstall', 'upgrade', 'downgrade' ];
|
||||
@ -41,17 +41,11 @@ var nukeTimer = null;
|
||||
// Utility function that synchronously reads local resource from the given
|
||||
// `uri` and returns content string.
|
||||
function readURI(uri) {
|
||||
let ioservice = Cc['@mozilla.org/network/io-service;1'].
|
||||
getService(Ci.nsIIOService);
|
||||
let channel = ioservice.newChannel2(uri,
|
||||
'UTF-8',
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
let stream = channel.open();
|
||||
let channel = NetUtil.newChannel({
|
||||
uri: NetUtil.newURI(uri, "UTF-8"),
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
let stream = channel.open2();
|
||||
|
||||
let cstream = Cc['@mozilla.org/intl/converter-input-stream;1'].
|
||||
createInstance(Ci.nsIConverterInputStream);
|
||||
|
@ -26,7 +26,7 @@ const appInfo = Cc["@mozilla.org/xre/app-info;1"].
|
||||
const vc = Cc["@mozilla.org/xpcom/version-comparator;1"].
|
||||
getService(Ci.nsIVersionComparator);
|
||||
|
||||
const { Services } = Cu.import("resource://gre/modules/Services.jsm");
|
||||
const { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
const REASON = [ 'unknown', 'startup', 'shutdown', 'enable', 'disable',
|
||||
'install', 'uninstall', 'upgrade', 'downgrade' ];
|
||||
@ -41,17 +41,11 @@ var nukeTimer = null;
|
||||
// Utility function that synchronously reads local resource from the given
|
||||
// `uri` and returns content string.
|
||||
function readURI(uri) {
|
||||
let ioservice = Cc['@mozilla.org/network/io-service;1'].
|
||||
getService(Ci.nsIIOService);
|
||||
let channel = ioservice.newChannel2(uri,
|
||||
'UTF-8',
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
let stream = channel.open();
|
||||
let channel = NetUtil.newChannel({
|
||||
uri: NetUtil.newURI(uri, "UTF-8"),
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
let stream = channel.open2();
|
||||
|
||||
let cstream = Cc['@mozilla.org/intl/converter-input-stream;1'].
|
||||
createInstance(Ci.nsIConverterInputStream);
|
||||
|
@ -7,7 +7,7 @@ const { Cc, Ci, Cm, Cr } = require("chrome");
|
||||
const { isCIDRegistered } = Cm.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
const { Class } = require("sdk/core/heritage");
|
||||
const { Loader } = require("sdk/test/loader");
|
||||
const { Services } = require("resource://gre/modules/Services.jsm");
|
||||
const { NetUtil } = require("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
exports['test Unknown implements nsISupports'] = function(assert) {
|
||||
let actual = xpcom.Unknown();
|
||||
@ -168,14 +168,11 @@ function testRegister(assert, text) {
|
||||
Ci.nsIAboutModule.ALLOW_SCRIPT
|
||||
);
|
||||
|
||||
var aboutURI = ios.newURI("about:boop", null, null);
|
||||
var channel = ios.newChannelFromURI2(aboutURI,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var iStream = channel.open();
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: "about:boop",
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var iStream = channel.open2();
|
||||
var siStream = Cc['@mozilla.org/scriptableinputstream;1']
|
||||
.createInstance(Ci.nsIScriptableInputStream);
|
||||
siStream.init(iStream);
|
||||
|
Loading…
Reference in New Issue
Block a user