feat: add support for content scripts 'all_frames' option (#17258)
* feat: add support for content scripts 'all_frames' option * merged content script tests 'all_frames' test now runs on all variants of sandbox/contentIsolation configurations :D
This commit is contained in:
parent
b7fc50b7ca
commit
8ee153dae1
11 changed files with 196 additions and 45 deletions
14
spec/fixtures/extensions/content-script/all_frames-preload.js
vendored
Normal file
14
spec/fixtures/extensions/content-script/all_frames-preload.js
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
const { ipcRenderer, webFrame } = require('electron')
|
||||
|
||||
if (process.isMainFrame) {
|
||||
// https://github.com/electron/electron/issues/17252
|
||||
ipcRenderer.on('executeJavaScriptInFrame', (event, frameRoutingId, code, responseId) => {
|
||||
const frame = webFrame.findFrameByRoutingId(frameRoutingId)
|
||||
if (!frame) {
|
||||
throw new Error(`Can't find frame for routing ID ${frameRoutingId}`)
|
||||
}
|
||||
frame.executeJavaScript(code, false, result => {
|
||||
event.sender.send(`executeJavaScriptInFrame_${responseId}`, result)
|
||||
})
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue