webview.addContentScripts cause TypeError: Illegal invocation
See original GitHub issueNWJS Version :v0.38.3 Operating System :window
Expected behavior
no TypeError
Actual behavior
an error “unCaught TypeError:Illegal invocation” displayed in the console panel
Uncaught TypeError: Illegal invocation at Object.define (extensions::safeMethods:20:22) at extensions::guestViewContainerElement:68:28 at registerInternalElement (extensions::guestViewContainerElement:37:28) at listener (extensions::guestViewContainerElement:27:5)
How to reproduce
the content in the index.html is,
<script> window.onload = function(){ var _webview = document.createElement("webview"); _webview.setAttribute("partition", "trusted"); var e = document.getElementById("foo"); e.appendChild(_webview); _webview.addContentScripts([{ name: "contentscript", matches: ["https://www.baidu.com/*"], js: {files: ["build/contentScript2.js"]}, run_at: "document_start" }]); _webview.src = "https://www.baidu.com/"; } </script>
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9 (2 by maintainers)
Top GitHub Comments
This is fixed in git and will be available in the next nightly build.
Finally, only one year, but thank you.