Bug 1288606 - Fix intermittent orange by making sure a weakly held nsISHistoryListener doesn't get GC'd before the browser_bug670318.js completes. r=jaws

MozReview-Commit-ID: AWvpK6OpmmI

--HG--
extra : rebase_source : 40863e55308f18a6f4172fe74fad323c0ad9cc38
This commit is contained in:
Mike Conley 2016-10-11 09:43:57 -04:00
parent 27428f453d
commit a99bfe13e7

View File

@ -31,6 +31,7 @@ add_task(function* test() {
}, true);
history.removeSHistoryListener(listener);
delete content._testListener;
content.setTimeout(() => { content.location.reload(); }, 0);
}
@ -55,7 +56,14 @@ add_task(function* test() {
};
history.addSHistoryListener(listener);
// Since listener implements nsISupportsWeakReference, we are
// responsible for keeping it alive so that the GC doesn't clear
// it before the test completes. We do this by anchoring the listener
// to the content global window, and clearing it just before the test
// completes.
content._testListener = listener;
content.location = URL;
yield testDone.promise;
});
});