michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: // Test that sessionrestore handles cycles in the shentry graph properly. michael@0: // michael@0: // These cycles shouldn't be there in the first place, but they cause hangs michael@0: // when they mysteriously appear (bug 687710). Docshell code assumes this michael@0: // graph is a tree and tires to walk to the root. But if there's a cycle, michael@0: // there is no root, and we loop forever. michael@0: michael@0: let stateBackup = ss.getBrowserState(); michael@0: michael@0: let state = {windows:[{tabs:[{entries:[ michael@0: { michael@0: docIdentifier: 1, michael@0: url: "http://example.com", michael@0: children: [ michael@0: { michael@0: docIdentifier: 2, michael@0: url: "http://example.com" michael@0: } michael@0: ] michael@0: }, michael@0: { michael@0: docIdentifier: 2, michael@0: url: "http://example.com", michael@0: children: [ michael@0: { michael@0: docIdentifier: 1, michael@0: url: "http://example.com" michael@0: } michael@0: ] michael@0: } michael@0: ]}]}]} michael@0: michael@0: function test() { michael@0: registerCleanupFunction(function () { michael@0: ss.setBrowserState(stateBackup); michael@0: }); michael@0: michael@0: /* This test fails by hanging. */ michael@0: ss.setBrowserState(JSON.stringify(state)); michael@0: ok(true, "Didn't hang!"); michael@0: }