Backed out changeset d319322e33cc (bug 1379256)

This commit is contained in:
Sebastian Hengst 2017-08-12 13:48:01 +02:00
Родитель 38703f6066
Коммит 1f19257b7d
26 изменённых файлов: 147 добавлений и 97 удалений

Просмотреть файл

@ -0,0 +1,14 @@
"use strict";
module.exports = {
"rules": {
"consistent-return": "off",
"no-irregular-whitespace": "off",
"no-lone-blocks": "off",
"no-redeclare": "off",
"no-self-assign": "off",
"no-shadow": "off",
"no-unused-vars": "off",
"object-shorthand": "off",
}
};

Просмотреть файл

@ -261,7 +261,7 @@ var Scheduler = this.Scheduler = {
/**
* Restart the OS.File worker killer timer.
*/
restartTimer(arg) {
restartTimer: function(arg) {
this.hasRecentActivity = true;
},
@ -275,7 +275,7 @@ var Scheduler = this.Scheduler = {
* would not cause leaks. Otherwise, assume that the worker will be shutdown
* through some other mean.
*/
kill({shutdown, reset}) {
kill: function({shutdown, reset}) {
// Grab the kill queue to make sure that we
// cannot be interrupted by another call to `kill`.
let killQueue = this._killQueue;
@ -382,7 +382,7 @@ var Scheduler = this.Scheduler = {
* @return {Promise} A promise with the same behavior as
* the promise returned by |code|.
*/
push(code) {
push: function(code) {
let promise = this.queue.then(code);
// By definition, |this.queue| can never reject.
this.queue = promise.catch(() => undefined);
@ -482,7 +482,7 @@ var Scheduler = this.Scheduler = {
*
* This is only useful on first launch.
*/
_updateTelemetry() {
_updateTelemetry: function() {
let worker = this.worker;
let workerTimeStamps = worker.workerTimeStamps;
if (!workerTimeStamps) {
@ -1270,10 +1270,10 @@ var DirectoryIterator = function DirectoryIterator(path, options) {
this._isClosed = false;
};
DirectoryIterator.prototype = {
iterator() {
iterator: function() {
return this;
},
__iterator__() {
__iterator__: function() {
return this;
},
@ -1481,7 +1481,7 @@ this.OS.Path = Path;
// Returns a resolved promise when all the queued operation have been completed.
Object.defineProperty(OS.File, "queue", {
get() {
get: function() {
return Scheduler.queue;
}
});
@ -1500,7 +1500,7 @@ var Barriers = {
/**
* Return the shutdown state of OS.File
*/
getDetails() {
getDetails: function() {
let result = {
launched: Scheduler.launched,
shutdown: Scheduler.shutdown,

Просмотреть файл

@ -59,7 +59,7 @@ if (this.Components) {
/**
* Get a resource from its unique identifier.
*/
get(id) {
get: function(id) {
let result = this._map.get(id);
if (result == null) {
return result;
@ -69,7 +69,7 @@ if (this.Components) {
/**
* Remove a resource from its unique identifier.
*/
remove(id) {
remove: function(id) {
if (!this._map.has(id)) {
throw new Error("Cannot find resource id " + id);
}
@ -84,9 +84,9 @@ if (this.Components) {
* @return {*} A unique identifier. For the moment, this is a number,
* but this might not remain the case forever.
*/
add(resource, info) {
add: function(resource, info) {
let id = this._idgen++;
this._map.set(id, {resource, info});
this._map.set(id, {resource: resource, info: info});
return id;
},
/**
@ -154,12 +154,12 @@ if (this.Components) {
*/
let Agent = {
// Update worker's OS.Shared.DEBUG flag message from controller.
SET_DEBUG(aDEBUG) {
SET_DEBUG: function(aDEBUG) {
SharedAll.Config.DEBUG = aDEBUG;
},
// Return worker's current OS.Shared.DEBUG value to controller.
// Note: This is used for testing purposes.
GET_DEBUG() {
GET_DEBUG: function() {
return SharedAll.Config.DEBUG;
},
/**
@ -168,7 +168,7 @@ if (this.Components) {
* @param {bool} If |true|, kill the worker if this would not cause
* leaks.
*/
Meta_shutdown(kill) {
Meta_shutdown: function(kill) {
let result = {
openedFiles: OpenedFiles.listOpenedResources(),
openedDirectoryIterators: OpenedDirectoryIterators.listOpenedResources(),
@ -269,7 +269,7 @@ if (this.Components) {
options
);
},
removeDir(path, options) {
removeDir: function(path, options) {
return File.removeDir(Type.path.fromMsg(path), options);
},
new_DirectoryIterator: function new_DirectoryIterator(path, options) {

Просмотреть файл

@ -109,7 +109,7 @@ var defineLazyGetter = function defineLazyGetter(object, name, getter) {
delete this[name];
let value = getter.call(this);
Object.defineProperty(object, name, {
value
value: value
});
return value;
}
@ -213,10 +213,10 @@ var clone = function(object, refs = []) {
let refer = function refer(result, key, object) {
Object.defineProperty(result, key, {
enumerable: true,
get() {
get: function() {
return object[key];
},
set(value) {
set: function(value) {
object[key] = value;
}
});
@ -301,7 +301,7 @@ Type.prototype = {
this);
Object.defineProperty(this, "in_ptr",
{
get() {
get: function() {
return ptr_t;
}
});
@ -319,7 +319,7 @@ Type.prototype = {
this);
Object.defineProperty(this, "out_ptr",
{
get() {
get: function() {
return ptr_t;
}
});
@ -341,7 +341,7 @@ Type.prototype = {
this);
Object.defineProperty(this, "inout_ptr",
{
get() {
get: function() {
return ptr_t;
}
});
@ -865,7 +865,7 @@ HollowStructure.prototype = {
" at offset " + offset +
" without exceeding its size of " + this.size);
}
let field = {name, type};
let field = {name: name, type: type};
this.offset_to_field_info[offset] = field;
},
@ -991,7 +991,7 @@ Library.prototype = Object.freeze({
}
let error = new Error("Could not open library " + this.name);
Object.defineProperty(this, "library", {
get() {
get: function() {
throw error;
}
});
@ -1010,10 +1010,10 @@ Library.prototype = Object.freeze({
* @param {Type} returnType The type of values returned by the function.
* @param {...Type} argTypes The type of arguments to the function.
*/
declareLazyFFI(object, field, ...args) {
declareLazyFFI: function(object, field, ...args) {
let lib = this;
Object.defineProperty(object, field, {
get() {
get: function() {
delete this[field];
let ffi = declareFFI(lib.library, ...args);
if (ffi) {
@ -1037,10 +1037,10 @@ Library.prototype = Object.freeze({
* @param {ctypes.CType} returnType The type of values returned by the function.
* @param {...ctypes.CType} argTypes The type of arguments to the function.
*/
declareLazy(object, field, ...args) {
declareLazy: function(object, field, ...args) {
let lib = this;
Object.defineProperty(object, field, {
get() {
get: function() {
delete this[field];
let ffi = lib.library.declare(...args);
if (ffi) {
@ -1067,10 +1067,10 @@ Library.prototype = Object.freeze({
* @param {ctypes.CType} returnType The type of values returned by the function.
* @param {...ctypes.CType} argTypes The type of arguments to the function.
*/
declareLazyWithFallback(fallbacklibrary, object, field, ...args) {
declareLazyWithFallback: function(fallbacklibrary, object, field, ...args) {
let lib = this;
Object.defineProperty(object, field, {
get() {
get: function() {
delete this[field];
try {
let ffi = lib.library.declare(...args);
@ -1089,7 +1089,7 @@ Library.prototype = Object.freeze({
});
},
toString() {
toString: function() {
return "[Library " + this.name + "]";
}
});
@ -1126,6 +1126,7 @@ var declareFFI = function declareFFI(lib, symbol, abi,
throw new TypeError("declareFFI expects as third argument an instance of Type");
}
let signature = [symbol, abi];
let argtypes = [];
for (let i = 3; i < arguments.length; ++i) {
let current = arguments[i];
if (!current) {
@ -1175,7 +1176,7 @@ exports.declareFFI = declareFFI;
*/
function declareLazyFFI(object, field, ...declareFFIArgs) {
Object.defineProperty(object, field, {
get() {
get: function() {
delete this[field];
let ffi = declareFFI(...declareFFIArgs);
if (ffi) {
@ -1203,7 +1204,7 @@ exports.declareLazyFFI = declareLazyFFI;
*/
function declareLazy(object, field, lib, ...declareArgs) {
Object.defineProperty(object, field, {
get() {
get: function() {
delete this[field];
try {
let ffi = lib.declare(...declareArgs);
@ -1278,31 +1279,31 @@ exports.OSError = OSError;
exports.OS = {
Constants: exports.Constants,
Shared: {
LOG,
clone,
Type,
HollowStructure,
LOG: LOG,
clone: clone,
Type: Type,
HollowStructure: HollowStructure,
Error: OSError,
declareFFI,
projectValue,
isTypedArray,
defineLazyGetter
declareFFI: declareFFI,
projectValue: projectValue,
isTypedArray: isTypedArray,
defineLazyGetter: defineLazyGetter
}
};
Object.defineProperty(exports.OS.Shared, "DEBUG", {
get() {
get: function() {
return Config.DEBUG;
},
set(x) {
set: function(x) {
return Config.DEBUG = x;
}
});
Object.defineProperty(exports.OS.Shared, "TEST", {
get() {
get: function() {
return Config.TEST;
},
set(x) {
set: function(x) {
return Config.TEST = x;
}
});

Просмотреть файл

@ -22,7 +22,7 @@ var SharedAll =
var Path = require("resource://gre/modules/osfile/ospath.jsm");
var Lz4 =
require("resource://gre/modules/lz4.js");
SharedAll.LOG.bind(SharedAll, "Shared front-end");
var LOG = SharedAll.LOG.bind(SharedAll, "Shared front-end");
var clone = SharedAll.clone;
/**
@ -152,7 +152,7 @@ AbstractFile.openUnique = function openUnique(path, options = {}) {
try {
return {
path,
path: path,
file: OS.File.open(path, mode)
};
} catch (ex) {
@ -179,7 +179,6 @@ AbstractFile.openUnique = function openUnique(path, options = {}) {
}
throw OS.File.Error.exists("could not find an unused file name.", path);
}
throw ex;
}
};

Просмотреть файл

@ -37,7 +37,7 @@ if (typeof Components != "undefined") {
throw new Error("Please open this module with Component.utils.import or with require()");
}
SharedAll.LOG.bind(SharedAll, "Unix", "allthreads");
var LOG = SharedAll.LOG.bind(SharedAll, "Unix", "allthreads");
var Const = SharedAll.Constants.libc;
// Open libc

Просмотреть файл

@ -5,7 +5,6 @@
/* eslint-env mozilla/chrome-worker, node */
/* global OS */
// eslint-disable-next-line no-lone-blocks
{
if (typeof Components != "undefined") {
// We do not wish osfile_unix_back.jsm to be used directly as a main thread
@ -25,7 +24,7 @@
require("resource://gre/modules/osfile/osfile_shared_allthreads.jsm");
let SysAll =
require("resource://gre/modules/osfile/osfile_unix_allthreads.jsm");
SharedAll.LOG.bind(SharedAll, "Unix", "back");
let LOG = SharedAll.LOG.bind(SharedAll, "Unix", "back");
let libc = SysAll.libc;
let Const = SharedAll.Constants.libc;
@ -36,18 +35,19 @@
*/
// FIXME: Both |init| and |aDeclareFFI| are deprecated, we should remove them
let init = function init(aDeclareFFI) {
let declareFFI;
if (aDeclareFFI) {
aDeclareFFI.bind(null, libc);
declareFFI = aDeclareFFI.bind(null, libc);
} else {
SysAll.declareFFI;
declareFFI = SysAll.declareFFI;
}
SharedAll.declareLazyFFI;
let declareLazyFFI = SharedAll.declareLazyFFI;
// Initialize types that require additional OS-specific
// support - either finalization or matching against
// OS-specific constants.
let Type = Object.create(SysAll.Type);
let SysFile = exports.OS.Unix.File = { Type };
let SysFile = exports.OS.Unix.File = { Type: Type };
/**
* A file descriptor.

Просмотреть файл

@ -12,7 +12,6 @@
/* eslint-env mozilla/chrome-worker, node */
/* global OS */
// eslint-disable-next-line no-lone-blocks
{
if (typeof Components != "undefined") {
// We do not wish osfile_unix_front.jsm to be used directly as a main thread
@ -32,7 +31,7 @@
let Path = require("resource://gre/modules/osfile/ospath.jsm");
let SysAll = require("resource://gre/modules/osfile/osfile_unix_allthreads.jsm");
exports.OS.Unix.File._init();
SharedAll.LOG.bind(SharedAll, "Unix front-end");
let LOG = SharedAll.LOG.bind(SharedAll, "Unix front-end");
let Const = SharedAll.Constants.libc;
let UnixFile = exports.OS.Unix.File;
let Type = UnixFile.Type;
@ -223,7 +222,7 @@
*/
if (SharedAll.Constants.Sys.Name != "Android") {
File.prototype.setDates = function(accessDate, modificationDate) {
let { /* value, */ ptr} = datesToTimevals(accessDate, modificationDate);
let {value, ptr} = datesToTimevals(accessDate, modificationDate);
throw_on_negative("setDates",
UnixFile.futimes(this.fd, ptr),
this._path);
@ -556,6 +555,7 @@
// Perform actual copy
let total_read = 0;
while (true) {
let chunk_size = Math.min(nbytes, bufSize);
let bytes_just_read = read(pump_buffer, bufSize);
if (bytes_just_read == 0) {
return total_read;
@ -646,6 +646,7 @@
// copy directories
File.copy = function copy(sourcePath, destPath, options = {}) {
let source, dest;
let result;
try {
source = File.open(sourcePath);
// Need to open the output file with |append:false|, or else |splice|
@ -656,9 +657,9 @@
dest = File.open(destPath, {trunc: true, append: false});
}
if (options.unixUserland) {
pump_userland(source, dest, options);
result = pump_userland(source, dest, options);
} else {
pump(source, dest, options);
result = pump(source, dest, options);
}
} catch (x) {
if (dest) {
@ -1001,7 +1002,7 @@
* @throws {OS.File.Error} In case of I/O error.
*/
File.setDates = function setDates(path, accessDate, modificationDate) {
let {/* value, */ ptr} = datesToTimevals(accessDate, modificationDate);
let {value, ptr} = datesToTimevals(accessDate, modificationDate);
throw_on_negative("setDates",
UnixFile.utimes(path, ptr),
path);
@ -1081,10 +1082,10 @@
* Get/set the current directory.
*/
Object.defineProperty(File, "curDir", {
set(path) {
set: function(path) {
this.setCurrentDirectory(path);
},
get() {
get: function() {
return this.getCurrentDirectory();
}
}

Просмотреть файл

@ -37,7 +37,7 @@ if (typeof Components != "undefined") {
throw new Error("Please open this module with Component.utils.import or with require()");
}
SharedAll.LOG.bind(SharedAll, "Win", "allthreads");
var LOG = SharedAll.LOG.bind(SharedAll, "Win", "allthreads");
var Const = SharedAll.Constants.Win;
// Open libc
@ -85,6 +85,7 @@ libc.declareLazy(Scope, "FormatMessage",
*/
var OSError = function OSError(operation = "unknown operation",
lastError = ctypes.winLastError, path = "") {
operation = operation;
SharedAll.OSError.call(this, operation, path);
this.winLastError = lastError;
};

Просмотреть файл

@ -22,7 +22,6 @@
/* eslint-env mozilla/chrome-worker, node */
/* global OS */
// eslint-disable-next-line no-lone-blocks
{
if (typeof Components != "undefined") {
// We do not wish osfile_win.jsm to be used directly as a main thread
@ -41,7 +40,7 @@
let SharedAll = require("resource://gre/modules/osfile/osfile_shared_allthreads.jsm");
let SysAll = require("resource://gre/modules/osfile/osfile_win_allthreads.jsm");
SharedAll.LOG.bind(SharedAll, "Unix", "back");
let LOG = SharedAll.LOG.bind(SharedAll, "Unix", "back");
let libc = SysAll.libc;
let advapi32 = new SharedAll.Library("advapi32", "advapi32.dll");
let Const = SharedAll.Constants.Win;
@ -53,19 +52,19 @@
*/
// FIXME: Both |init| and |aDeclareFFI| are deprecated, we should remove them
let init = function init(aDeclareFFI) {
let declareFFI; // eslint-disable-line no-unused-vars
let declareFFI;
if (aDeclareFFI) {
declareFFI = aDeclareFFI.bind(null, libc);
} else {
declareFFI = SysAll.declareFFI;
}
let declareLazyFFI = SharedAll.declareLazyFFI; // eslint-disable-line no-unused-vars
let declareLazyFFI = SharedAll.declareLazyFFI;
// Initialize types that require additional OS-specific
// support - either finalization or matching against
// OS-specific constants.
let Type = Object.create(SysAll.Type);
let SysFile = exports.OS.Win.File = { Type };
let SysFile = exports.OS.Win.File = { Type: Type };
// Initialize types

Просмотреть файл

@ -12,7 +12,6 @@
/* eslint-env mozilla/chrome-worker, node */
/* global OS */
// eslint-disable-next-line no-lone-blocks
{
if (typeof Components != "undefined") {
// We do not wish osfile_win_front.jsm to be used directly as a main thread
@ -1154,10 +1153,10 @@
* Get/set the current directory by |curDir|.
*/
Object.defineProperty(File, "curDir", {
set(path) {
set: function(path) {
this.setCurrentDirectory(path);
},
get() {
get: function() {
return this.getCurrentDirectory();
}
}
@ -1196,6 +1195,40 @@
return result;
}
/**
* Utility function to sort errors represented as "-1" from successes.
*
* @param {string=} operation The name of the operation. If unspecified,
* the name of the caller function.
* @param {number} result The result of the operation that may
* represent either an error or a success. If -1, this function raises
* an error holding ctypes.winLastError, otherwise it returns |result|.
* @param {string=} path The path of the file.
*/
function throw_on_negative(operation, result, path) {
if (result < 0) {
throw new File.Error(operation, ctypes.winLastError, path);
}
return result;
}
/**
* Utility function to sort errors represented as |null| from successes.
*
* @param {string=} operation The name of the operation. If unspecified,
* the name of the caller function.
* @param {pointer} result The result of the operation that may
* represent either an error or a success. If |null|, this function raises
* an error holding ctypes.winLastError, otherwise it returns |result|.
* @param {string=} path The path of the file.
*/
function throw_on_null(operation, result, path) {
if (result == null || (result.isNull && result.isNull())) {
throw new File.Error(operation, ctypes.winLastError, path);
}
return result;
}
/**
* Helper used by both versions of setPermissions
*/

Просмотреть файл

@ -407,7 +407,7 @@ var test_debug_test = maketest("debug_test", function debug_test(test) {
return (async function() {
// Create a console listener.
let consoleListener = {
observe(aMessage) {
observe: function(aMessage) {
// Ignore unexpected messages.
if (!(aMessage instanceof Components.interfaces.nsIConsoleMessage)) {
return;
@ -420,7 +420,7 @@ var test_debug_test = maketest("debug_test", function debug_test(test) {
};
toggleDebugTest(true, consoleListener);
// Execution of OS.File.exist method will trigger OS.File.LOG several times.
await OS.File.exists(EXISTING_FILE);
let fileExists = await OS.File.exists(EXISTING_FILE);
toggleDebugTest(false, consoleListener);
})();
});

Просмотреть файл

@ -65,7 +65,7 @@ function test_open_non_existing_file() {
info("Starting test_open_non_existing");
let exn;
try {
OS.File.open("/I do not exist");
let file = OS.File.open("/I do not exist");
} catch (x) {
exn = x;
info("test_open_non_existing_file: Exception detail " + exn);

Просмотреть файл

@ -19,12 +19,12 @@ function ok(condition, description) {
function is(a, b, description) {
let outcome = a == b; // Need to decide outcome here, as not everything can be serialized
send({kind: "is", outcome, description: "" + description, a: "" + a, b: "" + b});
send({kind: "is", outcome: outcome, description: "" + description, a: "" + a, b: "" + b});
}
function isnot(a, b, description) {
let outcome = a != b; // Need to decide outcome here, as not everything can be serialized
send({kind: "isnot", outcome, description: "" + description, a: "" + a, b: "" + b});
send({kind: "isnot", outcome: outcome, description: "" + description, a: "" + a, b: "" + b});
}
function info(description) {

Просмотреть файл

@ -118,7 +118,7 @@ function test_read_write() {
break;
}
while (bytes > 0) {
array.addressOfElement(write_from);
let ptr = array.addressOfElement(write_from);
// Note: |write| launches an exception in case of error
let written = OS.Unix.File.write(output, array, bytes);
isnot(written, -1, "test_read_write: no write error");
@ -186,7 +186,7 @@ function test_passing_undefined() {
let exceptionRaised = false;
try {
OS.Unix.File.open(undefined, OS.Constants.libc.O_RDWR
let file = OS.Unix.File.open(undefined, OS.Constants.libc.O_RDWR
| OS.Constants.libc.O_CREAT
| OS.Constants.libc.O_TRUNC,
OS.Constants.libc.S_IRWXU);

Просмотреть файл

@ -122,7 +122,7 @@ function test_ReadWrite() {
}
while (bytes_left.value > 0) {
log("test_ReadWrite: writing " + bytes_left.value);
array.addressOfElement(write_from);
let ptr = array.addressOfElement(write_from);
// Note: |WriteFile| launches an exception in case of error
result = OS.Win.File.WriteFile(output, array, bytes_left, bytes_written_ptr, null);
isnot(result, 0, "test_ReadWrite: write success");
@ -193,7 +193,7 @@ function test_passing_undefined() {
let exceptionRaised = false;
try {
OS.Win.File.CreateFile(
let file = OS.Win.File.CreateFile(
undefined,
OS.Constants.Win.GENERIC_READ,
0,

Просмотреть файл

@ -36,7 +36,7 @@ add_task(async function test_uncompressed() {
for (let i = 0; i < array.byteLength; ++i) {
array[i] = i;
}
await OS.File.writeAtomic(path, array); // No compression
let bytes = await OS.File.writeAtomic(path, array); // No compression
let exn;
// Force decompression, reading should fail
@ -56,7 +56,7 @@ add_task(async function test_no_header() {
do_print("Writing data with no header");
await OS.File.writeAtomic(path, array); // No compression
let bytes = await OS.File.writeAtomic(path, array); // No compression
let exn;
// Force decompression, reading should fail
try {
@ -80,7 +80,7 @@ add_task(async function test_invalid_content() {
do_print("Writing invalid data (with a valid header and only ones after that)");
await OS.File.writeAtomic(path, array); // No compression
let bytes = await OS.File.writeAtomic(path, array); // No compression
let exn;
// Force decompression, reading should fail
try {

Просмотреть файл

@ -15,7 +15,7 @@ add_task(async function test_deprecatedCreationDate() {
let consoleMessagePromise = new Promise(resolve => {
let consoleListener = {
observe(aMessage) {
observe: function(aMessage) {
if (aMessage.message.indexOf("Field 'creationDate' is deprecated.") > -1) {
do_print("Deprecation message printed");
do_check_true(true);

Просмотреть файл

@ -59,7 +59,7 @@ add_task(async function duration() {
// duration measurement then progressively incremented.
outSerializationDuration: null,
outExecutionDuration: null,
tmpPath
tmpPath: tmpPath
};
await OS.File.writeAtomic(pathDest, contents, writeAtomicOptions);
testOptions(writeAtomicOptions, "OS.File.writeAtomic");

Просмотреть файл

@ -15,7 +15,7 @@ function run_test() {
// Create a console listener.
let consoleListener = {
observe(aMessage) {
observe: function(aMessage) {
// Ignore unexpected messages.
if (!(aMessage instanceof Components.interfaces.nsIConsoleMessage)) {
return;
@ -71,3 +71,4 @@ function run_test() {
// Once both messages are observed OS.Shared.DEBUG, and OS.Shared.TEST
// are reset to false.
}

Просмотреть файл

@ -62,6 +62,8 @@ async function test_setPosition_failures() {
try {
let file = await OS.File.open(path, {write: true, append: false});
try {
let pos = 0;
// 1. Use an invalid position value
try {
await file.setPosition(0.5, OS.File.POS_START);
@ -112,7 +114,7 @@ function run_test() {
add_task(test_setPosition.bind(null, 1000, 100, 50));
add_task(test_setPosition.bind(null, 1000, -100, -50));
if (OS.Constants.Win || ctypes.off_t.size >= 8) {
if (OS.Constants.Win || ctypes.off_t.size >= 8) {
// Now verify stuff still works for large values.
// 1. Multiple small seeks, which add up to > MAXINT32
add_task(test_setPosition.bind(null, 0x7fffffff, 0x7fffffff, 0));

Просмотреть файл

@ -1,7 +1,5 @@
"use strict";
/* eslint-disable no-lone-blocks */
Components.utils.import("resource://gre/modules/osfile.jsm");
/**
@ -108,7 +106,7 @@ add_task(async function test_proto() {
"test_osfile_async_setDates_proto.tmp");
await OS.File.writeAtomic(path, new Uint8Array(1));
try {
try {
let fd = await OS.File.open(path, {write: true});
try {

Просмотреть файл

@ -62,7 +62,7 @@ add_task(async function test_kill_race() {
await OS.File.exists("foo.foo");
do_print("issuing first request");
let firstRequest = OS.File.exists("foo.bar"); // eslint-disable-line no-unused-vars
let firstRequest = OS.File.exists("foo.bar");
let secondRequest;
let secondResolved = false;

Просмотреть файл

@ -103,6 +103,7 @@ add_task(async function test_non_backupTo_option() {
* @result no back up file exists
*/
add_task(async function test_backupTo_option_without_destination_file() {
let DEFAULT_CONTENTS = "default contents" + Math.random();
let WRITE_CONTENTS = "abc" + Math.random();
let path = Path.join(Constants.Path.tmpDir,
"test_backupTo_option_without_destination_file.tmp");

Просмотреть файл

@ -16,7 +16,7 @@ add_task(async function check_init() {
// after an operation is successful.
add_task(async function check_success() {
do_print("Attempting to open a file correctly");
await OS.File.open(OS.Path.join(do_get_cwd().path, "test_queue.js"));
let openedFile = await OS.File.open(OS.Path.join(do_get_cwd().path, "test_queue.js"));
do_print("File opened correctly");
await OS.File.queue;
do_print("Function resolved");

Просмотреть файл

@ -86,7 +86,7 @@ add_test_pair(async function read_write_all() {
let array2 = await OS.File.read(DEST_PATH);
do_check_eq(LENGTH, array2.length);
for (var j = 0; j < LENGTH; j++)
for (var i = 0; i < LENGTH; i++)
do_check_eq(array2[i], (i + START) % 256);
// Cleanup.