browser/components/sessionstore/test/browser_687710.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     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.
    11 let stateBackup = ss.getBrowserState();
    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 ]}]}]}
    36 function test() {
    37   registerCleanupFunction(function () {
    38     ss.setBrowserState(stateBackup);
    39   });
    41   /* This test fails by hanging. */
    42   ss.setBrowserState(JSON.stringify(state));
    43   ok(true, "Didn't hang!");
    44 }

mercurial