michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "TestShellChild.h" michael@0: michael@0: using mozilla::ipc::TestShellChild; michael@0: using mozilla::ipc::PTestShellCommandChild; michael@0: using mozilla::ipc::XPCShellEnvironment; michael@0: michael@0: TestShellChild::TestShellChild() michael@0: : mXPCShell(XPCShellEnvironment::CreateEnvironment()) michael@0: { michael@0: } michael@0: michael@0: bool michael@0: TestShellChild::RecvExecuteCommand(const nsString& aCommand) michael@0: { michael@0: if (mXPCShell->IsQuitting()) { michael@0: NS_WARNING("Commands sent after quit command issued!"); michael@0: return false; michael@0: } michael@0: michael@0: return mXPCShell->EvaluateString(aCommand); michael@0: } michael@0: michael@0: PTestShellCommandChild* michael@0: TestShellChild::AllocPTestShellCommandChild(const nsString& aCommand) michael@0: { michael@0: return new PTestShellCommandChild(); michael@0: } michael@0: michael@0: bool michael@0: TestShellChild::DeallocPTestShellCommandChild(PTestShellCommandChild* aCommand) michael@0: { michael@0: delete aCommand; michael@0: return true; michael@0: } michael@0: michael@0: bool michael@0: TestShellChild::RecvPTestShellCommandConstructor(PTestShellCommandChild* aActor, michael@0: const nsString& aCommand) michael@0: { michael@0: if (mXPCShell->IsQuitting()) { michael@0: NS_WARNING("Commands sent after quit command issued!"); michael@0: return false; michael@0: } michael@0: michael@0: nsString response; michael@0: if (!mXPCShell->EvaluateString(aCommand, &response)) { michael@0: return false; michael@0: } michael@0: michael@0: return PTestShellCommandChild::Send__delete__(aActor, response); michael@0: } michael@0: