Opened 9 years ago
Closed 8 years ago
#13812 closed Bug (fixed)
When aborting file upload the placeholder for image is left.
Reported by: | Jakub Ś | Owned by: | Tade0 |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 4.5.11 |
Component: | General | Version: | 4.5.0 |
Keywords: | Cc: |
Description
Steps to reproduce
- Use below code in CKEditor
var editor1 = CKEDITOR.replace( 'editor1', { extraPlugins: 'uploadimage,image2', imageUploadUrl: 'http://your-url?command=QuickUpload&type=Images&responseType=json' ); editor1.on( 'fileUploadRequest', function( evt ) { evt.data.fileLoader.abort(); editor1.showNotification( 'File too big', 'warning' ); evt.cancel(); });
- D&D the file
Expected result
File upload is aborted, message is displayed and placeholder for the image is removed.
Actual result
File upload is aborted, message is displayed but placeholder for the image is left.
Other details (browser, OS, CKEditor version, installed plugins)
Browsers: all, CKEditor version 4.5.0.
Attachments (2)
Change History (20)
Changed 9 years ago by
Attachment: | placeholder.png 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
Milestone: | → CKEditor 4.5.5 |
---|
comment:4 Changed 9 years ago by
Milestone: | CKEditor 4.5.5 → CKEditor 4.5.6 |
---|
comment:5 Changed 9 years ago by
Owner: | set to Tade0 |
---|---|
Status: | confirmed → assigned |
comment:6 Changed 9 years ago by
From what I have established xhr.onabort
is never fired, because xhr.abort()
is called before xhr.send()
.
This code demonstrates this behavior:
var xhr = new XMLHttpRequest(); xhr.onabort = function() { console.log('not called'); }; xhr.open('get', 'http://www.google.com'); //xhr.send(); xhr.abort();
comment:7 Changed 9 years ago by
Milestone: | CKEditor 4.5.6 → CKEditor 4.5.7 |
---|
comment:8 Changed 9 years ago by
Milestone: | CKEditor 4.5.7 → CKEditor 4.5.8 |
---|
comment:9 Changed 9 years ago by
Milestone: | CKEditor 4.5.8 → CKEditor 4.5.9 |
---|
comment:10 Changed 9 years ago by
Milestone: | CKEditor 4.5.9 → CKEditor 4.5.10 |
---|
comment:11 Changed 9 years ago by
Status: | assigned → review |
---|
onAbort()
has a safeguard, that prevents anything of consequence from happening if it is called twice or more, so this solution should fit.
Added manual test and rebased. Changes pushed to branch:t/13812.
comment:12 Changed 9 years ago by
Status: | review → review_failed |
---|
We should have also a unit test to check if onAbort
is really called on abort
and how many times.
Interestingly in the manual test I don't see any placeholder – even without the fix.
Despite the issue with test, LGTM.
comment:13 Changed 9 years ago by
Milestone: | CKEditor 4.5.10 → CKEditor 4.5.11 |
---|
Moving tickets to the next milestone.
comment:14 Changed 8 years ago by
Status: | review_failed → review |
---|
Added unit test, Rebased with master, changes pushed to branch:t/13812.
comment:15 Changed 8 years ago by
Status: | review → review_failed |
---|
The image2
plugin (which is also the cause of this issue) was missing in the manual test (that's why @t.jakut was unable to reproduce the issue) - I added this dependency acfbf30.
The fix works fine, however:
- The unit test fails on IE10, IE11 and Edge.
- I would add information in the manual test that it won't work on IE8 and IE9 (because of lack of support for D'n'D).
- In the manual test, before notification error is shown, there is another notification
Upload aborted by the user.
- I would also add this to Expected result section so it is clear exactly what should happen.
Changed 8 years ago by
Attachment: | Screen Shot 2016-08-23 at 12.41.01.png added |
---|
Failing unit test (same error for IE10, IE11 and Edge).
comment:16 Changed 8 years ago by
Status: | review_failed → review |
---|
Fixed unit test, updated manual test.
Changes pushed to branch:t/13812.
comment:18 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | review_passed → closed |
Merged to master
with 50f9765.
It looks like
xml.onabort
is not called whenxml.abort()
is called. I pushed quick fix to the t/13812 branch, but this needs to be investigated.