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 var EXPORTED_SYMBOLS = ["TestProcessActorChild"];
9 class TestProcessActorChild extends JSProcessActorChild {
12 this.sawActorCreated = false;
16 this.sawActorCreated = true;
19 receiveMessage(aMessage) {
20 switch (aMessage.name) {
22 aMessage.data.toChild = true;
23 this.sendAsyncMessage("toParent", aMessage.data);
26 let { a, b } = aMessage.data;
27 return new Promise(resolve => {
28 resolve({ result: a + b });
31 return Promise.reject(new SyntaxError(aMessage.data.message));
33 return Promise.reject(
34 Components.Exception(aMessage.data.message, aMessage.data.result)
37 this.done(aMessage.data);
44 observe(subject, topic, data) {
45 this.lastObserved = { subject, topic, data };
49 return "TestProcessActorChild";
53 Services.obs.notifyObservers(
55 "test-js-content-actor-diddestroy",