Closed
Bug 1842565
Opened 1 year ago
Closed 1 year ago
Class methods are not defined in the constructor if the class has been extended from HTMLElement inside webextension `content_script`
Categories
(WebExtensions :: Untriaged, defect)
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1820521
People
(Reporter: kozackunisoft, Unassigned)
References
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/116.0
Steps to reproduce:
Create web extension with the content script
which should create custom element:
class ManualApp extends HTMLElement {
constructor() {
super();
this._log('hello world') // TypeError: this._log is not a function
}
_log(str) {
console.log(str);
}
}
customElements.define("my-app", ManualApp);
document.body.innerHTML = "<my-app></my-app>";
Actual results:
Calling any method inside constructor leads to TypeError. But if class not extended HTMLElement
, I get expected result
class ManualApp {
constructor() {
this._log('hello world') // ok
}
_log(str) {
console.log(str);
}
}
Also, I'm getting expected result if I run this con in regular web page, not inside extension's content_script
Expected results:
When <my-app>
created in document, I expect to see hello world
in console without errors.
Comment 1•1 year ago
|
||
The Bugbug bot thinks this bug should belong to the 'WebExtensions::Untriaged' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Product: Firefox → WebExtensions
Updated•1 year ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Duplicate of bug: 1820521
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•