Commit 33aca634 authored by Mark Banner's avatar Mark Banner
Browse files

Bug 1816934 - Convert most of services/settings to ES modules. r=leplatrem

Convert everything apart from items used in workers.

Differential Revision: https://phabricator.services.mozilla.com/D169933
parent ca64899a
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -2,11 +2,8 @@
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var EXPORTED_SYMBOLS = ["Downloader"];
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";

const { XPCOMUtils } = ChromeUtils.importESModule(
  "resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {};
XPCOMUtils.defineLazyModuleGetters(lazy, {
  RemoteSettingsWorker: "resource://services-settings/RemoteSettingsWorker.jsm",
@@ -92,7 +89,7 @@ class LazyRecordAndBuffer {
  }
}

class Downloader {
export class Downloader {
  static get DownloadError() {
    return DownloadError;
  }
+2 −6
Original line number Diff line number Diff line
@@ -2,9 +2,7 @@
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

const { XPCOMUtils } = ChromeUtils.importESModule(
  "resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";

const lazy = {};

@@ -20,14 +18,12 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
});
XPCOMUtils.defineLazyGetter(lazy, "console", () => lazy.Utils.log);

var EXPORTED_SYMBOLS = ["Database"];

/**
 * Database is a tiny wrapper with the objective
 * of providing major kinto-offline-client collection API.
 * (with the objective of getting rid of kinto-offline-client)
 */
class Database {
export class Database {
  static destroy() {
    return destroyIDB();
  }
+3 −10
Original line number Diff line number Diff line
@@ -2,16 +2,9 @@
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

"use strict";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";

var EXPORTED_SYMBOLS = ["RemoteSettingsClient"];

const { XPCOMUtils } = ChromeUtils.importESModule(
  "resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { AppConstants } = ChromeUtils.importESModule(
  "resource://gre/modules/AppConstants.sys.mjs"
);
const { Downloader } = ChromeUtils.import(
  "resource://services-settings/Attachments.jsm"
);
@@ -267,7 +260,7 @@ class AttachmentDownloader extends Downloader {
  }
}

class RemoteSettingsClient extends EventEmitter {
export class RemoteSettingsClient extends EventEmitter {
  static get APIError() {
    return APIError;
  }
+1 −4
Original line number Diff line number Diff line
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";

var EXPORTED_SYMBOLS = ["RemoteSettingsTimer"];

const lazy = {};

@@ -13,7 +10,7 @@ ChromeUtils.defineModuleGetter(
  "resource://services-settings/remote-settings.js"
);

var RemoteSettingsTimer = function() {};
export var RemoteSettingsTimer = function() {};
RemoteSettingsTimer.prototype = {
  QueryInterface: ChromeUtils.generateQI(["nsITimerCallback"]),
  classID: Components.ID("{5e756573-234a-49ea-bbe4-59ec7a70657d}"),
+3 −10
Original line number Diff line number Diff line
@@ -2,19 +2,12 @@
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

"use strict";

/**
 * Interface to a dedicated thread handling for Remote Settings heavy operations.
 */
const { XPCOMUtils } = ChromeUtils.importESModule(
  "resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { setTimeout, clearTimeout } = ChromeUtils.importESModule(
  "resource://gre/modules/Timer.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";

var EXPORTED_SYMBOLS = ["RemoteSettingsWorker"];
import { setTimeout, clearTimeout } from "resource://gre/modules/Timer.sys.mjs";

const lazy = {};

@@ -240,6 +233,6 @@ try {
  gShutdown = true;
}

var RemoteSettingsWorker = new Worker(
export var RemoteSettingsWorker = new Worker(
  "resource://services-settings/RemoteSettingsWorker.js"
);
Loading