tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_687710.js (1542B)


      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 var stateBackup = ss.getBrowserState();
     12 
     13 var state = {
     14  windows: [
     15    {
     16      tabs: [
     17        {
     18          entries: [
     19            {
     20              docIdentifier: 1,
     21              url: "http://example.com",
     22              triggeringPrincipal_base64,
     23              children: [
     24                {
     25                  docIdentifier: 2,
     26                  url: "http://example.com",
     27                  triggeringPrincipal_base64,
     28                },
     29              ],
     30            },
     31            {
     32              docIdentifier: 2,
     33              url: "http://example.com",
     34              triggeringPrincipal_base64,
     35              children: [
     36                {
     37                  docIdentifier: 1,
     38                  url: "http://example.com",
     39                  triggeringPrincipal_base64,
     40                },
     41              ],
     42            },
     43          ],
     44        },
     45      ],
     46    },
     47  ],
     48 };
     49 
     50 add_task(async function test() {
     51  registerCleanupFunction(function () {
     52    ss.setBrowserState(stateBackup);
     53  });
     54 
     55  /* This test fails by hanging. */
     56  await setBrowserState(state);
     57  ok(true, "Didn't hang!");
     58 });