How to use the bootstrap/api/services/xpconnect-service.XPConnectService function in bootstrap

To help you get started, we’ve selected a few bootstrap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RequestPolicyContinued / requestpolicy / tests / xpcshell / test_json_storage.js View on Github external
/* exported run_test */

const {XPConnectService} = require("bootstrap/api/services/xpconnect-service");
const xpconnectService = new XPConnectService();
const {
  FileUtils: mozFileUtils,
} = Cu.import("resource://gre/modules/FileUtils.jsm", {});
const {FileService} = require("bootstrap/api/services/file-service");
const fileService = new FileService(xpconnectService, mozFileUtils);

const {JsonStorage} = require("bootstrap/api/storage/json-storage");
const jsonStorage = new JsonStorage(fileService);

function run_test() {
  run_next_test();
}

add_test(function() {
  // exercise
  const fullJsonStorage = jsonStorage.getAll();
github RequestPolicyContinued / requestpolicy / tests / xpcshell / test_fileservice.js View on Github external
/* exported run_test */

const {XPConnectService} = require("bootstrap/api/services/xpconnect-service");
const xpcService = new XPConnectService();
const {
  FileUtils: mozFileUtils,
} = Cu.import("resource://gre/modules/FileUtils.jsm", {});

const {FileService} = require("bootstrap/api/services/file-service");
const fileService = new FileService(xpcService, mozFileUtils);

function run_test() {
  run_next_test();
}

add_test(function() {
  // Make sure the RP user dir doesn't already exist.

  // exercise
  const rpUserDir = do_get_profile();
github RequestPolicyContinued / requestpolicy / tests / xpcshell / test_storage_api.js View on Github external
/* exported run_test */

const {FileService} = require("bootstrap/api/services/file-service");
const {JSMService} = require("bootstrap/api/services/jsm-service");
const {XPConnectService} = require("bootstrap/api/services/xpconnect-service");
const {JsonStorage} = require("bootstrap/api/storage/json-storage");
const {PrefBranch} = require("bootstrap/api/storage/pref-branch");
const {Storage} = require("bootstrap/api/storage/storage.module");
const {SyncLocalStorageArea} = require("bootstrap/api/storage/sync-local-storage-area");
const {Log} = require("lib/classes/log");

const log = new Log();
const xpconnectService = new XPConnectService();
const jsmService = new JSMService(Cu);
const mozFileUtils = jsmService.getFileUtils();
const mozServices = jsmService.getServices();
const rpPrefBranch = new PrefBranch(
    Ci,
    mozServices.prefs,
    xpconnectService,
    "extensions.requestpolicy."
);
const fileService = new FileService(xpconnectService, mozFileUtils);
const jsonStorage = new JsonStorage(fileService);
const syncLocalStorageArea = new SyncLocalStorageArea(
    mozServices.prefs, rpPrefBranch, jsonStorage
);

function createStorageApi() {
github RequestPolicyContinued / requestpolicy / tests / xpcshell / head_utils.js View on Github external
} = (function() {
  const {XPConnectService} = require("bootstrap/api/services/xpconnect-service");
  const xpcService = new XPConnectService();
  const {
    FileUtils: mozFileUtils,
  } = Cu.import("resource://gre/modules/FileUtils.jsm", {});

  const {FileService} = require("bootstrap/api/services/file-service");
  const fileService = new FileService(xpcService, mozFileUtils);

  function createRPFile(aPath, aContent) {
    const file = fileService.getRPFile(aPath);

    const foStream = Cc["@mozilla.org/network/file-output-stream;1"].
        createInstance(Ci.nsIFileOutputStream);
    foStream.init(file, 0x02 | 0x08 | 0x20, 0o666, 0);

    const converter = Cc["@mozilla.org/intl/converter-output-stream;1"].
        createInstance(Ci.nsIConverterOutputStream);
github RequestPolicyContinued / requestpolicy / tests / xpcshell / test_privacy_api.js View on Github external
function createPrivacyApi() {
  const xpconnectService = new XPConnectService();
  const rootPrefBranch = new PrefBranch(
      Ci,
      prefsService,
      xpconnectService,
      ""
  );
  const networkPredictionEnabled = new NetworkPredictionEnabledSetting(
      log, rootPrefBranch
  );
  const privacyApi = new PrivacyApi(log, networkPredictionEnabled);
  const privacy = privacyApi.backgroundApi;
  return {privacy, privacyApi, rootPrefBranch, networkPredictionEnabled};
}
github RequestPolicyContinued / requestpolicy / src / content / app / app.content.ts View on Github external
storageAvailabilityController,
);

const msgListener = new MessageListenerModule(
    `AppContent[${outerWindowID}].contentSide`,
    log,
    cfmm,
);
const bgCommunication = new FramescriptToBackgroundCommunication(
    log,
    outerWindowID,
    cfmm,
    msgListener,
);
const blockedContent = new ManagerForBlockedContent(log, outerWindowID);
const xpconnectService = new XPConnectService();
const uriService = new UriService(
    log,
    outerWindowID,
    Services.eTLD,
    xpconnectService.getIDNService(),
    Services.io,
);
const domContentLoaded = new ManagerForDOMContentLoaded(
    log,
    outerWindowID,
    Ci,
    cfmm,
    bgCommunication,
    blockedContent,
    uriService,
);