From e00f08e5d6fbdd86cdba8efec5e809d0308117d8 Mon Sep 17 00:00:00 2001 From: shun <0xBADDCAFE@users.noreply.github.com> Date: Wed, 28 Aug 2019 20:28:18 +0900 Subject: [PATCH] Fix filter exception when injecting CSS (PR #837) When injecting CSS, an `onBeforeRequest paramater 'filter' must have property 'urls'` error is thrown. ![image](https://user-images.githubusercontent.com/599164/63574823-a3dd6180-c5c3-11e9-89c0-a9debdd4f696.png) This is caused by [Electron PR #19337: Throw on invalid webRequest filters](https://github.com/electron/electron/pull/19337). So, pass filter argument properly, like Electron expects it strictly. --- app/src/components/mainWindow/mainWindow.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/components/mainWindow/mainWindow.js b/app/src/components/mainWindow/mainWindow.js index cf2e1e1..b0251b7 100644 --- a/app/src/components/mainWindow/mainWindow.js +++ b/app/src/components/mainWindow/mainWindow.js @@ -58,7 +58,7 @@ function maybeInjectCss(browserWindow) { // we have to inject the css in onHeadersReceived so they're early enough // will run multiple times, so did-finish-load will remove this handler browserWindow.webContents.session.webRequest.onHeadersReceived( - [], // Pass an empty filter list; null will not match _any_ urls + { urls: [] }, // Pass an empty filter list; null will not match _any_ urls onHeadersReceived, ); });