--- a/addon-sdk/source/lib/sdk/addon/installer.js
+++ b/addon-sdk/source/lib/sdk/addon/installer.js
@@ -29,17 +29,17 @@ exports.ERROR_FILE_ACCESS = AddonManager
* @return {Promise}
* A promise resolved when the addon is finally installed.
* Resolved with addon id as value or rejected with an error code.
*/
exports.install = function install(xpiPath) {
let { promise, resolve, reject } = defer();
// Create nsIFile for the xpi file
- let file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile);
+ let file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
try {
file.initWithPath(xpiPath);
}
catch(e) {
reject(exports.ERROR_FILE_ACCESS);
return promise;
}
--- a/addon-sdk/source/lib/sdk/io/file.js
+++ b/addon-sdk/source/lib/sdk/io/file.js
@@ -23,17 +23,17 @@ const OPEN_FLAGS = {
EXCL: parseInt("0x80")
};
var dirsvc = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties);
function MozFile(path) {
var file = Cc['@mozilla.org/file/local;1']
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
file.initWithPath(path);
return file;
}
function ensureReadable(file) {
if (!file.isReadable())
throw new Error("path is not readable: " + file.path);
}
--- a/addon-sdk/source/lib/sdk/io/fs.js
+++ b/addon-sdk/source/lib/sdk/io/fs.js
@@ -13,17 +13,17 @@ lazyRequire(this, "../timers", "setTimeo
lazyRequire(this, "./stream", "Stream", "InputStream", "OutputStream");
lazyRequire(this, "../event/core", "emit", "on");
lazyRequire(this, "./buffer", "Buffer");
const { ns } = require("../core/namespace");
const { Class } = require("../core/heritage");
-const nsILocalFile = CC("@mozilla.org/file/local;1", "nsILocalFile",
+const nsIFile = CC("@mozilla.org/file/local;1", "nsIFile",
"initWithPath");
const FileOutputStream = CC("@mozilla.org/network/file-output-stream;1",
"nsIFileOutputStream", "init");
const FileInputStream = CC("@mozilla.org/network/file-input-stream;1",
"nsIFileInputStream", "init");
const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
"nsIBinaryInputStream", "setInputStream");
const BinaryOutputStream = CC("@mozilla.org/binaryoutputstream;1",
@@ -105,17 +105,17 @@ function toArray(enumerator) {
}
function getFileName(file) {
return file.QueryInterface(Ci.nsIFile).leafName;
}
function remove(path, recursive) {
- let fd = new nsILocalFile(path)
+ let fd = new nsIFile(path)
if (fd.exists()) {
fd.remove(recursive || false);
}
else {
throw FSError("remove", "ENOENT", 34, path);
}
}
@@ -251,17 +251,17 @@ const WriteStream = Class({
});
exports.WriteStream = WriteStream;
exports.createWriteStream = function createWriteStream(path, options) {
return new WriteStream(path, options);
};
const Stats = Class({
initialize: function initialize(path) {
- let file = new nsILocalFile(path);
+ let file = new nsIFile(path);
if (!file.exists()) throw FSError("stat", "ENOENT", 34, path);
nsIFile(this, file);
},
isDirectory: function() {
return nsIFile(this).isDirectory();
},
isFile: function() {
return nsIFile(this).isFile();
@@ -353,35 +353,35 @@ function Async(wrapped) {
}
}
/**
* Synchronous rename(2)
*/
function renameSync(oldPath, newPath) {
- let source = new nsILocalFile(oldPath);
- let target = new nsILocalFile(newPath);
+ let source = new nsIFile(oldPath);
+ let target = new nsIFile(newPath);
if (!source.exists()) throw FSError("rename", "ENOENT", 34, oldPath);
return source.moveTo(target.parent, target.leafName);
};
exports.renameSync = renameSync;
/**
* Asynchronous rename(2). No arguments other than a possible exception are
* given to the completion callback.
*/
var rename = Async(renameSync);
exports.rename = rename;
/**
* Test whether or not the given path exists by checking with the file system.
*/
function existsSync(path) {
- return new nsILocalFile(path).exists();
+ return new nsIFile(path).exists();
}
exports.existsSync = existsSync;
var exists = Async(existsSync);
exports.exists = exists;
/**
* Synchronous ftruncate(2).
@@ -442,17 +442,17 @@ var lchown = Async(lchown);
exports.lchown = lchown;
/**
* Synchronous chmod(2).
*/
function chmodSync (path, mode) {
let file;
try {
- file = new nsILocalFile(path);
+ file = new nsIFile(path);
} catch(e) {
throw FSError("chmod", "ENOENT", 34, path);
}
file.permissions = Mode(mode);
}
exports.chmodSync = chmodSync;
/**
@@ -553,32 +553,32 @@ exports.symlinkSync = symlinkSync;
*/
var symlink = Async(symlinkSync);
exports.symlink = symlink;
/**
* Synchronous readlink(2). Returns the resolved path.
*/
function readlinkSync(path) {
- return new nsILocalFile(path).target;
+ return new nsIFile(path).target;
};
exports.readlinkSync = readlinkSync;
/**
* Asynchronous readlink(2). The callback gets two arguments
* `(error, resolvedPath)`.
*/
var readlink = Async(readlinkSync);
exports.readlink = readlink;
/**
* Synchronous realpath(2). Returns the resolved path.
*/
function realpathSync(path) {
- return new nsILocalFile(path).path;
+ return new nsIFile(path).path;
};
exports.realpathSync = realpathSync;
/**
* Asynchronous realpath(2). The callback gets two arguments
* `(err, resolvedPath)`.
*/
var realpath = Async(realpathSync);
@@ -610,17 +610,17 @@ exports.rmdirSync = rmdirSync;
var rmdir = Async(rmdirSync);
exports.rmdir = rmdir;
/**
* Synchronous mkdir(2).
*/
function mkdirSync(path, mode) {
try {
- return nsILocalFile(path).create(DIRECTORY_TYPE, Mode(mode));
+ return nsIFile(path).create(DIRECTORY_TYPE, Mode(mode));
} catch (error) {
// Adjust exception thorw to match ones thrown by node.
if (error.name === "NS_ERROR_FILE_ALREADY_EXISTS") {
let { fileName, lineNumber } = error;
error = FSError("mkdir", "EEXIST", 47, path, fileName, lineNumber);
}
throw error;
}
@@ -635,17 +635,17 @@ var mkdir = Async(mkdirSync);
exports.mkdir = mkdir;
/**
* Synchronous readdir(3). Returns an array of filenames excluding `"."` and
* `".."`.
*/
function readdirSync(path) {
try {
- return toArray(new nsILocalFile(path).directoryEntries).map(getFileName);
+ return toArray(new nsIFile(path).directoryEntries).map(getFileName);
}
catch (error) {
// Adjust exception thorw to match ones thrown by node.
if (error.name === "NS_ERROR_FILE_TARGET_DOES_NOT_EXIST" ||
error.name === "NS_ERROR_FILE_NOT_FOUND")
{
let { fileName, lineNumber } = error;
error = FSError("readdir", "ENOENT", 34, path, fileName, lineNumber);
@@ -689,17 +689,17 @@ exports.closeSync = closeSync;
var close = Async(closeSync);
exports.close = close;
/**
* Synchronous open(2).
*/
function openSync(aPath, aFlag, aMode) {
let [ fd, flags, mode, file ] =
- [ { path: aPath }, Flags(aFlag), Mode(aMode), nsILocalFile(aPath) ];
+ [ { path: aPath }, Flags(aFlag), Mode(aMode), nsIFile(aPath) ];
nsIFile(fd, file);
// If trying to open file for just read that does not exists
// need to throw exception as node does.
if (!file.exists() && !isWritable(flags))
throw FSError("open", "ENOENT", 34, aPath);
--- a/addon-sdk/source/lib/sdk/platform/xpcom.js
+++ b/addon-sdk/source/lib/sdk/platform/xpcom.js
@@ -202,17 +202,17 @@ function autoRegister(path) {
// Gecko-specific binaries for a component (which will be the case
// if only frozen interfaces are used).
var runtime = require("../system/runtime");
var osDirName = runtime.OS + "_" + runtime.XPCOMABI;
var platformVersion = require("../system/xul-app").platformVersion.substring(0, 5);
var file = Cc['@mozilla.org/file/local;1']
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
file.initWithPath(path);
file.append(osDirName);
file.append(platformVersion);
if (!(file.exists() && file.isDirectory()))
throw new Error("component not available for OS/ABI " +
osDirName + " and platform " + platformVersion);
--- a/addon-sdk/source/lib/sdk/system.js
+++ b/addon-sdk/source/lib/sdk/system.js
@@ -26,17 +26,17 @@ const appInfo = Cc["@mozilla.org/xre/app
const PR_WRONLY = parseInt("0x02");
const PR_CREATE_FILE = parseInt("0x08");
const PR_APPEND = parseInt("0x10");
const PR_TRUNCATE = parseInt("0x20");
function openFile(path, mode) {
let file = Cc["@mozilla.org/file/local;1"].
- createInstance(Ci.nsILocalFile);
+ createInstance(Ci.nsIFile);
file.initWithPath(path);
let stream = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
stream.init(file, mode, -1, 0);
return stream
}
/**
--- a/addon-sdk/source/lib/sdk/url.js
+++ b/addon-sdk/source/lib/sdk/url.js
@@ -51,17 +51,17 @@ function resolveResourceURI(uri) {
throw new Error("resource does not exist: " + uri.spec);
}
}
return resolved;
}
var fromFilename = exports.fromFilename = function fromFilename(path) {
var file = Cc['@mozilla.org/file/local;1']
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
file.initWithPath(path);
return ios.newFileURI(file).spec;
};
var toFilename = exports.toFilename = function toFilename(url) {
var uri = newURI(url);
if (uri.scheme == "resource")
uri = newURI(resolveResourceURI(uri));
--- a/addon-sdk/source/test/addons/content-permissions/httpd.js
+++ b/addon-sdk/source/test/addons/content-permissions/httpd.js
@@ -1924,17 +1924,17 @@ function defaultIndexHandler(metadata, r
var body = '<html>\
<head>\
<title>' + path + '</title>\
</head>\
<body>\
<h1>' + path + '</h1>\
<ol style="list-style-type: none">';
- var directory = metadata.getProperty("directory").QueryInterface(Ci.nsILocalFile);
+ var directory = metadata.getProperty("directory").QueryInterface(Ci.nsIFile);
NS_ASSERT(directory && directory.isDirectory());
var fileList = [];
var files = directory.directoryEntries;
while (files.hasMoreElements())
{
var f = files.getNext().QueryInterface(Ci.nsIFile);
var name = f.leafName;
@@ -2126,17 +2126,17 @@ function ServerHandler(server)
// FIELDS
/**
* The nsHttpServer instance associated with this handler.
*/
this._server = server;
/**
-* A FileMap object containing the set of path->nsILocalFile mappings for
+* A FileMap object containing the set of path->nsIFile mappings for
* all directory mappings set in the server (e.g., "/" for /var/www/html/,
* "/foo/bar/" for /local/path/, and "/foo/bar/baz/" for /local/path2).
*
* Note carefully: the leading and trailing "/" in each path (not file) are
* removed before insertion to simplify the code which uses this. You have
* been warned!
*/
this._pathDirectoryMap = new FileMap();
@@ -2550,17 +2550,17 @@ ServerHandler.prototype =
},
/**
* Writes an HTTP response for the given file, including setting headers for
* file metadata.
*
* @param metadata : Request
* the Request for which a response is being generated
-* @param file : nsILocalFile
+* @param file : nsIFile
* the file which is to be sent in the response
* @param response : Response
* the response to which the file should be written
* @param offset: uint
* the byte offset to skip to when writing
* @param count: uint
* the number of bytes to write
*/
@@ -2888,27 +2888,27 @@ ServerHandler.prototype =
}
catch (e)
{
return "application/octet-stream";
}
},
/**
-* Returns the nsILocalFile which corresponds to the path, as determined using
+* Returns the nsIFile which corresponds to the path, as determined using
* all registered path->directory mappings and any paths which are explicitly
* overridden.
*
* @param path : string
* the server path for which a file should be retrieved, e.g. "/foo/bar"
* @throws HttpError
* when the correct action is the corresponding HTTP error (i.e., because no
* mapping was found for a directory in path, the referenced file doesn't
* exist, etc.)
-* @returns nsILocalFile
+* @returns nsIFile
* the file to be sent as the response to a request for the path
*/
_getFileForPath: function(path)
{
// decode and add underscores as necessary
try
{
path = toInternalPath(path, true);
@@ -3274,39 +3274,39 @@ function FileMap()
/** Hash which will map paths to nsILocalFiles. */
this._map = {};
}
FileMap.prototype =
{
// PUBLIC API
/**
-* Maps key to a clone of the nsILocalFile value if value is non-null;
+* Maps key to a clone of the nsIFile value if value is non-null;
* otherwise, removes any extant mapping for key.
*
* @param key : string
* string to which a clone of value is mapped
-* @param value : nsILocalFile
+* @param value : nsIFile
* the file to map to key, or null to remove a mapping
*/
put: function(key, value)
{
if (value)
this._map[key] = value.clone();
else
delete this._map[key];
},
/**
-* Returns a clone of the nsILocalFile mapped to key, or null if no such
+* Returns a clone of the nsIFile mapped to key, or null if no such
* mapping exists.
*
* @param key : string
* key to which the returned file maps
-* @returns nsILocalFile
+* @returns nsIFile
* a clone of the mapped file, or null if no mapping exists
*/
get: function(key)
{
var val = this._map[key];
return val ? val.clone() : null;
}
};
@@ -5157,17 +5157,17 @@ if ("XPCOMUtils" in this && // Firefox 3
* /home/jwalden/index.html); if this is omitted, only the default URLs in
* this server implementation will be functional
*/
function server(port, basePath)
{
if (basePath)
{
var lp = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
lp.initWithPath(basePath);
}
// if you're running this, you probably want to see debugging info
DEBUG = true;
var srv = new nsHttpServer();
if (lp)
@@ -5182,17 +5182,17 @@ function server(port, basePath)
DEBUG = false;
}
function startServerAsync(port, basePath)
{
if (basePath)
{
var lp = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
lp.initWithPath(basePath);
}
var srv = new nsHttpServer();
if (lp)
srv.registerDirectory("/", lp);
srv.registerContentType("sjs", "sjs");
srv.start(port);
--- a/addon-sdk/source/test/addons/content-script-messages-latency/httpd.js
+++ b/addon-sdk/source/test/addons/content-script-messages-latency/httpd.js
@@ -1924,17 +1924,17 @@ function defaultIndexHandler(metadata, r
var body = '<html>\
<head>\
<title>' + path + '</title>\
</head>\
<body>\
<h1>' + path + '</h1>\
<ol style="list-style-type: none">';
- var directory = metadata.getProperty("directory").QueryInterface(Ci.nsILocalFile);
+ var directory = metadata.getProperty("directory").QueryInterface(Ci.nsIFile);
NS_ASSERT(directory && directory.isDirectory());
var fileList = [];
var files = directory.directoryEntries;
while (files.hasMoreElements())
{
var f = files.getNext().QueryInterface(Ci.nsIFile);
var name = f.leafName;
@@ -2126,17 +2126,17 @@ function ServerHandler(server)
// FIELDS
/**
* The nsHttpServer instance associated with this handler.
*/
this._server = server;
/**
-* A FileMap object containing the set of path->nsILocalFile mappings for
+* A FileMap object containing the set of path->nsIFile mappings for
* all directory mappings set in the server (e.g., "/" for /var/www/html/,
* "/foo/bar/" for /local/path/, and "/foo/bar/baz/" for /local/path2).
*
* Note carefully: the leading and trailing "/" in each path (not file) are
* removed before insertion to simplify the code which uses this. You have
* been warned!
*/
this._pathDirectoryMap = new FileMap();
@@ -2550,17 +2550,17 @@ ServerHandler.prototype =
},
/**
* Writes an HTTP response for the given file, including setting headers for
* file metadata.
*
* @param metadata : Request
* the Request for which a response is being generated
-* @param file : nsILocalFile
+* @param file : nsIFile
* the file which is to be sent in the response
* @param response : Response
* the response to which the file should be written
* @param offset: uint
* the byte offset to skip to when writing
* @param count: uint
* the number of bytes to write
*/
@@ -2888,27 +2888,27 @@ ServerHandler.prototype =
}
catch (e)
{
return "application/octet-stream";
}
},
/**
-* Returns the nsILocalFile which corresponds to the path, as determined using
+* Returns the nsIFile which corresponds to the path, as determined using
* all registered path->directory mappings and any paths which are explicitly
* overridden.
*
* @param path : string
* the server path for which a file should be retrieved, e.g. "/foo/bar"
* @throws HttpError
* when the correct action is the corresponding HTTP error (i.e., because no
* mapping was found for a directory in path, the referenced file doesn't
* exist, etc.)
-* @returns nsILocalFile
+* @returns nsIFile
* the file to be sent as the response to a request for the path
*/
_getFileForPath: function(path)
{
// decode and add underscores as necessary
try
{
path = toInternalPath(path, true);
@@ -3274,39 +3274,39 @@ function FileMap()
/** Hash which will map paths to nsILocalFiles. */
this._map = {};
}
FileMap.prototype =
{
// PUBLIC API
/**
-* Maps key to a clone of the nsILocalFile value if value is non-null;
+* Maps key to a clone of the nsIFile value if value is non-null;
* otherwise, removes any extant mapping for key.
*
* @param key : string
* string to which a clone of value is mapped
-* @param value : nsILocalFile
+* @param value : nsIFile
* the file to map to key, or null to remove a mapping
*/
put: function(key, value)
{
if (value)
this._map[key] = value.clone();
else
delete this._map[key];
},
/**
-* Returns a clone of the nsILocalFile mapped to key, or null if no such
+* Returns a clone of the nsIFile mapped to key, or null if no such
* mapping exists.
*
* @param key : string
* key to which the returned file maps
-* @returns nsILocalFile
+* @returns nsIFile
* a clone of the mapped file, or null if no mapping exists
*/
get: function(key)
{
var val = this._map[key];
return val ? val.clone() : null;
}
};
@@ -5157,17 +5157,17 @@ if ("XPCOMUtils" in this && // Firefox 3
* /home/jwalden/index.html); if this is omitted, only the default URLs in
* this server implementation will be functional
*/
function server(port, basePath)
{
if (basePath)
{
var lp = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
lp.initWithPath(basePath);
}
// if you're running this, you probably want to see debugging info
DEBUG = true;
var srv = new nsHttpServer();
if (lp)
@@ -5182,17 +5182,17 @@ function server(port, basePath)
DEBUG = false;
}
function startServerAsync(port, basePath)
{
if (basePath)
{
var lp = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
lp.initWithPath(basePath);
}
var srv = new nsHttpServer();
if (lp)
srv.registerDirectory("/", lp);
srv.registerContentType("sjs", "sjs");
srv.start(port);
--- a/addon-sdk/source/test/addons/e10s-content/lib/httpd.js
+++ b/addon-sdk/source/test/addons/e10s-content/lib/httpd.js
@@ -1925,17 +1925,17 @@ function defaultIndexHandler(metadata, r
var body = '<html>\
<head>\
<title>' + path + '</title>\
</head>\
<body>\
<h1>' + path + '</h1>\
<ol style="list-style-type: none">';
- var directory = metadata.getProperty("directory").QueryInterface(Ci.nsILocalFile);
+ var directory = metadata.getProperty("directory").QueryInterface(Ci.nsIFile);
NS_ASSERT(directory && directory.isDirectory());
var fileList = [];
var files = directory.directoryEntries;
while (files.hasMoreElements())
{
var f = files.getNext().QueryInterface(Ci.nsIFile);
var name = f.leafName;
@@ -2127,17 +2127,17 @@ function ServerHandler(server)
// FIELDS
/**
* The nsHttpServer instance associated with this handler.
*/
this._server = server;
/**
-* A FileMap object containing the set of path->nsILocalFile mappings for
+* A FileMap object containing the set of path->nsIFile mappings for
* all directory mappings set in the server (e.g., "/" for /var/www/html/,
* "/foo/bar/" for /local/path/, and "/foo/bar/baz/" for /local/path2).
*
* Note carefully: the leading and trailing "/" in each path (not file) are
* removed before insertion to simplify the code which uses this. You have
* been warned!
*/
this._pathDirectoryMap = new FileMap();
@@ -2551,17 +2551,17 @@ ServerHandler.prototype =
},
/**
* Writes an HTTP response for the given file, including setting headers for
* file metadata.
*
* @param metadata : Request
* the Request for which a response is being generated
-* @param file : nsILocalFile
+* @param file : nsIFile
* the file which is to be sent in the response
* @param response : Response
* the response to which the file should be written
* @param offset: uint
* the byte offset to skip to when writing
* @param count: uint
* the number of bytes to write
*/
@@ -2889,27 +2889,27 @@ ServerHandler.prototype =
}
catch (e)
{
return "application/octet-stream";
}
},
/**
-* Returns the nsILocalFile which corresponds to the path, as determined using
+* Returns the nsIFile which corresponds to the path, as determined using
* all registered path->directory mappings and any paths which are explicitly
* overridden.
*
* @param path : string
* the server path for which a file should be retrieved, e.g. "/foo/bar"
* @throws HttpError
* when the correct action is the corresponding HTTP error (i.e., because no
* mapping was found for a directory in path, the referenced file doesn't
* exist, etc.)
-* @returns nsILocalFile
+* @returns nsIFile
* the file to be sent as the response to a request for the path
*/
_getFileForPath: function(path)
{
// decode and add underscores as necessary
try
{
path = toInternalPath(path, true);
@@ -3275,39 +3275,39 @@ function FileMap()
/** Hash which will map paths to nsILocalFiles. */
this._map = {};
}
FileMap.prototype =
{
// PUBLIC API
/**
-* Maps key to a clone of the nsILocalFile value if value is non-null;
+* Maps key to a clone of the nsIFile value if value is non-null;
* otherwise, removes any extant mapping for key.
*
* @param key : string
* string to which a clone of value is mapped
-* @param value : nsILocalFile
+* @param value : nsIFile
* the file to map to key, or null to remove a mapping
*/
put: function(key, value)
{
if (value)
this._map[key] = value.clone();
else
delete this._map[key];
},
/**
-* Returns a clone of the nsILocalFile mapped to key, or null if no such
+* Returns a clone of the nsIFile mapped to key, or null if no such
* mapping exists.
*
* @param key : string
* key to which the returned file maps
-* @returns nsILocalFile
+* @returns nsIFile
* a clone of the mapped file, or null if no mapping exists
*/
get: function(key)
{
var val = this._map[key];
return val ? val.clone() : null;
}
};
@@ -5158,17 +5158,17 @@ if ("XPCOMUtils" in this && // Firefox 3
* /home/jwalden/index.html); if this is omitted, only the default URLs in
* this server implementation will be functional
*/
function server(port, basePath)
{
if (basePath)
{
var lp = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
lp.initWithPath(basePath);
}
// if you're running this, you probably want to see debugging info
DEBUG = true;
var srv = new nsHttpServer();
if (lp)
@@ -5183,17 +5183,17 @@ function server(port, basePath)
DEBUG = false;
}
function startServerAsync(port, basePath)
{
if (basePath)
{
var lp = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
lp.initWithPath(basePath);
}
var srv = new nsHttpServer();
if (lp)
srv.registerDirectory("/", lp);
srv.registerContentType("sjs", "sjs");
srv.start(port);
--- a/addon-sdk/source/test/addons/places/lib/httpd.js
+++ b/addon-sdk/source/test/addons/places/lib/httpd.js
@@ -1924,17 +1924,17 @@ function defaultIndexHandler(metadata, r
var body = '<html>\
<head>\
<title>' + path + '</title>\
</head>\
<body>\
<h1>' + path + '</h1>\
<ol style="list-style-type: none">';
- var directory = metadata.getProperty("directory").QueryInterface(Ci.nsILocalFile);
+ var directory = metadata.getProperty("directory").QueryInterface(Ci.nsIFile);
NS_ASSERT(directory && directory.isDirectory());
var fileList = [];
var files = directory.directoryEntries;
while (files.hasMoreElements())
{
var f = files.getNext().QueryInterface(Ci.nsIFile);
var name = f.leafName;
@@ -2126,17 +2126,17 @@ function ServerHandler(server)
// FIELDS
/**
* The nsHttpServer instance associated with this handler.
*/
this._server = server;
/**
-* A FileMap object containing the set of path->nsILocalFile mappings for
+* A FileMap object containing the set of path->nsIFile mappings for
* all directory mappings set in the server (e.g., "/" for /var/www/html/,
* "/foo/bar/" for /local/path/, and "/foo/bar/baz/" for /local/path2).
*
* Note carefully: the leading and trailing "/" in each path (not file) are
* removed before insertion to simplify the code which uses this. You have
* been warned!
*/
this._pathDirectoryMap = new FileMap();
@@ -2550,17 +2550,17 @@ ServerHandler.prototype =
},
/**
* Writes an HTTP response for the given file, including setting headers for
* file metadata.
*
* @param metadata : Request
* the Request for which a response is being generated
-* @param file : nsILocalFile
+* @param file : nsIFile
* the file which is to be sent in the response
* @param response : Response
* the response to which the file should be written
* @param offset: uint
* the byte offset to skip to when writing
* @param count: uint
* the number of bytes to write
*/
@@ -2888,27 +2888,27 @@ ServerHandler.prototype =
}
catch (e)
{
return "application/octet-stream";
}
},
/**
-* Returns the nsILocalFile which corresponds to the path, as determined using
+* Returns the nsIFile which corresponds to the path, as determined using
* all registered path->directory mappings and any paths which are explicitly
* overridden.
*
* @param path : string
* the server path for which a file should be retrieved, e.g. "/foo/bar"
* @throws HttpError
* when the correct action is the corresponding HTTP error (i.e., because no
* mapping was found for a directory in path, the referenced file doesn't
* exist, etc.)
-* @returns nsILocalFile
+* @returns nsIFile
* the file to be sent as the response to a request for the path
*/
_getFileForPath: function(path)
{
// decode and add underscores as necessary
try
{
path = toInternalPath(path, true);
@@ -3274,39 +3274,39 @@ function FileMap()
/** Hash which will map paths to nsILocalFiles. */
this._map = {};
}
FileMap.prototype =
{
// PUBLIC API
/**
-* Maps key to a clone of the nsILocalFile value if value is non-null;
+* Maps key to a clone of the nsIFile value if value is non-null;
* otherwise, removes any extant mapping for key.
*
* @param key : string
* string to which a clone of value is mapped
-* @param value : nsILocalFile
+* @param value : nsIFile
* the file to map to key, or null to remove a mapping
*/
put: function(key, value)
{
if (value)
this._map[key] = value.clone();
else
delete this._map[key];
},
/**
-* Returns a clone of the nsILocalFile mapped to key, or null if no such
+* Returns a clone of the nsIFile mapped to key, or null if no such
* mapping exists.
*
* @param key : string
* key to which the returned file maps
-* @returns nsILocalFile
+* @returns nsIFile
* a clone of the mapped file, or null if no mapping exists
*/
get: function(key)
{
var val = this._map[key];
return val ? val.clone() : null;
}
};
@@ -5157,17 +5157,17 @@ if ("XPCOMUtils" in this && // Firefox 3
* /home/jwalden/index.html); if this is omitted, only the default URLs in
* this server implementation will be functional
*/
function server(port, basePath)
{
if (basePath)
{
var lp = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
lp.initWithPath(basePath);
}
// if you're running this, you probably want to see debugging info
DEBUG = true;
var srv = new nsHttpServer();
if (lp)
@@ -5182,17 +5182,17 @@ function server(port, basePath)
DEBUG = false;
}
function startServerAsync(port, basePath)
{
if (basePath)
{
var lp = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
lp.initWithPath(basePath);
}
var srv = new nsHttpServer();
if (lp)
srv.registerDirectory("/", lp);
srv.registerContentType("sjs", "sjs");
srv.start(port);
--- a/addon-sdk/source/test/fixtures/child-process-scripts.js
+++ b/addon-sdk/source/test/fixtures/child-process-scripts.js
@@ -59,18 +59,18 @@ function createFile (name, data) {
}
});
return promise;
}
// TODO Use fs.chmod once implemented, bug 914606
function makeExecutable (name) {
let { CC } = require('chrome');
- let nsILocalFile = CC('@mozilla.org/file/local;1', 'nsILocalFile', 'initWithPath');
- let file = nsILocalFile(name);
+ let nsIFile = CC('@mozilla.org/file/local;1', 'nsIFile', 'initWithPath');
+ let file = nsIFile(name);
file.permissions = 0o777;
}
function deleteFile (name) {
let file = join(PROFILE_DIR, name);
if (existsSync(file))
unlinkSync(file);
}
--- a/addon-sdk/source/test/lib/httpd.js
+++ b/addon-sdk/source/test/lib/httpd.js
@@ -1925,17 +1925,17 @@ function defaultIndexHandler(metadata, r
var body = '<html>\
<head>\
<title>' + path + '</title>\
</head>\
<body>\
<h1>' + path + '</h1>\
<ol style="list-style-type: none">';
- var directory = metadata.getProperty("directory").QueryInterface(Ci.nsILocalFile);
+ var directory = metadata.getProperty("directory").QueryInterface(Ci.nsIFile);
NS_ASSERT(directory && directory.isDirectory());
var fileList = [];
var files = directory.directoryEntries;
while (files.hasMoreElements())
{
var f = files.getNext().QueryInterface(Ci.nsIFile);
var name = f.leafName;
@@ -2127,17 +2127,17 @@ function ServerHandler(server)
// FIELDS
/**
* The nsHttpServer instance associated with this handler.
*/
this._server = server;
/**
-* A FileMap object containing the set of path->nsILocalFile mappings for
+* A FileMap object containing the set of path->nsIFile mappings for
* all directory mappings set in the server (e.g., "/" for /var/www/html/,
* "/foo/bar/" for /local/path/, and "/foo/bar/baz/" for /local/path2).
*
* Note carefully: the leading and trailing "/" in each path (not file) are
* removed before insertion to simplify the code which uses this. You have
* been warned!
*/
this._pathDirectoryMap = new FileMap();
@@ -2551,17 +2551,17 @@ ServerHandler.prototype =
},
/**
* Writes an HTTP response for the given file, including setting headers for
* file metadata.
*
* @param metadata : Request
* the Request for which a response is being generated
-* @param file : nsILocalFile
+* @param file : nsIFile
* the file which is to be sent in the response
* @param response : Response
* the response to which the file should be written
* @param offset: uint
* the byte offset to skip to when writing
* @param count: uint
* the number of bytes to write
*/
@@ -2889,27 +2889,27 @@ ServerHandler.prototype =
}
catch (e)
{
return "application/octet-stream";
}
},
/**
-* Returns the nsILocalFile which corresponds to the path, as determined using
+* Returns the nsIFile which corresponds to the path, as determined using
* all registered path->directory mappings and any paths which are explicitly
* overridden.
*
* @param path : string
* the server path for which a file should be retrieved, e.g. "/foo/bar"
* @throws HttpError
* when the correct action is the corresponding HTTP error (i.e., because no
* mapping was found for a directory in path, the referenced file doesn't
* exist, etc.)
-* @returns nsILocalFile
+* @returns nsIFile
* the file to be sent as the response to a request for the path
*/
_getFileForPath: function(path)
{
// decode and add underscores as necessary
try
{
path = toInternalPath(path, true);
@@ -3275,39 +3275,39 @@ function FileMap()
/** Hash which will map paths to nsILocalFiles. */
this._map = {};
}
FileMap.prototype =
{
// PUBLIC API
/**
-* Maps key to a clone of the nsILocalFile value if value is non-null;
+* Maps key to a clone of the nsIFile value if value is non-null;
* otherwise, removes any extant mapping for key.
*
* @param key : string
* string to which a clone of value is mapped
-* @param value : nsILocalFile
+* @param value : nsIFile
* the file to map to key, or null to remove a mapping
*/
put: function(key, value)
{
if (value)
this._map[key] = value.clone();
else
delete this._map[key];
},
/**
-* Returns a clone of the nsILocalFile mapped to key, or null if no such
+* Returns a clone of the nsIFile mapped to key, or null if no such
* mapping exists.
*
* @param key : string
* key to which the returned file maps
-* @returns nsILocalFile
+* @returns nsIFile
* a clone of the mapped file, or null if no mapping exists
*/
get: function(key)
{
var val = this._map[key];
return val ? val.clone() : null;
}
};
@@ -5158,17 +5158,17 @@ if ("XPCOMUtils" in this && // Firefox 3
* /home/jwalden/index.html); if this is omitted, only the default URLs in
* this server implementation will be functional
*/
function server(port, basePath)
{
if (basePath)
{
var lp = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
lp.initWithPath(basePath);
}
// if you're running this, you probably want to see debugging info
DEBUG = true;
var srv = new nsHttpServer();
if (lp)
@@ -5183,17 +5183,17 @@ function server(port, basePath)
DEBUG = false;
}
function startServerAsync(port, basePath)
{
if (basePath)
{
var lp = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
lp.initWithPath(basePath);
}
var srv = new nsHttpServer();
if (lp)
srv.registerDirectory("/", lp);
srv.registerContentType("sjs", "sjs");
srv.start(port);
--- a/addon-sdk/source/test/zip/utils.js
+++ b/addon-sdk/source/test/zip/utils.js
@@ -14,17 +14,17 @@ const PR_APPEND = 0x10;
const PR_TRUNCATE = 0x20;
const PR_SYNC = 0x40;
const PR_EXCL = 0x80;
// Default compression level:
const { COMPRESSION_DEFAULT } = Ci.nsIZipWriter;
function createNsFile(path) {
- let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
try {
file.initWithPath(path);
} catch(e) {
throw new Error("This zip file path is not valid : " + path + "\n" + e);
}
return file;
}
exports.createNsFile = createNsFile;
--- a/browser/base/content/browser-feeds.js
+++ b/browser/base/content/browser-feeds.js
@@ -343,38 +343,38 @@ var FeedHandler = {
appName = AppConstants.MOZ_MACBUNDLE_NAME;
break;
default:
appName = AppConstants.MOZ_APP_NAME + "-bin";
break;
}
if (fp.file.leafName != appName) {
- Services.prefs.setComplexValue(prefName, Ci.nsILocalFile, selectedApp);
+ Services.prefs.setComplexValue(prefName, Ci.nsIFile, selectedApp);
aBrowser.messageManager.sendAsyncMessage("FeedWriter:SetApplicationLauncherMenuItem",
{ name: this._getFileDisplayName(selectedApp),
type: "SelectedAppMenuItem" });
}
}
}
});
},
executeClientApp(aSpec, aTitle, aSubtitle, aFeedHandler) {
// aFeedHandler is either "default", indicating the system default reader, or a pref-name containing
- // an nsILocalFile pointing to the feed handler's executable.
+ // an nsIFile pointing to the feed handler's executable.
let clientApp = null;
if (aFeedHandler == "default") {
clientApp = Cc["@mozilla.org/browser/shell-service;1"]
.getService(Ci.nsIShellService)
.defaultFeedReader;
} else {
- clientApp = Services.prefs.getComplexValue(aFeedHandler, Ci.nsILocalFile);
+ clientApp = Services.prefs.getComplexValue(aFeedHandler, Ci.nsIFile);
}
// For the benefit of applications that might know how to deal with more
// URLs than just feeds, send feed: URLs in the following format:
//
// http urls: replace scheme with feed, e.g.
// http://foo.com/index.rdf -> feed://foo.com/index.rdf
// other urls: prepend feed: scheme, e.g.
@@ -492,17 +492,17 @@ var FeedHandler = {
// eslint-disable-next-line mozilla/use-default-preference-values
try {
showFirstRunUI = Services.prefs.getBoolPref(PREF_SHOW_FIRST_RUN_UI);
} catch (ex) { }
const response = { handlers, showFirstRunUI };
let selectedClientApp;
const feedTypePref = getPrefAppForType(feedType);
try {
- selectedClientApp = Services.prefs.getComplexValue(feedTypePref, Ci.nsILocalFile);
+ selectedClientApp = Services.prefs.getComplexValue(feedTypePref, Ci.nsIFile);
} catch (ex) {
// Just do nothing, then we won't bother populating
}
let defaultClientApp = null;
try {
// This can sometimes not exist
defaultClientApp = Cc["@mozilla.org/browser/shell-service;1"]
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -2358,17 +2358,17 @@ function delayedOpenTab(aUrl, aReferrer,
}
var gLastOpenDirectory = {
_lastDir: null,
get path() {
if (!this._lastDir || !this._lastDir.exists()) {
try {
this._lastDir = gPrefService.getComplexValue("browser.open.lastDir",
- Ci.nsILocalFile);
+ Ci.nsIFile);
if (!this._lastDir.exists())
this._lastDir = null;
} catch (e) {}
}
return this._lastDir;
},
set path(val) {
try {
@@ -2376,17 +2376,17 @@ var gLastOpenDirectory = {
return;
} catch (e) {
return;
}
this._lastDir = val.clone();
// Don't save the last open directory pref inside the Private Browsing mode
if (!PrivateBrowsingUtils.isWindowPrivate(window))
- gPrefService.setComplexValue("browser.open.lastDir", Ci.nsILocalFile,
+ gPrefService.setComplexValue("browser.open.lastDir", Ci.nsIFile,
this._lastDir);
},
reset() {
this._lastDir = null;
}
};
function BrowserOpenFileWindow() {
@@ -2394,17 +2394,17 @@ function BrowserOpenFileWindow() {
try {
const nsIFilePicker = Ci.nsIFilePicker;
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
let fpCallback = function fpCallback_done(aResult) {
if (aResult == nsIFilePicker.returnOK) {
try {
if (fp.file) {
gLastOpenDirectory.path =
- fp.file.parent.QueryInterface(Ci.nsILocalFile);
+ fp.file.parent.QueryInterface(Ci.nsIFile);
}
} catch (ex) {
}
openUILinkIn(fp.fileURL.spec, "current");
}
};
fp.init(window, gNavigatorBundle.getString("openFile"),
--- a/browser/base/content/pageinfo/pageInfo.js
+++ b/browser/base/content/pageinfo/pageInfo.js
@@ -663,35 +663,35 @@ function getSelectedRows(tree) {
}
function getSelectedRow(tree) {
var rows = getSelectedRows(tree);
return (rows.length == 1) ? rows[0] : -1;
}
function selectSaveFolder(aCallback) {
- const nsILocalFile = Components.interfaces.nsILocalFile;
+ const nsIFile = Components.interfaces.nsIFile;
const nsIFilePicker = Components.interfaces.nsIFilePicker;
let titleText = gBundle.getString("mediaSelectFolder");
let fp = Components.classes["@mozilla.org/filepicker;1"].
createInstance(nsIFilePicker);
let fpCallback = function fpCallback_done(aResult) {
if (aResult == nsIFilePicker.returnOK) {
- aCallback(fp.file.QueryInterface(nsILocalFile));
+ aCallback(fp.file.QueryInterface(nsIFile));
} else {
aCallback(null);
}
};
fp.init(window, titleText, nsIFilePicker.modeGetFolder);
fp.appendFilters(nsIFilePicker.filterAll);
try {
let prefs = Components.classes[PREFERENCES_CONTRACTID].
getService(Components.interfaces.nsIPrefBranch);
- let initialDir = prefs.getComplexValue("browser.download.dir", nsILocalFile);
+ let initialDir = prefs.getComplexValue("browser.download.dir", nsIFile);
if (initialDir) {
fp.displayDirectory = initialDir;
}
} catch (ex) {
}
fp.open(fpCallback);
}
--- a/browser/base/content/test/plugins/browser_CTP_crashreporting.js
+++ b/browser/base/content/test/plugins/browser_CTP_crashreporting.js
@@ -145,17 +145,17 @@ add_task(async function() {
ok(subject instanceof Ci.nsIPropertyBag,
"The crash report subject should be an nsIPropertyBag.");
let crashData = convertPropertyBag(subject);
ok(crashData.serverCrashID, "Should have a serverCrashID set.");
// Remove the submitted report file after ensuring it exists.
let file = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
file.initWithPath(Services.crashmanager._submittedDumpsDir);
file.append(crashData.serverCrashID + ".txt");
ok(file.exists(), "Submitted report file should exist");
file.remove(false);
ok(crashData.extra, "Extra data should exist");
is(crashData.extra.PluginUserComment, "a test comment",
"Comment in extra data should match comment in textbox");
@@ -217,17 +217,17 @@ add_task(async function() {
ok(subject instanceof Ci.nsIPropertyBag,
"The crash report subject should be an nsIPropertyBag.");
let crashData = convertPropertyBag(subject);
ok(crashData.serverCrashID, "Should have a serverCrashID set.");
// Remove the submitted report file after ensuring it exists.
let file = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
file.initWithPath(Services.crashmanager._submittedDumpsDir);
file.append(crashData.serverCrashID + ".txt");
ok(file.exists(), "Submitted report file should exist");
file.remove(false);
is(crashData.extra.PluginContentURL, undefined,
"URL should be absent from extra data when opt-in not checked");
});
--- a/browser/base/content/test/plugins/browser_pluginCrashCommentAndURL.js
+++ b/browser/base/content/test/plugins/browser_pluginCrashCommentAndURL.js
@@ -160,17 +160,17 @@ function onSubmitStatus(aSubject, aData)
return false;
let propBag = aSubject.QueryInterface(Ci.nsIPropertyBag);
if (aData == "success") {
let remoteID = getPropertyBagValue(propBag, "serverCrashID");
ok(!!remoteID, "serverCrashID should be set");
// Remove the submitted report file.
- let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(Services.crashmanager._submittedDumpsDir);
file.append(remoteID + ".txt");
ok(file.exists(), "Submitted report file should exist");
file.remove(false);
}
let extra = getPropertyBagValue(propBag, "extra");
ok(extra instanceof Ci.nsIPropertyBag, "Extra data should be property bag");
--- a/browser/base/content/test/tabcrashed/head.js
+++ b/browser/base/content/test/tabcrashed/head.js
@@ -34,17 +34,17 @@ function promiseCrashReport(expectedExtr
}
let remoteID = getPropertyBagValue(subject, "serverCrashID");
if (!remoteID) {
throw new Error("Report should have a server ID");
}
let file = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
file.initWithPath(Services.crashmanager._submittedDumpsDir);
file.append(remoteID + ".txt");
if (!file.exists()) {
throw new Error("Report should have been received by the server");
}
file.remove(false);
--- a/browser/components/nsBrowserContentHandler.js
+++ b/browser/components/nsBrowserContentHandler.js
@@ -698,17 +698,17 @@ nsDefaultCommandLineHandler.prototype =
// displayed) we will crash if we open an url and then select a profile. To
// prevent this handle all url command line flags and set the command line's
// preventDefault to true to prevent the display of the ui. The initial
// command line will be retained when nsAppRunner calls LaunchChild though
// urls launched after the initial launch will be lost.
if (!this._haveProfile) {
try {
// This will throw when a profile has not been selected.
- Services.dirsvc.get("ProfD", Components.interfaces.nsILocalFile);
+ Services.dirsvc.get("ProfD", Components.interfaces.nsIFile);
this._haveProfile = true;
} catch (e) {
while ((ar = cmdLine.handleFlagWithParam("url", false)));
cmdLine.preventDefault = true;
}
}
}
--- a/browser/components/places/content/places.js
+++ b/browser/components/places/content/places.js
@@ -473,17 +473,17 @@ var PlacesOrganizer = {
/**
* Called when 'Choose File...' is selected from the restore menu.
* Prompts for a file and restores bookmarks to those in the file.
*/
onRestoreBookmarksFromFile: function PO_onRestoreBookmarksFromFile() {
let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
- let backupsDir = dirSvc.get("Desk", Ci.nsILocalFile);
+ let backupsDir = dirSvc.get("Desk", Ci.nsIFile);
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
let fpCallback = aResult => {
if (aResult != Ci.nsIFilePicker.returnCancel) {
this.restoreBookmarksFromFile(fp.file.path);
}
};
fp.init(window, PlacesUIUtils.getString("bookmarksRestoreTitle"),
@@ -535,17 +535,17 @@ var PlacesOrganizer = {
/**
* Backup bookmarks to desktop, auto-generate a filename with a date.
* The file is a JSON serialization of bookmarks, tags and any annotations
* of those items.
*/
backupBookmarks: function PO_backupBookmarks() {
let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
- let backupsDir = dirSvc.get("Desk", Ci.nsILocalFile);
+ let backupsDir = dirSvc.get("Desk", Ci.nsIFile);
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
let fpCallback = function fpCallback_done(aResult) {
if (aResult != Ci.nsIFilePicker.returnCancel) {
// There is no OS.File version of the filepicker yet (Bug 937812).
PlacesBackups.saveBookmarksToJSONFile(fp.file.path);
}
};
--- a/browser/components/preferences/in-content-new/main.js
+++ b/browser/components/preferences/in-content-new/main.js
@@ -47,17 +47,17 @@ const PREF_HIDE_PLUGINS_WITHOUT_EXTENSIO
* checkbox is unchecked, corresponds to when browser.feeds.handler=="ask")
* or more permanently (i.e., the item displayed in the dropdown in Feeds
* preferences)
*
* browser.feeds.handler.webservice
* - the URL of the currently selected web service used to read feeds
*
* browser.feeds.handlers.application
- * - nsILocalFile, stores the current client-side feed reading app if one has
+ * - nsIFile, stores the current client-side feed reading app if one has
* been chosen
*/
const PREF_FEED_SELECTED_APP = "browser.feeds.handlers.application";
const PREF_FEED_SELECTED_WEB = "browser.feeds.handlers.webservice";
const PREF_FEED_SELECTED_ACTION = "browser.feeds.handler";
const PREF_FEED_SELECTED_READER = "browser.feeds.handler.default";
const PREF_VIDEO_FEED_SELECTED_APP = "browser.videoFeeds.handlers.application";
@@ -2373,17 +2373,17 @@ var gMainPane = {
*
* @throws if aFolder is not "Desktop" or "Downloads"
*/
async _getDownloadsFolder(aFolder) {
switch (aFolder) {
case "Desktop":
var fileLoc = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
- return fileLoc.get("Desk", Components.interfaces.nsILocalFile);
+ return fileLoc.get("Desk", Components.interfaces.nsIFile);
case "Downloads":
let downloadsDir = await Downloads.getSystemDownloadsDirectory();
return new FileUtils.File(downloadsDir);
}
throw "ASSERTION FAILED: folder type should be 'Desktop' or 'Downloads'";
},
/**
--- a/browser/components/preferences/in-content/applications.js
+++ b/browser/components/preferences/in-content/applications.js
@@ -40,17 +40,17 @@ const PREF_HIDE_PLUGINS_WITHOUT_EXTENSIO
* checkbox is unchecked, corresponds to when browser.feeds.handler=="ask")
* or more permanently (i.e., the item displayed in the dropdown in Feeds
* preferences)
*
* browser.feeds.handler.webservice
* - the URL of the currently selected web service used to read feeds
*
* browser.feeds.handlers.application
- * - nsILocalFile, stores the current client-side feed reading app if one has
+ * - nsIFile, stores the current client-side feed reading app if one has
* been chosen
*/
const PREF_FEED_SELECTED_APP = "browser.feeds.handlers.application";
const PREF_FEED_SELECTED_WEB = "browser.feeds.handlers.webservice";
const PREF_FEED_SELECTED_ACTION = "browser.feeds.handler";
const PREF_FEED_SELECTED_READER = "browser.feeds.handler.default";
const PREF_VIDEO_FEED_SELECTED_APP = "browser.videoFeeds.handlers.application";
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -627,17 +627,17 @@ var gMainPane = {
*
* @throws if aFolder is not "Desktop" or "Downloads"
*/
async _getDownloadsFolder(aFolder) {
switch (aFolder) {
case "Desktop":
var fileLoc = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
- return fileLoc.get("Desk", Components.interfaces.nsILocalFile);
+ return fileLoc.get("Desk", Components.interfaces.nsIFile);
case "Downloads":
let downloadsDir = await Downloads.getSystemDownloadsDirectory();
return new FileUtils.File(downloadsDir);
}
throw "ASSERTION FAILED: folder type should be 'Desktop' or 'Downloads'";
},
/**
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_opendir.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_opendir.js
@@ -88,27 +88,27 @@ function test() {
"The path set inside the private browsing mode should not leak when leaving that mode");
setupCleanSlate(nonPrivateWindow);
setupCleanSlate(privateWindow);
// Test 3: the last open directory is set from a previous session, it should be used
// in normal mode
- gPrefService.setComplexValue(kPrefName, Ci.nsILocalFile, dir1);
+ gPrefService.setComplexValue(kPrefName, Ci.nsIFile, dir1);
is(nonPrivateWindow.gLastOpenDirectory.path.path, dir1.path,
"The pref set from last session should take effect outside the private browsing mode");
setupCleanSlate(nonPrivateWindow);
setupCleanSlate(privateWindow);
// Test 4: the last open directory is set from a previous session, it should be used
// in private browsing mode mode
- gPrefService.setComplexValue(kPrefName, Ci.nsILocalFile, dir1);
+ gPrefService.setComplexValue(kPrefName, Ci.nsIFile, dir1);
// test the private window
is(privateWindow.gLastOpenDirectory.path.path, dir1.path,
"The pref set from last session should take effect inside the private browsing mode");
// test the non-private window
is(nonPrivateWindow.gLastOpenDirectory.path.path, dir1.path,
"The pref set from last session should remain in effect after leaving the private browsing mode");
setupCleanSlate(nonPrivateWindow);
--- a/browser/components/tests/browser/browser_bug538331.js
+++ b/browser/components/tests/browser/browser_bug538331.js
@@ -402,14 +402,14 @@ function writeUpdatesToXMLFile(aText) {
let file = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties).
get("UpdRootD", Ci.nsIFile);
file.append("updates.xml");
let fos = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
if (!file.exists()) {
- file.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_FILE);
+ file.create(Ci.nsIFile.NORMAL_FILE_TYPE, PERMS_FILE);
}
fos.init(file, MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE, PERMS_FILE, 0);
fos.write(aText, aText.length);
fos.close();
}
--- a/browser/components/tests/unit/head.js
+++ b/browser/components/tests/unit/head.js
@@ -1,9 +1,9 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const {interfaces: Ci, classes: Cc, results: Cr, utils: Cu} = Components;
Cu.import("resource://gre/modules/Services.jsm");
-var gProfD = do_get_profile().QueryInterface(Ci.nsILocalFile);
+var gProfD = do_get_profile().QueryInterface(Ci.nsIFile);
--- a/browser/components/translation/test/bing.sjs
+++ b/browser/components/translation/test/bing.sjs
@@ -104,17 +104,17 @@ function parseXml(body) {
if (xml.documentElement.localName == "parsererror")
throw new Error("Invalid XML");
return xml;
}
function getInputStream(path) {
let file = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties)
- .get("CurWorkD", Ci.nsILocalFile);
+ .get("CurWorkD", Ci.nsIFile);
for (let part of path.split("/"))
file.append(part);
let fileStream = Cc["@mozilla.org/network/file-input-stream;1"]
.createInstance(Ci.nsIFileInputStream);
fileStream.init(file, 1, 0, false);
return fileStream;
}
--- a/browser/components/translation/test/yandex.sjs
+++ b/browser/components/translation/test/yandex.sjs
@@ -111,17 +111,17 @@ function getRequestBody(req) {
Array.prototype.push.apply(bytes, body.readByteArray(avail));
return String.fromCharCode.apply(null, bytes);
}
function getInputStream(path) {
let file = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties)
- .get("CurWorkD", Ci.nsILocalFile);
+ .get("CurWorkD", Ci.nsIFile);
for (let part of path.split("/"))
file.append(part);
let fileStream = Cc["@mozilla.org/network/file-input-stream;1"]
.createInstance(Ci.nsIFileInputStream);
fileStream.init(file, 1, 0, false);
return fileStream;
}
--- a/browser/experiments/test/xpcshell/head.js
+++ b/browser/experiments/test/xpcshell/head.js
@@ -31,17 +31,17 @@ const PREF_TELEMETRY_ENABLED = "toolk
function getExperimentPath(base) {
let p = do_get_cwd();
p.append(base);
return p.path;
}
function sha1File(path) {
let f = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
f.initWithPath(path);
let hasher = Cc["@mozilla.org/security/hash;1"]
.createInstance(Ci.nsICryptoHash);
hasher.init(hasher.SHA1);
let is = Cc["@mozilla.org/network/file-input-stream;1"]
.createInstance(Ci.nsIFileInputStream);
is.init(f, -1, 0, 0);
--- a/browser/extensions/mortar/host/flash/bootstrap.js
+++ b/browser/extensions/mortar/host/flash/bootstrap.js
@@ -48,17 +48,17 @@ function startup(data) {
});
plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
let rng = Cc["@mozilla.org/security/random-generator;1"].createInstance(Ci.nsIRandomGenerator);
Services.ppmm.addMessageListener("ppapi.js:generateRandomBytes", ({ data }) => {
return rng.generateRandomBytes(data);
});
- let moduleLocalFiles = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
+ let moduleLocalFiles = Services.dirsvc.get("ProfD", Ci.nsIFile);
moduleLocalFiles.append("Flash PPAPI Data");
try {
moduleLocalFiles.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
} catch (e) {
if (e.result != Cr.NS_ERROR_FILE_ALREADY_EXISTS) {
throw e;
}
}
--- a/browser/modules/WindowsJumpLists.jsm
+++ b/browser/modules/WindowsJumpLists.jsm
@@ -357,17 +357,17 @@ this.WinTaskbarJumpList =
/**
* Jump list item creation helpers
*/
_getHandlerAppItem: function WTBJL__getHandlerAppItem(name, description,
args, iconIndex,
faviconPageUri) {
- var file = Services.dirsvc.get("XREExeF", Ci.nsILocalFile);
+ var file = Services.dirsvc.get("XREExeF", Ci.nsIFile);
var handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"].
createInstance(Ci.nsILocalHandlerApp);
handlerApp.executable = file;
// handlers default to the leaf name if a name is not specified
if (name && name.length != 0)
handlerApp.name = name;
handlerApp.detailedDescription = description;
--- a/browser/modules/test/browser/browser_UnsubmittedCrashHandler.js
+++ b/browser/modules/test/browser/browser_UnsubmittedCrashHandler.js
@@ -83,17 +83,17 @@ function createPendingCrashReports(howMa
* The date to set lastAccessed to.
* @param contents (string, optional)
* Set this to whatever the file needs to contain, if anything.
* @returns Promise
*/
let createFile = (fileName, extension, lastAccessedDate, contents) => {
let file = dir.clone();
file.append(fileName + "." + extension);
- file.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
+ file.create(Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
let promises = [OS.File.setDates(file.path, lastAccessedDate)];
if (contents) {
let encoder = new TextEncoder();
let array = encoder.encode(contents);
promises.push(OS.File.writeAtomic(file.path, array, {
tmpPath: file.path + ".tmp",
}));
--- a/caps/tests/mochitest/test_extensionURL.html
+++ b/caps/tests/mochitest/test_extensionURL.html
@@ -43,17 +43,17 @@ https://bugzilla.mozilla.org/show_bug.cg
}
Services.io.getProtocolHandler("moz-extension")
.QueryInterface(Ci.nsISubstitutingProtocolHandler)
.setSubstitution(from, uri);
});
// Gets a normalized (de-symlinked) path in the parent process
this.addMessageListener("ResolvePath", (path) => {
- let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(path);
file.normalize();
return file.path;
});
});
// An array of objects each containing a callback and a host
// for a substitution that has been set in either the parent
@@ -128,17 +128,17 @@ https://bugzilla.mozilla.org/show_bug.cg
ok(filePath.startsWith("file://"), "resource:// URI resolves where we expect: " + filePath);
var resFile = fileHandler.getFileFromURLSpec(filePath);
// Get normalized path to the test file. We already have a file object
// |resFile|, but its underlying path may contain a symlink we can't
// resolve in the child process.
let resolvedPath = script.sendSyncMessage("ResolvePath", resFile.path);
let file = SpecialPowers.Cc["@mozilla.org/file/local;1"]
- .createInstance(SpecialPowers.Ci.nsILocalFile);
+ .createInstance(SpecialPowers.Ci.nsIFile);
info(`resolved test file path: ${resolvedPath}`);
file.initWithPath(resolvedPath);
// Setup the base directory URI string and a URI string to refer to
// the test file within that directory.
let cheriseURIStr = "moz-extension://cherise/" + file.leafName;
let liebchenURIStr = "moz-extension://liebchen/" + file.leafName;
let cheriseBaseDirURIStr = "file://" + file.parent.path + "/";
--- a/devtools/client/memory/utils.js
+++ b/devtools/client/memory/utils.js
@@ -405,17 +405,17 @@ exports.getSnapshotTotals = function (ce
* @param {Array<Array<String>>} .filters
* An array of filters to display in the file picker. Each filter in the array
* is a duple of two strings, one a name for the filter, and one the filter itself
* (like "*.json").
* @param {String} .defaultName
* The default name chosen by the file picker window.
* @param {String} .mode
* The mode that this filepicker should open in. Can be "open" or "save".
- * @return {Promise<?nsILocalFile>}
+ * @return {Promise<?nsIFile>}
* The file selected by the user, or null, if cancelled.
*/
exports.openFilePicker = function ({ title, filters, defaultName, mode }) {
let fpMode;
if (mode === "save") {
fpMode = Ci.nsIFilePicker.modeSave;
} else if (mode === "open") {
fpMode = Ci.nsIFilePicker.modeOpen;
--- a/devtools/client/netmonitor/src/har/har-utils.js
+++ b/devtools/client/netmonitor/src/har/har-utils.js
@@ -16,17 +16,17 @@ XPCOMUtils.defineLazyGetter(this, "dirSe
.getService(Ci.nsIProperties);
});
XPCOMUtils.defineLazyGetter(this, "ZipWriter", function () {
return CC("@mozilla.org/zipwriter;1", "nsIZipWriter");
});
XPCOMUtils.defineLazyGetter(this, "LocalFile", function () {
- return new CC("@mozilla.org/file/local;1", "nsILocalFile", "initWithPath");
+ return new CC("@mozilla.org/file/local;1", "nsIFile", "initWithPath");
});
XPCOMUtils.defineLazyGetter(this, "getMostRecentBrowserWindow", function () {
return Services.wm.getMostRecentWindow(gDevTools.chromeWindowType);
});
const OPEN_FLAGS = {
RDONLY: parseInt("0x01", 16),
@@ -122,17 +122,17 @@ var HarUtils = {
let originalFileName = file.leafName;
try {
// Rename using unique name (the file is going to be removed).
file.moveTo(null, "temp" + (new Date()).getTime() + "temphar");
// Create compressed file with the original file path name.
let zipFile = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
zipFile.initWithPath(originalFilePath);
// The file within the zipped file doesn't use .zip extension.
let fileName = originalFileName;
if (fileName.indexOf(".zip") == fileName.length - 4) {
fileName = fileName.substr(0, fileName.indexOf(".zip"));
}
@@ -154,21 +154,21 @@ var HarUtils = {
return false;
},
getLocalDirectory: function (path) {
let dir;
if (!path) {
- dir = dirService.get("ProfD", Ci.nsILocalFile);
+ dir = dirService.get("ProfD", Ci.nsIFile);
dir.append("har");
dir.append("logs");
} else {
- dir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ dir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
dir.initWithPath(path);
}
return dir;
},
};
// Exports from this module
--- a/devtools/client/performance/modules/io.js
+++ b/devtools/client/performance/modules/io.js
@@ -33,17 +33,17 @@ function getUnicodeConverter() {
}
/**
* Saves a recording as JSON to a file. The provided data is assumed to be
* acyclical, so that it can be properly serialized.
*
* @param object recordingData
* The recording data to stream as JSON.
- * @param nsILocalFile file
+ * @param nsIFile file
* The file to stream the data into.
* @return object
* A promise that is resolved once streaming finishes, or rejected
* if there was an error.
*/
function saveRecordingToFile(recordingData, file) {
recordingData.fileType = PERF_TOOL_SERIALIZER_IDENTIFIER;
recordingData.version = PERF_TOOL_SERIALIZER_CURRENT_VERSION;
@@ -55,17 +55,17 @@ function saveRecordingToFile(recordingDa
return new Promise(resolve => {
NetUtil.asyncCopy(inputStream, outputStream, resolve);
});
}
/**
* Loads a recording stored as JSON from a file.
*
- * @param nsILocalFile file
+ * @param nsIFile file
* The file to import the data from.
* @return object
* A promise that is resolved once importing finishes, or rejected
* if there was an error.
*/
function loadRecordingFromFile(file) {
let channel = NetUtil.newChannel({
uri: NetUtil.newURI(file),
--- a/devtools/client/performance/performance-controller.js
+++ b/devtools/client/performance/performance-controller.js
@@ -286,17 +286,17 @@ var PerformanceController = {
}),
/**
* Saves the given recording to a file. Emits `EVENTS.RECORDING_EXPORTED`
* when the file was saved.
*
* @param PerformanceRecording recording
* The model that holds the recording data.
- * @param nsILocalFile file
+ * @param nsIFile file
* The file to stream the data into.
*/
exportRecording: Task.async(function* (_, recording, file) {
yield recording.exportRecording(file);
this.emit(EVENTS.RECORDING_EXPORTED, recording, file);
}),
/**
@@ -330,17 +330,17 @@ var PerformanceController = {
this.setCurrentRecording(null);
}
}),
/**
* Loads a recording from a file, adding it to the recordings list. Emits
* `EVENTS.RECORDING_IMPORTED` when the file was loaded.
*
- * @param nsILocalFile file
+ * @param nsIFile file
* The file to import the data from.
*/
importRecording: Task.async(function* (_, file) {
let recording = yield gFront.importRecording(file);
this._addRecordingIfUnknown(recording);
this.emit(EVENTS.RECORDING_IMPORTED, recording);
}),
--- a/devtools/client/scratchpad/scratchpad.js
+++ b/devtools/client/scratchpad/scratchpad.js
@@ -1050,17 +1050,17 @@ var Scratchpad = {
openScratchpad: function SP_openScratchpad()
{
return ScratchpadManager.openScratchpad();
},
/**
* Export the textbox content to a file.
*
- * @param nsILocalFile aFile
+ * @param nsIFile aFile
* The file where you want to save the textbox content.
* @param boolean aNoConfirmation
* If the file already exists, ask for confirmation?
* @param boolean aSilentError
* True if you do not want to display an error when file save fails,
* false otherwise.
* @param function aCallback
* Optional function you want to call when file save completes. It will
@@ -1136,17 +1136,17 @@ var Scratchpad = {
}
});
return content;
},
/**
* Read the content of a file and put it into the textbox.
*
- * @param nsILocalFile aFile
+ * @param nsIFile aFile
* The file you want to save the textbox content into.
* @param boolean aSilentError
* True if you do not want to display an error when file load fails,
* false otherwise.
* @param function aCallback
* Optional function you want to call when file load completes. It will
* get the following arguments:
* 1) the nsresult status code for the import operation.
@@ -1229,17 +1229,17 @@ var Scratchpad = {
}
if (shouldOpen) {
let file;
if (aFile) {
file = aFile;
} else {
file = Components.classes["@mozilla.org/file/local;1"].
- createInstance(Components.interfaces.nsILocalFile);
+ createInstance(Components.interfaces.nsIFile);
let filePath = this.getRecentFiles()[aIndex];
file.initWithPath(filePath);
}
if (!file.exists()) {
this.notificationBox.appendNotification(
this.strings.GetStringFromName("fileNoLongerExists.notification"),
"file-no-longer-exists",
@@ -1293,18 +1293,18 @@ var Scratchpad = {
}
return filePaths;
},
/**
* Save a recent file in a JSON parsable string.
*
- * @param nsILocalFile aFile
- * The nsILocalFile we want to save as a recent file.
+ * @param nsIFile aFile
+ * The nsIFile we want to save as a recent file.
*/
setRecentFile: function SP_setRecentFile(aFile)
{
let maxRecent = Services.prefs.getIntPref(PREF_RECENT_FILES_MAX);
if (maxRecent < 1) {
return;
}
@@ -1449,17 +1449,17 @@ var Scratchpad = {
* Optional function you want to call when file is saved
*/
saveFile: function SP_saveFile(aCallback)
{
if (!this.filename) {
return this.saveFileAs(aCallback);
}
- let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(this.filename);
this.exportToFile(file, true, false, aStatus => {
if (Components.isSuccessCode(aStatus)) {
this.dirty = false;
document.getElementById("sp-cmd-revert").setAttribute("disabled", true);
this.setRecentFile(file);
}
@@ -1504,17 +1504,17 @@ var Scratchpad = {
/**
* Restore content from saved version of current file.
*
* @param function aCallback
* Optional function you want to call when file is saved
*/
revertFile: function SP_revertFile(aCallback)
{
- let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(this.filename);
if (!file.exists()) {
return;
}
this.importFromFile(file, false, (aStatus, aContent) => {
if (aCallback) {
--- a/devtools/client/scratchpad/test/browser_scratchpad_confirm_close.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_confirm_close.js
@@ -188,25 +188,25 @@ function cleanup()
gFile.remove(false);
gFile = null;
}
function createTempFile(name)
{
let file = FileUtils.getFile("TmpD", [name]);
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o666);
- file.QueryInterface(Ci.nsILocalFile);
+ file.QueryInterface(Ci.nsIFile);
return file;
}
function writeFile(file, content, callback)
{
let fout = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
- fout.init(file.QueryInterface(Ci.nsILocalFile), 0x02 | 0x08 | 0x20,
+ fout.init(file.QueryInterface(Ci.nsIFile), 0x02 | 0x08 | 0x20,
0o644, fout.DEFER_OPEN);
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
let fileContentStream = converter.convertToInputStream(content);
NetUtil.asyncCopy(fileContentStream, fout, callback);
--- a/devtools/client/scratchpad/test/browser_scratchpad_files.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_files.js
@@ -27,17 +27,17 @@ function runTests()
{
gScratchpad = gScratchpadWindow.Scratchpad;
createTempFile("fileForBug636725.tmp", gFileContent, function (aStatus, aFile) {
ok(Components.isSuccessCode(aStatus),
"The temporary file was saved successfully");
gFile = aFile;
- gScratchpad.importFromFile(gFile.QueryInterface(Ci.nsILocalFile), true,
+ gScratchpad.importFromFile(gFile.QueryInterface(Ci.nsIFile), true,
fileImported);
});
}
function fileImported(aStatus, aFileContent)
{
ok(Components.isSuccessCode(aStatus),
"the temporary file was imported successfully with Scratchpad");
@@ -50,17 +50,17 @@ function fileImported(aStatus, aFileCont
is(gScratchpad.dirty, false,
"the editor marks imported file as saved");
// Save the file after changes.
gFileContent += "// omg, saved!";
gScratchpad.editor.setText(gFileContent);
- gScratchpad.exportToFile(gFile.QueryInterface(Ci.nsILocalFile), true, true,
+ gScratchpad.exportToFile(gFile.QueryInterface(Ci.nsIFile), true, true,
fileExported);
}
function fileExported(aStatus)
{
ok(Components.isSuccessCode(aStatus),
"the temporary file was exported successfully with Scratchpad");
@@ -72,17 +72,17 @@ function fileExported(aStatus)
let oldConfirm = gScratchpadWindow.confirm;
let askedConfirmation = false;
gScratchpadWindow.confirm = function () {
askedConfirmation = true;
return false;
};
- gScratchpad.exportToFile(gFile.QueryInterface(Ci.nsILocalFile), false, true,
+ gScratchpad.exportToFile(gFile.QueryInterface(Ci.nsIFile), false, true,
fileExported2);
gScratchpadWindow.confirm = oldConfirm;
ok(askedConfirmation, "exportToFile() asked for overwrite confirmation");
gFileContent = oldContent;
--- a/devtools/client/scratchpad/test/browser_scratchpad_modeline.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_modeline.js
@@ -51,31 +51,31 @@ function runTests() {
is(obj["other"], "true");
// Test importing files with a mode-line in them.
let content = "/* -sp-context:browser */\n" + gFileContent;
createTempFile("fileForBug644413.tmp", content, function (aStatus, aFile) {
ok(Components.isSuccessCode(aStatus), "File was saved successfully");
gFile = aFile;
- gScratchpad.importFromFile(gFile.QueryInterface(Ci.nsILocalFile), true, fileImported);
+ gScratchpad.importFromFile(gFile.QueryInterface(Ci.nsIFile), true, fileImported);
});
}
function fileImported(status, content) {
ok(Components.isSuccessCode(status), "File was imported successfully");
// Since devtools.chrome.enabled is off, Scratchpad should still be in
// the content context.
is(gScratchpad.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_CONTENT);
// Set the pref and try again.
Services.prefs.setBoolPref(DEVTOOLS_CHROME_ENABLED, true);
- gScratchpad.importFromFile(gFile.QueryInterface(Ci.nsILocalFile), true, function (status, content) {
+ gScratchpad.importFromFile(gFile.QueryInterface(Ci.nsIFile), true, function (status, content) {
ok(Components.isSuccessCode(status), "File was imported successfully");
is(gScratchpad.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_BROWSER);
gFile.remove(false);
gFile = null;
gScratchpad = null;
finish();
});
--- a/devtools/client/scratchpad/test/browser_scratchpad_recent_files.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_recent_files.js
@@ -187,21 +187,21 @@ function createAndLoadTemporaryFile(aFil
{
// Create a temporary file.
aFile = FileUtils.getFile("TmpD", [aFileName]);
aFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o666);
// Write the temporary file.
let fout = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
- fout.init(aFile.QueryInterface(Ci.nsILocalFile), 0x02 | 0x08 | 0x20,
+ fout.init(aFile.QueryInterface(Ci.nsIFile), 0x02 | 0x08 | 0x20,
0o644, fout.DEFER_OPEN);
gScratchpad.setFilename(aFile.path);
- gScratchpad.importFromFile(aFile.QueryInterface(Ci.nsILocalFile), true,
+ gScratchpad.importFromFile(aFile.QueryInterface(Ci.nsIFile), true,
fileImported);
gScratchpad.saveFile(fileSaved);
return aFile;
}
function fileImported(aStatus)
{
--- a/devtools/client/scratchpad/test/browser_scratchpad_reset_undo.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_reset_undo.js
@@ -41,22 +41,22 @@ function runTests()
gFileA.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o666);
gFileB = FileUtils.getFile("TmpD", ["fileBForBug684546.tmp"]);
gFileB.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o666);
// Write the temporary file.
let foutA = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
- foutA.init(gFileA.QueryInterface(Ci.nsILocalFile), 0x02 | 0x08 | 0x20,
+ foutA.init(gFileA.QueryInterface(Ci.nsIFile), 0x02 | 0x08 | 0x20,
0o644, foutA.DEFER_OPEN);
let foutB = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
- foutB.init(gFileB.QueryInterface(Ci.nsILocalFile), 0x02 | 0x08 | 0x20,
+ foutB.init(gFileB.QueryInterface(Ci.nsIFile), 0x02 | 0x08 | 0x20,
0o644, foutB.DEFER_OPEN);
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
let fileContentStreamA = converter.convertToInputStream(gFileAContent);
let fileContentStreamB = converter.convertToInputStream(gFileBContent);
@@ -75,17 +75,17 @@ function tempFileSaved(aStatus)
finish();
return;
}
if (gFirstFileSaved && success)
{
ok((gFirstFileSaved && success), "Both files loaded");
// Import the file A into Scratchpad.
- gScratchpad.importFromFile(gFileA.QueryInterface(Ci.nsILocalFile), true,
+ gScratchpad.importFromFile(gFileA.QueryInterface(Ci.nsIFile), true,
fileAImported);
}
gFirstFileSaved = success;
}
function fileAImported(aStatus, aFileContent)
{
ok(Components.isSuccessCode(aStatus),
@@ -100,17 +100,17 @@ function fileAImported(aStatus, aFileCon
is(gScratchpad.getText(), gFileAContent + "new text", "text updated correctly");
gScratchpad.undo();
is(gScratchpad.getText(), gFileAContent, "undo works");
gScratchpad.redo();
is(gScratchpad.getText(), gFileAContent + "new text", "redo works");
// Import the file B into Scratchpad.
- gScratchpad.importFromFile(gFileB.QueryInterface(Ci.nsILocalFile), true,
+ gScratchpad.importFromFile(gFileB.QueryInterface(Ci.nsIFile), true,
fileBImported);
}
function fileBImported(aStatus, aFileContent)
{
ok(Components.isSuccessCode(aStatus),
"the temporary file B was imported successfully with Scratchpad");
--- a/devtools/client/scratchpad/test/browser_scratchpad_revert_to_saved.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_revert_to_saved.js
@@ -92,17 +92,17 @@ function createAndLoadTemporaryFile()
{
// Create a temporary file.
gFile = FileUtils.getFile("TmpD", [gFileName]);
gFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o666);
// Write the temporary file.
let fout = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
- fout.init(gFile.QueryInterface(Ci.nsILocalFile), 0x02 | 0x08 | 0x20,
+ fout.init(gFile.QueryInterface(Ci.nsIFile), 0x02 | 0x08 | 0x20,
0o644, fout.DEFER_OPEN);
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
let fileContentStream = converter.convertToInputStream(gFileContent);
NetUtil.asyncCopy(fileContentStream, fout, tempFileSaved);
@@ -110,17 +110,17 @@ function createAndLoadTemporaryFile()
function tempFileSaved(aStatus)
{
ok(Components.isSuccessCode(aStatus),
"the temporary file was saved successfully");
// Import the file into Scratchpad.
gScratchpad.setFilename(gFile.path);
- gScratchpad.importFromFile(gFile.QueryInterface(Ci.nsILocalFile), true,
+ gScratchpad.importFromFile(gFile.QueryInterface(Ci.nsIFile), true,
testAfterSaved);
}
function test()
{
waitForExplicitFinish();
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
--- a/devtools/client/scratchpad/test/head.js
+++ b/devtools/client/scratchpad/test/head.js
@@ -115,17 +115,17 @@ function createTempFile(aName, aContent,
{
// Create a temporary file.
let file = FileUtils.getFile("TmpD", [aName]);
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("666", 8));
// Write the temporary file.
let fout = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
- fout.init(file.QueryInterface(Ci.nsILocalFile), 0x02 | 0x08 | 0x20,
+ fout.init(file.QueryInterface(Ci.nsIFile), 0x02 | 0x08 | 0x20,
parseInt("644", 8), fout.DEFER_OPEN);
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
let fileContentStream = converter.convertToInputStream(aContent);
NetUtil.asyncCopy(fileContentStream, fout, function (aStatus) {
--- a/devtools/client/styleeditor/StyleEditorUtil.jsm
+++ b/devtools/client/styleeditor/StyleEditorUtil.jsm
@@ -191,17 +191,17 @@ function showFilePicker(path, toSave, pa
return;
}
} catch (ex) {
callback(null);
return;
}
try {
let file =
- Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(path);
callback(file);
return;
} catch (ex) {
callback(null);
return;
}
}
--- a/devtools/client/webide/content/simulator.js
+++ b/devtools/client/webide/content/simulator.js
@@ -138,17 +138,17 @@ var SimulatorEditor = {
profD.append("extensions");
profD.append(this._simulator.addon.id);
profD.append("profile");
profD.append("dummy");
let profileDir = profD.path;
// Show the profile directory.
let nsLocalFile = Components.Constructor("@mozilla.org/file/local;1",
- "nsILocalFile", "initWithPath");
+ "nsIFile", "initWithPath");
new nsLocalFile(profileDir).reveal();
},
// Close the configuration panel.
close() {
this._simulator = null;
window.parent.UI.openProject();
},
--- a/devtools/client/webide/modules/simulator-process.js
+++ b/devtools/client/webide/modules/simulator-process.js
@@ -183,26 +183,26 @@ function CustomSimulatorProcess(options)
this.options = options;
}
var CSPp = CustomSimulatorProcess.prototype = Object.create(SimulatorProcess.prototype);
// Compute B2G binary file handle.
Object.defineProperty(CSPp, "b2gBinary", {
get: function () {
- let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(this.options.b2gBinary);
return file;
}
});
// Compute Gaia profile file handle.
Object.defineProperty(CSPp, "gaiaProfile", {
get: function () {
- let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(this.options.gaiaProfile);
return file;
}
});
exports.CustomSimulatorProcess = CustomSimulatorProcess;
@@ -252,17 +252,17 @@ Object.defineProperty(ASPp, "b2gBinary",
// Compute Gaia profile file handle.
Object.defineProperty(ASPp, "gaiaProfile", {
get: function () {
let file;
// Custom profile from simulator configuration.
if (this.options.gaiaProfile) {
- file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(this.options.gaiaProfile);
return file;
}
// Custom profile from addon prefs.
try {
let pref = "extensions." + this.addon.id + ".gaiaProfile";
file = Services.prefs.getComplexValue(pref, Ci.nsIFile);
--- a/devtools/client/webide/test/test_app_validator.html
+++ b/devtools/client/webide/test/test_app_validator.html
@@ -18,17 +18,17 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
Cu.import("resource://testing-common/httpd.js");
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
const {AppValidator} = require("devtools/client/webide/modules/app-validator");
const Services = require("Services");
const nsFile = Components.Constructor("@mozilla.org/file/local;1",
- "nsILocalFile", "initWithPath");
+ "nsIFile", "initWithPath");
const cr = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIChromeRegistry);
const strings = Services.strings.createBundle("chrome://devtools/locale/app-manager.properties");
let httpserver, origin;
window.onload = function() {
SimpleTest.waitForExplicitFinish();
--- a/devtools/shared/fronts/performance-recording.js
+++ b/devtools/shared/fronts/performance-recording.js
@@ -62,17 +62,17 @@ Object.assign({
destroy: function () {
Front.prototype.destroy.call(this);
},
/**
* Saves the current recording to a file.
*
- * @param nsILocalFile file
+ * @param nsIFile file
* The file to stream the data into.
*/
exportRecording: function (file) {
let recordingData = this.getAllData();
return PerformanceIO.saveRecordingToFile(recordingData, file);
},
/**
--- a/devtools/shared/fronts/performance.js
+++ b/devtools/shared/fronts/performance.js
@@ -83,17 +83,17 @@ const PerformanceFront = FrontClassWithS
}
return percent;
},
/**
* Loads a recording from a file.
*
- * @param {nsILocalFile} file
+ * @param {nsIFile} file
* The file to import the data from.
* @return {Promise<PerformanceRecordingFront>}
*/
importRecording: function (file) {
return PerformanceIO.loadRecordingFromFile(file).then(recordingData => {
let model = new PerformanceRecordingFront();
model._imported = true;
model._label = recordingData.label || "";
--- a/devtools/shared/gcli/commands/folder.js
+++ b/devtools/shared/gcli/commands/folder.js
@@ -6,17 +6,17 @@
const { Cc, Ci, CC } = require("chrome");
const Services = require("Services");
const l10n = require("gcli/l10n");
const dirService = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties);
function showFolder(path) {
- let NSLocalFile = CC("@mozilla.org/file/local;1", "nsILocalFile",
+ let NSLocalFile = CC("@mozilla.org/file/local;1", "nsIFile",
"initWithPath");
try {
let file = new NSLocalFile(path);
if (file.exists()) {
file.reveal();
return l10n.lookupFormat("folderOpenDirResult", [path]);
--- a/devtools/shared/gcli/commands/screenshot.js
+++ b/devtools/shared/gcli/commands/screenshot.js
@@ -161,17 +161,17 @@ exports.items = [
// Click handler
if (imageSummary.href || imageSummary.filename) {
root.style.cursor = "pointer";
root.addEventListener("click", () => {
if (imageSummary.href) {
let mainWindow = context.environment.chromeWindow;
mainWindow.openUILinkIn(imageSummary.href, "tab");
} else if (imageSummary.filename) {
- const file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ const file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(imageSummary.filename);
file.reveal();
}
});
}
return root;
}
--- a/devtools/shared/system.js
+++ b/devtools/shared/system.js
@@ -181,17 +181,17 @@ function* getSystemInfo() {
CACHED_INFO = info;
return info;
}
function getProfileLocation() {
// In child processes, we cannot access the profile location.
try {
- let profd = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
+ let profd = Services.dirsvc.get("ProfD", Ci.nsIFile);
let profservice = Cc["@mozilla.org/toolkit/profile-service;1"]
.getService(Ci.nsIToolkitProfileService);
let profiles = profservice.profiles;
while (profiles.hasMoreElements()) {
let profile = profiles.getNext().QueryInterface(Ci.nsIToolkitProfile);
if (profile.rootDir.path == profd.path) {
return profile.name;
}
--- a/docshell/test/chrome/bug294258_window.xul
+++ b/docshell/test/chrome/bug294258_window.xul
@@ -37,17 +37,17 @@
} );
yield undefined;
// Change the data for each of the form fields, and reload.
$("text").value = "text value";
$("checkbox").checked = true;
var file = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsILocalFile);
+ .get("TmpD", Components.interfaces.nsIFile);
file.append("294258_test.file");
file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
filePath = file.path;
$("file").value = filePath;
$("textarea").value = "textarea value";
$("radio1").checked = true;
$("select").selectedIndex = 2;
doPageNavigation( {
--- a/dom/base/test/bug638112.sjs
+++ b/dom/base/test/bug638112.sjs
@@ -1,13 +1,13 @@
function getInputStream(path)
{
var file = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
var fis = Components.classes['@mozilla.org/network/file-input-stream;1'].
createInstance(Components.interfaces.nsIFileInputStream);
var split = path.split("/");
for(var i = 0; i < split.length; ++i) {
file.append(split[i]);
}
fis.init(file, -1, -1, false);
return fis;
--- a/dom/base/test/unit/head_xml.js
+++ b/dom/base/test/unit/head_xml.js
@@ -2,17 +2,17 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const I = Components.interfaces;
const C = Components.classes;
-const nsILocalFile = I.nsILocalFile;
+const nsIFile = I.nsIFile;
const nsIProperties = I.nsIProperties;
const nsIFileInputStream = I.nsIFileInputStream;
const nsIInputStream = I.nsIInputStream;
const nsIDOMParser = I.nsIDOMParser;
const nsIDOMSerializer = I.nsIDOMSerializer;
const nsIDOMDocument = I.nsIDOMDocument;
const nsIDOMElement = I.nsIDOMElement;
@@ -36,17 +36,17 @@ function ParseFile(file) {
if (!__testsDirectory) {
__testsDirectory = do_get_cwd();
}
var fileObj = __testsDirectory.clone();
fileObj.append(file);
file = fileObj;
}
- do_check_eq(file instanceof nsILocalFile, true);
+ do_check_eq(file instanceof nsIFile, true);
var fileStr = C["@mozilla.org/network/file-input-stream;1"]
.createInstance(nsIFileInputStream);
// Init for readonly reading
fileStr.init(file, 0x01, 0o400, nsIFileInputStream.CLOSE_ON_EOF);
return ParseXML(fileStr);
}
--- a/dom/canvas/test/crossorigin/video.sjs
+++ b/dom/canvas/test/crossorigin/video.sjs
@@ -13,17 +13,17 @@ function parseQuery(request, key) {
}
function handleRequest(request, response) {
var name = parseQuery(request, "name");
var type = parseQuery(request, "type");
var cors = parseQuery(request, "cors");
var file = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
var fis = Components.classes['@mozilla.org/network/file-input-stream;1'].
createInstance(Components.interfaces.nsIFileInputStream);
var bis = Components.classes["@mozilla.org/binaryinputstream;1"].
createInstance(Components.interfaces.nsIBinaryInputStream);
var split = name.split("/");
for(var i = 0; i < split.length; ++i) {
file.append(split[i]);
}
--- a/dom/json/test/unit/test_encode.js
+++ b/dom/json/test/unit/test_encode.js
@@ -2,17 +2,17 @@ var Ci = Components.interfaces;
var Cc = Components.classes;
var nativeJSON = Cc["@mozilla.org/dom/json;1"].createInstance(Ci.nsIJSON);
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
var workingDir = dirSvc.get("TmpD", Ci.nsIFile);
var outputName = "json-test-output";
-var outputDir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+var outputDir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
outputDir.initWithFile(workingDir);
outputDir.append(outputName);
if (!outputDir.exists()) {
outputDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0o777);
} else if (!outputDir.isDirectory()) {
do_throw(outputName + " is not a directory?")
}
@@ -75,17 +75,17 @@ function testThrowingToJSON() {
throw "didn't throw";
} catch (ex) {
do_check_eq(ex, "crash and burn");
}
}
function testOutputStreams() {
function writeToFile(obj, charset, writeBOM) {
- var jsonFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ var jsonFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
jsonFile.initWithFile(outputDir);
jsonFile.append("test.json");
jsonFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600);
var stream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
try {
stream.init(jsonFile, 0x04 | 0x08 | 0x20, 0o600, 0); // write, create, truncate
nativeJSON.encodeToStream(stream, charset, writeBOM, obj);
} finally {
--- a/dom/manifest/test/file_testserver.sjs
+++ b/dom/manifest/test/file_testserver.sjs
@@ -4,17 +4,17 @@ Components.utils.importGlobalProperties(
function loadHTMLFromFile(path) {
// Load the HTML to return in the response from file.
// Since it's relative to the cwd of the test runner, we start there and
// append to get to the actual path of the file.
const testHTMLFile =
Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
const testHTMLFileStream =
Components.classes["@mozilla.org/network/file-input-stream;1"].
createInstance(Components.interfaces.nsIFileInputStream);
path
.split("/")
.filter(path => path)
--- a/dom/media/test/allowed.sjs
+++ b/dom/media/test/allowed.sjs
@@ -26,17 +26,17 @@ var types = {
// Return file with name as per the query string with access control
// allow headers.
function handleRequest(request, response)
{
var resource = parseQuery(request, "");
var file = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
var fis = Components.classes['@mozilla.org/network/file-input-stream;1'].
createInstance(Components.interfaces.nsIFileInputStream);
var bis = Components.classes["@mozilla.org/binaryinputstream;1"].
createInstance(Components.interfaces.nsIBinaryInputStream);
var paths = "tests/dom/media/test/" + resource;
var split = paths.split("/");
for(var i = 0; i < split.length; ++i) {
file.append(split[i]);
--- a/dom/media/test/contentType.sjs
+++ b/dom/media/test/contentType.sjs
@@ -20,17 +20,17 @@ function handleRequest(request, response
var filename = parseQuery(request, "file");
const CC = Components.Constructor;
const BinaryOutputStream = CC("@mozilla.org/binaryoutputstream;1",
"nsIBinaryOutputStream",
"setOutputStream");
var file = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
var fis = Components.classes['@mozilla.org/network/file-input-stream;1'].
createInstance(Components.interfaces.nsIFileInputStream);
var bis = Components.classes["@mozilla.org/binaryinputstream;1"].
createInstance(Components.interfaces.nsIBinaryInputStream);
var paths = "tests/dom/media/test/" + filename;
dump(paths + '\n');
var split = paths.split("/");
for(var i = 0; i < split.length; ++i) {
--- a/dom/media/test/dash_detect_stream_switch.sjs
+++ b/dom/media/test/dash_detect_stream_switch.sjs
@@ -54,17 +54,17 @@ function handleRequest(request, response
if (offsets.length != 2) {
throw "DASH-SJS: ERROR: invalid number of tokens (" + offsets.length +
") delimited by \'-\' in \'Range\' header.";
}
var startOffset = parseInt(offsets[0]);
var endOffset = parseInt(offsets[1]);
var file = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
var fis = Components.classes['@mozilla.org/network/file-input-stream;1'].
createInstance(Components.interfaces.nsIFileInputStream);
var bis = Components.classes["@mozilla.org/binaryinputstream;1"].
createInstance(Components.interfaces.nsIBinaryInputStream);
var paths = "tests/dom/media/test/" + name;
var split = paths.split("/");
for (var i = 0; i < split.length; ++i) {
--- a/dom/media/test/dynamic_redirect.sjs
+++ b/dom/media/test/dynamic_redirect.sjs
@@ -29,17 +29,17 @@ function handleRequest(request, response
response.setHeader("Location", url);
response.setHeader("Content-Type", "text/html");
return;
}
setState(key, "redirect");
}
var file = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
var fis = Components.classes['@mozilla.org/network/file-input-stream;1'].
createInstance(Components.interfaces.nsIFileInputStream);
var bis = Components.classes["@mozilla.org/binaryinputstream;1"].
createInstance(Components.interfaces.nsIBinaryInputStream);
var paths = "tests/dom/media/test/" + resource;
var split = paths.split("/");
for (var i = 0; i < split.length; ++i) {
file.append(split[i]);
--- a/dom/media/test/dynamic_resource.sjs
+++ b/dom/media/test/dynamic_resource.sjs
@@ -20,17 +20,17 @@ function handleRequest(request, response
var resource1 = parseQuery(request, "res1");
var resource2 = parseQuery(request, "res2");
var resource = getState(key) == "2" ? resource2 : resource1;
setState(key, "2");
var file = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
var fis = Components.classes['@mozilla.org/network/file-input-stream;1'].
createInstance(Components.interfaces.nsIFileInputStream);
var bis = Components.classes["@mozilla.org/binaryinputstream;1"].
createInstance(Components.interfaces.nsIBinaryInputStream);
var paths = "tests/dom/media/test/" + resource;
var split = paths.split("/");
for(var i = 0; i < split.length; ++i) {
file.append(split[i]);
--- a/dom/media/test/manifest.js
+++ b/dom/media/test/manifest.js
@@ -463,17 +463,17 @@ function fileUriToSrc(path, mustExist) {
if (manifestNavigator().appVersion.indexOf("Android") != -1 || SpecialPowers.Services.appinfo.name == "B2G")
return path;
const Ci = SpecialPowers.Ci;
const Cc = SpecialPowers.Cc;
const Cr = SpecialPowers.Cr;
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
- var f = dirSvc.get("CurWorkD", Ci.nsILocalFile);
+ var f = dirSvc.get("CurWorkD", Ci.nsIFile);
var split = path.split("/");
for(var i = 0; i < split.length; ++i) {
f.append(split[i]);
}
if (mustExist && !f.exists()) {
ok(false, "We expected '" + path + "' to exist, but it doesn't!");
}
return f.path;
--- a/dom/media/test/referer.sjs
+++ b/dom/media/test/referer.sjs
@@ -16,17 +16,17 @@ function handleRequest(request, response
{
var referer = request.hasHeader("Referer") ? request.getHeader("Referer")
: undefined;
if (referer == "http://mochi.test:8888/tests/dom/media/test/test_referer.html") {
var name = parseQuery(request, "name");
var type = parseQuery(request, "type");
var file = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
var fis = Components.classes['@mozilla.org/network/file-input-stream;1'].
createInstance(Components.interfaces.nsIFileInputStream);
var bis = Components.classes["@mozilla.org/binaryinputstream;1"].
createInstance(Components.interfaces.nsIBinaryInputStream);
var paths = "tests/dom/media/test/" + name;
var split = paths.split("/");
for(var i = 0; i < split.length; ++i) {
file.append(split[i]);
--- a/dom/media/test/seekLies.sjs
+++ b/dom/media/test/seekLies.sjs
@@ -1,13 +1,13 @@
function handleRequest(request, response)
{
var file = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
var fis = Components.classes['@mozilla.org/network/file-input-stream;1'].
createInstance(Components.interfaces.nsIFileInputStream);
var bis = Components.classes["@mozilla.org/binaryinputstream;1"].
createInstance(Components.interfaces.nsIBinaryInputStream);
var paths = "tests/dom/media/test/seek.ogv";
var split = paths.split("/");
for(var i = 0; i < split.length; ++i) {
file.append(split[i]);
--- a/dom/media/webaudio/test/corsServer.sjs
+++ b/dom/media/webaudio/test/corsServer.sjs
@@ -1,13 +1,13 @@
function handleRequest(request, response)
{
var file = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
var fis = Components.classes['@mozilla.org/network/file-input-stream;1'].
createInstance(Components.interfaces.nsIFileInputStream);
var bis = Components.classes["@mozilla.org/binaryinputstream;1"].
createInstance(Components.interfaces.nsIBinaryInputStream);
var paths = "tests/dom/media/webaudio/test/small-shot.ogg";
var split = paths.split("/");
for(var i = 0; i < split.length; ++i) {
file.append(split[i]);
--- a/dom/plugins/test/mochitest/test_crash_submit.xul
+++ b/dom/plugins/test/mochitest/test_crash_submit.xul
@@ -53,17 +53,17 @@ var testObserver = {
req.send(null);
is(req.status, 200, "Server response should be 200 OK");
let submitted = JSON.parse(req.responseText);
ok(!("Throttleable" in submitted), "Submit request should not be Throttleable");
is(submitted.ProcessType, "plugin", "Should specify ProcessType=plugin");
// Cleanup
// First remove our fake submitted report
- let file = Services.dirsvc.get("UAppData", Components.interfaces.nsILocalFile);
+ let file = Services.dirsvc.get("UAppData", Components.interfaces.nsIFile);
file.append("Crash Reports");
file.append("submitted");
file.append(remoteID + ".txt");
file.remove(false);
// Next unregister our observer
var os = Components.classes["@mozilla.org/observer-service;1"].
getService(Components.interfaces.nsIObserverService);
--- a/dom/plugins/test/mochitest/test_hang_submit.xul
+++ b/dom/plugins/test/mochitest/test_hang_submit.xul
@@ -63,17 +63,17 @@ var testObserver = {
let dumpNames = submitted.additional_minidumps.split(',');
ok(dumpNames.indexOf("browser") != -1, "additional_minidumps should contain browser");
info("additional_minidumps="+submitted.additional_minidumps);
ok("upload_file_minidump" in submitted, "Request should contain upload_file_minidump field");
ok("upload_file_minidump_browser" in submitted, "Request should contain upload_file_minidump_browser field");
// Cleanup
// First remove our fake submitted report
- let file = Services.dirsvc.get("UAppData", Ci.nsILocalFile);
+ let file = Services.dirsvc.get("UAppData", Ci.nsIFile);
file.append("Crash Reports");
file.append("submitted");
file.append(remoteID + ".txt");
file.remove(false);
// Next unregister our observer
Services.obs.removeObserver(testObserver, "crash-report-status");
--- a/dom/plugins/test/unit/head_plugins.js
+++ b/dom/plugins/test/unit/head_plugins.js
@@ -15,17 +15,17 @@ const gDirSvc = Cc["@mozilla.org/file/di
function allow_all_plugins() {
Services.prefs.setBoolPref("plugin.load_flash_only", false);
}
// Finds the test plugin library
function get_test_plugin(secondplugin=false) {
var pluginEnum = gDirSvc.get("APluginsDL", Ci.nsISimpleEnumerator);
while (pluginEnum.hasMoreElements()) {
- let dir = pluginEnum.getNext().QueryInterface(Ci.nsILocalFile);
+ let dir = pluginEnum.getNext().QueryInterface(Ci.nsIFile);
let name = get_platform_specific_plugin_name(secondplugin);
let plugin = dir.clone();
plugin.append(name);
if (plugin.exists()) {
plugin.normalize();
return plugin;
}
}
@@ -51,17 +51,17 @@ function get_test_plugintag(aName="Test
// Creates a fake ProfDS directory key, copied from do_get_profile
function do_get_profile_startup() {
let env = Components.classes["@mozilla.org/process/environment;1"]
.getService(Components.interfaces.nsIEnvironment);
// the python harness sets this in the environment for us
let profd = env.get("XPCSHELL_TEST_PROFILE_DIR");
let file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
+ .createInstance(Components.interfaces.nsIFile);
file.initWithPath(profd);
let dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
let provider = {
getFile: function(prop, persistent) {
persistent.value = true;
if (prop == "ProfDS") {
@@ -102,17 +102,17 @@ function get_platform_specific_plugin_su
else return null;
}
function get_test_plugin_no_symlink() {
let dirSvc = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties);
let pluginEnum = dirSvc.get("APluginsDL", Ci.nsISimpleEnumerator);
while (pluginEnum.hasMoreElements()) {
- let dir = pluginEnum.getNext().QueryInterface(Ci.nsILocalFile);
+ let dir = pluginEnum.getNext().QueryInterface(Ci.nsIFile);
let plugin = dir.clone();
plugin.append(get_platform_specific_plugin_name());
if (plugin.exists()) {
return plugin;
}
}
return null;
}
--- a/dom/security/test/contentverifier/file_contentserver.sjs
+++ b/dom/security/test/contentverifier/file_contentserver.sjs
@@ -59,17 +59,17 @@ function setupTestFiles() {
}
function getFileName(filePath, dir) {
// Since it's relative to the cwd of the test runner, we start there and
// append to get to the actual path of the file.
let testFile =
Cc["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get(dir, Components.interfaces.nsILocalFile);
+ get(dir, Components.interfaces.nsIFile);
let dirs = filePath.split("/");
for (let i = 0; i < dirs.length; i++) {
testFile.append(dirs[i]);
}
return testFile;
}
function loadFile(file) {
--- a/dom/security/test/csp/file_bug888172.sjs
+++ b/dom/security/test/csp/file_bug888172.sjs
@@ -4,17 +4,17 @@ Components.utils.import("resource://gre/
function loadHTMLFromFile(path) {
// Load the HTML to return in the response from file.
// Since it's relative to the cwd of the test runner, we start there and
// append to get to the actual path of the file.
var testHTMLFile =
Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
var dirs = path.split("/");
for (var i = 0; i < dirs.length; i++) {
testHTMLFile.append(dirs[i]);
}
var testHTMLFileStream =
Components.classes["@mozilla.org/network/file-input-stream;1"].
createInstance(Components.interfaces.nsIFileInputStream);
testHTMLFileStream.init(testHTMLFile, -1, 0, 0);
--- a/dom/security/test/csp/file_bug910139.sjs
+++ b/dom/security/test/csp/file_bug910139.sjs
@@ -1,17 +1,17 @@
// Server side js file for bug 910139, see file test_bug910139.html for details.
Components.utils.import("resource://gre/modules/NetUtil.jsm");
function loadResponseFromFile(path) {
var testHTMLFile =
Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
var dirs = path.split("/");
for (var i = 0; i < dirs.length; i++) {
testHTMLFile.append(dirs[i]);
}
var testHTMLFileStream =
Components.classes["@mozilla.org/network/file-input-stream;1"].
createInstance(Components.interfaces.nsIFileInputStream);
testHTMLFileStream.init(testHTMLFile, -1, 0, 0);
--- a/dom/security/test/csp/file_ignore_unsafe_inline_multiple_policies_server.sjs
+++ b/dom/security/test/csp/file_ignore_unsafe_inline_multiple_policies_server.sjs
@@ -6,17 +6,17 @@ Components.utils.import("resource://gre/
function loadHTMLFromFile(path) {
// Load the HTML to return in the response from file.
// Since it's relative to the cwd of the test runner, we start there and
// append to get to the actual path of the file.
var testHTMLFile =
Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
var dirs = path.split("/");
for (var i = 0; i < dirs.length; i++) {
testHTMLFile.append(dirs[i]);
}
var testHTMLFileStream =
Components.classes["@mozilla.org/network/file-input-stream;1"].
createInstance(Components.interfaces.nsIFileInputStream);
testHTMLFileStream.init(testHTMLFile, -1, 0, 0);
--- a/dom/security/test/csp/file_testserver.sjs
+++ b/dom/security/test/csp/file_testserver.sjs
@@ -5,17 +5,17 @@ Components.utils.importGlobalProperties(
function loadHTMLFromFile(path) {
// Load the HTML to return in the response from file.
// Since it's relative to the cwd of the test runner, we start there and
// append to get to the actual path of the file.
const testHTMLFile =
Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
const testHTMLFileStream =
Components.classes["@mozilla.org/network/file-input-stream;1"].
createInstance(Components.interfaces.nsIFileInputStream);
path
.split("/")
.filter(path => path)
--- a/dom/security/test/csp/file_upgrade_insecure_reporting_server.sjs
+++ b/dom/security/test/csp/file_upgrade_insecure_reporting_server.sjs
@@ -14,17 +14,17 @@ const POLICY_RO = "default-src https: 'u
function loadHTMLFromFile(path) {
// Load the HTML to return in the response from file.
// Since it's relative to the cwd of the test runner, we start there and
// append to get to the actual path of the file.
var testHTMLFile =
Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
var dirs = path.split("/");
for (var i = 0; i < dirs.length; i++) {
testHTMLFile.append(dirs[i]);
}
var testHTMLFileStream =
Components.classes["@mozilla.org/network/file-input-stream;1"].
createInstance(Components.interfaces.nsIFileInputStream);
testHTMLFileStream.init(testHTMLFile, -1, 0, 0);
--- a/dom/security/test/hsts/file_testserver.sjs
+++ b/dom/security/test/hsts/file_testserver.sjs
@@ -5,17 +5,17 @@ Components.utils.importGlobalProperties(
function loadFromFile(path) {
// Load the HTML to return in the response from file.
// Since it's relative to the cwd of the test runner, we start there and
// append to get to the actual path of the file.
var testFile =
Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
var dirs = path.split("/");
for (var i = 0; i < dirs.length; i++) {
testFile.append(dirs[i]);
}
var testFileStream =
Components.classes["@mozilla.org/network/file-input-stream;1"].
createInstance(Components.interfaces.nsIFileInputStream);
testFileStream.init(testFile, -1, 0, 0);
--- a/dom/xul/templates/tests/chrome/templates_shared.js
+++ b/dom/xul/templates/tests/chrome/templates_shared.js
@@ -473,16 +473,16 @@ function copyToProfile(filename)
if (parentURI.JARFile) {
parentURI = extractJarToTmp(parentURI);
} else {
var fileHandler = Cc["@mozilla.org/network/protocol;1?name=file"].
getService(Ci.nsIFileProtocolHandler);
parentURI = fileHandler.getFileFromURLSpec(parentURI.spec);
}
- parentURI = parentURI.QueryInterface(Ci.nsILocalFile);
+ parentURI = parentURI.QueryInterface(Ci.nsIFile);
parentURI.append(filename);
try {
var retVal = parentURI.copyToFollowingLinks(file.parent, filename);
} catch (ex) {
//ignore this error as the file could exist already
}
}
--- a/image/test/browser/browser_docshell_type_editor.js
+++ b/image/test/browser/browser_docshell_type_editor.js
@@ -2,22 +2,22 @@
"use strict";
const Ci = Components.interfaces;
const SIMPLE_HTML = "data:text/html,<html><head></head><body></body></html>";
/**
* Returns the directory where the chrome.manifest file for the test can be found.
*
- * @return nsILocalFile of the manifest directory
+ * @return nsIFile of the manifest directory
*/
function getManifestDir() {
let path = getTestFilePath("browser_docshell_type_editor");
let file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
+ .createInstance(Components.interfaces.nsIFile);
file.initWithPath(path);
return file;
}
// The following URI is *not* accessible to content, hence loading that URI
// from an unprivileged site should be blocked. If docshell is of appType
// APP_TYPE_EDITOR however the load should be allowed.
// >> chrome://test1/skin/privileged.png
--- a/image/test/crashtests/delayedframe.sjs
+++ b/image/test/crashtests/delayedframe.sjs
@@ -1,14 +1,14 @@
function getFileStream(filename)
{
// Get the location of this sjs file, and then use that to figure out where
// to find where our other files are.
var self = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
+ .createInstance(Components.interfaces.nsIFile);
self.initWithPath(getState("__LOCATION__"));
var file = self.parent;
file.append(filename);
dump(file.path + "\n");
var fileStream = Components.classes['@mozilla.org/network/file-input-stream;1']
.createInstance(Components.interfaces.nsIFileInputStream);
fileStream.init(file, 1, 0, false);
--- a/layout/base/tests/chrome/printpreview_helper.xul
+++ b/layout/base/tests/chrome/printpreview_helper.xul
@@ -15,17 +15,17 @@ var todo = window.opener.wrappedJSObject
var SimpleTest = window.opener.wrappedJSObject.SimpleTest;
var gWbp;
var ctx1;
var ctx2;
var counter = 0;
var file = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsILocalFile);
+ .get("TmpD", Components.interfaces.nsIFile);
filePath = file.path;
function printpreview() {
gWbp = window.frames[1].QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebBrowserPrint);
var listener = {
onLocationChange: function(webProgress, request, location, flags) { },
onProgressChange: function(webProgress, request, curSelfProgress,
--- a/layout/forms/test/test_bug536567_perwindowpb.html
+++ b/layout/forms/test/test_bug536567_perwindowpb.html
@@ -21,23 +21,23 @@ const Ci = Components.interfaces;
const Cu = Components.utils;
const Cm = Components.manager;
Cu.import("resource://gre/modules/Services.jsm");
var MockFilePicker = SpecialPowers.MockFilePicker;
MockFilePicker.init(window);
-var tmpDir = Services.dirsvc.get("TmpD", Ci.nsILocalFile);
-var homeDir = Services.dirsvc.get("Desk", Ci.nsILocalFile);
+var tmpDir = Services.dirsvc.get("TmpD", Ci.nsIFile);
+var homeDir = Services.dirsvc.get("Desk", Ci.nsIFile);
function newDir() {
var dir = tmpDir.clone();
dir.append("testdir" + Math.floor(Math.random() * 10000));
- dir.QueryInterface(Ci.nsILocalFile);
+ dir.QueryInterface(Ci.nsIFile);
dir.createUnique(Ci.nsIFile.DIRECTORY_TYPE, 0700);
return dir;
}
var dirs = [];
for(var i = 0; i < 6; i++) {
dirs.push(newDir());
}
@@ -167,17 +167,17 @@ function testOnWindow(aIsPrivate, aCallb
}
MockFilePicker.showCallback = function(filepicker) {
var test = tests[testIndex];
var returned = -1;
for (var i = 0; i < dirs.length; i++) {
var dir = MockFilePicker.displayDirectory
? MockFilePicker.displayDirectory
- : Services.dirsvc.get(MockFilePicker.displaySpecialDirectory, Ci.nsILocalFile);
+ : Services.dirsvc.get(MockFilePicker.displaySpecialDirectory, Ci.nsIFile);
if (dirs[i].path == dir.path) {
returned = i;
break;
}
}
if (test[1] == -1) {
ok(false, "We should never get an unknown directory back");
} else {
--- a/layout/generic/test/file_IconTestServer.sjs
+++ b/layout/generic/test/file_IconTestServer.sjs
@@ -63,17 +63,17 @@ function handleRequest(request, response
response.setHeader("Content-Type", "image/png", false);
// Get the output stream
ctx.ostream = response.bodyOutputStream;
// Ugly hack, but effective - copied from dom/media/test/contentDuration1.sjs
var pngFile = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
- get("CurWorkD", Components.interfaces.nsILocalFile);
+ get("CurWorkD", Components.interfaces.nsIFile);
var paths = "tests/layout/generic/test/file_Dolske.png";
var split = paths.split("/");
for(var i = 0; i < split.length; ++i) {
pngFile.append(split[i]);
}
// Get an input stream for the png data
ctx.istream = Cc["@mozilla.org/network/file-input-stream;1"].
--- a/layout/tools/layout-debug/ui/content/layoutdebug.js
+++ b/layout/tools/layout-debug/ui/content/layoutdebug.js
@@ -298,17 +298,17 @@ RTestIndexList.prototype = {
mLDB_Root : null,
mNC_Child : null,
mNC_Name : null
}
const nsIFileInputStream = Components.interfaces.nsIFileInputStream;
const nsILineInputStream = Components.interfaces.nsILineInputStream;
const nsIFile = Components.interfaces.nsIFile;
-const nsILocalFile = Components.interfaces.nsILocalFile;
+const nsIFile = Components.interfaces.nsIFile;
const nsIFileURL = Components.interfaces.nsIFileURL;
const nsIIOService = Components.interfaces.nsIIOService;
const nsILayoutRegressionTester = Components.interfaces.nsILayoutRegressionTester;
const NS_LOCAL_FILE_CONTRACTID = "@mozilla.org/file/local;1";
const IO_SERVICE_CONTRACTID = "@mozilla.org/network/io-service;1";
const NS_LOCALFILEINPUTSTREAM_CONTRACTID =
"@mozilla.org/network/file-input-stream;1";
@@ -320,17 +320,17 @@ function RunRTest(aFilename, aIsBaseline
// XXX Does alert work?
alert("Already running regression test.\n");
return;
}
dump("Running " + (aIsBaseline?"baseline":"verify") +
(aIsPrinting?" PrintMode":"") + " test for " + aFilename + ".\n");
var listFile = Components.classes[NS_LOCAL_FILE_CONTRACTID].
- createInstance(nsILocalFile);
+ createInstance(nsIFile);
listFile.persistentDescriptor = aFilename;
gRTestURLList = new RTestURLList(listFile, aIsBaseline, aIsPrinting);
gRTestURLList.startURL();
}
function RTestURLList(aLocalFile, aIsBaseline, aIsPrinting) {
this.init(aLocalFile, aIsBaseline, aIsPrinting);
}
@@ -385,33 +385,33 @@ RTestURLList.prototype = {
var data = this.mCurrentURL.dir.clone();
data.append( this.mIsBaseline ? "baseline" : "verify");
if (!data.exists())
data.create(nsIFile.DIRECTORY_TYPE, 0o777)
data.append(basename);
dump("Writing regression data to " +
- data.QueryInterface(nsILocalFile).persistentDescriptor + "\n");
+ data.QueryInterface(nsIFile).persistentDescriptor + "\n");
if (this.mIsPrinting) {
this.mRegressionTester.dumpFrameModel(gBrowser.contentWindow, data,
nsILayoutRegressionTester.DUMP_FLAGS_MASK_PRINT_MODE);
}
else {
this.mRegressionTester.dumpFrameModel(gBrowser.contentWindow, data, 0);
}
if (!this.mIsBaseline) {
var base_data = this.mCurrentURL.dir.clone();
base_data.append("baseline");
base_data.append(basename);
dump("Comparing to regression data from " +
- base_data.QueryInterface(nsILocalFile).persistentDescriptor + "\n");
+ base_data.QueryInterface(nsIFile).persistentDescriptor + "\n");
var filesDiffer =
this.mRegressionTester.compareFrameModels(base_data, data,
nsILayoutRegressionTester.COMPARE_FLAGS_BRIEF)
dump("Comparison for " + this.mCurrentURL.url + " " +
(filesDiffer ? "failed" : "passed") + ".\n");
}
this.mCurrentURL = null;
--- a/mobile/android/components/SessionStore.js
+++ b/mobile/android/components/SessionStore.js
@@ -94,17 +94,17 @@ SessionStore.prototype = {
// to bother reloading the newly selected tab if it is zombified.
// The Java UI will tell us which tab to watch out for.
_keepAsZombieTabId: INVALID_TAB_ID,
init: function ss_init() {
loggingEnabled = Services.prefs.getBoolPref("browser.sessionstore.debug_logging");
// Get file references
- this._sessionFile = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
+ this._sessionFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
this._sessionFileBackup = this._sessionFile.clone();
this._sessionFilePrevious = this._sessionFile.clone();
this._sessionFileTemp = this._sessionFile.clone();
this._sessionFile.append("sessionstore.js"); // The main session store save file.
this._sessionFileBackup.append("sessionstore.bak"); // A backup copy to guard against interrupted writes.
this._sessionFilePrevious.append("sessionstore.old"); // The previous session's file, used for what used to be the "Tabs from last time".
this._sessionFileTemp.append(this._sessionFile.leafName + ".tmp"); // Temporary file for writing changes to disk.
--- a/mobile/android/tests/browser/chrome/test_session_clear_history.html
+++ b/mobile/android/tests/browser/chrome/test_session_clear_history.html
@@ -74,17 +74,17 @@ https://bugzilla.mozilla.org/show_bug.cg
// Temporarily set the session store to shutdown mode to test the
// synchronous deletion code path.
// This also means that nothing gets written to disk until explicitly
// flushed, so we can test that all files have been deleted and don't
// have to worry about them already having been recreated before we get
// around checking on them.
ss.setLoadState(STATE_QUITTING);
- let sessionFile = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
+ let sessionFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
let sessionFileBackup = sessionFile.clone();
let sessionFilePrevious = sessionFile.clone();
let sessionFileTemp = sessionFile.clone();
sessionFile.append("sessionstore.js"); // The main session store save file.
sessionFileBackup.append("sessionstore.bak"); // A backup copy to guard against interrupted writes.
sessionFilePrevious.append("sessionstore.old"); // The previous session's file, used for what used to be the "Tabs from last time".
sessionFileTemp.append(sessionFile.leafName + ".tmp"); // Temporary file for writing changes to disk.
--- a/mobile/android/tests/browser/robocop/robocop_head.js
+++ b/mobile/android/tests/browser/robocop/robocop_head.js
@@ -578,17 +578,17 @@ function do_test_finished() {
_do_quit();
}
}
function do_get_file(path, allowNonexistent) {
try {
let lf = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
- .get("CurWorkD", Components.interfaces.nsILocalFile);
+ .get("CurWorkD", Components.interfaces.nsIFile);
let bits = path.split("/");
for (let i = 0; i < bits.length; i++) {
if (bits[i]) {
if (bits[i] == "..")
lf = lf.parent;
else
lf.append(bits[i]);
--- a/modules/libjar/test/unit/test_umlaute.js
+++ b/modules/libjar/test/unit/test_umlaute.js
@@ -22,17 +22,17 @@ function run_test() {
var entryName = entries.getNext();
do_check_eq(entryName, "test_\u00FC.txt");
do_check_true(zipreader.hasEntry(entryName));
var target = tmpDir.clone();
target.append(entryName);
- target.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, 0o640); // 0640
+ target.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o640); // 0640
zipreader.extract(entryName, target);
var entry = zipreader.getEntry(entryName);
do_check_true(entry != null);
zipreader.test(entryName);
--- a/modules/libjar/zipwriter/test/unit/test_zippermissions.js
+++ b/modules/libjar/zipwriter/test/unit/test_zippermissions.js
@@ -27,17 +27,17 @@ function build_tests() {
function run_test() {
build_tests();
var foStream = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
var tmp = tmpDir.clone();
tmp.append("temp-permissions");
- tmp.createUnique(Ci.nsILocalFile.DIRECTORY_TYPE, 0o755);
+ tmp.createUnique(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
var file = tmp.clone();
file.append("tempfile");
zipW.open(tmpFile, PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE);
for (let i = 0; i < TESTS.length; i++) {
// Open the file with the permissions to match how the zipreader extracts
// This obeys the umask
--- a/netwerk/test/httpserver/httpd.js
+++ b/netwerk/test/httpserver/httpd.js
@@ -2288,17 +2288,17 @@ function ServerHandler(server)
// FIELDS
/**
* The nsHttpServer instance associated with this handler.
*/
this._server = server;
/**
- * A FileMap object containing the set of path->nsILocalFile mappings for
+ * A FileMap object containing the set of path->nsIFile mappings for
* all directory mappings set in the server (e.g., "/" for /var/www/html/,
* "/foo/bar/" for /local/path/, and "/foo/bar/baz/" for /local/path2).
*
* Note carefully: the leading and trailing "/" in each path (not file) are
* removed before insertion to simplify the code which uses this. You have
* been warned!
*/
this._pathDirectoryMap = new FileMap();
@@ -2721,17 +2721,17 @@ ServerHandler.prototype =
},
/**
* Writes an HTTP response for the given file, including setting headers for
* file metadata.
*
* @param metadata : Request
* the Request for which a response is being generated
- * @param file : nsILocalFile
+ * @param file : nsIFile
* the file which is to be sent in the response
* @param response : Response
* the response to which the file should be written
* @param offset: uint
* the byte offset to skip to when writing
* @param count: uint
* the number of bytes to write
*/
@@ -3061,27 +3061,27 @@ ServerHandler.prototype =
}
catch (e)
{
return "application/octet-stream";
}
},
/**
- * Returns the nsILocalFile which corresponds to the path, as determined using
+ * Returns the nsIFile which corresponds to the path, as determined using
* all registered path->directory mappings and any paths which are explicitly
* overridden.
*
* @param path : string
* the server path for which a file should be retrieved, e.g. "/foo/bar"
* @throws HttpError
* when the correct action is the corresponding HTTP error (i.e., because no
* mapping was found for a directory in path, the referenced file doesn't
* exist, etc.)
- * @returns nsILocalFile
+ * @returns nsIFile
* the file to be sent as the response to a request for the path
*/
_getFileForPath: function(path)
{
// decode and add underscores as necessary
try
{
path = toInternalPath(path, true);
@@ -3448,39 +3448,39 @@ function FileMap()
/** Hash which will map paths to nsILocalFiles. */
this._map = {};
}
FileMap.prototype =
{
// PUBLIC API
/**
- * Maps key to a clone of the nsILocalFile value if value is non-null;
+ * Maps key to a clone of the nsIFile value if value is non-null;
* otherwise, removes any extant mapping for key.
*
* @param key : string
* string to which a clone of value is mapped
- * @param value : nsILocalFile
+ * @param value : nsIFile
* the file to map to key, or null to remove a mapping
*/
put: function(key, value)
{
if (value)
this._map[key] = value.clone();
else
delete this._map[key];
},
/**
- * Returns a clone of the nsILocalFile mapped to key, or null if no such
+ * Returns a clone of the nsIFile mapped to key, or null if no such
* mapping exists.
*
* @param key : string
* key to which the returned file maps
- * @returns nsILocalFile
+ * @returns nsIFile
* a clone of the mapped file, or null if no mapping exists
*/
get: function(key)
{
var val = this._map[key];
return val ? val.clone() : null;
}
};
@@ -5354,17 +5354,17 @@ this.NSGetFactory = XPCOMUtils.generateN
* /home/jwalden/index.html); if this is omitted, only the default URLs in
* this server implementation will be functional
*/
function server(port, basePath)
{
if (basePath)
{
var lp = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
lp.initWithPath(basePath);
}
// if you're running this, you probably want to see debugging info
DEBUG = true;
var srv = new nsHttpServer();
if (lp)
--- a/netwerk/test/httpserver/test/head_utils.js
+++ b/netwerk/test/httpserver/test/head_utils.js
@@ -46,17 +46,17 @@ function makeBIS(stream)
{
return new BinaryInputStream(stream);
}
/**
* Returns the contents of the file as a string.
*
- * @param file : nsILocalFile
+ * @param file : nsIFile
* the file whose contents are to be read
* @returns string
* the contents of the file
*/
function fileContents(file)
{
const PR_RDONLY = 0x01;
var fis = new FileInputStream(file, PR_RDONLY, 0o444,
--- a/netwerk/test/httpserver/test/test_basic_functionality.js
+++ b/netwerk/test/httpserver/test/test_basic_functionality.js
@@ -30,17 +30,17 @@ var srv;
function run_test()
{
srv = createServer();
// base path
// XXX should actually test this works with a file by comparing streams!
var dirServ = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties);
- var path = dirServ.get("CurProcD", Ci.nsILocalFile);
+ var path = dirServ.get("CurProcD", Ci.nsIFile);
srv.registerDirectory("/", path);
// register a few test paths
srv.registerPathHandler("/objHandler", objHandler);
srv.registerPathHandler("/functionHandler", functionHandler);
srv.registerPathHandler("/lotsOfHeaders", lotsOfHeadersHandler);
srv.start(-1);
--- a/netwerk/test/unit/test_bug767025.js
+++ b/netwerk/test/unit/test_bug767025.js
@@ -65,17 +65,17 @@ function app_handler(metadata, response)
var httpServer;
function init_profile() {
var ps = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
dump(ps.getBoolPref("browser.cache.offline.enable"));
ps.setBoolPref("browser.cache.offline.enable", true);
ps.setComplexValue("browser.cache.offline.parent_directory",
- Ci.nsILocalFile, do_get_profile());
+ Ci.nsIFile, do_get_profile());
do_print("profile " + do_get_profile());
}
function init_http_server() {
httpServer = new HttpServer();
httpServer.registerPathHandler("/app.appcache", manifest_handler);
httpServer.registerPathHandler("/app", app_handler);
for (i = 1; i <= 4; i++) {
--- a/netwerk/test/unit/test_fallback_no-cache-entry_canceled.js
+++ b/netwerk/test/unit/test_fallback_no-cache-entry_canceled.js
@@ -74,17 +74,17 @@ function run_test()
dump("Previous test failed to clear offline-app permission! Expect failures.\n");
}
pm.addFromPrincipal(principal, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
var ps = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
dump(ps.getBoolPref("browser.cache.offline.enable"));
ps.setBoolPref("browser.cache.offline.enable", true);
- ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsILocalFile, do_get_profile());
+ ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsIFile, do_get_profile());
cacheUpdateObserver = {observe: function() {
dump("got offline-cache-update-completed\n");
// offline cache update completed.
// In this test the randomURI doesn't exists
var chan = make_channel(randomURI);
chan.loadFlags = (Ci.nsIRequest.INHIBIT_CACHING |
Ci.nsIRequest.LOAD_FROM_CACHE |
--- a/netwerk/test/unit/test_fallback_no-cache-entry_passing.js
+++ b/netwerk/test/unit/test_fallback_no-cache-entry_passing.js
@@ -73,17 +73,17 @@ function run_test()
dump("Previous test failed to clear offline-app permission! Expect failures.\n");
}
pm.addFromPrincipal(principal, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
var ps = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
dump(ps.getBoolPref("browser.cache.offline.enable"));
ps.setBoolPref("browser.cache.offline.enable", true);
- ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsILocalFile, do_get_profile());
+ ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsIFile, do_get_profile());
cacheUpdateObserver = {observe: function() {
dump("got offline-cache-update-completed\n");
// offline cache update completed.
// In this test the randomURI doesn't exists
var chan = make_channel(randomURI);
chan.loadFlags = (Ci.nsIRequest.INHIBIT_CACHING |
Ci.nsIRequest.LOAD_FROM_CACHE |
--- a/netwerk/test/unit/test_fallback_redirect-to-different-origin_canceled.js
+++ b/netwerk/test/unit/test_fallback_redirect-to-different-origin_canceled.js
@@ -81,17 +81,17 @@ function run_test()
dump("Previous test failed to clear offline-app permission! Expect failures.\n");
}
pm.addFromPrincipal(principal, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
var ps = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
dump(ps.getBoolPref("browser.cache.offline.enable"));
ps.setBoolPref("browser.cache.offline.enable", true);
- ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsILocalFile, do_get_profile());
+ ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsIFile, do_get_profile());
cacheUpdateObserver = {observe: function() {
dump("got offline-cache-update-completed\n");
// offline cache update completed.
var chan = make_channel(randomURI);
chan.notificationCallbacks = new ChannelEventSink(ES_ABORT_REDIRECT);
var chanac = chan.QueryInterface(Ci.nsIApplicationCacheChannel);
chanac.chooseApplicationCache = true;
--- a/netwerk/test/unit/test_fallback_redirect-to-different-origin_passing.js
+++ b/netwerk/test/unit/test_fallback_redirect-to-different-origin_passing.js
@@ -81,17 +81,17 @@ function run_test()
dump("Previous test failed to clear offline-app permission! Expect failures.\n");
}
pm.addFromPrincipal(principal, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
var ps = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
dump(ps.getBoolPref("browser.cache.offline.enable"));
ps.setBoolPref("browser.cache.offline.enable", true);
- ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsILocalFile, do_get_profile());
+ ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsIFile, do_get_profile());
cacheUpdateObserver = {observe: function() {
dump("got offline-cache-update-completed\n");
// offline cache update completed.
var chan = make_channel(randomURI);
var chanac = chan.QueryInterface(Ci.nsIApplicationCacheChannel);
chanac.chooseApplicationCache = true;
chan.asyncOpen2(new ChannelListener(finish_test));
--- a/netwerk/test/unit/test_fallback_request-error_canceled.js
+++ b/netwerk/test/unit/test_fallback_request-error_canceled.js
@@ -80,17 +80,17 @@ function run_test()
dump("Previous test failed to clear offline-app permission! Expect failures.\n");
}
pm.addFromPrincipal(principal, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
var ps = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
dump(ps.getBoolPref("browser.cache.offline.enable"));
ps.setBoolPref("browser.cache.offline.enable", true);
- ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsILocalFile, do_get_profile());
+ ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsIFile, do_get_profile());
cacheUpdateObserver = {observe: function() {
dump("got offline-cache-update-completed\n");
// offline cache update completed.
// doing this to eval the lazy getter, otherwise the make_channel call would hang
randomURI;
httpServer.stop(function() {
--- a/netwerk/test/unit/test_fallback_request-error_passing.js
+++ b/netwerk/test/unit/test_fallback_request-error_passing.js
@@ -81,17 +81,17 @@ function run_test()
dump("Previous test failed to clear offline-app permission! Expect failures.\n");
}
pm.addFromPrincipal(principal, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
var ps = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
dump(ps.getBoolPref("browser.cache.offline.enable"));
ps.setBoolPref("browser.cache.offline.enable", true);
- ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsILocalFile, do_get_profile());
+ ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsIFile, do_get_profile());
cacheUpdateObserver = {observe: function() {
dump("got offline-cache-update-completed\n");
// offline cache update completed.
var _x = randomURI; // doing this so the lazy value gets computed
httpServer.stop(function() {
// Now shut the server down to have an error in onstartrequest
var chan = make_channel(randomURI);
--- a/netwerk/test/unit/test_fallback_response-error_canceled.js
+++ b/netwerk/test/unit/test_fallback_response-error_canceled.js
@@ -82,17 +82,17 @@ function run_test()
dump("Previous test failed to clear offline-app permission! Expect failures.\n");
}
pm.addFromPrincipal(principal, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
var ps = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
dump(ps.getBoolPref("browser.cache.offline.enable"));
ps.setBoolPref("browser.cache.offline.enable", true);
- ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsILocalFile, do_get_profile());
+ ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsIFile, do_get_profile());
cacheUpdateObserver = {observe: function() {
dump("got offline-cache-update-completed\n");
// offline cache update completed.
var chan = make_channel(randomURI);
chan.notificationCallbacks = new ChannelEventSink(ES_ABORT_REDIRECT);
var chanac = chan.QueryInterface(Ci.nsIApplicationCacheChannel);
chanac.chooseApplicationCache = true;
--- a/netwerk/test/unit/test_fallback_response-error_passing.js
+++ b/netwerk/test/unit/test_fallback_response-error_passing.js
@@ -81,17 +81,17 @@ function run_test()
dump("Previous test failed to clear offline-app permission! Expect failures.\n");
}
pm.addFromPrincipal(principal, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
var ps = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
dump(ps.getBoolPref("browser.cache.offline.enable"));
ps.setBoolPref("browser.cache.offline.enable", true);
- ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsILocalFile, do_get_profile());
+ ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsIFile, do_get_profile());
cacheUpdateObserver = {observe: function() {
dump("got offline-cache-update-completed\n");
// offline cache update completed.
var chan = make_channel(randomURI);
var chanac = chan.QueryInterface(Ci.nsIApplicationCacheChannel);
chanac.chooseApplicationCache = true;
chan.asyncOpen2(new ChannelListener(finish_test));
--- a/netwerk/test/unit/test_file_protocol.js
+++ b/netwerk/test/unit/test_file_protocol.js
@@ -13,17 +13,17 @@ const special_type = "application/x-our-
test_upload_file,
test_load_replace,
do_test_finished
].forEach(add_test);
function getFile(key) {
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
- return dirSvc.get(key, Components.interfaces.nsILocalFile);
+ return dirSvc.get(key, Components.interfaces.nsIFile);
}
function new_file_input_stream(file, buffered) {
var stream =
Cc["@mozilla.org/network/file-input-stream;1"].
createInstance(Ci.nsIFileInputStream);
stream.init(file, PR_RDONLY, 0, 0);
if (!buffered)
--- a/netwerk/test/unit/test_offlinecache_custom-directory.js
+++ b/netwerk/test/unit/test_offlinecache_custom-directory.js
@@ -110,17 +110,17 @@ function run_test()
dump("Previous test failed to clear offline-app permission! Expect failures.\n");
}
pm.addFromPrincipal(principal, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
var ps = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
ps.setBoolPref("browser.cache.offline.enable", true);
// Set this pref to mimic the default browser behavior.
- ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsILocalFile, profileDir);
+ ps.setComplexValue("browser.cache.offline.parent_directory", Ci.nsIFile, profileDir);
var us = Cc["@mozilla.org/offlinecacheupdate-service;1"].
getService(Ci.nsIOfflineCacheUpdateService);
var update = us.scheduleAppUpdate(
make_uri("http://localhost:4444/manifest"),
make_uri("http://localhost:4444/masterEntry"),
systemPrincipal,
customDir);
--- a/netwerk/test/unit/test_pinned_app_cache.js
+++ b/netwerk/test/unit/test_pinned_app_cache.js
@@ -97,17 +97,17 @@ function datafile_handler(metadata, resp
var httpServer;
function init_profile() {
var ps = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
dump(ps.getBoolPref("browser.cache.offline.enable"));
ps.setBoolPref("browser.cache.offline.enable", true);
ps.setComplexValue("browser.cache.offline.parent_directory",
- Ci.nsILocalFile, do_get_profile());
+ Ci.nsIFile, do_get_profile());
}
function init_http_server() {
httpServer = new HttpServer();
httpServer.registerPathHandler("/app1", app_handler);
httpServer.registerPathHandler("/app2", app_handler);
httpServer.registerPathHandler("/app1.appcache", manifest1_handler);
httpServer.registerPathHandler("/app2.appcache", manifest2_handler);
--- a/netwerk/test/unit/test_socks.js
+++ b/netwerk/test/unit/test_socks.js
@@ -26,17 +26,17 @@ function getAvailableBytes(input)
}
return len;
}
function runScriptSubprocess(script, args)
{
var ds = new DirectoryService();
- var bin = ds.get("XREExeF", Ci.nsILocalFile);
+ var bin = ds.get("XREExeF", Ci.nsIFile);
if (!bin.exists()) {
do_throw("Can't find xpcshell binary");
}
var script = do_get_file(script);
var proc = new Process(bin);
var args = [script.path].concat(args);
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -1094,17 +1094,17 @@ class GTestCommands(MachCommandBase):
# Use GTest environment variable to control test execution
# For details see:
# https://code.google.com/p/googletest/wiki/AdvancedGuide#Running_Test_Programs:_Advanced_Options
gtest_env = {b'GTEST_FILTER': gtest_filter}
# Note: we must normalize the path here so that gtest on Windows sees
# a MOZ_GMP_PATH which has only Windows dir seperators, because
- # nsILocalFile cannot open the paths with non-Windows dir seperators.
+ # nsIFile cannot open the paths with non-Windows dir seperators.
xre_path = os.path.join(os.path.normpath(self.topobjdir), "dist", "bin")
gtest_env["MOZ_XRE_DIR"] = xre_path
gtest_env["MOZ_GMP_PATH"] = os.pathsep.join(
os.path.join(xre_path, p, "1.0")
for p in ('gmp-fake', 'gmp-fakeopenh264')
)
gtest_env[b"MOZ_RUN_GTEST"] = b"True"
--- a/security/manager/pki/resources/content/pippki.js
+++ b/security/manager/pki/resources/content/pippki.js
@@ -142,17 +142,17 @@ function exportToFile(parent, cert) {
default:
content = getPEMString(cert);
break;
}
var msg;
var written = 0;
try {
var file = Components.classes["@mozilla.org/file/local;1"].
- createInstance(Components.interfaces.nsILocalFile);
+ createInstance(Components.interfaces.nsIFile);
file.initWithPath(fp.file.path);
var fos = Components.classes["@mozilla.org/network/file-output-stream;1"].
createInstance(Components.interfaces.nsIFileOutputStream);
// flags: PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE
fos.init(file, 0x02 | 0x08 | 0x20, 0o0644, 0);
written = fos.write(content, content.length);
fos.close();
} catch (e) {
--- a/security/manager/ssl/tests/unit/head_psm.js
+++ b/security/manager/ssl/tests/unit/head_psm.js
@@ -212,17 +212,17 @@ function _getLibraryFunctionWithNoArgume
// XXX really want to be able to pass specific dlopen flags here.
let nsslib;
try {
nsslib = ctypes.open(path);
} catch (e) {
// In case opening the library without a full path fails,
// try again with a full path.
- let file = Services.dirsvc.get("GreBinD", Ci.nsILocalFile);
+ let file = Services.dirsvc.get("GreBinD", Ci.nsIFile);
file.append(path);
nsslib = ctypes.open(file.path);
}
let SECStatus = ctypes.int;
let func = nsslib.declare(functionName, ctypes.default_abi,
returnType || SECStatus);
return func;
@@ -464,22 +464,22 @@ function add_connection_test(aHost, aExp
});
});
}
function _getBinaryUtil(binaryUtilName) {
let directoryService = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties);
- let utilBin = directoryService.get("CurProcD", Ci.nsILocalFile);
+ let utilBin = directoryService.get("CurProcD", Ci.nsIFile);
utilBin.append(binaryUtilName + mozinfo.bin_suffix);
// If we're testing locally, the above works. If not, the server executable
// is in another location.
if (!utilBin.exists()) {
- utilBin = directoryService.get("CurWorkD", Ci.nsILocalFile);
+ utilBin = directoryService.get("CurWorkD", Ci.nsIFile);
while (utilBin.path.indexOf("xpcshell") != -1) {
utilBin = utilBin.parent;
}
utilBin.append("bin");
utilBin.append(binaryUtilName + mozinfo.bin_suffix);
}
// But maybe we're on Android or B2G, where binaries are in /data/local/xpcb.
if (!utilBin.exists()) {
@@ -522,17 +522,17 @@ function _setupTLSServerTest(serverBinNa
httpServer.stop(run_next_test);
});
});
httpServer.start(CALLBACK_PORT);
let serverBin = _getBinaryUtil(serverBinName);
let process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
process.init(serverBin);
- let certDir = directoryService.get("CurWorkD", Ci.nsILocalFile);
+ let certDir = directoryService.get("CurWorkD", Ci.nsIFile);
certDir.append(`${certsPath}`);
Assert.ok(certDir.exists(), `certificate folder (${certsPath}) should exist`);
// Using "sql:" causes the SQL DB to be used so we can run tests on Android.
process.run(false, [ "sql:" + certDir.path ], 1);
do_register_cleanup(function() {
process.kill();
});
@@ -837,17 +837,17 @@ function asyncTestCertificateUsages(cert
* @param {Boolean} expectModuleUnloadToFail
* Should be set to true for tests that manually unload the
* test module, so the attempt to auto unload the test module
* doesn't cause a test failure. Should be set to false
* otherwise, so failure to automatically unload the test
* module gets reported.
*/
function loadPKCS11TestModule(expectModuleUnloadToFail) {
- let libraryFile = Services.dirsvc.get("CurWorkD", Ci.nsILocalFile);
+ let libraryFile = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
libraryFile.append("pkcs11testmodule");
libraryFile.append(ctypes.libraryName("pkcs11testmodule"));
ok(libraryFile.exists(), "The pkcs11testmodule file should exist");
let pkcs11 = Cc["@mozilla.org/security/pkcs11;1"].getService(Ci.nsIPKCS11);
do_register_cleanup(() => {
try {
pkcs11.deleteModule("PKCS11 Test Module");
--- a/security/manager/ssl/tests/unit/test_pkcs11_safe_mode.js
+++ b/security/manager/ssl/tests/unit/test_pkcs11_safe_mode.js
@@ -35,15 +35,15 @@ function run_test() {
const XULRUNTIME_CONTRACTID = "@mozilla.org/xre/runtime;1";
const XULRUNTIME_CID = Components.ID("{f0f0b230-5525-4127-98dc-7bca39059e70}");
registrar.registerFactory(XULRUNTIME_CID, "XULRuntime", XULRUNTIME_CONTRACTID,
xulRuntimeFactory);
// When starting in safe mode, the test module should fail to load.
let pkcs11 = Cc["@mozilla.org/security/pkcs11;1"].getService(Ci.nsIPKCS11);
let libraryName = ctypes.libraryName("pkcs11testmodule");
- let libraryFile = Services.dirsvc.get("CurWorkD", Ci.nsILocalFile);
+ let libraryFile = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
libraryFile.append("pkcs11testmodule");
libraryFile.append(libraryName);
ok(libraryFile.exists(), "The pkcs11testmodule file should exist");
throws(() => pkcs11.addModule("PKCS11 Test Module", libraryFile.path, 0, 0),
/NS_ERROR_FAILURE/, "addModule should throw when in safe mode");
}
--- a/security/manager/tools/genHPKPStaticPins.js
+++ b/security/manager/tools/genHPKPStaticPins.js
@@ -64,26 +64,26 @@ const PINSETDEF = "/* Pinsets are each a
"};\n\n";
// Command-line arguments
var gStaticPins = parseJson(arguments[0]);
// arguments[1] is ignored for now. See bug 1205406.
// Open the output file.
-var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(arguments[2]);
var gFileOutputStream = FileUtils.openSafeFileOutputStream(file);
function writeString(string) {
gFileOutputStream.write(string, string.length);
}
function readFileToString(filename) {
- let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(filename);
let stream = Cc["@mozilla.org/network/file-input-stream;1"]
.createInstance(Ci.nsIFileInputStream);
stream.init(file, -1, 0, 0);
let buf = NetUtil.readInputStreamToString(stream, stream.available());
return buf;
}
--- a/security/manager/tools/genRootCAHashes.js
+++ b/security/manager/tools/genRootCAHashes.js
@@ -214,17 +214,17 @@ function insertTrustAnchorsFromDatabase(
if (arguments.length != 1) {
throw new Error("Usage: genRootCAHashes.js " +
"<absolute path to current RootHashes.inc>");
}
var trustAnchorsFile = FileUtils.getFile("CurWorkD", [FILENAME_TRUST_ANCHORS]);
// let rootHashesFile = FileUtils.getFile("CurWorkD", arguments[0]);
-var rootHashesFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+var rootHashesFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
rootHashesFile.initWithPath(arguments[0]);
// Open the known hashes file; this is to ensure stable bin numbers.
var gTrustAnchors = loadTrustAnchors(trustAnchorsFile);
// Collect all certificate entries
insertTrustAnchorsFromDatabase();
--- a/security/manager/tools/getHSTSPreloadList.js
+++ b/security/manager/tools/getHSTSPreloadList.js
@@ -387,17 +387,17 @@ function waitForAResponse(outputList) {
// From <https://developer.mozilla.org/en/XPConnect/xpcshell/HOWTO>
var threadManager = Cc["@mozilla.org/thread-manager;1"]
.getService(Ci.nsIThreadManager);
threadManager.spinEventLoopUntil(() => outputList.length != 0);
}
function readCurrentList(filename) {
var currentHosts = {};
- var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(filename);
var fis = Cc["@mozilla.org/network/file-input-stream;1"]
.createInstance(Ci.nsILineInputStream);
fis.init(file, -1, -1, Ci.nsIFileInputStream.CLOSE_ON_EOF);
var line = {};
// While we generate entries matching the version 2 format (see bug 1255425
// for details), we still need to be able to read entries in the version 1
// format for bootstrapping a version 2 preload list from a version 1
--- a/security/sandbox/test/browser_content_sandbox_utils.js
+++ b/security/sandbox/test/browser_content_sandbox_utils.js
@@ -23,17 +23,17 @@ function isNightly() {
function uuid() {
return uuidGenerator.generateUUID().toString();
}
// Returns a file object for a new file in the home dir ($HOME/<UUID>).
function fileInHomeDir() {
// get home directory, make sure it exists
- let homeDir = Services.dirsvc.get("Home", Ci.nsILocalFile);
+ let homeDir = Services.dirsvc.get("Home", Ci.nsIFile);
Assert.ok(homeDir.exists(), "Home dir exists");
Assert.ok(homeDir.isDirectory(), "Home dir is a directory");
// build a file object for a new file named $HOME/<UUID>
let homeFile = homeDir.clone();
homeFile.appendRelativePath(uuid());
Assert.ok(!homeFile.exists(), homeFile.path + " does not exist");
return (homeFile);
@@ -43,49 +43,49 @@ function fileInHomeDir() {
function fileInTempDir() {
let contentTempKey = "ContentTmpD";
if (Services.appinfo.OS == "Linux") {
// Linux builds don't use the content-specific temp key
contentTempKey = "TmpD";
}
// get the content temp dir, make sure it exists
- let ctmp = Services.dirsvc.get(contentTempKey, Ci.nsILocalFile);
+ let ctmp = Services.dirsvc.get(contentTempKey, Ci.nsIFile);
Assert.ok(ctmp.exists(), "Content temp dir exists");
Assert.ok(ctmp.isDirectory(), "Content temp dir is a directory");
// build a file object for a new file in content temp
let tempFile = ctmp.clone();
tempFile.appendRelativePath(uuid());
Assert.ok(!tempFile.exists(), tempFile.path + " does not exist");
return (tempFile);
}
function GetProfileDir() {
// get profile directory
- let profileDir = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
+ let profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
return (profileDir);
}
function GetHomeDir() {
// get home directory
- let homeDir = Services.dirsvc.get("Home", Ci.nsILocalFile);
+ let homeDir = Services.dirsvc.get("Home", Ci.nsIFile);
return (homeDir);
}
// Returns a file object for the file or directory named |name| in the
// profile directory.
function GetProfileEntry(name) {
let entry = GetProfileDir();
entry.append(name);
return (entry);
}
function GetDir(path) {
- let dir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ let dir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
dir.initWithPath(path);
Assert.ok(dir.isDirectory(), `${path} is a directory`);
return (dir);
}
function GetDirFromEnvVariable(varName) {
return GetDir(environment.get(varName));
}
--- a/services/common/tests/unit/test_logmanager.js
+++ b/services/common/tests/unit/test_logmanager.js
@@ -109,17 +109,17 @@ function checkLogFile(prefix) {
let logsdir = FileUtils.getDir("ProfD", ["weave", "logs"], true);
let entries = logsdir.directoryEntries;
if (!prefix) {
// expecting no files.
ok(!entries.hasMoreElements());
} else {
// expecting 1 file.
ok(entries.hasMoreElements());
- let logfile = entries.getNext().QueryInterface(Ci.nsILocalFile);
+ let logfile = entries.getNext().QueryInterface(Ci.nsIFile);
equal(logfile.leafName.slice(-4), ".txt");
ok(logfile.leafName.startsWith(prefix + "-test-"), logfile.leafName);
// and remove it ready for the next check.
logfile.remove(false);
}
}
// Test that we correctly write error logs by default
--- a/services/sync/tests/unit/test_bookmark_engine.js
+++ b/services/sync/tests/unit/test_bookmark_engine.js
@@ -221,17 +221,17 @@ add_task(async function test_restoreProm
folder1_id, fxuri, PlacesUtils.bookmarks.DEFAULT_INDEX, "Get Firefox!");
let bmk1_guid = await store.GUIDForId(bmk1_id);
_("Get Firefox!: " + bmk1_id + ", " + bmk1_guid);
let dirSvc = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties);
- let backupFile = dirSvc.get("TmpD", Ci.nsILocalFile);
+ let backupFile = dirSvc.get("TmpD", Ci.nsIFile);
_("Make a backup.");
backupFile.append("t_b_e_" + Date.now() + ".json");
_("Backing up to file " + backupFile.path);
await BookmarkJSONUtils.exportToFile(backupFile.path);
_("Create a different record and sync.");
--- a/services/sync/tests/unit/test_errorhandler_2.js
+++ b/services/sync/tests/unit/test_errorhandler_2.js
@@ -24,26 +24,26 @@ do_register_cleanup(function() {
var fakeServerUrl = "http://localhost:" + fakeServer.port;
const logsdir = FileUtils.getDir("ProfD", ["weave", "logs"], true);
function removeLogFiles() {
let entries = logsdir.directoryEntries;
while (entries.hasMoreElements()) {
- let logfile = entries.getNext().QueryInterface(Ci.nsILocalFile);
+ let logfile = entries.getNext().QueryInterface(Ci.nsIFile);
logfile.remove(false);
}
}
function getLogFiles() {
let result = [];
let entries = logsdir.directoryEntries;
while (entries.hasMoreElements()) {
- result.push(entries.getNext().QueryInterface(Ci.nsILocalFile));
+ result.push(entries.getNext().QueryInterface(Ci.nsIFile));
}
return result;
}
const PROLONGED_ERROR_DURATION =
(Svc.Prefs.get("errorhandler.networkFailureReportTimeout") * 2) * 1000;
const NON_PROLONGED_ERROR_DURATION =
--- a/services/sync/tests/unit/test_errorhandler_filelog.js
+++ b/services/sync/tests/unit/test_errorhandler_filelog.js
@@ -103,17 +103,17 @@ add_test(function test_logOnSuccess_true
log.info(MESSAGE);
Svc.Obs.add("weave:service:reset-file-log", function onResetFileLog() {
Svc.Obs.remove("weave:service:reset-file-log", onResetFileLog);
// Exactly one log file was written.
let entries = logsdir.directoryEntries;
do_check_true(entries.hasMoreElements());
- let logfile = entries.getNext().QueryInterface(Ci.nsILocalFile);
+ let logfile = entries.getNext().QueryInterface(Ci.nsIFile);
do_check_eq(logfile.leafName.slice(-4), ".txt");
do_check_true(logfile.leafName.startsWith("success-sync-"), logfile.leafName);
do_check_false(entries.hasMoreElements());
// Ensure the log message was actually written to file.
readFile(logfile, function(error, data) {
do_check_true(Components.isSuccessCode(error));
do_check_neq(data.indexOf(MESSAGE), -1);
@@ -170,17 +170,17 @@ add_test(function test_sync_error_logOnE
});
Svc.Obs.add("weave:service:reset-file-log", function onResetFileLog() {
Svc.Obs.remove("weave:service:reset-file-log", onResetFileLog);
// Exactly one log file was written.
let entries = logsdir.directoryEntries;
do_check_true(entries.hasMoreElements());
- let logfile = entries.getNext().QueryInterface(Ci.nsILocalFile);
+ let logfile = entries.getNext().QueryInterface(Ci.nsIFile);
do_check_eq(logfile.leafName.slice(-4), ".txt");
do_check_true(logfile.leafName.startsWith("error-sync-"), logfile.leafName);
do_check_false(entries.hasMoreElements());
// Ensure the log message was actually written to file.
readFile(logfile, function(error, data) {
do_check_true(Components.isSuccessCode(error));
do_check_neq(data.indexOf(MESSAGE), -1);
@@ -237,17 +237,17 @@ add_test(function test_login_error_logOn
});
Svc.Obs.add("weave:service:reset-file-log", function onResetFileLog() {
Svc.Obs.remove("weave:service:reset-file-log", onResetFileLog);
// Exactly one log file was written.
let entries = logsdir.directoryEntries;
do_check_true(entries.hasMoreElements());
- let logfile = entries.getNext().QueryInterface(Ci.nsILocalFile);
+ let logfile = entries.getNext().QueryInterface(Ci.nsIFile);
do_check_eq(logfile.leafName.slice(-4), ".txt");
do_check_true(logfile.leafName.startsWith("error-sync-"), logfile.leafName);
do_check_false(entries.hasMoreElements());
// Ensure the log message was actually written to file.
readFile(logfile, function(error, data) {
do_check_true(Components.isSuccessCode(error));
do_check_neq(data.indexOf(MESSAGE), -1);
@@ -309,17 +309,17 @@ add_test(function test_newFailed_errorLo
});
Svc.Obs.add("weave:service:reset-file-log", function onResetFileLog() {
Svc.Obs.remove("weave:service:reset-file-log", onResetFileLog);
// Exactly one log file was written.
let entries = logsdir.directoryEntries;
do_check_true(entries.hasMoreElements());
- let logfile = entries.getNext().QueryInterface(Ci.nsILocalFile);
+ let logfile = entries.getNext().QueryInterface(Ci.nsIFile);
do_check_eq(logfile.leafName.slice(-4), ".txt");
do_check_true(logfile.leafName.startsWith("error-sync-"), logfile.leafName);
do_check_false(entries.hasMoreElements());
// Ensure the log message was actually written to file.
readFile(logfile, function(error, data) {
do_check_true(Components.isSuccessCode(error));
do_check_neq(data.indexOf(MESSAGE), -1);
@@ -359,17 +359,17 @@ add_test(function test_errorLog_dumpAddo
run_next_test();
});
Svc.Obs.add("weave:service:reset-file-log", function onResetFileLog() {
Svc.Obs.remove("weave:service:reset-file-log", onResetFileLog);
let entries = logsdir.directoryEntries;
do_check_true(entries.hasMoreElements());
- let logfile = entries.getNext().QueryInterface(Ci.nsILocalFile);
+ let logfile = entries.getNext().QueryInterface(Ci.nsIFile);
do_check_eq(logfile.leafName.slice(-4), ".txt");
do_check_true(logfile.leafName.startsWith("error-sync-"), logfile.leafName);
do_check_false(entries.hasMoreElements());
// Ensure we logged some addon list (which is probably empty)
readFile(logfile, function(error, data) {
do_check_true(Components.isSuccessCode(error));
do_check_neq(data.indexOf("Addons installed"), -1);
@@ -415,17 +415,17 @@ add_test(function test_logErrorCleanup_a
}
Svc.Obs.add("services-tests:common:log-manager:cleanup-logs", function onCleanupLogs() {
Svc.Obs.remove("services-tests:common:log-manager:cleanup-logs", onCleanupLogs);
// Only the newest created log file remains.
let entries = logsdir.directoryEntries;
do_check_true(entries.hasMoreElements());
- let logfile = entries.getNext().QueryInterface(Ci.nsILocalFile);
+ let logfile = entries.getNext().QueryInterface(Ci.nsIFile);
do_check_true(oldLogs.every(function(e) {
return e != logfile.leafName;
}));
do_check_false(entries.hasMoreElements());
// Clean up.
try {
logfile.remove(false);
--- a/services/sync/tps/extensions/mozmill/resource/modules/frame.js
+++ b/services/sync/tps/extensions/mozmill/resource/modules/frame.js
@@ -453,17 +453,17 @@ var appQuitObserver = new AppQuitObserve
* The collector handles HTTPd.js and initilizing the module
*/
function Collector() {
this.test_modules_by_filename = {};
this.testing = [];
}
Collector.prototype.addHttpResource = function (aDirectory, aPath) {
- var fp = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ var fp = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
fp.initWithPath(os.abspath(aDirectory, this.current_file));
return httpd.addHttpResource(fp, aPath);
}
Collector.prototype.initTestModule = function (filename, testname) {
var test_module = this.loadFile(filename, this);
var has_restarted = !(testname == null);
@@ -509,17 +509,17 @@ Collector.prototype.loadFile = function
defaultPrincipal: "system",
globals : { Cc: Cc,
Ci: Ci,
Cu: Cu,
Cr: Components.results}
});
// load a test module from a file and add some candy
- var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(path);
var uri = Services.io.newFileURI(file).spec;
this.loadTestResources();
var systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
var module = new Components.utils.Sandbox(systemPrincipal);
module.assert = assert;
--- a/services/sync/tps/extensions/mozmill/resource/stdlib/httpd.js
+++ b/services/sync/tps/extensions/mozmill/resource/stdlib/httpd.js
@@ -2278,17 +2278,17 @@ function ServerHandler(server)
// FIELDS
/**
* The nsHttpServer instance associated with this handler.
*/
this._server = server;
/**
- * A FileMap object containing the set of path->nsILocalFile mappings for
+ * A FileMap object containing the set of path->nsIFile mappings for
* all directory mappings set in the server (e.g., "/" for /var/www/html/,
* "/foo/bar/" for /local/path/, and "/foo/bar/baz/" for /local/path2).
*
* Note carefully: the leading and trailing "/" in each path (not file) are
* removed before insertion to simplify the code which uses this. You have
* been warned!
*/
this._pathDirectoryMap = new FileMap();
@@ -2711,17 +2711,17 @@ ServerHandler.prototype =
},
/**
* Writes an HTTP response for the given file, including setting headers for
* file metadata.
*
* @param metadata : Request
* the Request for which a response is being generated
- * @param file : nsILocalFile
+ * @param file : nsIFile
* the file which is to be sent in the response
* @param response : Response
* the response to which the file should be written
* @param offset: uint
* the byte offset to skip to when writing
* @param count: uint
* the number of bytes to write
*/
@@ -3049,27 +3049,27 @@ ServerHandler.prototype =
}
catch (e)
{
return "application/octet-stream";
}
},
/**
- * Returns the nsILocalFile which corresponds to the path, as determined using
+ * Returns the nsIFile which corresponds to the path, as determined using
* all registered path->directory mappings and any paths which are explicitly
* overridden.
*
* @param path : string
* the server path for which a file should be retrieved, e.g. "/foo/bar"
* @throws HttpError
* when the correct action is the corresponding HTTP error (i.e., because no
* mapping was found for a directory in path, the referenced file doesn't
* exist, etc.)
- * @returns nsILocalFile
+ * @returns nsIFile
* the file to be sent as the response to a request for the path
*/
_getFileForPath: function(path)
{
// decode and add underscores as necessary
try
{
path = toInternalPath(path, true);
@@ -3436,39 +3436,39 @@ function FileMap()
/** Hash which will map paths to nsILocalFiles. */
this._map = {};
}
FileMap.prototype =
{
// PUBLIC API
/**
- * Maps key to a clone of the nsILocalFile value if value is non-null;
+ * Maps key to a clone of the nsIFile value if value is non-null;
* otherwise, removes any extant mapping for key.
*
* @param key : string
* string to which a clone of value is mapped
- * @param value : nsILocalFile
+ * @param value : nsIFile
* the file to map to key, or null to remove a mapping
*/
put: function(key, value)
{
if (value)
this._map[key] = value.clone();
else
delete this._map[key];
},
/**
- * Returns a clone of the nsILocalFile mapped to key, or null if no such
+ * Returns a clone of the nsIFile mapped to key, or null if no such
* mapping exists.
*
* @param key : string
* key to which the returned file maps
- * @returns nsILocalFile
+ * @returns nsIFile
* a clone of the mapped file, or null if no mapping exists
*/
get: function(key)
{
var val = this._map[key];
return val ? val.clone() : null;
}
};
@@ -5322,17 +5322,17 @@ this.NSGetFactory = XPCOMUtils.generateN
* /home/jwalden/index.html); if this is omitted, only the default URLs in
* this server implementation will be functional
*/
function server(port, basePath)
{
if (basePath)
{
var lp = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
lp.initWithPath(basePath);
}
// if you're running this, you probably want to see debugging info
DEBUG = true;
var srv = new nsHttpServer();
if (lp)
--- a/services/sync/tps/extensions/mozmill/resource/stdlib/os.js
+++ b/services/sync/tps/extensions/mozmill/resource/stdlib/os.js
@@ -20,17 +20,17 @@ function listDirectory(file) {
entry.QueryInterface(Ci.nsIFile);
array.push(entry);
}
return array;
}
function getFileForPath(path) {
- var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(path);
return file;
}
function abspath(rel, file) {
var relSplit = rel.split('/');
if (relSplit[0] == '..' && !file.isDirectory()) {
--- a/services/sync/tps/extensions/mozmill/resource/stdlib/utils.js
+++ b/services/sync/tps/extensions/mozmill/resource/stdlib/utils.js
@@ -367,17 +367,17 @@ function takeScreenshot(node, highlights
* @returns {Object} The hash containing the path of saved file, and the failure bit
*/
function saveDataURL(aDataURL, aFilename) {
var frame = {}; Cu.import('resource://mozmill/modules/frame.js', frame);
const FILE_PERMISSIONS = parseInt("0644", 8);
var file;
file = Cc['@mozilla.org/file/local;1']
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
file.initWithPath(frame.persisted['screenshots']['path']);
file.append(aFilename + ".jpg");
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, FILE_PERMISSIONS);
// Create an output stream to write to file
let foStream = Cc["@mozilla.org/network/file-output-stream;1"]
.createInstance(Ci.nsIFileOutputStream);
foStream.init(file, 0x02 | 0x08 | 0x10, FILE_PERMISSIONS, foStream.DEFER_OPEN);
--- a/services/sync/tps/extensions/tps/resource/logger.jsm
+++ b/services/sync/tps/extensions/tps/resource/logger.jsm
@@ -26,17 +26,17 @@ var Logger = {
.getService(Ci.nsIPrefBranch);
if (path) {
prefs.setCharPref("tps.logfile", path);
} else {
path = prefs.getCharPref("tps.logfile");
}
this._file = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
this._file.initWithPath(path);
var exists = this._file.exists();
// Make a file output stream and converter to handle it.
this._foStream = Cc["@mozilla.org/network/file-output-stream;1"]
.createInstance(Ci.nsIFileOutputStream);
// If the file already exists, append it, otherwise create it.
var fileflags = exists ? 0x02 | 0x08 | 0x10 : 0x02 | 0x08 | 0x20;
--- a/services/sync/tps/extensions/tps/resource/tps.jsm
+++ b/services/sync/tps/extensions/tps/resource/tps.jsm
@@ -1030,17 +1030,17 @@ var TPS = {
+ typeof(names));
}
this._enabledEngines = names;
},
RunMozmillTest: function TPS__RunMozmillTest(testfile) {
var mozmillfile = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
if (hh.oscpu.toLowerCase().indexOf("windows") > -1) {
let re = /\/(\w)\/(.*)/;
this.config.testdir = this.config.testdir.replace(re, "$1://$2").replace(/\//g, "\\");
}
mozmillfile.initWithPath(this.config.testdir);
mozmillfile.appendRelativePath(testfile);
Logger.logInfo("Running mozmill test " + mozmillfile.path);
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -861,17 +861,17 @@ class Marionette(object):
"""Get the value of the specified preference.
:param pref: Name of the preference.
:param default_branch: Optional, if `True` the preference value will be read
from the default branch. Otherwise the user-defined
value if set is returned. Defaults to `False`.
:param value_type: Optional, XPCOM interface of the pref's complex value.
Defaults to `nsISupportsString`. Other possible values are:
- `nsILocalFile`, and `nsIPrefLocalizedString`.
+ `nsIFile`, and `nsIPrefLocalizedString`.
Usage example::
marionette.get_pref("browser.tabs.warnOnClose")
"""
with self.using_context(self.CONTEXT_CHROME):
pref_value = self.execute_script("""
--- a/testing/mochitest/chrome-harness.js
+++ b/testing/mochitest/chrome-harness.js
@@ -37,29 +37,29 @@ function getResolvedURI(url) {
resolvedURI = resolvedURI.QueryInterface(Components.interfaces.nsIJARURI);
} catch (ex) {} //not a jar file
return resolvedURI;
}
/**
* getChromeDir is intended to be called after getResolvedURI and convert
- * the input URI into a nsILocalFile (actually the directory containing the
+ * the input URI into a nsIFile (actually the directory containing the
* file). This can be used for copying or referencing the file or extra files
* required by the test. Usually we need to load a secondary html file or library
* and this will give us file system access to that.
*
* resolvedURI: nsIURI (from getResolvedURI) that points to a file:/// url
*/
function getChromeDir(resolvedURI) {
var fileHandler = Components.classes["@mozilla.org/network/protocol;1?name=file"].
getService(Components.interfaces.nsIFileProtocolHandler);
var chromeDir = fileHandler.getFileFromURLSpec(resolvedURI.spec);
- return chromeDir.parent.QueryInterface(Components.interfaces.nsILocalFile);
+ return chromeDir.parent.QueryInterface(Components.interfaces.nsIFile);
}
//used by tests to determine their directory based off window.location.path
function getRootDirectory(path, chromeURI) {
if (chromeURI === undefined)
{
chromeURI = getChromeURI(path);
}
@@ -104,17 +104,17 @@ function getJar(uri) {
*
* output;
* all files and subdirectories inside jarentry will be extracted to TmpD/mochikit.tmp
* we will return the location of /TmpD/mochikit.tmp* so you can reference the files locally
*/
function extractJarToTmp(jar) {
var tmpdir = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
- .get("ProfD", Components.interfaces.nsILocalFile);
+ .get("ProfD", Components.interfaces.nsIFile);
tmpdir.append("mochikit.tmp");
// parseInt is used because octal escape sequences cause deprecation warnings
// in strict mode (which is turned on in debug builds)
tmpdir.createUnique(Components.interfaces.nsIFile.DIRECTORY_TYPE, parseInt("0777", 8));
var zReader = Components.classes["@mozilla.org/libjar/zip-reader;1"].
createInstance(Components.interfaces.nsIZipReader);
@@ -190,29 +190,29 @@ function getTestFilePath(path) {
file.append(p);
}
});
return file.path;
}
/*
* Simple utility function to take the directory structure in jarentryname and
- * translate that to a path of a nsILocalFile.
+ * translate that to a path of a nsIFile.
*/
function buildRelativePath(jarentryname, destdir, basepath)
{
var baseParts = basepath.split('/');
if (baseParts[baseParts.length-1] == '') {
baseParts.pop();
}
var parts = jarentryname.split('/');
var targetFile = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
+ .createInstance(Components.interfaces.nsIFile);
targetFile.initWithFile(destdir);
for (var i = baseParts.length; i < parts.length; i++) {
targetFile.append(parts[i]);
}
return targetFile;
}
--- a/testing/mochitest/server.js
+++ b/testing/mochitest/server.js
@@ -158,17 +158,17 @@ function runServer()
}
server._start(SERVER_PORT, gServerAddress);
// touch a file in the profile directory to indicate we're alive
var foStream = Cc["@mozilla.org/network/file-output-stream;1"]
.createInstance(Ci.nsIFileOutputStream);
var serverAlive = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
if (typeof(_PROFILE_PATH) == "undefined") {
serverAlive.initWithFile(serverBasePath);
serverAlive.append("mochitesttestingprofile");
} else {
serverAlive.initWithPath(_PROFILE_PATH);
}
@@ -223,17 +223,17 @@ function createMochitestServer(serverBas
server.registerContentType("frag", "text/plain"); // .frag == WebGL fragment shader
server.registerContentType("vert", "text/plain"); // .vert == WebGL vertex shader
server.setIndexHandler(defaultDirHandler);
var serverRoot =
{
getFile: function getFile(path)
{
- var file = serverBasePath.clone().QueryInterface(Ci.nsILocalFile);
+ var file = serverBasePath.clone().QueryInterface(Ci.nsIFile);
path.split("/").forEach(function(p) {
file.appendRelativePath(p);
});
return file;
},
QueryInterface: function(aIID) { return this; }
};
@@ -371,17 +371,17 @@ function serverDebug(metadata, response)
* Creates a generator that iterates over the contents of
* an nsIFile directory.
*/
function* dirIter(dir)
{
var en = dir.directoryEntries;
while (en.hasMoreElements()) {
var file = en.getNext();
- yield file.QueryInterface(Ci.nsILocalFile);
+ yield file.QueryInterface(Ci.nsIFile);
}
}
/**
* Builds an optionally nested object containing links to the
* files and directories within dir.
*/
function list(requestPath, directory, recurse)
--- a/testing/specialpowers/content/MozillaLogger.js
+++ b/testing/specialpowers/content/MozillaLogger.js
@@ -84,17 +84,17 @@ function MozillaFileLogger(aPath) {
MozillaFileLogger.prototype = {
init(path) {
var PR_WRITE_ONLY = 0x02; // Open for writing only.
var PR_CREATE_FILE = 0x08;
var PR_APPEND = 0x10;
this._file = Components.classes["@mozilla.org/file/local;1"].
- createInstance(Components.interfaces.nsILocalFile);
+ createInstance(Components.interfaces.nsIFile);
this._file.initWithPath(path);
this._foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].
createInstance(Components.interfaces.nsIFileOutputStream);
this._foStream.init(this._file, PR_WRITE_ONLY | PR_CREATE_FILE | PR_APPEND,
436 /* 0664 */, 0);
this._converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"].
createInstance(Components.interfaces.nsIConverterOutputStream);
--- a/testing/specialpowers/content/SpecialPowersObserver.jsm
+++ b/testing/specialpowers/content/SpecialPowersObserver.jsm
@@ -108,17 +108,17 @@ SpecialPowersObserver.prototype._receive
SpecialPowersObserver.prototype.init = function() {
var obs = Services.obs;
obs.addObserver(this, "chrome-document-global-created");
// Register special testing modules.
var testsURI = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties).
- get("ProfD", Ci.nsILocalFile);
+ get("ProfD", Ci.nsIFile);
testsURI.append("tests.manifest");
var ioSvc = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var manifestFile = ioSvc.newFileURI(testsURI).
QueryInterface(Ci.nsIFileURL).file;
Components.manager.QueryInterface(Ci.nsIComponentRegistrar).
autoRegister(manifestFile);
--- a/testing/xpcshell/example/unit/check_profile.js
+++ b/testing/xpcshell/example/unit/check_profile.js
@@ -4,17 +4,17 @@
var {classes: Cc, interfaces: Ci} = Components;
function check_profile_dir(profd) {
Assert.ok(profd.exists());
Assert.ok(profd.isDirectory());
let dirSvc = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties);
- let profd2 = dirSvc.get("ProfD", Ci.nsILocalFile);
+ let profd2 = dirSvc.get("ProfD", Ci.nsIFile);
Assert.ok(profd2.exists());
Assert.ok(profd2.isDirectory());
// make sure we got the same thing back...
Assert.ok(profd.equals(profd2));
}
function check_do_get_profile(fireProfileAfterChange) {
const observedTopics = new Map([
--- a/testing/xpcshell/head.js
+++ b/testing/xpcshell/head.js
@@ -349,17 +349,17 @@ function _register_modules_protocol_hand
let ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
let protocolHandler =
ios.getProtocolHandler("resource")
.QueryInterface(Components.interfaces.nsIResProtocolHandler);
let modulesFile = Components.classes["@mozilla.org/file/local;1"].
- createInstance(Components.interfaces.nsILocalFile);
+ createInstance(Components.interfaces.nsIFile);
modulesFile.initWithPath(_TESTING_MODULES_DIR);
if (!modulesFile.exists()) {
throw new Error("Specified modules directory does not exist: " +
_TESTING_MODULES_DIR);
}
if (!modulesFile.isDirectory()) {
@@ -1014,17 +1014,17 @@ function do_test_finished(aName) {
if (--_tests_pending == 0)
_do_quit();
}
function do_get_file(path, allowNonexistent) {
try {
let lf = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
- .get("CurWorkD", Components.interfaces.nsILocalFile);
+ .get("CurWorkD", Components.interfaces.nsIFile);
let bits = path.split("/");
for (let i = 0; i < bits.length; i++) {
if (bits[i]) {
if (bits[i] == "..")
lf = lf.parent;
else
lf.append(bits[i]);
@@ -1108,67 +1108,67 @@ function do_parse_document(aPath, aType)
function do_register_cleanup(aFunction) {
_cleanupFunctions.push(aFunction);
}
/**
* Returns the directory for a temp dir, which is created by the
* test harness. Every test gets its own temp dir.
*
- * @return nsILocalFile of the temporary directory
+ * @return nsIFile of the temporary directory
*/
function do_get_tempdir() {
let env = Components.classes["@mozilla.org/process/environment;1"]
.getService(Components.interfaces.nsIEnvironment);
// the python harness sets this in the environment for us
let path = env.get("XPCSHELL_TEST_TEMP_DIR");
let file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
+ .createInstance(Components.interfaces.nsIFile);
file.initWithPath(path);
return file;
}
/**
* Returns the directory for crashreporter minidumps.
*
- * @return nsILocalFile of the minidump directory
+ * @return nsIFile of the minidump directory
*/
function do_get_minidumpdir() {
let env = Components.classes["@mozilla.org/process/environment;1"]
.getService(Components.interfaces.nsIEnvironment);
// the python harness may set this in the environment for us
let path = env.get("XPCSHELL_MINIDUMP_DIR");
if (path) {
let file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
+ .createInstance(Components.interfaces.nsIFile);
file.initWithPath(path);
return file;
}
return do_get_tempdir();
}
/**
* Registers a directory with the profile service,
- * and return the directory as an nsILocalFile.
+ * and return the directory as an nsIFile.
*
* @param notifyProfileAfterChange Whether to notify for "profile-after-change".
- * @return nsILocalFile of the profile directory.
+ * @return nsIFile of the profile directory.
*/
function do_get_profile(notifyProfileAfterChange = false) {
if (!runningInParent) {
_testLogger.info("Ignoring profile creation from child process.");
return null;
}
let env = Components.classes["@mozilla.org/process/environment;1"]
.getService(Components.interfaces.nsIEnvironment);
// the python harness sets this in the environment for us
let profd = env.get("XPCSHELL_TEST_PROFILE_DIR");
let file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
+ .createInstance(Components.interfaces.nsIFile);
file.initWithPath(profd);
let dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
let provider = {
getFile(prop, persistent) {
persistent.value = true;
if (prop == "ProfD" || prop == "ProfLD" || prop == "ProfDS" ||
--- a/toolkit/components/aboutmemory/tests/test_aboutmemory6.xul
+++ b/toolkit/components/aboutmemory/tests/test_aboutmemory6.xul
@@ -24,17 +24,17 @@
function onFocus() {
let frame = document.getElementById("amFrame");
frame.focus();
// Checks that a file exists on the local file system and removes it if it
// is present.
function checkForFileAndRemove(aFilename) {
let localFile = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
localFile.initWithPath(aFilename);
let exists = localFile.exists();
if (exists) {
localFile.remove(/* recursive = */ false);
}
return exists;
--- a/toolkit/components/alerts/test/image_server.sjs
+++ b/toolkit/components/alerts/test/image_server.sjs
@@ -1,13 +1,13 @@
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr, Constructor: CC } = Components;
Cu.import("resource://gre/modules/Timer.jsm");
-const LocalFile = CC("@mozilla.org/file/local;1", "nsILocalFile",
+const LocalFile = CC("@mozilla.org/file/local;1", "nsIFile",
"initWithPath");
const FileInputStream = CC("@mozilla.org/network/file-input-stream;1",
"nsIFileInputStream", "init");
const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
"nsIBinaryInputStream", "setInputStream");
--- a/toolkit/components/apppicker/content/appPicker.js
+++ b/toolkit/components/apppicker/content/appPicker.js
@@ -186,17 +186,17 @@ AppPicker.prototype =
if (AppConstants.platform == "win") {
startLocation = "ProgF"; // Program Files
} else if (AppConstants.platform == "macosx") {
startLocation = "LocApp"; // Local Applications
} else {
startLocation = "Home";
}
fp.displayDirectory =
- fileLoc.get(startLocation, Components.interfaces.nsILocalFile);
+ fileLoc.get(startLocation, Components.interfaces.nsIFile);
fp.open(rv => {
if (rv == nsIFilePicker.returnOK && fp.file) {
var localHandlerApp =
Components.classes["@mozilla.org/uriloader/local-handler-app;1"].
createInstance(Components.interfaces.nsILocalHandlerApp);
localHandlerApp.executable = fp.file;
--- a/toolkit/components/contentprefs/tests/unit/head_contentPrefs.js
+++ b/toolkit/components/contentprefs/tests/unit/head_contentPrefs.js
@@ -86,17 +86,17 @@ var ContentPrefTest = {
}
// if running in a content process, this just returns the path
// profile was initialized in the ipc head file
let env = Components.classes["@mozilla.org/process/environment;1"]
.getService(Components.interfaces.nsIEnvironment);
// the python harness sets this in the environment for us
let profd = env.get("XPCSHELL_TEST_PROFILE_DIR");
let file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
+ .createInstance(Components.interfaces.nsIFile);
file.initWithPath(profd);
return file;
},
/**
* Delete the content pref service's persistent datastore. We do this before
* and after running tests to make sure we start from scratch each time. We
* also do it during the database creation, schema migration, and backup tests.
--- a/toolkit/components/ctypes/tests/chrome/test_ctypes.xul
+++ b/toolkit/components/ctypes/tests/chrome/test_ctypes.xul
@@ -18,33 +18,33 @@
<![CDATA[
Components.utils.import("resource://gre/modules/ctypes.jsm");
CTYPES_TEST_LIB = ctypes.libraryName("jsctypes-test");
CTYPES_UNICODE_LIB = ctypes.libraryName("jsctyp\u00E8s-t\u00EB\u00DFt");
/*
* input: string of the url where we are running from
- * return: nsILocalFile
+ * return: nsIFile
*/
function getCurrentDir(path) {
var rootDir = getRootDirectory(window.location.href);
var jar = getJar(rootDir);
if (jar) {
return extractJarToTmp(jar);
} else {
return getLocalDir(path);
}
}
function getLocalDir(path) {
let dir = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
- .get("CurWorkD", Components.interfaces.nsILocalFile);
+ .get("CurWorkD", Components.interfaces.nsIFile);
path = location.pathname;
path = path.slice("content/".length,
-1 * "/test_ctypes.xul".length);
let components = path.split("/");
for (let part in components) {
dir.append(components[part]);
}
return dir;
--- a/toolkit/components/feeds/test/head.js
+++ b/toolkit/components/feeds/test/head.js
@@ -53,17 +53,17 @@ function readTestData(testFile) {
function iterateDir(dir, recurse, callback) {
do_print("Iterate " + dir.leafName);
let entries = dir.directoryEntries;
// Loop over everything in this dir. If its a dir
while (entries.hasMoreElements()) {
let entry = entries.getNext();
- entry.QueryInterface(Ci.nsILocalFile);
+ entry.QueryInterface(Ci.nsIFile);
if (entry.isDirectory()) {
if (recurse) {
iterateDir(entry, recurse, callback);
}
} else {
callback(entry);
}
--- a/toolkit/components/filepicker/content/filepicker.js
+++ b/toolkit/components/filepicker/content/filepicker.js
@@ -6,22 +6,22 @@
const nsIFilePicker = Components.interfaces.nsIFilePicker;
const nsIProperties = Components.interfaces.nsIProperties;
const NS_DIRECTORYSERVICE_CONTRACTID = "@mozilla.org/file/directory_service;1";
const NS_IOSERVICE_CONTRACTID = "@mozilla.org/network/io-service;1";
const nsIFileView = Components.interfaces.nsIFileView;
const NS_FILEVIEW_CONTRACTID = "@mozilla.org/filepicker/fileview;1";
const nsITreeView = Components.interfaces.nsITreeView;
-const nsILocalFile = Components.interfaces.nsILocalFile;
+const nsIFile = Components.interfaces.nsIFile;
const nsIFile = Components.interfaces.nsIFile;
const NS_LOCAL_FILE_CONTRACTID = "@mozilla.org/file/local;1";
const NS_PROMPTSERVICE_CONTRACTID = "@mozilla.org/embedcomp/prompt-service;1";
-var sfile = Components.classes[NS_LOCAL_FILE_CONTRACTID].createInstance(nsILocalFile);
+var sfile = Components.classes[NS_LOCAL_FILE_CONTRACTID].createInstance(nsIFile);
var retvals;
var filePickerMode;
var homeDir;
var treeView;
var allowURLs;
var textInput;
var okButton;
@@ -566,17 +566,17 @@ function addToTextFieldValue(path) {
function onTextFieldFocus() {
setOKAction(null);
doEnabling();
}
function onDirectoryChanged(target) {
var path = target.getAttribute("label");
- var file = Components.classes[NS_LOCAL_FILE_CONTRACTID].createInstance(nsILocalFile);
+ var file = Components.classes[NS_LOCAL_FILE_CONTRACTID].createInstance(nsIFile);
file.initWithPath(path);
if (!sfile.equals(file)) {
// Do this on a timeout callback so the directory list can roll up
// and we don't keep the mouse grabbed while we are loading.
setTimeout(gotoDirectory, 0, file);
}
@@ -771,17 +771,17 @@ function processPath(path) {
return fileArray;
}
function processPathEntry(path, fileArray) {
var filePath;
var file;
try {
- file = sfile.clone().QueryInterface(nsILocalFile);
+ file = sfile.clone().QueryInterface(nsIFile);
} catch (e) {
dump("Couldn't clone\n" + e);
return false;
}
var tilde_file = file.clone();
tilde_file.append("~");
if (path[0] == "~" && // Expand ~ to $HOME, except:
--- a/toolkit/components/filepicker/nsFilePicker.js
+++ b/toolkit/components/filepicker/nsFilePicker.js
@@ -22,17 +22,17 @@ Components.utils.import("resource://gre/
const DEBUG = false; /* set to true to enable debug messages */
var debug;
const LOCAL_FILE_CONTRACTID = "@mozilla.org/file/local;1";
const APPSHELL_SERV_CONTRACTID = "@mozilla.org/appshell/appShellService;1";
const STRBUNDLE_SERV_CONTRACTID = "@mozilla.org/intl/stringbundle;1";
const nsIAppShellService = Components.interfaces.nsIAppShellService;
-const nsILocalFile = Components.interfaces.nsILocalFile;
+const nsIFile = Components.interfaces.nsIFile;
const nsIFileURL = Components.interfaces.nsIFileURL;
const nsISupports = Components.interfaces.nsISupports;
const nsIFactory = Components.interfaces.nsIFactory;
const nsIFilePicker = Components.interfaces.nsIFilePicker;
const nsIInterfaceRequestor = Components.interfaces.nsIInterfaceRequestor;
const nsIDOMWindow = Components.interfaces.nsIDOMWindow;
const nsIStringBundleService = Components.interfaces.nsIStringBundleService;
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
@@ -53,17 +53,17 @@ function nsFilePicker() {
this.mDefaultString = "";
this.mFilterIndex = 0;
this.mFilterTitles = [];
this.mFilters = [];
this.mDisplayDirectory = null;
this.mDisplaySpecialDirectory = null;
if (lastDirectory) {
try {
- var dir = Components.classes[LOCAL_FILE_CONTRACTID].createInstance(nsILocalFile);
+ var dir = Components.classes[LOCAL_FILE_CONTRACTID].createInstance(nsIFile);
dir.initWithPath(lastDirectory);
this.mDisplayDirectory = dir;
} catch (e) {}
}
}
nsFilePicker.prototype = {
classID: Components.ID("{54ae32f8-1dd2-11b2-a209-df7c505370f8}"),
@@ -72,36 +72,36 @@ nsFilePicker.prototype = {
if (iid.equals(nsIFilePicker) ||
iid.equals(nsISupports))
return this;
throw Components.results.NS_ERROR_NO_INTERFACE;
},
- /* attribute nsILocalFile displayDirectory; */
+ /* attribute nsIFile displayDirectory; */
set displayDirectory(a) {
this.mDisplayDirectory = a &&
- a.clone().QueryInterface(nsILocalFile);
+ a.clone().QueryInterface(nsIFile);
},
get displayDirectory() {
return this.mDisplayDirectory &&
this.mDisplayDirectory.clone()
- .QueryInterface(nsILocalFile);
+ .QueryInterface(nsIFile);
},
/* attribute AString displaySpecialDirectory; */
set displaySpecialDirectory(a) {
this.mDisplaySpecialDirectory = a;
},
get displaySpecialDirectory() {
return this.mDisplaySpecialDirectory;
},
- /* readonly attribute nsILocalFile file; */
+ /* readonly attribute nsIFile file; */
get file() { return this.mFilesEnumerator.mFiles[0]; },
/* readonly attribute nsISimpleEnumerator files; */
get files() { return this.mFilesEnumerator; },
/* we don't support directories, yet */
get domFileOrDirectory() {
let enumerator = this.domFileOrDirectoryEnumerator;
--- a/toolkit/components/osfile/tests/mochi/main_test_osfile_async.js
+++ b/toolkit/components/osfile/tests/mochi/main_test_osfile_async.js
@@ -111,17 +111,17 @@ var reference_fetch_file = function refe
});
};
var reference_dir_contents = function reference_dir_contents(path) {
let result = [];
let entries = new FileUtils.File(path).directoryEntries;
while (entries.hasMoreElements()) {
- let entry = entries.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+ let entry = entries.getNext().QueryInterface(Components.interfaces.nsIFile);
result.push(entry.path);
}
return result;
};
// Set/Unset OS.Shared.DEBUG, OS.Shared.TEST and a console listener.
function toggleDebugTest (pref, consoleListener) {
Services.prefs.setBoolPref("toolkit.osfile.log", pref);
--- a/toolkit/components/passwordmgr/test/unit/test_storage_mozStorage.js
+++ b/toolkit/components/passwordmgr/test/unit/test_storage_mozStorage.js
@@ -40,17 +40,17 @@ function deleteFile(pathname, filename)
} catch (e) {}
}
function reloadStorage(aInputPathName, aInputFileName)
{
var inputFile = null;
if (aInputFileName) {
inputFile = Cc["@mozilla.org/file/local;1"].
- createInstance(Ci.nsILocalFile);
+ createInstance(Ci.nsIFile);
inputFile.initWithPath(aInputPathName);
inputFile.append(aInputFileName);
}
let storage = Cc["@mozilla.org/login-manager/storage/mozStorage;1"]
.createInstance(Ci.nsILoginManagerStorage);
storage.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIVariant)
@@ -487,17 +487,17 @@ do_check_false(await OS.File.exists(file
// initialize the storage module again
storage = reloadStorage(OS.Constants.Path.profileDir, filename);
// use the storage module again, should work now
storage.addLogin(testuser1);
checkStorageData(storage, [], [testuser1]);
// check the file exists
-var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(OS.Constants.Path.profileDir);
file.append(filename);
do_check_true(file.exists());
deleteFile(OS.Constants.Path.profileDir, filename + ".corrupt");
deleteFile(OS.Constants.Path.profileDir, filename);
} catch (e) {
--- a/toolkit/components/places/PlacesBackups.jsm
+++ b/toolkit/components/places/PlacesBackups.jsm
@@ -20,17 +20,17 @@ XPCOMUtils.defineLazyModuleGetter(this,
"resource://gre/modules/BookmarkJSONUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
"resource://gre/modules/Deprecated.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm");
XPCOMUtils.defineLazyGetter(this, "localFileCtor",
() => Components.Constructor("@mozilla.org/file/local;1",
- "nsILocalFile", "initWithPath"));
+ "nsIFile", "initWithPath"));
XPCOMUtils.defineLazyGetter(this, "filenamesRegex",
() => /^bookmarks-([0-9-]+)(?:_([0-9]+)){0,1}(?:_([a-z0-9=+-]{24})){0,1}\.(json(lz4)?)$/i
);
/**
* Appends meta-data information to a given filename.
*/
@@ -125,17 +125,17 @@ this.PlacesBackups = {
return this._folder;
},
/**
* This exists just to avoid spamming deprecate warnings from internal calls
* needed to support deprecated methods themselves.
*/
get _folder() {
- let bookmarksBackupDir = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
+ let bookmarksBackupDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
bookmarksBackupDir.append(this.profileRelativeFolderPath);
if (!bookmarksBackupDir.exists()) {
bookmarksBackupDir.create(Ci.nsIFile.DIRECTORY_TYPE, parseInt("0700", 8));
if (!bookmarksBackupDir.exists())
throw ("Unable to create bookmarks backup folder");
}
delete this._folder;
return this._folder = bookmarksBackupDir;
--- a/toolkit/components/places/PlacesDBUtils.jsm
+++ b/toolkit/components/places/PlacesDBUtils.jsm
@@ -771,27 +771,27 @@ this.PlacesDBUtils = {
* allow us to maintain a simple, consistent API for the tasks within this object.
*
* @return {Promise} resolves when database is vacuumed.
* @resolves to an array of logs for this task.
* @rejects if we are unable to vacuum database.
*/
async vacuum() { // eslint-disable-line require-await
let logs = [];
- let DBFile = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
+ let DBFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
DBFile.append("places.sqlite");
logs.push("Initial database size is " +
parseInt(DBFile.fileSize / 1024) + " KiB");
return PlacesUtils.withConnectionWrapper(
"PlacesDBUtils: vacuum",
async (db) => {
await db.execute("VACUUM");
}).then(() => {
logs.push("The database has been vacuumed");
- let vacuumedDBFile = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
+ let vacuumedDBFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
vacuumedDBFile.append("places.sqlite");
logs.push("Final database size is " +
parseInt(vacuumedDBFile.fileSize / 1024) + " KiB");
return logs;
}).catch(() => {
PlacesDBUtils.clearPendingTasks();
throw new Error("Unable to vacuum database");
});
@@ -830,17 +830,17 @@ this.PlacesDBUtils = {
* Collects statistical data on the database.
*
* @return {Promise} resolves when statistics are collected.
* @resolves to an array of logs for this task.
* @rejects if we are unable to collect stats for some reason.
*/
async stats() {
let logs = [];
- let DBFile = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
+ let DBFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
DBFile.append("places.sqlite");
logs.push("Database size is " + parseInt(DBFile.fileSize / 1024) + " KiB");
// Execute each step async.
let pragmas = [ "user_version",
"page_size",
"cache_size",
"journal_mode",
@@ -963,17 +963,17 @@ this.PlacesDBUtils = {
SELECT count(*) FROM moz_bookmarks b
JOIN moz_bookmarks t ON t.id = b.parent
AND t.parent <> :tags_folder
WHERE b.type = :type_bookmark
)), 0)` },
{ histogram: "PLACES_DATABASE_FILESIZE_MB",
callback() {
- let DBFile = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
+ let DBFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
DBFile.append("places.sqlite");
return parseInt(DBFile.fileSize / BYTES_PER_MEBIBYTE);
}
},
{ histogram: "PLACES_DATABASE_PAGESIZE_B",
query: "PRAGMA page_size /* PlacesDBUtils.jsm PAGESIZE_B */" },
--- a/toolkit/components/places/nsPlacesExpiration.js
+++ b/toolkit/components/places/nsPlacesExpiration.js
@@ -733,17 +733,17 @@ nsPlacesExpiration.prototype = {
if (memSizeBytes <= 0) {
memSizeBytes = MEMSIZE_FALLBACK_BYTES;
}
let diskAvailableBytes = DISKSIZE_FALLBACK_BYTES;
try {
// Protect against a full disk or tiny quota.
let dbFile = this._db.databaseFile;
- dbFile.QueryInterface(Ci.nsILocalFile);
+ dbFile.QueryInterface(Ci.nsIFile);
diskAvailableBytes = dbFile.diskSpaceAvailable;
} catch (ex) {}
if (diskAvailableBytes <= 0) {
diskAvailableBytes = DISKSIZE_FALLBACK_BYTES;
}
let optimalDatabaseSize = Math.min(
memSizeBytes * DATABASE_TO_MEMORY_PERC / 100,
--- a/toolkit/components/places/tests/bookmarks/test_477583_json-backup-in-future.js
+++ b/toolkit/components/places/tests/bookmarks/test_477583_json-backup-in-future.js
@@ -26,17 +26,17 @@ function run_test() {
while (files.hasMoreElements()) {
let entry = files.getNext().QueryInterface(Ci.nsIFile);
if (PlacesBackups.filenamesRegex.test(entry.leafName))
entry.remove(false);
}
let futureBackupFile = bookmarksBackupDir.clone();
futureBackupFile.append(name);
- futureBackupFile.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, 0o600);
+ futureBackupFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600);
do_check_true(futureBackupFile.exists());
do_check_eq((await PlacesBackups.getBackupFiles()).length, 0);
await PlacesBackups.create();
// Check that a backup for today has been created.
do_check_eq((await PlacesBackups.getBackupFiles()).length, 1);
let mostRecentBackupFile = await PlacesBackups.getMostRecentBackup();
--- a/toolkit/components/places/tests/bookmarks/test_818593-store-backup-metadata.js
+++ b/toolkit/components/places/tests/bookmarks/test_818593-store-backup-metadata.js
@@ -11,17 +11,17 @@ add_task(async function test_saveBookmar
let uri = NetUtil.newURI("http://getfirefox.com/");
let bookmarkId =
PlacesUtils.bookmarks.insertBookmark(
PlacesUtils.unfiledBookmarksFolderId, uri,
PlacesUtils.bookmarks.DEFAULT_INDEX, "Get Firefox!");
// Test saveBookmarksToJSONFile()
let backupFile = FileUtils.getFile("TmpD", ["bookmarks.json"]);
- backupFile.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, parseInt("0600", 8));
+ backupFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("0600", 8));
let nodeCount = await PlacesBackups.saveBookmarksToJSONFile(backupFile, true);
do_check_true(nodeCount > 0);
do_check_true(backupFile.exists());
do_check_eq(backupFile.leafName, "bookmarks.json");
// Ensure the backup would be copied to our backups folder when the original
// backup is saved somewhere else.
--- a/toolkit/components/places/tests/favicons/test_replaceFaviconData.js
+++ b/toolkit/components/places/tests/favicons/test_replaceFaviconData.js
@@ -11,17 +11,17 @@ var originalFavicon = {
file: do_get_file("favicon-normal16.png"),
uri: uri(do_get_file("favicon-normal16.png")),
data: readFileData(do_get_file("favicon-normal16.png")),
mimetype: "image/png"
};
var uniqueFaviconId = 0;
function createFavicon(fileName) {
- let tempdir = Services.dirsvc.get("TmpD", Ci.nsILocalFile);
+ let tempdir = Services.dirsvc.get("TmpD", Ci.nsIFile);
// remove any existing file at the path we're about to copy to
let outfile = tempdir.clone();
outfile.append(fileName);
try { outfile.remove(false); } catch (e) {}
originalFavicon.file.copyToFollowingLinks(tempdir, fileName);
--- a/toolkit/components/places/tests/favicons/test_replaceFaviconDataFromDataURL.js
+++ b/toolkit/components/places/tests/favicons/test_replaceFaviconDataFromDataURL.js
@@ -11,17 +11,17 @@ var originalFavicon = {
file: do_get_file("favicon-normal16.png"),
uri: uri(do_get_file("favicon-normal16.png")),
data: readFileData(do_get_file("favicon-normal16.png")),
mimetype: "image/png"
};
var uniqueFaviconId = 0;
function createFavicon(fileName) {
- let tempdir = Services.dirsvc.get("TmpD", Ci.nsILocalFile);
+ let tempdir = Services.dirsvc.get("TmpD", Ci.nsIFile);
// remove any existing file at the path we're about to copy to
let outfile = tempdir.clone();
outfile.append(fileName);
try { outfile.remove(false); } catch (e) {}
originalFavicon.file.copyToFollowingLinks(tempdir, fileName);
--- a/toolkit/components/places/tests/unit/test_bookmarks_html.js
+++ b/toolkit/components/places/tests/unit/test_bookmarks_html.js
@@ -76,17 +76,17 @@ var gBookmarksFileNew;
add_task(async function setup() {
// Avoid creating smart bookmarks during the test.
Services.prefs.setIntPref("browser.places.smartBookmarksVersion", -1);
// File pointer to legacy bookmarks file.
gBookmarksFileOld = do_get_file("bookmarks.preplaces.html");
// File pointer to a new Places-exported bookmarks file.
- gBookmarksFileNew = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
+ gBookmarksFileNew = Services.dirsvc.get("ProfD", Ci.nsIFile);
gBookmarksFileNew.append("bookmarks.exported.html");
if (gBookmarksFileNew.exists()) {
gBookmarksFileNew.remove(false);
}
// This test must be the first one, since it setups the new bookmarks.html.
// Test importing a pre-Places canonical bookmarks file.
// 1. import bookmarks.preplaces.html
--- a/toolkit/components/places/tests/unit/test_bookmarks_restore_notification.js
+++ b/toolkit/components/places/tests/unit/test_bookmarks_restore_notification.js
@@ -184,17 +184,17 @@ add_task(async function test_json_restor
add_task(async function test_json_restore_nonexist() {
let expectedData = {
data: NSIOBSERVER_DATA_JSON,
folderId: null
}
let expectPromises = registerObservers(false);
do_print("JSON restore: nonexistent file should fail");
- let file = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
+ let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
file.append("this file doesn't exist because nobody created it 1");
try {
await BookmarkJSONUtils.importFromFile(file, true);
do_throw(" Restore should have failed");
} catch (e) {}
await checkObservers(expectPromises, expectedData);
await teardown(file);
@@ -246,17 +246,17 @@ add_task(async function test_html_restor
add_task(async function test_html_restore_nonexist() {
let expectedData = {
data: NSIOBSERVER_DATA_HTML,
folderId: null
}
let expectPromises = registerObservers(false);
do_print("HTML restore: nonexistent file should fail");
- let file = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
+ let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
file.append("this file doesn't exist because nobody created it 2");
try {
await BookmarkHTMLUtils.importFromFile(file, false);
do_throw("Should fail!");
} catch (e) {}
await checkObservers(expectPromises, expectedData);
await teardown(file);
@@ -308,17 +308,17 @@ add_task(async function test_html_init_r
add_task(async function test_html_init_restore_nonexist() {
let expectedData = {
data: NSIOBSERVER_DATA_HTML_INIT,
folderId: null
}
let expectPromises = registerObservers(false);
do_print("HTML initial restore: nonexistent file should fail");
- let file = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
+ let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
file.append("this file doesn't exist because nobody created it 3");
try {
await BookmarkHTMLUtils.importFromFile(file, true);
do_throw("Should fail!");
} catch (e) {}
await checkObservers(expectPromises, expectedData);
await teardown(file);
--- a/toolkit/components/search/nsSearchService.js
+++ b/toolkit/components/search/nsSearchService.js
@@ -1194,30 +1194,30 @@ EngineURL.prototype = {
return json;
}
};
/**
* nsISearchEngine constructor.
* @param aLocation
- * A nsILocalFile or nsIURI object representing the location of the
+ * A nsIFile or nsIURI object representing the location of the
* search engine data file.
* @param aIsReadOnly
* Boolean indicating whether the engine should be treated as read-only.
*/
function Engine(aLocation, aIsReadOnly) {
this._readOnly = aIsReadOnly;
this._urls = [];
this._metaData = {};
let file, uri;
if (typeof aLocation == "string") {
this._shortName = aLocation;
- } else if (aLocation instanceof Ci.nsILocalFile) {
+ } else if (aLocation instanceof Ci.nsIFile) {
if (!aIsReadOnly) {
// This is an engine that was installed in NS_APP_USER_SEARCH_DIR by a
// previous version. We are converting the file to an engine stored only
// in JSON, but we need to keep the reference to the profile file to
// remove it if the user ever removes the engine.
this._filePath = aLocation.persistentDescriptor;
}
file = aLocation;
@@ -3460,17 +3460,17 @@ SearchService.prototype = {
let parts = osfile.path.split(".");
if (parts.length <= 1 || (parts.pop()).toLowerCase() != "xml") {
// Not an engine
continue;
}
let addedEngine = null;
try {
- let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(osfile.path);
addedEngine = new Engine(file, !isInProfile);
await checkForSyncCompletion(addedEngine._asyncInitFromFile(file));
if (!isInProfile && !addedEngine._isDefault) {
addedEngine._dirPath = dirPath;
let info = await OS.File.stat(dirPath);
addedEngine._dirLastModifiedTime =
info.lastModificationDate.getTime();
@@ -4092,17 +4092,17 @@ SearchService.prototype = {
if (engineToRemove._readOnly) {
// Just hide it (the "hidden" setter will notify) and remove its alias to
// avoid future conflicts with other engines.
engineToRemove.hidden = true;
engineToRemove.alias = null;
} else {
// Remove the engine file from disk if we had a legacy file in the profile.
if (engineToRemove._filePath) {
- let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.persistentDescriptor = engineToRemove._filePath;
if (file.exists()) {
file.remove(false);
}
engineToRemove._filePath = null;
}
// Remove the engine from _sortedEngines
--- a/toolkit/components/search/tests/xpcshell/head_search.js
+++ b/toolkit/components/search/tests/xpcshell/head_search.js
@@ -69,17 +69,17 @@ function configureToLoadJarEngines() {
}
/**
* Fake the installation of an add-on in the profile, by creating the
* directory and registering it with the directory service.
*/
function installAddonEngine(name = "engine-addon") {
const XRE_EXTENSIONS_DIR_LIST = "XREExtDL";
- const profD = do_get_profile().QueryInterface(Ci.nsILocalFile);
+ const profD = do_get_profile().QueryInterface(Ci.nsIFile);
let dir = profD.clone();
dir.append("extensions");
if (!dir.exists())
dir.create(dir.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
dir.append("search-engine@tests.mozilla.org");
dir.create(dir.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
@@ -120,17 +120,17 @@ function installAddonEngine(name = "engi
/**
* Copy the engine-distribution.xml engine to a fake distribution
* created in the profile, and registered with the directory service.
*/
function installDistributionEngine() {
const XRE_APP_DISTRIBUTION_DIR = "XREAppDist";
- const profD = do_get_profile().QueryInterface(Ci.nsILocalFile);
+ const profD = do_get_profile().QueryInterface(Ci.nsIFile);
let dir = profD.clone();
dir.append("distribution");
dir.create(dir.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
let distDir = dir.clone();
dir.append("searchplugins");
dir.create(dir.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
--- a/toolkit/components/thumbnails/test/browser_thumbnails_storage_migrate3.js
+++ b/toolkit/components/thumbnails/test/browser_thumbnails_storage_migrate3.js
@@ -72,17 +72,17 @@ function* runTests() {
if ("getFileForURL" in PageThumbsStorage) {
file = PageThumbsStorage.getFileForURL(URL);
is(file.path, PageThumbsStorage.getFilePathForURL(URL),
"Deprecated getFileForURL and getFilePathForURL return the same path");
}
}
function changeLocation(aLocation, aNewDir) {
- let oldDir = gDirSvc.get(aLocation, Ci.nsILocalFile);
+ let oldDir = gDirSvc.get(aLocation, Ci.nsIFile);
gDirSvc.undefine(aLocation);
gDirSvc.set(aLocation, aNewDir);
registerCleanupFunction(function() {
gDirSvc.undefine(aLocation);
gDirSvc.set(aLocation, oldDir);
});
}
--- a/toolkit/components/url-classifier/tests/unittests.xul
+++ b/toolkit/components/url-classifier/tests/unittests.xul
@@ -103,17 +103,17 @@
listManagerInst.safeInsert(listName, 'test', '1');
G_Assert(z, listManagerInst.safeExists(listName, 'test'),
'insert/exist failed');
// test serialization
var baseName = (new Date().getTime()) + ".tmp";
var tempDir = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties)
- .get("TmpD", Ci.nsILocalFile);
+ .get("TmpD", Ci.nsIFile);
tempDir.append(baseName);
tempDir.createUnique(tempDir.DIRECTORY_TYPE, 0744);
var listManager = Cc["@mozilla.org/url-classifier/listmanager;1"]
.getService(Ci.nsIUrlListManager);
listManager.setAppDir(tempDir);
var data = "";
--- a/toolkit/components/windowcreator/test/test_bug293834.html
+++ b/toolkit/components/windowcreator/test/test_bug293834.html
@@ -58,17 +58,17 @@ function checkform(doc) {
}
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
function getTempDir() {
return Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties)
- .get("TmpD", Ci.nsILocalFile);
+ .get("TmpD", Ci.nsIFile);
}
function getFileContents(aFile) {
const PR_RDONLY = 0x01;
var fileStream = Cc["@mozilla.org/network/file-input-stream;1"]
.createInstance(Ci.nsIFileInputStream);
fileStream.init(aFile, PR_RDONLY, 0o400,
Ci.nsIFileInputStream.DELETE_ON_CLOSE
--- a/toolkit/components/windowcreator/test/test_bug449141.html
+++ b/toolkit/components/windowcreator/test/test_bug449141.html
@@ -22,17 +22,17 @@ https://bugzilla.mozilla.org/show_bug.cg
/** Test for Bug 449141 **/
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
function getTempDir() {
return Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties)
- .get("TmpD", Ci.nsILocalFile);
+ .get("TmpD", Ci.nsIFile);
}
// STATE_STOP from nsIWebProgressListener.idl
const STATE_STOP = 0x00000010;
var progressListener = {
onProgressChange() {
/* Ignore progress callback */
--- a/toolkit/content/aboutProfiles.js
+++ b/toolkit/content/aboutProfiles.js
@@ -79,17 +79,17 @@ function refreshUI() {
restartSafeModeButton.onclick = function() { restart(true); }
let restartNormalModeButton = document.getElementById("restart-button");
restartNormalModeButton.onclick = function() { restart(false); }
}
function openDirectory(dir) {
let nsLocalFile = Components.Constructor("@mozilla.org/file/local;1",
- "nsILocalFile", "initWithPath");
+ "nsIFile", "initWithPath");
new nsLocalFile(dir).reveal();
}
function display(profileData) {
let parent = document.getElementById("profiles");
let div = document.createElement("div");
parent.appendChild(div);
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -1125,17 +1125,17 @@ Serializer.prototype = {
function openProfileDirectory() {
// Get the profile directory.
let currProfD = Services.dirsvc.get("ProfD", Ci.nsIFile);
let profileDir = currProfD.path;
// Show the profile directory.
let nsLocalFile = Components.Constructor("@mozilla.org/file/local;1",
- "nsILocalFile", "initWithPath");
+ "nsIFile", "initWithPath");
new nsLocalFile(profileDir).reveal();
}
/**
* Profile reset is only supported for the default profile if the appropriate migrator exists.
*/
function populateActionBox() {
if (ResetProfile.resetSupported()) {
--- a/toolkit/content/tests/chrome/test_preferences.xul
+++ b/toolkit/content/tests/chrome/test_preferences.xul
@@ -26,17 +26,17 @@
unichar_data: "äöüßÄÖÜ",
file_data: "/",
wstring: Components.classes["@mozilla.org/pref-localizedstring;1"]
.createInstance(Components.interfaces.nsIPrefLocalizedString),
unichar: Components.classes["@mozilla.org/supports-string;1"]
.createInstance(Components.interfaces.nsISupportsString),
file: Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile)
+ .createInstance(Components.interfaces.nsIFile)
};
kPrefValueSet1.wstring.data = kPrefValueSet1.wstring_data;
kPrefValueSet1.unichar.data = kPrefValueSet1.unichar_data;
SafeFileInit(kPrefValueSet1.file, kPrefValueSet1.file_data);
// preference values, set 2
const kPrefValueSet2 =
{
@@ -47,17 +47,17 @@
unichar_data: "áôùšŽ",
file_data: "/home",
wstring: Components.classes["@mozilla.org/pref-localizedstring;1"]
.createInstance(Components.interfaces.nsIPrefLocalizedString),
unichar: Components.classes["@mozilla.org/supports-string;1"]
.createInstance(Components.interfaces.nsISupportsString),
file: Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile)
+ .createInstance(Components.interfaces.nsIFile)
};
kPrefValueSet2.wstring.data = kPrefValueSet2.wstring_data;
kPrefValueSet2.unichar.data = kPrefValueSet2.unichar_data;
SafeFileInit(kPrefValueSet2.file, kPrefValueSet2.file_data);
function SafeFileInit(aFile, aPath)
{
@@ -94,17 +94,17 @@
kPref.setCharPref("tests.static_preference_string", aPrefValueSet.string);
kPref.setComplexValue("tests.static_preference_wstring",
Components.interfaces.nsIPrefLocalizedString,
aPrefValueSet.wstring);
kPref.setComplexValue("tests.static_preference_unichar",
Components.interfaces.nsISupportsString,
aPrefValueSet.unichar);
kPref.setComplexValue("tests.static_preference_file",
- Components.interfaces.nsILocalFile,
+ Components.interfaces.nsIFile,
aPrefValueSet.file);
}
function ReadPrefsFromSystem()
{
// read preference data via XPCOM
var result = CreateEmptyPrefValueSet();
try {result.int = kPref.getIntPref ("tests.static_preference_int") } catch (ignored) {};
@@ -122,17 +122,17 @@
result.unichar = kPref.getComplexValue("tests.static_preference_unichar",
Components.interfaces.nsISupportsString);
result.unichar_data = result.unichar.data;
}
catch (ignored) {};
try
{
result.file = kPref.getComplexValue("tests.static_preference_file",
- Components.interfaces.nsILocalFile);
+ Components.interfaces.nsIFile);
result.file_data = result.file.data;
}
catch (ignored) {};
return result;
}
function GetXULElement(aPrefWindow, aID)
{
@@ -161,17 +161,17 @@
wstring_data: GetXULElement(aPrefWindow, "tests.static_preference_wstring").value,
unichar_data: GetXULElement(aPrefWindow, "tests.static_preference_unichar").value,
file_data: GetXULElement(aPrefWindow, "tests.static_preference_file" ).value,
wstring: Components.classes["@mozilla.org/pref-localizedstring;1"]
.createInstance(Components.interfaces.nsIPrefLocalizedString),
unichar: Components.classes["@mozilla.org/supports-string;1"]
.createInstance(Components.interfaces.nsISupportsString),
file: Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile)
+ .createInstance(Components.interfaces.nsIFile)
}
result.wstring.data = result.wstring_data;
result.unichar.data = result.unichar_data;
SafeFileInit(result.file, result.file_data);
return result;
}
function WritePrefsToUI(aPrefWindow, aPrefValueSet)
@@ -196,17 +196,17 @@
wstring_data: GetXULElement(aPrefWindow, "static_element_wstring").value,
unichar_data: GetXULElement(aPrefWindow, "static_element_unichar").value,
file_data: GetXULElement(aPrefWindow, "static_element_file" ).value,
wstring: Components.classes["@mozilla.org/pref-localizedstring;1"]
.createInstance(Components.interfaces.nsIPrefLocalizedString),
unichar: Components.classes["@mozilla.org/supports-string;1"]
.createInstance(Components.interfaces.nsISupportsString),
file: Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile)
+ .createInstance(Components.interfaces.nsIFile)
}
result.wstring.data = result.wstring_data;
result.unichar.data = result.unichar_data;
SafeFileInit(result.file, result.file_data);
return result;
}
--- a/toolkit/content/widgets/preferences.xml
+++ b/toolkit/content/widgets/preferences.xml
@@ -369,17 +369,17 @@
return this._branch.getStringPref(this.name);
case "fontname":
var family = this._branch.getStringPref(this.name);
var fontEnumerator = Components.classes["@mozilla.org/gfx/fontenumerator;1"]
.createInstance(Components.interfaces.nsIFontEnumerator);
return fontEnumerator.getStandardFamilyName(family);
case "file":
var f = this._branch
- .getComplexValue(this.name, Components.interfaces.nsILocalFile);
+ .getComplexValue(this.name, Components.interfaces.nsIFile);
return f;
default:
this._reportUnknownType();
}
} catch (e) { }
return null;
]]>
</getter>
@@ -414,24 +414,24 @@
case "unichar":
case "fontname":
this.preferences.rootBranch.setStringPref(this.name, val);
break;
case "file":
var lf;
if (typeof(val) == "string") {
lf = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
+ .createInstance(Components.interfaces.nsIFile);
lf.persistentDescriptor = val;
if (!lf.exists())
lf.initWithPath(val);
} else
- lf = val.QueryInterface(Components.interfaces.nsILocalFile);
+ lf = val.QueryInterface(Components.interfaces.nsIFile);
this.preferences.rootBranch
- .setComplexValue(this.name, Components.interfaces.nsILocalFile, lf);
+ .setComplexValue(this.name, Components.interfaces.nsIFile, lf);
break;
default:
this._reportUnknownType();
}
if (!this.batching)
this.preferences.service.savePrefFile(null);
return val;
]]>
--- a/toolkit/crashreporter/test/CrashTestUtils.jsm
+++ b/toolkit/crashreporter/test/CrashTestUtils.jsm
@@ -23,17 +23,17 @@ this.CrashTestUtils = {
// From google_breakpad/common/minidump_format.h
MD_THREAD_LIST_STREAM: 3,
MD_MEMORY_INFO_LIST_STREAM: 16
};
// Grab APIs from the testcrasher shared library
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/ctypes.jsm");
-var dir = Services.dirsvc.get("CurWorkD", Components.interfaces.nsILocalFile);
+var dir = Services.dirsvc.get("CurWorkD", Components.interfaces.nsIFile);
var file = dir.clone();
file = file.parent;
file.append(ctypes.libraryName("testcrasher"));
var lib = ctypes.open(file.path);
CrashTestUtils.crash = lib.declare("Crash",
ctypes.default_abi,
ctypes.void_t,
ctypes.int16_t);
--- a/toolkit/crashreporter/test/browser/browser_aboutCrashes.js
+++ b/toolkit/crashreporter/test/browser/browser_aboutCrashes.js
@@ -1,17 +1,17 @@
add_task(async function test() {
let appD = make_fake_appdir();
let crD = appD.clone();
crD.append("Crash Reports");
let crashes = add_fake_crashes(crD, 5);
// sanity check
let dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
- let appDtest = dirSvc.get("UAppData", Components.interfaces.nsILocalFile);
+ let appDtest = dirSvc.get("UAppData", Components.interfaces.nsIFile);
ok(appD.equals(appDtest), "directory service provider registered ok");
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:crashes" }, function(browser) {
info("about:crashes loaded");
return ContentTask.spawn(browser, crashes, function(crashes) {
let doc = content.document;
let crashlinks = doc.getElementById("submitted").querySelectorAll(".crashReport");
Assert.equal(crashlinks.length, crashes.length,
--- a/toolkit/crashreporter/test/browser/head.js
+++ b/toolkit/crashreporter/test/browser/head.js
@@ -12,17 +12,17 @@ function create_subdir(dir, subdirname)
var _provider = null;
function make_fake_appdir() {
// Create a directory inside the profile and register it as UAppData, so
// we can stick fake crash reports inside there. We put it inside the profile
// just because we know that will get cleaned up after the mochitest run.
let dirSvc = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties);
- let profD = dirSvc.get("ProfD", Ci.nsILocalFile);
+ let profD = dirSvc.get("ProfD", Ci.nsIFile);
// create a subdir just to keep our files out of the way
let appD = create_subdir(profD, "UAppData");
let crashesDir = create_subdir(appD, "Crash Reports");
create_subdir(crashesDir, "pending");
create_subdir(crashesDir, "submitted");
_provider = {
--- a/toolkit/crashreporter/test/unit/crasher_subprocess_head.js
+++ b/toolkit/crashreporter/test/unit/crasher_subprocess_head.js
@@ -1,16 +1,16 @@
// enable crash reporting first
var cwd = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
- .get("CurWorkD", Components.interfaces.nsILocalFile);
+ .get("CurWorkD", Components.interfaces.nsIFile);
// get the temp dir
var env = Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment);
-var _tmpd = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
+var _tmpd = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsIFile);
_tmpd.initWithPath(env.get("XPCSHELL_TEST_TEMP_DIR"));
var crashReporter =
Components.classes["@mozilla.org/toolkit/crash-reporter;1"]
.getService(Components.interfaces.nsICrashReporter);
// We need to call this or crash events go in an undefined location.
crashReporter.UpdateCrashEventsDir();
--- a/toolkit/crashreporter/test/unit/head_crashreporter.js
+++ b/toolkit/crashreporter/test/unit/head_crashreporter.js
@@ -20,36 +20,36 @@ function getEventDir() {
* and crasher_subprocess_tail.js, so it will have access
* to everything defined in crasher_subprocess_head.js,
* which includes "crashReporter", a variable holding
* the crash reporter service.
*
* @param callback
* A JavaScript function to be called after the subprocess
* crashes. It will be passed (minidump, extra), where
- * minidump is an nsILocalFile of the minidump file produced,
+ * minidump is an nsIFile of the minidump file produced,
* and extra is an object containing the key,value pairs from
* the .extra file.
*
* @param canReturnZero
* If true, the subprocess may return with a zero exit code.
* Certain types of crashes may not cause the process to
* exit with an error.
*/
function do_crash(setup, callback, canReturnZero) {
// get current process filename (xpcshell)
let ds = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
- let bin = ds.get("XREExeF", Components.interfaces.nsILocalFile);
+ let bin = ds.get("XREExeF", Components.interfaces.nsIFile);
if (!bin.exists()) {
// weird, can't find xpcshell binary?
do_throw("Can't find xpcshell binary!");
}
// get Gre dir (GreD)
- let greD = ds.get("GreD", Components.interfaces.nsILocalFile);
+ let greD = ds.get("GreD", Components.interfaces.nsIFile);
let headfile = do_get_file("crasher_subprocess_head.js");
let tailfile = do_get_file("crasher_subprocess_tail.js");
// run xpcshell -g GreD -f head -e "some setup code" -f tail
let process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
process.init(bin);
let args = ["-g", greD.path,
"-f", headfile.path];
@@ -86,17 +86,17 @@ function do_crash(setup, callback, canRe
}
handleMinidump(callback);
}
function getMinidump() {
let en = do_get_tempdir().directoryEntries;
while (en.hasMoreElements()) {
- let f = en.getNext().QueryInterface(Components.interfaces.nsILocalFile);
+ let f = en.getNext().QueryInterface(Components.interfaces.nsIFile);
if (f.leafName.substr(-4) == ".dmp") {
return f;
}
}
return null;
}
--- a/toolkit/crashreporter/test/unit/test_crash_with_memory_report.js
+++ b/toolkit/crashreporter/test/unit/test_crash_with_memory_report.js
@@ -15,17 +15,17 @@ function run_test() {
let Cc = Components.classes;
let Ci = Components.interfaces;
let env = Cc["@mozilla.org/process/environment;1"]
.getService(Ci.nsIEnvironment);
let profd = env.get("XPCSHELL_TEST_PROFILE_DIR");
let file = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
+ .createInstance(Ci.nsIFile);
file.initWithPath(profd);
let dirSvc = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties);
let provider = {
getFile(prop, persistent) {
persistent.value = true;
if (prop == "ProfD" || prop == "ProfLD" || prop == "ProfDS" ||
--- a/toolkit/modules/FileUtils.jsm
+++ b/toolkit/modules/FileUtils.jsm
@@ -165,10 +165,10 @@ this.FileUtils = {
stream.finish();
return;
} catch (e) {
}
}
stream.close();
},
- File: Components.Constructor("@mozilla.org/file/local;1", Ci.nsILocalFile, "initWithPath")
+ File: Components.Constructor("@mozilla.org/file/local;1", Ci.nsIFile, "initWithPath")
};
--- a/toolkit/modules/PropertyListUtils.jsm
+++ b/toolkit/modules/PropertyListUtils.jsm
@@ -68,27 +68,27 @@ XPCOMUtils.defineLazyModuleGetter(this,
"resource://gre/modules/ctypes.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
this.PropertyListUtils = Object.freeze({
/**
* Asynchronously reads a file as a property list.
*
- * @param aFile (nsIDOMBlob/nsILocalFile)
+ * @param aFile (nsIDOMBlob/nsIFile)
* the file to be read as a property list.
* @param aCallback
* If the property list is read successfully, aPropertyListRoot is set
* to the root object of the property list.
* Use getPropertyListObjectType to detect its type.
* If it's not read successfully, aPropertyListRoot is set to null.
* The reaon for failure is reported to the Error Console.
*/
read: function PLU_read(aFile, aCallback) {
- if (!(aFile instanceof Ci.nsILocalFile || aFile instanceof File))
+ if (!(aFile instanceof Ci.nsIFile || aFile instanceof File))
throw new Error("aFile is not a file object");
if (typeof(aCallback) != "function")
throw new Error("Invalid value for aCallback");
// We guarantee not to throw directly for any other exceptions, and always
// call aCallback.
Services.tm.dispatchToMainThread(() => {
let self = this;
@@ -106,17 +106,17 @@ this.PropertyListUtils = Object.freeze({
aCallback(root);
}
}
fileReader.addEventListener("loadend", onLoadEnd);
fileReader.readAsArrayBuffer(aFile);
}
try {
- if (aFile instanceof Ci.nsILocalFile) {
+ if (aFile instanceof Ci.nsIFile) {
if (!aFile.exists()) {
throw new Error("The file pointed by aFile does not exist");
}
File.createFromNsIFile(aFile).then(function(aFile) {
readDOMFile(aFile);
});
return;
--- a/toolkit/modules/subprocess/test/xpcshell/test_subprocess.js
+++ b/toolkit/modules/subprocess/test/xpcshell/test_subprocess.js
@@ -524,17 +524,17 @@ add_task(async function test_subprocess_
},
"Subprocess.call should fail for a bad executable");
});
add_task(async function test_subprocess_workdir() {
let procDir = await OS.File.getCurrentDirectory();
let tmpDirFile = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
+ .createInstance(Components.interfaces.nsIFile);
tmpDirFile.initWithPath(OS.Constants.Path.tmpDir);
tmpDirFile.normalize();
let tmpDir = tmpDirFile.path;
notEqual(procDir, tmpDir,
"Current process directory must not be the current temp directory");
async function pwd(options) {
--- a/toolkit/modules/tests/xpcshell/test_FileUtils.js
+++ b/toolkit/modules/tests/xpcshell/test_FileUtils.js
@@ -210,17 +210,17 @@ add_test(function test_openSafeFileOutpu
add_test(function test_closeSafeFileOutputStream() {
closeFileOutputStream("safe", "georgee");
});
add_test(function test_newFile() {
let testfile = FileUtils.getFile("ProfD", ["test"]);
let testpath = testfile.path;
let file = new FileUtils.File(testpath);
- do_check_true(file instanceof Components.interfaces.nsILocalFile);
+ do_check_true(file instanceof Components.interfaces.nsIFile);
do_check_true(file.equals(testfile));
do_check_eq(file.path, testpath);
run_next_test();
});
function run_test() {
run_next_test();
}
--- a/toolkit/mozapps/downloads/DownloadPaths.jsm
+++ b/toolkit/mozapps/downloads/DownloadPaths.jsm
@@ -9,18 +9,18 @@ this.EXPORTED_SYMBOLS = [
];
/**
* This module provides the DownloadPaths object which contains methods for
* giving names and paths to files being downloaded.
*
* List of methods:
*
- * nsILocalFile
- * createNiceUniqueFile(nsILocalFile aLocalFile)
+ * nsIFile
+ * createNiceUniqueFile(nsIFile aLocalFile)
*
* [string base, string ext]
* splitBaseNameAndExtension(string aLeafName)
*/
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
@@ -32,25 +32,25 @@ this.DownloadPaths = {
* If a file with the provided name already exists, the function attempts to
* create nice alternatives, like "base(1).ext" (instead of "base-1.ext").
*
* If a unique name cannot be found, the function throws the XPCOM exception
* NS_ERROR_FILE_TOO_BIG. Other exceptions, like NS_ERROR_FILE_ACCESS_DENIED,
* can also be expected.
*
* @param aTemplateFile
- * nsILocalFile whose leaf name is going to be used as a template. The
+ * nsIFile whose leaf name is going to be used as a template. The
* provided object is not modified.
- * @returns A new instance of an nsILocalFile object pointing to the newly
+ * @returns A new instance of an nsIFile object pointing to the newly
* created empty file. On platforms that support permission bits, the
* file is created with permissions 644.
*/
createNiceUniqueFile: function DP_createNiceUniqueFile(aTemplateFile) {
// Work on a clone of the provided template file object.
- var curFile = aTemplateFile.clone().QueryInterface(Ci.nsILocalFile);
+ var curFile = aTemplateFile.clone().QueryInterface(Ci.nsIFile);
var [base, ext] = DownloadPaths.splitBaseNameAndExtension(curFile.leafName);
// Try other file names, for example "base(1).txt" or "base(1).tar.gz",
// only if the file name initially set already exists.
for (let i = 1; i < 10000 && curFile.exists(); i++) {
curFile.leafName = base + "(" + i + ")" + ext;
}
// At this point we hand off control to createUnique, which will create the
// file with the name we chose, if it is valid. If not, createUnique will
--- a/toolkit/mozapps/downloads/nsHelperAppDlg.js
+++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js
@@ -336,17 +336,17 @@ nsUnknownContentTypeDialog.prototype = {
if (result.exists() && this.getFinalLeafName(result.leafName) == result.leafName)
result.remove(false);
}
catch (ex) {
// As it turns out, the failure to remove the file, for example due to
// permission error, will be handled below eventually somehow.
}
- var newDir = result.parent.QueryInterface(Components.interfaces.nsILocalFile);
+ var newDir = result.parent.QueryInterface(Components.interfaces.nsIFile);
// Do not store the last save directory as a pref inside the private browsing mode
gDownloadLastDir.setFile(aLauncher.source, newDir);
try {
result = this.validateLeafName(newDir, result.leafName, null);
}
catch (ex) {
@@ -388,17 +388,17 @@ nsUnknownContentTypeDialog.prototype = {
* @param aLocalFolder
* the folder where the file resides
* @param aLeafName
* the string name of the file (may be empty if no name is known,
* in which case a name will be chosen)
* @param aFileExt
* the extension of the file, if one is known; this will be ignored
* if aLeafName is non-empty
- * @return nsILocalFile
+ * @return nsIFile
* the created file
* @throw an error such as permission doesn't allow creation of
* file, etc.
*/
validateLeafName: function (aLocalFolder, aLeafName, aFileExt)
{
if (!(aLocalFolder && isUsableDirectory(aLocalFolder))) {
throw new Components.Exception("Destination directory non-existing or permission error",
@@ -917,17 +917,17 @@ nsUnknownContentTypeDialog.prototype = {
// for the file to be saved to to pass to |saveToDisk| - otherwise
// we must ask the user to pick a save name.
/*
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var targetFile = null;
try {
targetFile = prefs.getComplexValue("browser.download.defaultFolder",
- Components.interfaces.nsILocalFile);
+ Components.interfaces.nsIFile);
var leafName = this.dialogElement("location").getAttribute("realname");
// Ensure that we don't overwrite any existing files here.
targetFile = this.validateLeafName(targetFile, leafName, null);
}
catch(e) { }
this.mLauncher.saveToDisk(targetFile, false);
*/
--- a/toolkit/mozapps/extensions/internal/GMPProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/GMPProvider.jsm
@@ -568,17 +568,17 @@ var GMPProvider = {
this._log.warn("startup - adding gmp directory failed with " +
e.name + " - sandboxing not available?", e);
}
}
}
try {
let greDir = Services.dirsvc.get(NS_GRE_DIR,
- Ci.nsILocalFile);
+ Ci.nsIFile);
let clearkeyPath = OS.Path.join(greDir.path,
CLEARKEY_PLUGIN_ID,
CLEARKEY_VERSION);
this._log.info("startup - adding clearkey CDM directory " +
clearkeyPath);
gmpService.addPluginDirectory(clearkeyPath);
} catch (e) {
this._log.warn("startup - adding clearkey CDM failed", e);
--- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
@@ -1189,17 +1189,17 @@ function interpolateAndServeFile(request
/**
* Sets up a path handler for the given URL and saves the
* corresponding file in the global url -> file map.
*
* @param url
* the actual URL
* @param file
- * nsILocalFile representing a static file
+ * nsIFile representing a static file
*/
function mapUrlToFile(url, file, server) {
server.registerPathHandler(url, interpolateAndServeFile);
gUrlToFileMap[url] = file;
}
function mapFile(path, server) {
mapUrlToFile(path, do_get_file(path), server);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_plugins.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_plugins.js
@@ -34,17 +34,17 @@ function run_test() {
run_test_1();
}
// Finds the test plugin library
function get_test_plugin() {
var pluginEnum = Services.dirsvc.get("APluginsDL", AM_Ci.nsISimpleEnumerator);
while (pluginEnum.hasMoreElements()) {
- let dir = pluginEnum.getNext().QueryInterface(AM_Ci.nsILocalFile);
+ let dir = pluginEnum.getNext().QueryInterface(AM_Ci.nsIFile);
let plugin = dir.clone();
// OSX plugin
plugin.append("npswftest.plugin");
if (plugin.exists()) {
plugin.normalize();
return plugin;
}
plugin = dir.clone();
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -211,18 +211,18 @@ XPCOMUtils.defineLazyGetter(this, "gCert
/**
* Tests to make sure that we can write to a given directory.
*
* @param updateTestFile a test file in the directory that needs to be tested.
* @param createDirectory whether a test directory should be created.
* @throws if we don't have right access to the directory.
*/
function testWriteAccess(updateTestFile, createDirectory) {
- const NORMAL_FILE_TYPE = Ci.nsILocalFile.NORMAL_FILE_TYPE;
- const DIRECTORY_TYPE = Ci.nsILocalFile.DIRECTORY_TYPE;
+ const NORMAL_FILE_TYPE = Ci.nsIFile.NORMAL_FILE_TYPE;
+ const DIRECTORY_TYPE = Ci.nsIFile.DIRECTORY_TYPE;
if (updateTestFile.exists())
updateTestFile.remove(false);
updateTestFile.create(createDirectory ? DIRECTORY_TYPE : NORMAL_FILE_TYPE,
createDirectory ? FileUtils.PERMS_DIRECTORY : FileUtils.PERMS_FILE);
updateTestFile.remove(false);
}
/**
@@ -291,17 +291,17 @@ function getPerInstallationMutexName(aGl
if (AppConstants.platform != "win") {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
}
let hasher = Cc["@mozilla.org/security/hash;1"].
createInstance(Ci.nsICryptoHash);
hasher.init(hasher.SHA1);
- let exeFile = Services.dirsvc.get(KEY_EXECUTABLE, Ci.nsILocalFile);
+ let exeFile = Services.dirsvc.get(KEY_EXECUTABLE, Ci.nsIFile);
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
var data = converter.convertToByteArray(exeFile.path.toLowerCase());
hasher.update(data, data.length);
return (aGlobal ? "Global\\" : "") + "MozillaUpdateMutex-" + hasher.finish(true);
@@ -419,17 +419,17 @@ function getCanApplyUpdates() {
if (!userCanElevate) {
// if we're unable to create the test file this will throw an exception.
let appDirTestFile = getAppBaseDir();
appDirTestFile.append(FILE_UPDATE_TEST);
LOG("getCanApplyUpdates - testing write access " + appDirTestFile.path);
if (appDirTestFile.exists()) {
appDirTestFile.remove(false);
}
- appDirTestFile.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
+ appDirTestFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
appDirTestFile.remove(false);
}
}
} catch (e) {
LOG("getCanApplyUpdates - unable to apply updates. Exception: " + e);
// No write access to the installation directory
return false;
}
@@ -465,17 +465,17 @@ XPCOMUtils.defineLazyGetter(this, "gCanS
if (AppConstants.platform != "macosx") {
// On all platforms except Mac, we need to test the parent directory as
// well, as we need to be able to move files in that directory during the
// replacing step.
updateTestFile = getInstallDirRoot().parent;
updateTestFile.append(FILE_UPDATE_TEST);
LOG("gCanStageUpdatesSession - testing write access " +
updateTestFile.path);
- updateTestFile.createUnique(Ci.nsILocalFile.DIRECTORY_TYPE,
+ updateTestFile.createUnique(Ci.nsIFile.DIRECTORY_TYPE,
FileUtils.PERMS_DIRECTORY);
updateTestFile.remove(false);
}
} catch (e) {
LOG("gCanStageUpdatesSession - unable to stage updates. Exception: " +
e);
// No write privileges
return false;
@@ -2637,17 +2637,17 @@ UpdateManager.prototype = {
* The nsIFile object to serialize to
*/
_writeUpdatesToXMLFile: function UM__writeUpdatesToXMLFile(updates, file) {
var fos = Cc["@mozilla.org/network/safe-file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
var modeFlags = FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE |
FileUtils.MODE_TRUNCATE;
if (!file.exists()) {
- file.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
+ file.create(Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
}
fos.init(file, modeFlags, FileUtils.PERMS_FILE, 0);
try {
var parser = Cc["@mozilla.org/xmlextras/domparser;1"].
createInstance(Ci.nsIDOMParser);
const EMPTY_UPDATES_DOCUMENT = "<?xml version=\"1.0\"?><updates xmlns=\"http://www.mozilla.org/2005/app-update\"></updates>";
var doc = parser.parseFromString(EMPTY_UPDATES_DOCUMENT, "text/xml");
--- a/toolkit/mozapps/update/tests/browser/head.js
+++ b/toolkit/mozapps/update/tests/browser/head.js
@@ -341,17 +341,17 @@ function moveRealUpdater() {
* since Windows debug builds at times leave the file in use. After success it
* will call runTest to continue the test.
*/
function copyTestUpdater(attempt = 0) {
return (async function() {
try {
// Copy the test updater
let baseAppDir = getAppBaseDir();
- let testUpdaterDir = Services.dirsvc.get("CurWorkD", Ci.nsILocalFile);
+ let testUpdaterDir = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
let relPath = REL_PATH_DATA;
let pathParts = relPath.split("/");
for (let i = 0; i < pathParts.length; ++i) {
testUpdaterDir.append(pathParts[i]);
}
let testUpdater = testUpdaterDir.clone();
testUpdater.append(FILE_UPDATER_BIN);
--- a/toolkit/mozapps/update/tests/chrome/update.sjs
+++ b/toolkit/mozapps/update/tests/chrome/update.sjs
@@ -5,17 +5,17 @@
/**
* Server side http server script for application update tests.
*/
const { classes: Cc, interfaces: Ci } = Components;
function getTestDataFile(aFilename) {
let file = Cc["@mozilla.org/file/directory_service;1"].
- getService(Ci.nsIProperties).get("CurWorkD", Ci.nsILocalFile);
+ getService(Ci.nsIProperties).get("CurWorkD", Ci.nsIFile);
let pathParts = REL_PATH_DATA.split("/");
for (let i = 0; i < pathParts.length; ++i) {
file.append(pathParts[i]);
}
if (aFilename) {
file.append(aFilename);
}
return file;
@@ -24,17 +24,17 @@ function getTestDataFile(aFilename) {
function loadHelperScript(aScriptFile) {
let io = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService2);
let scriptSpec = io.newFileURI(aScriptFile).spec;
let scriptloader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
scriptloader.loadSubScript(scriptSpec, this);
}
-var scriptFile = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile);
+var scriptFile = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
scriptFile.initWithPath(getState("__LOCATION__"));
scriptFile = scriptFile.parent;
scriptFile.append("testConstants.js");
loadHelperScript(scriptFile);
scriptFile = getTestDataFile("sharedUpdateXML.js");
loadHelperScript(scriptFile);
--- a/toolkit/mozapps/update/tests/chrome/utils.js
+++ b/toolkit/mozapps/update/tests/chrome/utils.js
@@ -472,22 +472,22 @@ function delayedDefaultCallback() {
gTest.extraDelayedFinishFunction();
}
}
/**
* Gets the continue file used to signal the mock http server to continue
* downloading for slow download mar file tests without creating it.
*
- * @return nsILocalFile for the continue file.
+ * @return nsIFile for the continue file.
*/
function getContinueFile() {
let continueFile = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties).
- get("CurWorkD", Ci.nsILocalFile);
+ get("CurWorkD", Ci.nsIFile);
let continuePath = REL_PATH_DATA + "continue";
let continuePathParts = continuePath.split("/");
for (let i = 0; i < continuePathParts.length; ++i) {
continueFile.append(continuePathParts[i]);
}
return continueFile;
}
@@ -724,17 +724,17 @@ function moveRealUpdater() {
* Copies the test updater so it can be used by tests and tries again on failure
* since Windows debug builds at times leave the file in use. After success it
* will call runTest to continue the test.
*/
function copyTestUpdater() {
try {
// Copy the test updater
let baseAppDir = getAppBaseDir();
- let testUpdaterDir = Services.dirsvc.get("CurWorkD", Ci.nsILocalFile);
+ let testUpdaterDir = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
let relPath = REL_PATH_DATA;
let pathParts = relPath.split("/");
for (let i = 0; i < pathParts.length; ++i) {
testUpdaterDir.append(pathParts[i]);
}
let testUpdater = testUpdaterDir.clone();
testUpdater.append(FILE_UPDATER_BIN);
--- a/toolkit/mozapps/update/tests/data/shared.js
+++ b/toolkit/mozapps/update/tests/data/shared.js
@@ -275,17 +275,17 @@ function getUpdatesPatchDir() {
* @param aText
* The text to write to the file. If there is existing text it will be
* replaced.
*/
function writeFile(aFile, aText) {
let fos = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
if (!aFile.exists()) {
- aFile.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_FILE);
+ aFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, PERMS_FILE);
}
fos.init(aFile, MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE, PERMS_FILE, 0);
fos.write(aText, aText.length);
fos.close();
}
/**
* Reads the current update operation/state in the status file in the patch
--- a/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
+++ b/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
@@ -841,17 +841,17 @@ function setupTestCommon() {
// This prevents a warning about not being able to find the greprefs.js file
// from being logged.
let grePrefsFile = getGREDir();
if (!grePrefsFile.exists()) {
grePrefsFile.create(Ci.nsIFile.DIRECTORY_TYPE, PERMS_DIRECTORY);
}
grePrefsFile.append("greprefs.js");
if (!grePrefsFile.exists()) {
- grePrefsFile.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_FILE);
+ grePrefsFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, PERMS_FILE);
}
// Remove the updates directory on Windows and Mac OS X which is located
// outside of the application directory after the call to adjustGeneralPaths
// has set it up. Since the test hasn't ran yet and the directory shouldn't
// exist this is non-fatal for the test.
if (IS_WIN || IS_MACOSX) {
let updatesDir = getMockUpdRootD();
@@ -1282,22 +1282,22 @@ function getMaintSvcDir() {
if (!maintSvcDir) {
do_throw("Unable to find the maintenance service install directory");
}
return maintSvcDir;
}
/**
- * Get the nsILocalFile for a Windows special folder determined by the CSIDL
+ * Get the nsIFile for a Windows special folder determined by the CSIDL
* passed.
*
* @param aCSIDL
* The CSIDL for the Windows special folder.
- * @return The nsILocalFile for the Windows special folder.
+ * @return The nsIFile for the Windows special folder.
* @throws If called from a platform other than Windows.
*/
function getSpecialFolderDir(aCSIDL) {
if (!IS_WIN) {
do_throw("Windows only function called by a different platform!");
}
let lib = ctypes.open("shell32");
@@ -1313,17 +1313,17 @@ function getSpecialFolderDir(aCSIDL) {
SHGetSpecialFolderPath(0, aryPath, aCSIDL, false);
lib.close();
let path = aryPath.readString(); // Convert the c-string to js-string
if (!path) {
return null;
}
debugDump("SHGetSpecialFolderPath returned path: " + path);
- let dir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ let dir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
dir.initWithPath(path);
return dir;
}
XPCOMUtils.defineLazyGetter(this, "gInstallDirPathHash", function test_gIDPH() {
if (!IS_WIN) {
do_throw("Windows only function called by a different platform!");
}
@@ -1436,27 +1436,27 @@ function getMockUpdRootDWin() {
relPathUpdates += MOZ_APP_VENDOR + "\\" + MOZ_APP_BASENAME;
} else {
relPathUpdates += MOZ_APP_BASENAME;
}
relPathUpdates += "\\" + MOZ_APP_NAME;
}
let updatesDir = Cc["@mozilla.org/file/local;1"].
- createInstance(Ci.nsILocalFile);
+ createInstance(Ci.nsIFile);
updatesDir.initWithPath(localAppDataDir.path + "\\" + relPathUpdates);
return updatesDir;
}
XPCOMUtils.defineLazyGetter(this, "gUpdatesRootDir", function test_gURD() {
if (!IS_MACOSX) {
do_throw("Mac OS X only function called by a different platform!");
}
- let dir = Services.dirsvc.get("ULibDir", Ci.nsILocalFile);
+ let dir = Services.dirsvc.get("ULibDir", Ci.nsIFile);
dir.append("Caches");
if (MOZ_APP_VENDOR || MOZ_APP_BASENAME) {
dir.append(MOZ_APP_VENDOR ? MOZ_APP_VENDOR : MOZ_APP_BASENAME);
} else {
dir.append("Mozilla");
}
dir.append(DIR_UPDATES);
return dir;
@@ -1475,17 +1475,17 @@ function getMockUpdRootDMac() {
let appDir = Services.dirsvc.get(XRE_EXECUTABLE_FILE, Ci.nsIFile).
parent.parent.parent;
let appDirPath = appDir.path;
appDirPath = appDirPath.substr(0, appDirPath.length - 4);
let pathUpdates = gUpdatesRootDir.path + appDirPath;
let updatesDir = Cc["@mozilla.org/file/local;1"].
- createInstance(Ci.nsILocalFile);
+ createInstance(Ci.nsIFile);
updatesDir.initWithPath(pathUpdates);
return updatesDir;
}
/**
* Creates an update in progress lock file in the specified directory on
* Windows.
*
@@ -2251,17 +2251,17 @@ function copyFileToTestAppDir(aFileRelPa
", Exception: " + ex);
}
}
} else {
try {
if (destFile.exists()) {
destFile.remove(false);
}
- let ln = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ let ln = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
ln.initWithPath("/bin/ln");
let process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
process.init(ln);
let args = ["-s", srcFile.path, destFile.path];
process.run(true, args, args.length);
Assert.ok(destFile.isSymlink(),
destFile.leafName + " should be a symlink");
} catch (e) {
@@ -2405,17 +2405,17 @@ function waitForApplicationStop(aApplica
function getLaunchBin() {
let launchBin;
if (IS_WIN) {
launchBin = Services.dirsvc.get("WinD", Ci.nsIFile);
launchBin.append("System32");
launchBin.append("cmd.exe");
} else {
launchBin = Cc["@mozilla.org/file/local;1"].
- createInstance(Ci.nsILocalFile);
+ createInstance(Ci.nsIFile);
launchBin.initWithPath("/bin/sh");
}
Assert.ok(launchBin.exists(),
MSG_SHOULD_EXIST + getMsgPath(launchBin.path));
return launchBin;
}
@@ -3695,17 +3695,17 @@ function getProcessArgs(aExtraArgs) {
if (/ /.test(appBinPath)) {
appBinPath = '"' + appBinPath + '"';
}
let args;
if (IS_UNIX) {
let launchScript = getLaunchScript();
// Precreate the script with executable permissions
- launchScript.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_DIRECTORY);
+ launchScript.create(Ci.nsIFile.NORMAL_FILE_TYPE, PERMS_DIRECTORY);
let scriptContents = "#! /bin/sh\n";
scriptContents += appBinPath + " -no-remote -test-process-updates " +
aExtraArgs.join(" ") + " " + PIPE_TO_NULL;
writeFile(launchScript, scriptContents);
debugDump("created " + launchScript.path + " containing:\n" +
scriptContents);
args = [launchScript.path];
@@ -3987,17 +3987,17 @@ function setEnvironment() {
debugDump("setting the XRE_NO_WINDOWS_CRASH_DIALOG environment " +
"variable to 1... previously it didn't exist");
gEnv.set("XRE_NO_WINDOWS_CRASH_DIALOG", "1");
}
if (IS_UNIX) {
let appGreBinDir = gGREBinDirOrig.clone();
let envGreBinDir = Cc["@mozilla.org/file/local;1"].
- createInstance(Ci.nsILocalFile);
+ createInstance(Ci.nsIFile);
let shouldSetEnv = true;
if (IS_MACOSX) {
if (gEnv.exists("DYLD_LIBRARY_PATH")) {
gEnvDyldLibraryPath = gEnv.get("DYLD_LIBRARY_PATH");
envGreBinDir.initWithPath(gEnvDyldLibraryPath);
if (envGreBinDir.path == appGreBinDir.path) {
gEnvDyldLibraryPath = null;
shouldSetEnv = false;
--- a/toolkit/mozapps/update/tests/unit_aus_update/canCheckForAndCanApplyUpdates.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/canCheckForAndCanApplyUpdates.js
@@ -64,17 +64,17 @@ function getPerInstallationMutexName() {
if (!IS_WIN) {
do_throw("Windows only function called by a different platform!");
}
let hasher = Cc["@mozilla.org/security/hash;1"].
createInstance(Ci.nsICryptoHash);
hasher.init(hasher.SHA1);
- let exeFile = Services.dirsvc.get(XRE_EXECUTABLE_FILE, Ci.nsILocalFile);
+ let exeFile = Services.dirsvc.get(XRE_EXECUTABLE_FILE, Ci.nsIFile);
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
let data = converter.convertToByteArray(exeFile.path.toLowerCase());
hasher.update(data, data.length);
return "Global\\MozillaUpdateMutex-" + hasher.finish(true);
--- a/toolkit/xre/test/test_launch_without_hang.js
+++ b/toolkit/xre/test/test_launch_without_hang.js
@@ -61,22 +61,22 @@ function getFirefoxExecutableFile() {
// Takes an executable and arguments, and wraps it in a call to the system shell.
// Technique adapted from \toolkit\mozapps\update\tests\unit_service_updater\xpcshellUtilsAUS.js
// to avoid child process console output polluting the xpcshell log.
// returns { file: (nsIFile), args: [] }
function wrapLaunchInShell(file, args) {
let ret = { };
if (AppConstants.platform === "win") {
- ret.file = Services.dirsvc.get("WinD", Ci.nsILocalFile);
+ ret.file = Services.dirsvc.get("WinD", Ci.nsIFile);
ret.file.append("System32");
ret.file.append("cmd.exe");
ret.args = ["/D", "/Q", "/C", file.path].concat(args).concat([">nul"]);
} else {
- ret.file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ ret.file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
ret.file.initWithPath("/usr/bin/env");
ret.args = [file.path].concat(args).concat(["> /dev/null"]);
}
Assert.ok(ret.file.exists(), "Executable file should exist: " + ret.file.path);
return ret;
}
@@ -84,22 +84,22 @@ function wrapLaunchInShell(file, args) {
// Needed because process.kill() kills the console, not its child process, firefox.
function terminateFirefox(completion) {
let executableName = getFirefoxExecutableFilename();
let file;
let args;
if (AppConstants.platform === "win") {
- file = Services.dirsvc.get("WinD", Ci.nsILocalFile);
+ file = Services.dirsvc.get("WinD", Ci.nsIFile);
file.append("System32");
file.append("taskkill.exe");
args = ["/F", "/IM", executableName];
} else {
- file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath("/usr/bin/killall");
args = [executableName];
}
do_print("launching application: " + file.path);
do_print(" with args: " + args.join(" "));
let process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
--- a/uriloader/exthandler/nsHandlerService.js
+++ b/uriloader/exthandler/nsHandlerService.js
@@ -618,31 +618,31 @@ HandlerService.prototype = {
/**
* Get the file with the given path. This is not as simple as merely
* initializing a local file object with the path, because the path might be
* relative to the current process directory, in which case we have to
* construct a path starting from that directory.
*
* @param aPath {string} a path to a file
*
- * @returns {nsILocalFile} the file, or null if the file does not exist
+ * @returns {nsIFile} the file, or null if the file does not exist
*/
_getFileWithPath: function HS__getFileWithPath(aPath) {
- var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
try {
file.initWithPath(aPath);
if (file.exists())
return file;
}
catch(ex) {
// Note: for historical reasons, we don't actually check to see
// if the exception is NS_ERROR_FILE_UNRECOGNIZED_PATH, which is what
- // nsILocalFile::initWithPath throws when a path is relative.
+ // nsIFile::initWithPath throws when a path is relative.
file = this._dirSvc.get("XCurProcD", Ci.nsIFile);
try {
file.append(aPath);
if (file.exists())
return file;
}
--- a/uriloader/exthandler/tests/mochitest/handlerApps.js
+++ b/uriloader/exthandler/tests/mochitest/handlerApps.js
@@ -49,17 +49,17 @@ function test() {
// get a local app that we know will be there and do something sane
var osString = Cc["@mozilla.org/xre/app-info;1"].
getService(SpecialPowers.Ci.nsIXULRuntime).OS;
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(SpecialPowers.Ci.nsIDirectoryServiceProvider);
if (osString == "WINNT") {
var windowsDir = dirSvc.getFile("WinD", {});
- var exe = windowsDir.clone().QueryInterface(SpecialPowers.Ci.nsILocalFile);
+ var exe = windowsDir.clone().QueryInterface(SpecialPowers.Ci.nsIFile);
exe.appendRelativePath("SYSTEM32\\HOSTNAME.EXE");
} else if (osString == "Darwin") {
var localAppsDir = dirSvc.getFile("LocApp", {});
exe = localAppsDir.clone();
exe.append("iCal.app"); // lingers after the tests finish, but this seems
// seems better than explicitly killing it, since
// developers who run the tests locally may well
@@ -67,38 +67,38 @@ function test() {
if (navigator.userAgent.match(/ SeaMonkey\//)) {
// SeaMonkey tinderboxes don't like to have iCal lingering (and focused)
// on next test suite run(s).
todo(false, "On SeaMonkey, testing OS X as generic Unix. (Bug 749872)");
// assume a generic UNIX variant
exe = Cc["@mozilla.org/file/local;1"].
- createInstance(SpecialPowers.Ci.nsILocalFile);
+ createInstance(SpecialPowers.Ci.nsIFile);
exe.initWithPath("/bin/echo");
}
} else {
// assume a generic UNIX variant
exe = Cc["@mozilla.org/file/local;1"].
- createInstance(SpecialPowers.Ci.nsILocalFile);
+ createInstance(SpecialPowers.Ci.nsIFile);
exe.initWithPath("/bin/echo");
}
localHandler.executable = exe;
localHandler.launchWithURI(ioService.newURI(testURI));
// if we get this far without an exception, we've passed
ok(true, "localHandler launchWithURI test");
// if we ever decide that killing iCal is the right thing to do, change
// the if statement below from "NOTDarwin" to "Darwin"
if (osString == "NOTDarwin") {
var killall = Cc["@mozilla.org/file/local;1"].
- createInstance(SpecialPowers.Ci.nsILocalFile);
+ createInstance(SpecialPowers.Ci.nsIFile);
killall.initWithPath("/usr/bin/killall");
var process = Cc["@mozilla.org/process/util;1"].
createInstance(SpecialPowers.Ci.nsIProcess);
process.init(killall);
var args = ['iCal'];
process.run(false, args, args.length);
--- a/xpcom/tests/unit/test_bug364285-1.js
+++ b/xpcom/tests/unit/test_bug364285-1.js
@@ -10,17 +10,17 @@ var nameArray = [
"\uD55C\uAD6D\uC5B4", // Korean
"\uD801\uDC0F\uD801\uDC2D\uD801\uDC3B\uD801\uDC2B" // Deseret
];
function getTempDir()
{
var dirService = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties);
- return dirService.get("TmpD", Ci.nsILocalFile);
+ return dirService.get("TmpD", Ci.nsIFile);
}
function create_file(fileName)
{
var outFile = getTempDir();
outFile.append(fileName);
outFile.createUnique(outFile.NORMAL_FILE_TYPE, 0o600);
--- a/xpcom/tests/unit/test_bug476919.js
+++ b/xpcom/tests/unit/test_bug476919.js
@@ -11,17 +11,17 @@ function run_test() {
if (!targetFile.exists())
targetFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o644);
var link = testDir.clone();
link.append("link");
if (link.exists())
link.remove(false);
- var ln = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ var ln = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
ln.initWithPath("/bin/ln");
var process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
process.init(ln);
var args = ["-s", targetFile.path, link.path];
process.run(true, args, args.length);
do_check_true(link.isSymlink());
}
}
--- a/xpcom/tests/unit/test_bug478086.js
+++ b/xpcom/tests/unit/test_bug478086.js
@@ -1,24 +1,24 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/ */
function run_test() {
- var nsILocalFile = Components.interfaces.nsILocalFile;
+ var nsIFile = Components.interfaces.nsIFile;
var root = Components.classes["@mozilla.org/file/local;1"].
- createInstance(nsILocalFile);
+ createInstance(nsIFile);
// copied from http://mxr.mozilla.org/mozilla-central/source/image/test/unit/test_imgtools.js#135
// nsIXULRuntime.OS doesn't seem to be available in xpcshell, so we'll use
// this as a kludgy way to figure out if we're running on Windows.
if (mozinfo.os == "win") {
root.initWithPath("\\\\.");
} else {
return; // XXX disabled, since this causes intermittent failures on Mac (bug 481369).
root.initWithPath("/");
}
var drives = root.directoryEntries;
do_check_true(drives.hasMoreElements());
while (drives.hasMoreElements()) {
- var newPath = drives.getNext().QueryInterface(nsILocalFile).path;
+ var newPath = drives.getNext().QueryInterface(nsIFile).path;
do_check_eq(newPath.indexOf("\0"), -1);
}
}
--- a/xpcom/tests/unit/test_file_equality.js
+++ b/xpcom/tests/unit/test_file_equality.js
@@ -3,28 +3,28 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var Cr = Components.results;
var Ci = Components.interfaces;
var CC = Components.Constructor;
-var LocalFile = CC("@mozilla.org/file/local;1", "nsILocalFile", "initWithPath");
+var LocalFile = CC("@mozilla.org/file/local;1", "nsIFile", "initWithPath");
function run_test()
{
test_normalized_vs_non_normalized();
}
function test_normalized_vs_non_normalized()
{
// get a directory that exists on all platforms
var dirProvider = Components.classes["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
- var tmp1 = dirProvider.get("TmpD", Ci.nsILocalFile);
+ var tmp1 = dirProvider.get("TmpD", Ci.nsIFile);
var exists = tmp1.exists();
do_check_true(exists);
if (!exists)
return;
// the test logic below assumes we're starting with a normalized path, but the
// default location on macos is a symbolic link, so resolve it before starting
tmp1.normalize();
--- a/xpcom/tests/unit/test_file_renameTo.js
+++ b/xpcom/tests/unit/test_file_renameTo.js
@@ -6,17 +6,17 @@
var Cc = Components.classes;
var Ci = Components.interfaces;
function run_test()
{
// Create the base directory.
let base = Cc['@mozilla.org/file/directory_service;1']
.getService(Ci.nsIProperties)
- .get('TmpD', Ci.nsILocalFile);
+ .get('TmpD', Ci.nsIFile);
base.append('renameTesting');
if (base.exists()) {
base.remove(true);
}
base.create(Ci.nsIFile.DIRECTORY_TYPE, parseInt('0777', 8));
// Create a sub directory under the base.
let subdir = base.clone();
--- a/xpcom/tests/unit/test_home.js
+++ b/xpcom/tests/unit/test_home.js
@@ -1,24 +1,24 @@
var Ci = Components.interfaces;
var Cc = Components.classes;
const CWD = do_get_cwd();
function checkOS(os) {
- const nsILocalFile_ = "nsILocalFile" + os;
+ const nsILocalFile_ = "nsIFile" + os;
return nsILocalFile_ in Components.interfaces &&
CWD instanceof Components.interfaces[nsILocalFile_];
}
const isWin = checkOS("Win");
function run_test() {
var envVar = isWin ? "USERPROFILE" : "HOME";
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
var homeDir = dirSvc.get("Home", Ci.nsIFile);
var env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
- var expected = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
+ var expected = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
expected.initWithPath(env.get(envVar));
do_check_eq(homeDir.path, expected.path);
}
--- a/xpcom/tests/unit/test_localfile.js
+++ b/xpcom/tests/unit/test_localfile.js
@@ -6,17 +6,17 @@
var Cr = Components.results;
var CC = Components.Constructor;
var Ci = Components.interfaces;
const MAX_TIME_DIFFERENCE = 2500;
const MILLIS_PER_DAY = 1000 * 60 * 60 * 24;
-var LocalFile = CC("@mozilla.org/file/local;1", "nsILocalFile", "initWithPath");
+var LocalFile = CC("@mozilla.org/file/local;1", "nsIFile", "initWithPath");
function run_test()
{
test_toplevel_parent_is_null();
test_normalize_crash_if_media_missing();
test_file_modification_time();
test_directory_modification_time();
test_diskSpaceAvailable();
@@ -129,17 +129,17 @@ function test_directory_modification_tim
do_check_true(diff < MAX_TIME_DIFFERENCE);
dir.remove(true);
}
function test_diskSpaceAvailable()
{
let file = do_get_profile();
- file.QueryInterface(Ci.nsILocalFile);
+ file.QueryInterface(Ci.nsIFile);
let bytes = file.diskSpaceAvailable;
do_check_true(bytes > 0);
file.append("testfile");
if (file.exists())
file.remove(true);
file.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o644);
--- a/xpcom/tests/unit/test_symlinks.js
+++ b/xpcom/tests/unit/test_symlinks.js
@@ -12,17 +12,17 @@ const DANGLING_LINK = "dangling_link";
const LOOP_LINK = "loop_link";
const nsIFile = Components.interfaces.nsIFile;
var process;
function createSymLink(from, to) {
if (!process) {
var ln = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
+ .createInstance(Components.interfaces.nsIFile);
ln.initWithPath("/bin/ln");
process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
process.init(ln);
}
const args = ["-s", from, to];
--- a/xpcom/tests/unit/test_windows_shortcut.js
+++ b/xpcom/tests/unit/test_windows_shortcut.js
@@ -6,27 +6,27 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
var Cr = Components.results;
var Ci = Components.interfaces;
var Cc = Components.classes;
var Cu = Components.utils;
var CC = Components.Constructor;
-const LocalFile = CC("@mozilla.org/file/local;1", "nsILocalFile", "initWithPath");
+const LocalFile = CC("@mozilla.org/file/local;1", "nsIFile", "initWithPath");
Cu.import("resource://gre/modules/Services.jsm");
function run_test()
{
// This test makes sense only on Windows, so skip it on other platforms
if ("nsILocalFileWin" in Ci
&& do_get_cwd() instanceof Ci.nsILocalFileWin) {
- let tempDir = Services.dirsvc.get("TmpD", Ci.nsILocalFile);
+ let tempDir = Services.dirsvc.get("TmpD", Ci.nsIFile);
tempDir.append("shortcutTesting");
tempDir.createUnique(Ci.nsIFile.DIRECTORY_TYPE, 0o666);
test_create_noargs(tempDir);
test_create_notarget(tempDir);
test_create_targetonly(tempDir);
test_create_normal(tempDir);
test_create_unicode(tempDir);