ipc/testshell/TestShellParent.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
michael@0 2 * vim: sw=2 ts=8 et :
michael@0 3 */
michael@0 4 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 5 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 7
michael@0 8 #ifndef ipc_testshell_TestShellParent_h
michael@0 9 #define ipc_testshell_TestShellParent_h 1
michael@0 10
michael@0 11 #include "mozilla/ipc/PTestShellParent.h"
michael@0 12 #include "mozilla/ipc/PTestShellCommandParent.h"
michael@0 13
michael@0 14 #include "js/TypeDecls.h"
michael@0 15 #include "nsAutoJSValHolder.h"
michael@0 16 #include "nsString.h"
michael@0 17
michael@0 18 namespace mozilla {
michael@0 19
michael@0 20 namespace ipc {
michael@0 21
michael@0 22 class TestShellCommandParent;
michael@0 23
michael@0 24 class TestShellParent : public PTestShellParent
michael@0 25 {
michael@0 26 public:
michael@0 27 PTestShellCommandParent*
michael@0 28 AllocPTestShellCommandParent(const nsString& aCommand);
michael@0 29
michael@0 30 bool
michael@0 31 DeallocPTestShellCommandParent(PTestShellCommandParent* aActor);
michael@0 32
michael@0 33 bool
michael@0 34 CommandDone(TestShellCommandParent* aActor, const nsString& aResponse);
michael@0 35 };
michael@0 36
michael@0 37
michael@0 38 class TestShellCommandParent : public PTestShellCommandParent
michael@0 39 {
michael@0 40 public:
michael@0 41 TestShellCommandParent() : mCx(nullptr) { }
michael@0 42
michael@0 43 bool SetCallback(JSContext* aCx, JS::Value aCallback);
michael@0 44
michael@0 45 bool RunCallback(const nsString& aResponse);
michael@0 46
michael@0 47 void ReleaseCallback();
michael@0 48
michael@0 49 protected:
michael@0 50 bool ExecuteCallback(const nsString& aResponse);
michael@0 51
michael@0 52 void ActorDestroy(ActorDestroyReason why);
michael@0 53
michael@0 54 bool Recv__delete__(const nsString& aResponse) {
michael@0 55 return ExecuteCallback(aResponse);
michael@0 56 }
michael@0 57
michael@0 58 private:
michael@0 59 JSContext* mCx;
michael@0 60 nsAutoJSValHolder mCallback;
michael@0 61 };
michael@0 62
michael@0 63
michael@0 64 } /* namespace ipc */
michael@0 65 } /* namespace mozilla */
michael@0 66
michael@0 67 #endif /* ipc_testshell_TestShellParent_h */

mercurial