Bug 1350646: Part 18 - Remove SDK MVC modules. r?Mossop draft
authorKris Maglione <maglione.k@gmail.com>
Sat, 05 Aug 2017 22:43:41 -0700
changeset 641199 f7501988619f373b4a42cec702e2c84927500124
parent 641198 3d3d526ec262bc79d40cc2b6ef192bd40b24a042
child 641200 8086deaefa401daba3a6d15a258fbbea1eed11a3
push id72469
push usermaglione.k@gmail.com
push dateSun, 06 Aug 2017 07:23:41 +0000
reviewersMossop
bugs1350646
milestone57.0a1
Bug 1350646: Part 18 - Remove SDK MVC modules. r?Mossop MozReview-Commit-ID: bFrqTxEs4S
addon-sdk/moz.build
addon-sdk/source/lib/sdk/messaging.js
addon-sdk/source/lib/sdk/model/core.js
addon-sdk/source/lib/sdk/output/system.js
addon-sdk/source/lib/sdk/view/core.js
--- a/addon-sdk/moz.build
+++ b/addon-sdk/moz.build
@@ -53,20 +53,17 @@ modules = [
     'sdk/frame/utils.js',
     'sdk/io/file.js',
     'sdk/lang/functional.js',
     'sdk/lang/functional/concurrent.js',
     'sdk/lang/functional/core.js',
     'sdk/lang/functional/helpers.js',
     'sdk/lang/type.js',
     'sdk/lang/weak-set.js',
-    'sdk/messaging.js',
-    'sdk/model/core.js',
     'sdk/net/url.js',
-    'sdk/output/system.js',
     'sdk/passwords.js',
     'sdk/passwords/utils.js',
     'sdk/platform/xpcom.js',
     'sdk/preferences/service.js',
     'sdk/preferences/utils.js',
     'sdk/private-browsing.js',
     'sdk/private-browsing/utils.js',
     'sdk/querystring.js',
@@ -94,17 +91,16 @@ modules = [
     'sdk/util/collection.js',
     'sdk/util/contract.js',
     'sdk/util/deprecate.js',
     'sdk/util/dispatcher.js',
     'sdk/util/list.js',
     'sdk/util/object.js',
     'sdk/util/sequence.js',
     'sdk/util/uuid.js',
-    'sdk/view/core.js',
     'sdk/window/utils.js',
     'sdk/zip/utils.js',
     'test.js',
     'toolkit/loader.js',
     'toolkit/require.js',
 ]
 
 commonjs = EXTRA_JS_MODULES.commonjs
deleted file mode 100644
--- a/addon-sdk/source/lib/sdk/messaging.js
+++ /dev/null
@@ -1,12 +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 { window } = require("sdk/addon/window");
-exports.MessageChannel = window.MessageChannel;
-exports.MessagePort = window.MessagePort;
deleted file mode 100644
--- a/addon-sdk/source/lib/sdk/model/core.js
+++ /dev/null
@@ -1,23 +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 { dispatcher } = require("../util/dispatcher");
-
-
-// Define `modelFor` accessor function that can be implemented
-// for different types of views. Since view's we'll be dealing
-// with types that don't really play well with `instanceof`
-// operator we're gonig to use `dispatcher` that is slight
-// extension over polymorphic dispatch provided by method.
-// This allows models to extend implementations of this by
-// providing predicates:
-//
-// modelFor.when($ => $ && $.nodeName === "tab", findTabById($.id))
-const modelFor = dispatcher("modelFor");
-exports.modelFor = modelFor;
deleted file mode 100644
--- a/addon-sdk/source/lib/sdk/output/system.js
+++ /dev/null
@@ -1,71 +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";
-
-const { Cc, Ci, Cr } = require("chrome");
-const { Input, start, stop, receive, outputs } = require("../event/utils");
-const { id: addonID } = require("../self");
-const { setImmediate } = require("../timers");
-const { notifyObservers } = Cc['@mozilla.org/observer-service;1'].
-                             getService(Ci.nsIObserverService);
-
-const NOT_AN_INPUT = "OutputPort can be used only for sending messages";
-
-// `OutputPort` creates a port to which messages can be send. Those
-// messages are actually disptached as `subject`'s of the observer
-// notifications. This is handy for communicating between different
-// components of the SDK. By default messages are dispatched
-// asynchronously, although `options.sync` can be used to make them
-// synchronous. If `options.id` is given `topic` for observer
-// notifications is generated by namespacing it, to avoid spamming
-// other SDK add-ons. It's also possible to provide `options.topic`
-// to use excat `topic` without namespacing it.
-//
-// Note: Symmetric `new InputPort({ id: "x" })` instances can be used to
-// receive messages send to the instances of `new OutputPort({ id: "x" })`.
-const OutputPort = function({id, topic, sync}) {
-  this.id = id || topic;
-  this.sync = !!sync;
-  this.topic = topic || "sdk:" + addonID + ":" + id;
-};
-// OutputPort extends base signal type to implement same message
-// receiving interface.
-OutputPort.prototype = new Input();
-OutputPort.constructor = OutputPort;
-
-// OutputPort can not be consumed there for starting or stopping it
-// is not supported.
-OutputPort.prototype[start] = _ => { throw TypeError(NOT_AN_INPUT); };
-OutputPort.prototype[stop] = _ => { throw TypeError(NOT_AN_INPUT); };
-
-// Port reecives message send to it, which will be dispatched via
-// observer notification service.
-OutputPort.receive = ({topic, sync}, message) => {
-  const type = typeof(message);
-  const supported = message === null ||
-                    type === "object" ||
-                    type === "function";
-
-  // There is no sensible way to wrap JS primitives that would make sense
-  // for general observer notification users. It's also probably not very
-  // useful to dispatch JS primitives as subject of observer service, there
-  // for we do not support those use cases.
-  if (!supported)
-    throw new TypeError("Unsupproted message type: `" + type + "`");
-
-  // Normalize `message` to create a valid observer notification `subject`.
-  // If `message` is `null`, implements `nsISupports` interface or already
-  // represents wrapped JS object use it as is. Otherwise create a wrapped
-  // object so that observers could receive it.
-  const subject = message === null ? null :
-                  message instanceof Ci.nsISupports ? message :
-                  message.wrappedJSObject ? message :
-                  {wrappedJSObject: message};
-  if (sync)
-    notifyObservers(subject, topic, null);
-  else
-    setImmediate(notifyObservers, subject, topic, null);
-};
-OutputPort.prototype[receive] = OutputPort.receive;
-exports.OutputPort = OutputPort;
deleted file mode 100644
--- a/addon-sdk/source/lib/sdk/view/core.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": "unstable"
-};
-
-var { Ci } = require("chrome");
-var method = require("../../method/core");
-
-// Returns DOM node associated with a view for
-// the given `value`. If `value` has no view associated
-// it returns `null`. You can implement this method for
-// this type to define what the result should be for it.
-var getNodeView = method("getNodeView");
-getNodeView.define(x =>
-                     x instanceof Ci.nsIDOMNode ? x :
-                     x instanceof Ci.nsIDOMWindow ? x :
-                     null);
-exports.getNodeView = getNodeView;
-exports.viewFor = getNodeView;
-
-var getActiveView = method("getActiveView");
-exports.getActiveView = getActiveView;