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.
michael@0 | 1 | namespace mozilla { |
michael@0 | 2 | namespace _ipdltest { |
michael@0 | 3 | |
michael@0 | 4 | intr protocol PTestInterruptRaces { |
michael@0 | 5 | both: |
michael@0 | 6 | intr Race() returns (bool hasReply); |
michael@0 | 7 | intr StackFrame() returns (); |
michael@0 | 8 | intr StackFrame3() returns (); |
michael@0 | 9 | |
michael@0 | 10 | parent: |
michael@0 | 11 | sync StartRace(); |
michael@0 | 12 | intr Parent(); |
michael@0 | 13 | sync GetAnsweredParent() returns (bool answeredParent); |
michael@0 | 14 | |
michael@0 | 15 | child: |
michael@0 | 16 | Start(); |
michael@0 | 17 | Wakeup(); |
michael@0 | 18 | Wakeup3(); |
michael@0 | 19 | intr Child(); |
michael@0 | 20 | __delete__(); |
michael@0 | 21 | |
michael@0 | 22 | state START: |
michael@0 | 23 | send Start goto TEST1; |
michael@0 | 24 | |
michael@0 | 25 | // First test: race while no other messages are on the Interrupt stack |
michael@0 | 26 | state TEST1: |
michael@0 | 27 | recv StartRace goto RACE1; |
michael@0 | 28 | state RACE1: |
michael@0 | 29 | call Race goto DUMMY1_1; |
michael@0 | 30 | answer Race goto DUMMY1_2; |
michael@0 | 31 | state DUMMY1_1: |
michael@0 | 32 | answer Race goto TEST2; |
michael@0 | 33 | state DUMMY1_2: |
michael@0 | 34 | call Race goto TEST2; |
michael@0 | 35 | |
michael@0 | 36 | // Second test: race while other messages are on the Interrupt stack |
michael@0 | 37 | state TEST2: |
michael@0 | 38 | call StackFrame goto MORESTACK; |
michael@0 | 39 | state MORESTACK: |
michael@0 | 40 | answer StackFrame goto STARTRACE; |
michael@0 | 41 | state STARTRACE: |
michael@0 | 42 | send Wakeup goto RACE2; |
michael@0 | 43 | state RACE2: |
michael@0 | 44 | call Race goto DUMMY2_1; |
michael@0 | 45 | answer Race goto DUMMY2_2; |
michael@0 | 46 | state DUMMY2_1: |
michael@0 | 47 | answer Race goto TEST3; |
michael@0 | 48 | state DUMMY2_2: |
michael@0 | 49 | call Race goto TEST3; |
michael@0 | 50 | |
michael@0 | 51 | // Third test: resolve race using custom policy |
michael@0 | 52 | state TEST3: |
michael@0 | 53 | call StackFrame3 goto MORESTACK3; |
michael@0 | 54 | state MORESTACK3: |
michael@0 | 55 | answer StackFrame3 goto STARTRACE3; |
michael@0 | 56 | state STARTRACE3: |
michael@0 | 57 | send Wakeup3 goto RACE3; |
michael@0 | 58 | state RACE3: |
michael@0 | 59 | call Child goto DUMMY3_1; |
michael@0 | 60 | answer Parent goto DUMMY3_2; |
michael@0 | 61 | state DUMMY3_1: |
michael@0 | 62 | // the parent receives this from the child in this state |
michael@0 | 63 | recv GetAnsweredParent goto CHECK; |
michael@0 | 64 | // this transition is never taken (if the custom race resolution |
michael@0 | 65 | // works correctly) |
michael@0 | 66 | answer Parent goto CHECK; |
michael@0 | 67 | state DUMMY3_2: |
michael@0 | 68 | call Child goto CHECK; |
michael@0 | 69 | state CHECK: |
michael@0 | 70 | // the child sends this from this state |
michael@0 | 71 | recv GetAnsweredParent goto DYING; |
michael@0 | 72 | // because of deferred processing, the parent receives the child's |
michael@0 | 73 | // message here |
michael@0 | 74 | answer Parent goto DYING; |
michael@0 | 75 | |
michael@0 | 76 | |
michael@0 | 77 | state DYING: |
michael@0 | 78 | send __delete__; |
michael@0 | 79 | }; |
michael@0 | 80 | |
michael@0 | 81 | } // namespace _ipdltest |
michael@0 | 82 | } // namespace mozilla |