1 /* vim: set ts=2 sw=2 sts=2 et tw=80: */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
9 var EXPORTED_SYMBOLS = ["TestProcessActorChild"];
11 class TestProcessActorChild extends JSProcessActorChild {
14 this.sawActorCreated = false;
18 this.sawActorCreated = true;
21 receiveMessage(aMessage) {
22 switch (aMessage.name) {
24 aMessage.data.toChild = true;
25 this.sendAsyncMessage("toParent", aMessage.data);
28 let { a, b } = aMessage.data;
29 return new Promise(resolve => {
30 resolve({ result: a + b });
33 return Promise.reject(new SyntaxError(aMessage.data.message));
35 return Promise.reject(
36 Components.Exception(aMessage.data.message, aMessage.data.result)
39 this.done(aMessage.data);
46 observe(subject, topic, data) {
47 this.lastObserved = { subject, topic, data };
51 return "TestProcessActorChild";
55 Services.obs.notifyObservers(
57 "test-js-content-actor-diddestroy",