waiter waiter more webextensions please

This commit is contained in:
wuggy 2026-09-14 14:37:34 -07:00
commit bb0adb61ae
10 changed files with 198 additions and 8 deletions

View file

@ -6,6 +6,7 @@
//#define USEWEAKREFS // (haven't quite figured that out yet)
#include "nsWindowWatcher.h"
#include "nsHashPropertyBag.h"
#include "nsAutoWindowStateHelper.h"
#include "nsCRT.h"
@ -1212,6 +1213,29 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent,
// userContextId.
MOZ_ASSERT(CheckUserContextCompatibility(newDocShell));
// If this tab or window has been opened by a window.open call, we have to provide
// all the data needed to send a webNavigation.onCreatedNavigationTarget event.
if (windowIsNew && parentDocShell && newDocShellItem) {
nsCOMPtr<nsIObserverService> obsSvc =
mozilla::services::GetObserverService();
if (obsSvc) {
RefPtr<nsHashPropertyBag> props = new nsHashPropertyBag();
if (uriToLoad) {
// The url notified in the webNavigation.onCreatedNavigationTarget event.
props->SetPropertyAsACString(NS_LITERAL_STRING("url"),
uriToLoad->GetSpecOrDefault());
}
props->SetPropertyAsInterface(NS_LITERAL_STRING("sourceTabDocShell"), parentDocShell);
props->SetPropertyAsInterface(NS_LITERAL_STRING("createdTabDocShell"), newDocShellItem);
obsSvc->NotifyObservers(static_cast<nsIPropertyBag2*>(props),
"webNavigation-createdNavigationTarget-from-js", nullptr);
}
}
if (uriToLoad && aNavigate) {
newDocShell->LoadURI(
uriToLoad,