forked from mirrors/gecko-dev
Bug 1403959, part 3 - Manually fix some xpcom/ eslint failures and enable it. r=froydnj
Renames are because another location also defined that variable. Unused definitions are eliminated. The .eslintrc.js file makes eslint expect XPCShell global variables. MozReview-Commit-ID: Fafm5o45bme --HG-- extra : rebase_source : ab71132a60e90bd30f34766bd828b18dd608f8b3
This commit is contained in:
parent
4ae455cdc5
commit
70333838d1
13 changed files with 32 additions and 29 deletions
|
|
@ -30,7 +30,6 @@ tools/update-packaging/**
|
|||
uriloader/**
|
||||
view/**
|
||||
widget/**
|
||||
xpcom/**
|
||||
|
||||
# We currently have no js files in these directories, so we ignore them by
|
||||
# default to aid ESLint's performance.
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<html>
|
||||
<body>
|
||||
<script>
|
||||
style = document.createElement("style");
|
||||
document.documentElement.appendChild(style);
|
||||
style.textContent = "tz\uDAB2 ";
|
||||
style = document.createElement("style"); // eslint-disable-line no-undef
|
||||
document.documentElement.appendChild(style); // eslint-disable-line no-undef
|
||||
style.textContent = "tz\uDAB2 "; // eslint-disable-line no-undef
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
7
xpcom/tests/unit/.eslintrc.js
Normal file
7
xpcom/tests/unit/.eslintrc.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"extends": [
|
||||
"plugin:mozilla/xpcshell-test"
|
||||
]
|
||||
};
|
||||
|
|
@ -54,11 +54,11 @@ function run_test() {
|
|||
|
||||
dataFile = do_get_file("data/bug121341-2.properties");
|
||||
|
||||
var channel = NetUtil.newChannel({
|
||||
var channel2 = NetUtil.newChannel({
|
||||
uri: ios.newFileURI(dataFile, null, null),
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
inp = channel.open2();
|
||||
inp = channel2.open2();
|
||||
|
||||
var properties2 = Components.classes["@mozilla.org/persistent-properties;1"].
|
||||
createInstance(Components.interfaces.nsIPersistentProperties);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ var nameArray = [
|
|||
|
||||
function getTempDir() {
|
||||
var dirService = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties);
|
||||
.getService(Ci.nsIProperties);
|
||||
return dirService.get("TmpD", Ci.nsIFile);
|
||||
}
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ function create_file(fileName) {
|
|||
outFile.createUnique(outFile.NORMAL_FILE_TYPE, 0o600);
|
||||
|
||||
var stream = Cc["@mozilla.org/network/file-output-stream;1"]
|
||||
.createInstance(Ci.nsIFileOutputStream);
|
||||
.createInstance(Ci.nsIFileOutputStream);
|
||||
stream.init(outFile, 0x02 | 0x08 | 0x20, 0o600, 0);
|
||||
stream.write("foo", 3);
|
||||
stream.close();
|
||||
|
|
@ -42,6 +42,6 @@ function test_create(fileName) {
|
|||
|
||||
function run_test() {
|
||||
for (var i = 0; i < nameArray.length; ++i) {
|
||||
test_create(nameArray[i]);
|
||||
test_create(nameArray[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
|
||||
/* global __LOCATION__ */
|
||||
|
||||
function run_test() {
|
||||
// skip this test on Windows
|
||||
if (mozinfo.os != "win") {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ function run_test() {
|
|||
root.initWithPath("\\\\.");
|
||||
} else {
|
||||
return; // XXX disabled, since this causes intermittent failures on Mac (bug 481369).
|
||||
root.initWithPath("/");
|
||||
// root.initWithPath("/");
|
||||
}
|
||||
var drives = root.directoryEntries;
|
||||
do_check_true(drives.hasMoreElements());
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
/* global registerAppManifest */
|
||||
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ function parserForFile(filename) {
|
|||
parser = factory.createINIParser(file);
|
||||
do_check_true(!!parser);
|
||||
} catch (e) {
|
||||
dump("INFO | caught error: " + e);
|
||||
dump("INFO | caught error: " + e);
|
||||
// checkParserOutput will handle a null parser when it's expected.
|
||||
}
|
||||
return parser;
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ function test_insert_at_beginning() {
|
|||
do_check_eq(str, obj);
|
||||
// check the data of all the other objects
|
||||
for (let i = 1; i < arr.length; i++) {
|
||||
let obj = arr.queryElementAt(i, Ci.nsISupportsString);
|
||||
do_check_eq("element " + (i - 1), obj.data);
|
||||
let obj2 = arr.queryElementAt(i, Ci.nsISupportsString);
|
||||
do_check_eq("element " + (i - 1), obj2.data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ function test_not_initialized() {
|
|||
.createInstance(Ci.nsIPipe);
|
||||
try {
|
||||
var dummy = p.outputStream;
|
||||
dump("dummy: " + dummy + "\n");
|
||||
throw Cr.NS_ERROR_FAILURE;
|
||||
} catch (e) {
|
||||
if (e.result != Cr.NS_ERROR_NOT_INITIALIZED)
|
||||
|
|
|
|||
|
|
@ -17,11 +17,6 @@ function test_multiplex_streams() {
|
|||
"nsIMultiplexInputStream");
|
||||
do_check_eq(1, 1);
|
||||
|
||||
var BinaryInputStream = Components.Constructor("@mozilla.org/binaryinputstream;1",
|
||||
"nsIBinaryInputStream");
|
||||
var BinaryOutputStream = Components.Constructor("@mozilla.org/binaryoutputstream;1",
|
||||
"nsIBinaryOutputStream",
|
||||
"setOutputStream");
|
||||
var multiplex = new MultiplexStream();
|
||||
for (var i = 0; i < count; ++i) {
|
||||
let s = Cc["@mozilla.org/io/string-input-stream;1"]
|
||||
|
|
@ -134,21 +129,16 @@ function test_multiplex_streams() {
|
|||
|
||||
function test_multiplex_bug797871() {
|
||||
|
||||
var data = "1234567890123456789012345678901234567890";
|
||||
var data2 = "1234567890123456789012345678901234567890";
|
||||
|
||||
var MultiplexStream = CC("@mozilla.org/io/multiplex-input-stream;1",
|
||||
"nsIMultiplexInputStream");
|
||||
do_check_eq(1, 1);
|
||||
|
||||
var BinaryInputStream = Components.Constructor("@mozilla.org/binaryinputstream;1",
|
||||
"nsIBinaryInputStream");
|
||||
var BinaryOutputStream = Components.Constructor("@mozilla.org/binaryoutputstream;1",
|
||||
"nsIBinaryOutputStream",
|
||||
"setOutputStream");
|
||||
var multiplex = new MultiplexStream();
|
||||
let s = Cc["@mozilla.org/io/string-input-stream;1"]
|
||||
.createInstance(Ci.nsIStringInputStream);
|
||||
s.setData(data, data.length);
|
||||
s.setData(data2, data2.length);
|
||||
|
||||
multiplex.appendStream(s);
|
||||
|
||||
|
|
@ -159,7 +149,7 @@ function test_multiplex_bug797871() {
|
|||
|
||||
seekable.seek(Ci.nsISeekableStream.NS_SEEK_SET, 8);
|
||||
do_check_eq(seekable.tell(), 8);
|
||||
readData = sis.read(2);
|
||||
sis.read(2);
|
||||
do_check_eq(seekable.tell(), 10);
|
||||
|
||||
seekable.seek(Ci.nsISeekableStream.NS_SEEK_SET, 20);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
* 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/. */
|
||||
|
||||
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "unusedVariable" }] */
|
||||
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cr = Components.results;
|
||||
|
|
@ -24,7 +26,7 @@ function test1() {
|
|||
.createInstance(Ci.nsIStorageStream);
|
||||
ss.init(1024, 1024, null);
|
||||
|
||||
var out = ss.getOutputStream(0);
|
||||
var unusedVariable = ss.getOutputStream(0);
|
||||
var inp2 = ss.newInputStream(0);
|
||||
do_check_eq(inp2.available(), 0);
|
||||
do_check_true(inp2.isNonBlocking());
|
||||
|
|
@ -59,7 +61,7 @@ function test2() {
|
|||
var out = ss.getOutputStream(0);
|
||||
out.write("", 0);
|
||||
try {
|
||||
var inp2 = ss.newInputStream(0);
|
||||
ss.newInputStream(0);
|
||||
} catch (e) {
|
||||
do_throw("shouldn't throw exception when new input stream created");
|
||||
}
|
||||
|
|
@ -87,7 +89,7 @@ function test3() {
|
|||
try {
|
||||
var threw = false;
|
||||
var bis = BIS(inp);
|
||||
var dummy = bis.readByteArray(5);
|
||||
bis.readByteArray(5);
|
||||
} catch (e) {
|
||||
if (e.result != Cr.NS_BASE_STREAM_WOULD_BLOCK)
|
||||
do_throw("wrong error thrown: " + e);
|
||||
|
|
|
|||
Loading…
Reference in a new issue