ondrop: XMLHttpRequestProgressEvent message undefined when dropping blocked file




DOM: Events
2 years ago
2 years ago


(Reporter: Ralf Hauser, Unassigned)


40 Branch

Firefox Tracking Flags

(Not tracked)




2 years ago
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0
Build ID: 20150826023504

Steps to reproduce:

I tried to drop the file nohup.out and failed.
As another application locked the file, this is not so surpring.

Actual results:

the XMLHttpRequestProgressEvent.message said 'undefined'

Expected results:

It should say "Permission denied on file 'nohup.out' "

Also, I was surprised according to 
https://developer.mozilla.org/es/docs/XMLHttpRequest/Using_XMLHttpRequest#Monitoring_progress that
evt.lengthComputable was false and thus trying to read
    var percentComplete = evt.loaded / evt.total;
should not be tried instead of 'loaded' be set to 0 or maybe -1 and total to the file size (1780b in my case on debian stable)


2 years ago
Component: Untriaged → DOM: Events
Product: Firefox → Core
I don't understand what XMLHttpRequestProgressEvent.message is about.

Comment 2

2 years ago
Olli, you can try it yourself on https://dev.p4u.ch/r 

Basically, in

request.onerror = function(e) {

the "e" we get is of type XMLHttpRequestProgressEvent and I would expect some meaningful information like "Permission denied on file 'nohup.out' " to be placed in the message field.

Or should I look elsewhere for error information?
There is no such thing as XMLHttpRequestProgressEvent. There is ProgressEvent, but it doesn't have .message.
But to check the status of the request, use XMLHttpRequest.status https://xhr.spec.whatwg.org/#dom-xmlhttprequest-status ?

If you want something new to the API, please file a spec bug.

Comment 4

2 years ago
hmm, I doubt it gets that far.

It might already die in the below "append" before  new XMLHttpRequest() is executed?

var formData = new FormData();
var files = ev.dataTransfer.files;
for (var i = 0; i < files.length; i++) {
formData.append('file', files[i]);

On the other hand, the error may occur as late as when serializing for the form for the "send"

Might it make sense to define a 

formData.onerror = function(e) {

to aleady catch errors during the "append" ?

   client.onreadystatechange = function() {
     if(this.readyState == this.HEADERS_RECEIVED) {
most likely won't get us far because it never gets to send any headers let alone receive response headers from the server

Comment 5

2 years ago

e.target.status and e.target.statusText result in '0' and ''
You need to log in before you can comment on or make changes to this bug.