Bug 1542781 - Expose browsingContext on FrameLoaderOwner, r=farre

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nika Layzell 2019-04-08 16:27:28 +00:00
parent 96425af79a
commit 91f0500959
3 changed files with 16 additions and 1 deletions

View File

@ -7,6 +7,7 @@
#include "nsFrameLoaderOwner.h"
#include "nsFrameLoader.h"
#include "mozilla/dom/FrameLoaderBinding.h"
#include "mozilla/dom/BrowsingContext.h"
already_AddRefed<nsFrameLoader> nsFrameLoaderOwner::GetFrameLoader() {
return do_AddRef(mFrameLoader);
@ -16,6 +17,14 @@ void nsFrameLoaderOwner::SetFrameLoader(nsFrameLoader* aNewFrameLoader) {
mFrameLoader = aNewFrameLoader;
}
already_AddRefed<mozilla::dom::BrowsingContext>
nsFrameLoaderOwner::GetBrowsingContext() {
if (mFrameLoader) {
return mFrameLoader->GetBrowsingContext();
}
return nullptr;
}
void nsFrameLoaderOwner::ChangeRemoteness(
const mozilla::dom::RemotenessOptions& aOptions, mozilla::ErrorResult& rv) {
// If we already have a Frameloader, destroy it.

View File

@ -11,8 +11,9 @@ class nsFrameLoader;
namespace mozilla {
class ErrorResult;
namespace dom {
class BrowsingContext;
struct RemotenessOptions;
}
} // namespace dom
} // namespace mozilla
// IID for the FrameLoaderOwner interface
@ -38,6 +39,8 @@ class nsFrameLoaderOwner : public nsISupports {
already_AddRefed<nsFrameLoader> GetFrameLoader();
void SetFrameLoader(nsFrameLoader* aNewFrameLoader);
already_AddRefed<mozilla::dom::BrowsingContext> GetBrowsingContext();
// Destroy (if it exists) and recreate our frameloader, based on new
// remoteness requirements. This should follow the same path as
// tabbrowser.js's updateBrowserRemoteness, including running the same logic

View File

@ -15,6 +15,9 @@ interface MozFrameLoaderOwner {
[ChromeOnly]
readonly attribute FrameLoader? frameLoader;
[ChromeOnly]
readonly attribute BrowsingContext? browsingContext;
[ChromeOnly, Throws]
void presetOpenerWindow(WindowProxy? window);