I'm currently writing WebExtension under Firefox and I've stuck on interacting with page. I have a content script that needs an access to the page variables, for example jQuery instance.
I'm accessing jQuery with
var $ = window.wrappedJSObject.$;
And this works pretty good, I can add DOM elements to page etc, but there is a problem with event handling. For example, this code works fine:
$('#nav-bar').append('<img src="..."/>'); // Works great
But when I try to add event handler, it fails
$('#button').click(function () {}); // Fails
Error message says that
Permission denied to access property "handler"
My guess is Firefox WebExtensions have some security measures that prevent from easily adding event handlers, but I've been out of luck looking what is the cause. How can I make it work?