Bug 1532795: Part 4 - Add helper to get BrowsingContext from WindowProxy. r=nika

Differential Revision: https://phabricator.services.mozilla.com/D35377

--HG--
extra : rebase_source : 42022b7759d70aee7733f9c24b1828e7441d4581
This commit is contained in:
Kris Maglione 2019-06-19 13:06:32 -07:00
parent a66227f3cc
commit 00a255e541
3 changed files with 15 additions and 0 deletions

View File

@ -85,6 +85,12 @@ already_AddRefed<BrowsingContext> BrowsingContext::Get(uint64_t aId) {
return do_AddRef(sBrowsingContexts->Get(aId));
}
/* static */
already_AddRefed<BrowsingContext> BrowsingContext::GetFromWindow(
WindowProxyHolder& aProxy) {
return do_AddRef(aProxy.get());
}
CanonicalBrowsingContext* BrowsingContext::Canonical() {
return CanonicalBrowsingContext::Cast(this);
}

View File

@ -105,6 +105,13 @@ class BrowsingContext : public nsWrapperCache, public BrowsingContextBase {
return Get(aId);
}
static already_AddRefed<BrowsingContext> GetFromWindow(
WindowProxyHolder& aProxy);
static already_AddRefed<BrowsingContext> GetFromWindow(
GlobalObject&, WindowProxyHolder& aProxy) {
return GetFromWindow(aProxy);
}
// Create a brand-new BrowsingContext object.
static already_AddRefed<BrowsingContext> Create(BrowsingContext* aParent,
BrowsingContext* aOpener,

View File

@ -9,6 +9,8 @@ interface nsIDocShell;
interface BrowsingContext {
static BrowsingContext? get(unsigned long long aId);
static BrowsingContext? getFromWindow(WindowProxy window);
BrowsingContext? findChildWithName(DOMString name);
BrowsingContext? findWithName(DOMString name);