зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1223231 - Use channel.asyncOpen2 in devtools/client/shared/AppCacheUtils.jsm (r=sicking)
This commit is contained in:
Родитель
f212540c95
Коммит
7ed0d8b385
|
@ -29,6 +29,7 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||||
|
|
||||||
var { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
|
var { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
|
||||||
var { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
var { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||||
|
var { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});
|
||||||
var { LoadContextInfo } = Cu.import("resource://gre/modules/LoadContextInfo.jsm", {});
|
var { LoadContextInfo } = Cu.import("resource://gre/modules/LoadContextInfo.jsm", {});
|
||||||
var { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
var { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||||
var promise = require("promise");
|
var promise = require("promise");
|
||||||
|
@ -186,20 +187,17 @@ AppCacheUtils.prototype = {
|
||||||
.createInstance(Ci.nsIScriptableInputStream);
|
.createInstance(Ci.nsIScriptableInputStream);
|
||||||
let deferred = promise.defer();
|
let deferred = promise.defer();
|
||||||
let buffer = "";
|
let buffer = "";
|
||||||
let channel = Services.io.newChannel2(uri,
|
var channel = NetUtil.newChannel({
|
||||||
null,
|
uri: uri,
|
||||||
null,
|
loadUsingSystemPrincipal: true,
|
||||||
null, // aLoadingNode
|
securityFlags: Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL
|
||||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
});
|
||||||
null, // aTriggeringPrincipal
|
|
||||||
Ci.nsILoadInfo.SEC_NORMAL,
|
|
||||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
|
||||||
|
|
||||||
// Avoid the cache:
|
// Avoid the cache:
|
||||||
channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
|
channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
|
||||||
channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING;
|
channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING;
|
||||||
|
|
||||||
channel.asyncOpen({
|
channel.asyncOpen2({
|
||||||
onStartRequest: function (request, context) {
|
onStartRequest: function (request, context) {
|
||||||
// This empty method is needed in order for onDataAvailable to be
|
// This empty method is needed in order for onDataAvailable to be
|
||||||
// called.
|
// called.
|
||||||
|
@ -245,7 +243,7 @@ AppCacheUtils.prototype = {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, null);
|
});
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче