Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: chrome/browser/resources/net_internals/import_view.js

Issue 9596003: [WebUI] Make drag'n'drop future proof. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: doc Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/ntp4/apps_page.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/net_internals/import_view.js
diff --git a/chrome/browser/resources/net_internals/import_view.js b/chrome/browser/resources/net_internals/import_view.js
index f8c9c7ab88a17605abe0b54332ec9b089b56381c..9045bc0404e25745fe2a5f6f7902f215c1b70d54 100644
--- a/chrome/browser/resources/net_internals/import_view.js
+++ b/chrome/browser/resources/net_internals/import_view.js
@@ -80,7 +80,13 @@ var ImportView = (function() {
* security reasons, which is why we allow the |files| array to be empty.
*/
onDrag: function(event) {
- return !event.dataTransfer.types.contains('Files') ||
+ // NOTE: Use Array.prototype.indexOf here is necessary while WebKit
+ // decides which type of data structure dataTransfer.types will be
+ // (currently between DOMStringList and Array). These have different APIs
+ // so assuming one type or the other was breaking things. See
+ // http://crbug.com/115433. TODO(dbeam): Remove when standardized more.
+ var indexOf = Array.prototype.indexOf;
+ return indexOf.call(event.dataTransfer.types, 'Files') == -1 ||
event.dataTransfer.files.length > 1;
},
@@ -89,7 +95,8 @@ var ImportView = (function() {
* file, tries to load it as a log file.
*/
onDrop: function(event) {
- if (!event.dataTransfer.types.contains('Files') ||
+ var indexOf = Array.prototype.indexOf;
+ if (indexOf.call(event.dataTransfer.types, 'Files') == -1 ||
event.dataTransfer.files.length != 1) {
return;
}
« no previous file with comments | « no previous file | chrome/browser/resources/ntp4/apps_page.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698