ipc/testshell/TestShellChild.cpp

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #include "TestShellChild.h"
michael@0 6
michael@0 7 using mozilla::ipc::TestShellChild;
michael@0 8 using mozilla::ipc::PTestShellCommandChild;
michael@0 9 using mozilla::ipc::XPCShellEnvironment;
michael@0 10
michael@0 11 TestShellChild::TestShellChild()
michael@0 12 : mXPCShell(XPCShellEnvironment::CreateEnvironment())
michael@0 13 {
michael@0 14 }
michael@0 15
michael@0 16 bool
michael@0 17 TestShellChild::RecvExecuteCommand(const nsString& aCommand)
michael@0 18 {
michael@0 19 if (mXPCShell->IsQuitting()) {
michael@0 20 NS_WARNING("Commands sent after quit command issued!");
michael@0 21 return false;
michael@0 22 }
michael@0 23
michael@0 24 return mXPCShell->EvaluateString(aCommand);
michael@0 25 }
michael@0 26
michael@0 27 PTestShellCommandChild*
michael@0 28 TestShellChild::AllocPTestShellCommandChild(const nsString& aCommand)
michael@0 29 {
michael@0 30 return new PTestShellCommandChild();
michael@0 31 }
michael@0 32
michael@0 33 bool
michael@0 34 TestShellChild::DeallocPTestShellCommandChild(PTestShellCommandChild* aCommand)
michael@0 35 {
michael@0 36 delete aCommand;
michael@0 37 return true;
michael@0 38 }
michael@0 39
michael@0 40 bool
michael@0 41 TestShellChild::RecvPTestShellCommandConstructor(PTestShellCommandChild* aActor,
michael@0 42 const nsString& aCommand)
michael@0 43 {
michael@0 44 if (mXPCShell->IsQuitting()) {
michael@0 45 NS_WARNING("Commands sent after quit command issued!");
michael@0 46 return false;
michael@0 47 }
michael@0 48
michael@0 49 nsString response;
michael@0 50 if (!mXPCShell->EvaluateString(aCommand, &response)) {
michael@0 51 return false;
michael@0 52 }
michael@0 53
michael@0 54 return PTestShellCommandChild::Send__delete__(aActor, response);
michael@0 55 }
michael@0 56

mercurial