зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1770727 - Fix ESLint rule mozilla/use-services on sjs files and expose Services to sjs files. r=Gijs
Depends on D147080 Differential Revision: https://phabricator.services.mozilla.com/D147081
This commit is contained in:
Родитель
ef5633d319
Коммит
dac6401c3b
|
@ -101,7 +101,6 @@ module.exports = {
|
|||
"no-control-regex": "warn",
|
||||
"no-throw-literal": "warn",
|
||||
"no-useless-concat": "warn",
|
||||
"mozilla/use-services": "warn",
|
||||
"mozilla/use-includes-instead-of-indexOf": "warn",
|
||||
"mozilla/no-compare-against-boolean-literals": "warn",
|
||||
},
|
||||
|
|
|
@ -114,9 +114,7 @@ function parseXml(body) {
|
|||
}
|
||||
|
||||
function getInputStream(path) {
|
||||
let file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
let file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
for (let part of path.split("/")) {
|
||||
file.append(part);
|
||||
}
|
||||
|
|
|
@ -122,9 +122,7 @@ function getRequestBody(req) {
|
|||
}
|
||||
|
||||
function getInputStream(path) {
|
||||
let file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
let file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
for (let part of path.split("/")) {
|
||||
file.append(part);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,7 @@ 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 = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
const testHTMLFile = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
|
||||
const testHTMLFileStream = Cc[
|
||||
"@mozilla.org/network/file-input-stream;1"
|
||||
|
|
|
@ -31,9 +31,7 @@ var types = {
|
|||
function handleRequest(request, response) {
|
||||
var resource = parseQuery(request, "");
|
||||
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
var fis = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(
|
||||
Ci.nsIFileInputStream
|
||||
);
|
||||
|
|
|
@ -22,9 +22,7 @@ function handleRequest(request, response) {
|
|||
// Get the filename to send back.
|
||||
var filename = parseQuery(request, "file");
|
||||
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
var fis = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(
|
||||
Ci.nsIFileInputStream
|
||||
);
|
||||
|
|
|
@ -64,9 +64,7 @@ function handleRequest(request, response) {
|
|||
}
|
||||
var startOffset = parseInt(offsets[0]);
|
||||
var endOffset = parseInt(offsets[1]);
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
var fis = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(
|
||||
Ci.nsIFileInputStream
|
||||
);
|
||||
|
|
|
@ -25,9 +25,7 @@ function handleRequest(request, response) {
|
|||
var resource = getState(key) == "2" ? resource2 : resource1;
|
||||
setState(key, "2");
|
||||
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
var fis = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(
|
||||
Ci.nsIFileInputStream
|
||||
);
|
||||
|
|
|
@ -20,9 +20,7 @@ function handleRequest(request, response) {
|
|||
var redirected = parseQuery(query, "redirected") || false;
|
||||
var useCors = parseQuery(query, "cors") || false;
|
||||
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
var fis = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(
|
||||
Ci.nsIFileInputStream
|
||||
);
|
||||
|
|
|
@ -24,9 +24,7 @@ function handleRequest(request, response) {
|
|||
) {
|
||||
var name = parseQuery(request, "name");
|
||||
var type = parseQuery(request, "type");
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
var fis = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(
|
||||
Ci.nsIFileInputStream
|
||||
);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
function handleRequest(request, response) {
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
var fis = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(
|
||||
Ci.nsIFileInputStream
|
||||
);
|
||||
|
|
|
@ -7,9 +7,7 @@ var timer = Cc["@mozilla.org/timer;1"];
|
|||
var partTimer = timer.createInstance(Ci.nsITimer);
|
||||
|
||||
function getFileAsInputStream(aFilename) {
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
|
||||
file.append("tests");
|
||||
file.append("image");
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
function handleRequest(request, response) {
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
|
||||
file.append("tests");
|
||||
file.append("image");
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
function handleRequest(request, response) {
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
|
||||
file.append("tests");
|
||||
file.append("image");
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
function handleRequest(request, response) {
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
|
||||
file.append("tests");
|
||||
file.append("image");
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
function handleRequest(request, response) {
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
|
||||
file.append("tests");
|
||||
file.append("image");
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
function handleRequest(request, response) {
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
|
||||
file.append("tests");
|
||||
file.append("image");
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
function handleRequest(request, response) {
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
|
||||
file.append("tests");
|
||||
file.append("image");
|
||||
|
|
|
@ -28,9 +28,7 @@ var timer = Cc["@mozilla.org/timer;1"];
|
|||
var partTimer = timer.createInstance(Ci.nsITimer);
|
||||
|
||||
function getFileAsInputStream(aFilename) {
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
|
||||
file.append("tests");
|
||||
file.append("image");
|
||||
|
|
|
@ -6,9 +6,7 @@ var timer = Cc["@mozilla.org/timer;1"];
|
|||
var partTimer = timer.createInstance(Ci.nsITimer);
|
||||
|
||||
function getFileAsInputStream(aFilename) {
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
|
||||
file.append("tests");
|
||||
file.append("image");
|
||||
|
|
|
@ -8,9 +8,7 @@ var timer = Cc["@mozilla.org/timer;1"];
|
|||
var partTimer = timer.createInstance(Ci.nsITimer);
|
||||
|
||||
function getFileAsInputStream(aFilename) {
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties)
|
||||
.get("CurWorkD", Ci.nsIFile);
|
||||
var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
|
||||
file.append("tests");
|
||||
file.append("image");
|
||||
|
|
|
@ -2882,6 +2882,7 @@ ServerHandler.prototype = {
|
|||
s.importFunction(atob, "atob");
|
||||
s.importFunction(btoa, "btoa");
|
||||
s.importFunction(ChromeUtils, "ChromeUtils");
|
||||
s.importFunction(Services, "Services");
|
||||
|
||||
// Define a basic key-value state-preservation API across requests, with
|
||||
// keys initially corresponding to the empty string.
|
||||
|
|
|
@ -155,10 +155,7 @@ function handleRequest(request, response) {
|
|||
if (formData && "upload_file_minidump" in formData) {
|
||||
response.setHeader("Content-Type", "text/plain", false);
|
||||
|
||||
let uuidGenerator = Cc["@mozilla.org/uuid-generator;1"].getService(
|
||||
Ci.nsIUUIDGenerator
|
||||
);
|
||||
let uuid = uuidGenerator.generateUUID().toString();
|
||||
let uuid = Services.uuid.generateUUID().toString();
|
||||
// ditch the {}, add bp- prefix
|
||||
uuid = "bp-" + uuid.substring(1, uuid.length - 1);
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ module.exports = {
|
|||
getObjectState: false,
|
||||
setObjectState: false,
|
||||
registerPathHandler: false,
|
||||
Services: false,
|
||||
// importScripts is also available.
|
||||
importScripts: false,
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче