mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 23:23:33 +00:00
Bug 584402 - Audit references across XPCOM borders [r=mconnor]
Use weak references for observers.
This commit is contained in:
parent
bf06e6e72e
commit
e97c6b419f
@ -1001,7 +1001,7 @@ function BookmarksTracker(name) {
|
||||
for (let guid in kSpecialIds)
|
||||
this.ignoreID(guid);
|
||||
|
||||
Svc.Bookmark.addObserver(this, false);
|
||||
Svc.Bookmark.addObserver(this, true);
|
||||
|
||||
// Explicitly nullify our references to our cached services so we don't leak
|
||||
Observers.add("places-shutdown", function() {
|
||||
@ -1030,7 +1030,8 @@ BookmarksTracker.prototype = {
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsINavBookmarkObserver,
|
||||
Ci.nsINavBookmarkObserver_MOZILLA_1_9_1_ADDITIONS
|
||||
Ci.nsINavBookmarkObserver_MOZILLA_1_9_1_ADDITIONS,
|
||||
Ci.nsISupportsWeakReference
|
||||
]),
|
||||
|
||||
/**
|
||||
|
@ -257,14 +257,15 @@ HistoryStore.prototype = {
|
||||
|
||||
function HistoryTracker(name) {
|
||||
Tracker.call(this, name);
|
||||
Svc.History.addObserver(this, false);
|
||||
Svc.History.addObserver(this, true);
|
||||
}
|
||||
HistoryTracker.prototype = {
|
||||
__proto__: Tracker.prototype,
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsINavHistoryObserver,
|
||||
Ci.nsINavHistoryObserver_MOZILLA_1_9_1_ADDITIONS
|
||||
Ci.nsINavHistoryObserver_MOZILLA_1_9_1_ADDITIONS,
|
||||
Ci.nsISupportsWeakReference
|
||||
]),
|
||||
|
||||
onBeginUpdateBatch: function HT_onBeginUpdateBatch() {},
|
||||
|
@ -232,7 +232,7 @@ function TabTracker(name) {
|
||||
this.onTab = Utils.bind2(this, this.onTab);
|
||||
|
||||
// Register as an observer so we can catch windows opening and closing:
|
||||
Svc.WinWatcher.registerNotification(this);
|
||||
Svc.Obs.add("domwindowopened", this);
|
||||
|
||||
// Also register listeners on already open windows
|
||||
let wins = Svc.WinMediator.getEnumerator("navigator:browser");
|
||||
|
Loading…
x
Reference in New Issue
Block a user