Improve: Specifically allow application/x-moz-file as a drag and drop valid case
The original logic was a bit hard to understand, I changed everything to compare with -1 This is quite easier to read Pull-request: #20189 Ref: #18557 Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
parent
84c971aaa3
commit
03ef236b57
@ -214,7 +214,7 @@ var DragDropImport = {
|
||||
}
|
||||
|
||||
// Not a file drag at all
|
||||
if ($.inArray('Files', types) < 0) {
|
||||
if ($.inArray('Files', types) === -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -222,12 +222,12 @@ var DragDropImport = {
|
||||
// "Firefox also adds a non-standard text item of type application/x-moz-file
|
||||
// containing the full path of the file on the user's file system. Unless within
|
||||
// privileged code (such as an extension), its value is the empty string."
|
||||
if ($.inArray('application/x-moz-file', types) > 0) {
|
||||
if ($.inArray('application/x-moz-file', types) !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Firefox native image drag - exclude it
|
||||
if ($.inArray('application/x-moz-nativeimage', types) >= 0) {
|
||||
if ($.inArray('application/x-moz-nativeimage', types) === -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -235,7 +235,7 @@ var DragDropImport = {
|
||||
// dragging browser-internal elements like images or icons. These drags also
|
||||
// include 'text/uri-list' and/or 'text/html', which are not present when
|
||||
// the user is dragging a real file from the OS filesystem.
|
||||
if ($.inArray('text/uri-list', types) >= 0 || $.inArray('text/html', types) >= 0) {
|
||||
if ($.inArray('text/uri-list', types) !== -1 || $.inArray('text/html', types) !== -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user