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.
This commit is contained in:
shun 2019-08-28 20:28:18 +09:00 committed by Ronan Jouchet
parent 4f235c550a
commit e00f08e5d6
1 changed files with 1 additions and 1 deletions

View File

@ -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,
);
});