Bug 1644275 Comment 6 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I tried doing some investigations
```diff
diff --git a/devtools/server/actors/network-monitor/network-observer.js b/devtools/server/actors/network-monitor/network-observer.js
--- a/devtools/server/actors/network-monitor/network-observer.js
+++ b/devtools/server/actors/network-monitor/network-observer.js
@@ -363,10 +363,12 @@ NetworkObserver.prototype = {
       // If the owner isn't set we need to create the network event and send
       // it to the client. This happens in case where the request has been
       // blocked (e.g. CORS) and "http-on-stop-request" is the first notification.
-      this._createNetworkEvent(subject, {
-        blockedReason: reason,
-        blockingExtension: id,
-      });
+      if (id || reason) {
+        this._createNetworkEvent(subject, {
+          blockedReason: reason,
+          blockingExtension: id,
+        });
+      }
     }
   },
```
This seems to remove the duplicates, and also stops the blocking of the all the service worker requests. see Fix_Image.png
Just to clarify
1) In this scenario the `reason` is `0` and the extension id is an empty string, which feels like it there's no valid reason for it to be blocked by default. Should we check for the availability of these before blocking?

Opening a patch to fix and for discussions.
I tried doing some investigations
```diff
diff --git a/devtools/server/actors/network-monitor/network-observer.js b/devtools/server/actors/network-monitor/network-observer.js
--- a/devtools/server/actors/network-monitor/network-observer.js
+++ b/devtools/server/actors/network-monitor/network-observer.js
@@ -363,10 +363,12 @@ NetworkObserver.prototype = {
       // If the owner isn't set we need to create the network event and send
       // it to the client. This happens in case where the request has been
       // blocked (e.g. CORS) and "http-on-stop-request" is the first notification.
-      this._createNetworkEvent(subject, {
-        blockedReason: reason,
-        blockingExtension: id,
-      });
+      if (id || reason) {
+        this._createNetworkEvent(subject, {
+          blockedReason: reason,
+          blockingExtension: id,
+        });
+      }
     }
   },
```
This seems to remove the duplicates, and also stops the blocking of the all the service worker requests. 
Just for my clarifications
1) In this scenario the `reason` is `0` and the extension id is an empty string, which feels like it there's no valid reason for it to be blocked by default. Should we check for the availability of these before blocking?

Opening a patch for discussions and possible fix.
I tried doing some investigations
```diff
diff --git a/devtools/server/actors/network-monitor/network-observer.js b/devtools/server/actors/network-monitor/network-observer.js
--- a/devtools/server/actors/network-monitor/network-observer.js
+++ b/devtools/server/actors/network-monitor/network-observer.js
@@ -363,10 +363,12 @@ NetworkObserver.prototype = {
       // If the owner isn't set we need to create the network event and send
       // it to the client. This happens in case where the request has been
       // blocked (e.g. CORS) and "http-on-stop-request" is the first notification.
-      this._createNetworkEvent(subject, {
-        blockedReason: reason,
-        blockingExtension: id,
-      });
+      if (id || reason) {
+        this._createNetworkEvent(subject, {
+          blockedReason: reason,
+          blockingExtension: id,
+        });
+      }
     }
   },
```
This seems to remove the duplicates, and also stops the blocking of the all the service worker requests. 
Just for my clarifications
1) In this scenario the `reason` is `0` and the extension id is an empty string, which feels like it should not be blocking by default. Should we check for the availability of these before blocking?

Opening a patch for discussions and possible fix.

Back to Bug 1644275 Comment 6