Bug 549539: Send a notification after a new window is created, but before any script inside it has run. r=mrbkap sr=bz

--HG--
extra : rebase_source : f15c2b197eb1a54a2ecb9b738729fda75565932c
This commit is contained in:
Jonas Sicking 2010-03-12 17:04:02 -08:00
parent 6464e01c74
commit 119924bbe0

View File

@ -2061,6 +2061,20 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
}
}
nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1");
if (observerService) {
nsAutoString origin;
nsIPrincipal* principal = aDocument->NodePrincipal();
nsContentUtils::GetUTFOrigin(principal, origin);
observerService->
NotifyObservers(static_cast<nsIDOMWindow*>(this),
nsContentUtils::IsSystemPrincipal(principal) ?
"chrome-document-global-created" :
"content-document-global-created",
origin.get());
}
return NS_OK;
}