| 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; } }
|
| + });
|
| +};
|
|
|