Bug 1777320 [wpt PR 34649] - Update CSS toggles parsing/computation code to spec...
[gecko.git] / ipc / testshell / TestShellChild.cpp
blobbd363cb474d41f3cd9d88641cfc20fa0557ce072
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);
24 return IPC_OK();
27 PTestShellCommandChild* TestShellChild::AllocPTestShellCommandChild(
28 const nsString& aCommand) {
29 return new PTestShellCommandChild();
32 bool TestShellChild::DeallocPTestShellCommandChild(
33 PTestShellCommandChild* aCommand) {
34 delete aCommand;
35 return true;
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);
45 nsString response;
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);
53 return IPC_OK();