Closed
Bug 1509734
Opened 6 years ago
Closed 6 years ago
ThunderHTMLedit is causing some weird error: ReferenceError: ThunderHTMLedit_ is not defined - messengercompose.xul:1:1
Categories
(MailNews Core :: XUL Replacements, defect)
MailNews Core
XUL Replacements
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: jorgk-bmo, Unassigned)
References
Details
ThunderHTMLedit now works on trunk again and can be found here:
http://www.jorgk.com/misc/addons63/
It causes
ReferenceError: ThunderHTMLedit_ is not defined - messengercompose.xul:1:1
in the error console which comes from
<radiogroup onselect="ThunderHTMLedit_.SelectEditMode(this.selectedIndex, false);" flex="1">
with this stack:
onselect chrome://messenger/content/messengercompose/messengercompose.xul:1:1
set selectedItem chrome://global/content/elements/radio.js:247:5
set selectedIndex chrome://global/content/elements/radio.js:206:25
connectedCallback chrome://global/content/elements/radio.js:121:7
_insertElement resource:///modules/Overlays.jsm:357:11
_mergeElement resource:///modules/Overlays.jsm:410:9
_resolveForwardReference resource:///modules/Overlays.jsm:322:7
load resource:///modules/Overlays.jsm:160:14
load resource:///modules/Overlays.jsm:42:5
observe chrome://messenger/content/parent/ext-legacy.js:138:11
when the compose window is launched.
I was going to ignore it, but Aceman suggested to report it since it may affect other add-ons. The add-on works, so I don't see where the complaint comes from.
Flags: needinfo?(geoff)
We think it could be caused by a problem in the overlay loader, that's why it is filed here.
Reporter | ||
Comment 2•6 years ago
|
||
Note this code:
thunderHTMLedit.jsm: win.ThunderHTMLedit_ = {};
thunderHTMLedit-composer.js: ThunderHTMLedit_.SelectEditMode = function(mode, syncOnly) {
BTW, ThunderHTMLedit is a stripped fork of the Stationery add-on, so I blame it all on the original author ;-) - I fixed most bugs though.
Comment 3•6 years ago
|
||
Scripts are run after all overlay elements are added to the document, so your onselect handler (which fires as it's added to the document) finds ThunderHTMLedit_ is not defined. I think the first part of the previous sentence should definitely be in the upgrading add-ons notes.
Flags: needinfo?(geoff)
Reporter | ||
Comment 4•6 years ago
|
||
I had some private exchange with Geoff and he suggested this text for the add-on guide:
"Scripts in overlays are now run after all elements have been inserted
into the document. This may cause unexpected behaviour if your script
previously ran before elements were inserted."
I questioned this with regards to the 'onselect' handler and the reply was:
... when I say "scripts", I mean what's in a <script> tag. What's in an
event handler (onselect="…", which I guess you could say is also a script,
but not what I mean here), has not changed in behaviour.
Does the event handler indeed get executed after attaching it as per comment #1 at a point in time where the scripts haven't run *yet*? I'm a bit surprised that the handler gets run since there was no user action to select anything. Or did and does it always get run for the initial selection?
Flags: needinfo?(geoff)
Reporter | ||
Comment 5•6 years ago
|
||
OK, solved per PM:
The event handler gets run when the element is added, but at that stage the scripts haven't run yet, so the ThunderHTMLedit_ object doesn't exist yet.
Case closed.
Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(geoff)
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•