Bug 1391110: Part 1 - Convert FrameLoader bindings to WebIDL. r=smaug

XPConnect wrapper overhead for this interface has been showing up heavily in a
lot of my profiles, in some places accounting for 50ms of the 80ms we spend
getting getting <browser> messageManagers. This improves the situation
considerably.

MozReview-Commit-ID: 9d1hCORxsYG

--HG--
rename : dom/base/nsIFrameLoader.idl => dom/webidl/FrameLoader.webidl
extra : rebase_source : d8a1fc1a19632ba36a9fc6f63873f7534671a13b
This commit is contained in:
Kris Maglione 2017-08-19 00:55:00 -07:00
Родитель fb8abb94c7
Коммит 470160f420
9 изменённых файлов: 698 добавлений и 52 удалений

Просмотреть файл

@ -84,6 +84,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/FrameLoaderBinding.h"
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
#include "mozilla/layout/RenderFrameParent.h"
#include "GeckoProfiler.h"
@ -143,17 +144,18 @@ typedef FrameMetrics::ViewID ViewID;
// we'd need to re-institute a fixed version of bug 98158.
#define MAX_DEPTH_CONTENT_FRAMES 10
NS_IMPL_CYCLE_COLLECTION(nsFrameLoader,
mDocShell,
mMessageManager,
mChildMessageManager,
mOpener,
mPartialSHistory)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsFrameLoader,
mDocShell,
mMessageManager,
mChildMessageManager,
mOpener,
mPartialSHistory)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsFrameLoader)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFrameLoader)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameLoader)
NS_INTERFACE_MAP_ENTRY(nsIFrameLoader)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIFrameLoader)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserPersistable)
NS_INTERFACE_MAP_END
@ -231,6 +233,15 @@ nsFrameLoader::Create(Element* aOwner, nsPIDOMWindowOuter* aOpener, bool aNetwor
return new nsFrameLoader(aOwner, aOpener, aNetworkCreated, aJSPluginId);
}
void
nsFrameLoader::LoadFrame(ErrorResult& aRv)
{
nsresult rv = LoadFrame();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::LoadFrame()
{
@ -309,6 +320,15 @@ nsFrameLoader::FireErrorEvent()
loadBlockingAsyncDispatcher->PostDOMEvent();
}
void
nsFrameLoader::LoadURI(nsIURI* aURI, ErrorResult& aRv)
{
nsresult rv = LoadURI(aURI);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::LoadURI(nsIURI* aURI)
{
@ -336,6 +356,15 @@ nsFrameLoader::LoadURI(nsIURI* aURI)
return rv;
}
void
nsFrameLoader::SetIsPrerendered(ErrorResult& aRv)
{
nsresult rv = SetIsPrerendered();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::SetIsPrerendered()
{
@ -345,6 +374,15 @@ nsFrameLoader::SetIsPrerendered()
return NS_OK;
}
void
nsFrameLoader::MakePrerenderedLoaderActive(ErrorResult& aRv)
{
nsresult rv = MakePrerenderedLoaderActive();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::MakePrerenderedLoaderActive()
{
@ -371,6 +409,14 @@ nsFrameLoader::MakePrerenderedLoaderActive()
return NS_OK;
}
already_AddRefed<nsIPartialSHistory>
nsFrameLoader::GetPartialSHistory()
{
nsCOMPtr<nsIPartialSHistory> partialSHistory;
MOZ_ALWAYS_SUCCEEDS(GetPartialSHistory(getter_AddRefs(partialSHistory)));
return partialSHistory.forget();
}
NS_IMETHODIMP
nsFrameLoader::GetPartialSHistory(nsIPartialSHistory** aResult)
{
@ -385,6 +431,17 @@ nsFrameLoader::GetPartialSHistory(nsIPartialSHistory** aResult)
return NS_OK;
}
already_AddRefed<nsIGroupedSHistory>
nsFrameLoader::EnsureGroupedSHistory(ErrorResult& aRv)
{
nsCOMPtr<nsIGroupedSHistory> result;
nsresult rv = EnsureGroupedSHistory(getter_AddRefs(result));
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
return result.forget();
}
NS_IMETHODIMP
nsFrameLoader::EnsureGroupedSHistory(nsIGroupedSHistory** aResult)
{
@ -409,6 +466,14 @@ nsFrameLoader::EnsureGroupedSHistory(nsIGroupedSHistory** aResult)
return NS_OK;
}
already_AddRefed<nsIGroupedSHistory>
nsFrameLoader::GetGroupedSHistory()
{
nsCOMPtr<nsIGroupedSHistory> groupedSHistory;
MOZ_ALWAYS_SUCCEEDS(GetGroupedSHistory(getter_AddRefs(groupedSHistory)));
return groupedSHistory.forget();
}
NS_IMETHODIMP
nsFrameLoader::GetGroupedSHistory(nsIGroupedSHistory** aResult)
{
@ -680,30 +745,32 @@ nsFrameLoader::FireWillChangeProcessEvent()
return allPromise.forget();
}
NS_IMETHODIMP
nsFrameLoader::AppendPartialSHistoryAndSwap(nsIFrameLoader* aOther, nsISupports** aPromise)
already_AddRefed<Promise>
nsFrameLoader::AppendPartialSHistoryAndSwap(nsIFrameLoader& aOther, ErrorResult& aRv)
{
if (!aOther) {
return NS_ERROR_INVALID_POINTER;
nsresult rv = SetIsPrerendered();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return nullptr;
}
if (aOther == this) {
return NS_OK;
if (&aOther == this) {
return nullptr;
}
RefPtr<nsFrameLoader> otherLoader = static_cast<nsFrameLoader*>(aOther);
RefPtr<nsFrameLoader> otherLoader = static_cast<nsFrameLoader*>(&aOther);
RefPtr<Promise> ready = FireWillChangeProcessEvent();
if (NS_WARN_IF(!ready)) {
return NS_ERROR_FAILURE;
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
// This promise will be resolved when the swap has finished, we return it now
// and pass it to our helper so our helper can resolve it.
ErrorResult rv;
RefPtr<Promise> complete = Promise::Create(mOwnerContent->GetOwnerGlobal(), rv);
if (NS_WARN_IF(rv.Failed())) {
return rv.StealNSResult();
RefPtr<Promise> complete = Promise::Create(mOwnerContent->GetOwnerGlobal(), aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
// Attach our handler to the ready promise, and make it fulfil the complete
@ -711,25 +778,39 @@ nsFrameLoader::AppendPartialSHistoryAndSwap(nsIFrameLoader* aOther, nsISupports*
RefPtr<AppendPartialSHistoryAndSwapHelper> helper =
new AppendPartialSHistoryAndSwapHelper(this, otherLoader, complete);
ready->AppendNativeHandler(helper);
return complete.forget();
}
NS_IMETHODIMP
nsFrameLoader::AppendPartialSHistoryAndSwap(nsIFrameLoader* aOther, nsISupports** aPromise)
{
if (!aOther) {
return NS_ERROR_INVALID_POINTER;
}
ErrorResult rv;
RefPtr<Promise> complete = AppendPartialSHistoryAndSwap(*aOther, rv);
if (rv.Failed()) {
return rv.StealNSResult();
}
complete.forget(aPromise);
return NS_OK;
}
NS_IMETHODIMP
nsFrameLoader::RequestGroupedHistoryNavigation(uint32_t aGlobalIndex, nsISupports** aPromise)
already_AddRefed<Promise>
nsFrameLoader::RequestGroupedHistoryNavigation(uint32_t aGlobalIndex, ErrorResult& aRv)
{
RefPtr<Promise> ready = FireWillChangeProcessEvent();
if (NS_WARN_IF(!ready)) {
return NS_ERROR_FAILURE;
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
// This promise will be resolved when the swap has finished, we return it now
// and pass it to our helper so our helper can resolve it.
ErrorResult rv;
RefPtr<Promise> complete = Promise::Create(mOwnerContent->GetOwnerGlobal(), rv);
if (NS_WARN_IF(rv.Failed())) {
return rv.StealNSResult();
RefPtr<Promise> complete = Promise::Create(mOwnerContent->GetOwnerGlobal(), aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
// Attach our handler to the ready promise, and make it fulfil the complete
@ -737,10 +818,31 @@ nsFrameLoader::RequestGroupedHistoryNavigation(uint32_t aGlobalIndex, nsISupport
RefPtr<RequestGroupedHistoryNavigationHelper> helper =
new RequestGroupedHistoryNavigationHelper(this, aGlobalIndex, complete);
ready->AppendNativeHandler(helper);
return complete.forget();
}
NS_IMETHODIMP
nsFrameLoader::RequestGroupedHistoryNavigation(uint32_t aGlobalIndex, nsISupports** aPromise)
{
ErrorResult rv;
RefPtr<Promise> complete = RequestGroupedHistoryNavigation(aGlobalIndex, rv);
if (rv.Failed()) {
return rv.StealNSResult();
}
complete.forget(aPromise);
return NS_OK;
}
void
nsFrameLoader::AddProcessChangeBlockingPromise(Promise& aPromise, ErrorResult& aRv)
{
if (NS_WARN_IF(!mBrowserChangingProcessBlockers)) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
} else {
mBrowserChangingProcessBlockers->AppendElement(&aPromise);
}
}
NS_IMETHODIMP
nsFrameLoader::AddProcessChangeBlockingPromise(js::Handle<js::Value> aPromise,
JSContext* aCx)
@ -755,11 +857,10 @@ nsFrameLoader::AddProcessChangeBlockingPromise(js::Handle<js::Value> aPromise,
return rv.StealNSResult();
}
if (NS_WARN_IF(!mBrowserChangingProcessBlockers)) {
return NS_ERROR_DOM_INVALID_STATE_ERR;
AddProcessChangeBlockingPromise(*promise, rv);
if (NS_WARN_IF(rv.Failed())) {
return rv.StealNSResult();
}
mBrowserChangingProcessBlockers->AppendElement(promise);
return NS_OK;
}
@ -926,6 +1027,17 @@ nsFrameLoader::CheckURILoad(nsIURI* aURI)
return CheckForRecursiveLoad(aURI);
}
already_AddRefed<nsIDocShell>
nsFrameLoader::GetDocShell(ErrorResult& aRv)
{
nsCOMPtr<nsIDocShell> docShell;
nsresult rv = GetDocShell(getter_AddRefs(docShell));
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
return docShell.forget();
}
NS_IMETHODIMP
nsFrameLoader::GetDocShell(nsIDocShell **aDocShell)
{
@ -1980,6 +2092,15 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
return NS_OK;
}
void
nsFrameLoader::Destroy(ErrorResult& aRv)
{
nsresult rv = Destroy();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::Destroy()
{
@ -2784,29 +2905,43 @@ nsFrameLoader::UpdateBaseWindowPositionAndSize(nsSubDocumentFrame *aIFrame)
}
}
NS_IMETHODIMP
nsFrameLoader::GetLazyWidth(uint32_t* aLazyWidth)
uint32_t
nsFrameLoader::LazyWidth() const
{
*aLazyWidth = mLazySize.width;
uint32_t lazyWidth = mLazySize.width;
nsIFrame* frame = GetPrimaryFrameOfOwningContent();
if (frame) {
*aLazyWidth = frame->PresContext()->DevPixelsToIntCSSPixels(*aLazyWidth);
lazyWidth = frame->PresContext()->DevPixelsToIntCSSPixels(lazyWidth);
}
return lazyWidth;
}
NS_IMETHODIMP
nsFrameLoader::GetLazyWidth(uint32_t* aLazyWidth)
{
*aLazyWidth = LazyWidth();
return NS_OK;
}
uint32_t
nsFrameLoader::LazyHeight() const
{
uint32_t lazyHeight = mLazySize.height;
nsIFrame* frame = GetPrimaryFrameOfOwningContent();
if (frame) {
lazyHeight = frame->PresContext()->DevPixelsToIntCSSPixels(lazyHeight);
}
return lazyHeight;
}
NS_IMETHODIMP
nsFrameLoader::GetLazyHeight(uint32_t* aLazyHeight)
{
*aLazyHeight = mLazySize.height;
nsIFrame* frame = GetPrimaryFrameOfOwningContent();
if (frame) {
*aLazyHeight = frame->PresContext()->DevPixelsToIntCSSPixels(*aLazyHeight);
}
*aLazyHeight = LazyHeight();
return NS_OK;
}
@ -3084,6 +3219,15 @@ nsFrameLoader::GetCurrentRenderFrame() const
return nullptr;
}
void
nsFrameLoader::ActivateRemoteFrame(ErrorResult& aRv)
{
nsresult rv = ActivateRemoteFrame();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::ActivateRemoteFrame() {
if (mRemoteBrowser) {
@ -3093,6 +3237,15 @@ nsFrameLoader::ActivateRemoteFrame() {
return NS_ERROR_UNEXPECTED;
}
void
nsFrameLoader::DeactivateRemoteFrame(ErrorResult& aRv)
{
nsresult rv = DeactivateRemoteFrame();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::DeactivateRemoteFrame() {
if (mRemoteBrowser) {
@ -3102,6 +3255,22 @@ nsFrameLoader::DeactivateRemoteFrame() {
return NS_ERROR_UNEXPECTED;
}
void
nsFrameLoader::SendCrossProcessMouseEvent(const nsAString& aType,
float aX,
float aY,
int32_t aButton,
int32_t aClickCount,
int32_t aModifiers,
bool aIgnoreRootScrollFrame,
ErrorResult& aRv)
{
nsresult rv = SendCrossProcessMouseEvent(aType, aX, aY, aButton, aClickCount, aModifiers, aIgnoreRootScrollFrame);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::SendCrossProcessMouseEvent(const nsAString& aType,
float aX,
@ -3120,6 +3289,15 @@ nsFrameLoader::SendCrossProcessMouseEvent(const nsAString& aType,
return NS_ERROR_FAILURE;
}
void
nsFrameLoader::ActivateFrameEvent(const nsAString& aType, bool aCapture, ErrorResult& aRv)
{
nsresult rv = ActivateFrameEvent(aType, aCapture);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::ActivateFrameEvent(const nsAString& aType,
bool aCapture)
@ -3131,6 +3309,20 @@ nsFrameLoader::ActivateFrameEvent(const nsAString& aType,
return NS_ERROR_FAILURE;
}
void
nsFrameLoader::SendCrossProcessKeyEvent(const nsAString& aType,
int32_t aKeyCode,
int32_t aCharCode,
int32_t aModifiers,
bool aPreventDefault,
ErrorResult& aRv)
{
nsresult rv = SendCrossProcessKeyEvent(aType, aKeyCode, aCharCode, aModifiers, aPreventDefault);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::SendCrossProcessKeyEvent(const nsAString& aType,
int32_t aKeyCode,
@ -3264,6 +3456,14 @@ nsFrameLoader::DoSendAsyncMessage(JSContext* aCx,
return NS_ERROR_UNEXPECTED;
}
already_AddRefed<nsIMessageSender>
nsFrameLoader::GetMessageManager()
{
nsCOMPtr<nsIMessageSender> messageManager;
MOZ_ALWAYS_SUCCEEDS(GetMessageManager(getter_AddRefs(messageManager)));
return messageManager.forget();
}
NS_IMETHODIMP
nsFrameLoader::GetMessageManager(nsIMessageSender** aManager)
{
@ -3353,6 +3553,13 @@ nsFrameLoader::GetTabChildGlobalAsEventTarget()
return static_cast<nsInProcessTabChildGlobal*>(mChildMessageManager.get());
}
already_AddRefed<Element>
nsFrameLoader::GetOwnerElement()
{
nsCOMPtr<Element> element = do_QueryInterface(mOwnerContent);
return element.forget();
}
NS_IMETHODIMP
nsFrameLoader::GetOwnerElement(nsIDOMElement **aElement)
{
@ -3490,6 +3697,15 @@ nsFrameLoader::AttributeChanged(nsIDocument* aDocument,
/**
* Send the RequestNotifyAfterRemotePaint message to the current Tab.
*/
void
nsFrameLoader::RequestNotifyAfterRemotePaint(ErrorResult& aRv)
{
nsresult rv = RequestNotifyAfterRemotePaint();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::RequestNotifyAfterRemotePaint()
{
@ -3501,6 +3717,15 @@ nsFrameLoader::RequestNotifyAfterRemotePaint()
return NS_OK;
}
void
nsFrameLoader::RequestFrameLoaderClose(ErrorResult& aRv)
{
nsresult rv = RequestFrameLoaderClose();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::RequestFrameLoaderClose()
{
@ -3513,6 +3738,18 @@ nsFrameLoader::RequestFrameLoaderClose()
return browser->CloseBrowser();
}
void
nsFrameLoader::Print(uint64_t aOuterWindowID,
nsIPrintSettings* aPrintSettings,
nsIWebProgressListener* aProgressListener,
ErrorResult& aRv)
{
nsresult rv = Print(aOuterWindowID, aPrintSettings, aProgressListener);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
NS_IMETHODIMP
nsFrameLoader::Print(uint64_t aOuterWindowID,
nsIPrintSettings* aPrintSettings,
@ -3551,6 +3788,12 @@ nsFrameLoader::Print(uint64_t aOuterWindowID,
return NS_OK;
}
already_AddRefed<nsITabParent>
nsFrameLoader::GetTabParent()
{
return do_AddRef(mRemoteBrowser);
}
NS_IMETHODIMP
nsFrameLoader::GetTabParent(nsITabParent** aTabParent)
{
@ -3559,6 +3802,14 @@ nsFrameLoader::GetTabParent(nsITabParent** aTabParent)
return NS_OK;
}
already_AddRefed<nsILoadContext>
nsFrameLoader::LoadContext()
{
nsCOMPtr<nsILoadContext> loadContext;
MOZ_ALWAYS_SUCCEEDS(GetLoadContext(getter_AddRefs(loadContext)));
return loadContext.forget();
}
NS_IMETHODIMP
nsFrameLoader::GetLoadContext(nsILoadContext** aLoadContext)
{
@ -3768,3 +4019,11 @@ nsFrameLoader::GetProcessMessageManager() const
return mRemoteBrowser ? mRemoteBrowser->Manager()->GetMessageManager()
: nullptr;
};
JSObject*
nsFrameLoader::WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto)
{
JS::RootedObject result(cx);
FrameLoaderBinding::Wrap(cx, this, this, aGivenProto, &result);
return result;
}

Просмотреть файл

@ -17,8 +17,10 @@
#include "nsIFrameLoader.h"
#include "nsPoint.h"
#include "nsSize.h"
#include "nsWrapperCache.h"
#include "nsIURI.h"
#include "nsFrameMessageManager.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Attributes.h"
#include "nsStubMutationObserver.h"
@ -67,7 +69,8 @@ typedef struct _GtkWidget GtkWidget;
class nsFrameLoader final : public nsIFrameLoader,
public nsIWebBrowserPersistable,
public nsStubMutationObserver,
public mozilla::dom::ipc::MessageManagerCallback
public mozilla::dom::ipc::MessageManagerCallback,
public nsWrapperCache
{
friend class AutoResetInShow;
friend class AutoResetInFrameSwap;
@ -84,7 +87,7 @@ public:
int32_t aJSPluginID = nsFakePluginTag::NOT_JSPLUGIN);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
NS_DECL_NSIFRAMELOADER
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
NS_DECL_NSIWEBBROWSERPERSISTABLE
@ -97,6 +100,100 @@ public:
mozilla::dom::EventTarget* GetTabChildGlobalAsEventTarget();
nsresult CreateStaticClone(nsIFrameLoader* aDest);
already_AddRefed<nsIDocShell> GetDocShell(mozilla::ErrorResult& aRv);
already_AddRefed<nsITabParent> GetTabParent();
already_AddRefed<nsILoadContext> LoadContext();
void LoadFrame(mozilla::ErrorResult& aRv);
void LoadURI(nsIURI* aURI, mozilla::ErrorResult& aRv);
void SetIsPrerendered(mozilla::ErrorResult& aRv);
void MakePrerenderedLoaderActive(mozilla::ErrorResult& aRv);
already_AddRefed<mozilla::dom::Promise>
AppendPartialSHistoryAndSwap(nsIFrameLoader& aOther, mozilla::ErrorResult& aRv);
already_AddRefed<mozilla::dom::Promise>
RequestGroupedHistoryNavigation(uint32_t aGlobalIndex, mozilla::ErrorResult& aRv);
void AddProcessChangeBlockingPromise(mozilla::dom::Promise& aPromise, mozilla::ErrorResult& aRv);
void Destroy(mozilla::ErrorResult& aRv);
void ActivateRemoteFrame(mozilla::ErrorResult& aRv);
void DeactivateRemoteFrame(mozilla::ErrorResult& aRv);
void SendCrossProcessMouseEvent(const nsAString& aType,
float aX,
float aY,
int32_t aButton,
int32_t aClickCount,
int32_t aModifiers,
bool aIgnoreRootScrollFrame,
mozilla::ErrorResult& aRv);
void SendCrossProcessKeyEvent(const nsAString& aType,
int32_t aKeyCode,
int32_t aCharCode,
int32_t aModifiers,
bool aPreventDefault,
mozilla::ErrorResult& aRv);
void ActivateFrameEvent(const nsAString& aType,
bool aCapture,
mozilla::ErrorResult& aRv);
void RequestNotifyAfterRemotePaint(mozilla::ErrorResult& aRv);
void RequestFrameLoaderClose(mozilla::ErrorResult& aRv);
void Print(uint64_t aOuterWindowID,
nsIPrintSettings* aPrintSettings,
nsIWebProgressListener* aProgressListener,
mozilla::ErrorResult& aRv);
already_AddRefed<nsIGroupedSHistory> EnsureGroupedSHistory(mozilla::ErrorResult& aRv);
already_AddRefed<nsIMessageSender> GetMessageManager();
uint32_t EventMode() const { return mEventMode; }
already_AddRefed<Element> GetOwnerElement();
uint32_t LazyWidth() const;
uint32_t LazyHeight() const;
already_AddRefed<nsIPartialSHistory> GetPartialSHistory();
already_AddRefed<nsIGroupedSHistory> GetGroupedSHistory();
uint64_t ChildID() const { return mChildID; }
bool ClampScrollPosition() const { return mClampScrollPosition; }
bool ClipSubdocument() const { return mClipSubdocument; }
bool DepthTooGreat() const { return mDepthTooGreat; }
bool IsDead() const { return mDestroyCalled; }
/**
* Is this a frame loader for a bona fide <iframe mozbrowser>?
* <xul:browser> is not a mozbrowser, so this is false for that case.
*/
bool OwnerIsMozBrowserFrame();
nsIContent* GetParentObject() const { return mOwnerContent; }
/**
* MessageManagerCallback methods that we override.
*/
@ -231,6 +328,8 @@ public:
RefPtr<nsFrameMessageManager> mMessageManager;
nsCOMPtr<nsIInProcessContentFrameMessageManager> mChildMessageManager;
virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto) override;
private:
nsFrameLoader(mozilla::dom::Element* aOwner,
nsPIDOMWindowOuter* aOpener,
@ -252,12 +351,6 @@ private:
return mJSPluginID != nsFakePluginTag::NOT_JSPLUGIN;
}
/**
* Is this a frame loader for a bona fide <iframe mozbrowser>?
* <xul:browser> is not a mozbrowser, so this is false for that case.
*/
bool OwnerIsMozBrowserFrame();
/**
* Is this a frame loader for an isolated <iframe mozbrowser>?
*

Просмотреть файл

@ -20,7 +20,7 @@ interface nsIWebProgressListener;
interface nsIGroupedSHistory;
interface nsIPartialSHistory;
[scriptable, builtinclass, uuid(1645af04-1bc7-4363-8f2c-eb9679220ab1)]
[builtinclass, uuid(1645af04-1bc7-4363-8f2c-eb9679220ab1)]
interface nsIFrameLoader : nsISupports
{
/**

Просмотреть файл

@ -379,6 +379,10 @@ DOMInterfaces = {
'wrapperCache': False,
},
'FrameLoader': {
'nativeType': 'nsFrameLoader',
},
'FuzzingFunctions': {
# The codegen is dumb, and doesn't understand that this interface is only a
# collection of static methods, so we have this `concrete: False` hack.
@ -1728,6 +1732,7 @@ addExternalIface('RTCDataChannel', nativeType='nsIDOMDataChannel')
addExternalIface('HitRegionOptions', nativeType='nsISupports')
addExternalIface('imgINotificationObserver', nativeType='imgINotificationObserver')
addExternalIface('imgIRequest', nativeType='imgIRequest', notflattened=True)
addExternalIface('LoadContext', nativeType='nsILoadContext', notflattened=True)
addExternalIface('LoadInfo', nativeType='nsILoadInfo',
headerFile='nsILoadInfo.h', notflattened=True)
addExternalIface('MenuBuilder', nativeType='nsIMenuBuilder', notflattened=True)
@ -1745,10 +1750,18 @@ addExternalIface('nsIBrowserDOMWindow', nativeType='nsIBrowserDOMWindow',
addExternalIface('nsIDOMCrypto', nativeType='nsIDOMCrypto',
headerFile='Crypto.h')
addExternalIface('nsIFile', nativeType='nsIFile', notflattened=True)
addExternalIface('nsIGroupedSHistory', nativeType='nsIGroupedSHistory',
notflattened=True)
addExternalIface('nsILoadGroup', nativeType='nsILoadGroup',
headerFile='nsILoadGroup.h', notflattened=True)
addExternalIface('nsIMessageBroadcaster', nativeType='nsIMessageBroadcaster',
headerFile='nsIMessageManager.h', notflattened=True)
addExternalIface('nsIMessageSender', nativeType='nsIMessageSender',
headerFile='nsIMessageManager.h', notflattened=True)
addExternalIface('nsIPartialSHistory', nativeType='nsIPartialSHistory',
notflattened=True)
addExternalIface('nsIPrintSettings', nativeType='nsIPrintSettings',
notflattened=True)
addExternalIface('nsISelectionListener', nativeType='nsISelectionListener')
addExternalIface('nsIStreamListener', nativeType='nsIStreamListener', notflattened=True)
addExternalIface('nsITransportProvider', nativeType='nsITransportProvider')
@ -1758,6 +1771,8 @@ addExternalIface('nsISupports', nativeType='nsISupports')
addExternalIface('nsIDocShell', nativeType='nsIDocShell', notflattened=True)
addExternalIface('nsIEditor', nativeType='nsIEditor', notflattened=True)
addExternalIface('nsIVariant', nativeType='nsIVariant', notflattened=True)
addExternalIface('nsIWebProgressListener', nativeType='nsIWebProgressListener',
notflattened=True)
addExternalIface('nsIScriptableRegion', nativeType='nsIScriptableRegion', notflattened=True)
addExternalIface('OutputStream', nativeType='nsIOutputStream',
notflattened=True)
@ -1765,6 +1780,8 @@ addExternalIface('Principal', nativeType='nsIPrincipal',
headerFile='nsIPrincipal.h', notflattened=True)
addExternalIface('StackFrame', nativeType='nsIStackFrame',
headerFile='nsIException.h', notflattened=True)
addExternalIface('TabParent', nativeType='nsITabParent',
notflattened=True)
addExternalIface('URI', nativeType='nsIURI', headerFile='nsIURI.h',
notflattened=True)
addExternalIface('XULCommandDispatcher', notflattened=True)

Просмотреть файл

@ -0,0 +1,273 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
interface LoadContext;
interface TabParent;
interface URI;
interface nsIDocShell;
interface nsIGroupedSHistory;
interface nsIMessageSender;
interface nsIPartialSHistory;
interface nsIPrintSettings;
interface nsIWebProgressListener;
[ChromeOnly]
interface FrameLoader {
/**
* Get the docshell from the frame loader.
*/
[GetterThrows]
readonly attribute nsIDocShell? docShell;
/**
* Get this frame loader's TabParent, if it has a remote frame. Otherwise,
* returns null.
*/
readonly attribute TabParent? tabParent;
/**
* Get an nsILoadContext for the top-level docshell. For remote
* frames, a shim is returned that contains private browsing and app
* information.
*/
readonly attribute LoadContext loadContext;
/**
* Start loading the frame. This method figures out what to load
* from the owner content in the frame loader.
*/
[Throws]
void loadFrame();
/**
* Loads the specified URI in this frame. Behaves identically to loadFrame,
* except that this method allows specifying the URI to load.
*/
[Throws]
void loadURI(URI aURI);
/**
* Puts the frameloader in prerendering mode.
*/
[Throws]
void setIsPrerendered();
/**
* Make the prerendered frameloader being active (and clear isPrerendered flag).
*/
[Throws]
void makePrerenderedLoaderActive();
/**
* Append partial session history from another frame loader.
*
* @return A promise which will be resolved when the navigation is complete.
*/
[Throws]
Promise<void> appendPartialSHistoryAndSwap(FrameLoader aOther);
/**
* If grouped session history is applied, use this function to navigate to
* an entry of session history object of another frameloader.
*
* @return A promise which will be resolved when the navigation is complete.
*/
[Throws]
Promise<void> requestGroupedHistoryNavigation(unsigned long aGlobalIndex);
/**
* Adds a blocking promise for the current cross process navigation.
* This method can only be called while the "BrowserWillChangeProcess" event
* is being fired.
*/
[Throws]
void addProcessChangeBlockingPromise(Promise<any> aPromise);
/**
* Destroy the frame loader and everything inside it. This will
* clear the weak owner content reference.
*/
[Throws]
void destroy();
/**
* Find out whether the loader's frame is at too great a depth in
* the frame tree. This can be used to decide what operations may
* or may not be allowed on the loader's docshell.
*/
[Pure]
readonly attribute boolean depthTooGreat;
/**
* Activate remote frame.
* Throws an exception with non-remote frames.
*/
[Throws]
void activateRemoteFrame();
/**
* Deactivate remote frame.
* Throws an exception with non-remote frames.
*/
[Throws]
void deactivateRemoteFrame();
/**
* @see nsIDOMWindowUtils sendMouseEvent.
*/
[Throws]
void sendCrossProcessMouseEvent(DOMString aType,
float aX,
float aY,
long aButton,
long aClickCount,
long aModifiers,
optional boolean aIgnoreRootScrollFrame = false);
/**
* Activate event forwarding from client (remote frame) to parent.
*/
[Throws]
void activateFrameEvent(DOMString aType, boolean capture);
// Note, when frameloaders are swapped, also messageManagers are swapped.
readonly attribute nsIMessageSender? messageManager;
/**
* @see nsIDOMWindowUtils sendKeyEvent.
*/
[Throws]
void sendCrossProcessKeyEvent(DOMString aType,
long aKeyCode,
long aCharCode,
long aModifiers,
optional boolean aPreventDefault = false);
/**
* Request that the next time a remote layer transaction has been
* received by the Compositor, a MozAfterRemoteFrame event be sent
* to the window.
*/
[Throws]
void requestNotifyAfterRemotePaint();
/**
* Close the window through the ownerElement.
*/
[Throws]
void requestFrameLoaderClose();
/**
* Print the current document.
*
* @param aOuterWindowID the ID of the outer window to print
* @param aPrintSettings optional print settings to use; printSilent can be
* set to prevent prompting.
* @param aProgressListener optional print progress listener.
*/
[Throws]
void print(unsigned long long aOuterWindowID,
nsIPrintSettings aPrintSettings,
nsIWebProgressListener aProgressListener);
/**
* Ensure that the current nsIFrameLoader has a GroupedSHistory.
*/
[Throws]
nsIGroupedSHistory ensureGroupedSHistory();
/**
* The default event mode automatically forwards the events
* handled in EventStateManager::HandleCrossProcessEvent to
* the child content process when these events are targeted to
* the remote browser element.
*
* Used primarly for input events (mouse, keyboard)
*/
const unsigned long EVENT_MODE_NORMAL_DISPATCH = 0x00000000;
/**
* With this event mode, it's the application's responsability to
* convert and forward events to the content process
*/
const unsigned long EVENT_MODE_DONT_FORWARD_TO_CHILD = 0x00000001;
[Pure]
attribute unsigned long eventMode;
/**
* If false, then the subdocument is not clipped to its CSS viewport, and the
* subdocument's viewport scrollbar(s) are not rendered.
* Defaults to true.
*/
attribute boolean clipSubdocument;
/**
* If false, then the subdocument's scroll coordinates will not be clamped
* to their scroll boundaries.
* Defaults to true.
*/
attribute boolean clampScrollPosition;
/**
* The element which owns this frame loader.
*
* For example, if this is a frame loader for an <iframe>, this attribute
* returns the iframe element.
*/
[Pure]
readonly attribute Element? ownerElement;
/**
* Cached childID of the ContentParent owning the TabParent in this frame
* loader. This can be used to obtain the childID after the TabParent died.
*/
[Pure]
readonly attribute unsigned long long childID;
/**
* Find out whether the owner content really is a mozbrowser. <xul:browser>
* is not considered to be a mozbrowser frame.
*/
[Pure]
readonly attribute boolean ownerIsMozBrowserFrame;
/**
* The last known width of the frame. Reading this property will not trigger
* a reflow, and therefore may not reflect the current state of things. It
* should only be used in asynchronous APIs where values are not guaranteed
* to be up-to-date when received.
*/
[Pure]
readonly attribute unsigned long lazyWidth;
/**
* The last known height of the frame. Reading this property will not trigger
* a reflow, and therefore may not reflect the current state of things. It
* should only be used in asynchronous APIs where values are not guaranteed
* to be up-to-date when received.
*/
[Pure]
readonly attribute unsigned long lazyHeight;
/**
* The partial session history.
*/
readonly attribute nsIPartialSHistory? partialSHistory;
/**
* The grouped session history composed of multiple session history objects
* across root docshells.
*/
readonly attribute nsIGroupedSHistory? groupedSHistory;
/**
* Is `true` if the frameloader is dead (destroy has been called on it)
*/
[Pure]
readonly attribute boolean isDead;
};

Просмотреть файл

@ -40,6 +40,7 @@ Element implements LegacyQueryInterface;
Event implements LegacyQueryInterface;
EventSource implements LegacyQueryInterface;
FileList implements LegacyQueryInterface;
FrameLoader implements LegacyQueryInterface;
FormData implements LegacyQueryInterface;
HTMLCollection implements LegacyQueryInterface;
History implements LegacyQueryInterface;

Просмотреть файл

@ -5,7 +5,6 @@
*/
interface XULControllers;
interface MozFrameLoader;
interface MozRDFCompositeDataSource;
interface MozRDFResource;
@ -116,7 +115,7 @@ interface XULElement : Element {
[NoInterfaceObject]
interface MozFrameLoaderOwner {
[ChromeOnly]
readonly attribute MozFrameLoader? frameLoader;
readonly attribute FrameLoader? frameLoader;
[ChromeOnly]
void setIsPrerendered();

Просмотреть файл

@ -538,6 +538,7 @@ WEBIDL_FILES = [
'FontFaceSet.webidl',
'FontFaceSource.webidl',
'FormData.webidl',
'FrameLoader.webidl',
'Function.webidl',
'GainNode.webidl',
'Gamepad.webidl',

Просмотреть файл

@ -107,6 +107,7 @@
#include "nsIDOMXULCommandEvent.h"
#include "nsIDOMXULDocument.h"
#include "nsIDOMXULElement.h"
#include "nsIFrameLoader.h"
#include "nsIListBoxObject.h"
#include "nsIMenuBoxObject.h"
#include "nsIScrollBoxObject.h"
@ -151,6 +152,7 @@
#include "mozilla/dom/FileListBinding.h"
#include "mozilla/dom/FocusEventBinding.h"
#include "mozilla/dom/FormDataBinding.h"
#include "mozilla/dom/FrameLoaderBinding.h"
#include "mozilla/dom/HistoryBinding.h"
#include "mozilla/dom/HTMLAnchorElementBinding.h"
#include "mozilla/dom/HTMLAreaElementBinding.h"
@ -316,6 +318,7 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
DEFINE_SHIM(FileList),
DEFINE_SHIM(FocusEvent),
DEFINE_SHIM(FormData),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIFrameLoader, FrameLoader),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMGeoPositionError, PositionError),
DEFINE_SHIM(History),
DEFINE_SHIM(HTMLAnchorElement),