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 = ["TestWindowParent"];
9 class TestWindowParent extends JSWindowActorParent {
12 this.wrappedJSObject = this;
13 this.sawActorCreated = false;
17 this.sawActorCreated = true;
20 receiveMessage(aMessage) {
21 switch (aMessage.name) {
23 aMessage.data.initial = true;
24 this.sendAsyncMessage("toChild", aMessage.data);
27 aMessage.data.toParent = true;
28 this.sendAsyncMessage("done", aMessage.data);
31 let { a, b } = aMessage.data;
32 return { result: a * b };
35 Services.obs.notifyObservers(
37 "test-js-window-actor-parent-event",
42 const { port } = aMessage.data;
43 port.postMessage("Message sent from parent over a MessagePort.");
52 return "TestWindowParent";