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 #include "TestBadActor.h"
2 #include "IPDLUnitTests.h"
3 #include "mozilla/unused.h"
5 namespace mozilla {
6 namespace _ipdltest {
8 void
9 TestBadActorParent::Main()
10 {
11 // This test is designed to test a race condition where the child sends us
12 // a message on an actor that we've already destroyed. The child process
13 // should die, and the parent process should not abort.
15 PTestBadActorSubParent* child = SendPTestBadActorSubConstructor();
16 if (!child)
17 fail("Sending constructor");
19 unused << child->Call__delete__(child);
20 }
22 PTestBadActorSubParent*
23 TestBadActorParent::AllocPTestBadActorSubParent()
24 {
25 return new TestBadActorSubParent();
26 }
28 bool
29 TestBadActorSubParent::RecvPing()
30 {
31 fail("Shouldn't have received ping.");
32 return false;
33 }
35 PTestBadActorSubChild*
36 TestBadActorChild::AllocPTestBadActorSubChild()
37 {
38 return new TestBadActorSubChild();
39 }
41 bool
42 TestBadActorChild::RecvPTestBadActorSubConstructor(PTestBadActorSubChild* actor)
43 {
44 if (!actor->SendPing()) {
45 fail("Couldn't send ping to an actor which supposedly isn't dead yet.");
46 }
47 return true;
48 }
50 } // namespace _ipdltest
51 } // namespace mozilla