зеркало из https://github.com/mozilla/pjs.git
Dispatch observer service notifications when dom windows are created and destroyed. Bug 326742, r+sr=jst.
This commit is contained in:
Родитель
2f2c6b9851
Коммит
4698f94e3b
|
@ -8134,6 +8134,15 @@ nsDocShell::EnsureScriptEnvironment()
|
|||
// Note that mScriptGlobal has taken a reference to the script
|
||||
// context, so we don't have to.
|
||||
|
||||
// Notify observers that we've created a new outer window.
|
||||
// The matching notification for domwindowdestroyed is in
|
||||
// nsGlobalWindow::~nsGlobalWindow().
|
||||
nsCOMPtr<nsIObserverService> obsSvc =
|
||||
do_GetService("@mozilla.org/observer-service;1");
|
||||
if (obsSvc) {
|
||||
obsSvc->NotifyObservers(win, "domwindowcreated", nsnull);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -140,6 +140,7 @@
|
|||
#include "nsCSSProps.h"
|
||||
#include "nsIURIFixup.h"
|
||||
#include "nsCDefaultURIFixup.h"
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
#include "plbase64.h"
|
||||
|
||||
|
@ -349,6 +350,16 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
|
|||
|
||||
nsGlobalWindow::~nsGlobalWindow()
|
||||
{
|
||||
if (IsOuterWindow()) {
|
||||
// Only notify about outer window destruction
|
||||
nsCOMPtr<nsIObserverService> obsSvc =
|
||||
do_GetService("@mozilla.org/observer-service;1");
|
||||
if (obsSvc) {
|
||||
obsSvc->NotifyObservers(NS_STATIC_CAST(nsPIDOMWindow*, this),
|
||||
"domwindowdestroyed", nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
if (!--gRefCnt) {
|
||||
NS_IF_RELEASE(gEntropyCollector);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче