Bug 1350646: Part 18 - Remove SDK MVC modules. r=Mossop

MozReview-Commit-ID: bFrqTxEs4S

--HG--
extra : source : 5584fdcd2ee0bed1cb94f91e7fca416f93d0aa0d
This commit is contained in:
Kris Maglione 2017-08-05 22:43:41 -07:00
parent c8e4075eff
commit 580371c1c7
5 changed files with 0 additions and 136 deletions

View File

@ -58,10 +58,7 @@ modules = [
'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',
@ -99,7 +96,6 @@ modules = [
'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',

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;