2011-10-01 09:14:36 -07:00
|
|
|
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 2; -*- */
|
2009-08-18 12:05:15 -07:00
|
|
|
/* vim: set sw=4 ts=8 et tw=80 : */
|
2012-05-21 04:12:37 -07: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/. */
|
2009-06-30 13:39:22 -07:00
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
#ifndef mozilla_dom_TabChild_h
|
|
|
|
#define mozilla_dom_TabChild_h
|
2009-06-30 13:39:22 -07:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
#include "mozilla/dom/PBrowserChild.h"
|
2009-06-30 13:39:22 -07:00
|
|
|
#include "nsIWebNavigation.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2009-11-05 10:14:22 -08:00
|
|
|
#include "nsAutoPtr.h"
|
2013-08-08 17:16:47 -07:00
|
|
|
#include "nsEventDispatcher.h"
|
2009-11-05 10:14:22 -08:00
|
|
|
#include "nsIWebBrowserChrome2.h"
|
2012-06-09 15:15:12 -07:00
|
|
|
#include "nsIEmbeddingSiteWindow.h"
|
2009-11-05 10:14:22 -08:00
|
|
|
#include "nsIWebBrowserChromeFocus.h"
|
2009-11-17 06:22:23 -08:00
|
|
|
#include "nsIDOMEventListener.h"
|
2009-12-31 17:34:06 -08:00
|
|
|
#include "nsIInterfaceRequestor.h"
|
2009-12-31 17:35:55 -08:00
|
|
|
#include "nsIWindowProvider.h"
|
2010-02-20 09:05:20 -08:00
|
|
|
#include "nsIDOMWindow.h"
|
2010-03-03 12:30:25 -08:00
|
|
|
#include "nsIDocShell.h"
|
2013-09-23 14:30:40 -07:00
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
2010-02-20 09:05:20 -08:00
|
|
|
#include "nsFrameMessageManager.h"
|
2012-09-28 19:18:18 -07:00
|
|
|
#include "nsIWebProgressListener.h"
|
2012-02-07 18:53:33 -08:00
|
|
|
#include "nsDOMEventTargetHelper.h"
|
2010-05-17 04:25:22 -07:00
|
|
|
#include "nsIDialogCreator.h"
|
2010-08-05 15:11:23 -07:00
|
|
|
#include "nsIPresShell.h"
|
2010-02-20 09:05:20 -08:00
|
|
|
#include "nsIScriptObjectPrincipal.h"
|
2010-03-26 11:39:39 -07:00
|
|
|
#include "nsWeakReference.h"
|
2010-05-13 10:44:51 -07:00
|
|
|
#include "nsITabChild.h"
|
2012-06-14 19:31:55 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
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 10:32:37 -08:00
|
|
|
#include "mozilla/dom/TabContext.h"
|
2013-09-25 04:21:16 -07:00
|
|
|
#include "mozilla/EventForwards.h"
|
2013-10-18 13:57:55 -07:00
|
|
|
#include "mozilla/layers/CompositorTypes.h"
|
2009-06-30 13:39:22 -07:00
|
|
|
|
2010-07-16 23:59:36 -07:00
|
|
|
struct gfxMatrix;
|
2013-02-15 14:27:21 -08:00
|
|
|
class nsICachedFileDescriptorListener;
|
2013-06-14 14:47:56 -07:00
|
|
|
class nsIDOMWindowUtils;
|
2010-03-24 03:47:18 -07:00
|
|
|
|
2009-06-30 13:39:22 -07:00
|
|
|
namespace mozilla {
|
2010-08-20 16:24:41 -07:00
|
|
|
namespace layout {
|
|
|
|
class RenderFrameChild;
|
|
|
|
}
|
|
|
|
|
2009-08-12 09:18:08 -07:00
|
|
|
namespace dom {
|
2009-06-30 13:39:22 -07:00
|
|
|
|
2009-11-17 06:22:23 -08:00
|
|
|
class TabChild;
|
2010-05-17 04:25:22 -07:00
|
|
|
class PContentDialogChild;
|
2012-08-01 23:02:29 -07:00
|
|
|
class ClonedMessageData;
|
2009-11-17 06:22:23 -08:00
|
|
|
|
2012-02-07 18:53:33 -08:00
|
|
|
class TabChildGlobal : public nsDOMEventTargetHelper,
|
2010-02-20 09:05:20 -08:00
|
|
|
public nsIContentFrameMessageManager,
|
2013-05-06 16:53:10 -07:00
|
|
|
public nsIScriptObjectPrincipal
|
2010-02-20 09:05:20 -08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
TabChildGlobal(TabChild* aTabChild);
|
2012-04-26 13:56:46 -07:00
|
|
|
void Init();
|
2010-02-20 09:05:20 -08:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2012-02-07 18:53:33 -08:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, nsDOMEventTargetHelper)
|
2012-08-27 07:13:02 -07:00
|
|
|
NS_FORWARD_SAFE_NSIMESSAGELISTENERMANAGER(mMessageManager)
|
|
|
|
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
|
2011-10-01 09:14:36 -07:00
|
|
|
NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
|
2013-04-02 16:22:12 -07:00
|
|
|
const JS::Value& aObject,
|
2013-07-10 15:05:39 -07:00
|
|
|
const JS::Value& aRemote,
|
2013-11-06 09:21:15 -08:00
|
|
|
nsIPrincipal* aPrincipal,
|
2011-10-01 09:14:36 -07:00
|
|
|
JSContext* aCx,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint8_t aArgc,
|
2013-04-02 16:22:12 -07:00
|
|
|
JS::Value* aRetval)
|
2010-02-20 09:05:20 -08:00
|
|
|
{
|
2011-10-01 09:14:36 -07:00
|
|
|
return mMessageManager
|
2013-11-06 09:21:15 -08:00
|
|
|
? mMessageManager->SendSyncMessage(aMessageName, aObject, aRemote,
|
|
|
|
aPrincipal, aCx, aArgc, aRetval)
|
2011-10-01 09:14:36 -07:00
|
|
|
: NS_ERROR_NULL_POINTER;
|
2010-02-20 09:05:20 -08:00
|
|
|
}
|
2013-10-01 09:15:06 -07:00
|
|
|
NS_IMETHOD SendRpcMessage(const nsAString& aMessageName,
|
|
|
|
const JS::Value& aObject,
|
|
|
|
const JS::Value& aRemote,
|
2013-11-06 09:21:15 -08:00
|
|
|
nsIPrincipal* aPrincipal,
|
2013-10-01 09:15:06 -07:00
|
|
|
JSContext* aCx,
|
|
|
|
uint8_t aArgc,
|
|
|
|
JS::Value* aRetval)
|
|
|
|
{
|
|
|
|
return mMessageManager
|
2013-11-06 09:21:15 -08:00
|
|
|
? mMessageManager->SendRpcMessage(aMessageName, aObject, aRemote,
|
|
|
|
aPrincipal, aCx, aArgc, aRetval)
|
2013-10-01 09:15:06 -07:00
|
|
|
: NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
2013-06-05 09:15:48 -07:00
|
|
|
NS_IMETHOD GetContent(nsIDOMWindow** aContent) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD Dump(const nsAString& aStr) MOZ_OVERRIDE
|
2010-02-20 09:05:20 -08:00
|
|
|
{
|
|
|
|
return mMessageManager ? mMessageManager->Dump(aStr) : NS_OK;
|
|
|
|
}
|
2013-06-05 09:15:48 -07:00
|
|
|
NS_IMETHOD PrivateNoteIntentionalCrash() MOZ_OVERRIDE;
|
2011-06-25 02:52:00 -07:00
|
|
|
NS_IMETHOD Btoa(const nsAString& aBinaryData,
|
2013-06-05 09:15:48 -07:00
|
|
|
nsAString& aAsciiBase64String) MOZ_OVERRIDE;
|
2011-06-25 02:52:00 -07:00
|
|
|
NS_IMETHOD Atob(const nsAString& aAsciiString,
|
2013-06-05 09:15:48 -07:00
|
|
|
nsAString& aBinaryData) MOZ_OVERRIDE;
|
2010-02-20 09:05:20 -08:00
|
|
|
|
|
|
|
NS_IMETHOD AddEventListener(const nsAString& aType,
|
|
|
|
nsIDOMEventListener* aListener,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aUseCapture)
|
2010-02-20 09:05:20 -08:00
|
|
|
{
|
|
|
|
// By default add listeners only for trusted events!
|
|
|
|
return nsDOMEventTargetHelper::AddEventListener(aType, aListener,
|
2011-10-17 07:59:28 -07:00
|
|
|
aUseCapture, false, 2);
|
2010-02-20 09:05:20 -08:00
|
|
|
}
|
2013-04-16 14:16:08 -07:00
|
|
|
using nsDOMEventTargetHelper::AddEventListener;
|
2010-02-20 09:05:20 -08:00
|
|
|
NS_IMETHOD AddEventListener(const nsAString& aType,
|
|
|
|
nsIDOMEventListener* aListener,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aUseCapture, bool aWantsUntrusted,
|
2013-06-05 09:15:48 -07:00
|
|
|
uint8_t optional_argc) MOZ_OVERRIDE
|
2010-02-20 09:05:20 -08:00
|
|
|
{
|
|
|
|
return nsDOMEventTargetHelper::AddEventListener(aType, aListener,
|
|
|
|
aUseCapture,
|
|
|
|
aWantsUntrusted,
|
|
|
|
optional_argc);
|
|
|
|
}
|
|
|
|
|
2013-08-08 17:16:47 -07:00
|
|
|
nsresult
|
|
|
|
PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
|
|
|
{
|
|
|
|
aVisitor.mForceContentDispatch = true;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-06-05 09:15:48 -07:00
|
|
|
virtual JSContext* GetJSContextForEventHandlers() MOZ_OVERRIDE;
|
|
|
|
virtual nsIPrincipal* GetPrincipal() MOZ_OVERRIDE;
|
2010-02-20 09:05:20 -08:00
|
|
|
|
|
|
|
nsCOMPtr<nsIContentFrameMessageManager> mMessageManager;
|
|
|
|
TabChild* mTabChild;
|
|
|
|
};
|
|
|
|
|
2012-06-14 19:31:55 -07:00
|
|
|
class ContentListener MOZ_FINAL : public nsIDOMEventListener
|
2009-11-17 06:22:23 -08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
ContentListener(TabChild* aTabChild) : mTabChild(aTabChild) {}
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIDOMEVENTLISTENER
|
|
|
|
protected:
|
|
|
|
TabChild* mTabChild;
|
|
|
|
};
|
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
class TabChild : public PBrowserChild,
|
2010-08-18 03:02:49 -07:00
|
|
|
public nsFrameScriptExecutor,
|
2009-11-05 10:14:22 -08:00
|
|
|
public nsIWebBrowserChrome2,
|
2012-06-09 15:15:12 -07:00
|
|
|
public nsIEmbeddingSiteWindow,
|
2009-12-31 17:34:06 -08:00
|
|
|
public nsIWebBrowserChromeFocus,
|
2009-12-31 17:35:55 -08:00
|
|
|
public nsIInterfaceRequestor,
|
2010-03-26 11:39:39 -07:00
|
|
|
public nsIWindowProvider,
|
2012-09-28 19:18:18 -07:00
|
|
|
public nsIDOMEventListener,
|
|
|
|
public nsIWebProgressListener,
|
2010-05-13 10:44:51 -07:00
|
|
|
public nsSupportsWeakReference,
|
2010-05-17 04:25:22 -07:00
|
|
|
public nsIDialogCreator,
|
2012-08-08 13:37:57 -07:00
|
|
|
public nsITabChild,
|
2012-09-27 22:43:12 -07:00
|
|
|
public nsIObserver,
|
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 10:32:37 -08:00
|
|
|
public ipc::MessageManagerCallback,
|
|
|
|
public TabContext
|
2009-06-30 13:39:22 -07:00
|
|
|
{
|
2012-08-01 23:02:29 -07:00
|
|
|
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
|
2012-11-27 12:43:52 -08:00
|
|
|
typedef mozilla::layout::RenderFrameChild RenderFrameChild;
|
|
|
|
typedef mozilla::layout::ScrollingBehavior ScrollingBehavior;
|
2010-08-20 16:24:41 -07:00
|
|
|
|
2009-06-30 13:39:22 -07:00
|
|
|
public:
|
2012-08-29 08:26:18 -07:00
|
|
|
/**
|
|
|
|
* This is expected to be called off the critical path to content
|
|
|
|
* startup. This is an opportunity to load things that are slow
|
|
|
|
* on the critical path.
|
2012-06-21 18:17:52 -07:00
|
|
|
*/
|
2012-08-29 08:26:18 -07:00
|
|
|
static void PreloadSlowThings();
|
|
|
|
|
|
|
|
/** Return a TabChild with the given attributes. */
|
2013-07-10 10:07:51 -07:00
|
|
|
static already_AddRefed<TabChild>
|
|
|
|
Create(ContentChild* aManager, const TabContext& aContext, uint32_t aChromeFlags);
|
2012-08-29 08:26:18 -07:00
|
|
|
|
2009-06-30 13:39:22 -07:00
|
|
|
virtual ~TabChild();
|
2009-11-05 10:14:22 -08:00
|
|
|
|
2012-09-05 09:23:45 -07:00
|
|
|
bool IsRootContentDocument();
|
|
|
|
|
2009-11-05 10:14:22 -08:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIWEBBROWSERCHROME
|
|
|
|
NS_DECL_NSIWEBBROWSERCHROME2
|
|
|
|
NS_DECL_NSIEMBEDDINGSITEWINDOW
|
|
|
|
NS_DECL_NSIWEBBROWSERCHROMEFOCUS
|
2009-12-31 17:34:06 -08:00
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
2009-12-31 17:35:55 -08:00
|
|
|
NS_DECL_NSIWINDOWPROVIDER
|
2012-09-28 19:18:18 -07:00
|
|
|
NS_DECL_NSIDOMEVENTLISTENER
|
|
|
|
NS_DECL_NSIWEBPROGRESSLISTENER
|
2010-05-17 04:25:22 -07:00
|
|
|
NS_DECL_NSIDIALOGCREATOR
|
2012-05-28 02:27:25 -07:00
|
|
|
NS_DECL_NSITABCHILD
|
2012-08-08 13:37:57 -07:00
|
|
|
NS_DECL_NSIOBSERVER
|
2009-06-30 13:39:22 -07:00
|
|
|
|
2012-09-27 22:43:12 -07:00
|
|
|
/**
|
|
|
|
* MessageManagerCallback methods that we override.
|
|
|
|
*/
|
2013-10-01 09:15:06 -07:00
|
|
|
virtual bool DoSendBlockingMessage(JSContext* aCx,
|
|
|
|
const nsAString& aMessage,
|
|
|
|
const mozilla::dom::StructuredCloneData& aData,
|
|
|
|
JS::Handle<JSObject *> aCpows,
|
2013-11-06 09:21:15 -08:00
|
|
|
nsIPrincipal* aPrincipal,
|
2013-10-01 09:15:06 -07:00
|
|
|
InfallibleTArray<nsString>* aJSONRetVal,
|
|
|
|
bool aIsSync) MOZ_OVERRIDE;
|
2013-07-10 15:05:39 -07:00
|
|
|
virtual bool DoSendAsyncMessage(JSContext* aCx,
|
|
|
|
const nsAString& aMessage,
|
|
|
|
const mozilla::dom::StructuredCloneData& aData,
|
2013-11-06 09:21:15 -08:00
|
|
|
JS::Handle<JSObject *> aCpows,
|
|
|
|
nsIPrincipal* aPrincipal) MOZ_OVERRIDE;
|
2012-09-27 22:43:12 -07:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
virtual bool RecvLoadURL(const nsCString& uri);
|
2013-02-15 14:27:21 -08:00
|
|
|
virtual bool RecvCacheFileDescriptor(const nsString& aPath,
|
|
|
|
const FileDescriptor& aFileDescriptor)
|
|
|
|
MOZ_OVERRIDE;
|
2010-08-20 16:24:40 -07:00
|
|
|
virtual bool RecvShow(const nsIntSize& size);
|
2013-03-04 06:37:43 -08:00
|
|
|
virtual bool RecvUpdateDimensions(const nsRect& rect, const nsIntSize& size, const ScreenOrientation& orientation);
|
2012-08-08 21:39:02 -07:00
|
|
|
virtual bool RecvUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics);
|
2013-06-10 06:05:44 -07:00
|
|
|
virtual bool RecvHandleDoubleTap(const CSSIntPoint& aPoint);
|
|
|
|
virtual bool RecvHandleSingleTap(const CSSIntPoint& aPoint);
|
|
|
|
virtual bool RecvHandleLongTap(const CSSIntPoint& aPoint);
|
2010-07-19 11:33:33 -07:00
|
|
|
virtual bool RecvActivate();
|
2011-06-17 17:08:32 -07:00
|
|
|
virtual bool RecvDeactivate();
|
2010-07-19 11:33:33 -07:00
|
|
|
virtual bool RecvMouseEvent(const nsString& aType,
|
|
|
|
const float& aX,
|
|
|
|
const float& aY,
|
2012-08-22 08:56:38 -07:00
|
|
|
const int32_t& aButton,
|
|
|
|
const int32_t& aClickCount,
|
|
|
|
const int32_t& aModifiers,
|
2010-07-19 11:33:33 -07:00
|
|
|
const bool& aIgnoreRootScrollFrame);
|
2013-10-01 23:38:27 -07:00
|
|
|
virtual bool RecvRealMouseEvent(const mozilla::WidgetMouseEvent& event);
|
2013-10-01 00:22:58 -07:00
|
|
|
virtual bool RecvRealKeyEvent(const mozilla::WidgetKeyboardEvent& event);
|
2013-10-16 02:37:36 -07:00
|
|
|
virtual bool RecvMouseWheelEvent(const mozilla::WidgetWheelEvent& event);
|
2013-11-13 10:20:31 -08:00
|
|
|
virtual bool RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
|
|
|
|
const ScrollableLayerGuid& aGuid);
|
|
|
|
virtual bool RecvRealTouchMoveEvent(const WidgetTouchEvent& aEvent,
|
|
|
|
const ScrollableLayerGuid& aGuid);
|
2010-07-19 11:33:33 -07:00
|
|
|
virtual bool RecvKeyEvent(const nsString& aType,
|
2012-08-22 08:56:38 -07:00
|
|
|
const int32_t& aKeyCode,
|
|
|
|
const int32_t& aCharCode,
|
|
|
|
const int32_t& aModifiers,
|
2010-07-19 11:33:33 -07:00
|
|
|
const bool& aPreventDefault);
|
2013-10-01 00:23:00 -07:00
|
|
|
virtual bool RecvCompositionEvent(const mozilla::WidgetCompositionEvent& event);
|
2013-10-01 00:22:59 -07:00
|
|
|
virtual bool RecvTextEvent(const mozilla::WidgetTextEvent& event);
|
2013-10-01 00:23:01 -07:00
|
|
|
virtual bool RecvSelectionEvent(const mozilla::WidgetSelectionEvent& event);
|
2010-07-19 11:33:33 -07:00
|
|
|
virtual bool RecvActivateFrameEvent(const nsString& aType, const bool& capture);
|
2013-11-23 21:32:45 -08:00
|
|
|
virtual bool RecvLoadRemoteScript(const nsString& aURL, const bool& aRunInGlobalScope);
|
2010-07-19 11:33:33 -07:00
|
|
|
virtual bool RecvAsyncMessage(const nsString& aMessage,
|
2013-07-10 15:05:39 -07:00
|
|
|
const ClonedMessageData& aData,
|
2013-11-06 09:21:15 -08:00
|
|
|
const InfallibleTArray<CpowEntry>& aCpows,
|
|
|
|
const IPC::Principal& aPrincipal) MOZ_OVERRIDE;
|
2010-10-26 15:20:53 -07:00
|
|
|
|
|
|
|
virtual PDocumentRendererChild*
|
2013-07-08 08:48:39 -07:00
|
|
|
AllocPDocumentRendererChild(const nsRect& documentRect, const gfxMatrix& transform,
|
|
|
|
const nsString& bgcolor,
|
|
|
|
const uint32_t& renderFlags, const bool& flushLayout,
|
|
|
|
const nsIntSize& renderSize);
|
|
|
|
virtual bool DeallocPDocumentRendererChild(PDocumentRendererChild* actor);
|
2010-10-26 15:20:53 -07:00
|
|
|
virtual bool RecvPDocumentRendererConstructor(PDocumentRendererChild* actor,
|
|
|
|
const nsRect& documentRect,
|
2010-10-26 15:20:53 -07:00
|
|
|
const gfxMatrix& transform,
|
2010-10-26 15:20:53 -07:00
|
|
|
const nsString& bgcolor,
|
2012-08-22 08:56:38 -07:00
|
|
|
const uint32_t& renderFlags,
|
2010-10-26 15:20:53 -07:00
|
|
|
const bool& flushLayout,
|
|
|
|
const nsIntSize& renderSize);
|
2010-10-26 15:20:53 -07:00
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual PContentDialogChild* AllocPContentDialogChild(const uint32_t&,
|
|
|
|
const nsCString&,
|
|
|
|
const nsCString&,
|
|
|
|
const InfallibleTArray<int>&,
|
|
|
|
const InfallibleTArray<nsString>&);
|
|
|
|
virtual bool DeallocPContentDialogChild(PContentDialogChild* aDialog);
|
2010-05-17 04:25:22 -07:00
|
|
|
static void ParamsToArrays(nsIDialogParamBlock* aParams,
|
2010-11-08 18:49:00 -08:00
|
|
|
InfallibleTArray<int>& aIntParams,
|
|
|
|
InfallibleTArray<nsString>& aStringParams);
|
|
|
|
static void ArraysToParams(const InfallibleTArray<int>& aIntParams,
|
|
|
|
const InfallibleTArray<nsString>& aStringParams,
|
2010-05-17 04:25:22 -07:00
|
|
|
nsIDialogParamBlock* aParams);
|
2009-06-30 13:39:22 -07:00
|
|
|
|
2012-07-18 12:09:28 -07:00
|
|
|
#ifdef DEBUG
|
2013-11-05 06:16:25 -08:00
|
|
|
virtual PContentPermissionRequestChild*
|
|
|
|
SendPContentPermissionRequestConstructor(PContentPermissionRequestChild* aActor,
|
2013-11-05 19:32:42 -08:00
|
|
|
const nsCString& aType,
|
|
|
|
const nsCString& aAccess,
|
2013-11-05 06:16:25 -08:00
|
|
|
const IPC::Principal& aPrincipal);
|
2012-07-18 12:09:28 -07:00
|
|
|
#endif /* DEBUG */
|
|
|
|
|
2013-11-05 19:32:42 -08:00
|
|
|
virtual PContentPermissionRequestChild* AllocPContentPermissionRequestChild(const nsCString& aType,
|
|
|
|
const nsCString& aAccess,
|
2013-07-08 08:48:39 -07:00
|
|
|
const IPC::Principal& aPrincipal);
|
|
|
|
virtual bool DeallocPContentPermissionRequestChild(PContentPermissionRequestChild* actor);
|
2010-05-13 10:44:51 -07:00
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual POfflineCacheUpdateChild* AllocPOfflineCacheUpdateChild(
|
2012-07-30 23:36:00 -07:00
|
|
|
const URIParams& manifestURI,
|
2012-08-23 12:33:46 -07:00
|
|
|
const URIParams& documentURI,
|
2010-10-20 10:12:32 -07:00
|
|
|
const bool& stickDocument);
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual bool DeallocPOfflineCacheUpdateChild(POfflineCacheUpdateChild* offlineCacheUpdate);
|
2010-10-20 10:12:32 -07:00
|
|
|
|
2010-02-20 09:05:20 -08:00
|
|
|
nsIWebNavigation* WebNavigation() { return mWebNav; }
|
|
|
|
|
|
|
|
nsIPrincipal* GetPrincipal() { return mPrincipal; }
|
2009-11-06 12:43:39 -08:00
|
|
|
|
2012-08-29 08:26:18 -07:00
|
|
|
/** Return the DPI of the widget this TabChild draws to. */
|
|
|
|
void GetDPI(float* aDPI);
|
2013-05-01 16:06:19 -07:00
|
|
|
void GetDefaultScale(double *aScale);
|
2012-08-29 08:26:18 -07:00
|
|
|
|
2012-11-21 18:40:57 -08:00
|
|
|
ScreenOrientation GetOrientation() { return mOrientation; }
|
|
|
|
|
2011-10-20 15:17:09 -07:00
|
|
|
void SetBackgroundColor(const nscolor& aColor);
|
2012-07-17 16:59:45 -07:00
|
|
|
|
|
|
|
void NotifyPainted();
|
2012-07-19 23:48:27 -07:00
|
|
|
|
|
|
|
bool IsAsyncPanZoomEnabled();
|
|
|
|
|
2013-05-23 08:52:06 -07:00
|
|
|
/** Return a boolean indicating if the page has called preventDefault on
|
|
|
|
* the event.
|
|
|
|
*/
|
2013-09-11 05:28:58 -07:00
|
|
|
bool DispatchMouseEvent(const nsString& aType,
|
|
|
|
const CSSPoint& aPoint,
|
|
|
|
const int32_t& aButton,
|
|
|
|
const int32_t& aClickCount,
|
|
|
|
const int32_t& aModifiers,
|
|
|
|
const bool& aIgnoreRootScrollFrame,
|
|
|
|
const unsigned short& aInputSourceArg);
|
2013-05-23 08:52:06 -07:00
|
|
|
|
2012-11-07 19:51:55 -08:00
|
|
|
/**
|
|
|
|
* Signal to this TabChild that it should be made visible:
|
|
|
|
* activated widget, retained layer tree, etc. (Respectively,
|
|
|
|
* made not visible.)
|
|
|
|
*/
|
|
|
|
void MakeVisible();
|
|
|
|
void MakeHidden();
|
|
|
|
|
2013-02-15 14:27:21 -08:00
|
|
|
// Returns true if the file descriptor was found in the cache, false
|
|
|
|
// otherwise.
|
|
|
|
bool GetCachedFileDescriptor(const nsAString& aPath,
|
|
|
|
nsICachedFileDescriptorListener* aCallback);
|
|
|
|
|
|
|
|
void CancelCachedFileDescriptorCallback(
|
|
|
|
const nsAString& aPath,
|
|
|
|
nsICachedFileDescriptorListener* aCallback);
|
|
|
|
|
2013-07-10 10:07:51 -07:00
|
|
|
ContentChild* Manager() { return mManager; }
|
|
|
|
|
2013-08-13 00:56:57 -07:00
|
|
|
bool GetUpdateHitRegion() { return mUpdateHitRegion; }
|
|
|
|
|
|
|
|
void UpdateHitRegion(const nsRegion& aRegion);
|
|
|
|
|
2013-09-12 12:24:11 -07:00
|
|
|
static inline TabChild*
|
|
|
|
GetFrom(nsIDocShell* aDocShell)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsITabChild> tc = do_GetInterface(aDocShell);
|
|
|
|
return static_cast<TabChild*>(tc.get());
|
|
|
|
}
|
|
|
|
|
2013-10-02 13:08:30 -07:00
|
|
|
static TabChild* GetFrom(nsIPresShell* aPresShell);
|
2013-09-12 12:24:11 -07:00
|
|
|
|
|
|
|
static inline TabChild*
|
|
|
|
GetFrom(nsIDOMWindow* aWindow)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(aWindow);
|
|
|
|
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(webNav);
|
|
|
|
return GetFrom(docShell);
|
|
|
|
}
|
|
|
|
|
2010-08-05 15:11:23 -07:00
|
|
|
protected:
|
2013-11-20 04:32:52 -08:00
|
|
|
virtual PRenderFrameChild* AllocPRenderFrameChild(ScrollingBehavior* aScrolling,
|
|
|
|
TextureFactoryIdentifier* aTextureFactoryIdentifier,
|
|
|
|
uint64_t* aLayersId) MOZ_OVERRIDE;
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual bool DeallocPRenderFrameChild(PRenderFrameChild* aFrame) MOZ_OVERRIDE;
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual bool RecvDestroy() MOZ_OVERRIDE;
|
2013-08-13 00:56:57 -07:00
|
|
|
virtual bool RecvSetUpdateHitRegion(const bool& aEnabled) MOZ_OVERRIDE;
|
2010-08-05 15:11:23 -07:00
|
|
|
|
2013-10-01 20:46:03 -07:00
|
|
|
nsEventStatus DispatchWidgetEvent(WidgetGUIEvent& event);
|
2010-08-17 01:07:42 -07:00
|
|
|
|
2013-09-10 21:18:36 -07:00
|
|
|
virtual PIndexedDBChild* AllocPIndexedDBChild(const nsCString& aGroup,
|
|
|
|
const nsCString& aASCIIOrigin,
|
2013-07-08 08:48:39 -07:00
|
|
|
bool* /* aAllowed */);
|
2012-06-01 10:21:12 -07:00
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual bool DeallocPIndexedDBChild(PIndexedDBChild* aActor);
|
2012-06-01 10:21:12 -07:00
|
|
|
|
2009-06-30 13:39:22 -07:00
|
|
|
private:
|
2012-08-29 08:26:18 -07:00
|
|
|
/**
|
|
|
|
* Create a new TabChild object.
|
|
|
|
*
|
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 10:32:37 -08:00
|
|
|
* |aOwnOrContainingAppId| is the app-id of our frame or of the closest app
|
|
|
|
* frame in the hierarchy which contains us.
|
|
|
|
*
|
|
|
|
* |aIsBrowserElement| indicates whether we're a browser (but not an app).
|
2012-08-29 08:26:18 -07:00
|
|
|
*/
|
2013-07-10 10:07:51 -07:00
|
|
|
TabChild(ContentChild* aManager, const TabContext& aContext, uint32_t aChromeFlags);
|
2012-08-29 08:26:18 -07:00
|
|
|
|
|
|
|
nsresult Init();
|
|
|
|
|
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 10:32:37 -08:00
|
|
|
// Notify others that our TabContext has been updated. (At the moment, this
|
|
|
|
// sets the appropriate app-id and is-browser flags on our docshell.)
|
|
|
|
//
|
|
|
|
// You should call this after calling TabContext::SetTabContext(). We also
|
|
|
|
// call this during Init().
|
|
|
|
void NotifyTabContextUpdated();
|
2012-08-29 08:26:18 -07:00
|
|
|
|
2012-07-17 16:59:45 -07:00
|
|
|
bool UseDirectCompositor();
|
|
|
|
|
2010-07-21 16:23:03 -07:00
|
|
|
void ActorDestroy(ActorDestroyReason why);
|
|
|
|
|
2012-08-29 08:26:18 -07:00
|
|
|
enum FrameScriptLoading { DONT_LOAD_SCRIPTS, DEFAULT_LOAD_SCRIPTS };
|
|
|
|
bool InitTabChildGlobal(FrameScriptLoading aScriptLoading = DEFAULT_LOAD_SCRIPTS);
|
|
|
|
bool InitRenderingState();
|
2010-08-20 16:24:40 -07:00
|
|
|
void DestroyWindow();
|
2012-09-10 21:30:33 -07:00
|
|
|
void SetProcessNameToAppName();
|
2013-05-23 18:43:36 -07:00
|
|
|
bool ProcessUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics);
|
2013-07-09 16:26:07 -07:00
|
|
|
|
2012-06-12 15:01:25 -07:00
|
|
|
// Call RecvShow(nsIntSize(0, 0)) and block future calls to RecvShow().
|
|
|
|
void DoFakeShow();
|
|
|
|
|
2012-09-28 19:18:18 -07:00
|
|
|
// Wrapper for nsIDOMWindowUtils.setCSSViewport(). This updates some state
|
|
|
|
// variables local to this class before setting it.
|
2013-06-10 06:05:43 -07:00
|
|
|
void SetCSSViewport(const CSSSize& aSize);
|
2012-09-28 19:18:18 -07:00
|
|
|
|
2012-10-11 22:46:24 -07:00
|
|
|
// Recalculates the display state, including the CSS
|
|
|
|
// viewport. This should be called whenever we believe the
|
|
|
|
// viewport data on a document may have changed. If it didn't
|
|
|
|
// change, this function doesn't do anything. However, it should
|
|
|
|
// not be called all the time as it is fairly expensive.
|
|
|
|
void HandlePossibleViewportChange();
|
2012-09-28 19:18:18 -07:00
|
|
|
|
2012-08-08 21:39:02 -07:00
|
|
|
// Wraps up a JSON object as a structured clone and sends it to the browser
|
|
|
|
// chrome script.
|
|
|
|
//
|
|
|
|
// XXX/bug 780335: Do the work the browser chrome script does in C++ instead
|
|
|
|
// so we don't need things like this.
|
|
|
|
void DispatchMessageManagerMessage(const nsAString& aMessageName,
|
|
|
|
const nsACString& aJSONData);
|
|
|
|
|
2013-01-05 06:53:16 -08:00
|
|
|
void DispatchSynthesizedMouseEvent(uint32_t aMsg, uint64_t aTime,
|
2013-07-16 12:54:59 -07:00
|
|
|
const LayoutDevicePoint& aRefPoint);
|
2013-01-05 06:53:16 -08:00
|
|
|
|
|
|
|
// These methods are used for tracking synthetic mouse events
|
|
|
|
// dispatched for compatibility. On each touch event, we
|
|
|
|
// UpdateTapState(). If we've detected that the current gesture
|
|
|
|
// isn't a tap, then we CancelTapTracking(). In the meantime, we
|
|
|
|
// may detect a context-menu event, and if so we
|
|
|
|
// FireContextMenuEvent().
|
|
|
|
void FireContextMenuEvent();
|
|
|
|
void CancelTapTracking();
|
2013-09-26 23:20:57 -07:00
|
|
|
void UpdateTapState(const WidgetTouchEvent& aEvent, nsEventStatus aStatus);
|
2012-09-14 18:16:32 -07:00
|
|
|
|
2012-06-12 15:01:25 -07:00
|
|
|
nsresult
|
|
|
|
BrowserFrameProvideWindow(nsIDOMWindow* aOpener,
|
|
|
|
nsIURI* aURI,
|
|
|
|
const nsAString& aName,
|
|
|
|
const nsACString& aFeatures,
|
|
|
|
bool* aWindowIsNew,
|
|
|
|
nsIDOMWindow** aReturn);
|
|
|
|
|
2013-07-30 11:03:42 -07:00
|
|
|
// Get the DOMWindowUtils for the top-level window in this tab.
|
2013-06-14 14:47:56 -07:00
|
|
|
already_AddRefed<nsIDOMWindowUtils> GetDOMWindowUtils();
|
2013-11-13 10:20:30 -08:00
|
|
|
// Get the Document for the top-level window in this tab.
|
|
|
|
already_AddRefed<nsIDocument> GetDocument();
|
2012-09-28 19:18:18 -07:00
|
|
|
|
2013-02-15 14:27:21 -08:00
|
|
|
class CachedFileDescriptorInfo;
|
|
|
|
class CachedFileDescriptorCallbackRunnable;
|
|
|
|
|
2013-04-30 17:42:05 -07:00
|
|
|
TextureFactoryIdentifier mTextureFactoryIdentifier;
|
2009-06-30 13:39:22 -07:00
|
|
|
nsCOMPtr<nsIWebNavigation> mWebNav;
|
2010-08-20 16:24:40 -07:00
|
|
|
nsCOMPtr<nsIWidget> mWidget;
|
2012-09-28 19:18:18 -07:00
|
|
|
nsCOMPtr<nsIURI> mLastURI;
|
|
|
|
FrameMetrics mLastMetrics;
|
2010-08-20 16:24:41 -07:00
|
|
|
RenderFrameChild* mRemoteFrame;
|
2013-07-10 10:07:51 -07:00
|
|
|
nsRefPtr<ContentChild> mManager;
|
2010-08-23 01:44:43 -07:00
|
|
|
nsRefPtr<TabChildGlobal> mTabChildGlobal;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mChromeFlags;
|
2013-03-04 06:37:43 -08:00
|
|
|
nsIntRect mOuterRect;
|
2013-06-14 13:11:29 -07:00
|
|
|
ScreenIntSize mInnerSize;
|
2013-01-05 06:53:16 -08:00
|
|
|
// When we're tracking a possible tap gesture, this is the "down"
|
|
|
|
// point of the touchstart.
|
2013-07-16 12:54:59 -07:00
|
|
|
LayoutDevicePoint mGestureDownPoint;
|
2013-01-05 06:53:16 -08:00
|
|
|
// The touch identifier of the active gesture.
|
|
|
|
int32_t mActivePointerId;
|
|
|
|
// A timer task that fires if the tap-hold timeout is exceeded by
|
|
|
|
// the touch we're tracking. That is, if touchend or a touchmove
|
|
|
|
// that exceeds the gesture threshold doesn't happen.
|
|
|
|
CancelableTask* mTapHoldTimer;
|
2013-05-29 17:56:09 -07:00
|
|
|
// Whether we have already received a FileDescriptor for the app package.
|
|
|
|
bool mAppPackageFileDescriptorRecved;
|
2013-02-15 14:27:21 -08:00
|
|
|
// At present only 1 of these is really expected.
|
|
|
|
nsAutoTArray<nsAutoPtr<CachedFileDescriptorInfo>, 1>
|
|
|
|
mCachedFileDescriptorInfos;
|
2012-09-28 19:18:18 -07:00
|
|
|
float mOldViewportWidth;
|
2011-10-20 15:17:09 -07:00
|
|
|
nscolor mLastBackgroundColor;
|
2012-07-19 23:48:27 -07:00
|
|
|
ScrollingBehavior mScrolling;
|
Bug 802366 - The main event: Let a browser process inherit its app's id. r=bz,cjones DONTBUILD
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.
(Re-landing changeset a6a847452dbf, backed out in 5091aa6083c4, because it was originally landed with the incorrect bug number.)
2012-10-30 13:13:21 -07:00
|
|
|
bool mDidFakeShow;
|
2012-08-06 20:00:41 -07:00
|
|
|
bool mNotified;
|
2012-09-28 19:18:18 -07:00
|
|
|
bool mContentDocumentIsDisplayed;
|
2012-08-29 08:26:18 -07:00
|
|
|
bool mTriedBrowserInit;
|
2012-11-21 18:40:57 -08:00
|
|
|
ScreenOrientation mOrientation;
|
2013-08-13 00:56:57 -07:00
|
|
|
bool mUpdateHitRegion;
|
2010-02-20 09:05:20 -08:00
|
|
|
|
2009-06-30 13:39:22 -07:00
|
|
|
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
#endif // mozilla_dom_TabChild_h
|