Opened 21 months ago

Last modified 4 months ago

#29334 new defect

Exception when running the garbage collection during new identity

Reported by: gk Owned by: tbb-team
Priority: Medium Milestone:
Component: Applications/Tor Browser Version:
Severity: Normal Keywords: tbb-torbutton, tbb-newnym, gitlab-tb-torbutton
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


During New Identity we run some fancy code to make sure we are really have a clean state after closing and reopening the browser:

  // Run garbage collection and cycle collection after window is gone.
  // This ensures that blob URIs are forgotten.
  window.addEventListener("unload", function (event) {
    torbutton_log(3, "Initiating New Identity GC pass");
    // Clear out potential pending sInterSliceGCTimer:

    // Clear out potential pending sICCTimer:

    // Schedule a garbage collection in 4000-1000ms...

    // To ensure the GC runs immediately instead of 4-10s from now, we need
    // to poke it at least 11 times.
    // We need 5 pokes for GC, 1 poke for the interSliceGC, and 5 pokes for CC.
    // See nsJSContext::RunNextCollectorTimer() in
    // XXX: We might want to make our own method for immediate full GC...
    for (let poke = 0; poke < 11; poke++) {

    // And now, since the GC probably actually ran *after* the CC last time,
    // run the whole thing again.
    for (let poke = 0; poke < 11; poke++) {

That leads to an exception in chrome://extensions/content/ext-tabs-base.js in some cases at

get frameLoader() {
    return this.browser.frameLoader;

as it is not guaranteed that browser is still a thing during that operation. An example where this occurs is

1) On about:page open the link to our newsletter in a new tab
2) Open the browser console
3) Hit New Identity

This got reported on our blog ff.

Child Tickets

Change History (1)

comment:1 Changed 4 months ago by gk

Keywords: gitlab-tb-torbutton added

Add magic gitlab keyword.

Note: See TracTickets for help on using tickets.