toolkit/actors/TestChild.jsm
author John Dai <jdai@mozilla.com>
Fri, 08 Feb 2019 13:02:08 +0000
changeset 516121 b482c6618d72ac38a9a82fbccf425e0a7f8b6129
parent 512610 a480d92de046edf8092ea9a3f0ed56a060aea8eb
child 518008 33dd29846b7b64da9b31a936ac1b152ef5c95e12
permissions -rw-r--r--
Bug 1513877 - Implement send and receive methods for base WindowActor class. r=nika Differential Revision: https://phabricator.services.mozilla.com/D18695

/* vim: set ts=2 sw=2 sts=2 et tw=80: */
/* 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";

var EXPORTED_SYMBOLS = ["TestChild"];

class TestChild extends JSWindowActorChild {
  constructor() {
     super();
  }

  recvAsyncMessage(aMessage) {
    switch (aMessage.name) {
      case "toChild":
        aMessage.data.toChild = true;
        this.sendAsyncMessage("Test", "toParent", aMessage.data);
        break;
      case "done":
        this.done(aMessage.data);
        break;
    }
  }

  show() {
    return "TestChild";
  }
}