Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fp.show(function(x) {
// Check if the user selected nothing.
if (!x) {
return;
}
console.log("you picked " + x.length + " files");
for (var i = 0; i < x.length; i++) {
currentFile = "" + x[i];
stringData = require("file").read(currentFile);
editorSession.setValue(stringData);
}
});
}
updateMemory: function() {
let path = getStoragePath();
// update storage if the file
// does not exist or is older than we want
if (!file.exists(path) ||
(getUnixTimeStamp()-
getLastModificationTime(path)/1000>=STORAGE_UPDATE_INTERVAL)) {
cps.updateStorage();
return;
}
let str = file.read(path);
cps.pool = JSON.parse(str);
cps.last_update = getUnixTimeStamp();
},
/**
function installAndRun(installPath, xpiPath) {
// TODO: If the XPI is corrupted, Firefox will crash. Figure out how
// to bail gracefully.
if (file.exists(installPath))
shellUtils.removeDirRecursive(installPath);
shellUtils.makeDir(installPath);
var zip = require("zip-file").open(xpiPath);
zip.extractAll(installPath);
var manifestFile = file.join(installPath, "harness-options.json");
var manifest = JSON.parse(file.read(manifestFile));
return {
id: manifest.jetpackID,
__proto__: require("bootstrap").run(manifest, installPath, print)
};
}
exports["test " + hamlFile] = function() {
var scopeFile = hamlFile.replace(/haml$/, "js");
var htmlFile = hamlFile.replace(/haml$/, "html");
var haml = FILE.read(hamlFile);
var expected = FILE.read(htmlFile);
var scope = FILE.exists(scopeFile) ? eval("("+FILE.read(scopeFile)+")") : {};
var js = Haml.compile(haml);
var js_opt = Haml.optimize(js);
var actual = Haml.execute(js_opt, scope.context, scope.locals);
ASSERT.equal(actual.trim(), expected.trim());
}
});