b500294c1d
* feat: add worldSafe flag for executeJS results * chore: do not log warning for webContents.executeJS * Apply suggestions from code review Co-authored-by: Jeremy Rose <jeremya@chromium.org> * chore: apply PR feedback * chore: split logic a bit * chore: allow primitives through the world safe checl * chore: clean up per PR feedback * chore: flip boolean logic * chore: update per PR feedback * chore: fix typo * chore: fix spec Co-authored-by: Jeremy Rose <jeremya@chromium.org>
8 lines
263 B
JavaScript
8 lines
263 B
JavaScript
const { ipcRenderer, webFrame } = require('electron');
|
|
|
|
webFrame.executeJavaScript(`(() => {
|
|
return {};
|
|
})()`).then((obj) => {
|
|
// Considered safe if the object is constructed in this world
|
|
ipcRenderer.send('executejs-safe', obj.constructor === Object);
|
|
});
|