MCPcopy
hub / github.com/zen-browser/desktop / getMods

Method getMods

src/zen/mods/ZenMods.mjs:422–449  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

420 }
421
422 async getMods() {
423 if (!(await IOUtils.exists(this.modsDataFile))) {
424 await IOUtils.writeJSON(this.modsDataFile, {});
425
426 return {};
427 }
428
429 let mods = {};
430
431 try {
432 mods = await IOUtils.readJSON(this.modsDataFile);
433
434 if (mods === null || typeof mods !== "object") {
435 throw new Error("Mods data file is invalid");
436 }
437 } catch {
438 // If we have a corrupted file, reset it
439 await IOUtils.writeJSON(this.modsDataFile, {});
440
441 Services.wm
442 .getMostRecentWindow("navigator:browser")
443 .gZenUIManager.showToast("zen-themes-corrupted", {
444 timeout: 8000,
445 });
446 }
447
448 return mods;
449 }
450
451 async getModPreferences(mod) {
452 const modPath = PathUtils.join(

Callers 12

#getEnabledModsMethod · 0.95
initMethod · 0.95
checkForModsUpdatesMethod · 0.95
removeModMethod · 0.95
enableModMethod · 0.95
disableModMethod · 0.95
updateModsMethod · 0.95
checkForModChangesMethod · 0.95
isModInstalledMethod · 0.95
_exportThemesFunction · 0.80
_buildModsListFunction · 0.80
receiveMessageMethod · 0.80

Calls 2

getMostRecentWindowMethod · 0.80
existsMethod · 0.65

Tested by

no test coverage detected