зеркало из https://github.com/mozilla/gecko-dev.git
Add a Destruct() function to remove observers on onload.
This commit is contained in:
Родитель
871e90e3eb
Коммит
9388dd2b52
|
@ -206,6 +206,23 @@ function Init()
|
|||
}
|
||||
}
|
||||
|
||||
function Destruct() {
|
||||
// Install the observer so we'll be notified when new content is loaded.
|
||||
var ObserverService = Components.classes["component://netscape/observer-service"].getService();
|
||||
ObserverService = ObserverService.QueryInterface(Components.interfaces.nsIObserverService);
|
||||
if (ObserverService)
|
||||
{
|
||||
debug("Removing observer\n");
|
||||
ObserverService.RemoveObserver(Observer, "StartDocumentLoad");
|
||||
ObserverService.RemoveObserver(Observer, "EndDocumentLoad");
|
||||
ObserverService.RemoveObserver(Observer, "FailDocumentLoad");
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("FAILURE to get observer service\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function openURL(event, treeitem, root)
|
||||
|
@ -253,3 +270,6 @@ function openURL(event, treeitem, root)
|
|||
|
||||
ContentWindow.location = id;
|
||||
}
|
||||
|
||||
addEventListener("load", Init, false);
|
||||
addEventListener("unload", Destruct, false);
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
align="vertical"
|
||||
onload="Init();">
|
||||
align="vertical">
|
||||
|
||||
<html:script src="chrome://communicator/content/related/related-panel.js" />
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче