Bug 1350646: Part 12 - Remove SDK simple-prefs module. r=Mossop
☠☠ backed out by 9f7d0c809762 ☠ ☠
authorKris Maglione <maglione.k@gmail.com>
Sat, 05 Aug 2017 21:39:28 -0700
changeset 373641 13110c98b0fd79643e204b07a75476b889e0ff81
parent 373640 096ff315b48b51aae1863b687fff74707e8e04c3
child 373642 6d9244a8ac40c7daffc95917a4c7a58652d859d9
push id93571
push usermaglione.k@gmail.com
push dateWed, 09 Aug 2017 22:31:31 +0000
treeherdermozilla-inbound@c3108aebee35 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMossop
bugs1350646
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1350646: Part 12 - Remove SDK simple-prefs module. r=Mossop MozReview-Commit-ID: Abh0zfzGP0h
addon-sdk/moz.build
addon-sdk/source/lib/sdk/preferences/event-target.js
addon-sdk/source/lib/sdk/simple-prefs.js
--- a/addon-sdk/moz.build
+++ b/addon-sdk/moz.build
@@ -76,25 +76,23 @@ modules = [
     'sdk/model/core.js',
     'sdk/net/url.js',
     'sdk/net/xhr.js',
     'sdk/notifications.js',
     'sdk/output/system.js',
     'sdk/passwords.js',
     'sdk/passwords/utils.js',
     'sdk/platform/xpcom.js',
-    'sdk/preferences/event-target.js',
     'sdk/preferences/service.js',
     'sdk/preferences/utils.js',
     'sdk/private-browsing.js',
     'sdk/private-browsing/utils.js',
     'sdk/querystring.js',
     'sdk/request.js',
     'sdk/self.js',
-    'sdk/simple-prefs.js',
     'sdk/simple-storage.js',
     'sdk/system.js',
     'sdk/system/environment.js',
     'sdk/system/events-shimmed.js',
     'sdk/system/events.js',
     'sdk/system/globals.js',
     'sdk/system/process.js',
     'sdk/system/runtime.js',
deleted file mode 100644
--- a/addon-sdk/source/lib/sdk/preferences/event-target.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/* 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';
-
-module.metadata = {
-  "stability": "unstable"
-};
-
-const { Cc, Ci } = require('chrome');
-const { Class } = require('../core/heritage');
-const { EventTarget } = require('../event/target');
-const { Branch } = require('./service');
-const { emit, off } = require('../event/core');
-const { when: unload } = require('../system/unload');
-
-const prefTargetNS = require('../core/namespace').ns();
-
-const PrefsTarget = Class({
-  extends: EventTarget,
-  initialize: function(options) {
-    options = options || {};
-    EventTarget.prototype.initialize.call(this, options);
-
-    let branchName = options.branchName || '';
-    let branch = Cc["@mozilla.org/preferences-service;1"].
-        getService(Ci.nsIPrefService).
-        getBranch(branchName).
-        QueryInterface(Ci.nsIPrefBranch);
-    prefTargetNS(this).branch = branch;
-
-    // provides easy access to preference values
-    this.prefs = Branch(branchName);
-
-    // start listening to preference changes
-    let observer = prefTargetNS(this).observer = onChange.bind(this);
-    branch.addObserver('', observer);
-
-    // Make sure to destroy this on unload
-    unload(destroy.bind(this));
-  }
-});
-exports.PrefsTarget = PrefsTarget;
-
-/* HELPERS */
-
-function onChange(subject, topic, name) {
-  if (topic === 'nsPref:changed') {
-    emit(this, name, name);
-    emit(this, '', name);
-  }
-}
-
-function destroy() {
-  off(this);
-
-  // stop listening to preference changes
-  let branch = prefTargetNS(this).branch;
-  branch.removeObserver('', prefTargetNS(this).observer);
-  prefTargetNS(this).observer = null;
-}
deleted file mode 100644
--- a/addon-sdk/source/lib/sdk/simple-prefs.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/* 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';
-
-module.metadata = {
-  "stability": "experimental"
-};
-
-const { emit, off } = require("./event/core");
-const { PrefsTarget } = require("./preferences/event-target");
-const { preferencesBranch, id } = require("./self");
-const { on } = require("./system/events");
-
-const ADDON_BRANCH = "extensions." + preferencesBranch + ".";
-const BUTTON_PRESSED = id + "-cmdPressed";
-
-const target = PrefsTarget({ branchName: ADDON_BRANCH });
-
-// Listen to clicks on buttons
-function buttonClick({ data }) {
-  emit(target, data);
-}
-on(BUTTON_PRESSED, buttonClick);
-
-module.exports = target;