Bug 1143922 - Add AsyncOpen2 to channels in toolkit/ and b2g/ (r=sicking)

This commit is contained in:
Christoph Kerschbaumer 2015-09-18 09:27:32 -07:00
Родитель b01fc3ad90
Коммит bee2068e40
2 изменённых файлов: 21 добавлений и 1 удалений

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

@ -12,6 +12,10 @@ XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
"@mozilla.org/childprocessmessagemanager;1",
"nsIMessageSender");
XPCOMUtils.defineLazyServiceGetter(this, "contentSecManager",
"@mozilla.org/contentsecuritymanager;1",
"nsIContentSecurityManager");
this.EXPORTED_SYMBOLS = ["ActivityChannel"];
this.ActivityChannel = function(aURI, aLoadInfo, aName, aDetails) {
@ -51,7 +55,9 @@ this.ActivityChannel.prototype = {
},
asyncOpen2: function(aListener) {
this.asyncOpen(aListener, null);
// throws an error if security checks fail
var outListener = contentSecManager.performSecurityCheck(this, aListener);
this.asyncOpen(outListener, null);
},
QueryInterface2: XPCOMUtils.generateQI([Ci.nsIChannel])

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

@ -20,6 +20,10 @@ XPCOMUtils.defineLazyModuleGetter(this, "Prefetcher",
XPCOMUtils.defineLazyServiceGetter(this, "SystemPrincipal",
"@mozilla.org/systemprincipal;1", "nsIPrincipal");
XPCOMUtils.defineLazyServiceGetter(this, "contentSecManager",
"@mozilla.org/contentsecuritymanager;1",
"nsIContentSecurityManager");
// Similar to Python. Returns dict[key] if it exists. Otherwise,
// sets dict[key] to default_ and returns default_.
function setDefault(dict, key, default_)
@ -274,10 +278,20 @@ AboutProtocolChannel.prototype = {
Services.tm.currentThread.dispatch(runnable, Ci.nsIEventTarget.DISPATCH_NORMAL);
},
asyncOpen2: function(listener) {
// throws an error if security checks fail
var outListener = contentSecManager.performSecurityCheck(this, listener);
this.asyncOpen(outListener, null);
},
open: function() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
open2: function() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
isPending: function() {
return false;
},