diff --git a/mozilla/embedding/components/windowwatcher/public/nsIWindowWatcher.idl b/mozilla/embedding/components/windowwatcher/public/nsIWindowWatcher.idl index cebe85214ab..28900cf81a9 100644 --- a/mozilla/embedding/components/windowwatcher/public/nsIWindowWatcher.idl +++ b/mozilla/embedding/components/windowwatcher/public/nsIWindowWatcher.idl @@ -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, diff --git a/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp b/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp index b52e4aa24a4..c2e14b866ad 100644 --- a/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp +++ b/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp @@ -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 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;