Bug 1242857 - Use channel.asyncOpen2() within toolkit/components/places. r=sicking, r=mak

--HG--
extra : rebase_source : 164a43d5195027d37df49d6e105ebf29cde50a83
This commit is contained in:
Christoph Kerschbaumer 2016-03-18 10:58:58 -07:00
Родитель 8be05b1b22
Коммит 5cfc7ef5a9
2 изменённых файлов: 10 добавлений и 6 удалений

Просмотреть файл

@ -208,14 +208,13 @@ BookmarkImporter.prototype = {
let uri = NetUtil.newURI(spec);
let channel = NetUtil.newChannel({
uri,
loadingPrincipal: Services.scriptSecurityManager.createCodebasePrincipal(uri, {}),
contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_XMLHTTPREQUEST
uri: uri,
loadUsingSystemPrincipal: true
});
let streamLoader = Cc["@mozilla.org/network/stream-loader;1"]
.createInstance(Ci.nsIStreamLoader);
streamLoader.init(streamObserver);
channel.asyncOpen(streamLoader, channel);
channel.asyncOpen2(streamLoader);
});
},

Просмотреть файл

@ -528,9 +528,14 @@ Livemark.prototype = {
// cancel the channel.
let loadgroup = Cc["@mozilla.org/network/load-group;1"].
createInstance(Ci.nsILoadGroup);
// Creating a CodeBasePrincipal and using it as the loadingPrincipal
// is *not* desired and is only tolerated within this file.
// TODO: Find the right OriginAttributes and pass something other
// than {} to .createCodeBasePrincipal().
let channel = NetUtil.newChannel({
uri: this.feedURI.spec,
uri: this.feedURI,
loadingPrincipal: Services.scriptSecurityManager.createCodebasePrincipal(this.feedURI, {}),
securityFlags: Ci.nsILoadInfo.SEC_REQUIRE_SAME_ORIGIN_DATA_IS_BLOCKED,
contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_XMLHTTPREQUEST
}).QueryInterface(Ci.nsIHttpChannel);
channel.loadGroup = loadgroup;
@ -542,7 +547,7 @@ Livemark.prototype = {
// Stream the result to the feed parser with this listener
let listener = new LivemarkLoadListener(this);
channel.notificationCallbacks = listener;
channel.asyncOpen(listener, null);
channel.asyncOpen2(listener);
this.loadGroup = loadgroup;
}