Dispatch a notification that a newly-opened window has been initialized (bug 326784). r+sr=bzbarsky.

This commit is contained in:
bryner%brianryner.com 2006-02-12 00:39:26 +00:00
Родитель f0a9209f86
Коммит a084fa9ff9
2 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -96,6 +96,8 @@ interface nsIWindowWatcher : nsISupports {
@note This method should try to set the default charset for the new
window to the default charset of aParent. This is not guaranteed,
however.
@note This method may dispatch a "toplevel-window-ready" notification
via nsIObserverService if the window did not already exist.
*/
nsIDOMWindow openWindow(in nsIDOMWindow aParent, in string aUrl,
in string aName, in string aFeatures,

Просмотреть файл

@ -839,6 +839,16 @@ nsWindowWatcher::OpenWindowJSInternal(nsIDOMWindow *aParent,
}
}
if (windowIsNew) {
// Notify observers that the window is open and ready.
// The window has not yet started to load a document.
nsCOMPtr<nsIObserverService> obsSvc =
do_GetService("@mozilla.org/observer-service;1");
if (obsSvc) {
obsSvc->NotifyObservers(*_retval, "toplevel-window-ready", nsnull);
}
}
if (uriToLoad) { // get the script principal and pass it to docshell
JSContextAutoPopper contextGuard;