зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 29227ffebd04 (bug 1772261) for causing build bustages. CLOSED TREE
This commit is contained in:
Родитель
0e34199d45
Коммит
d3f7b3772d
|
@ -15,13 +15,14 @@ ChromeUtils.defineModuleGetter(
|
|||
"JSONFile",
|
||||
"resource://gre/modules/JSONFile.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(lazy, "OS", "resource://gre/modules/osfile.jsm");
|
||||
|
||||
var EXPORTED_SYMBOLS = ["Storage"];
|
||||
|
||||
// Lazy-load JSON file that backs Storage instances.
|
||||
XPCOMUtils.defineLazyGetter(lazy, "lazyStore", async function() {
|
||||
const path = PathUtils.join(
|
||||
PathUtils.profileDir,
|
||||
const path = lazy.OS.Path.join(
|
||||
lazy.OS.Constants.Path.profileDir,
|
||||
"shield-recipe-client.json"
|
||||
);
|
||||
const store = new lazy.JSONFile({ path });
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
/* eslint-env xpcshell */
|
||||
/* globals print, quit, arguments */
|
||||
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/services.jsm");
|
||||
const { RecipeRunner } = ChromeUtils.import(
|
||||
"resource://normandy/lib/RecipeRunner.jsm"
|
||||
);
|
||||
|
@ -17,35 +16,10 @@ if (arguments.length !== 1) {
|
|||
|
||||
main(...arguments);
|
||||
|
||||
function resolvePath(path) {
|
||||
let absPath = path;
|
||||
|
||||
if (!PathUtils.isAbsolute(path)) {
|
||||
const components = path.split(new RegExp("[/\\\\]")).filter(c => c.length);
|
||||
absPath = Services.dirsvc.get("CurWorkD", Ci.nsIFile).path;
|
||||
|
||||
for (const component of components) {
|
||||
switch (component) {
|
||||
case ".":
|
||||
break;
|
||||
|
||||
case "..":
|
||||
absPath = PathUtils.parent(absPath);
|
||||
break;
|
||||
|
||||
default:
|
||||
absPath = PathUtils.join(absPath, component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return absPath;
|
||||
}
|
||||
|
||||
async function main(outPath) {
|
||||
const capabililitySet = RecipeRunner.getCapabilities();
|
||||
await IOUtils.writeUTF8(
|
||||
resolvePath(outPath),
|
||||
await OS.File.writeAtomic(
|
||||
outPath,
|
||||
JSON.stringify(
|
||||
{
|
||||
capabilities: Array.from(capabililitySet),
|
||||
|
|
|
@ -9,6 +9,7 @@ const { Preferences } = ChromeUtils.import(
|
|||
);
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
||||
const { NormandyApi } = ChromeUtils.import(
|
||||
"resource://normandy/lib/NormandyApi.jsm"
|
||||
);
|
||||
|
@ -90,7 +91,7 @@ function makeMockApiServer(directory) {
|
|||
}
|
||||
|
||||
try {
|
||||
const contents = await IOUtils.readUTF8(index.path);
|
||||
const contents = await OS.File.read(index.path, { encoding: "utf-8" });
|
||||
response.write(contents);
|
||||
} catch (e) {
|
||||
response.setStatusLine("1.1", 500, "Server error");
|
||||
|
|
Загрузка…
Ссылка в новой задаче