biancadanforth / tracking-protection-shield-study

A Shield study to determine the optimal messaging, if any, for Tracking Protection in Firefox.
0 stars 3 forks source link

Fix "leaked X window(s)" errors from unit tests #89

Closed biancadanforth closed 6 years ago

biancadanforth commented 6 years ago

This is the start of a fix for #88.

FIXED: The addTabsProgressListener now removes itself from the initial window if it closes BEFORE Feature.uninit (i.e. WindowWatcher.stop) is called. So now, we get mTabsProgressListeners.length down to 0 when that window is closed instead of 1. Reason: We were previously not handling the onWindowClose event in the WindowWatcher observe function -- Are event listeners on windows automatically removed on window close? NO.

Also ensures the addTabsProgressListener is added to any newly created windows.

Currently the code is bisected (i.e a large chunk is commented out) for leak debugging purposes. It gets as far into Feature.jsm as addTabsProgressListener and into a portion of its listener onLocationChange.

biancadanforth commented 6 years ago

browser_temporary_permissions_tabs.js unit test now passes with 0 memory leaks! (from this commit)