mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-07 04:05:49 +00:00
Fix shutdown leaks of observer service via cycles through JS caused by closures and global variables. b=170022 r=morse sr=jag
This commit is contained in:
parent
e5bfd3c07f
commit
a0abf1d341
@ -34,8 +34,6 @@
|
||||
|
||||
/******* THE FOLLOWING IS FOR THE STATUSBAR OVERLAY *******/
|
||||
|
||||
var gObserverService;
|
||||
var gPref;
|
||||
var gButtonPressed;
|
||||
|
||||
var cookieIconObserver = {
|
||||
@ -68,10 +66,8 @@
|
||||
};
|
||||
|
||||
function viewP3PDialog() {
|
||||
if (!gObserverService) {
|
||||
gObserverService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
|
||||
}
|
||||
gObserverService.notifyObservers(null, "cookieIcon", "off");
|
||||
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
|
||||
observerService.notifyObservers(null, "cookieIcon", "off");
|
||||
|
||||
window.openDialog
|
||||
("chrome://cookie/content/p3pDialog.xul","_blank","modal=yes,chrome,resizable=no", this);
|
||||
@ -82,15 +78,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
function CookieTasksStartup() {
|
||||
// determine if p3p pref is set
|
||||
gPref = Components.classes['@mozilla.org/preferences-service;1'];
|
||||
gPref = gPref.getService();
|
||||
gPref = gPref.QueryInterface(Components.interfaces.nsIPrefBranch);
|
||||
if (gPref.getIntPref("network.cookie.cookieBehavior") == 3) {
|
||||
var pref = Components.classes['@mozilla.org/preferences-service;1'].
|
||||
getService(Components.interfaces.nsIPrefBranch);
|
||||
if (pref.getIntPref("network.cookie.cookieBehavior") == 3) {
|
||||
|
||||
// make sure p3p dll exists, else we can't keep pref set
|
||||
if (!("@mozilla.org/cookie-consent;1" in Components.classes)) {
|
||||
gPref.setIntPref("network.cookie.cookieBehavior", 0);
|
||||
pref.setIntPref("network.cookie.cookieBehavior", 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,6 +100,9 @@
|
||||
// we need to wait until window is created before displaying icon
|
||||
addEventListener("load", listener, false);
|
||||
}
|
||||
}
|
||||
|
||||
CookieTasksStartup();
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user