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

git-svn-id: svn://10.0.0.236/trunk@189785 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bryner%brianryner.com 2006-02-12 00:39:26 +00:00
parent 045e3ffeef
commit dfa7da67ad
2 changed files with 12 additions and 0 deletions

View File

@ -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,

View File

@ -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;