Bug 899135 - Drop buffers in ScriptProcessorNode instead of buffering them when the...
[gecko.git] / ipc / testshell / TestShellChild.cpp
blobadb60e088047bb4b36d956fff7bc467b6e3cdc7f
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::TestShellChild;
8 using mozilla::ipc::PTestShellCommandChild;
9 using mozilla::ipc::XPCShellEnvironment;
11 TestShellChild::TestShellChild()
12 : mXPCShell(XPCShellEnvironment::CreateEnvironment())
16 bool
17 TestShellChild::RecvExecuteCommand(const nsString& aCommand)
19 if (mXPCShell->IsQuitting()) {
20 NS_WARNING("Commands sent after quit command issued!");
21 return false;
24 return mXPCShell->EvaluateString(aCommand);
27 PTestShellCommandChild*
28 TestShellChild::AllocPTestShellCommandChild(const nsString& aCommand)
30 return new PTestShellCommandChild();
33 bool
34 TestShellChild::DeallocPTestShellCommandChild(PTestShellCommandChild* aCommand)
36 delete aCommand;
37 return true;
40 bool
41 TestShellChild::RecvPTestShellCommandConstructor(PTestShellCommandChild* aActor,
42 const nsString& aCommand)
44 if (mXPCShell->IsQuitting()) {
45 NS_WARNING("Commands sent after quit command issued!");
46 return false;
49 nsString response;
50 if (!mXPCShell->EvaluateString(aCommand, &response)) {
51 return false;
54 return PTestShellCommandChild::Send__delete__(aActor, response);