Unfortunately this doesn't capture event listeners added in the
content document.
I have the following script:
(function(original) {
Element.prototype.addEventListener = function(type, listener,
useCapture) {
if (typeof (this._handlerTypes) == 'undefined') {
this._handlerTypes = {};
}
this._handlerTypes[type] = true;
return original.apply(this, arguments);
}
})(Element.prototype.addEventListener);
(function(original) {
Element.prototype.removeEventListener = function(type, listener,
useCapture) {
if (typeof (this._handlerTypes) != 'undefined') {
delete this._handlerTypes[type];
}
return original.apply(this, arguments);
}
})(Element.prototype.removeEventListener);
Which I include into manifest.json:
"content_scripts" : [
{
"matches" : [ "http://*/*", "https://*/*" ],
"js" : [ "events_spy.js" ],
"run_at" : "document_start",
"all_frames" : true
},
...
]
Then, I open the following example page:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<a id="test" href="#">Click here</a>
<script type="application/javascript">
document.getElementById("test").addEventListener("click",
function() { alert("clicked"); }, false);
</script>
</body>
</html>
But debugger doesn't stop on a break-point set inside custom
addEventListener() handler function.
What am I doing wrong?
Thanks,
Michael