Created
July 4, 2018 13:19
-
-
Save uhyo/895e91d2b7a4434a8690145f53ee8277 to your computer and use it in GitHub Desktop.
Firefox EventTarget bug reproduction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('Test 1: raw EventTarget'); | |
const et = new EventTarget(); | |
// add handler of 'foo' event | |
et.addEventListener('foo', (e)=> { | |
console.log('foo event emitted:', e.detail); | |
}); | |
// dispatch 'foo' event | |
et.dispatchEvent(new CustomEvent('foo', { detail: 123 })); | |
console.log('Test 2: subclass of EventTarget'); | |
class MyEventTarget extends EventTarget {} | |
const met = new MyEventTarget(); | |
// add handler of 'foo' event | |
met.addEventListener('foo', (e)=> { | |
console.log('foo event emitted:', e.detail); | |
}); | |
// dispatch 'foo' event | |
met.dispatchEvent(new CustomEvent('foo', { detail: 456 })); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"manifest_version": 2, | |
"name": "Firefox EventTarget bug reproduction", | |
"version": "1.0.0", | |
"description": "sample", | |
"content_scripts": [ | |
{ | |
"matches": ["<all_urls>"], | |
"js": ["content.js"] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment