Bug 1293980 - NetMonitor fails to get security info of a request intercepted by service worker r?ochameau draft
authorJarda Snajdr <jsnajdr@gmail.com>
Thu, 11 Aug 2016 10:44:38 +0200
changeset 399561 d0af37c375d398062f64f68e773115b91428d567
parent 399408 0502bd9e025edde29777ba1de4280f9b52af4663
child 527962 6920874eb04e6689ecd34a142cd7312016a33e8a
push id25874
push userbmo:jsnajdr@gmail.com
push dateThu, 11 Aug 2016 13:49:00 +0000
reviewersochameau
bugs1293980
milestone51.0a1
Bug 1293980 - NetMonitor fails to get security info of a request intercepted by service worker r?ochameau MozReview-Commit-ID: 1NhazApMbgs
devtools/shared/webconsole/network-monitor.js
--- a/devtools/shared/webconsole/network-monitor.js
+++ b/devtools/shared/webconsole/network-monitor.js
@@ -495,16 +495,24 @@ NetworkResponseListener.prototype = {
     // Asynchronously wait for the data coming from the request.
     this.setAsyncListener(this.sink.inputStream, this);
   },
 
   /**
    * Parse security state of this request and report it to the client.
    */
   _getSecurityInfo: DevToolsUtils.makeInfallible(function () {
+    // Many properties of the securityInfo (e.g., the server certificate or HPKP
+    // status) are not available in the content process and can't be even touched safely,
+    // because their C++ getters trigger assertions. This function is called in content
+    // process for synthesized responses from service workers, in the parent otherwise.
+    if (Services.appinfo.processType == Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT) {
+      return;
+    }
+
     // Take the security information from the original nsIHTTPChannel instead of
     // the nsIRequest received in onStartRequest. If response to this request
     // was a redirect from http to https, the request object seems to contain
     // security info for the https request after redirect.
     let secinfo = this.httpActivity.channel.securityInfo;
     let info = NetworkHelper.parseSecurityInfo(secinfo, this.httpActivity);
 
     this.httpActivity.owner.addSecurityInfo(info);