MW CS bridge server: detect when the extension is dead

When the extension is dead (and thus the main world content script
bridge server as well), the server doesn't try to handle the message,
since this will result in an error.

Change-Id: I6ef0babc8cbb598f793ba633604b9c5e42eec31a
diff --git a/src/common/mainWorldContentScriptBridge/Server.js b/src/common/mainWorldContentScriptBridge/Server.js
index 321a068..cf19e4d 100644
--- a/src/common/mainWorldContentScriptBridge/Server.js
+++ b/src/common/mainWorldContentScriptBridge/Server.js
@@ -21,6 +21,14 @@
     if (e.source !== window || e.data?.target !== this.CSTarget || !uuid)
       return;
 
+    // If chrome.runtime.id is undefined, then this content script belongs to a
+    // dead extension (see https://stackoverflow.com/a/69603416).
+    if (typeof chrome.runtime.id === 'undefined') {
+      console.debug(
+          '[MainWorldContentScriptBridgeServer] Not handling message because this is a dead server.');
+      return;
+    }
+
     const action = e.data?.action;
     const request = e.data?.request;
     return this.handler(uuid, action, request);