Extension server error: Operation failed: : has no execution context", source: chrome-devtools://devtools/bundled/inspector.js ( code example

Example: Extension server error: Object not found: , source: devtools://devtools/bundled/extensions/extensions.js (216) [9900:1226/171021.620

+  // Open dev tools initially when in development mode
+  if (process.env.NODE_ENV === "development") {
+    mainWindow.webContents.on("did-frame-finish-load", () => {
+      mainWindow.webContents.once("devtools-opened", () => {
+        mainWindow.focus();
+      });
+      mainWindow.webContents.openDevTools();
+    });
+  }