[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
Mon Aug 26 18:03:10 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=278290

--- Comment #11 from Karl Dubost <karlcow at apple.com> ---
Hi John, thanks a lot for the testcase. 

So As we are talking here about the error message 
The console is giving information about the error type:


[Error] InvalidStateError: The object is in an invalid state.
        collapseToEnd (attachment.cgi:198)
        rich_caret_move (attachment.cgi:198)
        onclick (attachment.cgi:262)

And the line where it happens. 
In the code is calling:
   window.getSelection().collapseToEnd();

What information would you have expected. 


When artificially creating a state where it should return InvalidStateError:



Safari:
InvalidStateError: The object is in an invalid state.
    collapseToEnd

Chrome:
Uncaught InvalidStateError: Failed to execute 'collapseToEnd' on 'Selection': there is no selection.

Firefox:
Uncaught DOMException: Selection.collapseToEnd: No selection range exists


The 3 browsers are sending more or less the same information with 
   * Error type (except for Firefox)
   * the function which fails (collapseToEnd)
   * the location in the script




Now there is a difference of behavior on when this is triggered, but that's a separate bug. 
I will open it with a reduced test case.

-- 
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/82a45eb0/attachment.htm>


More information about the webkit-unassigned mailing list