mirror of
https://github.com/yaklang/yaklang-chrome-extension.git
synced 2026-09-27 05:31:53 +08:00
eval in page context
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
console.log("Loaded content.js")
|
||||
|
||||
window.addEventListener("message", (event) => {
|
||||
if (event.data.type && (event.data.type === "TEST")) {
|
||||
console.log(event)
|
||||
const name = event.data.fn_name
|
||||
const args = event.data.args
|
||||
const a = (fn, args) => {
|
||||
return window[fn](args)
|
||||
}
|
||||
const zz = a(name, args)
|
||||
window.postMessage({type: "FROM_PAGE", text: zz}, "*")
|
||||
}
|
||||
}, );
|
||||
Reference in New Issue
Block a user