Tue, 06 Jan 2015 21:39:09 +0100
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 | /* vim:set ts=2 sw=2 sts=2 et cin: */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include <stdio.h> |
michael@0 | 7 | #include "nsISimpleTest.h" |
michael@0 | 8 | #include "mozilla/ModuleUtils.h" |
michael@0 | 9 | |
michael@0 | 10 | class SimpleTest : public nsISimpleTest |
michael@0 | 11 | { |
michael@0 | 12 | public: |
michael@0 | 13 | NS_DECL_ISUPPORTS |
michael@0 | 14 | NS_DECL_NSISIMPLETEST |
michael@0 | 15 | }; |
michael@0 | 16 | |
michael@0 | 17 | NS_IMPL_ISUPPORTS(SimpleTest, nsISimpleTest) |
michael@0 | 18 | |
michael@0 | 19 | NS_IMETHODIMP |
michael@0 | 20 | SimpleTest::Add(int32_t a, int32_t b, int32_t *r) |
michael@0 | 21 | { |
michael@0 | 22 | printf("add(%d,%d) from C++\n", a, b); |
michael@0 | 23 | |
michael@0 | 24 | *r = a + b; |
michael@0 | 25 | return NS_OK; |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | NS_GENERIC_FACTORY_CONSTRUCTOR(SimpleTest) |
michael@0 | 29 | |
michael@0 | 30 | // 5e14b432-37b6-4377-923b-c987418d8429 |
michael@0 | 31 | #define SIMPLETEST_CID \ |
michael@0 | 32 | { 0x5e14b432, 0x37b6, 0x4377, \ |
michael@0 | 33 | { 0x92, 0x3b, 0xc9, 0x87, 0x41, 0x8d, 0x84, 0x29 } } |
michael@0 | 34 | |
michael@0 | 35 | NS_DEFINE_NAMED_CID(SIMPLETEST_CID); |
michael@0 | 36 | |
michael@0 | 37 | static const mozilla::Module::CIDEntry kSimpleCIDs[] = { |
michael@0 | 38 | { &kSIMPLETEST_CID, false, nullptr, SimpleTestConstructor }, |
michael@0 | 39 | { nullptr } |
michael@0 | 40 | }; |
michael@0 | 41 | |
michael@0 | 42 | static const mozilla::Module::ContractIDEntry kSimpleContracts[] = { |
michael@0 | 43 | { "@test.mozilla.org/simple-test;1?impl=c++", &kSIMPLETEST_CID }, |
michael@0 | 44 | { nullptr } |
michael@0 | 45 | }; |
michael@0 | 46 | |
michael@0 | 47 | static const mozilla::Module kSimpleModule = { |
michael@0 | 48 | mozilla::Module::kVersion, |
michael@0 | 49 | kSimpleCIDs, |
michael@0 | 50 | kSimpleContracts |
michael@0 | 51 | }; |
michael@0 | 52 | |
michael@0 | 53 | NSMODULE_DEFN(SimpleTestModule) = &kSimpleModule; |