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-02-20 09:05:20 -08:00
|
|
|
#ifndef _IMPL_NS_LAYOUT
|
2010-07-19 11:33:33 -07:00
|
|
|
#include "mozilla/dom/PBrowserChild.h"
|
2010-02-20 09:05:20 -08:00
|
|
|
#endif
|
2012-07-18 12:09:28 -07:00
|
|
|
#ifdef DEBUG
|
|
|
|
#include "PCOMContentPermissionRequestChild.h"
|
|
|
|
#endif /* DEBUG */
|
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"
|
|
|
|
#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"
|
2010-08-20 16:24:40 -07:00
|
|
|
#include "nsIWidget.h"
|
2009-11-17 06:22:23 -08:00
|
|
|
#include "nsIDOMEventListener.h"
|
|
|
|
#include "nsIDOMEventTarget.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 "nsIXPCScriptable.h"
|
|
|
|
#include "nsIClassInfo.h"
|
|
|
|
#include "jsapi.h"
|
|
|
|
#include "nsIXPConnect.h"
|
|
|
|
#include "nsIDOMWindow.h"
|
2010-03-03 12:30:25 -08:00
|
|
|
#include "nsIDocShell.h"
|
2010-08-05 15:11:23 -07:00
|
|
|
#include "nsIDocShellTreeItem.h"
|
|
|
|
#include "nsIDocShellTreeOwner.h"
|
|
|
|
#include "nsIDocument.h"
|
2010-02-20 09:05:20 -08:00
|
|
|
#include "nsNetUtil.h"
|
|
|
|
#include "nsFrameMessageManager.h"
|
|
|
|
#include "nsIScriptContext.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"
|
|
|
|
#include "nsIDialogParamBlock.h"
|
2012-09-28 19:18:18 -07:00
|
|
|
#include "nsIDOMWindowUtils.h"
|
2010-08-05 15:11:23 -07:00
|
|
|
#include "nsIPresShell.h"
|
2010-02-20 09:05:20 -08:00
|
|
|
#include "nsIPrincipal.h"
|
|
|
|
#include "nsIScriptObjectPrincipal.h"
|
|
|
|
#include "nsIScriptContext.h"
|
2012-07-19 23:48:27 -07:00
|
|
|
#include "nsPIDOMWindow.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"
|
2012-08-08 21:39:02 -07:00
|
|
|
#include "FrameMetrics.h"
|
2012-09-10 21:30:33 -07:00
|
|
|
#include "ProcessUtils.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"
|
2009-06-30 13:39:22 -07:00
|
|
|
|
2010-07-16 23:59:36 -07:00
|
|
|
struct gfxMatrix;
|
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,
|
|
|
|
public nsIScriptObjectPrincipal,
|
|
|
|
public nsIScriptContextPrincipal
|
|
|
|
{
|
|
|
|
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,
|
|
|
|
const jsval& aObject,
|
|
|
|
JSContext* aCx,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint8_t aArgc,
|
2011-10-01 09:14:36 -07:00
|
|
|
jsval* aRetval)
|
2010-02-20 09:05:20 -08:00
|
|
|
{
|
2011-10-01 09:14:36 -07:00
|
|
|
return mMessageManager
|
|
|
|
? mMessageManager->SendSyncMessage(aMessageName, aObject, aCx, aArgc, aRetval)
|
|
|
|
: NS_ERROR_NULL_POINTER;
|
2010-02-20 09:05:20 -08:00
|
|
|
}
|
|
|
|
NS_IMETHOD GetContent(nsIDOMWindow** aContent);
|
2010-03-03 12:30:25 -08:00
|
|
|
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell);
|
2010-02-20 09:05:20 -08:00
|
|
|
NS_IMETHOD Dump(const nsAString& aStr)
|
|
|
|
{
|
|
|
|
return mMessageManager ? mMessageManager->Dump(aStr) : NS_OK;
|
|
|
|
}
|
2010-11-24 05:58:21 -08:00
|
|
|
NS_IMETHOD PrivateNoteIntentionalCrash();
|
2011-06-25 02:52:00 -07:00
|
|
|
NS_IMETHOD Btoa(const nsAString& aBinaryData,
|
|
|
|
nsAString& aAsciiBase64String);
|
|
|
|
NS_IMETHOD Atob(const nsAString& aAsciiString,
|
|
|
|
nsAString& aBinaryData);
|
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
|
|
|
}
|
|
|
|
NS_IMETHOD AddEventListener(const nsAString& aType,
|
|
|
|
nsIDOMEventListener* aListener,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aUseCapture, bool aWantsUntrusted,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint8_t optional_argc)
|
2010-02-20 09:05:20 -08:00
|
|
|
{
|
|
|
|
return nsDOMEventTargetHelper::AddEventListener(aType, aListener,
|
|
|
|
aUseCapture,
|
|
|
|
aWantsUntrusted,
|
|
|
|
optional_argc);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual nsIScriptObjectPrincipal* GetObjectPrincipal() { return this; }
|
|
|
|
virtual JSContext* GetJSContextForEventHandlers();
|
|
|
|
virtual nsIPrincipal* GetPrincipal();
|
|
|
|
|
|
|
|
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. */
|
|
|
|
static already_AddRefed<TabChild>
|
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
|
|
|
Create(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.
|
|
|
|
*/
|
|
|
|
virtual bool DoSendSyncMessage(const nsAString& aMessage,
|
|
|
|
const mozilla::dom::StructuredCloneData& aData,
|
|
|
|
InfallibleTArray<nsString>* aJSONRetVal);
|
|
|
|
virtual bool DoSendAsyncMessage(const nsAString& aMessage,
|
|
|
|
const mozilla::dom::StructuredCloneData& aData);
|
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
virtual bool RecvLoadURL(const nsCString& uri);
|
2010-08-20 16:24:40 -07:00
|
|
|
virtual bool RecvShow(const nsIntSize& size);
|
2011-07-15 14:46:56 -07:00
|
|
|
virtual bool RecvUpdateDimensions(const nsRect& rect, const nsIntSize& size);
|
2012-08-08 21:39:02 -07:00
|
|
|
virtual bool RecvUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics);
|
|
|
|
virtual bool RecvHandleDoubleTap(const nsIntPoint& aPoint);
|
2012-09-14 18:16:32 -07:00
|
|
|
virtual bool RecvHandleSingleTap(const nsIntPoint& aPoint);
|
2012-11-08 11:35:02 -08:00
|
|
|
virtual bool RecvHandleLongTap(const nsIntPoint& 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);
|
2011-06-21 17:32:43 -07:00
|
|
|
virtual bool RecvRealMouseEvent(const nsMouseEvent& event);
|
|
|
|
virtual bool RecvRealKeyEvent(const nsKeyEvent& event);
|
2012-08-11 18:42:34 -07:00
|
|
|
virtual bool RecvMouseWheelEvent(const mozilla::widget::WheelEvent& event);
|
2012-07-15 19:58:43 -07:00
|
|
|
virtual bool RecvRealTouchEvent(const nsTouchEvent& event);
|
2012-08-22 03:54:20 -07:00
|
|
|
virtual bool RecvRealTouchMoveEvent(const nsTouchEvent& event);
|
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);
|
2010-08-17 01:07:42 -07:00
|
|
|
virtual bool RecvCompositionEvent(const nsCompositionEvent& event);
|
|
|
|
virtual bool RecvTextEvent(const nsTextEvent& event);
|
|
|
|
virtual bool RecvSelectionEvent(const nsSelectionEvent& event);
|
2010-07-19 11:33:33 -07:00
|
|
|
virtual bool RecvActivateFrameEvent(const nsString& aType, const bool& capture);
|
|
|
|
virtual bool RecvLoadRemoteScript(const nsString& aURL);
|
|
|
|
virtual bool RecvAsyncMessage(const nsString& aMessage,
|
2012-08-01 23:02:29 -07:00
|
|
|
const ClonedMessageData& aData);
|
2010-10-26 15:20:53 -07:00
|
|
|
|
|
|
|
virtual PDocumentRendererChild*
|
2010-10-26 15:20:53 -07:00
|
|
|
AllocPDocumentRenderer(const nsRect& documentRect, const gfxMatrix& transform,
|
|
|
|
const nsString& bgcolor,
|
2012-08-22 08:56:38 -07:00
|
|
|
const uint32_t& renderFlags, const bool& flushLayout,
|
2010-10-26 15:20:53 -07:00
|
|
|
const nsIntSize& renderSize);
|
2009-12-03 00:16:14 -08:00
|
|
|
virtual bool DeallocPDocumentRenderer(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
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual PContentDialogChild* AllocPContentDialog(const uint32_t&,
|
2010-05-17 04:25:22 -07:00
|
|
|
const nsCString&,
|
|
|
|
const nsCString&,
|
2010-11-08 18:49:00 -08:00
|
|
|
const InfallibleTArray<int>&,
|
|
|
|
const InfallibleTArray<nsString>&);
|
2010-05-17 04:25:22 -07:00
|
|
|
virtual bool DeallocPContentDialog(PContentDialogChild* aDialog);
|
|
|
|
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
|
|
|
|
virtual PContentPermissionRequestChild* SendPContentPermissionRequestConstructor(PContentPermissionRequestChild* aActor,
|
|
|
|
const nsCString& aType,
|
2012-11-13 16:06:42 -08:00
|
|
|
const nsCString& aAccess,
|
2012-07-30 07:58:26 -07:00
|
|
|
const IPC::Principal& aPrincipal)
|
2012-07-18 12:09:28 -07:00
|
|
|
{
|
|
|
|
PCOMContentPermissionRequestChild* child = static_cast<PCOMContentPermissionRequestChild*>(aActor);
|
2012-11-13 16:06:42 -08:00
|
|
|
PContentPermissionRequestChild* request = PBrowserChild::SendPContentPermissionRequestConstructor(aActor, aType, aAccess, aPrincipal);
|
2012-07-18 12:09:28 -07:00
|
|
|
child->mIPCOpen = true;
|
|
|
|
return request;
|
|
|
|
}
|
|
|
|
#endif /* DEBUG */
|
|
|
|
|
2012-11-13 16:06:42 -08:00
|
|
|
virtual PContentPermissionRequestChild* AllocPContentPermissionRequest(const nsCString& aType,
|
|
|
|
const nsCString& aAccess,
|
|
|
|
const IPC::Principal& aPrincipal);
|
2010-09-09 22:00:08 -07:00
|
|
|
virtual bool DeallocPContentPermissionRequest(PContentPermissionRequestChild* actor);
|
2010-05-13 10:44:51 -07:00
|
|
|
|
2012-07-30 23:36:00 -07:00
|
|
|
virtual POfflineCacheUpdateChild* AllocPOfflineCacheUpdate(
|
|
|
|
const URIParams& manifestURI,
|
2012-08-23 12:33:46 -07:00
|
|
|
const URIParams& documentURI,
|
2012-12-11 12:04:11 -08:00
|
|
|
const bool& isInBrowserElement,
|
|
|
|
const uint32_t& appId,
|
2010-10-20 10:12:32 -07:00
|
|
|
const bool& stickDocument);
|
|
|
|
virtual bool DeallocPOfflineCacheUpdate(POfflineCacheUpdateChild* offlineCacheUpdate);
|
|
|
|
|
2010-02-20 09:05:20 -08:00
|
|
|
nsIWebNavigation* WebNavigation() { return mWebNav; }
|
|
|
|
|
|
|
|
JSContext* GetJSContext() { return mCx; }
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2012-12-11 14:49:57 -08:00
|
|
|
gfxSize GetZoom() { return mLastMetrics.mZoom; }
|
|
|
|
|
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();
|
|
|
|
|
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();
|
|
|
|
|
2010-08-05 15:11:23 -07:00
|
|
|
protected:
|
2012-07-19 23:48:27 -07:00
|
|
|
virtual PRenderFrameChild* AllocPRenderFrame(ScrollingBehavior* aScrolling,
|
|
|
|
LayersBackend* aBackend,
|
2012-07-17 16:59:45 -07:00
|
|
|
int32_t* aMaxTextureSize,
|
2012-07-06 11:15:45 -07:00
|
|
|
uint64_t* aLayersId) MOZ_OVERRIDE;
|
|
|
|
virtual bool DeallocPRenderFrame(PRenderFrameChild* aFrame) MOZ_OVERRIDE;
|
|
|
|
virtual bool RecvDestroy() MOZ_OVERRIDE;
|
2010-08-05 15:11:23 -07:00
|
|
|
|
2012-07-15 19:58:43 -07:00
|
|
|
nsEventStatus DispatchWidgetEvent(nsGUIEvent& event);
|
2010-08-17 01:07:42 -07:00
|
|
|
|
2012-06-01 10:21:12 -07:00
|
|
|
virtual PIndexedDBChild* AllocPIndexedDB(const nsCString& aASCIIOrigin,
|
|
|
|
bool* /* aAllowed */);
|
|
|
|
|
2012-07-14 04:24:20 -07:00
|
|
|
virtual bool DeallocPIndexedDB(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
|
|
|
*/
|
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
|
|
|
TabChild(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();
|
2010-02-20 09:05:20 -08: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.
|
|
|
|
void SetCSSViewport(float aX, float aY);
|
|
|
|
|
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);
|
|
|
|
|
2012-09-14 18:16:32 -07:00
|
|
|
// Sends a simulated mouse event from a touch event for compatibility.
|
|
|
|
void DispatchSynthesizedMouseEvent(const nsTouchEvent& aEvent);
|
|
|
|
|
2012-06-12 15:01:25 -07:00
|
|
|
nsresult
|
|
|
|
BrowserFrameProvideWindow(nsIDOMWindow* aOpener,
|
|
|
|
nsIURI* aURI,
|
|
|
|
const nsAString& aName,
|
|
|
|
const nsACString& aFeatures,
|
|
|
|
bool* aWindowIsNew,
|
|
|
|
nsIDOMWindow** aReturn);
|
|
|
|
|
2012-09-28 19:18:18 -07:00
|
|
|
nsIDOMWindowUtils* GetDOMWindowUtils()
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(mWebNav);
|
|
|
|
nsCOMPtr<nsIDOMWindowUtils> utils = do_GetInterface(window);
|
|
|
|
return utils;
|
|
|
|
}
|
|
|
|
|
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;
|
2010-08-23 01:44:43 -07:00
|
|
|
nsRefPtr<TabChildGlobal> mTabChildGlobal;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mChromeFlags;
|
2011-07-15 14:46:56 -07:00
|
|
|
nsIntRect mOuterRect;
|
2012-09-28 19:18:18 -07:00
|
|
|
nsIntSize mInnerSize;
|
|
|
|
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;
|
2010-02-20 09:05:20 -08:00
|
|
|
|
2009-06-30 13:39:22 -07:00
|
|
|
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
|
|
|
|
};
|
|
|
|
|
2010-08-05 15:11:23 -07:00
|
|
|
inline TabChild*
|
|
|
|
GetTabChildFrom(nsIDocShell* aDocShell)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsITabChild> tc = do_GetInterface(aDocShell);
|
|
|
|
return static_cast<TabChild*>(tc.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
inline TabChild*
|
|
|
|
GetTabChildFrom(nsIPresShell* aPresShell)
|
|
|
|
{
|
|
|
|
nsIDocument* doc = aPresShell->GetDocument();
|
|
|
|
if (!doc) {
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2010-08-05 15:11:23 -07:00
|
|
|
}
|
|
|
|
nsCOMPtr<nsISupports> container = doc->GetContainer();
|
|
|
|
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
|
|
|
|
return GetTabChildFrom(docShell);
|
|
|
|
}
|
|
|
|
|
2011-09-30 00:00:48 -07:00
|
|
|
inline TabChild*
|
|
|
|
GetTabChildFrom(nsIDOMWindow* aWindow)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(aWindow);
|
|
|
|
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(webNav);
|
|
|
|
return GetTabChildFrom(docShell);
|
|
|
|
}
|
|
|
|
|
2009-06-30 13:39:22 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
#endif // mozilla_dom_TabChild_h
|