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

Unified Diff: ui/file_manager/file_manager/foreground/js/file_manager_commands.js

Issue 550943003: Warn on executing command on unsupported elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/file_manager_commands.js
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
index 31bc19ffcfec16ed0a561eefb183b3a343609801..52e9d88ad74cdb3460debffca92d99f99f4812e7 100644
--- a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
+++ b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
@@ -60,7 +60,6 @@ CommandUtil.getCommandEntry = function(element) {
// Check if it is Entry or not by checking for toURL().
return entry && 'toURL' in entry ? entry : null;
} else {
- console.warn('Unsupported element');
return null;
}
};
@@ -329,8 +328,11 @@ CommandHandler.COMMANDS_['unmount'] = {
*/
execute: function(event, fileManager) {
var root = CommandUtil.getCommandEntry(event.target);
- if (!root)
+ if (!root) {
+ console.warn('unmount command executed on an element which does not ' +
+ 'have corresponding entry.');
return;
+ }
var errorCallback = function() {
fileManager.alert.showHtml('', str('UNMOUNT_FAILED'));
};
@@ -806,8 +808,12 @@ CommandHandler.COMMANDS_['create-folder-shortcut'] = {
*/
execute: function(event, fileManager) {
var entry = CommandUtil.getCommandEntry(event.target);
- if (entry)
- fileManager.createFolderShortcut(entry);
+ if (!entry) {
+ console.warn('create-folder-shortcut command executed on an element ' +
+ 'which does not have corresponding entry.');
+ return;
+ }
+ fileManager.createFolderShortcut(entry);
},
/**
@@ -846,8 +852,12 @@ CommandHandler.COMMANDS_['remove-folder-shortcut'] = {
*/
execute: function(event, fileManager) {
var entry = CommandUtil.getCommandEntry(event.target);
- if (entry)
- fileManager.removeFolderShortcut(entry);
+ if (!entry) {
+ console.warn('remove-folder-shortcut command executed on an element ' +
+ 'which does not have corresponding entry.');
+ return;
+ }
+ fileManager.removeFolderShortcut(entry);
},
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698