2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2005-02-08 02:53:47 +03:00
|
|
|
|
2006-03-30 12:03:04 +04:00
|
|
|
/*
|
|
|
|
* Class for managing loading of a subframe (creation of the docshell,
|
|
|
|
* handling of loads in it, recursion-checking).
|
|
|
|
*/
|
|
|
|
|
2005-02-08 02:53:47 +03:00
|
|
|
#ifndef nsFrameLoader_h_
|
|
|
|
#define nsFrameLoader_h_
|
|
|
|
|
|
|
|
#include "nsIDocShell.h"
|
|
|
|
#include "nsStringFwd.h"
|
2018-03-22 05:43:17 +03:00
|
|
|
#include "nsIFrameLoaderOwner.h"
|
2010-09-04 00:10:46 +04:00
|
|
|
#include "nsPoint.h"
|
2009-10-05 15:52:19 +04:00
|
|
|
#include "nsSize.h"
|
2017-08-19 10:55:00 +03:00
|
|
|
#include "nsWrapperCache.h"
|
2008-03-21 14:44:09 +03:00
|
|
|
#include "nsIURI.h"
|
2010-02-20 20:05:20 +03:00
|
|
|
#include "nsFrameMessageManager.h"
|
2017-08-19 10:55:00 +03:00
|
|
|
#include "mozilla/dom/BindingUtils.h"
|
2011-10-01 21:14:35 +04:00
|
|
|
#include "mozilla/dom/Element.h"
|
2018-02-02 01:56:54 +03:00
|
|
|
#include "mozilla/dom/ParentSHistory.h"
|
2012-06-19 06:30:09 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-09-05 07:00:26 +04:00
|
|
|
#include "nsStubMutationObserver.h"
|
2015-03-05 12:13:05 +03:00
|
|
|
#include "Units.h"
|
2016-05-05 00:12:48 +03:00
|
|
|
#include "nsIFrame.h"
|
2017-05-29 13:38:46 +03:00
|
|
|
#include "nsPluginTags.h"
|
2005-02-08 02:53:47 +03:00
|
|
|
|
2005-03-08 03:02:55 +03:00
|
|
|
class nsIURI;
|
2010-08-31 04:49:07 +04:00
|
|
|
class nsSubDocumentFrame;
|
2013-01-03 17:23:11 +04:00
|
|
|
class nsView;
|
2010-05-28 23:34:50 +04:00
|
|
|
class AutoResetInShow;
|
2015-08-07 17:17:50 +03:00
|
|
|
class AutoResetInFrameSwap;
|
2012-06-13 02:01:25 +04:00
|
|
|
class nsITabParent;
|
2012-09-05 07:00:26 +04:00
|
|
|
class nsIDocShellTreeItem;
|
|
|
|
class nsIDocShellTreeOwner;
|
2018-03-22 05:43:17 +03:00
|
|
|
class nsILoadContext;
|
|
|
|
class nsIMessageSender;
|
|
|
|
class nsIPrintSettings;
|
2018-04-09 23:30:33 +03:00
|
|
|
class nsIWebBrowserPersistDocumentReceiver;
|
2018-03-22 05:43:17 +03:00
|
|
|
class nsIWebProgressListener;
|
2009-07-20 23:04:52 +04:00
|
|
|
|
2009-07-01 00:39:22 +04:00
|
|
|
namespace mozilla {
|
2016-05-30 02:48:00 +03:00
|
|
|
|
2017-01-12 19:38:48 +03:00
|
|
|
class OriginAttributes;
|
2016-05-30 02:48:00 +03:00
|
|
|
|
2010-07-19 22:33:33 +04:00
|
|
|
namespace dom {
|
2018-10-20 03:02:37 +03:00
|
|
|
class BrowsingContext;
|
2017-06-14 17:44:17 +03:00
|
|
|
class ChromeMessageSender;
|
2013-07-18 03:34:57 +04:00
|
|
|
class ContentParent;
|
2018-08-11 00:08:07 +03:00
|
|
|
class InProcessTabChildMessageManager;
|
2018-02-16 12:34:21 +03:00
|
|
|
class MessageSender;
|
2010-07-19 22:33:33 +04:00
|
|
|
class PBrowserParent;
|
2018-04-16 16:18:48 +03:00
|
|
|
class ProcessMessageManager;
|
2016-11-09 22:51:02 +03:00
|
|
|
class Promise;
|
2010-07-19 22:33:33 +04:00
|
|
|
class TabParent;
|
2015-10-08 09:44:36 +03:00
|
|
|
class MutableTabContext;
|
2010-08-21 03:24:41 +04:00
|
|
|
|
2015-09-10 23:50:58 +03:00
|
|
|
namespace ipc {
|
|
|
|
class StructuredCloneData;
|
|
|
|
} // namespace ipc
|
|
|
|
|
2016-11-24 18:08:31 +03:00
|
|
|
} // namespace dom
|
|
|
|
|
2010-08-21 03:24:41 +04:00
|
|
|
namespace layout {
|
2018-11-07 00:35:37 +03:00
|
|
|
class RenderFrame;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layout
|
|
|
|
} // namespace mozilla
|
2009-10-28 23:41:46 +03:00
|
|
|
|
2013-06-12 16:04:28 +04:00
|
|
|
#if defined(MOZ_WIDGET_GTK)
|
2009-10-28 23:41:46 +03:00
|
|
|
typedef struct _GtkWidget GtkWidget;
|
|
|
|
#endif
|
2005-02-08 02:53:47 +03:00
|
|
|
|
2018-03-22 05:43:16 +03:00
|
|
|
// IID for nsFrameLoader, because some places want to QI to it.
|
|
|
|
#define NS_FRAMELOADER_IID \
|
2018-11-30 13:46:48 +03:00
|
|
|
{ \
|
2018-03-22 05:43:16 +03:00
|
|
|
0x297fd0ea, 0x1b4a, 0x4c9a, { \
|
|
|
|
0xa4, 0x04, 0xe5, 0x8b, 0xe8, 0x95, 0x10, 0x50 \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2018-04-09 23:30:33 +03:00
|
|
|
class nsFrameLoader final : public nsStubMutationObserver,
|
2017-08-19 10:55:00 +03:00
|
|
|
public mozilla::dom::ipc::MessageManagerCallback,
|
|
|
|
public nsWrapperCache {
|
2011-01-13 20:45:14 +03:00
|
|
|
friend class AutoResetInShow;
|
2015-08-07 17:17:50 +03:00
|
|
|
friend class AutoResetInFrameSwap;
|
2011-01-13 20:45:14 +03:00
|
|
|
typedef mozilla::dom::PBrowserParent PBrowserParent;
|
|
|
|
typedef mozilla::dom::TabParent TabParent;
|
2018-11-07 00:35:37 +03:00
|
|
|
typedef mozilla::layout::RenderFrame RenderFrame;
|
2011-01-13 20:45:14 +03:00
|
|
|
|
2014-06-25 06:09:15 +04:00
|
|
|
public:
|
2011-10-01 21:14:35 +04:00
|
|
|
static nsFrameLoader* Create(
|
|
|
|
mozilla::dom::Element* aOwner, nsPIDOMWindowOuter* aOpener,
|
2017-05-29 13:38:46 +03:00
|
|
|
bool aNetworkCreated,
|
|
|
|
int32_t aJSPluginID = nsFakePluginTag::NOT_JSPLUGIN);
|
2009-08-19 13:09:26 +04:00
|
|
|
|
2018-03-22 05:43:16 +03:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_FRAMELOADER_IID)
|
|
|
|
|
2007-03-08 14:17:16 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2018-04-09 23:30:33 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsFrameLoader)
|
|
|
|
|
2012-09-05 07:00:26 +04:00
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
2014-06-02 16:08:21 +04:00
|
|
|
nsresult CheckForRecursiveLoad(nsIURI* aURI);
|
2008-03-21 14:44:09 +03:00
|
|
|
nsresult ReallyStartLoading();
|
2015-02-27 08:35:26 +03:00
|
|
|
void StartDestroy();
|
|
|
|
void DestroyDocShell();
|
|
|
|
void DestroyComplete();
|
2008-04-24 14:33:22 +04:00
|
|
|
nsIDocShell* GetExistingDocShell() { return mDocShell; }
|
2018-08-11 00:08:07 +03:00
|
|
|
mozilla::dom::InProcessTabChildMessageManager* GetTabChildMessageManager()
|
|
|
|
const {
|
2018-08-03 06:49:09 +03:00
|
|
|
return mChildMessageManager;
|
|
|
|
}
|
2018-03-22 05:43:17 +03:00
|
|
|
nsresult CreateStaticClone(nsFrameLoader* aDest);
|
2018-03-22 05:43:15 +03:00
|
|
|
nsresult UpdatePositionAndSize(nsSubDocumentFrame* aIFrame);
|
2017-08-20 00:16:16 +03:00
|
|
|
|
|
|
|
// WebIDL methods
|
|
|
|
|
2018-03-22 05:43:15 +03:00
|
|
|
nsIDocShell* GetDocShell(mozilla::ErrorResult& aRv);
|
2017-08-19 10:55:00 +03:00
|
|
|
|
|
|
|
already_AddRefed<nsITabParent> GetTabParent();
|
|
|
|
|
|
|
|
already_AddRefed<nsILoadContext> LoadContext();
|
|
|
|
|
2018-10-20 03:02:37 +03:00
|
|
|
already_AddRefed<mozilla::dom::BrowsingContext> GetBrowsingContext();
|
|
|
|
|
2018-03-22 05:43:16 +03:00
|
|
|
/**
|
|
|
|
* Start loading the frame. This method figures out what to load
|
|
|
|
* from the owner content in the frame loader.
|
|
|
|
*/
|
|
|
|
void LoadFrame(bool aOriginalSrc);
|
2017-08-19 10:55:00 +03:00
|
|
|
|
2017-10-05 08:59:44 +03:00
|
|
|
/**
|
2018-03-22 05:43:17 +03:00
|
|
|
* Loads the specified URI in this frame. Behaves identically to loadFrame,
|
|
|
|
* except that this method allows specifying the URI to load.
|
2018-09-28 17:00:13 +03:00
|
|
|
*
|
|
|
|
* @param aURI The URI to load.
|
|
|
|
* @param aTriggeringPrincipal The triggering principal for the load. May be
|
|
|
|
* null, in which case the node principal of the owner content will be
|
|
|
|
* used.
|
2017-10-05 08:59:44 +03:00
|
|
|
*/
|
2018-09-28 17:00:13 +03:00
|
|
|
nsresult LoadURI(nsIURI* aURI, nsIPrincipal* aTriggeringPrincipal,
|
|
|
|
bool aOriginalSrc);
|
2017-10-05 08:59:44 +03:00
|
|
|
|
2018-03-22 05:43:16 +03:00
|
|
|
/**
|
|
|
|
* Destroy the frame loader and everything inside it. This will
|
|
|
|
* clear the weak owner content reference.
|
|
|
|
*/
|
|
|
|
void Destroy();
|
2017-08-19 10:55:00 +03:00
|
|
|
|
|
|
|
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 ActivateFrameEvent(const nsAString& aType, bool aCapture,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
2018-03-22 05:43:15 +03:00
|
|
|
void RequestNotifyAfterRemotePaint();
|
2017-08-19 10:55:00 +03:00
|
|
|
|
2017-09-20 21:03:58 +03:00
|
|
|
void RequestUpdatePosition(mozilla::ErrorResult& aRv);
|
|
|
|
|
2017-08-19 10:55:00 +03:00
|
|
|
void Print(uint64_t aOuterWindowID, nsIPrintSettings* aPrintSettings,
|
|
|
|
nsIWebProgressListener* aProgressListener,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
2018-09-25 05:48:30 +03:00
|
|
|
already_AddRefed<mozilla::dom::Promise> DrawSnapshot(
|
|
|
|
double aX, double aY, double aW, double aH, double aScale,
|
|
|
|
const nsAString& aBackgroundColor, mozilla::ErrorResult& aRv);
|
|
|
|
|
2017-08-20 00:16:16 +03:00
|
|
|
void StartPersistence(uint64_t aOuterWindowID,
|
|
|
|
nsIWebBrowserPersistDocumentReceiver* aRecv,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
|
|
|
// WebIDL getters
|
2017-08-19 10:55:00 +03:00
|
|
|
|
2018-02-16 12:34:21 +03:00
|
|
|
already_AddRefed<mozilla::dom::MessageSender> GetMessageManager();
|
2017-08-19 10:55:00 +03:00
|
|
|
|
|
|
|
already_AddRefed<Element> GetOwnerElement();
|
|
|
|
|
|
|
|
uint32_t LazyWidth() const;
|
|
|
|
|
|
|
|
uint32_t LazyHeight() const;
|
|
|
|
|
|
|
|
uint64_t ChildID() const { return mChildID; }
|
|
|
|
|
|
|
|
bool ClampScrollPosition() const { return mClampScrollPosition; }
|
2018-03-22 05:43:15 +03:00
|
|
|
void SetClampScrollPosition(bool aClamp);
|
2017-08-19 10:55:00 +03:00
|
|
|
|
|
|
|
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; }
|
|
|
|
|
2012-09-28 09:43:12 +04:00
|
|
|
/**
|
|
|
|
* MessageManagerCallback methods that we override.
|
|
|
|
*/
|
2015-02-20 04:11:32 +03:00
|
|
|
virtual bool DoLoadMessageManagerScript(const nsAString& aURL,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aRunInGlobalScope) override;
|
2015-10-07 13:42:43 +03:00
|
|
|
virtual nsresult DoSendAsyncMessage(
|
|
|
|
JSContext* aCx, const nsAString& aMessage,
|
|
|
|
mozilla::dom::ipc::StructuredCloneData& aData,
|
|
|
|
JS::Handle<JSObject*> aCpows, nsIPrincipal* aPrincipal) override;
|
2012-09-28 09:43:12 +04:00
|
|
|
|
2009-10-16 23:42:29 +04:00
|
|
|
/**
|
2009-10-16 23:42:29 +04:00
|
|
|
* Called from the layout frame associated with this frame loader;
|
|
|
|
* this notifies us to hook up with the widget and view.
|
2009-10-16 23:42:29 +04:00
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
bool Show(int32_t marginWidth, int32_t marginHeight, int32_t scrollbarPrefX,
|
2010-08-31 04:49:07 +04:00
|
|
|
int32_t scrollbarPrefY, nsSubDocumentFrame* frame);
|
2009-10-16 23:42:29 +04:00
|
|
|
|
2017-07-21 00:24:40 +03:00
|
|
|
void MaybeShowFrame();
|
|
|
|
|
2011-05-13 21:41:00 +04:00
|
|
|
/**
|
|
|
|
* Called when the margin properties of the containing frame are changed.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
void MarginsChanged(uint32_t aMarginWidth, uint32_t aMarginHeight);
|
2011-05-13 21:41:00 +04:00
|
|
|
|
2009-10-16 23:42:29 +04:00
|
|
|
/**
|
2009-10-16 23:42:29 +04:00
|
|
|
* Called from the layout frame associated with this frame loader, when
|
|
|
|
* the frame is being torn down; this notifies us that out widget and view
|
|
|
|
* are going away and we should unhook from them.
|
2009-10-16 23:42:29 +04:00
|
|
|
*/
|
|
|
|
void Hide();
|
|
|
|
|
2018-04-20 00:26:56 +03:00
|
|
|
// Used when content is causing a FrameLoader to be created, and
|
|
|
|
// needs to try forcing layout to flush in order to get accurate
|
|
|
|
// dimensions for the content area.
|
|
|
|
void ForceLayoutIfNecessary();
|
|
|
|
|
2008-08-08 03:15:40 +04:00
|
|
|
// The guts of an nsIFrameLoaderOwner::SwapFrameLoader implementation. A
|
|
|
|
// frame loader owner needs to call this, and pass in the two references to
|
|
|
|
// nsRefPtrs for frame loaders that need to be swapped.
|
|
|
|
nsresult SwapWithOtherLoader(nsFrameLoader* aOther,
|
2016-10-17 17:37:50 +03:00
|
|
|
nsIFrameLoaderOwner* aThisOwner,
|
|
|
|
nsIFrameLoaderOwner* aOtherOwner);
|
2009-10-29 20:58:31 +03:00
|
|
|
|
2014-10-07 06:30:42 +04:00
|
|
|
nsresult SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
|
2016-10-17 17:37:50 +03:00
|
|
|
nsIFrameLoaderOwner* aThisOwner,
|
|
|
|
nsIFrameLoaderOwner* aOtherOwner);
|
2014-10-07 06:30:42 +04:00
|
|
|
|
2010-08-06 02:11:23 +04:00
|
|
|
/**
|
|
|
|
* Return the primary frame for our owning content, or null if it
|
|
|
|
* can't be found.
|
|
|
|
*/
|
|
|
|
nsIFrame* GetPrimaryFrameOfOwningContent() const {
|
2012-07-30 18:20:58 +04:00
|
|
|
return mOwnerContent ? mOwnerContent->GetPrimaryFrame() : nullptr;
|
2010-08-06 02:11:23 +04:00
|
|
|
}
|
|
|
|
|
2016-02-18 06:31:29 +03:00
|
|
|
/**
|
2010-08-06 02:11:23 +04:00
|
|
|
* Return the document that owns this, or null if we don't have
|
|
|
|
* an owner.
|
|
|
|
*/
|
2012-05-11 11:47:40 +04:00
|
|
|
nsIDocument* GetOwnerDoc() const {
|
2012-07-30 18:20:58 +04:00
|
|
|
return mOwnerContent ? mOwnerContent->OwnerDoc() : nullptr;
|
|
|
|
}
|
2010-08-06 02:11:23 +04:00
|
|
|
|
2015-06-09 13:20:41 +03:00
|
|
|
PBrowserParent* GetRemoteBrowser() const;
|
2010-08-21 03:24:41 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The "current" render frame is the one on which the most recent
|
|
|
|
* remote layer-tree transaction was executed. If no content has
|
|
|
|
* been drawn yet, or the remote browser doesn't have any drawn
|
2013-04-03 05:14:24 +04:00
|
|
|
* content for whatever reason, return nullptr. The returned render
|
2010-08-21 03:24:41 +04:00
|
|
|
* frame has an associated shadow layer tree.
|
|
|
|
*
|
|
|
|
* Note that the returned render frame might not be a frame
|
|
|
|
* constructed for this->GetURL(). This can happen, e.g., if the
|
|
|
|
* <browser> was just navigated to a new URL, but hasn't painted the
|
|
|
|
* new page yet. A render frame for the previous page may be
|
|
|
|
* returned. (In-process <browser> behaves similarly, and this
|
|
|
|
* behavior seems desirable.)
|
|
|
|
*/
|
2018-11-07 00:35:37 +03:00
|
|
|
RenderFrame* GetCurrentRenderFrame() const;
|
2010-08-21 03:24:41 +04:00
|
|
|
|
2017-06-14 17:44:17 +03:00
|
|
|
mozilla::dom::ChromeMessageSender* GetFrameMessageManager() {
|
|
|
|
return mMessageManager;
|
|
|
|
}
|
2010-02-20 20:05:20 +03:00
|
|
|
|
2011-10-01 21:14:35 +04:00
|
|
|
mozilla::dom::Element* GetOwnerContent() { return mOwnerContent; }
|
2011-12-05 16:38:46 +04:00
|
|
|
|
2012-02-18 03:41:13 +04:00
|
|
|
bool ShouldClampScrollPosition() { return mClampScrollPosition; }
|
|
|
|
|
2018-02-02 01:56:54 +03:00
|
|
|
mozilla::dom::ParentSHistory* GetParentSHistory() { return mParentSHistory; }
|
|
|
|
|
2012-06-13 02:01:25 +04:00
|
|
|
/**
|
|
|
|
* Tell this FrameLoader to use a particular remote browser.
|
|
|
|
*
|
2015-06-09 13:20:41 +03:00
|
|
|
* This will assert if mRemoteBrowser is non-null. In practice,
|
|
|
|
* this means you can't have successfully run TryRemoteBrowser() on
|
|
|
|
* this object, which means you can't have called ShowRemoteFrame()
|
|
|
|
* or ReallyStartLoading().
|
2012-06-13 02:01:25 +04:00
|
|
|
*/
|
|
|
|
void SetRemoteBrowser(nsITabParent* aTabParent);
|
|
|
|
|
2012-08-14 08:06:44 +04:00
|
|
|
/**
|
2016-05-05 00:12:48 +03:00
|
|
|
* Stashes a detached nsIFrame on the frame loader. We do this when we're
|
2012-08-14 08:06:44 +04:00
|
|
|
* destroying the nsSubDocumentFrame. If the nsSubdocumentFrame is
|
2016-05-05 00:12:48 +03:00
|
|
|
* being reframed we'll restore the detached nsIFrame when it's recreated,
|
2012-08-14 08:06:44 +04:00
|
|
|
* otherwise we'll discard the old presentation and set the detached
|
2016-05-05 00:12:48 +03:00
|
|
|
* subdoc nsIFrame to null. aContainerDoc is the document containing the
|
2012-08-14 08:06:44 +04:00
|
|
|
* the subdoc frame. This enables us to detect when the containing
|
2016-02-18 06:31:29 +03:00
|
|
|
* document has changed during reframe, so we can discard the presentation
|
2012-08-14 08:06:44 +04:00
|
|
|
* in that case.
|
|
|
|
*/
|
2016-05-05 00:12:48 +03:00
|
|
|
void SetDetachedSubdocFrame(nsIFrame* aDetachedFrame,
|
|
|
|
nsIDocument* aContainerDoc);
|
2012-08-14 08:06:44 +04:00
|
|
|
|
|
|
|
/**
|
2016-05-05 00:12:48 +03:00
|
|
|
* Retrieves the detached nsIFrame and the document containing the nsIFrame,
|
|
|
|
* as set by SetDetachedSubdocFrame().
|
2012-08-14 08:06:44 +04:00
|
|
|
*/
|
2016-05-05 00:12:48 +03:00
|
|
|
nsIFrame* GetDetachedSubdocFrame(nsIDocument** aContainerDoc) const;
|
2012-08-14 08:06:44 +04:00
|
|
|
|
2013-08-06 14:01:23 +04:00
|
|
|
/**
|
|
|
|
* Applies a new set of sandbox flags. These are merged with the sandbox
|
|
|
|
* flags from our owning content's owning document with a logical OR, this
|
|
|
|
* ensures that we can only add restrictions and never remove them.
|
|
|
|
*/
|
|
|
|
void ApplySandboxFlags(uint32_t sandboxFlags);
|
|
|
|
|
2017-10-05 08:59:44 +03:00
|
|
|
void GetURL(nsString& aURL, nsIPrincipal** aTriggeringPrincipal);
|
2013-10-26 04:04:50 +04:00
|
|
|
|
2015-03-31 23:39:02 +03:00
|
|
|
// Properly retrieves documentSize of any subdocument type.
|
|
|
|
nsresult GetWindowDimensions(nsIntRect& aRect);
|
2016-08-22 11:28:04 +03:00
|
|
|
|
2018-04-16 16:18:48 +03:00
|
|
|
virtual mozilla::dom::ProcessMessageManager* GetProcessMessageManager()
|
|
|
|
const override;
|
2015-03-31 23:39:02 +03:00
|
|
|
|
2015-06-09 13:49:17 +03:00
|
|
|
// public because a callback needs these.
|
2017-06-14 17:44:17 +03:00
|
|
|
RefPtr<mozilla::dom::ChromeMessageSender> mMessageManager;
|
2018-08-11 00:08:07 +03:00
|
|
|
RefPtr<mozilla::dom::InProcessTabChildMessageManager> mChildMessageManager;
|
2015-06-09 13:49:17 +03:00
|
|
|
|
2017-08-19 10:55:00 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* cx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
2005-02-08 09:55:00 +03:00
|
|
|
private:
|
2016-10-17 17:37:50 +03:00
|
|
|
nsFrameLoader(mozilla::dom::Element* aOwner, nsPIDOMWindowOuter* aOpener,
|
2017-05-29 13:38:46 +03:00
|
|
|
bool aNetworkCreated, int32_t aJSPluginID);
|
2015-06-09 13:49:17 +03:00
|
|
|
~nsFrameLoader();
|
2005-02-08 02:53:47 +03:00
|
|
|
|
2012-05-08 20:20:35 +04:00
|
|
|
void SetOwnerContent(mozilla::dom::Element* aContent);
|
|
|
|
|
2009-10-16 23:42:27 +04:00
|
|
|
bool ShouldUseRemoteProcess();
|
|
|
|
|
2015-07-31 12:28:36 +03:00
|
|
|
/**
|
|
|
|
* Return true if the frame is a remote frame. Return false otherwise
|
|
|
|
*/
|
|
|
|
bool IsRemoteFrame();
|
|
|
|
|
2017-05-29 13:38:46 +03:00
|
|
|
bool IsForJSPlugin() { return mJSPluginID != nsFakePluginTag::NOT_JSPLUGIN; }
|
|
|
|
|
2016-02-18 06:31:29 +03:00
|
|
|
/**
|
|
|
|
* Is this a frame loader for an isolated <iframe mozbrowser>?
|
|
|
|
*
|
|
|
|
* By default, mozbrowser frames are isolated. Isolation can be disabled by
|
|
|
|
* setting the frame's noisolation attribute. Disabling isolation is
|
|
|
|
* only allowed if the containing document is chrome.
|
Bug 802366 - The main event: Let a browser process inherit its app's id. r=bz,cjones
The main bug fixed here is that in half of our interfaces, we use "is browser frame/element" to mean "browser or app", and in the other half, we use it to mean "is browser not app".
There's a related, functional bug also fixed here, which is that a browser process doesn't inherit its parent's app-id. This causes problems e.g. for IndexedDB: If a browser inside an app uses IndexedDB, the DB should have the app's app-id.
I also modified Tab{Parent,Child} and nsFrameLoader to call "app" "ownOrContainingApp", to emphasize that we might have inherited the app from a parent process. I left nsIDocShell::appId alone, because changing that would have necessitated changing nsILoadGroup and therefore a /lot/ of users in Necko; it's also not clear it would have clarified anything in those cases.
2012-11-10 22:32:37 +04:00
|
|
|
*/
|
2016-02-18 06:31:29 +03:00
|
|
|
bool OwnerIsIsolatedMozBrowserFrame();
|
Bug 802366 - The main event: Let a browser process inherit its app's id. r=bz,cjones
The main bug fixed here is that in half of our interfaces, we use "is browser frame/element" to mean "browser or app", and in the other half, we use it to mean "is browser not app".
There's a related, functional bug also fixed here, which is that a browser process doesn't inherit its parent's app-id. This causes problems e.g. for IndexedDB: If a browser inside an app uses IndexedDB, the DB should have the app's app-id.
I also modified Tab{Parent,Child} and nsFrameLoader to call "app" "ownOrContainingApp", to emphasize that we might have inherited the app from a parent process. I left nsIDocShell::appId alone, because changing that would have necessitated changing nsILoadGroup and therefore a /lot/ of users in Necko; it's also not clear it would have clarified anything in those cases.
2012-11-10 22:32:37 +04:00
|
|
|
|
2013-02-07 03:49:27 +04:00
|
|
|
/**
|
|
|
|
* Get our owning element's app manifest URL, or return the empty string if
|
|
|
|
* our owning element doesn't have an app manifest URL.
|
|
|
|
*/
|
|
|
|
void GetOwnerAppManifestURL(nsAString& aOut);
|
|
|
|
|
2009-10-16 23:42:27 +04:00
|
|
|
/**
|
|
|
|
* If we are an IPC frame, set mRemoteFrame. Otherwise, create and
|
|
|
|
* initialize mDocShell.
|
|
|
|
*/
|
|
|
|
nsresult MaybeCreateDocShell();
|
2010-05-18 16:28:37 +04:00
|
|
|
nsresult EnsureMessageManager();
|
2015-07-30 06:07:14 +03:00
|
|
|
nsresult ReallyLoadFrameScripts();
|
2009-10-05 15:52:19 +04:00
|
|
|
|
|
|
|
// Updates the subdocument position and size. This gets called only
|
|
|
|
// when we have our own in-process DocShell.
|
2015-01-14 22:04:00 +03:00
|
|
|
void UpdateBaseWindowPositionAndSize(nsSubDocumentFrame* aIFrame);
|
2017-10-05 08:59:44 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks whether a load of the given URI should be allowed, and returns an
|
|
|
|
* error result if it should not.
|
|
|
|
*
|
|
|
|
* @param aURI The URI to check.
|
|
|
|
* @param aTriggeringPrincipal The triggering principal for the load. May be
|
|
|
|
* null, in which case the node principal of the owner content is used.
|
|
|
|
*/
|
|
|
|
nsresult CheckURILoad(nsIURI* aURI, nsIPrincipal* aTriggeringPrincipal);
|
2010-02-25 05:45:43 +03:00
|
|
|
void FireErrorEvent();
|
|
|
|
nsresult ReallyStartLoadingInternal();
|
2005-02-08 02:53:47 +03:00
|
|
|
|
2010-08-21 03:24:40 +04:00
|
|
|
// Return true if remote browser created; nothing else to do
|
|
|
|
bool TryRemoteBrowser();
|
2009-10-28 23:41:46 +03:00
|
|
|
|
2010-08-21 03:24:40 +04:00
|
|
|
// Tell the remote browser that it's now "virtually visible"
|
2015-03-05 12:13:05 +03:00
|
|
|
bool ShowRemoteFrame(const mozilla::ScreenIntSize& size,
|
2013-01-10 11:23:55 +04:00
|
|
|
nsSubDocumentFrame* aFrame = nullptr);
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2018-11-05 15:43:10 +03:00
|
|
|
void AddTreeItemToTreeOwner(nsIDocShellTreeItem* aItem,
|
|
|
|
nsIDocShellTreeOwner* aOwner);
|
2012-09-05 07:00:26 +04:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* TypeAttrName() const {
|
2015-03-03 14:08:59 +03:00
|
|
|
return mOwnerContent->IsXULElement() ? nsGkAtoms::type
|
|
|
|
: nsGkAtoms::mozframetype;
|
2012-09-05 07:00:26 +04:00
|
|
|
}
|
|
|
|
|
2015-02-09 10:04:18 +03:00
|
|
|
void InitializeBrowserAPI();
|
2016-09-09 00:00:12 +03:00
|
|
|
void DestroyBrowserFrameScripts();
|
2015-02-09 10:04:18 +03:00
|
|
|
|
2015-10-22 06:44:00 +03:00
|
|
|
nsresult GetNewTabContext(mozilla::dom::MutableTabContext* aTabContext,
|
2016-11-06 18:15:36 +03:00
|
|
|
nsIURI* aURI = nullptr);
|
2015-10-08 09:44:36 +03:00
|
|
|
|
2015-10-01 20:06:51 +03:00
|
|
|
enum TabParentChange { eTabParentRemoved, eTabParentChanged };
|
|
|
|
void MaybeUpdatePrimaryTabParent(TabParentChange aChange);
|
|
|
|
|
2017-01-12 19:38:48 +03:00
|
|
|
nsresult PopulateUserContextIdFromAttribute(mozilla::OriginAttributes& aAttr);
|
2016-05-30 02:48:00 +03:00
|
|
|
|
2005-02-08 02:53:47 +03:00
|
|
|
nsCOMPtr<nsIDocShell> mDocShell;
|
2008-03-21 14:44:09 +03:00
|
|
|
nsCOMPtr<nsIURI> mURIToLoad;
|
2017-10-05 08:59:44 +03:00
|
|
|
nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
|
2011-10-01 21:14:35 +04:00
|
|
|
mozilla::dom::Element* mOwnerContent; // WEAK
|
2012-09-05 07:00:26 +04:00
|
|
|
|
2015-02-27 08:35:26 +03:00
|
|
|
// After the frameloader has been removed from the DOM but before all of the
|
|
|
|
// messages from the frame have been received, we keep a strong reference to
|
|
|
|
// our <browser> element.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::dom::Element> mOwnerContentStrong;
|
2015-02-27 08:35:26 +03:00
|
|
|
|
2016-05-05 00:12:48 +03:00
|
|
|
// Stores the root frame of the subdocument while the subdocument is being
|
2012-08-14 08:06:44 +04:00
|
|
|
// reframed. Used to restore the presentation after reframing.
|
2017-03-01 20:03:14 +03:00
|
|
|
WeakFrame mDetachedSubdocFrame;
|
2012-08-14 08:06:44 +04:00
|
|
|
// Stores the containing document of the frame corresponding to this
|
|
|
|
// frame loader. This is reference is kept valid while the subframe's
|
2016-05-05 00:12:48 +03:00
|
|
|
// presentation is detached and stored in mDetachedSubdocFrame. This
|
2012-08-14 08:06:44 +04:00
|
|
|
// enables us to detect whether the frame has moved documents during
|
|
|
|
// a reframe, so that we know not to restore the presentation.
|
|
|
|
nsCOMPtr<nsIDocument> mContainerDocWhileDetached;
|
|
|
|
|
2016-10-17 17:37:50 +03:00
|
|
|
// An opener window which should be used when the docshell is created.
|
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> mOpener;
|
|
|
|
|
2015-06-09 13:49:17 +03:00
|
|
|
TabParent* mRemoteBrowser;
|
|
|
|
uint64_t mChildID;
|
|
|
|
|
2017-05-29 13:38:46 +03:00
|
|
|
int32_t mJSPluginID;
|
|
|
|
|
2016-04-08 03:04:57 +03:00
|
|
|
// Holds the last known size of the frame.
|
|
|
|
mozilla::ScreenIntSize mLazySize;
|
|
|
|
|
2018-02-02 01:56:54 +03:00
|
|
|
RefPtr<mozilla::dom::ParentSHistory> mParentSHistory;
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mDepthTooGreat : 1;
|
|
|
|
bool mIsTopLevelContent : 1;
|
|
|
|
bool mDestroyCalled : 1;
|
|
|
|
bool mNeedsAsyncDestroy : 1;
|
|
|
|
bool mInSwap : 1;
|
|
|
|
bool mInShow : 1;
|
|
|
|
bool mHideCalled : 1;
|
2010-08-17 18:13:55 +04:00
|
|
|
// True when the object is created for an element which the parser has
|
|
|
|
// created using NS_FROM_PARSER_NETWORK flag. If the element is modified,
|
|
|
|
// it may lose the flag.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mNetworkCreated : 1;
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2017-11-05 07:06:20 +03:00
|
|
|
// True if a pending load corresponds to the original src (or srcdoc)
|
|
|
|
// attribute of the frame element.
|
|
|
|
bool mLoadingOriginalSrc : 1;
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mRemoteBrowserShown : 1;
|
2011-12-05 16:38:46 +04:00
|
|
|
bool mRemoteFrame : 1;
|
2012-02-18 03:41:13 +04:00
|
|
|
bool mClampScrollPosition : 1;
|
2012-09-05 07:00:26 +04:00
|
|
|
bool mObservingOwnerContent : 1;
|
2005-02-08 02:53:47 +03:00
|
|
|
};
|
|
|
|
|
2018-03-22 05:43:16 +03:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsFrameLoader, NS_FRAMELOADER_IID)
|
|
|
|
|
2018-03-22 05:43:17 +03:00
|
|
|
inline nsISupports* ToSupports(nsFrameLoader* aFrameLoader) {
|
2018-04-09 23:30:33 +03:00
|
|
|
return aFrameLoader;
|
2018-03-22 05:43:17 +03:00
|
|
|
}
|
|
|
|
|
2005-02-08 02:53:47 +03:00
|
|
|
#endif
|