RESOLVED INVALID 110120
Web Inspector: Text editor exception
https://bugs.webkit.org/show_bug.cgi?id=110120
Summary Web Inspector: Text editor exception
Vsevolod Vlasov
Reported 2013-02-18 07:54:01 PST
Uncaught TypeError: Cannot call method 'substring' of undefined TextEditorModel.js:485 WebInspector.TextEditorModel.copyRange TextEditorModel.js:485 WebInspector.TextEditorMainPanel.TokenHighlighter.handleSelectionChange DefaultTextEditor.js:3237 WebInspector.TextEditorMainPanel._handleSelectionChange DefaultTextEditor.js:2750 This happens when UISourceCode content is set to single line text externally. At this point cursor is shown in the very beginning of the file and window.getSelection returns the following selection: Selection {type: "Caret", extentOffset: 0, extentNode: div.inner-container text-editor-editable, baseOffset: 0, baseNode: div.inner-container text-editor-editable…} anchorNode: div.inner-container text-editor-editable anchorOffset: 0 baseNode: div.inner-container text-editor-editable baseOffset: 0 extentNode: div.inner-container text-editor-editable extentOffset: 0 focusNode: div.inner-container text-editor-editable focusOffset: 0 isCollapsed: true rangeCount: 1 type: "Caret" __proto__: Selection This differs from what window.getSelection() returns when cursor is set to the beginning of the file manually: Selection {type: "Caret", extentOffset: 0, extentNode: text, baseOffset: 0, baseNode: text…} anchorNode: text anchorOffset: 0 baseNode: text baseOffset: 0 extentNode: text extentOffset: 0 focusNode: text focusOffset: 0 isCollapsed: true rangeCount: 1 type: "Caret" __proto__: Selection This is probably the reason of the exception (I saw that the range received in the selectionToPosition method had undefined as start/endLine)
Attachments
Patch (1.86 KB, patch)
2013-02-19 03:08 PST, Andrey Lushnikov
vsevik: review-
vsevik: commit-queue-
Andrey Lushnikov
Comment 1 2013-02-19 03:08:50 PST
Vsevolod Vlasov
Comment 2 2013-02-20 01:37:30 PST
Comment on attachment 189036 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=189036&action=review > Source/WebCore/inspector/front-end/DefaultTextEditor.js:1399 > + this._restoreSelection(WebInspector.TextRange.createFromLocation(0, 0)); This is going to regress keeping track of selection in delegate.
Brian Burg
Comment 3 2014-12-12 13:41:17 PST
Closing as invalid, as this bug pertains to the old inspector UI and/or its tests. Please file a new bug (https://www.webkit.org/new-inspector-bug) if the bug/feature/issue is still relevant to WebKit trunk.
Note You need to log in before you can comment on or make changes to this bug.