Bug 207248 - [Web Inspector][WinCairo] Selecting an error message in Console causes "TypeError:​ selection.focusNode.closest is not a function."
Summary: [Web Inspector][WinCairo] Selecting an error message in Console causes "TypeE...
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Fujii Hironori
Keywords: InRadar
Depends on:
Reported: 2020-02-04 20:09 PST by Fujii Hironori
Modified: 2020-02-06 19:49 PST (History)
4 users (show)

See Also:

Patch (2.20 KB, patch)
2020-02-06 02:46 PST, Fujii Hironori
no flags Details | Formatted Diff | Diff
Patch for landing (2.21 KB, patch)
2020-02-06 17:56 PST, Fujii Hironori
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fujii Hironori 2020-02-04 20:09:29 PST
[Web Inspector][WinCairo] The error "TypeError:​ selection.focusNode.closest is not a function." happens by selecting an error message

I tested with WinCairo WK2, trunk, r255482.

1. Start MiniBrowser
2. Open Web Inspector
3. Open Console Tab
4. Enter "foo"
5. An error message "ReferenceError: Can't find variable: foo" is output
6. Press left mouse button on the string of the error message
6. Drug the mouse
7. "TypeError:​ selection.focusNode.closest is not a function." happens

These uncaught exceptions caused the problem:
TypeError:​ selection.focusNode.closest is not a function. (In 'selection.focusNode.closest("." + WI.LogContentView.ItemWrapperStyleClassName)​', 'selection.focusNode.closest' is undefined)​ (at LogContentView.js:​552:​54)​
    _mousemove @ LogContentView.js:​552:​54
    handleEvent @ LogContentView.js:​653:​28

I don't see this issue in Mac port.
Comment 1 Stephan Szabo 2020-02-04 21:02:33 PST
Hmm, Devin Rousso seems to have reported similar for mac at https://bugs.webkit.org/show_bug.cgi?id=198594
Comment 2 Fujii Hironori 2020-02-04 21:59:45 PST
Looks a same issue. Thanks. But surprisingly Mac port doesn't reproduce the issue even this Bug 198594's test case on my Mac. 🤔
Comment 3 Fujii Hironori 2020-02-06 02:20:13 PST
selection.focusNode is a Text node at the time. closest is a method of Element.
Comment 4 Fujii Hironori 2020-02-06 02:40:27 PST
The code was added by r242174 (Bug 173747).
Comment 5 Fujii Hironori 2020-02-06 02:46:43 PST
Created attachment 389941 [details]
Comment 6 Devin Rousso 2020-02-06 09:24:24 PST
Comment on attachment 389941 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=389941&action=review


> Source/WebInspectorUI/UserInterface/Views/LogContentView.js:552
> +                var focusElement = selection.focusNode;

Style: we prefer using `let`
Comment 7 Fujii Hironori 2020-02-06 17:56:14 PST
Created attachment 390037 [details]
Patch for landing

Thank you for the reveiw.
Comment 8 Fujii Hironori 2020-02-06 19:48:13 PST
Committed r256006: <https://trac.webkit.org/changeset/256006>
Comment 9 Radar WebKit Bug Importer 2020-02-06 19:49:13 PST