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"].
|
||||
getService(Ci.nsIVersionComparator);
|
||||
|
||||
const { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});
|
||||
|
||||
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
|
||||
// `uri` and returns content string.
|
||||
function readURI(uri) {
|
||||
let ioservice = Cc['@mozilla.org/network/io-service;1'].
|
||||
getService(Ci.nsIIOService);
|
||||
let channel = NetUtil.newChannel({
|
||||
uri: NetUtil.newURI(uri, 'UTF-8'),
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
|
||||
let channel = ioservice.newChannel2(uri,
|
||||
'UTF-8',
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
systemPrincipal,
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
let stream = channel.open();
|
||||
let stream = channel.open2();
|
||||
|
||||
let cstream = Cc['@mozilla.org/intl/converter-input-stream;1'].
|
||||
createInstance(Ci.nsIConverterInputStream);
|
||||
|
@ -81,7 +81,7 @@ function readURISync(uri, charset) {
|
||||
let channel = NetUtil.newChannel({
|
||||
uri: NetUtil.newURI(uri, charset),
|
||||
loadUsingSystemPrincipal: true});
|
||||
let stream = channel.open();
|
||||
let stream = channel.open2();
|
||||
|
||||
let count = stream.available();
|
||||
let data = NetUtil.readInputStreamToString(stream, count, { charset : charset });
|
||||
|
Loading…
Reference in New Issue
Block a user