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

Bug 348469

Summary: [editor] FF4 - ctrl-V stops working and then I get console errors
Product: [ECD] Orion Reporter: Susan McCourt <susan>
Component: ClientAssignee: Felipe Heidrich <eclipse.felipe>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe, Silenio_Quarti, simon_kaegi
Version: 0.2   
Target Milestone: 0.2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
text file none

Description Susan McCourt CLA 2011-06-06 16:06:19 EDT
- i was editing a file, using copy/paste, all was good
- decided to move some stuff around
- selected first three lines of file (the third line is blank)
- ctrl-c 
- scroll down
- ctrl-v

No paste and I see this error in the console

nodeChild is null
getNodeText(node=pre)textView.js (line 3027)
_getText()textView.js (line 3037)
(?)()textView.js (line 3055)
[Break On This Error] if (nodeChild.nodeType === child.TEXT_NODE) {
textView.js (line 3027)

At that point I have to reload the page to get the editor working again.

If my selection doesn't include the third empty line, it works.
Comment 1 Susan McCourt CLA 2011-06-06 16:07:23 EDT
In case it matters, here is the text I'm trying to copy/paste.  These are the first three lines in the file:  

- consider a "put editor location in browser history" command
- URL hash for token within a line, polish global search


(where the empty line under the two lines is the third line).
I am late for a meeting but will try to give more detail later if needed.
Comment 2 Felipe Heidrich CLA 2011-06-06 16:26:24 EDT
I would not duplicate this bug on firefox 4.0.1 (are you also on FF 4.0.1/Windows ?) 


Could you please try to add a null check to the code
this line
while (nodeChild !== endNode)   (line number 3026)
to 
while (nodeChild && nodeChild !== endNode)

Thanks
Comment 3 Susan McCourt CLA 2011-06-06 18:54:33 EDT
(In reply to comment #2)
> I would not duplicate this bug on firefox 4.0.1 (are you also on FF
> 4.0.1/Windows ?) 

yes, FF 4.01 on Win7
I can duplicate it at will.
Always happens when the third empty line is the last thing selected in the copy.  If I copy a fourth line, that has content, the problem does not occur.  And if I copy only the two lines, the problem does not occur.

> 
> Could you please try to add a null check to the code
> this line
> while (nodeChild !== endNode)   (line number 3026)
> to 
> while (nodeChild && nodeChild !== endNode)
> 
> Thanks

This fixes the problem.
With that change, I can perform copy/paste for the scenario with the third line selected.
Comment 4 Susan McCourt CLA 2011-06-07 15:40:28 EDT
Created attachment 197539 [details]
text file

this was the text file (my m8 todo list) where I saw the problem.
Try to select the first three lines and then ctrl-v to somewhere else in the file.

(It didn't seem to matter where you were pasting to).
Comment 5 Felipe Heidrich CLA 2011-06-10 11:54:03 EDT
Works for me with todos.txt
(copy and paste works, no error in the console)

Try the null pointer check I mention in comment 2, if that fixes the problem for you feel free to commit it.
Comment 6 Susan McCourt CLA 2011-06-10 17:41:28 EDT
See comment #3.  (I tried it before and it fixed the problem).
Comment 7 Felipe Heidrich CLA 2011-06-13 10:41:07 EDT
Silenio, we should release the null check, agreed ?
Comment 8 Silenio Quarti CLA 2011-06-13 10:49:29 EDT
(In reply to comment #7)
> Silenio, we should release the null check, agreed ?

I am ok with the null check if the pasted text is correct/complete.
Comment 9 Susan McCourt CLA 2011-06-13 12:40:26 EDT
(In reply to comment #8)
> (In reply to comment #7)
> > Silenio, we should release the null check, agreed ?
> 
> I am ok with the null check if the pasted text is correct/complete.

yes, the pasted text was correct.