mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1241561 - Convert addon-sdk to use .open2() (r=sicking)
This commit is contained in:
parent
4ed97ebe1f
commit
26b22a9478
18
addon-sdk/source/app-extension/bootstrap.js
vendored
18
addon-sdk/source/app-extension/bootstrap.js
vendored
@ -26,6 +26,8 @@ const appInfo = Cc["@mozilla.org/xre/app-info;1"].
|
|||||||
const vc = Cc["@mozilla.org/xpcom/version-comparator;1"].
|
const vc = Cc["@mozilla.org/xpcom/version-comparator;1"].
|
||||||
getService(Ci.nsIVersionComparator);
|
getService(Ci.nsIVersionComparator);
|
||||||
|
|
||||||
|
const { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});
|
||||||
|
|
||||||
const Startup = Cu.import("resource://gre/modules/sdk/system/Startup.js", {}).exports;
|
const Startup = Cu.import("resource://gre/modules/sdk/system/Startup.js", {}).exports;
|
||||||
|
|
||||||
|
|
||||||
@ -48,18 +50,12 @@ function setResourceSubstitution(domain, uri) {
|
|||||||
// Utility function that synchronously reads local resource from the given
|
// Utility function that synchronously reads local resource from the given
|
||||||
// `uri` and returns content string.
|
// `uri` and returns content string.
|
||||||
function readURI(uri) {
|
function readURI(uri) {
|
||||||
let ioservice = Cc['@mozilla.org/network/io-service;1'].
|
let channel = NetUtil.newChannel({
|
||||||
getService(Ci.nsIIOService);
|
uri: NetUtil.newURI(uri, 'UTF-8'),
|
||||||
|
loadUsingSystemPrincipal: true
|
||||||
|
});
|
||||||
|
|
||||||
let channel = ioservice.newChannel2(uri,
|
let stream = channel.open2();
|
||||||
'UTF-8',
|
|
||||||
null,
|
|
||||||
null, // aLoadingNode
|
|
||||||
systemPrincipal,
|
|
||||||
null, // aTriggeringPrincipal
|
|
||||||
Ci.nsILoadInfo.SEC_NORMAL,
|
|
||||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
|
||||||
let stream = channel.open();
|
|
||||||
|
|
||||||
let cstream = Cc['@mozilla.org/intl/converter-input-stream;1'].
|
let cstream = Cc['@mozilla.org/intl/converter-input-stream;1'].
|
||||||
createInstance(Ci.nsIConverterInputStream);
|
createInstance(Ci.nsIConverterInputStream);
|
||||||
|
@ -81,7 +81,7 @@ function readURISync(uri, charset) {
|
|||||||
let channel = NetUtil.newChannel({
|
let channel = NetUtil.newChannel({
|
||||||
uri: NetUtil.newURI(uri, charset),
|
uri: NetUtil.newURI(uri, charset),
|
||||||
loadUsingSystemPrincipal: true});
|
loadUsingSystemPrincipal: true});
|
||||||
let stream = channel.open();
|
let stream = channel.open2();
|
||||||
|
|
||||||
let count = stream.available();
|
let count = stream.available();
|
||||||
let data = NetUtil.readInputStreamToString(stream, count, { charset : charset });
|
let data = NetUtil.readInputStreamToString(stream, count, { charset : charset });
|
||||||
|
Loading…
Reference in New Issue
Block a user