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

Unified Diff: chrome/browser/resources/file_manager/js/util.js

Issue 22150006: Re-implement cancellation of copyFileEntry_(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
Index: chrome/browser/resources/file_manager/js/util.js
diff --git a/chrome/browser/resources/file_manager/js/util.js b/chrome/browser/resources/file_manager/js/util.js
index b31f4048d11b8df160f6bc7d5cf0946f6f1a6e96..f8a8ea29f7ab66560f2f62d55715141def3ebdd5 100644
--- a/chrome/browser/resources/file_manager/js/util.js
+++ b/chrome/browser/resources/file_manager/js/util.js
@@ -505,11 +505,7 @@ util.deduplicatePath = function(dirEntry, relativePath, onSuccess, onError) {
// Hit the limit of the number of retrial.
// Note that we cannot create FileError object directly, so here we use
// Object.create instead.
- onError(Object.create(FileError.prototype, {
- code: {
- get: function() { return FileError.PATH_EXISTS_ERR; }
- }
- }));
+ onError(util.createFileError(FileError.PATH_EXISTS_ERR));
return;
}
@@ -1158,3 +1154,17 @@ util.EntryChangedType = {
CREATED: 0,
DELETED: 1,
};
+
+
+/**
+ * Creates a FileError instance with given code.
+ * Note that we cannot create FileError instance by "new FileError(code)",
+ * unfortunately, so here we use Object.create.
+ * @param {number} code Error code for the FileError.
+ * @return {FileError} FileError instance
+ */
+util.createFileError = function(code) {
+ return Object.create(FileError.prototype, {
+ code: { get: function() { return code; } }
+ });
+};

Powered by Google App Engine
This is Rietveld 408576698