Closed Bug 659629 Opened 14 years ago Closed 9 years ago

Enabling private mode from TabClose event listener hangs browser

Categories

(Firefox :: Private Browsing, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: irakli, Unassigned)

References

Details

Here is a snippet with reproducible scenario: https://gist.github.com/991031
So in order to reproduce this bug you need to do following: 1. Open two tabs in the same window. 2. Execute code from the snippet. 3. Close the active tab.
Transitioning the PB mode causes all of the open tabs to be closed. If you install a close handler on tabs asking the PB mode to change again, you're bound to get an infinite recursion. I'm not sure what you're requesting here. The code you quoted is incorrect, and it should be fixed. I'm not sure if there is anything in the Private Browsing implementation that we can do to prevent callers from doing things like this.
I was expecting that attempt to close same tab from the listener won't trigger 'TabClose' event again. I have updated gist, in order to remove my listener to avoid recursion, still switch to PB mode hangs browser. If this behavior still expected can you please give more details on what enters infinite recursion ? Thanks!
(In reply to comment #3) > I was expecting that attempt to close same tab from the listener won't trigger > 'TabClose' event again. I have updated gist, in order to remove my listener to > avoid recursion, still switch to PB mode hangs browser. > > If this behavior still expected can you please give more details on what enters > infinite recursion ? This behavior is expected. We call the sessionstore's setBrowserState function to switch private and non-private sessions (look for those calls here <http://mxr.mozilla.org/mozilla-central/source/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js>), and those APIs internally close tabs, which triggers TabClose events before the PB transition has been completed, where you initiate another one, causing the infinite recursion.
As I mentioned in previous comment, my listener is called only once (I dump when it's called), also I remove my `TabClose` event listener once it's called so that it can not be called more then once. So even if PB transition causes `TabClose` events my code does not ninitiate that recursively, that suggests me that something else does.
Can you get a js and C++ stack of the hang and attach it to the bug, please?
We no longer have a 'private mode' in the same way, so it seems unlikely we will be able to do something useful here.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.