Setting a webview's WebPreferences


Is there a way to set a webview’s webPreferences?

By poking around with the DevTools I’ve found I can read them as follows: webview.getWebContents().getWebPreferences(), but modifying that object has no effect and I see no other way to set them.

Specifically, I want to change the default font families used in my webview (webPreferences.defaultFontFamily) but of course there’s plenty of other stuff in webPreferences too that one might want to change. I see that some of the webPreferences properties, eg. preload, plugins, blinkfeatures - have equivalent attributes that you can set in the webview HTML tag but most don’t. Is this a kind of situation where the Electron developers would have to add all of these properties one by one and they simply haven’t got around to the font ones yet, and/or no-one has asked for it?