1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "TestShellChild.h"
7 using mozilla::ipc::PTestShellCommandChild
;
8 using mozilla::ipc::TestShellChild
;
9 using mozilla::ipc::XPCShellEnvironment
;
11 TestShellChild::TestShellChild()
12 : mXPCShell(XPCShellEnvironment::CreateEnvironment()) {}
14 mozilla::ipc::IPCResult
TestShellChild::RecvExecuteCommand(
15 const nsString
& aCommand
) {
16 if (mXPCShell
->IsQuitting()) {
17 NS_WARNING("Commands sent after quit command issued!");
18 return IPC_FAIL_NO_REASON(this);
21 if (!mXPCShell
->EvaluateString(aCommand
)) {
22 return IPC_FAIL_NO_REASON(this);
27 PTestShellCommandChild
* TestShellChild::AllocPTestShellCommandChild(
28 const nsString
& aCommand
) {
29 return new PTestShellCommandChild();
32 bool TestShellChild::DeallocPTestShellCommandChild(
33 PTestShellCommandChild
* aCommand
) {
38 mozilla::ipc::IPCResult
TestShellChild::RecvPTestShellCommandConstructor(
39 PTestShellCommandChild
* aActor
, const nsString
& aCommand
) {
40 if (mXPCShell
->IsQuitting()) {
41 NS_WARNING("Commands sent after quit command issued!");
42 return IPC_FAIL_NO_REASON(this);
46 if (!mXPCShell
->EvaluateString(aCommand
, &response
)) {
47 return IPC_FAIL_NO_REASON(this);
50 if (!PTestShellCommandChild::Send__delete__(aActor
, response
)) {
51 return IPC_FAIL_NO_REASON(this);