|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 // Test that sessionrestore handles cycles in the shentry graph properly. |
|
5 // |
|
6 // These cycles shouldn't be there in the first place, but they cause hangs |
|
7 // when they mysteriously appear (bug 687710). Docshell code assumes this |
|
8 // graph is a tree and tires to walk to the root. But if there's a cycle, |
|
9 // there is no root, and we loop forever. |
|
10 |
|
11 let stateBackup = ss.getBrowserState(); |
|
12 |
|
13 let state = {windows:[{tabs:[{entries:[ |
|
14 { |
|
15 docIdentifier: 1, |
|
16 url: "http://example.com", |
|
17 children: [ |
|
18 { |
|
19 docIdentifier: 2, |
|
20 url: "http://example.com" |
|
21 } |
|
22 ] |
|
23 }, |
|
24 { |
|
25 docIdentifier: 2, |
|
26 url: "http://example.com", |
|
27 children: [ |
|
28 { |
|
29 docIdentifier: 1, |
|
30 url: "http://example.com" |
|
31 } |
|
32 ] |
|
33 } |
|
34 ]}]}]} |
|
35 |
|
36 function test() { |
|
37 registerCleanupFunction(function () { |
|
38 ss.setBrowserState(stateBackup); |
|
39 }); |
|
40 |
|
41 /* This test fails by hanging. */ |
|
42 ss.setBrowserState(JSON.stringify(state)); |
|
43 ok(true, "Didn't hang!"); |
|
44 } |