[Webkit-unassigned] [Bug 278290] "InvalidStateError: The object is in an invalid state" is not very helpful
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Aug 27 09:06:57 PDT 2024
https://bugs.webkit.org/show_bug.cgi?id=278290
--- Comment #13 from John A. Bilicki III <jab_creations at yahoo.com> ---
Hi Karl,
So two key pieces of information are missing for developers.
First, what is the state? Well, the element isn't visible so that is the invalid state but remember, we're under a lot of pressure so most of the time we're not going to interpret "invalid state" as "not visible".
Secondly, which element? I've done an excessive amount of work to create very clean and easy to comprehend JavaScript error reports cleaning the error.stack object between different browsers and odd text formatting within the same rendering engines. So most developers don't have that. So they'll get lost at the interpretation stage.
So an error message that would be much more helpful and save developers time would be something along the times of:
InvalidStateError: The element object [<div id="editor_rich">] is not currently visible to the user, unable to execute [collapseToEnd()] for the [selection].
I would hope to be able to click the element object in the developer console to have the DOM inspector open and highlight the element I'm attempting to have my script interact with. Then it should be clear from both the error message and the faded code in the DOM Inspector that the element is not currently visible.
I don't remember offhand if we're talking about textNodes specifically since they're not elements. So in that case I might adapt it to be more like:
InvalidStateError: The textNode object [] of the element object [<div id="editor_rich">] is not currently visible to the user, unable to execute [collapseToEnd()] for the [selection].
Oddly enough I have not encountered this problem with Gecko/Waterfox or Blink/Vivaldi. I actually do prefer to get error messages versus "silent errors" because if I don't know there is an error I very likely won't fix it. Though my case is likely different from other developers. For my CMS custom page editor there are layers: Meta, Rich and XML. Often I'll save a page in the Meta layer while the other layers are hidden. My Rich Editor always switches states when saving (I can't remember if it is XML to Rich or vice-versa) to then collect the XML code to send in an AJAX request to the server to save the page. I have since fixed the bug in my system. Since it's Webmaster/Administrator access only that is why I created the test case.
I hope this information is helpful? Thank you for taking the time to work on this.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240827/bef6c1d7/attachment-0001.htm>
More information about the webkit-unassigned
mailing list