Bug 1143922 - Add AsyncOpen2 to channels in toolkit/ and b2g/ (r=sicking)
☠☠ backed out by c2a2e73b931f ☠ ☠
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Fri, 18 Sep 2015 09:27:32 -0700
changeset 295896 deda472458fd5314c11461302008ce984dbd00a7
parent 295895 977d5b7ecba32a0617d40c231e2f16963bf4a4ef
child 295897 309b4d1ab81c67783d7db0968bcff7c88108ba4f
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs1143922
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1143922 - Add AsyncOpen2 to channels in toolkit/ and b2g/ (r=sicking)
b2g/components/ActivityChannel.jsm
toolkit/components/addoncompat/RemoteAddonsChild.jsm
--- a/b2g/components/ActivityChannel.jsm
+++ b/b2g/components/ActivityChannel.jsm
@@ -7,16 +7,20 @@
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 Cu.import('resource://gre/modules/XPCOMUtils.jsm');
 
 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) {
   this._activityName = aName;
   this._activityDetails = aDetails;
   this.originalURI = aURI;
   this.URI = aURI;
   this.loadInfo = aLoadInfo;
@@ -46,13 +50,15 @@ this.ActivityChannel.prototype = {
 
   asyncOpen: function(aListener, aContext) {
     cpmm.sendAsyncMessage(this._activityName, this._activityDetails);
     // Let the listener cleanup.
     aListener.onStopRequest(this, aContext, Cr.NS_OK);
   },
 
   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])
 }
--- a/toolkit/components/addoncompat/RemoteAddonsChild.jsm
+++ b/toolkit/components/addoncompat/RemoteAddonsChild.jsm
@@ -15,16 +15,20 @@ Cu.import("resource://gre/modules/Servic
 XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
                                   "resource://gre/modules/BrowserUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Prefetcher",
                                   "resource://gre/modules/Prefetcher.jsm");
 
 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_)
 {
   if (key in dict) {
     return dict[key];
   }
   dict[key] = default_;
@@ -269,20 +273,30 @@ AboutProtocolChannel.prototype = {
         try {
           listener.onStopRequest(this, context, Cr.NS_OK);
         } catch(e) {}
       }
     };
     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;
   },
 
   cancel: function() {
     throw Cr.NS_ERROR_NOT_IMPLEMENTED;
   },