Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 355224

Summary: Error when navigating through browser history
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: EditorAssignee: Silenio Quarti <Silenio_Quarti>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: eclipse.felipe, john.arthorne, Silenio_Quarti
Version: 0.2   
Target Milestone: 0.3   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Mark Macdonald CLA 2011-08-19 09:44:36 EDT
Chrome 14
Orion 08/17

1. Open the editor on a file.
2. Open another file in the same tab (eg. by using Ctrl+Shift+R).
3. Click on the editor to give it focus.
4. Click Back in the browser.
5. I see an error:

TypeError at textModel.js:284
  type: "non_object_property_call"
  arguments: Array[2]
    0: "substring"
    1: undefined
    length: 2

5. The error causes the editor to become dirty, and the undo stack goes haywire. You have to reload the page to fix it.
Comment 1 Mark Macdonald CLA 2011-09-12 10:54:53 EDT
*** Bug 357389 has been marked as a duplicate of this bug. ***
Comment 2 John Arthorne CLA 2011-09-12 13:18:41 EDT
Marking as candidate for 0.3. This quickly becomes annoying, although it is slightly better when you realize refreshing the page will fix it.
Comment 3 Mark Macdonald CLA 2011-09-12 16:19:23 EDT
When you navigate to another file, the new file is loaded and used to populate the editor, like this:

- Editor calls textView.setModel(new TextModel(...))
- Editor calls textView.setText(new file contents)
  - TextView dispatches a ModelChangedEvent
  - TextView dispatches a SelectionEvent

In the case where the caret position before you loaded the new file was >= 1, the SelectionEvent will contain a Selection that is out of range. This causes the TypeError later on when the styler tries to get the selected text.
Comment 4 Felipe Heidrich CLA 2011-09-13 09:37:15 EDT
sounds like a bug for Silenio and I.
Comment 5 Silenio Quarti CLA 2011-09-22 16:50:24 EDT
I believe this is fixed in the latest. We changed how the text is set in the editor. There is no need to change the model anymore.

Mark please try the latest.
Comment 6 Mark Macdonald CLA 2011-09-22 17:18:51 EDT
Fixed, thanks