Opened 9 years ago
Closed 9 years ago
#13513 closed Bug (fixed)
Divarea and getData throw error when image is only data in editor.
Reported by: | Jakub Ś | Owned by: | Szymon Cofalik |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 4.5.7 |
Component: | General | Version: | 4.4.6 |
Keywords: | Blink Webkit Support | Cc: | glen.84@… |
Description
Use attached sample to reproduce the problem.
- Copy image from some webpage
- Paste it into editor with Ctrl+V
- Click Clear
- Paste image into editor with Ctrl+V
- Click getData
Result: In Webkit and Blink JS error is thrown.
Message: Uncaught IndexSizeError - Failed to execute 'extend' on 'Selection': 1 is larger than the given node's length.
Line: 224
URI: core/selection.js
Attachments (1)
Change History (24)
Changed 9 years ago by
Attachment: | CKEditor.html added |
---|
comment:1 Changed 9 years ago by
Status: | new → confirmed |
---|
comment:2 Changed 9 years ago by
comment:3 Changed 9 years ago by
We are seeing this exact same stack trace from users about 20 times a day from Chrome users. All of them occur in the context of calling editor.getData(). We do not allow pasting images in production yet, but these errors may share a root cause. Production is running CKEditor 4.4.7.
comment:4 Changed 9 years ago by
Milestone: | → CKEditor 4.5.2 |
---|
OK, this is another ticket pointing to the same extend(). We've already worked on some fixes around it, so I don't know if one of the patches on review does not fix it, but to remember to check I'm adding this ticket to 4.5.2 too.
comment:6 Changed 9 years ago by
The workflow above appears to be fixed by #13284, but there is a related workflow that still causes the error. These two workflows only happen with the 'image2' plugin enabled.
- Copy image from some webpage
- Paste it into editor with Ctrl+V
- Delete the image.
- Type some text without a space
- Click getData
Another workflow:
- Copy image from some webpage
- Paste it into the editor with Ctrl+V
- Hit the right arrow button to place the caret right next to the image.
- Type some text without a space.
- Click getData
Removing the 'image2' plugin, the error manifests itself differently:
- Copy image from some webpage
- Paste it into the editor with Ctrl+V
- Hit the right arrow button to place the caret right next to the image.
- Type some text without a space.
- Click getData
- Click clear
You can see the issue with the 'image2' plugin here. If you want, I can remove the plugin so that you can see the other issue. Example
comment:7 Changed 9 years ago by
Owner: | set to Szymon Cofalik |
---|---|
Status: | confirmed → assigned |
comment:8 Changed 9 years ago by
Status: | assigned → review |
---|
@jbalinski: thanks for providing test cases!
I've pushed branch:t/13513 with additional fix. It seems like a weird bug on Chrome's end but I can't reproduce it outside CKEditor "environment". The fix is separate from #13284 and branch:t/13284 but both are connected to similar issues.
comment:10 Changed 9 years ago by
Milestone: | CKEditor 4.5.2 → CKEditor 4.5.3 |
---|---|
Status: | review → review_failed |
comment:11 Changed 9 years ago by
Status: | review_failed → assigned |
---|
comment:12 Changed 9 years ago by
Status: | assigned → review |
---|
I rebased branch:t/13513 with master and pushed tests.
I narrowed test cases to two, simpler scenarios. Errors are caused by ZWS, so any command that inserts ZWS into editor results in same error, it doesn't have to be an image. I used bold
. Instead messing with image, now I just use bold
command to insert strong
element with ZWS in it. I also reduced plugins set to a minimal group that is needed to reproduce the error.
@jbalinski provided 3 test cases. TC1 and TC2 are basically same, and TC3 is the same thing but we fire setData( '' )
instead of getData()
. I was able to automate the tests. While writing tests I noticed that the error is thrown only when getData/setData
is fired after click the button, which lead me to discover that it, in fact, is only thrown if editor is blurred before getData/setData
. Maybe this information will be useful during review. I simulated this by firing blur()
directly on editable().$
element.
comment:13 Changed 9 years ago by
Small note here - instead of blurring editable, focus some other field (e.g. <input>). This is more predictable.
comment:15 Changed 9 years ago by
@Reinmar: It seems that, because of unknown reason, it crashes only if I use blur()
on contenteditable. focus()
on another field does not make the code to throw an error.
comment:16 Changed 9 years ago by
Milestone: | CKEditor 4.5.3 → CKEditor 4.5.4 |
---|
comment:18 Changed 9 years ago by
I'd wait with this for results of @a.nowodzinski's work on a complete filling char rewrite. Perhaps all this won't be necessary after that.
comment:19 Changed 9 years ago by
Milestone: | CKEditor 4.5.4 → CKEditor 4.5.5 |
---|
comment:20 Changed 9 years ago by
Cc: | glen.84@… added |
---|
comment:21 Changed 9 years ago by
Milestone: | CKEditor 4.5.5 → CKEditor 4.5.6 |
---|
This issue will be fixed by #13816 in the next milestone.
comment:22 Changed 9 years ago by
Milestone: | CKEditor 4.5.6 → CKEditor 4.5.7 |
---|
comment:23 Changed 9 years ago by
Resolution: | → fixed |
---|---|
Status: | review → closed |
Fixed with git:2d078ff42a by #13816.
Tracking.