Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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())
13 {
14 }
16 bool
17 TestShellChild::RecvExecuteCommand(const nsString& aCommand)
18 {
19 if (mXPCShell->IsQuitting()) {
20 NS_WARNING("Commands sent after quit command issued!");
21 return false;
22 }
24 return mXPCShell->EvaluateString(aCommand);
25 }
27 PTestShellCommandChild*
28 TestShellChild::AllocPTestShellCommandChild(const nsString& aCommand)
29 {
30 return new PTestShellCommandChild();
31 }
33 bool
34 TestShellChild::DeallocPTestShellCommandChild(PTestShellCommandChild* aCommand)
35 {
36 delete aCommand;
37 return true;
38 }
40 bool
41 TestShellChild::RecvPTestShellCommandConstructor(PTestShellCommandChild* aActor,
42 const nsString& aCommand)
43 {
44 if (mXPCShell->IsQuitting()) {
45 NS_WARNING("Commands sent after quit command issued!");
46 return false;
47 }
49 nsString response;
50 if (!mXPCShell->EvaluateString(aCommand, &response)) {
51 return false;
52 }
54 return PTestShellCommandChild::Send__delete__(aActor, response);
55 }