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/. */
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2012-07-18 03:59:45 +04:00
|
|
|
#include "base/basictypes.h"
|
|
|
|
|
2012-08-02 10:02:29 +04:00
|
|
|
#include "TabChild.h"
|
|
|
|
|
2015-07-31 10:25:14 +03:00
|
|
|
#include "gfxPrefs.h"
|
2015-05-21 20:04:58 +03:00
|
|
|
#ifdef ACCESSIBILITY
|
|
|
|
#include "mozilla/a11y/DocAccessibleChild.h"
|
|
|
|
#endif
|
2013-09-02 02:20:45 +04:00
|
|
|
#include "Layers.h"
|
2012-08-02 10:02:29 +04:00
|
|
|
#include "ContentChild.h"
|
2014-08-08 08:34:00 +04:00
|
|
|
#include "TabParent.h"
|
2013-09-04 16:14:52 +04:00
|
|
|
#include "mozilla/Preferences.h"
|
2016-01-08 22:17:39 +03:00
|
|
|
#include "mozilla/BrowserElementParent.h"
|
2012-08-29 19:26:18 +04:00
|
|
|
#include "mozilla/ClearOnShutdown.h"
|
2014-03-17 10:56:53 +04:00
|
|
|
#include "mozilla/EventListenerManager.h"
|
2014-09-27 03:21:57 +04:00
|
|
|
#include "mozilla/dom/indexedDB/PIndexedDBPermissionRequestChild.h"
|
2014-11-12 23:59:19 +03:00
|
|
|
#include "mozilla/plugins/PluginWidgetChild.h"
|
2015-07-01 16:19:11 +03:00
|
|
|
#include "mozilla/IMEStateManager.h"
|
2012-07-18 03:59:45 +04:00
|
|
|
#include "mozilla/ipc/DocumentRendererChild.h"
|
2015-12-04 02:04:28 +03:00
|
|
|
#include "mozilla/ipc/URIUtils.h"
|
2016-01-08 22:17:39 +03:00
|
|
|
#include "mozilla/layers/APZChild.h"
|
2014-04-17 15:54:25 +04:00
|
|
|
#include "mozilla/layers/APZCCallbackHelper.h"
|
2014-10-16 17:23:52 +04:00
|
|
|
#include "mozilla/layers/APZCTreeManager.h"
|
2016-11-29 07:21:27 +03:00
|
|
|
#include "mozilla/layers/APZCTreeManagerChild.h"
|
2015-02-09 22:05:18 +03:00
|
|
|
#include "mozilla/layers/APZEventState.h"
|
2016-08-11 02:51:45 +03:00
|
|
|
#include "mozilla/layers/ContentProcessController.h"
|
2016-03-22 21:08:38 +03:00
|
|
|
#include "mozilla/layers/CompositorBridgeChild.h"
|
2015-07-27 21:07:58 +03:00
|
|
|
#include "mozilla/layers/DoubleTapToZoom.h"
|
2016-11-29 07:21:27 +03:00
|
|
|
#include "mozilla/layers/IAPZCTreeManager.h"
|
2013-06-24 09:28:22 +04:00
|
|
|
#include "mozilla/layers/ImageBridgeChild.h"
|
2015-09-28 21:44:37 +03:00
|
|
|
#include "mozilla/layers/InputAPZContext.h"
|
2013-08-12 03:15:10 +04:00
|
|
|
#include "mozilla/layers/ShadowLayers.h"
|
2010-08-21 03:24:41 +04:00
|
|
|
#include "mozilla/layout/RenderFrameChild.h"
|
2016-01-08 22:17:39 +03:00
|
|
|
#include "mozilla/layout/RenderFrameParent.h"
|
2015-07-31 10:25:14 +03:00
|
|
|
#include "mozilla/LookAndFeel.h"
|
2013-09-25 15:21:18 +04:00
|
|
|
#include "mozilla/MouseEvents.h"
|
2015-09-11 19:52:43 +03:00
|
|
|
#include "mozilla/Move.h"
|
2016-11-30 06:14:28 +03:00
|
|
|
#include "mozilla/PresShell.h"
|
2016-10-21 21:56:46 +03:00
|
|
|
#include "mozilla/ProcessHangMonitor.h"
|
|
|
|
#include "mozilla/ScopeExit.h"
|
2013-10-21 16:58:12 +04:00
|
|
|
#include "mozilla/Services.h"
|
2012-08-29 19:26:18 +04:00
|
|
|
#include "mozilla/StaticPtr.h"
|
2013-09-25 15:21:19 +04:00
|
|
|
#include "mozilla/TextEvents.h"
|
2013-09-25 15:21:16 +04:00
|
|
|
#include "mozilla/TouchEvents.h"
|
2016-08-23 07:09:32 +03:00
|
|
|
#include "mozilla/Unused.h"
|
2012-07-18 03:59:45 +04:00
|
|
|
#include "nsContentUtils.h"
|
2016-07-23 02:36:45 +03:00
|
|
|
#include "nsCSSFrameConstructor.h"
|
2014-08-22 12:32:00 +04:00
|
|
|
#include "nsDocShell.h"
|
2012-07-18 03:59:45 +04:00
|
|
|
#include "nsEmbedCID.h"
|
2016-05-11 12:44:57 +03:00
|
|
|
#include "nsGlobalWindow.h"
|
2013-01-15 16:22:03 +04:00
|
|
|
#include <algorithm>
|
2013-01-08 00:45:10 +04:00
|
|
|
#ifdef MOZ_CRASHREPORTER
|
2013-01-07 18:42:32 +04:00
|
|
|
#include "nsExceptionHandler.h"
|
2013-01-08 00:45:10 +04:00
|
|
|
#endif
|
2014-02-18 04:30:06 +04:00
|
|
|
#include "nsFilePickerProxy.h"
|
2012-11-15 02:10:08 +04:00
|
|
|
#include "mozilla/dom/Element.h"
|
2016-05-25 09:41:54 +03:00
|
|
|
#include "nsGlobalWindow.h"
|
2009-07-01 00:39:22 +04:00
|
|
|
#include "nsIBaseWindow.h"
|
2014-06-20 22:07:47 +04:00
|
|
|
#include "nsIBrowserDOMWindow.h"
|
2013-01-13 01:53:01 +04:00
|
|
|
#include "nsIDocumentInlines.h"
|
2013-09-24 01:30:40 +04:00
|
|
|
#include "nsIDocShellTreeOwner.h"
|
2014-06-20 22:07:47 +04:00
|
|
|
#include "nsIDOMChromeWindow.h"
|
2014-11-13 03:31:00 +03:00
|
|
|
#include "nsIDOMDocument.h"
|
2012-07-18 03:59:45 +04:00
|
|
|
#include "nsIDOMEvent.h"
|
2009-10-29 20:58:31 +03:00
|
|
|
#include "nsIDOMWindow.h"
|
2012-07-18 03:59:45 +04:00
|
|
|
#include "nsIDOMWindowUtils.h"
|
2014-11-27 16:28:26 +03:00
|
|
|
#include "nsFocusManager.h"
|
2015-09-18 15:19:13 +03:00
|
|
|
#include "EventStateManager.h"
|
2010-08-13 12:06:40 +04:00
|
|
|
#include "nsIDocShell.h"
|
2014-11-22 06:10:18 +03:00
|
|
|
#include "nsIFrame.h"
|
2010-03-26 21:39:39 +03:00
|
|
|
#include "nsIURI.h"
|
2012-09-29 06:18:18 +04:00
|
|
|
#include "nsIURIFixup.h"
|
|
|
|
#include "nsCDefaultURIFixup.h"
|
2012-07-18 03:59:45 +04:00
|
|
|
#include "nsIWebBrowser.h"
|
2009-11-05 21:14:22 +03:00
|
|
|
#include "nsIWebBrowserFocus.h"
|
2012-07-18 03:59:45 +04:00
|
|
|
#include "nsIWebBrowserSetup.h"
|
|
|
|
#include "nsIWebProgress.h"
|
2013-12-13 02:13:20 +04:00
|
|
|
#include "nsIXULRuntime.h"
|
2012-07-18 03:59:45 +04:00
|
|
|
#include "nsPIDOMWindow.h"
|
|
|
|
#include "nsPIWindowRoot.h"
|
2013-07-10 03:26:07 +04:00
|
|
|
#include "nsLayoutUtils.h"
|
2012-07-20 10:48:27 +04:00
|
|
|
#include "nsPrintfCString.h"
|
2012-07-18 03:59:45 +04:00
|
|
|
#include "nsThreadUtils.h"
|
2016-07-23 02:36:45 +03:00
|
|
|
#include "nsViewManager.h"
|
2012-07-18 03:59:45 +04:00
|
|
|
#include "nsWeakReference.h"
|
2014-06-20 22:07:47 +04:00
|
|
|
#include "nsWindowWatcher.h"
|
2013-11-06 21:21:15 +04:00
|
|
|
#include "PermissionMessageUtils.h"
|
2012-08-29 19:26:18 +04:00
|
|
|
#include "PuppetWidget.h"
|
2015-09-10 23:50:58 +03:00
|
|
|
#include "StructuredCloneData.h"
|
2012-12-18 01:24:41 +04:00
|
|
|
#include "nsViewportInfo.h"
|
2013-10-08 06:21:07 +04:00
|
|
|
#include "nsILoadContext.h"
|
2013-10-19 00:57:55 +04:00
|
|
|
#include "ipc/nsGUIEventIPC.h"
|
2013-12-26 22:06:53 +04:00
|
|
|
#include "mozilla/gfx/Matrix.h"
|
2014-03-11 01:56:59 +04:00
|
|
|
#include "UnitTransforms.h"
|
2014-03-07 07:24:32 +04:00
|
|
|
#include "ClientLayerManager.h"
|
2014-08-06 20:41:05 +04:00
|
|
|
#include "LayersLogging.h"
|
2014-10-22 19:40:49 +04:00
|
|
|
#include "nsDOMClassInfoID.h"
|
2014-02-24 00:19:43 +04:00
|
|
|
#include "nsColorPickerProxy.h"
|
2016-06-20 16:55:00 +03:00
|
|
|
#include "nsDatePickerProxy.h"
|
2015-11-09 03:55:08 +03:00
|
|
|
#include "nsContentPermissionHelper.h"
|
2014-10-31 20:54:02 +03:00
|
|
|
#include "nsNetUtil.h"
|
|
|
|
#include "nsIPermissionManager.h"
|
2015-12-04 02:04:28 +03:00
|
|
|
#include "nsIURILoader.h"
|
2014-11-24 22:05:35 +03:00
|
|
|
#include "nsIScriptError.h"
|
2015-05-14 15:16:00 +03:00
|
|
|
#include "mozilla/EventForwards.h"
|
2015-06-08 08:39:28 +03:00
|
|
|
#include "nsDeviceContext.h"
|
2016-06-21 21:31:00 +03:00
|
|
|
#include "nsSandboxFlags.h"
|
2016-02-29 09:53:12 +03:00
|
|
|
#include "FrameLayerBuilder.h"
|
2016-02-25 02:54:50 +03:00
|
|
|
#include "VRManagerChild.h"
|
2016-08-31 04:30:45 +03:00
|
|
|
#include "nsICommandParams.h"
|
2016-10-14 10:31:02 +03:00
|
|
|
#include "nsISHistory.h"
|
|
|
|
#include "nsQueryObject.h"
|
|
|
|
#include "GroupedSHistory.h"
|
2016-10-21 23:56:51 +03:00
|
|
|
#include "nsIHttpChannel.h"
|
|
|
|
#include "mozilla/dom/DocGroup.h"
|
2014-02-24 00:19:43 +04:00
|
|
|
|
2016-05-16 12:40:54 +03:00
|
|
|
#ifdef NS_PRINTING
|
|
|
|
#include "nsIPrintSession.h"
|
|
|
|
#include "nsIPrintSettings.h"
|
|
|
|
#include "nsIPrintSettingsService.h"
|
|
|
|
#include "nsIWebBrowserPrint.h"
|
|
|
|
#endif
|
|
|
|
|
2012-08-29 19:26:18 +04:00
|
|
|
#define BROWSER_ELEMENT_CHILD_SCRIPT \
|
|
|
|
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js")
|
|
|
|
|
2014-08-06 20:41:05 +04:00
|
|
|
#define TABC_LOG(...)
|
|
|
|
// #define TABC_LOG(...) printf_stderr("TABC: " __VA_ARGS__)
|
|
|
|
|
2012-08-02 10:02:29 +04:00
|
|
|
using namespace mozilla;
|
2009-08-12 20:18:08 +04:00
|
|
|
using namespace mozilla::dom;
|
2012-09-28 09:43:12 +04:00
|
|
|
using namespace mozilla::dom::ipc;
|
2015-02-11 14:53:00 +03:00
|
|
|
using namespace mozilla::dom::workers;
|
2010-10-27 02:20:53 +04:00
|
|
|
using namespace mozilla::ipc;
|
2010-08-21 03:24:41 +04:00
|
|
|
using namespace mozilla::layers;
|
2010-08-21 03:24:41 +04:00
|
|
|
using namespace mozilla::layout;
|
2010-10-20 21:12:32 +04:00
|
|
|
using namespace mozilla::docshell;
|
2012-08-12 05:42:34 +04:00
|
|
|
using namespace mozilla::widget;
|
2013-07-11 02:05:39 +04:00
|
|
|
using namespace mozilla::jsipc;
|
2016-07-05 20:24:54 +03:00
|
|
|
using mozilla::layers::GeckoContentController;
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_IMPL_ISUPPORTS(ContentListener, nsIDOMEventListener)
|
2016-10-14 10:31:02 +03:00
|
|
|
NS_IMPL_ISUPPORTS(TabChildSHistoryListener,
|
|
|
|
nsISHistoryListener,
|
|
|
|
nsIPartialSHistoryListener,
|
|
|
|
nsISupportsWeakReference)
|
2009-11-17 17:22:23 +03:00
|
|
|
|
2013-06-10 17:05:43 +04:00
|
|
|
static const CSSSize kDefaultViewportSize(980, 480);
|
2012-09-29 06:18:18 +04:00
|
|
|
|
|
|
|
static const char BEFORE_FIRST_PAINT[] = "before-first-paint";
|
|
|
|
|
2014-03-07 07:24:32 +04:00
|
|
|
typedef nsDataHashtable<nsUint64HashKey, TabChild*> TabChildMap;
|
|
|
|
static TabChildMap* sTabChildren;
|
|
|
|
|
2014-03-25 06:28:46 +04:00
|
|
|
TabChildBase::TabChildBase()
|
2015-07-21 17:51:55 +03:00
|
|
|
: mTabChildGlobal(nullptr)
|
2014-03-25 06:28:46 +04:00
|
|
|
{
|
2014-06-13 21:56:38 +04:00
|
|
|
mozilla::HoldJSObjects(this);
|
2014-03-25 06:28:46 +04:00
|
|
|
}
|
|
|
|
|
2014-06-13 21:56:38 +04:00
|
|
|
TabChildBase::~TabChildBase()
|
|
|
|
{
|
|
|
|
mAnonymousGlobalScopes.Clear();
|
|
|
|
mozilla::DropJSObjects(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(TabChildBase)
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(TabChildBase)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTabChildGlobal)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mGlobal)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mAnonymousGlobalScopes)
|
2014-09-03 01:43:08 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWebBrowserChrome)
|
2014-06-13 21:56:38 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(TabChildBase)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTabChildGlobal)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGlobal)
|
2014-09-03 01:43:08 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWebBrowserChrome)
|
2014-06-13 21:56:38 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(TabChildBase)
|
2016-02-10 01:08:53 +03:00
|
|
|
tmp->nsMessageManagerScriptExecutor::Trace(aCallbacks, aClosure);
|
2014-06-13 21:56:38 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
|
|
|
|
2014-04-23 01:26:45 +04:00
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TabChildBase)
|
2014-05-07 04:11:20 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
2014-04-23 01:26:45 +04:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
2014-06-13 21:56:38 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(TabChildBase)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(TabChildBase)
|
2014-04-23 01:26:45 +04:00
|
|
|
|
2014-03-25 06:28:46 +04:00
|
|
|
already_AddRefed<nsIDocument>
|
2015-01-16 21:48:33 +03:00
|
|
|
TabChildBase::GetDocument() const
|
2014-03-25 06:28:46 +04:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMDocument> domDoc;
|
|
|
|
WebNavigation()->GetDocument(getter_AddRefs(domDoc));
|
|
|
|
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
|
|
|
return doc.forget();
|
|
|
|
}
|
|
|
|
|
2015-04-14 23:44:59 +03:00
|
|
|
already_AddRefed<nsIPresShell>
|
|
|
|
TabChildBase::GetPresShell() const
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIPresShell> result;
|
|
|
|
if (nsCOMPtr<nsIDocument> doc = GetDocument()) {
|
|
|
|
result = doc->GetShell();
|
|
|
|
}
|
|
|
|
return result.forget();
|
|
|
|
}
|
|
|
|
|
2014-03-25 06:28:46 +04:00
|
|
|
void
|
|
|
|
TabChildBase::DispatchMessageManagerMessage(const nsAString& aMessageName,
|
|
|
|
const nsAString& aJSONData)
|
|
|
|
{
|
|
|
|
AutoSafeJSContext cx;
|
2015-06-30 04:36:44 +03:00
|
|
|
JS::Rooted<JS::Value> json(cx, JS::NullValue());
|
2016-11-24 18:08:31 +03:00
|
|
|
dom::ipc::StructuredCloneData data;
|
2014-03-25 06:28:46 +04:00
|
|
|
if (JS_ParseJSON(cx,
|
2014-07-22 08:43:21 +04:00
|
|
|
static_cast<const char16_t*>(aJSONData.BeginReading()),
|
2014-03-25 06:28:46 +04:00
|
|
|
aJSONData.Length(),
|
|
|
|
&json)) {
|
2015-09-02 19:20:30 +03:00
|
|
|
ErrorResult rv;
|
2015-09-10 23:50:58 +03:00
|
|
|
data.Write(cx, json, rv);
|
2015-09-02 19:20:30 +03:00
|
|
|
if (NS_WARN_IF(rv.Failed())) {
|
2016-07-22 17:50:10 +03:00
|
|
|
rv.SuppressException();
|
2015-09-02 19:20:30 +03:00
|
|
|
return;
|
|
|
|
}
|
2014-03-25 06:28:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsIXPConnectJSObjectHolder> kungFuDeathGrip(GetGlobal());
|
|
|
|
// Let the BrowserElementScrolling helper (if it exists) for this
|
|
|
|
// content manipulate the frame state.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsFrameMessageManager> mm =
|
2014-03-25 06:28:46 +04:00
|
|
|
static_cast<nsFrameMessageManager*>(mTabChildGlobal->mMessageManager.get());
|
2015-04-16 18:17:54 +03:00
|
|
|
mm->ReceiveMessage(static_cast<EventTarget*>(mTabChildGlobal), nullptr,
|
2015-09-10 23:50:58 +03:00
|
|
|
aMessageName, false, &data, nullptr, nullptr, nullptr);
|
2014-03-25 06:28:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
TabChildBase::UpdateFrameHandler(const FrameMetrics& aFrameMetrics)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aFrameMetrics.GetScrollId() != FrameMetrics::NULL_SCROLL_ID);
|
|
|
|
|
2015-06-08 23:01:26 +03:00
|
|
|
if (aFrameMetrics.IsRootContent()) {
|
2015-04-14 23:44:59 +03:00
|
|
|
if (nsCOMPtr<nsIPresShell> shell = GetPresShell()) {
|
|
|
|
// Guard against stale updates (updates meant for a pres shell which
|
|
|
|
// has since been torn down and destroyed).
|
|
|
|
if (aFrameMetrics.GetPresShellId() == shell->GetPresShellId()) {
|
2015-07-21 17:51:55 +03:00
|
|
|
ProcessUpdateFrame(aFrameMetrics);
|
2015-04-14 23:44:59 +03:00
|
|
|
return true;
|
|
|
|
}
|
2014-03-25 06:28:46 +04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// aFrameMetrics.mIsRoot is false, so we are trying to update a subframe.
|
|
|
|
// This requires special handling.
|
2015-06-15 21:39:06 +03:00
|
|
|
FrameMetrics newSubFrameMetrics(aFrameMetrics);
|
|
|
|
APZCCallbackHelper::UpdateSubFrame(newSubFrameMetrics);
|
|
|
|
return true;
|
2014-03-25 06:28:46 +04:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-07-21 17:51:55 +03:00
|
|
|
void
|
2014-03-25 06:28:46 +04:00
|
|
|
TabChildBase::ProcessUpdateFrame(const FrameMetrics& aFrameMetrics)
|
|
|
|
{
|
|
|
|
if (!mGlobal || !mTabChildGlobal) {
|
2015-07-21 17:51:55 +03:00
|
|
|
return;
|
2014-03-25 06:28:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
FrameMetrics newMetrics = aFrameMetrics;
|
2015-06-15 21:39:06 +03:00
|
|
|
APZCCallbackHelper::UpdateRootFrame(newMetrics);
|
2014-03-25 06:28:46 +04:00
|
|
|
}
|
|
|
|
|
2009-11-17 17:22:23 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
ContentListener::HandleEvent(nsIDOMEvent* aEvent)
|
|
|
|
{
|
|
|
|
RemoteDOMEvent remoteEvent;
|
|
|
|
remoteEvent.mEvent = do_QueryInterface(aEvent);
|
|
|
|
NS_ENSURE_STATE(remoteEvent.mEvent);
|
2010-07-19 22:33:33 +04:00
|
|
|
mTabChild->SendEvent(remoteEvent);
|
2009-11-17 17:22:23 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class TabChild::DelayedDeleteRunnable final
|
2016-04-26 03:23:21 +03:00
|
|
|
: public Runnable
|
2014-07-11 22:15:10 +04:00
|
|
|
{
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<TabChild> mTabChild;
|
2014-07-11 22:15:10 +04:00
|
|
|
|
|
|
|
public:
|
2014-12-11 01:49:09 +03:00
|
|
|
explicit DelayedDeleteRunnable(TabChild* aTabChild)
|
2014-07-11 22:15:10 +04:00
|
|
|
: mTabChild(aTabChild)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
MOZ_ASSERT(aTabChild);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
~DelayedDeleteRunnable()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
MOZ_ASSERT(!mTabChild);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHOD
|
2016-08-08 05:18:10 +03:00
|
|
|
Run() override
|
2014-07-11 22:15:10 +04:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
MOZ_ASSERT(mTabChild);
|
2016-11-12 00:04:09 +03:00
|
|
|
|
|
|
|
// Check in case ActorDestroy was called after RecvDestroy message.
|
|
|
|
if (mTabChild->IPCOpen()) {
|
|
|
|
Unused << PBrowserChild::Send__delete__(mTabChild);
|
|
|
|
}
|
|
|
|
|
2014-07-11 22:15:10 +04:00
|
|
|
mTabChild = nullptr;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-01-30 12:07:12 +03:00
|
|
|
namespace {
|
2015-10-18 08:24:48 +03:00
|
|
|
std::map<TabId, RefPtr<TabChild>>&
|
2015-01-30 12:07:12 +03:00
|
|
|
NestedTabChildMap()
|
2014-06-11 09:44:36 +04:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
2015-10-18 08:24:48 +03:00
|
|
|
static std::map<TabId, RefPtr<TabChild>> sNestedTabChildMap;
|
2014-06-11 09:44:36 +04:00
|
|
|
return sNestedTabChildMap;
|
|
|
|
}
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace
|
2015-01-30 12:07:12 +03:00
|
|
|
|
|
|
|
already_AddRefed<TabChild>
|
|
|
|
TabChild::FindTabChild(const TabId& aTabId)
|
|
|
|
{
|
|
|
|
auto iter = NestedTabChildMap().find(aTabId);
|
|
|
|
if (iter == NestedTabChildMap().end()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<TabChild> tabChild = iter->second;
|
2015-01-30 12:07:12 +03:00
|
|
|
return tabChild.forget();
|
|
|
|
}
|
2014-06-11 09:44:36 +04:00
|
|
|
|
2012-08-29 19:26:18 +04:00
|
|
|
/*static*/ already_AddRefed<TabChild>
|
2014-09-09 12:57:54 +04:00
|
|
|
TabChild::Create(nsIContentChild* aManager,
|
2014-10-29 21:11:00 +03:00
|
|
|
const TabId& aTabId,
|
2014-09-09 12:57:54 +04:00
|
|
|
const TabContext &aContext,
|
|
|
|
uint32_t aChromeFlags)
|
2012-08-29 19:26:18 +04:00
|
|
|
{
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<TabChild> iframe = new TabChild(aManager, aTabId,
|
2013-07-10 21:07:51 +04:00
|
|
|
aContext, aChromeFlags);
|
2016-12-01 06:16:28 +03:00
|
|
|
return iframe.forget();
|
2012-08-29 19:26:18 +04:00
|
|
|
}
|
|
|
|
|
2014-09-09 12:57:54 +04:00
|
|
|
TabChild::TabChild(nsIContentChild* aManager,
|
2014-10-29 21:11:00 +03:00
|
|
|
const TabId& aTabId,
|
2014-09-09 12:57:54 +04:00
|
|
|
const TabContext& aContext,
|
|
|
|
uint32_t aChromeFlags)
|
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
|
|
|
: TabContext(aContext)
|
|
|
|
, mRemoteFrame(nullptr)
|
2013-07-10 21:07:51 +04:00
|
|
|
, mManager(aManager)
|
2010-07-19 22:33:33 +04:00
|
|
|
, mChromeFlags(aChromeFlags)
|
2015-08-20 00:08:41 +03:00
|
|
|
, mActiveSuppressDisplayport(0)
|
2014-03-07 07:24:32 +04:00
|
|
|
, mLayersId(0)
|
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-31 00:13:21 +04:00
|
|
|
, mDidFakeShow(false)
|
2012-08-07 07:00:41 +04:00
|
|
|
, mNotified(false)
|
2012-08-29 19:26:18 +04:00
|
|
|
, mTriedBrowserInit(false)
|
2012-11-22 06:40:57 +04:00
|
|
|
, mOrientation(eScreenOrientation_PortraitPrimary)
|
2014-03-12 07:13:38 +04:00
|
|
|
, mIgnoreKeyPressEvent(false)
|
2014-04-25 19:40:23 +04:00
|
|
|
, mHasValidInnerSize(false)
|
2014-08-24 11:16:32 +04:00
|
|
|
, mDestroyed(false)
|
2014-10-29 21:11:00 +03:00
|
|
|
, mUniqueId(aTabId)
|
2014-12-12 20:50:46 +03:00
|
|
|
, mDPI(0)
|
2016-09-27 09:37:07 +03:00
|
|
|
, mRounding(0)
|
2014-12-12 20:50:46 +03:00
|
|
|
, mDefaultScale(0)
|
2016-05-16 05:56:09 +03:00
|
|
|
, mIsTransparent(false)
|
2016-09-21 02:02:37 +03:00
|
|
|
, mIPCOpen(false)
|
2015-02-06 19:26:29 +03:00
|
|
|
, mParentIsActive(false)
|
2015-10-30 16:24:57 +03:00
|
|
|
, mDidSetRealShowInfo(false)
|
2016-03-12 01:31:55 +03:00
|
|
|
, mDidLoadURLInit(false)
|
2016-10-21 23:56:51 +03:00
|
|
|
, mIsFreshProcess(false)
|
2016-07-23 02:36:45 +03:00
|
|
|
, mLayerObserverEpoch(0)
|
2016-09-15 22:37:04 +03:00
|
|
|
#if defined(XP_WIN) && defined(ACCESSIBILITY)
|
|
|
|
, mNativeWindowHandle(0)
|
|
|
|
#endif
|
2009-07-01 00:39:22 +04:00
|
|
|
{
|
2015-06-04 23:51:10 +03:00
|
|
|
// In the general case having the TabParent tell us if APZ is enabled or not
|
|
|
|
// doesn't really work because the TabParent itself may not have a reference
|
|
|
|
// to the owning widget during initialization. Instead we assume that this
|
|
|
|
// TabChild corresponds to a widget type that would have APZ enabled, and just
|
|
|
|
// check the other conditions necessary for enabling APZ.
|
|
|
|
mAsyncPanZoomEnabled = gfxPlatform::AsyncPanZoomEnabled();
|
|
|
|
|
2015-09-11 19:27:49 +03:00
|
|
|
nsWeakPtr weakPtrThis(do_GetWeakReference(static_cast<nsITabChild*>(this))); // for capture by the lambda
|
|
|
|
mSetAllowedTouchBehaviorCallback = [weakPtrThis](uint64_t aInputBlockId,
|
|
|
|
const nsTArray<TouchBehaviorFlags>& aFlags)
|
|
|
|
{
|
|
|
|
if (nsCOMPtr<nsITabChild> tabChild = do_QueryReferent(weakPtrThis)) {
|
2016-01-08 22:17:39 +03:00
|
|
|
static_cast<TabChild*>(tabChild.get())->SetAllowedTouchBehavior(aInputBlockId, aFlags);
|
2015-09-11 19:27:49 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-10-29 21:11:00 +03:00
|
|
|
// preloaded TabChild should not be added to child map
|
|
|
|
if (mUniqueId) {
|
|
|
|
MOZ_ASSERT(NestedTabChildMap().find(mUniqueId) == NestedTabChildMap().end());
|
|
|
|
NestedTabChildMap()[mUniqueId] = this;
|
|
|
|
}
|
2015-07-10 19:38:44 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIObserverService> observerService =
|
|
|
|
mozilla::services::GetObserverService();
|
|
|
|
|
|
|
|
if (observerService) {
|
|
|
|
const nsAttrValue::EnumTable* table =
|
|
|
|
AudioChannelService::GetAudioChannelTable();
|
|
|
|
|
|
|
|
nsAutoCString topic;
|
|
|
|
for (uint32_t i = 0; table[i].tag; ++i) {
|
|
|
|
topic.Assign("audiochannel-activity-");
|
|
|
|
topic.Append(table[i].tag);
|
|
|
|
|
|
|
|
observerService->AddObserver(this, topic.get(), false);
|
|
|
|
}
|
|
|
|
}
|
2015-08-05 05:47:10 +03:00
|
|
|
|
|
|
|
for (uint32_t idx = 0; idx < NUMBER_OF_AUDIO_CHANNELS; idx++) {
|
|
|
|
mAudioChannelsActive.AppendElement(false);
|
|
|
|
}
|
2009-11-05 21:14:22 +03:00
|
|
|
}
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2012-09-29 06:18:18 +04:00
|
|
|
NS_IMETHODIMP
|
2012-08-09 00:37:57 +04:00
|
|
|
TabChild::Observe(nsISupports *aSubject,
|
|
|
|
const char *aTopic,
|
2014-01-04 19:02:17 +04:00
|
|
|
const char16_t *aData)
|
2012-08-09 00:37:57 +04:00
|
|
|
{
|
2015-07-27 21:07:58 +03:00
|
|
|
if (!strcmp(aTopic, BEFORE_FIRST_PAINT)) {
|
2015-06-04 23:51:10 +03:00
|
|
|
if (AsyncPanZoomEnabled()) {
|
2012-09-29 06:18:18 +04:00
|
|
|
nsCOMPtr<nsIDocument> subject(do_QueryInterface(aSubject));
|
2013-11-13 22:20:30 +04:00
|
|
|
nsCOMPtr<nsIDocument> doc(GetDocument());
|
2012-09-29 06:18:18 +04:00
|
|
|
|
|
|
|
if (SameCOMIdentity(subject, doc)) {
|
2015-04-14 23:44:59 +03:00
|
|
|
nsCOMPtr<nsIPresShell> shell(doc->GetShell());
|
|
|
|
if (shell) {
|
|
|
|
shell->SetIsFirstPaint(true);
|
|
|
|
}
|
2012-09-29 06:18:18 +04:00
|
|
|
|
2015-07-21 17:51:55 +03:00
|
|
|
APZCCallbackHelper::InitializeRootDisplayport(shell);
|
2012-09-29 06:18:18 +04:00
|
|
|
}
|
|
|
|
}
|
2012-08-09 00:37:57 +04:00
|
|
|
}
|
|
|
|
|
2015-07-10 19:38:44 +03:00
|
|
|
const nsAttrValue::EnumTable* table =
|
|
|
|
AudioChannelService::GetAudioChannelTable();
|
|
|
|
|
|
|
|
nsAutoCString topic;
|
|
|
|
int16_t audioChannel = -1;
|
|
|
|
for (uint32_t i = 0; table[i].tag; ++i) {
|
|
|
|
topic.Assign("audiochannel-activity-");
|
|
|
|
topic.Append(table[i].tag);
|
|
|
|
|
|
|
|
if (topic.Equals(aTopic)) {
|
|
|
|
audioChannel = table[i].value;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-10 19:38:48 +03:00
|
|
|
if (audioChannel != -1 && mIPCOpen) {
|
|
|
|
// If the subject is not a wrapper, it is sent by the TabParent and we
|
|
|
|
// should ignore it.
|
|
|
|
nsCOMPtr<nsISupportsPRUint64> wrapper = do_QueryInterface(aSubject);
|
|
|
|
if (!wrapper) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// We must have a window in order to compare the windowID contained into the
|
|
|
|
// wrapper.
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(WebNavigation());
|
2015-07-10 19:38:48 +03:00
|
|
|
if (!window) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t windowID = 0;
|
|
|
|
nsresult rv = wrapper->GetData(&windowID);
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
// In theory a tabChild should contain just 1 top window, but let's double
|
|
|
|
// check it comparing the windowID.
|
|
|
|
if (window->WindowID() != windowID) {
|
2015-11-10 13:32:00 +03:00
|
|
|
MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
|
|
|
|
("TabChild, Observe, different windowID, owner ID = %lld, "
|
|
|
|
"ID from wrapper = %lld", window->WindowID(), windowID));
|
2015-07-10 19:38:48 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAutoString activeStr(aData);
|
|
|
|
bool active = activeStr.EqualsLiteral("active");
|
2015-08-05 05:47:10 +03:00
|
|
|
if (active != mAudioChannelsActive[audioChannel]) {
|
|
|
|
mAudioChannelsActive[audioChannel] = active;
|
2015-11-02 08:53:26 +03:00
|
|
|
Unused << SendAudioChannelActivityNotification(audioChannel, active);
|
2015-07-10 19:38:48 +03:00
|
|
|
}
|
2015-07-10 19:38:44 +03:00
|
|
|
}
|
|
|
|
|
2012-08-09 00:37:57 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2016-01-08 22:17:39 +03:00
|
|
|
void
|
|
|
|
TabChild::ContentReceivedInputBlock(const ScrollableLayerGuid& aGuid,
|
|
|
|
uint64_t aInputBlockId,
|
|
|
|
bool aPreventDefault) const
|
|
|
|
{
|
2016-07-31 22:39:00 +03:00
|
|
|
if (mApzcTreeManager) {
|
|
|
|
mApzcTreeManager->ContentReceivedInputBlock(aInputBlockId, aPreventDefault);
|
2016-01-08 22:17:39 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TabChild::SetTargetAPZC(uint64_t aInputBlockId,
|
|
|
|
const nsTArray<ScrollableLayerGuid>& aTargets) const
|
|
|
|
{
|
2016-07-31 22:39:00 +03:00
|
|
|
if (mApzcTreeManager) {
|
|
|
|
mApzcTreeManager->SetTargetAPZC(aInputBlockId, aTargets);
|
2016-01-08 22:17:39 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TabChild::SetAllowedTouchBehavior(uint64_t aInputBlockId,
|
|
|
|
const nsTArray<TouchBehaviorFlags>& aTargets) const
|
|
|
|
{
|
2016-07-31 22:39:00 +03:00
|
|
|
if (mApzcTreeManager) {
|
|
|
|
mApzcTreeManager->SetAllowedTouchBehavior(aInputBlockId, aTargets);
|
2016-01-08 22:17:39 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-25 06:28:46 +04:00
|
|
|
bool
|
|
|
|
TabChild::DoUpdateZoomConstraints(const uint32_t& aPresShellId,
|
|
|
|
const ViewID& aViewId,
|
2015-06-17 19:32:41 +03:00
|
|
|
const Maybe<ZoomConstraints>& aConstraints)
|
2014-03-25 06:28:46 +04:00
|
|
|
{
|
2016-07-31 22:39:00 +03:00
|
|
|
if (!mApzcTreeManager) {
|
2016-01-08 22:17:39 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-07-31 22:39:00 +03:00
|
|
|
ScrollableLayerGuid guid = ScrollableLayerGuid(mLayersId, aPresShellId, aViewId);
|
|
|
|
|
|
|
|
mApzcTreeManager->UpdateZoomConstraints(guid, aConstraints);
|
|
|
|
return true;
|
2012-09-29 06:18:18 +04:00
|
|
|
}
|
|
|
|
|
2009-11-05 21:14:22 +03:00
|
|
|
nsresult
|
|
|
|
TabChild::Init()
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIWebBrowser> webBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID);
|
|
|
|
if (!webBrowser) {
|
|
|
|
NS_ERROR("Couldn't create a nsWebBrowser?");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
webBrowser->SetContainerWindow(this);
|
2016-09-05 15:43:51 +03:00
|
|
|
webBrowser->SetOriginAttributes(OriginAttributesRef());
|
2009-11-05 21:14:22 +03:00
|
|
|
mWebNav = do_QueryInterface(webBrowser);
|
|
|
|
NS_ASSERTION(mWebNav, "nsWebBrowser doesn't implement nsIWebNavigation?");
|
|
|
|
|
2014-03-25 06:28:46 +04:00
|
|
|
nsCOMPtr<nsIDocShellTreeItem> docShellItem(do_QueryInterface(WebNavigation()));
|
2009-11-05 21:14:22 +03:00
|
|
|
docShellItem->SetItemType(nsIDocShellTreeItem::typeContentWrapper);
|
2015-08-05 05:47:10 +03:00
|
|
|
|
2014-03-25 06:28:46 +04:00
|
|
|
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(WebNavigation());
|
2012-08-29 19:26:18 +04:00
|
|
|
if (!baseWindow) {
|
|
|
|
NS_ERROR("mWebNav doesn't QI to nsIBaseWindow");
|
2012-09-07 17:23:23 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
2012-08-29 19:26:18 +04:00
|
|
|
}
|
2012-08-09 00:37:57 +04:00
|
|
|
|
2015-06-17 11:44:50 +03:00
|
|
|
nsCOMPtr<nsIWidget> widget = nsIWidget::CreatePuppetWidget(this);
|
|
|
|
mPuppetWidget = static_cast<PuppetWidget*>(widget.get());
|
|
|
|
if (!mPuppetWidget) {
|
2012-08-29 19:26:18 +04:00
|
|
|
NS_ERROR("couldn't create fake widget");
|
2012-09-07 17:23:23 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
2012-08-29 19:26:18 +04:00
|
|
|
}
|
2016-08-19 02:03:17 +03:00
|
|
|
mPuppetWidget->InfallibleCreate(
|
2012-08-29 19:26:18 +04:00
|
|
|
nullptr, 0, // no parents
|
2015-11-16 11:35:18 +03:00
|
|
|
LayoutDeviceIntRect(0, 0, 0, 0),
|
2015-02-05 10:35:25 +03:00
|
|
|
nullptr // HandleWidgetEvent
|
2012-08-29 19:26:18 +04:00
|
|
|
);
|
|
|
|
|
2015-06-17 11:44:50 +03:00
|
|
|
baseWindow->InitWindow(0, mPuppetWidget, 0, 0, 0, 0);
|
2012-08-29 19:26:18 +04:00
|
|
|
baseWindow->Create();
|
|
|
|
|
2016-06-03 00:02:29 +03:00
|
|
|
// Set the tab context attributes then pass to docShell
|
2016-09-05 15:43:51 +03:00
|
|
|
NotifyTabContextUpdated(false);
|
2012-08-29 19:26:18 +04:00
|
|
|
|
|
|
|
// IPC uses a WebBrowser object for which DNS prefetching is turned off
|
|
|
|
// by default. But here we really want it, so enable it explicitly
|
|
|
|
nsCOMPtr<nsIWebBrowserSetup> webBrowserSetup =
|
|
|
|
do_QueryInterface(baseWindow);
|
|
|
|
if (webBrowserSetup) {
|
|
|
|
webBrowserSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_DNS_PREFETCH,
|
|
|
|
true);
|
|
|
|
} else {
|
|
|
|
NS_WARNING("baseWindow doesn't QI to nsIWebBrowserSetup, skipping "
|
|
|
|
"DNS prefetching enable step.");
|
2012-08-09 00:37:57 +04:00
|
|
|
}
|
|
|
|
|
2014-03-25 06:28:46 +04:00
|
|
|
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
|
2012-09-29 06:18:18 +04:00
|
|
|
MOZ_ASSERT(docShell);
|
2013-05-07 08:10:31 +04:00
|
|
|
|
|
|
|
docShell->SetAffectPrivateSessionLifetime(
|
|
|
|
mChromeFlags & nsIWebBrowserChrome::CHROME_PRIVATE_LIFETIME);
|
2014-03-25 06:28:46 +04:00
|
|
|
nsCOMPtr<nsILoadContext> loadContext = do_GetInterface(WebNavigation());
|
2013-05-07 08:10:31 +04:00
|
|
|
MOZ_ASSERT(loadContext);
|
2016-07-21 14:26:57 +03:00
|
|
|
loadContext->SetPrivateBrowsing(OriginAttributesRef().mPrivateBrowsingId > 0);
|
2014-02-11 21:00:54 +04:00
|
|
|
loadContext->SetRemoteTabs(
|
|
|
|
mChromeFlags & nsIWebBrowserChrome::CHROME_REMOTE_WINDOW);
|
2013-05-07 08:10:31 +04:00
|
|
|
|
2014-04-09 09:15:00 +04:00
|
|
|
// Few lines before, baseWindow->Create() will end up creating a new
|
|
|
|
// window root in nsGlobalWindow::SetDocShell.
|
|
|
|
// Then this chrome event handler, will be inherited to inner windows.
|
|
|
|
// We want to also set it to the docshell so that inner windows
|
|
|
|
// and any code that has access to the docshell
|
|
|
|
// can all listen to the same chrome event handler.
|
|
|
|
// XXX: ideally, we would set a chrome event handler earlier,
|
|
|
|
// and all windows, even the root one, will use the docshell one.
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(WebNavigation());
|
2014-04-09 09:15:00 +04:00
|
|
|
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
|
|
|
nsCOMPtr<EventTarget> chromeHandler =
|
|
|
|
do_QueryInterface(window->GetChromeEventHandler());
|
|
|
|
docShell->SetChromeEventHandler(chromeHandler);
|
|
|
|
|
2016-07-29 05:28:50 +03:00
|
|
|
if (window->GetCurrentInnerWindow()) {
|
|
|
|
window->SetKeyboardIndicators(ShowAccelerators(), ShowFocusRings());
|
|
|
|
} else {
|
|
|
|
// Skip ShouldShowFocusRing check if no inner window is available
|
|
|
|
window->SetInitialKeyboardIndicators(ShowAccelerators(), ShowFocusRings());
|
|
|
|
}
|
2016-06-09 14:59:31 +03:00
|
|
|
|
2016-05-20 06:36:27 +03:00
|
|
|
// Set prerender flag if necessary.
|
|
|
|
if (mIsPrerendered) {
|
|
|
|
docShell->SetIsPrerendered();
|
|
|
|
}
|
|
|
|
|
2016-03-12 02:10:13 +03:00
|
|
|
nsContentUtils::SetScrollbarsVisibility(window->GetDocShell(),
|
|
|
|
!!(mChromeFlags & nsIWebBrowserChrome::CHROME_SCROLLBARS));
|
|
|
|
|
2015-09-11 19:52:43 +03:00
|
|
|
nsWeakPtr weakPtrThis = do_GetWeakReference(static_cast<nsITabChild*>(this)); // for capture by the lambda
|
|
|
|
ContentReceivedInputBlockCallback callback(
|
|
|
|
[weakPtrThis](const ScrollableLayerGuid& aGuid,
|
|
|
|
uint64_t aInputBlockId,
|
|
|
|
bool aPreventDefault)
|
|
|
|
{
|
|
|
|
if (nsCOMPtr<nsITabChild> tabChild = do_QueryReferent(weakPtrThis)) {
|
2016-01-08 22:17:39 +03:00
|
|
|
static_cast<TabChild*>(tabChild.get())->ContentReceivedInputBlock(aGuid, aInputBlockId, aPreventDefault);
|
2015-09-11 19:52:43 +03:00
|
|
|
}
|
|
|
|
});
|
|
|
|
mAPZEventState = new APZEventState(mPuppetWidget, Move(callback));
|
2015-02-09 22:05:18 +03:00
|
|
|
|
2016-09-21 02:02:37 +03:00
|
|
|
mIPCOpen = true;
|
|
|
|
|
2016-10-14 10:31:02 +03:00
|
|
|
if (GroupedSHistory::GroupedHistoryEnabled()) {
|
|
|
|
// Set session history listener.
|
2016-12-15 08:28:40 +03:00
|
|
|
nsCOMPtr<nsISHistory> shistory = GetRelatedSHistory();
|
2016-10-14 10:31:02 +03:00
|
|
|
if (!shistory) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
mHistoryListener = new TabChildSHistoryListener(this);
|
|
|
|
nsCOMPtr<nsISHistoryListener> listener(do_QueryObject(mHistoryListener));
|
|
|
|
shistory->AddSHistoryListener(listener);
|
|
|
|
nsCOMPtr<nsIPartialSHistoryListener> partialListener(do_QueryObject(mHistoryListener));
|
|
|
|
shistory->SetPartialSHistoryListener(partialListener);
|
|
|
|
}
|
|
|
|
|
2009-11-05 21:14:22 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-29 19:26:18 +04:00
|
|
|
void
|
2016-09-05 15:43:51 +03:00
|
|
|
TabChild::NotifyTabContextUpdated(bool aIsPreallocated)
|
2012-08-29 19:26:18 +04:00
|
|
|
{
|
2016-02-16 10:04:14 +03:00
|
|
|
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
|
|
|
|
MOZ_ASSERT(docShell);
|
2016-01-20 02:28:00 +03:00
|
|
|
|
2016-02-16 10:04:14 +03:00
|
|
|
if (!docShell) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-05-16 06:07:09 +03:00
|
|
|
UpdateFrameType();
|
2016-09-05 15:43:51 +03:00
|
|
|
|
|
|
|
if (aIsPreallocated) {
|
|
|
|
nsDocShell::Cast(docShell)->SetOriginAttributes(OriginAttributesRef());
|
|
|
|
}
|
2016-06-21 21:31:00 +03:00
|
|
|
|
|
|
|
// Set SANDBOXED_AUXILIARY_NAVIGATION flag if this is a receiver page.
|
|
|
|
if (!PresentationURL().IsEmpty()) {
|
|
|
|
docShell->SetSandboxFlags(SANDBOXED_AUXILIARY_NAVIGATION);
|
|
|
|
}
|
2012-08-29 19:26:18 +04:00
|
|
|
}
|
|
|
|
|
2016-05-16 06:07:09 +03:00
|
|
|
void
|
|
|
|
TabChild::UpdateFrameType()
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
|
|
|
|
MOZ_ASSERT(docShell);
|
|
|
|
|
|
|
|
// TODO: Bug 1252794 - remove frameType from nsIDocShell.idl
|
|
|
|
docShell->SetFrameType(IsMozBrowserElement() ? nsIDocShell::FRAME_TYPE_BROWSER :
|
2016-10-15 04:46:26 +03:00
|
|
|
nsIDocShell::FRAME_TYPE_REGULAR);
|
2016-05-16 06:07:09 +03:00
|
|
|
}
|
|
|
|
|
2014-05-07 04:11:20 +04:00
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TabChild)
|
2010-05-17 15:25:22 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome2)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChromeFocus)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIWindowProvider)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsITabChild)
|
2012-09-29 06:18:18 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIObserver)
|
2014-03-28 12:40:13 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
2014-01-23 00:27:23 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsITooltipListener)
|
2014-05-07 04:11:20 +04:00
|
|
|
NS_INTERFACE_MAP_END_INHERITING(TabChildBase)
|
2010-05-17 15:25:22 +04:00
|
|
|
|
2014-05-07 04:11:20 +04:00
|
|
|
NS_IMPL_ADDREF_INHERITED(TabChild, TabChildBase);
|
|
|
|
NS_IMPL_RELEASE_INHERITED(TabChild, TabChildBase);
|
2009-11-05 21:14:22 +03:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2014-01-04 19:02:17 +04:00
|
|
|
TabChild::SetStatus(uint32_t aStatusType, const char16_t* aStatus)
|
2009-11-05 21:14:22 +03:00
|
|
|
{
|
2013-07-25 23:45:31 +04:00
|
|
|
return SetStatusWithContext(aStatusType,
|
|
|
|
aStatus ? static_cast<const nsString &>(nsDependentString(aStatus))
|
|
|
|
: EmptyString(),
|
|
|
|
nullptr);
|
2009-11-05 21:14:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChild::GetWebBrowser(nsIWebBrowser** aWebBrowser)
|
|
|
|
{
|
2016-01-08 23:40:26 +03:00
|
|
|
NS_WARNING("TabChild::GetWebBrowser not supported in TabChild");
|
2010-11-03 16:00:49 +03:00
|
|
|
|
2009-11-05 21:14:22 +03:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChild::SetWebBrowser(nsIWebBrowser* aWebBrowser)
|
|
|
|
{
|
2016-01-08 23:40:26 +03:00
|
|
|
NS_WARNING("TabChild::SetWebBrowser not supported in TabChild");
|
2010-11-03 16:00:49 +03:00
|
|
|
|
2009-11-05 21:14:22 +03:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
TabChild::GetChromeFlags(uint32_t* aChromeFlags)
|
2009-11-05 21:14:22 +03:00
|
|
|
{
|
2010-07-19 22:33:33 +04:00
|
|
|
*aChromeFlags = mChromeFlags;
|
|
|
|
return NS_OK;
|
2009-11-05 21:14:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
TabChild::SetChromeFlags(uint32_t aChromeFlags)
|
2009-11-05 21:14:22 +03:00
|
|
|
{
|
2016-01-08 23:40:26 +03:00
|
|
|
NS_WARNING("trying to SetChromeFlags from content process?");
|
2010-11-03 16:00:49 +03:00
|
|
|
|
2009-11-05 21:14:22 +03:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChild::DestroyBrowserWindow()
|
|
|
|
{
|
2016-01-08 23:40:26 +03:00
|
|
|
NS_WARNING("TabChild::DestroyBrowserWindow not supported in TabChild");
|
2010-11-03 16:00:49 +03:00
|
|
|
|
2009-11-05 21:14:22 +03:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2016-05-11 12:44:57 +03:00
|
|
|
TabChild::RemoteSizeShellTo(int32_t aWidth, int32_t aHeight,
|
|
|
|
int32_t aShellItemWidth, int32_t aShellItemHeight)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDocShell> ourDocShell = do_GetInterface(WebNavigation());
|
|
|
|
nsCOMPtr<nsIBaseWindow> docShellAsWin(do_QueryInterface(ourDocShell));
|
|
|
|
int32_t width, height;
|
|
|
|
docShellAsWin->GetSize(&width, &height);
|
|
|
|
|
|
|
|
uint32_t flags = 0;
|
|
|
|
if (width == aWidth) {
|
|
|
|
flags |= nsIEmbeddingSiteWindow::DIM_FLAGS_IGNORE_CX;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (height == aHeight) {
|
|
|
|
flags |= nsIEmbeddingSiteWindow::DIM_FLAGS_IGNORE_CY;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool sent = SendSizeShellTo(flags, aWidth, aHeight, aShellItemWidth, aShellItemHeight);
|
|
|
|
|
|
|
|
return sent ? NS_OK : NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2015-11-11 01:35:12 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChild::RemoteDropLinks(uint32_t aLinksCount, nsIDroppedLinkItem** aLinks)
|
|
|
|
{
|
|
|
|
nsTArray<nsString> linksArray;
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
for (uint32_t i = 0; i < aLinksCount; i++) {
|
|
|
|
nsString tmp;
|
|
|
|
rv = aLinks[i]->GetUrl(tmp);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
linksArray.AppendElement(tmp);
|
|
|
|
|
|
|
|
rv = aLinks[i]->GetName(tmp);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
linksArray.AppendElement(tmp);
|
|
|
|
|
|
|
|
rv = aLinks[i]->GetType(tmp);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
linksArray.AppendElement(tmp);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool sent = SendDropLinks(linksArray);
|
|
|
|
|
|
|
|
return sent ? NS_OK : NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2016-05-11 12:44:57 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChild::SizeBrowserTo(int32_t aWidth, int32_t aHeight)
|
2009-11-05 21:14:22 +03:00
|
|
|
{
|
2016-01-08 23:40:26 +03:00
|
|
|
NS_WARNING("TabChild::SizeBrowserTo not supported in TabChild");
|
2010-11-03 16:00:49 +03:00
|
|
|
|
2009-11-05 21:14:22 +03:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChild::ShowAsModal()
|
|
|
|
{
|
2016-01-08 23:40:26 +03:00
|
|
|
NS_WARNING("TabChild::ShowAsModal not supported in TabChild");
|
2010-11-03 16:00:49 +03:00
|
|
|
|
2009-11-05 21:14:22 +03:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-09-29 10:19:26 +04:00
|
|
|
TabChild::IsWindowModal(bool* aRetVal)
|
2009-11-05 21:14:22 +03:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
*aRetVal = false;
|
2009-11-05 21:14:22 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChild::ExitModalEventLoop(nsresult aStatus)
|
|
|
|
{
|
2016-01-08 23:40:26 +03:00
|
|
|
NS_WARNING("TabChild::ExitModalEventLoop not supported in TabChild");
|
2010-11-03 16:00:49 +03:00
|
|
|
|
2009-11-05 21:14:22 +03:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2009-11-05 21:14:22 +03:00
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
TabChild::SetStatusWithContext(uint32_t aStatusType,
|
2013-07-25 23:45:31 +04:00
|
|
|
const nsAString& aStatusText,
|
|
|
|
nsISupports* aStatusContext)
|
2009-11-05 21:14:22 +03:00
|
|
|
{
|
2013-07-25 23:45:31 +04:00
|
|
|
// We can only send the status after the ipc machinery is set up,
|
|
|
|
// mRemoteFrame is a good indicator.
|
|
|
|
if (mRemoteFrame)
|
|
|
|
SendSetStatus(aStatusType, nsString(aStatusText));
|
2011-07-07 19:11:58 +04:00
|
|
|
return NS_OK;
|
2009-11-05 21:14:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
TabChild::SetDimensions(uint32_t aFlags, int32_t aX, int32_t aY,
|
2016-05-11 12:44:57 +03:00
|
|
|
int32_t aCx, int32_t aCy)
|
2009-11-05 21:14:22 +03:00
|
|
|
{
|
2016-05-11 12:44:57 +03:00
|
|
|
// The parent is in charge of the dimension changes. If JS code wants to
|
|
|
|
// change the dimensions (moveTo, screenX, etc.) we send a message to the
|
|
|
|
// parent about the new requested dimension, the parent does the resize/move
|
|
|
|
// then send a message to the child to update itself. For APIs like screenX
|
|
|
|
// this function is called with the current value for the non-changed values.
|
|
|
|
// In a series of calls like window.screenX = 10; window.screenY = 10; for
|
|
|
|
// the second call, since screenX is not yet updated we might accidentally
|
|
|
|
// reset back screenX to it's old value. To avoid this if a parameter did not
|
|
|
|
// change we want the parent to ignore its value.
|
|
|
|
int32_t x, y, cx, cy;
|
|
|
|
GetDimensions(aFlags, &x, &y, &cx, &cy);
|
|
|
|
|
|
|
|
if (x == aX) {
|
|
|
|
aFlags |= nsIEmbeddingSiteWindow::DIM_FLAGS_IGNORE_X;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (y == aY) {
|
|
|
|
aFlags |= nsIEmbeddingSiteWindow::DIM_FLAGS_IGNORE_Y;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cx == aCx) {
|
|
|
|
aFlags |= nsIEmbeddingSiteWindow::DIM_FLAGS_IGNORE_CX;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cy == aCy) {
|
|
|
|
aFlags |= nsIEmbeddingSiteWindow::DIM_FLAGS_IGNORE_CY;
|
|
|
|
}
|
|
|
|
|
|
|
|
Unused << SendSetDimensions(aFlags, aX, aY, aCx, aCy);
|
2010-11-03 16:00:49 +03:00
|
|
|
|
2015-01-13 03:41:53 +03:00
|
|
|
return NS_OK;
|
2009-11-05 21:14:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
TabChild::GetDimensions(uint32_t aFlags, int32_t* aX,
|
|
|
|
int32_t* aY, int32_t* aCx, int32_t* aCy)
|
2009-11-05 21:14:22 +03:00
|
|
|
{
|
2015-06-08 08:39:28 +03:00
|
|
|
ScreenIntRect rect = GetOuterRect();
|
2011-07-16 01:46:56 +04:00
|
|
|
if (aX) {
|
2015-06-08 08:39:28 +03:00
|
|
|
*aX = rect.x;
|
2011-07-16 01:46:56 +04:00
|
|
|
}
|
|
|
|
if (aY) {
|
2015-06-08 08:39:28 +03:00
|
|
|
*aY = rect.y;
|
2011-07-16 01:46:56 +04:00
|
|
|
}
|
|
|
|
if (aCx) {
|
2015-06-08 08:39:28 +03:00
|
|
|
*aCx = rect.width;
|
2011-07-16 01:46:56 +04:00
|
|
|
}
|
|
|
|
if (aCy) {
|
2015-06-08 08:39:28 +03:00
|
|
|
*aCy = rect.height;
|
2011-07-16 01:46:56 +04:00
|
|
|
}
|
2010-11-03 16:00:49 +03:00
|
|
|
|
2011-07-16 01:46:56 +04:00
|
|
|
return NS_OK;
|
2009-11-05 21:14:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChild::SetFocus()
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-09-29 10:19:26 +04:00
|
|
|
TabChild::GetVisibility(bool* aVisibility)
|
2009-11-05 21:14:22 +03:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
*aVisibility = true;
|
2009-11-05 21:14:22 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-09-29 10:19:26 +04:00
|
|
|
TabChild::SetVisibility(bool aVisibility)
|
2009-11-05 21:14:22 +03:00
|
|
|
{
|
2011-06-23 00:43:05 +04:00
|
|
|
// should the platform support this? Bug 666365
|
|
|
|
return NS_OK;
|
2009-11-05 21:14:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2014-01-04 19:02:17 +04:00
|
|
|
TabChild::GetTitle(char16_t** aTitle)
|
2009-11-05 21:14:22 +03:00
|
|
|
{
|
2016-01-08 23:40:26 +03:00
|
|
|
NS_WARNING("TabChild::GetTitle not supported in TabChild");
|
2010-11-03 16:00:49 +03:00
|
|
|
|
2009-11-05 21:14:22 +03:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2014-01-04 19:02:17 +04:00
|
|
|
TabChild::SetTitle(const char16_t* aTitle)
|
2009-11-05 21:14:22 +03:00
|
|
|
{
|
2013-08-06 20:35:39 +04:00
|
|
|
// JavaScript sends the "DOMTitleChanged" event to the parent
|
|
|
|
// via the message manager.
|
2011-01-04 19:40:54 +03:00
|
|
|
return NS_OK;
|
2009-11-05 21:14:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChild::GetSiteWindow(void** aSiteWindow)
|
|
|
|
{
|
2016-01-08 23:40:26 +03:00
|
|
|
NS_WARNING("TabChild::GetSiteWindow not supported in TabChild");
|
2010-11-03 16:00:49 +03:00
|
|
|
|
2009-11-05 21:14:22 +03:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChild::Blur()
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2015-07-13 13:07:49 +03:00
|
|
|
TabChild::FocusNextElement(bool aForDocumentNavigation)
|
2009-11-05 21:14:22 +03:00
|
|
|
{
|
2015-07-13 13:07:49 +03:00
|
|
|
SendMoveFocus(true, aForDocumentNavigation);
|
2009-11-05 21:14:22 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2015-07-13 13:07:49 +03:00
|
|
|
TabChild::FocusPrevElement(bool aForDocumentNavigation)
|
2009-11-05 21:14:22 +03:00
|
|
|
{
|
2015-07-13 13:07:49 +03:00
|
|
|
SendMoveFocus(false, aForDocumentNavigation);
|
2009-11-05 21:14:22 +03:00
|
|
|
return NS_OK;
|
2009-10-28 23:41:46 +03:00
|
|
|
}
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2010-01-01 04:34:06 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChild::GetInterface(const nsIID & aIID, void **aSink)
|
|
|
|
{
|
2014-09-03 01:43:08 +04:00
|
|
|
if (aIID.Equals(NS_GET_IID(nsIWebBrowserChrome3))) {
|
|
|
|
NS_IF_ADDREF(((nsISupports *) (*aSink = mWebBrowserChrome)));
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2010-01-01 04:34:06 +03:00
|
|
|
// XXXbz should we restrict the set of interfaces we hand out here?
|
|
|
|
// See bug 537429
|
|
|
|
return QueryInterface(aIID, aSink);
|
|
|
|
}
|
|
|
|
|
2010-01-01 04:35:55 +03:00
|
|
|
NS_IMETHODIMP
|
2016-01-30 20:05:36 +03:00
|
|
|
TabChild::ProvideWindow(mozIDOMWindowProxy* aParent,
|
|
|
|
uint32_t aChromeFlags,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aCalledFromJS,
|
|
|
|
bool aPositionSpecified, bool aSizeSpecified,
|
2010-01-01 04:35:55 +03:00
|
|
|
nsIURI* aURI, const nsAString& aName,
|
2016-10-27 19:37:44 +03:00
|
|
|
const nsACString& aFeatures, bool aForceNoOpener,
|
|
|
|
bool* aWindowIsNew, mozIDOMWindowProxy** aReturn)
|
2010-01-01 04:35:55 +03:00
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
*aReturn = nullptr;
|
2010-01-01 04:35:55 +03:00
|
|
|
|
2016-10-15 04:46:26 +03:00
|
|
|
// If aParent is inside an <iframe mozbrowser> and this isn't a request to
|
|
|
|
// open a modal-type window, we're going to create a new <iframe mozbrowser>
|
|
|
|
// and return its window here.
|
2012-06-13 02:01:25 +04:00
|
|
|
nsCOMPtr<nsIDocShell> docshell = do_GetInterface(aParent);
|
2016-10-15 04:46:26 +03:00
|
|
|
bool iframeMoz = (docshell && docshell->GetIsInMozBrowser() &&
|
2015-01-16 21:07:50 +03:00
|
|
|
!(aChromeFlags & (nsIWebBrowserChrome::CHROME_MODAL |
|
|
|
|
nsIWebBrowserChrome::CHROME_OPENAS_DIALOG |
|
|
|
|
nsIWebBrowserChrome::CHROME_OPENAS_CHROME)));
|
|
|
|
|
|
|
|
if (!iframeMoz) {
|
|
|
|
int32_t openLocation =
|
2016-01-30 20:05:36 +03:00
|
|
|
nsWindowWatcher::GetWindowOpenLocation(nsPIDOMWindowOuter::From(aParent),
|
|
|
|
aChromeFlags, aCalledFromJS,
|
2015-01-16 21:07:50 +03:00
|
|
|
aPositionSpecified, aSizeSpecified);
|
|
|
|
|
|
|
|
// If it turns out we're opening in the current browser, just hand over the
|
|
|
|
// current browser's docshell.
|
|
|
|
if (openLocation == nsIBrowserDOMWindow::OPEN_CURRENTWINDOW) {
|
|
|
|
nsCOMPtr<nsIWebBrowser> browser = do_GetInterface(WebNavigation());
|
|
|
|
*aWindowIsNew = false;
|
|
|
|
return browser->GetContentDOMWindow(aReturn);
|
|
|
|
}
|
2010-01-01 04:35:55 +03:00
|
|
|
}
|
|
|
|
|
2015-01-16 21:07:50 +03:00
|
|
|
// Note that ProvideWindowCommon may return NS_ERROR_ABORT if the
|
|
|
|
// open window call was canceled. It's important that we pass this error
|
|
|
|
// code back to our caller.
|
2015-10-30 02:30:57 +03:00
|
|
|
ContentChild* cc = ContentChild::GetSingleton();
|
|
|
|
return cc->ProvideWindowCommon(this,
|
|
|
|
aParent,
|
|
|
|
iframeMoz,
|
|
|
|
aChromeFlags,
|
|
|
|
aCalledFromJS,
|
|
|
|
aPositionSpecified,
|
|
|
|
aSizeSpecified,
|
|
|
|
aURI,
|
|
|
|
aName,
|
|
|
|
aFeatures,
|
2016-10-27 19:37:44 +03:00
|
|
|
aForceNoOpener,
|
2015-10-30 02:30:57 +03:00
|
|
|
aWindowIsNew,
|
|
|
|
aReturn);
|
2012-06-13 02:01:25 +04:00
|
|
|
}
|
|
|
|
|
2010-08-21 03:24:40 +04:00
|
|
|
void
|
|
|
|
TabChild::DestroyWindow()
|
2009-10-28 23:41:46 +03:00
|
|
|
{
|
2014-03-25 06:28:46 +04:00
|
|
|
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(WebNavigation());
|
2009-10-28 23:41:46 +03:00
|
|
|
if (baseWindow)
|
|
|
|
baseWindow->Destroy();
|
2009-07-07 20:26:49 +04:00
|
|
|
|
2015-06-17 11:44:50 +03:00
|
|
|
// NB: the order of mPuppetWidget->Destroy() and mRemoteFrame->Destroy()
|
2010-08-21 03:24:41 +04:00
|
|
|
// is important: we want to kill off remote layers before their
|
|
|
|
// frames
|
2015-06-17 11:44:50 +03:00
|
|
|
if (mPuppetWidget) {
|
|
|
|
mPuppetWidget->Destroy();
|
2010-03-01 22:05:48 +03:00
|
|
|
}
|
2009-07-07 20:26:49 +04:00
|
|
|
|
2010-08-21 03:24:41 +04:00
|
|
|
if (mRemoteFrame) {
|
|
|
|
mRemoteFrame->Destroy();
|
2012-07-30 18:20:58 +04:00
|
|
|
mRemoteFrame = nullptr;
|
2010-07-26 22:49:09 +04:00
|
|
|
}
|
2014-03-07 07:24:32 +04:00
|
|
|
|
|
|
|
|
|
|
|
if (mLayersId != 0) {
|
|
|
|
MOZ_ASSERT(sTabChildren);
|
|
|
|
sTabChildren->Remove(mLayersId);
|
|
|
|
if (!sTabChildren->Count()) {
|
|
|
|
delete sTabChildren;
|
|
|
|
sTabChildren = nullptr;
|
|
|
|
}
|
|
|
|
mLayersId = 0;
|
|
|
|
}
|
2009-08-12 20:18:08 +04:00
|
|
|
}
|
2009-07-14 11:33:50 +04:00
|
|
|
|
2010-07-22 03:23:03 +04:00
|
|
|
void
|
|
|
|
TabChild::ActorDestroy(ActorDestroyReason why)
|
|
|
|
{
|
2015-01-07 08:42:00 +03:00
|
|
|
mIPCOpen = false;
|
|
|
|
|
2014-09-26 00:01:33 +04:00
|
|
|
DestroyWindow();
|
|
|
|
|
2011-08-09 23:38:26 +04:00
|
|
|
if (mTabChildGlobal) {
|
|
|
|
// The messageManager relays messages via the TabChild which
|
|
|
|
// no longer exists.
|
|
|
|
static_cast<nsFrameMessageManager*>
|
|
|
|
(mTabChildGlobal->mMessageManager.get())->Disconnect();
|
2012-07-30 18:20:58 +04:00
|
|
|
mTabChildGlobal->mMessageManager = nullptr;
|
2011-08-09 23:38:26 +04:00
|
|
|
}
|
2014-08-22 03:37:00 +04:00
|
|
|
|
2016-03-22 21:08:38 +03:00
|
|
|
CompositorBridgeChild* compositorChild = static_cast<CompositorBridgeChild*>(CompositorBridgeChild::Get());
|
2014-09-04 16:20:45 +04:00
|
|
|
compositorChild->CancelNotifyAfterRemotePaint(this);
|
|
|
|
|
2014-10-29 21:11:00 +03:00
|
|
|
if (GetTabId() != 0) {
|
|
|
|
NestedTabChildMap().erase(GetTabId());
|
2014-06-11 09:44:36 +04:00
|
|
|
}
|
2010-07-22 03:23:03 +04:00
|
|
|
}
|
|
|
|
|
2009-08-12 20:18:08 +04:00
|
|
|
TabChild::~TabChild()
|
|
|
|
{
|
2016-10-14 10:31:02 +03:00
|
|
|
DestroyWindow();
|
2012-08-29 19:26:18 +04:00
|
|
|
|
2016-10-14 10:31:02 +03:00
|
|
|
nsCOMPtr<nsIWebBrowser> webBrowser = do_QueryInterface(WebNavigation());
|
|
|
|
if (webBrowser) {
|
|
|
|
webBrowser->SetContainerWindow(nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mHistoryListener) {
|
|
|
|
mHistoryListener->ClearTabChild();
|
|
|
|
}
|
2009-07-01 00:39:22 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-02-11 14:53:00 +03:00
|
|
|
TabChild::RecvLoadURL(const nsCString& aURI,
|
2015-10-30 16:24:57 +03:00
|
|
|
const ShowInfo& aInfo)
|
2009-07-01 00:39:22 +04:00
|
|
|
{
|
2016-03-12 01:31:55 +03:00
|
|
|
if (!mDidLoadURLInit) {
|
|
|
|
mDidLoadURLInit = true;
|
2015-04-07 05:56:10 +03:00
|
|
|
if (!InitTabChildGlobal()) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_FAIL_NO_REASON(this);
|
2015-04-07 05:56:10 +03:00
|
|
|
}
|
|
|
|
|
2015-10-30 16:24:57 +03:00
|
|
|
ApplyShowInfo(aInfo);
|
2016-03-12 01:31:55 +03:00
|
|
|
}
|
2015-04-24 01:44:24 +03:00
|
|
|
|
2015-12-04 02:04:28 +03:00
|
|
|
nsresult rv =
|
2016-03-12 01:31:55 +03:00
|
|
|
WebNavigation()->LoadURI(NS_ConvertUTF8toUTF16(aURI).get(),
|
|
|
|
nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
|
2016-07-28 10:20:41 +03:00
|
|
|
nsIWebNavigation::LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL,
|
2016-03-12 01:31:55 +03:00
|
|
|
nullptr, nullptr, nullptr);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
NS_WARNING("WebNavigation()->LoadURI failed. Eating exception, what else can I do?");
|
2015-12-04 02:04:28 +03:00
|
|
|
}
|
|
|
|
|
2016-03-12 01:31:55 +03:00
|
|
|
#ifdef MOZ_CRASHREPORTER
|
|
|
|
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("URL"), aURI);
|
|
|
|
#endif
|
2015-12-04 02:04:28 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-12-04 02:04:28 +03:00
|
|
|
}
|
|
|
|
|
2012-06-13 02:01:25 +04:00
|
|
|
void
|
2015-02-26 16:47:01 +03:00
|
|
|
TabChild::DoFakeShow(const TextureFactoryIdentifier& aTextureFactoryIdentifier,
|
2014-11-16 21:23:22 +03:00
|
|
|
const uint64_t& aLayersId,
|
2015-10-30 16:24:57 +03:00
|
|
|
PRenderFrameChild* aRenderFrame, const ShowInfo& aShowInfo)
|
2012-06-13 02:01:25 +04:00
|
|
|
{
|
2015-10-30 16:24:57 +03:00
|
|
|
RecvShow(ScreenIntSize(0, 0), aShowInfo, aTextureFactoryIdentifier,
|
2016-02-23 19:10:00 +03:00
|
|
|
aLayersId, aRenderFrame, mParentIsActive, nsSizeMode_Normal);
|
2012-06-13 02:01:25 +04:00
|
|
|
mDidFakeShow = true;
|
|
|
|
}
|
|
|
|
|
2014-11-24 22:05:35 +03:00
|
|
|
void
|
|
|
|
TabChild::ApplyShowInfo(const ShowInfo& aInfo)
|
|
|
|
{
|
2015-10-30 16:24:57 +03:00
|
|
|
if (mDidSetRealShowInfo) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!aInfo.fakeShowInfo()) {
|
|
|
|
// Once we've got one ShowInfo from parent, no need to update the values
|
|
|
|
// anymore.
|
|
|
|
mDidSetRealShowInfo = true;
|
|
|
|
}
|
|
|
|
|
2014-11-24 22:05:35 +03:00
|
|
|
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
|
|
|
|
if (docShell) {
|
|
|
|
nsCOMPtr<nsIDocShellTreeItem> item = do_GetInterface(docShell);
|
2016-10-15 04:46:26 +03:00
|
|
|
if (IsMozBrowser()) {
|
2015-01-16 21:07:50 +03:00
|
|
|
// B2G allows window.name to be set by changing the name attribute on the
|
|
|
|
// <iframe mozbrowser> element. window.open calls cause this attribute to
|
|
|
|
// be set to the correct value. A normal <xul:browser> element has no such
|
|
|
|
// attribute. The data we get here comes from reading the attribute, so we
|
|
|
|
// shouldn't trust it for <xul:browser> elements.
|
|
|
|
item->SetName(aInfo.name());
|
|
|
|
}
|
2014-11-24 22:05:35 +03:00
|
|
|
docShell->SetFullscreenAllowed(aInfo.fullscreenAllowed());
|
|
|
|
if (aInfo.isPrivate()) {
|
2015-10-30 16:24:57 +03:00
|
|
|
nsCOMPtr<nsILoadContext> context = do_GetInterface(docShell);
|
|
|
|
// No need to re-set private browsing mode.
|
|
|
|
if (!context->UsePrivateBrowsing()) {
|
2016-08-12 08:19:29 +03:00
|
|
|
if (docShell->GetHasLoadedNonBlankURI()) {
|
2015-10-30 16:24:57 +03:00
|
|
|
nsContentUtils::ReportToConsoleNonLocalized(
|
|
|
|
NS_LITERAL_STRING("We should not switch to Private Browsing after loading a document."),
|
|
|
|
nsIScriptError::warningFlag,
|
|
|
|
NS_LITERAL_CSTRING("mozprivatebrowsing"),
|
|
|
|
nullptr);
|
|
|
|
} else {
|
2016-06-06 08:42:00 +03:00
|
|
|
DocShellOriginAttributes attrs(nsDocShell::Cast(docShell)->GetOriginAttributes());
|
|
|
|
attrs.SyncAttributesWithPrivateBrowsing(true);
|
|
|
|
nsDocShell::Cast(docShell)->SetOriginAttributes(attrs);
|
2015-10-30 16:24:57 +03:00
|
|
|
}
|
2014-11-24 22:05:35 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-12-12 20:50:46 +03:00
|
|
|
mDPI = aInfo.dpi();
|
2016-09-27 09:37:07 +03:00
|
|
|
mRounding = aInfo.widgetRounding();
|
2014-12-12 20:50:46 +03:00
|
|
|
mDefaultScale = aInfo.defaultScale();
|
2016-05-16 05:56:09 +03:00
|
|
|
mIsTransparent = aInfo.isTransparent();
|
2014-11-24 22:05:35 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-03-05 12:13:05 +03:00
|
|
|
TabChild::RecvShow(const ScreenIntSize& aSize,
|
2014-11-24 22:05:35 +03:00
|
|
|
const ShowInfo& aInfo,
|
2014-11-16 21:23:22 +03:00
|
|
|
const TextureFactoryIdentifier& aTextureFactoryIdentifier,
|
|
|
|
const uint64_t& aLayersId,
|
2015-02-06 19:26:29 +03:00
|
|
|
PRenderFrameChild* aRenderFrame,
|
2016-02-23 19:10:00 +03:00
|
|
|
const bool& aParentIsActive,
|
|
|
|
const nsSizeMode& aSizeMode)
|
2009-07-01 00:39:22 +04:00
|
|
|
{
|
2014-11-16 21:23:22 +03:00
|
|
|
MOZ_ASSERT((!mDidFakeShow && aRenderFrame) || (mDidFakeShow && !aRenderFrame));
|
2012-08-29 19:26:18 +04:00
|
|
|
|
2016-02-23 19:10:00 +03:00
|
|
|
mPuppetWidget->SetSizeMode(aSizeMode);
|
2012-06-13 02:01:25 +04:00
|
|
|
if (mDidFakeShow) {
|
2014-11-24 22:05:35 +03:00
|
|
|
ApplyShowInfo(aInfo);
|
2015-02-06 19:26:29 +03:00
|
|
|
RecvParentActivated(aParentIsActive);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2012-06-13 02:01:25 +04:00
|
|
|
}
|
|
|
|
|
2014-03-25 06:28:46 +04:00
|
|
|
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(WebNavigation());
|
2010-08-21 03:24:40 +04:00
|
|
|
if (!baseWindow) {
|
2014-03-25 06:28:46 +04:00
|
|
|
NS_ERROR("WebNavigation() doesn't QI to nsIBaseWindow");
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_FAIL_NO_REASON(this);
|
2010-08-21 03:24:40 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 01:58:22 +03:00
|
|
|
InitRenderingState(aTextureFactoryIdentifier, aLayersId, aRenderFrame);
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
baseWindow->SetVisibility(true);
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2014-11-24 22:05:35 +03:00
|
|
|
bool res = InitTabChildGlobal();
|
|
|
|
ApplyShowInfo(aInfo);
|
2015-02-06 19:26:29 +03:00
|
|
|
RecvParentActivated(aParentIsActive);
|
2015-06-04 23:51:10 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
if (!res) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
2009-07-01 00:39:22 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-06-08 08:39:28 +03:00
|
|
|
TabChild::RecvUpdateDimensions(const CSSRect& rect, const CSSSize& size,
|
2015-08-19 00:55:09 +03:00
|
|
|
const ScreenOrientationInternal& orientation,
|
2016-03-08 22:14:43 +03:00
|
|
|
const LayoutDeviceIntPoint& clientOffset,
|
2015-06-08 08:39:28 +03:00
|
|
|
const LayoutDeviceIntPoint& chromeDisp)
|
2009-07-01 00:39:22 +04:00
|
|
|
{
|
2011-08-09 23:38:26 +04:00
|
|
|
if (!mRemoteFrame) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2011-08-09 23:38:26 +04:00
|
|
|
}
|
|
|
|
|
2015-06-08 08:39:28 +03:00
|
|
|
mUnscaledOuterRect = rect;
|
2016-03-08 22:14:43 +03:00
|
|
|
mClientOffset = clientOffset;
|
2014-12-11 17:44:07 +03:00
|
|
|
mChromeDisp = chromeDisp;
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2015-06-08 08:39:28 +03:00
|
|
|
mOrientation = orientation;
|
|
|
|
SetUnscaledInnerSize(size);
|
2015-07-21 17:51:55 +03:00
|
|
|
if (!mHasValidInnerSize && size.width != 0 && size.height != 0) {
|
2014-04-25 19:40:23 +04:00
|
|
|
mHasValidInnerSize = true;
|
|
|
|
}
|
2014-02-22 03:12:43 +04:00
|
|
|
|
2015-07-21 17:51:55 +03:00
|
|
|
ScreenIntSize screenSize = GetInnerSize();
|
2015-06-08 08:39:28 +03:00
|
|
|
ScreenIntRect screenRect = GetOuterRect();
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2015-07-21 17:51:55 +03:00
|
|
|
// Set the size on the document viewer before we update the widget and
|
|
|
|
// trigger a reflow. Otherwise the MobileViewportManager reads the stale
|
|
|
|
// size from the content viewer when it computes a new CSS viewport.
|
2014-03-25 06:28:46 +04:00
|
|
|
nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(WebNavigation());
|
2015-06-08 08:39:28 +03:00
|
|
|
baseWin->SetPositionAndSize(0, 0, screenSize.width, screenSize.height,
|
2016-05-12 03:07:45 +03:00
|
|
|
nsIBaseWindow::eRepaint);
|
2011-07-16 01:46:56 +04:00
|
|
|
|
2016-03-08 22:14:43 +03:00
|
|
|
mPuppetWidget->Resize(screenRect.x + clientOffset.x + chromeDisp.x,
|
|
|
|
screenRect.y + clientOffset.y + chromeDisp.y,
|
2015-07-21 17:51:55 +03:00
|
|
|
screenSize.width, screenSize.height, true);
|
2012-09-29 06:18:18 +04:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2009-07-01 00:39:22 +04:00
|
|
|
}
|
2009-10-29 20:58:31 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-02-23 19:10:00 +03:00
|
|
|
TabChild::RecvSizeModeChanged(const nsSizeMode& aSizeMode)
|
|
|
|
{
|
|
|
|
mPuppetWidget->SetSizeMode(aSizeMode);
|
2016-04-20 06:41:42 +03:00
|
|
|
if (!mPuppetWidget->IsVisible()) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-04-20 06:41:42 +03:00
|
|
|
}
|
2016-02-23 19:10:00 +03:00
|
|
|
nsCOMPtr<nsIDocument> document(GetDocument());
|
|
|
|
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
|
|
|
|
if (presShell) {
|
|
|
|
nsPresContext* presContext = presShell->GetPresContext();
|
|
|
|
if (presContext) {
|
2016-04-20 06:41:42 +03:00
|
|
|
presContext->SizeModeChanged(aSizeMode);
|
2016-02-23 19:10:00 +03:00
|
|
|
}
|
|
|
|
}
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-02-23 19:10:00 +03:00
|
|
|
}
|
|
|
|
|
2012-08-09 08:39:02 +04:00
|
|
|
bool
|
2016-01-08 22:17:39 +03:00
|
|
|
TabChild::UpdateFrame(const FrameMetrics& aFrameMetrics)
|
2012-08-09 08:39:02 +04:00
|
|
|
{
|
2014-03-25 06:28:46 +04:00
|
|
|
return TabChildBase::UpdateFrameHandler(aFrameMetrics);
|
2013-05-24 05:43:36 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-08-20 00:08:41 +03:00
|
|
|
TabChild::RecvSuppressDisplayport(const bool& aEnabled)
|
|
|
|
{
|
|
|
|
if (aEnabled) {
|
|
|
|
mActiveSuppressDisplayport++;
|
|
|
|
} else {
|
|
|
|
mActiveSuppressDisplayport--;
|
|
|
|
}
|
|
|
|
|
|
|
|
MOZ_ASSERT(mActiveSuppressDisplayport >= 0);
|
2016-03-10 00:56:54 +03:00
|
|
|
APZCCallbackHelper::SuppressDisplayport(aEnabled, GetPresShell());
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-08-20 00:08:41 +03:00
|
|
|
}
|
|
|
|
|
2016-01-08 22:17:39 +03:00
|
|
|
void
|
|
|
|
TabChild::HandleDoubleTap(const CSSPoint& aPoint, const Modifiers& aModifiers,
|
|
|
|
const ScrollableLayerGuid& aGuid)
|
2012-08-09 08:39:02 +04:00
|
|
|
{
|
2016-01-08 22:17:39 +03:00
|
|
|
TABC_LOG("Handling double tap at %s with %p %p\n",
|
|
|
|
Stringify(aPoint).c_str(), mGlobal.get(), mTabChildGlobal.get());
|
2014-09-12 01:25:27 +04:00
|
|
|
|
2016-01-08 22:17:39 +03:00
|
|
|
if (!mGlobal || !mTabChildGlobal) {
|
|
|
|
return;
|
|
|
|
}
|
2012-08-09 08:39:02 +04:00
|
|
|
|
2016-01-08 22:17:39 +03:00
|
|
|
// Note: there is nothing to do with the modifiers here, as we are not
|
|
|
|
// synthesizing any sort of mouse event.
|
|
|
|
nsCOMPtr<nsIDocument> document = GetDocument();
|
2016-07-29 21:44:29 +03:00
|
|
|
CSSRect zoomToRect = CalculateRectToZoomTo(document, aPoint);
|
2016-01-08 22:17:39 +03:00
|
|
|
// The double-tap can be dispatched by any scroll frame (so |aGuid| could be
|
|
|
|
// the guid of any scroll frame), but the zoom-to-rect operation must be
|
|
|
|
// performed by the root content scroll frame, so query its identifiers
|
|
|
|
// for the SendZoomToRect() call rather than using the ones from |aGuid|.
|
|
|
|
uint32_t presShellId;
|
|
|
|
ViewID viewId;
|
|
|
|
if (APZCCallbackHelper::GetOrCreateScrollIdentifiers(
|
2016-07-31 22:39:00 +03:00
|
|
|
document->GetDocumentElement(), &presShellId, &viewId) && mApzcTreeManager) {
|
|
|
|
ScrollableLayerGuid guid(mLayersId, presShellId, viewId);
|
|
|
|
|
|
|
|
mApzcTreeManager->ZoomToRect(guid, zoomToRect, DEFAULT_BEHAVIOR);
|
2016-01-08 22:17:39 +03:00
|
|
|
}
|
2012-07-20 10:48:27 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-09-21 17:26:33 +03:00
|
|
|
TabChild::RecvHandleTap(const GeckoContentController::TapType& aType,
|
|
|
|
const LayoutDevicePoint& aPoint,
|
|
|
|
const Modifiers& aModifiers,
|
|
|
|
const ScrollableLayerGuid& aGuid,
|
|
|
|
const uint64_t& aInputBlockId)
|
2016-07-05 20:24:54 +03:00
|
|
|
{
|
2016-07-29 21:44:29 +03:00
|
|
|
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
|
|
|
if (!presShell) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-07-29 21:44:29 +03:00
|
|
|
}
|
|
|
|
if (!presShell->GetPresContext()) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-07-29 21:44:29 +03:00
|
|
|
}
|
|
|
|
CSSToLayoutDeviceScale scale(presShell->GetPresContext()->CSSToDevPixelScale());
|
|
|
|
CSSPoint point = APZCCallbackHelper::ApplyCallbackTransform(aPoint / scale, aGuid);
|
|
|
|
|
2016-07-05 20:24:54 +03:00
|
|
|
switch (aType) {
|
|
|
|
case GeckoContentController::TapType::eSingleTap:
|
|
|
|
if (mGlobal && mTabChildGlobal) {
|
2016-09-29 17:05:25 +03:00
|
|
|
mAPZEventState->ProcessSingleTap(point, scale, aModifiers, aGuid, 1);
|
2016-07-05 20:24:54 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GeckoContentController::TapType::eDoubleTap:
|
2016-07-29 21:44:29 +03:00
|
|
|
HandleDoubleTap(point, aModifiers, aGuid);
|
2016-07-05 20:24:54 +03:00
|
|
|
break;
|
2016-09-29 17:05:25 +03:00
|
|
|
case GeckoContentController::TapType::eSecondTap:
|
|
|
|
if (mGlobal && mTabChildGlobal) {
|
|
|
|
mAPZEventState->ProcessSingleTap(point, scale, aModifiers, aGuid, 2);
|
|
|
|
}
|
|
|
|
break;
|
2016-07-05 20:24:54 +03:00
|
|
|
case GeckoContentController::TapType::eLongTap:
|
|
|
|
if (mGlobal && mTabChildGlobal) {
|
2016-07-29 21:44:29 +03:00
|
|
|
mAPZEventState->ProcessLongTap(presShell, point, scale, aModifiers, aGuid,
|
2016-07-05 20:24:54 +03:00
|
|
|
aInputBlockId);
|
|
|
|
}
|
|
|
|
break;
|
2016-07-05 20:24:54 +03:00
|
|
|
case GeckoContentController::TapType::eLongTapUp:
|
|
|
|
if (mGlobal && mTabChildGlobal) {
|
2016-08-31 00:32:08 +03:00
|
|
|
mAPZEventState->ProcessLongTapUp(presShell, point, scale, aModifiers);
|
2016-07-05 20:24:54 +03:00
|
|
|
}
|
|
|
|
break;
|
2016-07-05 20:24:54 +03:00
|
|
|
case GeckoContentController::TapType::eSentinel:
|
|
|
|
// Should never happen, but we need to handle this case to make the compiler
|
|
|
|
// happy.
|
|
|
|
MOZ_ASSERT(false);
|
|
|
|
break;
|
2012-11-08 23:35:02 +04:00
|
|
|
}
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2012-11-08 23:35:02 +04:00
|
|
|
}
|
|
|
|
|
2013-12-10 07:14:55 +04:00
|
|
|
bool
|
2016-01-08 22:17:39 +03:00
|
|
|
TabChild::NotifyAPZStateChange(const ViewID& aViewId,
|
|
|
|
const layers::GeckoContentController::APZStateChange& aChange,
|
|
|
|
const int& aArg)
|
2014-04-15 21:39:20 +04:00
|
|
|
{
|
2016-11-04 17:27:02 +03:00
|
|
|
mAPZEventState->ProcessAPZStateChange(aViewId, aChange, aArg);
|
2016-07-04 21:44:08 +03:00
|
|
|
if (aChange == layers::GeckoContentController::APZStateChange::eTransformEnd) {
|
2015-06-20 05:51:35 +03:00
|
|
|
// This is used by tests to determine when the APZ is done doing whatever
|
|
|
|
// it's doing. XXX generify this as needed when writing additional tests.
|
2016-02-25 19:15:14 +03:00
|
|
|
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
|
|
|
|
observerService->NotifyObservers(nullptr, "APZ:TransformEnd", nullptr);
|
2015-06-20 05:51:35 +03:00
|
|
|
}
|
2013-12-10 07:14:55 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-01-08 22:17:39 +03:00
|
|
|
void
|
|
|
|
TabChild::StartScrollbarDrag(const layers::AsyncDragMetrics& aDragMetrics)
|
2015-06-19 15:25:41 +03:00
|
|
|
{
|
2016-07-31 22:39:00 +03:00
|
|
|
ScrollableLayerGuid guid(mLayersId, aDragMetrics.mPresShellId,
|
|
|
|
aDragMetrics.mViewId);
|
|
|
|
|
|
|
|
if (mApzcTreeManager) {
|
|
|
|
mApzcTreeManager->StartScrollbarDrag(guid, aDragMetrics);
|
2016-01-08 22:17:39 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TabChild::ZoomToRect(const uint32_t& aPresShellId,
|
|
|
|
const FrameMetrics::ViewID& aViewId,
|
|
|
|
const CSSRect& aRect,
|
|
|
|
const uint32_t& aFlags)
|
|
|
|
{
|
2016-07-31 22:39:00 +03:00
|
|
|
ScrollableLayerGuid guid(mLayersId, aPresShellId, aViewId);
|
|
|
|
|
|
|
|
if (mApzcTreeManager) {
|
|
|
|
mApzcTreeManager->ZoomToRect(guid, aRect, aFlags);
|
2016-01-08 22:17:39 +03:00
|
|
|
}
|
2015-06-19 15:25:41 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2010-07-19 22:33:33 +04:00
|
|
|
TabChild::RecvActivate()
|
2009-11-05 21:14:22 +03:00
|
|
|
{
|
2014-03-25 06:28:46 +04:00
|
|
|
nsCOMPtr<nsIWebBrowserFocus> browser = do_QueryInterface(WebNavigation());
|
2009-11-05 21:14:22 +03:00
|
|
|
browser->Activate();
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2009-11-05 21:14:22 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
TabChild::RecvDeactivate()
|
2011-06-18 04:08:32 +04:00
|
|
|
{
|
2014-03-25 06:28:46 +04:00
|
|
|
nsCOMPtr<nsIWebBrowserFocus> browser = do_QueryInterface(WebNavigation());
|
2011-06-18 04:08:32 +04:00
|
|
|
browser->Deactivate();
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2011-06-18 04:08:32 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
TabChild::RecvParentActivated(const bool& aActivated)
|
2014-11-27 16:28:26 +03:00
|
|
|
{
|
2015-02-06 19:26:29 +03:00
|
|
|
mParentIsActive = aActivated;
|
|
|
|
|
2014-11-27 16:28:26 +03:00
|
|
|
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
2016-11-15 06:26:00 +03:00
|
|
|
NS_ENSURE_TRUE(fm, IPC_OK());
|
2014-11-27 16:28:26 +03:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(WebNavigation());
|
2014-11-27 16:28:26 +03:00
|
|
|
fm->ParentActivated(window, aActivated);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2014-11-27 16:28:26 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
|
|
|
TabChild::RecvSetKeyboardIndicators(const UIStateChangeType& aShowAccelerators,
|
|
|
|
const UIStateChangeType& aShowFocusRings)
|
2016-06-09 14:59:31 +03:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(WebNavigation());
|
2016-11-15 06:26:00 +03:00
|
|
|
NS_ENSURE_TRUE(window, IPC_OK());
|
2016-06-09 14:59:31 +03:00
|
|
|
|
|
|
|
window->SetKeyboardIndicators(aShowAccelerators, aShowFocusRings);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-06-09 14:59:31 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-07-01 16:19:11 +03:00
|
|
|
TabChild::RecvStopIMEStateManagement()
|
|
|
|
{
|
|
|
|
IMEStateManager::StopIMEStateManagement();
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-07-01 16:19:11 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-07-01 16:19:11 +03:00
|
|
|
TabChild::RecvMenuKeyboardListenerInstalled(const bool& aInstalled)
|
|
|
|
{
|
|
|
|
IMEStateManager::OnInstalledMenuKeyboardListener(aInstalled);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-07-01 16:19:11 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-12-22 11:06:50 +03:00
|
|
|
TabChild::RecvNotifyAttachGroupedSHistory(const uint32_t& aOffset)
|
2016-10-14 10:31:02 +03:00
|
|
|
{
|
|
|
|
// nsISHistory uses int32_t
|
|
|
|
if (NS_WARN_IF(aOffset > INT32_MAX)) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_FAIL_NO_REASON(this);
|
2016-10-14 10:31:02 +03:00
|
|
|
}
|
|
|
|
|
2016-12-15 08:28:40 +03:00
|
|
|
nsCOMPtr<nsISHistory> shistory = GetRelatedSHistory();
|
2016-11-15 06:26:00 +03:00
|
|
|
NS_ENSURE_TRUE(shistory, IPC_FAIL_NO_REASON(this));
|
2016-10-14 10:31:02 +03:00
|
|
|
|
2016-12-22 11:06:50 +03:00
|
|
|
if (NS_FAILED(shistory->OnAttachGroupedSHistory(aOffset))) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
2016-10-14 10:31:02 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-12-22 11:06:50 +03:00
|
|
|
TabChild::RecvNotifyPartialSHistoryActive(const uint32_t& aGlobalLength,
|
|
|
|
const uint32_t& aTargetLocalIndex)
|
2016-10-14 10:31:02 +03:00
|
|
|
{
|
|
|
|
// nsISHistory uses int32_t
|
|
|
|
if (NS_WARN_IF(aGlobalLength > INT32_MAX || aTargetLocalIndex > INT32_MAX)) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_FAIL_NO_REASON(this);
|
2016-10-14 10:31:02 +03:00
|
|
|
}
|
|
|
|
|
2016-12-15 08:28:40 +03:00
|
|
|
nsCOMPtr<nsISHistory> shistory = GetRelatedSHistory();
|
2016-11-15 06:26:00 +03:00
|
|
|
NS_ENSURE_TRUE(shistory, IPC_FAIL_NO_REASON(this));
|
2016-10-14 10:31:02 +03:00
|
|
|
|
2016-12-22 11:06:50 +03:00
|
|
|
if (NS_FAILED(shistory->OnPartialSHistoryActive(aGlobalLength,
|
|
|
|
aTargetLocalIndex))) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
2016-10-14 10:31:02 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-12-22 11:06:50 +03:00
|
|
|
TabChild::RecvNotifyPartialSHistoryDeactive()
|
2016-10-14 10:31:02 +03:00
|
|
|
{
|
2016-12-15 08:28:40 +03:00
|
|
|
nsCOMPtr<nsISHistory> shistory = GetRelatedSHistory();
|
2016-11-15 06:26:00 +03:00
|
|
|
NS_ENSURE_TRUE(shistory, IPC_FAIL_NO_REASON(this));
|
2016-10-14 10:31:02 +03:00
|
|
|
|
2016-12-22 11:06:50 +03:00
|
|
|
if (NS_FAILED(shistory->OnPartialSHistoryDeactive())) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
2016-10-14 10:31:02 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2010-07-19 22:33:33 +04:00
|
|
|
TabChild::RecvMouseEvent(const nsString& aType,
|
|
|
|
const float& aX,
|
|
|
|
const float& aY,
|
2012-08-22 19:56:38 +04:00
|
|
|
const int32_t& aButton,
|
|
|
|
const int32_t& aClickCount,
|
|
|
|
const int32_t& aModifiers,
|
2010-07-19 22:33:33 +04:00
|
|
|
const bool& aIgnoreRootScrollFrame)
|
2009-11-05 21:21:09 +03:00
|
|
|
{
|
2015-04-15 10:09:46 +03:00
|
|
|
APZCCallbackHelper::DispatchMouseEvent(GetPresShell(), aType, CSSPoint(aX, aY),
|
2016-12-21 06:53:00 +03:00
|
|
|
aButton, aClickCount, aModifiers, aIgnoreRootScrollFrame,
|
|
|
|
nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN, 0 /* Use the default value here. */);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2009-11-05 21:21:09 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-03-11 02:25:48 +03:00
|
|
|
TabChild::RecvRealMouseMoveEvent(const WidgetMouseEvent& aEvent,
|
2015-09-28 21:44:37 +03:00
|
|
|
const ScrollableLayerGuid& aGuid,
|
|
|
|
const uint64_t& aInputBlockId)
|
2015-02-14 02:34:04 +03:00
|
|
|
{
|
2016-11-15 06:26:00 +03:00
|
|
|
if (!RecvRealMouseButtonEvent(aEvent, aGuid, aInputBlockId)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
2015-02-14 02:34:04 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-03-11 02:25:48 +03:00
|
|
|
TabChild::RecvSynthMouseMoveEvent(const WidgetMouseEvent& aEvent,
|
2015-09-28 21:44:37 +03:00
|
|
|
const ScrollableLayerGuid& aGuid,
|
|
|
|
const uint64_t& aInputBlockId)
|
2015-07-28 01:35:51 +03:00
|
|
|
{
|
2016-11-15 06:26:00 +03:00
|
|
|
if (!RecvRealMouseButtonEvent(aEvent, aGuid, aInputBlockId)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
2015-07-28 01:35:51 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-03-11 02:25:48 +03:00
|
|
|
TabChild::RecvRealMouseButtonEvent(const WidgetMouseEvent& aEvent,
|
2015-09-28 21:44:37 +03:00
|
|
|
const ScrollableLayerGuid& aGuid,
|
|
|
|
const uint64_t& aInputBlockId)
|
2011-06-22 04:32:43 +04:00
|
|
|
{
|
2016-06-20 19:52:47 +03:00
|
|
|
// Mouse events like eMouseEnterIntoWidget, that are created in the parent
|
|
|
|
// process EventStateManager code, have an input block id which they get from
|
|
|
|
// the InputAPZContext in the parent process stack. However, they did not
|
|
|
|
// actually go through the APZ code and so their mHandledByAPZ flag is false.
|
|
|
|
// Since thos events didn't go through APZ, we don't need to send notifications
|
|
|
|
// for them.
|
2017-01-04 21:42:36 +03:00
|
|
|
bool pendingLayerization = false;
|
2016-06-20 19:52:47 +03:00
|
|
|
if (aInputBlockId && aEvent.mFlags.mHandledByAPZ) {
|
2016-06-07 18:07:55 +03:00
|
|
|
nsCOMPtr<nsIDocument> document(GetDocument());
|
2017-01-04 21:42:36 +03:00
|
|
|
pendingLayerization = APZCCallbackHelper::SendSetTargetAPZCNotification(
|
2016-06-07 18:07:55 +03:00
|
|
|
mPuppetWidget, document, aEvent, aGuid, aInputBlockId);
|
|
|
|
}
|
|
|
|
|
2015-09-28 21:44:37 +03:00
|
|
|
nsEventStatus unused;
|
|
|
|
InputAPZContext context(aGuid, aInputBlockId, unused);
|
2017-01-04 21:42:36 +03:00
|
|
|
if (pendingLayerization) {
|
|
|
|
context.SetPendingLayerization();
|
|
|
|
}
|
2015-09-28 21:44:37 +03:00
|
|
|
|
2016-03-11 02:25:48 +03:00
|
|
|
WidgetMouseEvent localEvent(aEvent);
|
2016-04-14 11:03:14 +03:00
|
|
|
localEvent.mWidget = mPuppetWidget;
|
2016-03-11 02:25:48 +03:00
|
|
|
APZCCallbackHelper::ApplyCallbackTransform(localEvent, aGuid,
|
|
|
|
mPuppetWidget->GetDefaultScale());
|
2015-01-22 03:46:27 +03:00
|
|
|
APZCCallbackHelper::DispatchWidgetEvent(localEvent);
|
2015-10-26 23:06:49 +03:00
|
|
|
|
2016-06-20 19:52:47 +03:00
|
|
|
if (aInputBlockId && aEvent.mFlags.mHandledByAPZ) {
|
2016-03-11 02:25:48 +03:00
|
|
|
mAPZEventState->ProcessMouseEvent(aEvent, aGuid, aInputBlockId);
|
2015-10-26 23:06:49 +03:00
|
|
|
}
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2011-06-22 04:32:43 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2014-12-09 13:40:26 +03:00
|
|
|
TabChild::RecvMouseWheelEvent(const WidgetWheelEvent& aEvent,
|
|
|
|
const ScrollableLayerGuid& aGuid,
|
|
|
|
const uint64_t& aInputBlockId)
|
|
|
|
{
|
2016-06-20 19:52:47 +03:00
|
|
|
if (aInputBlockId && aEvent.mFlags.mHandledByAPZ) {
|
2014-12-09 13:40:26 +03:00
|
|
|
nsCOMPtr<nsIDocument> document(GetDocument());
|
2015-06-17 11:44:50 +03:00
|
|
|
APZCCallbackHelper::SendSetTargetAPZCNotification(
|
|
|
|
mPuppetWidget, document, aEvent, aGuid, aInputBlockId);
|
2014-12-09 13:40:26 +03:00
|
|
|
}
|
|
|
|
|
2016-03-11 02:25:48 +03:00
|
|
|
WidgetWheelEvent localEvent(aEvent);
|
2016-04-14 11:03:14 +03:00
|
|
|
localEvent.mWidget = mPuppetWidget;
|
2016-03-11 02:25:48 +03:00
|
|
|
APZCCallbackHelper::ApplyCallbackTransform(localEvent, aGuid,
|
|
|
|
mPuppetWidget->GetDefaultScale());
|
|
|
|
APZCCallbackHelper::DispatchWidgetEvent(localEvent);
|
2014-12-09 13:40:26 +03:00
|
|
|
|
2016-03-11 02:25:48 +03:00
|
|
|
if (localEvent.mCanTriggerSwipe) {
|
|
|
|
SendRespondStartSwipeEvent(aInputBlockId, localEvent.TriggersSwipe());
|
2015-11-27 19:33:50 +03:00
|
|
|
}
|
|
|
|
|
2016-06-20 19:52:47 +03:00
|
|
|
if (aInputBlockId && aEvent.mFlags.mHandledByAPZ) {
|
2016-03-11 02:25:48 +03:00
|
|
|
mAPZEventState->ProcessWheelEvent(localEvent, aGuid, aInputBlockId);
|
2014-12-09 13:40:26 +03:00
|
|
|
}
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2011-06-22 04:32:43 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2013-11-13 22:20:31 +04:00
|
|
|
TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
|
2014-10-24 21:29:30 +04:00
|
|
|
const ScrollableLayerGuid& aGuid,
|
2015-05-14 15:16:00 +03:00
|
|
|
const uint64_t& aInputBlockId,
|
|
|
|
const nsEventStatus& aApzResponse)
|
2012-09-15 05:16:32 +04:00
|
|
|
{
|
2015-08-22 04:34:51 +03:00
|
|
|
TABC_LOG("Receiving touch event of type %d\n", aEvent.mMessage);
|
2014-09-12 01:25:27 +04:00
|
|
|
|
2015-02-06 02:02:27 +03:00
|
|
|
WidgetTouchEvent localEvent(aEvent);
|
2016-04-14 11:03:14 +03:00
|
|
|
localEvent.mWidget = mPuppetWidget;
|
2015-02-06 02:02:27 +03:00
|
|
|
|
|
|
|
APZCCallbackHelper::ApplyCallbackTransform(localEvent, aGuid,
|
2015-06-17 19:34:42 +03:00
|
|
|
mPuppetWidget->GetDefaultScale());
|
2014-03-12 23:27:45 +04:00
|
|
|
|
2015-09-14 18:14:34 +03:00
|
|
|
if (localEvent.mMessage == eTouchStart && AsyncPanZoomEnabled()) {
|
2016-07-26 03:35:03 +03:00
|
|
|
nsCOMPtr<nsIDocument> document = GetDocument();
|
2015-03-19 13:33:33 +03:00
|
|
|
if (gfxPrefs::TouchActionEnabled()) {
|
2015-06-17 11:44:50 +03:00
|
|
|
APZCCallbackHelper::SendSetAllowedTouchBehaviorNotification(mPuppetWidget,
|
2016-07-26 03:35:03 +03:00
|
|
|
document, localEvent, aInputBlockId, mSetAllowedTouchBehaviorCallback);
|
2015-03-19 13:33:33 +03:00
|
|
|
}
|
2015-06-17 11:44:50 +03:00
|
|
|
APZCCallbackHelper::SendSetTargetAPZCNotification(mPuppetWidget, document,
|
2015-04-14 19:24:32 +03:00
|
|
|
localEvent, aGuid, aInputBlockId);
|
2014-11-22 05:36:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Dispatch event to content (potentially a long-running operation)
|
2015-01-22 03:46:27 +03:00
|
|
|
nsEventStatus status = APZCCallbackHelper::DispatchWidgetEvent(localEvent);
|
2012-09-15 05:16:32 +04:00
|
|
|
|
2015-06-04 23:51:10 +03:00
|
|
|
if (!AsyncPanZoomEnabled()) {
|
2015-10-31 05:20:58 +03:00
|
|
|
// We shouldn't have any e10s platforms that have touch events enabled
|
|
|
|
// without APZ.
|
|
|
|
MOZ_ASSERT(false);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2013-12-20 13:11:01 +04:00
|
|
|
}
|
|
|
|
|
2015-10-31 05:22:28 +03:00
|
|
|
mAPZEventState->ProcessTouchEvent(localEvent, aGuid, aInputBlockId,
|
|
|
|
aApzResponse, status);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2012-07-16 06:58:43 +04:00
|
|
|
}
|
2011-06-22 04:32:43 +04:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2013-11-13 22:20:31 +04:00
|
|
|
TabChild::RecvRealTouchMoveEvent(const WidgetTouchEvent& aEvent,
|
2014-10-24 21:29:30 +04:00
|
|
|
const ScrollableLayerGuid& aGuid,
|
2015-05-14 15:16:00 +03:00
|
|
|
const uint64_t& aInputBlockId,
|
|
|
|
const nsEventStatus& aApzResponse)
|
2012-08-22 14:54:20 +04:00
|
|
|
{
|
2016-11-15 06:26:00 +03:00
|
|
|
if (!RecvRealTouchEvent(aEvent, aGuid, aInputBlockId, aApzResponse)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
2012-08-22 14:54:20 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-04-08 21:48:11 +03:00
|
|
|
TabChild::RecvRealDragEvent(const WidgetDragEvent& aEvent,
|
|
|
|
const uint32_t& aDragAction,
|
|
|
|
const uint32_t& aDropEffect)
|
|
|
|
{
|
|
|
|
WidgetDragEvent localEvent(aEvent);
|
2016-04-14 11:03:14 +03:00
|
|
|
localEvent.mWidget = mPuppetWidget;
|
2015-04-08 21:48:11 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
|
|
|
|
if (dragSession) {
|
|
|
|
dragSession->SetDragAction(aDragAction);
|
|
|
|
nsCOMPtr<nsIDOMDataTransfer> initialDataTransfer;
|
|
|
|
dragSession->GetDataTransfer(getter_AddRefs(initialDataTransfer));
|
|
|
|
if (initialDataTransfer) {
|
|
|
|
initialDataTransfer->SetDropEffectInt(aDropEffect);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-02 09:08:01 +03:00
|
|
|
if (aEvent.mMessage == eDrop) {
|
2015-04-08 21:48:11 +03:00
|
|
|
bool canDrop = true;
|
|
|
|
if (!dragSession || NS_FAILED(dragSession->GetCanDrop(&canDrop)) ||
|
|
|
|
!canDrop) {
|
2015-09-02 09:08:02 +03:00
|
|
|
localEvent.mMessage = eDragExit;
|
2015-04-08 21:48:11 +03:00
|
|
|
}
|
2015-09-02 09:08:02 +03:00
|
|
|
} else if (aEvent.mMessage == eDragOver) {
|
2015-04-08 21:48:11 +03:00
|
|
|
nsCOMPtr<nsIDragService> dragService =
|
|
|
|
do_GetService("@mozilla.org/widget/dragservice;1");
|
|
|
|
if (dragService) {
|
|
|
|
// This will dispatch 'drag' event at the source if the
|
|
|
|
// drag transaction started in this process.
|
2015-09-02 09:08:02 +03:00
|
|
|
dragService->FireDragEventAtSource(eDrag);
|
2015-04-08 21:48:11 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
APZCCallbackHelper::DispatchWidgetEvent(localEvent);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-04-08 21:48:11 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-12-29 16:57:38 +03:00
|
|
|
TabChild::RecvPluginEvent(const WidgetPluginEvent& aEvent)
|
|
|
|
{
|
|
|
|
WidgetPluginEvent localEvent(aEvent);
|
2016-04-14 11:03:14 +03:00
|
|
|
localEvent.mWidget = mPuppetWidget;
|
2015-12-29 16:57:38 +03:00
|
|
|
nsEventStatus status = APZCCallbackHelper::DispatchWidgetEvent(localEvent);
|
|
|
|
if (status != nsEventStatus_eConsumeNoDefault) {
|
|
|
|
// If not consumed, we should call default action
|
|
|
|
SendDefaultProcOfPluginEvent(aEvent);
|
|
|
|
}
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-12-29 16:57:38 +03:00
|
|
|
}
|
|
|
|
|
2014-04-22 00:40:09 +04:00
|
|
|
void
|
|
|
|
TabChild::RequestNativeKeyBindings(AutoCacheNativeKeyCommands* aAutoCache,
|
2016-10-31 19:38:04 +03:00
|
|
|
const WidgetKeyboardEvent* aEvent)
|
2014-04-22 00:40:09 +04:00
|
|
|
{
|
|
|
|
MaybeNativeKeyBinding maybeBindings;
|
|
|
|
if (!SendRequestNativeKeyBindings(*aEvent, &maybeBindings)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (maybeBindings.type() == MaybeNativeKeyBinding::TNativeKeyBinding) {
|
|
|
|
const NativeKeyBinding& bindings = maybeBindings;
|
|
|
|
aAutoCache->Cache(bindings.singleLineCommands(),
|
|
|
|
bindings.multiLineCommands(),
|
|
|
|
bindings.richTextCommands());
|
|
|
|
} else {
|
|
|
|
aAutoCache->CacheNoCommands();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-04-14 18:36:36 +03:00
|
|
|
TabChild::RecvNativeSynthesisResponse(const uint64_t& aObserverId,
|
|
|
|
const nsCString& aResponse)
|
|
|
|
{
|
|
|
|
mozilla::widget::AutoObserverNotifier::NotifySavedObserver(aObserverId, aResponse.get());
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-04-14 18:36:36 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2014-03-20 19:46:29 +04:00
|
|
|
TabChild::RecvRealKeyEvent(const WidgetKeyboardEvent& event,
|
|
|
|
const MaybeNativeKeyBinding& aBindings)
|
2014-04-22 00:40:09 +04:00
|
|
|
{
|
2015-06-17 11:44:50 +03:00
|
|
|
AutoCacheNativeKeyCommands autoCache(mPuppetWidget);
|
2014-04-22 00:40:09 +04:00
|
|
|
|
2015-08-29 02:58:27 +03:00
|
|
|
if (event.mMessage == eKeyPress) {
|
2015-04-14 09:01:05 +03:00
|
|
|
// If content code called preventDefault() on a keydown event, then we don't
|
|
|
|
// want to process any following keypress events.
|
|
|
|
if (mIgnoreKeyPressEvent) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-04-14 09:01:05 +03:00
|
|
|
}
|
2014-03-20 19:46:29 +04:00
|
|
|
if (aBindings.type() == MaybeNativeKeyBinding::TNativeKeyBinding) {
|
|
|
|
const NativeKeyBinding& bindings = aBindings;
|
2014-04-22 00:40:09 +04:00
|
|
|
autoCache.Cache(bindings.singleLineCommands(),
|
|
|
|
bindings.multiLineCommands(),
|
|
|
|
bindings.richTextCommands());
|
2014-03-20 19:46:29 +04:00
|
|
|
} else {
|
2014-04-22 00:40:09 +04:00
|
|
|
autoCache.CacheNoCommands();
|
2014-03-20 19:46:29 +04:00
|
|
|
}
|
|
|
|
}
|
2014-03-12 07:13:38 +04:00
|
|
|
|
2013-10-01 11:22:58 +04:00
|
|
|
WidgetKeyboardEvent localEvent(event);
|
2016-04-14 11:03:14 +03:00
|
|
|
localEvent.mWidget = mPuppetWidget;
|
2015-01-22 03:46:27 +03:00
|
|
|
nsEventStatus status = APZCCallbackHelper::DispatchWidgetEvent(localEvent);
|
2014-03-12 07:13:38 +04:00
|
|
|
|
2015-08-29 02:58:27 +03:00
|
|
|
if (event.mMessage == eKeyDown) {
|
2014-03-12 07:13:38 +04:00
|
|
|
mIgnoreKeyPressEvent = status == nsEventStatus_eConsumeNoDefault;
|
|
|
|
}
|
|
|
|
|
2016-11-21 14:55:00 +03:00
|
|
|
if (localEvent.mFlags.mIsSuppressedOrDelayed) {
|
|
|
|
localEvent.PreventDefault();
|
|
|
|
}
|
|
|
|
|
2016-05-11 15:56:42 +03:00
|
|
|
// If a response is desired from the content process, resend the key event.
|
|
|
|
// If mAccessKeyForwardedToChild is set, then don't resend the key event yet
|
|
|
|
// as RecvHandleAccessKey will do this.
|
2014-03-18 19:16:47 +04:00
|
|
|
if (localEvent.mFlags.mWantReplyFromContentProcess) {
|
|
|
|
SendReplyKeyEvent(localEvent);
|
|
|
|
}
|
|
|
|
|
2016-05-11 15:56:42 +03:00
|
|
|
if (localEvent.mAccessKeyForwardedToChild) {
|
|
|
|
SendAccessKeyNotHandled(localEvent);
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2011-06-22 04:32:43 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2010-07-19 22:33:33 +04:00
|
|
|
TabChild::RecvKeyEvent(const nsString& aType,
|
2012-08-22 19:56:38 +04:00
|
|
|
const int32_t& aKeyCode,
|
|
|
|
const int32_t& aCharCode,
|
|
|
|
const int32_t& aModifiers,
|
2010-07-19 22:33:33 +04:00
|
|
|
const bool& aPreventDefault)
|
2010-03-19 09:52:18 +03:00
|
|
|
{
|
2011-09-29 10:19:26 +04:00
|
|
|
bool ignored = false;
|
2015-06-18 07:41:28 +03:00
|
|
|
nsContentUtils::SendKeyEvent(mPuppetWidget, aType, aKeyCode, aCharCode,
|
2015-04-15 10:09:46 +03:00
|
|
|
aModifiers, aPreventDefault, &ignored);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2010-03-19 09:52:18 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2013-10-01 11:23:00 +04:00
|
|
|
TabChild::RecvCompositionEvent(const WidgetCompositionEvent& event)
|
2010-08-17 12:07:42 +04:00
|
|
|
{
|
2014-10-07 14:01:48 +04:00
|
|
|
WidgetCompositionEvent localEvent(event);
|
2016-04-14 11:03:14 +03:00
|
|
|
localEvent.mWidget = mPuppetWidget;
|
2015-01-22 03:46:27 +03:00
|
|
|
APZCCallbackHelper::DispatchWidgetEvent(localEvent);
|
2015-11-02 08:53:26 +03:00
|
|
|
Unused << SendOnEventNeedingAckHandled(event.mMessage);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2010-08-17 12:07:42 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2013-10-01 11:23:01 +04:00
|
|
|
TabChild::RecvSelectionEvent(const WidgetSelectionEvent& event)
|
2010-08-17 12:07:42 +04:00
|
|
|
{
|
2013-10-01 11:23:01 +04:00
|
|
|
WidgetSelectionEvent localEvent(event);
|
2016-04-14 11:03:14 +03:00
|
|
|
localEvent.mWidget = mPuppetWidget;
|
2015-01-22 03:46:27 +03:00
|
|
|
APZCCallbackHelper::DispatchWidgetEvent(localEvent);
|
2015-11-02 08:53:26 +03:00
|
|
|
Unused << SendOnEventNeedingAckHandled(event.mMessage);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2010-08-17 12:07:42 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-08-31 04:30:45 +03:00
|
|
|
TabChild::RecvPasteTransferable(const IPCDataTransfer& aDataTransfer,
|
|
|
|
const bool& aIsPrivateData,
|
|
|
|
const IPC::Principal& aRequestingPrincipal)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsITransferable> trans =
|
|
|
|
do_CreateInstance("@mozilla.org/widget/transferable;1", &rv);
|
2016-11-15 06:26:00 +03:00
|
|
|
NS_ENSURE_SUCCESS(rv, IPC_OK());
|
2016-08-31 04:30:45 +03:00
|
|
|
trans->Init(nullptr);
|
|
|
|
|
|
|
|
rv = nsContentUtils::IPCTransferableToTransferable(aDataTransfer,
|
|
|
|
aIsPrivateData,
|
|
|
|
aRequestingPrincipal,
|
|
|
|
trans, nullptr, this);
|
2016-11-15 06:26:00 +03:00
|
|
|
NS_ENSURE_SUCCESS(rv, IPC_OK());
|
2016-08-31 04:30:45 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIDocShell> ourDocShell = do_GetInterface(WebNavigation());
|
|
|
|
if (NS_WARN_IF(!ourDocShell)) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-08-31 04:30:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsICommandParams> params = do_CreateInstance("@mozilla.org/embedcomp/command-params;1", &rv);
|
2016-11-15 06:26:00 +03:00
|
|
|
NS_ENSURE_SUCCESS(rv, IPC_OK());
|
2016-08-31 04:30:45 +03:00
|
|
|
|
|
|
|
rv = params->SetISupportsValue("transferable", trans);
|
2016-11-15 06:26:00 +03:00
|
|
|
NS_ENSURE_SUCCESS(rv, IPC_OK());
|
2016-08-31 04:30:45 +03:00
|
|
|
|
|
|
|
ourDocShell->DoCommandWithParams("cmd_pasteTransferable", params);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-08-31 04:30:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-21 20:04:58 +03:00
|
|
|
a11y::PDocAccessibleChild*
|
2016-10-27 22:16:24 +03:00
|
|
|
TabChild::AllocPDocAccessibleChild(PDocAccessibleChild*, const uint64_t&,
|
2016-12-02 02:28:54 +03:00
|
|
|
const uint32_t&, const IAccessibleHolder&)
|
2015-05-21 20:04:58 +03:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(false, "should never call this!");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
TabChild::DeallocPDocAccessibleChild(a11y::PDocAccessibleChild* aChild)
|
|
|
|
{
|
|
|
|
#ifdef ACCESSIBILITY
|
|
|
|
delete static_cast<mozilla::a11y::DocAccessibleChild*>(aChild);
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-10-27 02:20:53 +04:00
|
|
|
PDocumentRendererChild*
|
2013-07-08 19:48:39 +04:00
|
|
|
TabChild::AllocPDocumentRendererChild(const nsRect& documentRect,
|
2013-12-26 22:06:53 +04:00
|
|
|
const mozilla::gfx::Matrix& transform,
|
2013-07-08 19:48:39 +04:00
|
|
|
const nsString& bgcolor,
|
|
|
|
const uint32_t& renderFlags,
|
|
|
|
const bool& flushLayout,
|
|
|
|
const nsIntSize& renderSize)
|
2009-10-29 20:58:31 +03:00
|
|
|
{
|
2010-10-27 02:20:53 +04:00
|
|
|
return new DocumentRendererChild();
|
2009-10-29 20:58:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-08 19:48:39 +04:00
|
|
|
TabChild::DeallocPDocumentRendererChild(PDocumentRendererChild* actor)
|
2009-10-29 20:58:31 +03:00
|
|
|
{
|
2009-12-03 11:16:14 +03:00
|
|
|
delete actor;
|
2009-10-29 20:58:31 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2010-10-27 02:20:53 +04:00
|
|
|
TabChild::RecvPDocumentRendererConstructor(PDocumentRendererChild* actor,
|
|
|
|
const nsRect& documentRect,
|
2013-12-26 22:06:53 +04:00
|
|
|
const mozilla::gfx::Matrix& transform,
|
2010-10-27 02:20:53 +04:00
|
|
|
const nsString& bgcolor,
|
2012-08-22 19:56:38 +04:00
|
|
|
const uint32_t& renderFlags,
|
2010-10-27 02:20:53 +04:00
|
|
|
const bool& flushLayout,
|
|
|
|
const nsIntSize& renderSize)
|
2010-10-27 02:20:53 +04:00
|
|
|
{
|
|
|
|
DocumentRendererChild *render = static_cast<DocumentRendererChild *>(actor);
|
2009-10-29 20:58:31 +03:00
|
|
|
|
2014-03-25 06:28:46 +04:00
|
|
|
nsCOMPtr<nsIWebBrowser> browser = do_QueryInterface(WebNavigation());
|
2009-10-29 20:58:31 +03:00
|
|
|
if (!browser)
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK(); // silently ignore
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<mozIDOMWindowProxy> window;
|
2009-10-29 20:58:31 +03:00
|
|
|
if (NS_FAILED(browser->GetContentDOMWindow(getter_AddRefs(window))) ||
|
|
|
|
!window)
|
|
|
|
{
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK(); // silently ignore
|
2009-10-29 20:58:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsCString data;
|
2016-01-30 20:05:36 +03:00
|
|
|
bool ret = render->RenderDocument(nsPIDOMWindowOuter::From(window),
|
2010-10-27 02:20:53 +04:00
|
|
|
documentRect, transform,
|
|
|
|
bgcolor,
|
2010-10-27 02:20:53 +04:00
|
|
|
renderFlags, flushLayout,
|
2010-10-27 02:20:53 +04:00
|
|
|
renderSize, data);
|
2009-10-29 20:58:31 +03:00
|
|
|
if (!ret)
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK(); // silently ignore
|
2009-10-29 20:58:31 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
if (!PDocumentRendererChild::Send__delete__(actor, renderSize, data)) {
|
|
|
|
return IPC_FAIL_NO_REASON(this);
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
2009-10-29 20:58:31 +03:00
|
|
|
}
|
2009-11-17 17:22:23 +03:00
|
|
|
|
2014-02-24 00:19:43 +04:00
|
|
|
PColorPickerChild*
|
|
|
|
TabChild::AllocPColorPickerChild(const nsString&, const nsString&)
|
|
|
|
{
|
2016-12-03 00:46:53 +03:00
|
|
|
MOZ_CRASH("unused");
|
2014-02-24 00:19:43 +04:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
TabChild::DeallocPColorPickerChild(PColorPickerChild* aColorPicker)
|
|
|
|
{
|
|
|
|
nsColorPickerProxy* picker = static_cast<nsColorPickerProxy*>(aColorPicker);
|
|
|
|
NS_RELEASE(picker);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-06-20 16:55:00 +03:00
|
|
|
PDatePickerChild*
|
|
|
|
TabChild::AllocPDatePickerChild(const nsString&, const nsString&)
|
|
|
|
{
|
2016-12-03 00:46:53 +03:00
|
|
|
MOZ_CRASH("unused");
|
2016-06-20 16:55:00 +03:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
TabChild::DeallocPDatePickerChild(PDatePickerChild* aDatePicker)
|
|
|
|
{
|
|
|
|
nsDatePickerProxy* picker = static_cast<nsDatePickerProxy*>(aDatePicker);
|
|
|
|
NS_RELEASE(picker);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-02-18 04:30:06 +04:00
|
|
|
PFilePickerChild*
|
|
|
|
TabChild::AllocPFilePickerChild(const nsString&, const int16_t&)
|
|
|
|
{
|
2016-12-03 00:46:53 +03:00
|
|
|
MOZ_CRASH("unused");
|
2014-02-18 04:30:06 +04:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
TabChild::DeallocPFilePickerChild(PFilePickerChild* actor)
|
|
|
|
{
|
|
|
|
nsFilePickerProxy* filePicker = static_cast<nsFilePickerProxy*>(actor);
|
|
|
|
NS_RELEASE(filePicker);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-27 03:21:57 +04:00
|
|
|
auto
|
|
|
|
TabChild::AllocPIndexedDBPermissionRequestChild(const Principal& aPrincipal)
|
|
|
|
-> PIndexedDBPermissionRequestChild*
|
|
|
|
{
|
|
|
|
MOZ_CRASH("PIndexedDBPermissionRequestChild actors should always be created "
|
|
|
|
"manually!");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
TabChild::DeallocPIndexedDBPermissionRequestChild(
|
|
|
|
PIndexedDBPermissionRequestChild* aActor)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aActor);
|
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2010-07-19 22:33:33 +04:00
|
|
|
TabChild::RecvActivateFrameEvent(const nsString& aType, const bool& capture)
|
2009-11-17 17:22:23 +03:00
|
|
|
{
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(WebNavigation());
|
2016-11-15 06:26:00 +03:00
|
|
|
NS_ENSURE_TRUE(window, IPC_OK());
|
2013-04-20 02:18:32 +04:00
|
|
|
nsCOMPtr<EventTarget> chromeHandler =
|
2009-11-17 17:22:23 +03:00
|
|
|
do_QueryInterface(window->GetChromeEventHandler());
|
2016-11-15 06:26:00 +03:00
|
|
|
NS_ENSURE_TRUE(chromeHandler, IPC_OK());
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<ContentListener> listener = new ContentListener(this);
|
2009-11-17 17:22:23 +03:00
|
|
|
chromeHandler->AddEventListener(aType, listener, capture);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2009-11-17 17:22:23 +03:00
|
|
|
}
|
2010-02-20 20:05:20 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2013-11-24 09:32:45 +04:00
|
|
|
TabChild::RecvLoadRemoteScript(const nsString& aURL, const bool& aRunInGlobalScope)
|
2010-02-20 20:05:20 +03:00
|
|
|
{
|
2013-06-30 19:00:19 +04:00
|
|
|
if (!mGlobal && !InitTabChildGlobal())
|
2011-08-09 23:38:26 +04:00
|
|
|
// This can happen if we're half-destroyed. It's not a fatal
|
|
|
|
// error.
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2010-08-24 21:01:28 +04:00
|
|
|
|
2015-02-20 04:10:44 +03:00
|
|
|
LoadScriptInternal(aURL, aRunInGlobalScope);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2010-02-20 20:05:20 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2010-07-19 22:33:33 +04:00
|
|
|
TabChild::RecvAsyncMessage(const nsString& aMessage,
|
2015-01-16 22:58:52 +03:00
|
|
|
InfallibleTArray<CpowEntry>&& aCpows,
|
2016-04-09 16:50:59 +03:00
|
|
|
const IPC::Principal& aPrincipal,
|
|
|
|
const ClonedMessageData& aData)
|
2010-02-20 20:05:20 +03:00
|
|
|
{
|
|
|
|
if (mTabChildGlobal) {
|
2013-06-30 19:00:18 +04:00
|
|
|
nsCOMPtr<nsIXPConnectJSObjectHolder> kungFuDeathGrip(GetGlobal());
|
2015-09-10 23:50:58 +03:00
|
|
|
StructuredCloneData data;
|
|
|
|
UnpackClonedMessageDataForChild(aData, data);
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsFrameMessageManager> mm =
|
2011-06-16 22:21:08 +04:00
|
|
|
static_cast<nsFrameMessageManager*>(mTabChildGlobal->mMessageManager.get());
|
2015-01-27 00:32:31 +03:00
|
|
|
CrossProcessCpowHolder cpows(Manager(), aCpows);
|
2015-04-16 18:17:54 +03:00
|
|
|
mm->ReceiveMessage(static_cast<EventTarget*>(mTabChildGlobal), nullptr,
|
2015-09-10 23:50:58 +03:00
|
|
|
aMessage, false, &data, &cpows, aPrincipal, nullptr);
|
2010-02-20 20:05:20 +03:00
|
|
|
}
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2010-02-20 20:05:20 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-04-29 01:04:52 +03:00
|
|
|
TabChild::RecvSwappedWithOtherRemoteLoader(const IPCTabContext& aContext)
|
2015-05-07 18:43:40 +03:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDocShell> ourDocShell = do_GetInterface(WebNavigation());
|
|
|
|
if (NS_WARN_IF(!ourDocShell)) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-05-07 18:43:40 +03:00
|
|
|
}
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> ourWindow = ourDocShell->GetWindow();
|
2015-05-07 18:43:40 +03:00
|
|
|
if (NS_WARN_IF(!ourWindow)) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-05-07 18:43:40 +03:00
|
|
|
}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsDocShell> docShell = static_cast<nsDocShell*>(ourDocShell.get());
|
2015-08-06 17:03:24 +03:00
|
|
|
|
2015-05-07 18:43:40 +03:00
|
|
|
nsCOMPtr<EventTarget> ourEventTarget = ourWindow->GetParentTarget();
|
|
|
|
|
2015-08-06 17:03:24 +03:00
|
|
|
docShell->SetInFrameSwap(true);
|
|
|
|
|
2015-05-07 18:43:40 +03:00
|
|
|
nsContentUtils::FirePageShowEvent(ourDocShell, ourEventTarget, false);
|
|
|
|
nsContentUtils::FirePageHideEvent(ourDocShell, ourEventTarget);
|
2016-04-29 01:04:52 +03:00
|
|
|
|
|
|
|
// Owner content type may have changed, so store the possibly updated context
|
|
|
|
// and notify others.
|
|
|
|
MaybeInvalidTabContext maybeContext(aContext);
|
|
|
|
if (!maybeContext.IsValid()) {
|
|
|
|
NS_ERROR(nsPrintfCString("Received an invalid TabContext from "
|
|
|
|
"the parent process. (%s)",
|
|
|
|
maybeContext.GetInvalidReason()).get());
|
|
|
|
MOZ_CRASH("Invalid TabContext received from the parent process.");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!UpdateTabContextAfterSwap(maybeContext.GetTabContext())) {
|
|
|
|
MOZ_CRASH("Update to TabContext after swap was denied.");
|
|
|
|
}
|
2016-05-16 06:07:09 +03:00
|
|
|
|
|
|
|
// Since mIsMozBrowserElement may change in UpdateTabContextAfterSwap, so we
|
|
|
|
// call UpdateFrameType here to make sure the frameType on the docshell is
|
|
|
|
// correct.
|
|
|
|
UpdateFrameType();
|
2016-04-29 01:04:52 +03:00
|
|
|
|
|
|
|
// Ignore previous value of mTriedBrowserInit since owner content has changed.
|
|
|
|
mTriedBrowserInit = true;
|
|
|
|
// Initialize the child side of the browser element machinery, if appropriate.
|
2016-10-15 04:46:26 +03:00
|
|
|
if (IsMozBrowser()) {
|
2016-04-29 01:04:52 +03:00
|
|
|
RecvLoadRemoteScript(BROWSER_ELEMENT_CHILD_SCRIPT, true);
|
|
|
|
}
|
|
|
|
|
2015-05-07 18:43:40 +03:00
|
|
|
nsContentUtils::FirePageShowEvent(ourDocShell, ourEventTarget, true);
|
2015-08-06 17:03:24 +03:00
|
|
|
|
|
|
|
docShell->SetInFrameSwap(false);
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-05-07 18:43:40 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-05-11 15:56:42 +03:00
|
|
|
TabChild::RecvHandleAccessKey(const WidgetKeyboardEvent& aEvent,
|
|
|
|
nsTArray<uint32_t>&& aCharCodes,
|
2015-09-18 15:19:13 +03:00
|
|
|
const int32_t& aModifierMask)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDocument> document(GetDocument());
|
|
|
|
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
|
|
|
|
if (presShell) {
|
|
|
|
nsPresContext* pc = presShell->GetPresContext();
|
|
|
|
if (pc) {
|
2016-05-11 15:56:42 +03:00
|
|
|
if (!pc->EventStateManager()->
|
|
|
|
HandleAccessKey(&(const_cast<WidgetKeyboardEvent&>(aEvent)),
|
|
|
|
pc, aCharCodes,
|
|
|
|
aModifierMask, true)) {
|
|
|
|
// If no accesskey was found, inform the parent so that accesskeys on
|
|
|
|
// menus can be handled.
|
|
|
|
WidgetKeyboardEvent localEvent(aEvent);
|
|
|
|
localEvent.mWidget = mPuppetWidget;
|
|
|
|
SendAccessKeyNotHandled(localEvent);
|
|
|
|
}
|
2015-09-18 15:19:13 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-09-18 15:19:13 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-12-11 19:17:33 +03:00
|
|
|
TabChild::RecvAudioChannelChangeNotification(const uint32_t& aAudioChannel,
|
|
|
|
const float& aVolume,
|
|
|
|
const bool& aMuted)
|
|
|
|
{
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(WebNavigation());
|
2015-12-11 19:17:33 +03:00
|
|
|
if (window) {
|
|
|
|
RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
|
|
|
|
MOZ_ASSERT(service);
|
|
|
|
|
|
|
|
service->SetAudioChannelVolume(window,
|
|
|
|
static_cast<AudioChannel>(aAudioChannel),
|
|
|
|
aVolume);
|
|
|
|
service->SetAudioChannelMuted(window,
|
|
|
|
static_cast<AudioChannel>(aAudioChannel),
|
|
|
|
aMuted);
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-12-11 19:17:33 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-03-23 21:39:28 +03:00
|
|
|
TabChild::RecvSetUseGlobalHistory(const bool& aUse)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
|
|
|
|
MOZ_ASSERT(docShell);
|
|
|
|
|
|
|
|
nsresult rv = docShell->SetUseGlobalHistory(aUse);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
NS_WARNING("Failed to set UseGlobalHistory on TabChild docShell");
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-03-23 21:39:28 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-05-25 09:41:54 +03:00
|
|
|
TabChild::RecvPrint(const uint64_t& aOuterWindowID, const PrintData& aPrintData)
|
2016-05-16 12:40:54 +03:00
|
|
|
{
|
|
|
|
#ifdef NS_PRINTING
|
2016-05-25 09:41:54 +03:00
|
|
|
nsGlobalWindow* outerWindow =
|
|
|
|
nsGlobalWindow::GetOuterWindowWithId(aOuterWindowID);
|
|
|
|
if (NS_WARN_IF(!outerWindow)) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-05-25 09:41:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsIWebBrowserPrint> webBrowserPrint =
|
|
|
|
do_GetInterface(outerWindow->AsOuter());
|
2016-05-16 12:40:54 +03:00
|
|
|
if (NS_WARN_IF(!webBrowserPrint)) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-05-16 12:40:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPrintSettingsService> printSettingsSvc =
|
|
|
|
do_GetService("@mozilla.org/gfx/printsettings-service;1");
|
|
|
|
if (NS_WARN_IF(!printSettingsSvc)) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-05-16 12:40:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPrintSettings> printSettings;
|
|
|
|
nsresult rv =
|
|
|
|
printSettingsSvc->GetNewPrintSettings(getter_AddRefs(printSettings));
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-05-16 12:40:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPrintSession> printSession =
|
|
|
|
do_CreateInstance("@mozilla.org/gfx/printsession;1", &rv);
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-05-16 12:40:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
printSettings->SetPrintSession(printSession);
|
|
|
|
printSettingsSvc->DeserializeToPrintSettings(aPrintData, printSettings);
|
|
|
|
rv = webBrowserPrint->Print(printSettings, nullptr);
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-05-16 12:40:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-05-16 12:40:54 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-09-15 22:37:04 +03:00
|
|
|
TabChild::RecvUpdateNativeWindowHandle(const uintptr_t& aNewHandle)
|
|
|
|
{
|
|
|
|
#if defined(XP_WIN) && defined(ACCESSIBILITY)
|
|
|
|
mNativeWindowHandle = aNewHandle;
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-09-15 22:37:04 +03:00
|
|
|
#else
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_FAIL_NO_REASON(this);
|
2016-09-15 22:37:04 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2010-08-06 02:11:23 +04:00
|
|
|
TabChild::RecvDestroy()
|
|
|
|
{
|
2014-08-24 11:16:32 +04:00
|
|
|
MOZ_ASSERT(mDestroyed == false);
|
|
|
|
mDestroyed = true;
|
|
|
|
|
2015-11-09 03:55:08 +03:00
|
|
|
nsTArray<PContentPermissionRequestChild*> childArray =
|
|
|
|
nsContentPermissionUtils::GetContentPermissionRequestChildById(GetTabId());
|
|
|
|
|
|
|
|
// Need to close undeleted ContentPermissionRequestChilds before tab is closed.
|
|
|
|
for (auto& permissionRequestChild : childArray) {
|
|
|
|
auto child = static_cast<RemotePermissionRequest*>(permissionRequestChild);
|
|
|
|
child->Destroy();
|
|
|
|
}
|
|
|
|
|
2015-08-20 00:08:41 +03:00
|
|
|
while (mActiveSuppressDisplayport > 0) {
|
2016-03-10 00:56:54 +03:00
|
|
|
APZCCallbackHelper::SuppressDisplayport(false, nullptr);
|
2015-08-20 00:08:41 +03:00
|
|
|
mActiveSuppressDisplayport--;
|
|
|
|
}
|
|
|
|
|
2011-08-09 23:38:26 +04:00
|
|
|
if (mTabChildGlobal) {
|
2015-02-27 08:35:26 +03:00
|
|
|
// Message handlers are called from the event loop, so it better be safe to
|
|
|
|
// run script.
|
|
|
|
MOZ_ASSERT(nsContentUtils::IsSafeToRunScript());
|
|
|
|
mTabChildGlobal->DispatchTrustedEvent(NS_LITERAL_STRING("unload"));
|
2011-08-09 23:38:26 +04:00
|
|
|
}
|
2010-08-06 02:11:23 +04:00
|
|
|
|
2012-09-29 06:18:18 +04:00
|
|
|
nsCOMPtr<nsIObserverService> observerService =
|
2013-10-21 16:58:12 +04:00
|
|
|
mozilla::services::GetObserverService();
|
2012-09-29 06:18:18 +04:00
|
|
|
|
|
|
|
observerService->RemoveObserver(this, BEFORE_FIRST_PAINT);
|
|
|
|
|
2015-07-10 19:38:44 +03:00
|
|
|
const nsAttrValue::EnumTable* table =
|
|
|
|
AudioChannelService::GetAudioChannelTable();
|
|
|
|
|
|
|
|
nsAutoCString topic;
|
|
|
|
for (uint32_t i = 0; table[i].tag; ++i) {
|
|
|
|
topic.Assign("audiochannel-activity-");
|
|
|
|
topic.Append(table[i].tag);
|
|
|
|
|
|
|
|
observerService->RemoveObserver(this, topic.get());
|
|
|
|
}
|
|
|
|
|
2010-08-12 20:47:22 +04:00
|
|
|
// XXX what other code in ~TabChild() should we be running here?
|
2010-08-21 03:24:40 +04:00
|
|
|
DestroyWindow();
|
2010-08-06 02:11:23 +04:00
|
|
|
|
2014-07-11 22:15:10 +04:00
|
|
|
// Bounce through the event loop once to allow any delayed teardown runnables
|
|
|
|
// that were just generated to have a chance to run.
|
|
|
|
nsCOMPtr<nsIRunnable> deleteRunnable = new DelayedDeleteRunnable(this);
|
2016-03-28 20:28:15 +03:00
|
|
|
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(deleteRunnable));
|
2014-07-11 22:15:10 +04:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2010-08-06 02:11:23 +04:00
|
|
|
}
|
2010-02-20 20:05:20 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-07-23 02:36:45 +03:00
|
|
|
TabChild::RecvSetDocShellIsActive(const bool& aIsActive,
|
|
|
|
const bool& aPreserveLayers,
|
|
|
|
const uint64_t& aLayerObserverEpoch)
|
|
|
|
{
|
|
|
|
// Since SetDocShellIsActive requests come in from both the hang monitor
|
|
|
|
// channel and the PContent channel, we have an ordering problem. This code
|
|
|
|
// ensures that we respect the order in which the requests were made and
|
|
|
|
// ignore stale requests.
|
|
|
|
if (mLayerObserverEpoch >= aLayerObserverEpoch) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-07-23 02:36:45 +03:00
|
|
|
}
|
|
|
|
mLayerObserverEpoch = aLayerObserverEpoch;
|
|
|
|
|
|
|
|
MOZ_ASSERT(mPuppetWidget);
|
|
|
|
MOZ_ASSERT(mPuppetWidget->GetLayerManager());
|
|
|
|
MOZ_ASSERT(mPuppetWidget->GetLayerManager()->GetBackendType() ==
|
|
|
|
LayersBackend::LAYERS_CLIENT);
|
|
|
|
|
2016-10-21 21:56:46 +03:00
|
|
|
auto clearForcePaint = MakeScopeExit([&] {
|
|
|
|
// We might force a paint, or we might already have painted and this is a
|
|
|
|
// no-op. In either case, once we exit this scope, we need to alert the
|
|
|
|
// ProcessHangMonitor that we've finished responding to what might have
|
|
|
|
// been a request to force paint. This is so that the BackgroundHangMonitor
|
|
|
|
// for force painting can be made to wait again.
|
|
|
|
if (aIsActive) {
|
|
|
|
ProcessHangMonitor::ClearForcePaint();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-07-23 02:36:45 +03:00
|
|
|
// We send the current layer observer epoch to the compositor so that
|
|
|
|
// TabParent knows whether a layer update notification corresponds to the
|
|
|
|
// latest SetDocShellIsActive request that was made.
|
2016-11-08 18:42:26 +03:00
|
|
|
if (ClientLayerManager* clm = mPuppetWidget->GetLayerManager()->AsClientLayerManager()) {
|
|
|
|
clm->SetLayerObserverEpoch(aLayerObserverEpoch);
|
|
|
|
}
|
2016-07-23 02:36:45 +03:00
|
|
|
|
|
|
|
// docshell is consider prerendered only if not active yet
|
|
|
|
mIsPrerendered &= !aIsActive;
|
|
|
|
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
|
|
|
|
if (docShell) {
|
|
|
|
bool wasActive;
|
|
|
|
docShell->GetIsActive(&wasActive);
|
|
|
|
if (aIsActive && wasActive) {
|
|
|
|
// This request is a no-op. In this case, we still want a MozLayerTreeReady
|
|
|
|
// notification to fire in the parent (so that it knows that the child has
|
|
|
|
// updated its epoch). ForcePaintNoOp does that.
|
|
|
|
if (IPCOpen()) {
|
|
|
|
Unused << SendForcePaintNoOp(aLayerObserverEpoch);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-07-23 02:36:45 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
docShell->SetIsActive(aIsActive);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aIsActive) {
|
|
|
|
MakeVisible();
|
|
|
|
|
|
|
|
// We don't use TabChildBase::GetPresShell() here because that would create
|
|
|
|
// a content viewer if one doesn't exist yet. Creating a content viewer can
|
|
|
|
// cause JS to run, which we want to avoid. nsIDocShell::GetPresShell
|
|
|
|
// returns null if no content viewer exists yet.
|
|
|
|
if (nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell()) {
|
|
|
|
if (nsIFrame* root = presShell->FrameConstructor()->GetRootFrame()) {
|
|
|
|
FrameLayerBuilder::InvalidateAllLayersForFrame(
|
|
|
|
nsLayoutUtils::GetDisplayRootFrame(root));
|
|
|
|
root->SchedulePaint();
|
|
|
|
}
|
|
|
|
|
2016-10-28 18:48:24 +03:00
|
|
|
Telemetry::AutoTimer<Telemetry::TABCHILD_PAINT_TIME> timer;
|
2016-07-23 02:36:45 +03:00
|
|
|
// If we need to repaint, let's do that right away. No sense waiting until
|
|
|
|
// we get back to the event loop again. We suppress the display port so that
|
|
|
|
// we only paint what's visible. This ensures that the tab we're switching
|
|
|
|
// to paints as quickly as possible.
|
|
|
|
APZCCallbackHelper::SuppressDisplayport(true, presShell);
|
|
|
|
if (nsContentUtils::IsSafeToRunScript()) {
|
|
|
|
WebWidget()->PaintNowIfNeeded();
|
2015-11-10 05:38:21 +03:00
|
|
|
} else {
|
2016-07-23 02:36:45 +03:00
|
|
|
RefPtr<nsViewManager> vm = presShell->GetViewManager();
|
|
|
|
if (nsView* view = vm->GetRootView()) {
|
|
|
|
presShell->Paint(view, view->GetBounds(),
|
2016-10-20 06:32:33 +03:00
|
|
|
nsIPresShell::PAINT_LAYERS);
|
2016-07-23 02:36:45 +03:00
|
|
|
}
|
2015-11-10 05:38:21 +03:00
|
|
|
}
|
2016-07-23 02:36:45 +03:00
|
|
|
APZCCallbackHelper::SuppressDisplayport(false, presShell);
|
2014-02-20 15:26:13 +04:00
|
|
|
}
|
2016-07-23 02:36:45 +03:00
|
|
|
} else if (!aPreserveLayers) {
|
|
|
|
MakeHidden();
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2014-02-20 15:26:13 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-07-23 17:04:15 +03:00
|
|
|
TabChild::RecvNavigateByKey(const bool& aForward, const bool& aForDocumentNavigation)
|
2015-07-13 13:07:49 +03:00
|
|
|
{
|
|
|
|
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
|
|
|
if (fm) {
|
|
|
|
nsCOMPtr<nsIDOMElement> result;
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(WebNavigation());
|
2015-07-13 13:07:49 +03:00
|
|
|
|
|
|
|
// Move to the first or last document.
|
2015-07-23 17:04:15 +03:00
|
|
|
uint32_t type = aForward ?
|
|
|
|
(aForDocumentNavigation ? static_cast<uint32_t>(nsIFocusManager::MOVEFOCUS_FIRSTDOC) :
|
|
|
|
static_cast<uint32_t>(nsIFocusManager::MOVEFOCUS_ROOT)) :
|
|
|
|
(aForDocumentNavigation ? static_cast<uint32_t>(nsIFocusManager::MOVEFOCUS_LASTDOC) :
|
|
|
|
static_cast<uint32_t>(nsIFocusManager::MOVEFOCUS_LAST));
|
|
|
|
fm->MoveFocus(window, nullptr, type,
|
2015-07-13 13:07:49 +03:00
|
|
|
nsIFocusManager::FLAG_BYKEY, getter_AddRefs(result));
|
2015-07-23 17:04:15 +03:00
|
|
|
|
|
|
|
// No valid root element was found, so move to the first focusable element.
|
|
|
|
if (!result && aForward && !aForDocumentNavigation) {
|
|
|
|
fm->MoveFocus(window, nullptr, nsIFocusManager::MOVEFOCUS_FIRST,
|
|
|
|
nsIFocusManager::FLAG_BYKEY, getter_AddRefs(result));
|
|
|
|
}
|
|
|
|
|
2015-07-13 13:07:49 +03:00
|
|
|
SendRequestFocus(false);
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-07-13 13:07:49 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
When PluginInstanceChild receives native key events, it should post the events to the chrome process first for checking if the key combination is reserved. However, posting all key events to the chrome process may make damage to the performance of text input. Therefore, this patch starts to post a key event whose key combination may be a shortcut key. However, for avoiding to shuffle the event order, it posts following key events until all posted key events are handled by the chrome process.
For receiving response from widget, this patch defines nsIKeyEventInPluginCallback. It's specified by nsIWidget::OnWindowedPluginKeyEvent() for ensuring the caller will receive the reply. Basically, the caller of nsIWidget::OnWindowedPluginKeyEvent() should reply to the child process. However, if the widget is a PuppetWidget, it cannot return the result synchronously. Therefore, PuppetWidget::OnWindowedPluginKeyEvent() returns NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY and stores the callback to mKeyEventInPluginCallbacks. Then, TabParent::HandledWindowedPluginKeyEvent() will call PuppetWidget::HandledWindowedPluginKeyEvent().
MozReview-Commit-ID: G6brOU26NwQ
--HG--
extra : rebase_source : 8140456de278956d2d594e85c7b397ae366b4962
2016-04-19 14:09:37 +03:00
|
|
|
TabChild::RecvHandledWindowedPluginKeyEvent(
|
|
|
|
const NativeEventData& aKeyEventData,
|
|
|
|
const bool& aIsConsumed)
|
|
|
|
{
|
|
|
|
if (NS_WARN_IF(!mPuppetWidget)) {
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
When PluginInstanceChild receives native key events, it should post the events to the chrome process first for checking if the key combination is reserved. However, posting all key events to the chrome process may make damage to the performance of text input. Therefore, this patch starts to post a key event whose key combination may be a shortcut key. However, for avoiding to shuffle the event order, it posts following key events until all posted key events are handled by the chrome process.
For receiving response from widget, this patch defines nsIKeyEventInPluginCallback. It's specified by nsIWidget::OnWindowedPluginKeyEvent() for ensuring the caller will receive the reply. Basically, the caller of nsIWidget::OnWindowedPluginKeyEvent() should reply to the child process. However, if the widget is a PuppetWidget, it cannot return the result synchronously. Therefore, PuppetWidget::OnWindowedPluginKeyEvent() returns NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY and stores the callback to mKeyEventInPluginCallbacks. Then, TabParent::HandledWindowedPluginKeyEvent() will call PuppetWidget::HandledWindowedPluginKeyEvent().
MozReview-Commit-ID: G6brOU26NwQ
--HG--
extra : rebase_source : 8140456de278956d2d594e85c7b397ae366b4962
2016-04-19 14:09:37 +03:00
|
|
|
}
|
|
|
|
mPuppetWidget->HandledWindowedPluginKeyEvent(aKeyEventData, aIsConsumed);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
When PluginInstanceChild receives native key events, it should post the events to the chrome process first for checking if the key combination is reserved. However, posting all key events to the chrome process may make damage to the performance of text input. Therefore, this patch starts to post a key event whose key combination may be a shortcut key. However, for avoiding to shuffle the event order, it posts following key events until all posted key events are handled by the chrome process.
For receiving response from widget, this patch defines nsIKeyEventInPluginCallback. It's specified by nsIWidget::OnWindowedPluginKeyEvent() for ensuring the caller will receive the reply. Basically, the caller of nsIWidget::OnWindowedPluginKeyEvent() should reply to the child process. However, if the widget is a PuppetWidget, it cannot return the result synchronously. Therefore, PuppetWidget::OnWindowedPluginKeyEvent() returns NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY and stores the callback to mKeyEventInPluginCallbacks. Then, TabParent::HandledWindowedPluginKeyEvent() will call PuppetWidget::HandledWindowedPluginKeyEvent().
MozReview-Commit-ID: G6brOU26NwQ
--HG--
extra : rebase_source : 8140456de278956d2d594e85c7b397ae366b4962
2016-04-19 14:09:37 +03:00
|
|
|
}
|
|
|
|
|
2010-08-21 03:24:41 +04:00
|
|
|
PRenderFrameChild*
|
2014-11-16 21:23:22 +03:00
|
|
|
TabChild::AllocPRenderFrameChild()
|
2010-08-21 03:24:41 +04:00
|
|
|
{
|
|
|
|
return new RenderFrameChild();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-08 19:48:39 +04:00
|
|
|
TabChild::DeallocPRenderFrameChild(PRenderFrameChild* aFrame)
|
2010-08-21 03:24:41 +04:00
|
|
|
{
|
|
|
|
delete aFrame;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-02-20 20:05:20 +03:00
|
|
|
bool
|
2016-10-19 04:54:12 +03:00
|
|
|
TabChild::InitTabChildGlobal()
|
2010-02-20 20:05:20 +03:00
|
|
|
{
|
2013-06-30 19:00:19 +04:00
|
|
|
if (!mGlobal && !mTabChildGlobal) {
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(WebNavigation());
|
2012-08-29 19:26:18 +04:00
|
|
|
NS_ENSURE_TRUE(window, false);
|
2013-04-20 02:18:32 +04:00
|
|
|
nsCOMPtr<EventTarget> chromeHandler =
|
2012-08-29 19:26:18 +04:00
|
|
|
do_QueryInterface(window->GetChromeEventHandler());
|
|
|
|
NS_ENSURE_TRUE(chromeHandler, false);
|
2010-02-20 20:05:20 +03:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<TabChildGlobal> scope = new TabChildGlobal(this);
|
2012-08-29 19:26:18 +04:00
|
|
|
mTabChildGlobal = scope;
|
2010-02-20 20:05:20 +03:00
|
|
|
|
2013-04-20 02:18:33 +04:00
|
|
|
nsISupports* scopeSupports = NS_ISUPPORTS_CAST(EventTarget*, scope);
|
2012-09-29 06:18:18 +04:00
|
|
|
|
2013-02-20 14:39:59 +04:00
|
|
|
NS_NAMED_LITERAL_CSTRING(globalId, "outOfProcessTabChildGlobal");
|
2015-02-20 04:10:44 +03:00
|
|
|
NS_ENSURE_TRUE(InitChildGlobalInternal(scopeSupports, globalId), false);
|
2010-02-20 20:05:20 +03:00
|
|
|
|
2012-08-29 19:26:18 +04:00
|
|
|
scope->Init();
|
2012-04-27 00:56:46 +04:00
|
|
|
|
2012-08-29 19:26:18 +04:00
|
|
|
nsCOMPtr<nsPIWindowRoot> root = do_QueryInterface(chromeHandler);
|
|
|
|
NS_ENSURE_TRUE(root, false);
|
|
|
|
root->SetParentTarget(scope);
|
|
|
|
}
|
2012-06-22 05:17:52 +04:00
|
|
|
|
2016-10-19 04:54:12 +03:00
|
|
|
if (!mTriedBrowserInit) {
|
2012-08-29 19:26:18 +04:00
|
|
|
mTriedBrowserInit = true;
|
|
|
|
// Initialize the child side of the browser element machinery,
|
|
|
|
// if appropriate.
|
2016-10-15 04:46:26 +03:00
|
|
|
if (IsMozBrowser()) {
|
2013-11-24 09:32:45 +04:00
|
|
|
RecvLoadRemoteScript(BROWSER_ELEMENT_CHILD_SCRIPT, true);
|
2012-08-29 19:26:18 +04:00
|
|
|
}
|
2012-06-22 05:17:52 +04:00
|
|
|
}
|
|
|
|
|
2010-02-20 20:05:20 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-11-15 01:58:22 +03:00
|
|
|
void
|
2015-02-26 16:47:01 +03:00
|
|
|
TabChild::InitRenderingState(const TextureFactoryIdentifier& aTextureFactoryIdentifier,
|
2014-11-16 21:23:22 +03:00
|
|
|
const uint64_t& aLayersId,
|
|
|
|
PRenderFrameChild* aRenderFrame)
|
2010-08-21 03:24:41 +04:00
|
|
|
{
|
2015-06-17 11:44:50 +03:00
|
|
|
mPuppetWidget->InitIMEState();
|
2010-08-21 03:24:41 +04:00
|
|
|
|
2016-11-15 01:58:22 +03:00
|
|
|
if (!aRenderFrame) {
|
|
|
|
NS_WARNING("failed to construct RenderFrame");
|
|
|
|
return;
|
2014-01-16 01:10:39 +04:00
|
|
|
}
|
2010-08-21 03:24:41 +04:00
|
|
|
|
2014-11-16 21:23:22 +03:00
|
|
|
MOZ_ASSERT(aLayersId != 0);
|
|
|
|
mTextureFactoryIdentifier = aTextureFactoryIdentifier;
|
2014-08-22 04:16:44 +04:00
|
|
|
|
|
|
|
// Pushing layers transactions directly to a separate
|
|
|
|
// compositor context.
|
2016-03-22 21:08:38 +03:00
|
|
|
PCompositorBridgeChild* compositorChild = CompositorBridgeChild::Get();
|
2014-08-22 04:16:44 +04:00
|
|
|
if (!compositorChild) {
|
2016-03-22 21:08:38 +03:00
|
|
|
NS_WARNING("failed to get CompositorBridgeChild instance");
|
2016-11-15 01:58:22 +03:00
|
|
|
return;
|
2014-08-22 04:16:44 +04:00
|
|
|
}
|
2010-08-21 03:24:41 +04:00
|
|
|
|
2011-08-09 23:38:26 +04:00
|
|
|
ShadowLayerForwarder* lf =
|
2015-06-17 11:44:50 +03:00
|
|
|
mPuppetWidget->GetLayerManager(
|
2016-11-08 18:42:26 +03:00
|
|
|
nullptr, mTextureFactoryIdentifier.mParentBackend)
|
2015-06-17 11:44:50 +03:00
|
|
|
->AsShadowForwarder();
|
2016-11-08 18:42:26 +03:00
|
|
|
// As long as we are creating a ClientLayerManager for the puppet widget,
|
|
|
|
// lf must be non-null here.
|
|
|
|
MOZ_ASSERT(lf);
|
|
|
|
|
|
|
|
if (lf) {
|
|
|
|
nsTArray<LayersBackend> backends;
|
|
|
|
backends.AppendElement(mTextureFactoryIdentifier.mParentBackend);
|
|
|
|
bool success;
|
|
|
|
PLayerTransactionChild* shadowManager =
|
|
|
|
compositorChild->SendPLayerTransactionConstructor(backends,
|
|
|
|
aLayersId, &mTextureFactoryIdentifier, &success);
|
2016-11-15 01:58:22 +03:00
|
|
|
if (shadowManager && success) {
|
|
|
|
lf->SetShadowManager(shadowManager);
|
|
|
|
lf->IdentifyTextureHost(mTextureFactoryIdentifier);
|
|
|
|
ImageBridgeChild::IdentifyCompositorTextureHost(mTextureFactoryIdentifier);
|
|
|
|
gfx::VRManagerChild::IdentifyTextureHost(mTextureFactoryIdentifier);
|
2016-11-08 18:42:26 +03:00
|
|
|
}
|
|
|
|
}
|
2010-08-21 03:24:41 +04:00
|
|
|
|
2016-11-15 01:58:22 +03:00
|
|
|
mRemoteFrame = static_cast<RenderFrameChild*>(aRenderFrame);
|
2014-11-16 21:23:22 +03:00
|
|
|
if (aLayersId != 0) {
|
2014-03-07 07:24:32 +04:00
|
|
|
if (!sTabChildren) {
|
|
|
|
sTabChildren = new TabChildMap;
|
|
|
|
}
|
2014-11-16 21:23:22 +03:00
|
|
|
MOZ_ASSERT(!sTabChildren->Get(aLayersId));
|
|
|
|
sTabChildren->Put(aLayersId, this);
|
|
|
|
mLayersId = aLayersId;
|
2014-03-07 07:24:32 +04:00
|
|
|
}
|
2012-08-29 19:26:18 +04:00
|
|
|
|
2016-11-29 07:21:27 +03:00
|
|
|
InitAPZState();
|
2016-07-31 22:39:00 +03:00
|
|
|
|
2012-08-29 19:26:18 +04:00
|
|
|
nsCOMPtr<nsIObserverService> observerService =
|
2013-10-21 16:58:12 +04:00
|
|
|
mozilla::services::GetObserverService();
|
2012-08-29 19:26:18 +04:00
|
|
|
|
|
|
|
if (observerService) {
|
|
|
|
observerService->AddObserver(this,
|
2012-09-29 06:18:18 +04:00
|
|
|
BEFORE_FIRST_PAINT,
|
2012-08-29 19:26:18 +04:00
|
|
|
false);
|
|
|
|
}
|
2010-08-21 03:24:41 +04:00
|
|
|
}
|
|
|
|
|
2016-11-29 07:21:27 +03:00
|
|
|
void
|
|
|
|
TabChild::InitAPZState()
|
|
|
|
{
|
|
|
|
auto cbc = CompositorBridgeChild::Get();
|
|
|
|
|
|
|
|
if (!cbc->GetAPZEnabled(mLayersId)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Initialize the ApzcTreeManager. This takes multiple casts because of ugly multiple inheritance.
|
|
|
|
PAPZCTreeManagerChild* baseProtocol = cbc->SendPAPZCTreeManagerConstructor(mLayersId);
|
|
|
|
APZCTreeManagerChild* derivedProtocol = static_cast<APZCTreeManagerChild*>(baseProtocol);
|
|
|
|
|
|
|
|
mApzcTreeManager = RefPtr<IAPZCTreeManager>(derivedProtocol);
|
|
|
|
|
|
|
|
// Initialize the GeckoContentController for this tab. We don't hold a reference because we don't need it.
|
|
|
|
// The ContentProcessController will hold a reference to the tab, and will be destroyed by the compositor or ipdl
|
|
|
|
// during destruction.
|
|
|
|
RefPtr<GeckoContentController> contentController = new ContentProcessController(this);
|
|
|
|
cbc->SendPAPZConstructor(new APZChild(contentController), mLayersId);
|
|
|
|
}
|
|
|
|
|
2012-08-29 19:26:18 +04:00
|
|
|
void
|
|
|
|
TabChild::GetDPI(float* aDPI)
|
|
|
|
{
|
|
|
|
*aDPI = -1.0;
|
|
|
|
if (!mRemoteFrame) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-12-12 20:50:46 +03:00
|
|
|
if (mDPI > 0) {
|
|
|
|
*aDPI = mDPI;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fallback to a sync call if needed.
|
2012-08-29 19:26:18 +04:00
|
|
|
SendGetDPI(aDPI);
|
|
|
|
}
|
|
|
|
|
2013-05-02 03:06:19 +04:00
|
|
|
void
|
|
|
|
TabChild::GetDefaultScale(double* aScale)
|
|
|
|
{
|
|
|
|
*aScale = -1.0;
|
|
|
|
if (!mRemoteFrame) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-12-12 20:50:46 +03:00
|
|
|
if (mDefaultScale > 0) {
|
|
|
|
*aScale = mDefaultScale;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fallback to a sync call if needed.
|
2013-05-02 03:06:19 +04:00
|
|
|
SendGetDefaultScale(aScale);
|
|
|
|
}
|
|
|
|
|
2016-09-27 09:37:07 +03:00
|
|
|
void
|
|
|
|
TabChild::GetWidgetRounding(int32_t* aRounding)
|
|
|
|
{
|
|
|
|
*aRounding = 1;
|
|
|
|
if (!mRemoteFrame) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (mRounding > 0) {
|
|
|
|
*aRounding = mRounding;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fallback to a sync call if needed.
|
|
|
|
SendGetWidgetRounding(aRounding);
|
|
|
|
}
|
|
|
|
|
2015-05-08 04:29:00 +03:00
|
|
|
void
|
|
|
|
TabChild::GetMaxTouchPoints(uint32_t* aTouchPoints)
|
|
|
|
{
|
|
|
|
// Fallback to a sync call.
|
|
|
|
SendGetMaxTouchPoints(aTouchPoints);
|
|
|
|
}
|
|
|
|
|
2012-07-18 03:59:45 +04:00
|
|
|
void
|
|
|
|
TabChild::NotifyPainted()
|
|
|
|
{
|
2014-08-22 04:16:44 +04:00
|
|
|
if (!mNotified) {
|
2012-07-18 03:59:45 +04:00
|
|
|
mRemoteFrame->SendNotifyCompositorTransaction();
|
2012-08-07 07:00:41 +04:00
|
|
|
mNotified = true;
|
2012-07-18 03:59:45 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-08 07:51:55 +04:00
|
|
|
void
|
|
|
|
TabChild::MakeVisible()
|
|
|
|
{
|
2016-07-23 02:36:45 +03:00
|
|
|
if (mPuppetWidget && mPuppetWidget->IsVisible()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-06-17 11:44:50 +03:00
|
|
|
if (mPuppetWidget) {
|
|
|
|
mPuppetWidget->Show(true);
|
2015-05-05 09:32:47 +03:00
|
|
|
}
|
2012-11-08 07:51:55 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TabChild::MakeHidden()
|
|
|
|
{
|
2016-07-23 02:36:45 +03:00
|
|
|
if (mPuppetWidget && !mPuppetWidget->IsVisible()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-03-22 21:08:38 +03:00
|
|
|
CompositorBridgeChild* compositor = CompositorBridgeChild::Get();
|
2016-07-20 07:12:54 +03:00
|
|
|
|
|
|
|
// Clear cached resources directly. This avoids one extra IPC
|
|
|
|
// round-trip from CompositorBridgeChild to CompositorBridgeParent.
|
|
|
|
compositor->RecvClearCachedResources(mLayersId);
|
2015-05-05 09:32:47 +03:00
|
|
|
|
2015-06-17 11:44:50 +03:00
|
|
|
if (mPuppetWidget) {
|
|
|
|
mPuppetWidget->Show(false);
|
2015-05-05 09:32:47 +03:00
|
|
|
}
|
2012-11-08 07:51:55 +04:00
|
|
|
}
|
|
|
|
|
2012-05-28 13:27:25 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChild::GetMessageManager(nsIContentFrameMessageManager** aResult)
|
|
|
|
{
|
|
|
|
if (mTabChildGlobal) {
|
|
|
|
NS_ADDREF(*aResult = mTabChildGlobal);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-07-30 18:20:58 +04:00
|
|
|
*aResult = nullptr;
|
2012-05-28 13:27:25 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2014-09-03 01:43:08 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChild::GetWebBrowserChrome(nsIWebBrowserChrome3** aWebBrowserChrome)
|
|
|
|
{
|
|
|
|
NS_IF_ADDREF(*aWebBrowserChrome = mWebBrowserChrome);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChild::SetWebBrowserChrome(nsIWebBrowserChrome3* aWebBrowserChrome)
|
|
|
|
{
|
|
|
|
mWebBrowserChrome = aWebBrowserChrome;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-11-05 18:16:25 +04:00
|
|
|
void
|
|
|
|
TabChild::SendRequestFocus(bool aCanFocus)
|
|
|
|
{
|
|
|
|
PBrowserChild::SendRequestFocus(aCanFocus);
|
|
|
|
}
|
|
|
|
|
2016-04-14 21:03:00 +03:00
|
|
|
void
|
|
|
|
TabChild::SendGetTabCount(uint32_t* tabCount)
|
|
|
|
{
|
|
|
|
PBrowserChild::SendGetTabCount(tabCount);
|
|
|
|
}
|
|
|
|
|
2014-12-09 18:48:27 +03:00
|
|
|
void
|
|
|
|
TabChild::EnableDisableCommands(const nsAString& aAction,
|
|
|
|
nsTArray<nsCString>& aEnabledCommands,
|
|
|
|
nsTArray<nsCString>& aDisabledCommands)
|
|
|
|
{
|
|
|
|
PBrowserChild::SendEnableDisableCommands(PromiseFlatString(aAction),
|
|
|
|
aEnabledCommands, aDisabledCommands);
|
|
|
|
}
|
|
|
|
|
2015-01-22 12:40:17 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChild::GetTabId(uint64_t* aId)
|
|
|
|
{
|
|
|
|
*aId = GetTabId();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-01-30 12:07:12 +03:00
|
|
|
void
|
|
|
|
TabChild::SetTabId(const TabId& aTabId)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mUniqueId == 0);
|
|
|
|
|
|
|
|
mUniqueId = aTabId;
|
|
|
|
NestedTabChildMap()[mUniqueId] = this;
|
|
|
|
}
|
|
|
|
|
2012-09-28 09:43:12 +04:00
|
|
|
bool
|
2013-10-01 20:15:06 +04:00
|
|
|
TabChild::DoSendBlockingMessage(JSContext* aCx,
|
|
|
|
const nsAString& aMessage,
|
2015-09-10 23:50:58 +03:00
|
|
|
StructuredCloneData& aData,
|
2013-10-01 20:15:06 +04:00
|
|
|
JS::Handle<JSObject *> aCpows,
|
2013-11-06 21:21:15 +04:00
|
|
|
nsIPrincipal* aPrincipal,
|
2015-09-10 23:50:58 +03:00
|
|
|
nsTArray<StructuredCloneData>* aRetVal,
|
2013-10-01 20:15:06 +04:00
|
|
|
bool aIsSync)
|
2010-02-20 20:05:20 +03:00
|
|
|
{
|
2012-08-02 10:02:29 +04:00
|
|
|
ClonedMessageData data;
|
2015-09-10 23:50:58 +03:00
|
|
|
if (!BuildClonedMessageDataForChild(Manager(), aData, data)) {
|
2013-01-24 06:39:27 +04:00
|
|
|
return false;
|
2012-08-02 10:02:29 +04:00
|
|
|
}
|
2013-07-11 02:05:39 +04:00
|
|
|
InfallibleTArray<CpowEntry> cpows;
|
2014-10-07 02:45:42 +04:00
|
|
|
if (aCpows && !Manager()->GetCPOWManager()->Wrap(aCx, aCpows, &cpows)) {
|
2014-09-30 01:11:08 +04:00
|
|
|
return false;
|
2013-07-11 02:05:39 +04:00
|
|
|
}
|
2013-11-06 21:21:15 +04:00
|
|
|
if (aIsSync) {
|
2014-02-25 06:14:22 +04:00
|
|
|
return SendSyncMessage(PromiseFlatString(aMessage), data, cpows,
|
2015-04-30 06:39:59 +03:00
|
|
|
Principal(aPrincipal), aRetVal);
|
2013-11-06 21:21:15 +04:00
|
|
|
}
|
|
|
|
|
2014-10-08 08:32:45 +04:00
|
|
|
return SendRpcMessage(PromiseFlatString(aMessage), data, cpows,
|
2015-04-30 06:39:59 +03:00
|
|
|
Principal(aPrincipal), aRetVal);
|
2010-02-20 20:05:20 +03:00
|
|
|
}
|
|
|
|
|
2015-10-07 13:42:43 +03:00
|
|
|
nsresult
|
2013-07-11 02:05:39 +04:00
|
|
|
TabChild::DoSendAsyncMessage(JSContext* aCx,
|
|
|
|
const nsAString& aMessage,
|
2015-09-10 23:50:58 +03:00
|
|
|
StructuredCloneData& aData,
|
2013-11-06 21:21:15 +04:00
|
|
|
JS::Handle<JSObject *> aCpows,
|
|
|
|
nsIPrincipal* aPrincipal)
|
2012-08-02 10:02:29 +04:00
|
|
|
{
|
|
|
|
ClonedMessageData data;
|
2015-09-10 23:50:58 +03:00
|
|
|
if (!BuildClonedMessageDataForChild(Manager(), aData, data)) {
|
2015-10-07 13:42:43 +03:00
|
|
|
return NS_ERROR_DOM_DATA_CLONE_ERR;
|
2012-08-02 10:02:29 +04:00
|
|
|
}
|
2013-07-11 02:05:39 +04:00
|
|
|
InfallibleTArray<CpowEntry> cpows;
|
2014-10-07 02:45:42 +04:00
|
|
|
if (aCpows && !Manager()->GetCPOWManager()->Wrap(aCx, aCpows, &cpows)) {
|
2015-10-07 13:42:43 +03:00
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
2016-04-09 16:50:59 +03:00
|
|
|
if (!SendAsyncMessage(PromiseFlatString(aMessage), cpows,
|
|
|
|
Principal(aPrincipal), data)) {
|
2015-10-07 13:42:43 +03:00
|
|
|
return NS_ERROR_UNEXPECTED;
|
2013-07-11 02:05:39 +04:00
|
|
|
}
|
2015-10-07 13:42:43 +03:00
|
|
|
return NS_OK;
|
2010-02-20 20:05:20 +03:00
|
|
|
}
|
|
|
|
|
2016-09-20 11:19:32 +03:00
|
|
|
/* static */ nsTArray<RefPtr<TabChild>>
|
|
|
|
TabChild::GetAll()
|
|
|
|
{
|
|
|
|
nsTArray<RefPtr<TabChild>> list;
|
|
|
|
if (!sTabChildren) {
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto iter = sTabChildren->Iter(); !iter.Done(); iter.Next()) {
|
|
|
|
list.AppendElement(iter.Data());
|
|
|
|
}
|
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2013-10-03 00:08:30 +04:00
|
|
|
TabChild*
|
|
|
|
TabChild::GetFrom(nsIPresShell* aPresShell)
|
|
|
|
{
|
|
|
|
nsIDocument* doc = aPresShell->GetDocument();
|
|
|
|
if (!doc) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2013-11-15 20:32:12 +04:00
|
|
|
nsCOMPtr<nsIDocShell> docShell(doc->GetDocShell());
|
2013-10-03 00:08:30 +04:00
|
|
|
return GetFrom(docShell);
|
|
|
|
}
|
|
|
|
|
2014-03-07 07:24:32 +04:00
|
|
|
TabChild*
|
|
|
|
TabChild::GetFrom(uint64_t aLayersId)
|
|
|
|
{
|
|
|
|
if (!sTabChildren) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return sTabChildren->Get(aLayersId);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-08-25 08:51:58 +03:00
|
|
|
TabChild::DidComposite(uint64_t aTransactionId,
|
|
|
|
const TimeStamp& aCompositeStart,
|
|
|
|
const TimeStamp& aCompositeEnd)
|
2014-03-07 07:24:32 +04:00
|
|
|
{
|
2015-06-17 11:44:50 +03:00
|
|
|
MOZ_ASSERT(mPuppetWidget);
|
|
|
|
MOZ_ASSERT(mPuppetWidget->GetLayerManager());
|
|
|
|
MOZ_ASSERT(mPuppetWidget->GetLayerManager()->GetBackendType() ==
|
|
|
|
LayersBackend::LAYERS_CLIENT);
|
2014-03-07 07:24:32 +04:00
|
|
|
|
2016-02-26 01:26:10 +03:00
|
|
|
RefPtr<ClientLayerManager> manager = mPuppetWidget->GetLayerManager()->AsClientLayerManager();
|
2015-08-25 08:51:58 +03:00
|
|
|
|
|
|
|
manager->DidComposite(aTransactionId, aCompositeStart, aCompositeEnd);
|
2014-03-07 07:24:32 +04:00
|
|
|
}
|
|
|
|
|
2015-09-11 08:59:53 +03:00
|
|
|
void
|
|
|
|
TabChild::DidRequestComposite(const TimeStamp& aCompositeReqStart,
|
|
|
|
const TimeStamp& aCompositeReqEnd)
|
|
|
|
{
|
2015-10-22 00:10:05 +03:00
|
|
|
nsCOMPtr<nsIDocShell> docShellComPtr = do_GetInterface(WebNavigation());
|
|
|
|
if (!docShellComPtr) {
|
2015-09-11 08:59:53 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-10-22 00:10:05 +03:00
|
|
|
nsDocShell* docShell = static_cast<nsDocShell*>(docShellComPtr.get());
|
|
|
|
RefPtr<TimelineConsumers> timelines = TimelineConsumers::Get();
|
|
|
|
|
|
|
|
if (timelines && timelines->HasConsumer(docShell)) {
|
2016-10-14 22:01:49 +03:00
|
|
|
// Since we're assuming that it's impossible for content JS to directly
|
|
|
|
// trigger a synchronous paint, we can avoid capturing a stack trace here,
|
|
|
|
// which means we won't run into JS engine reentrancy issues like bug
|
|
|
|
// 1310014.
|
2015-10-22 00:10:05 +03:00
|
|
|
timelines->AddMarkerForDocShell(docShell,
|
2016-10-14 22:01:49 +03:00
|
|
|
"CompositeForwardTransaction", aCompositeReqStart,
|
|
|
|
MarkerTracingType::START, MarkerStackRequest::NO_STACK);
|
2015-10-22 00:10:05 +03:00
|
|
|
timelines->AddMarkerForDocShell(docShell,
|
2016-10-14 22:01:49 +03:00
|
|
|
"CompositeForwardTransaction", aCompositeReqEnd,
|
|
|
|
MarkerTracingType::END, MarkerStackRequest::NO_STACK);
|
2015-10-22 00:10:05 +03:00
|
|
|
}
|
2015-09-11 08:59:53 +03:00
|
|
|
}
|
|
|
|
|
2015-05-05 09:32:47 +03:00
|
|
|
void
|
|
|
|
TabChild::ClearCachedResources()
|
|
|
|
{
|
2015-06-17 11:44:50 +03:00
|
|
|
MOZ_ASSERT(mPuppetWidget);
|
|
|
|
MOZ_ASSERT(mPuppetWidget->GetLayerManager());
|
|
|
|
MOZ_ASSERT(mPuppetWidget->GetLayerManager()->GetBackendType() ==
|
|
|
|
LayersBackend::LAYERS_CLIENT);
|
2015-05-05 09:32:47 +03:00
|
|
|
|
2016-02-29 09:53:14 +03:00
|
|
|
ClientLayerManager *manager = mPuppetWidget->GetLayerManager()->AsClientLayerManager();
|
2015-05-05 09:32:47 +03:00
|
|
|
manager->ClearCachedResources();
|
|
|
|
}
|
|
|
|
|
2016-02-29 09:53:12 +03:00
|
|
|
void
|
|
|
|
TabChild::InvalidateLayers()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mPuppetWidget);
|
|
|
|
MOZ_ASSERT(mPuppetWidget->GetLayerManager());
|
|
|
|
MOZ_ASSERT(mPuppetWidget->GetLayerManager()->GetBackendType() ==
|
|
|
|
LayersBackend::LAYERS_CLIENT);
|
|
|
|
|
|
|
|
RefPtr<LayerManager> lm = mPuppetWidget->GetLayerManager();
|
|
|
|
FrameLayerBuilder::InvalidateAllLayers(lm);
|
|
|
|
}
|
|
|
|
|
2016-09-20 11:19:32 +03:00
|
|
|
void
|
|
|
|
TabChild::ReinitRendering()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mLayersId);
|
|
|
|
|
|
|
|
// Before we establish a new PLayerTransaction, we must connect our layer tree
|
|
|
|
// id, CompositorBridge, and the widget compositor all together again.
|
|
|
|
// Normally this happens in TabParent before TabChild is given rendering
|
|
|
|
// information.
|
|
|
|
//
|
|
|
|
// In this case, we will send a sync message to our TabParent, which in turn
|
|
|
|
// will send a sync message to the Compositor of the widget owning this tab.
|
|
|
|
// This guarantees the correct association is in place before our
|
|
|
|
// PLayerTransaction constructor message arrives on the cross-process
|
|
|
|
// compositor bridge.
|
|
|
|
SendEnsureLayersConnected();
|
|
|
|
|
|
|
|
RefPtr<CompositorBridgeChild> cb = CompositorBridgeChild::Get();
|
|
|
|
|
|
|
|
bool success;
|
|
|
|
nsTArray<LayersBackend> ignored;
|
|
|
|
PLayerTransactionChild* shadowManager =
|
|
|
|
cb->SendPLayerTransactionConstructor(ignored, LayersId(), &mTextureFactoryIdentifier, &success);
|
|
|
|
if (!success) {
|
|
|
|
NS_WARNING("failed to re-allocate layer transaction");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!shadowManager) {
|
|
|
|
NS_WARNING("failed to re-construct LayersChild");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
RefPtr<LayerManager> lm = mPuppetWidget->RecreateLayerManager(shadowManager);
|
|
|
|
ShadowLayerForwarder* lf = lm->AsShadowForwarder();
|
|
|
|
lf->IdentifyTextureHost(mTextureFactoryIdentifier);
|
|
|
|
|
2016-11-29 07:21:27 +03:00
|
|
|
InitAPZState();
|
2016-11-08 05:23:12 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIDocument> doc(GetDocument());
|
|
|
|
doc->NotifyLayerManagerRecreated();
|
2016-09-20 11:19:32 +03:00
|
|
|
}
|
|
|
|
|
2016-02-29 09:53:15 +03:00
|
|
|
void
|
|
|
|
TabChild::CompositorUpdated(const TextureFactoryIdentifier& aNewIdentifier)
|
|
|
|
{
|
|
|
|
RefPtr<LayerManager> lm = mPuppetWidget->GetLayerManager();
|
|
|
|
ClientLayerManager* clm = lm->AsClientLayerManager();
|
2016-11-08 18:42:26 +03:00
|
|
|
MOZ_ASSERT(clm);
|
2016-02-29 09:53:15 +03:00
|
|
|
|
|
|
|
mTextureFactoryIdentifier = aNewIdentifier;
|
|
|
|
clm->UpdateTextureFactoryIdentifier(aNewIdentifier);
|
|
|
|
FrameLayerBuilder::InvalidateAllLayers(clm);
|
|
|
|
}
|
|
|
|
|
2014-01-23 00:27:23 +04:00
|
|
|
NS_IMETHODIMP
|
2016-04-12 23:47:25 +03:00
|
|
|
TabChild::OnShowTooltip(int32_t aXCoords, int32_t aYCoords, const char16_t *aTipText,
|
|
|
|
const char16_t *aTipDir)
|
2014-01-23 00:27:23 +04:00
|
|
|
{
|
|
|
|
nsString str(aTipText);
|
2016-04-12 23:47:25 +03:00
|
|
|
nsString dir(aTipDir);
|
|
|
|
SendShowTooltip(aXCoords, aYCoords, str, dir);
|
2014-01-23 00:27:23 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChild::OnHideTooltip()
|
|
|
|
{
|
|
|
|
SendHideTooltip();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-08-02 10:02:29 +04:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2014-05-23 22:19:00 +04:00
|
|
|
TabChild::RecvRequestNotifyAfterRemotePaint()
|
|
|
|
{
|
2016-03-22 21:08:38 +03:00
|
|
|
// Get the CompositorBridgeChild instance for this content thread.
|
|
|
|
CompositorBridgeChild* compositor = CompositorBridgeChild::Get();
|
2014-05-23 22:19:00 +04:00
|
|
|
|
2016-03-22 21:08:38 +03:00
|
|
|
// Tell the CompositorBridgeChild that, when it gets a RemotePaintIsReady
|
2014-05-23 22:19:00 +04:00
|
|
|
// message that it should forward it us so that we can bounce it to our
|
|
|
|
// RenderFrameParent.
|
|
|
|
compositor->RequestNotifyAfterRemotePaint(this);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2014-05-23 22:19:00 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-09-27 09:37:07 +03:00
|
|
|
TabChild::RecvUIResolutionChanged(const float& aDpi,
|
|
|
|
const int32_t& aRounding,
|
|
|
|
const double& aScale)
|
2014-05-23 18:36:50 +04:00
|
|
|
{
|
2015-06-08 08:39:28 +03:00
|
|
|
ScreenIntSize oldScreenSize = GetInnerSize();
|
2014-12-16 19:25:15 +03:00
|
|
|
mDPI = 0;
|
2016-09-27 09:37:07 +03:00
|
|
|
mRounding = 0;
|
2014-12-16 19:25:15 +03:00
|
|
|
mDefaultScale = 0;
|
2016-09-27 09:37:07 +03:00
|
|
|
static_cast<PuppetWidget*>(mPuppetWidget.get())->UpdateBackingScaleCache(aDpi, aRounding, aScale);
|
2014-05-23 18:36:50 +04:00
|
|
|
nsCOMPtr<nsIDocument> document(GetDocument());
|
|
|
|
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
|
2015-04-22 17:58:33 +03:00
|
|
|
if (presShell) {
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsPresContext> presContext = presShell->GetPresContext();
|
2015-04-22 17:58:33 +03:00
|
|
|
if (presContext) {
|
2015-06-08 08:39:28 +03:00
|
|
|
presContext->UIResolutionChangedSync();
|
2015-04-22 17:58:33 +03:00
|
|
|
}
|
|
|
|
}
|
2015-06-08 08:39:28 +03:00
|
|
|
|
|
|
|
ScreenIntSize screenSize = GetInnerSize();
|
|
|
|
if (mHasValidInnerSize && oldScreenSize != screenSize) {
|
|
|
|
ScreenIntRect screenRect = GetOuterRect();
|
2016-03-08 22:14:43 +03:00
|
|
|
mPuppetWidget->Resize(screenRect.x + mClientOffset.x + mChromeDisp.x,
|
|
|
|
screenRect.y + mClientOffset.y + mChromeDisp.y,
|
2015-06-17 11:44:50 +03:00
|
|
|
screenSize.width, screenSize.height, true);
|
2015-06-08 08:39:28 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(WebNavigation());
|
|
|
|
baseWin->SetPositionAndSize(0, 0, screenSize.width, screenSize.height,
|
2016-05-12 03:07:45 +03:00
|
|
|
nsIBaseWindow::eRepaint);
|
2015-06-08 08:39:28 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-04-22 17:58:33 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-04-22 17:58:33 +03:00
|
|
|
TabChild::RecvThemeChanged(nsTArray<LookAndFeelInt>&& aLookAndFeelIntCache)
|
|
|
|
{
|
|
|
|
LookAndFeel::SetIntCache(aLookAndFeelIntCache);
|
|
|
|
nsCOMPtr<nsIDocument> document(GetDocument());
|
|
|
|
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
|
|
|
|
if (presShell) {
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsPresContext> presContext = presShell->GetPresContext();
|
2015-04-22 17:58:33 +03:00
|
|
|
if (presContext) {
|
|
|
|
presContext->ThemeChanged();
|
|
|
|
}
|
|
|
|
}
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2014-05-23 18:36:50 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-10-21 23:56:51 +03:00
|
|
|
TabChild::RecvSetFreshProcess()
|
|
|
|
{
|
|
|
|
mIsFreshProcess = true;
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-10-21 23:56:51 +03:00
|
|
|
}
|
|
|
|
|
2014-11-12 23:59:19 +03:00
|
|
|
mozilla::plugins::PPluginWidgetChild*
|
|
|
|
TabChild::AllocPPluginWidgetChild()
|
|
|
|
{
|
|
|
|
return new mozilla::plugins::PluginWidgetChild();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
TabChild::DeallocPPluginWidgetChild(mozilla::plugins::PPluginWidgetChild* aActor)
|
|
|
|
{
|
|
|
|
delete aActor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-02-06 00:48:44 +03:00
|
|
|
nsresult
|
|
|
|
TabChild::CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut)
|
2014-11-12 23:59:19 +03:00
|
|
|
{
|
2015-02-06 00:48:44 +03:00
|
|
|
*aOut = nullptr;
|
2014-11-12 23:59:19 +03:00
|
|
|
mozilla::plugins::PluginWidgetChild* child =
|
|
|
|
static_cast<mozilla::plugins::PluginWidgetChild*>(SendPPluginWidgetConstructor());
|
|
|
|
if (!child) {
|
|
|
|
NS_ERROR("couldn't create PluginWidgetChild");
|
2015-02-06 00:48:44 +03:00
|
|
|
return NS_ERROR_UNEXPECTED;
|
2014-11-12 23:59:19 +03:00
|
|
|
}
|
|
|
|
nsCOMPtr<nsIWidget> pluginWidget = nsIWidget::CreatePluginProxyWidget(this, child);
|
|
|
|
if (!pluginWidget) {
|
|
|
|
NS_ERROR("couldn't create PluginWidgetProxy");
|
2015-02-06 00:48:44 +03:00
|
|
|
return NS_ERROR_UNEXPECTED;
|
2014-11-12 23:59:19 +03:00
|
|
|
}
|
|
|
|
|
2014-11-12 23:59:20 +03:00
|
|
|
nsWidgetInitData initData;
|
|
|
|
initData.mWindowType = eWindowType_plugin_ipc_content;
|
|
|
|
initData.mUnicode = false;
|
|
|
|
initData.clipChildren = true;
|
|
|
|
initData.clipSiblings = true;
|
2015-11-16 11:35:18 +03:00
|
|
|
nsresult rv = pluginWidget->Create(aParent, nullptr,
|
|
|
|
LayoutDeviceIntRect(0, 0, 0, 0),
|
|
|
|
&initData);
|
2014-11-12 23:59:19 +03:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
NS_WARNING("Creating native plugin widget on the chrome side failed.");
|
|
|
|
}
|
2015-02-06 00:48:44 +03:00
|
|
|
pluginWidget.forget(aOut);
|
|
|
|
return rv;
|
2014-11-12 23:59:19 +03:00
|
|
|
}
|
|
|
|
|
2015-06-08 08:39:28 +03:00
|
|
|
ScreenIntSize
|
|
|
|
TabChild::GetInnerSize()
|
|
|
|
{
|
|
|
|
LayoutDeviceIntSize innerSize =
|
2015-06-17 11:44:50 +03:00
|
|
|
RoundedToInt(mUnscaledInnerSize * mPuppetWidget->GetDefaultScale());
|
2015-06-08 08:39:28 +03:00
|
|
|
return ViewAs<ScreenPixel>(innerSize, PixelCastJustification::LayoutDeviceIsScreenForTabDims);
|
|
|
|
};
|
|
|
|
|
|
|
|
ScreenIntRect
|
|
|
|
TabChild::GetOuterRect()
|
|
|
|
{
|
|
|
|
LayoutDeviceIntRect outerRect =
|
2015-06-17 11:44:50 +03:00
|
|
|
RoundedToInt(mUnscaledOuterRect * mPuppetWidget->GetDefaultScale());
|
2015-06-08 08:39:28 +03:00
|
|
|
return ViewAs<ScreenPixel>(outerRect, PixelCastJustification::LayoutDeviceIsScreenForTabDims);
|
|
|
|
}
|
|
|
|
|
2016-07-23 02:36:45 +03:00
|
|
|
void
|
|
|
|
TabChild::ForcePaint(uint64_t aLayerObserverEpoch)
|
|
|
|
{
|
2016-09-21 02:02:37 +03:00
|
|
|
if (!IPCOpen()) {
|
|
|
|
// Don't bother doing anything now. Better to wait until we receive the
|
|
|
|
// message on the PContent channel.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-07-23 02:36:45 +03:00
|
|
|
nsAutoScriptBlocker scriptBlocker;
|
|
|
|
RecvSetDocShellIsActive(true, false, aLayerObserverEpoch);
|
|
|
|
}
|
|
|
|
|
2016-12-15 08:28:40 +03:00
|
|
|
already_AddRefed<nsISHistory>
|
|
|
|
TabChild::GetRelatedSHistory()
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsISHistory> shistory;
|
|
|
|
mWebNav->GetSessionHistory(getter_AddRefs(shistory));
|
|
|
|
return shistory.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
TabChildSHistoryListener::SHistoryDidUpdate(bool aTruncate /* = false */)
|
|
|
|
{
|
|
|
|
RefPtr<TabChild> tabChild(mTabChild);
|
|
|
|
if (NS_WARN_IF(!tabChild)) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsISHistory> shistory = tabChild->GetRelatedSHistory();
|
|
|
|
NS_ENSURE_TRUE(shistory, NS_ERROR_FAILURE);
|
|
|
|
|
|
|
|
int32_t index, count;
|
|
|
|
nsresult rv = shistory->GetIndex(&index);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
rv = shistory->GetCount(&count);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
// XXX: It would be nice if we could batch these updates like SessionStore
|
|
|
|
// does, and provide a form of `Flush` command which would allow us to trigger
|
|
|
|
// an update, and wait for the state to become consistent.
|
|
|
|
NS_ENSURE_TRUE(tabChild->SendSHistoryUpdate(count, index, aTruncate), NS_ERROR_FAILURE);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2016-11-04 21:13:52 +03:00
|
|
|
mozilla::dom::TabGroup*
|
|
|
|
TabChild::TabGroup()
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(WebNavigation());
|
|
|
|
MOZ_ASSERT(window);
|
|
|
|
return window->TabGroup();
|
|
|
|
}
|
|
|
|
|
2016-10-14 10:31:02 +03:00
|
|
|
/*******************************************************************************
|
|
|
|
* nsISHistoryListener
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChildSHistoryListener::OnHistoryNewEntry(nsIURI *aNewURI, int32_t aOldIndex)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChildSHistoryListener::OnHistoryGoBack(nsIURI *aBackURI, bool *_retval)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChildSHistoryListener::OnHistoryGoForward(nsIURI *aForwardURI, bool *_retval)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChildSHistoryListener::OnHistoryReload(nsIURI *aReloadURI, uint32_t aReloadFlags, bool *_retval)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChildSHistoryListener::OnHistoryGotoIndex(int32_t aIndex, nsIURI *aGotoURI, bool *_retval)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChildSHistoryListener::OnHistoryPurge(int32_t aNumEntries, bool *_retval)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChildSHistoryListener::OnHistoryReplaceEntry(int32_t aIndex)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2016-12-15 08:28:40 +03:00
|
|
|
TabChildSHistoryListener::OnLengthChanged(int32_t aCount)
|
2016-10-14 10:31:02 +03:00
|
|
|
{
|
2016-12-15 08:28:40 +03:00
|
|
|
return SHistoryDidUpdate(/* aTruncate = */ true);
|
|
|
|
}
|
2016-10-14 10:31:02 +03:00
|
|
|
|
2016-12-15 08:28:40 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChildSHistoryListener::OnIndexChanged(int32_t aIndex)
|
|
|
|
{
|
|
|
|
return SHistoryDidUpdate(/* aTruncate = */ false);
|
2016-10-14 10:31:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChildSHistoryListener::OnRequestCrossBrowserNavigation(uint32_t aIndex)
|
|
|
|
{
|
|
|
|
RefPtr<TabChild> tabChild(mTabChild);
|
|
|
|
if (!tabChild) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return tabChild->SendRequestCrossBrowserNavigation(aIndex) ?
|
|
|
|
NS_OK : NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2014-03-25 06:28:46 +04:00
|
|
|
TabChildGlobal::TabChildGlobal(TabChildBase* aTabChild)
|
2010-02-20 20:05:20 +03:00
|
|
|
: mTabChild(aTabChild)
|
|
|
|
{
|
2014-10-15 13:43:25 +04:00
|
|
|
SetIsNotDOMBinding();
|
2012-04-27 00:56:46 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 01:23:17 +04:00
|
|
|
TabChildGlobal::~TabChildGlobal()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-04-27 00:56:46 +04:00
|
|
|
void
|
|
|
|
TabChildGlobal::Init()
|
|
|
|
{
|
|
|
|
NS_ASSERTION(!mMessageManager, "Re-initializing?!?");
|
2012-09-28 09:43:12 +04:00
|
|
|
mMessageManager = new nsFrameMessageManager(mTabChild,
|
2012-07-30 18:20:58 +04:00
|
|
|
nullptr,
|
2012-09-28 09:43:12 +04:00
|
|
|
MM_CHILD);
|
2010-02-20 20:05:20 +03:00
|
|
|
}
|
|
|
|
|
2015-05-07 10:05:43 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(TabChildGlobal)
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(TabChildGlobal,
|
|
|
|
DOMEventTargetHelper)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mMessageManager);
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTabChild);
|
|
|
|
tmp->UnlinkHostObjectURIs();
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(TabChildGlobal,
|
|
|
|
DOMEventTargetHelper)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMessageManager)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTabChild)
|
|
|
|
tmp->TraverseHostObjectURIs(cb);
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
2010-02-20 20:05:20 +03:00
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TabChildGlobal)
|
2012-08-27 18:13:02 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIMessageListenerManager)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIMessageSender)
|
2010-08-31 22:58:35 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISyncMessageSender)
|
2010-02-20 20:05:20 +03:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIContentFrameMessageManager)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
|
2013-12-12 05:51:56 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)
|
2015-01-18 06:17:06 +03:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
2010-02-20 20:05:20 +03:00
|
|
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ContentFrameMessageManager)
|
2014-04-01 10:13:50 +04:00
|
|
|
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
|
2010-02-20 20:05:20 +03:00
|
|
|
|
2014-04-01 10:13:50 +04:00
|
|
|
NS_IMPL_ADDREF_INHERITED(TabChildGlobal, DOMEventTargetHelper)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(TabChildGlobal, DOMEventTargetHelper)
|
2010-02-20 20:05:20 +03:00
|
|
|
|
2012-08-09 12:33:38 +04:00
|
|
|
// This method isn't automatically forwarded safely because it's notxpcom, so
|
|
|
|
// the IDL binding doesn't know what value to return.
|
|
|
|
NS_IMETHODIMP_(bool)
|
|
|
|
TabChildGlobal::MarkForCC()
|
|
|
|
{
|
2015-02-25 01:23:53 +03:00
|
|
|
if (mTabChild) {
|
|
|
|
mTabChild->MarkScopesForCC();
|
|
|
|
}
|
2015-07-11 16:45:49 +03:00
|
|
|
EventListenerManager* elm = GetExistingListenerManager();
|
|
|
|
if (elm) {
|
|
|
|
elm->MarkForCC();
|
|
|
|
}
|
2012-08-09 12:33:38 +04:00
|
|
|
return mMessageManager ? mMessageManager->MarkForCC() : false;
|
|
|
|
}
|
|
|
|
|
2010-02-20 20:05:20 +03:00
|
|
|
NS_IMETHODIMP
|
2016-01-30 20:05:36 +03:00
|
|
|
TabChildGlobal::GetContent(mozIDOMWindowProxy** aContent)
|
2010-02-20 20:05:20 +03:00
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
*aContent = nullptr;
|
2010-07-22 03:23:03 +04:00
|
|
|
if (!mTabChild)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(mTabChild->WebNavigation());
|
|
|
|
window.forget(aContent);
|
2010-02-20 20:05:20 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2010-03-03 23:30:25 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
TabChildGlobal::GetDocShell(nsIDocShell** aDocShell)
|
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
*aDocShell = nullptr;
|
2010-05-12 13:52:15 +04:00
|
|
|
if (!mTabChild)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
2010-03-03 23:30:25 +03:00
|
|
|
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(mTabChild->WebNavigation());
|
|
|
|
docShell.swap(*aDocShell);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-12-12 05:51:56 +04:00
|
|
|
nsIPrincipal*
|
2010-02-20 20:05:20 +03:00
|
|
|
TabChildGlobal::GetPrincipal()
|
|
|
|
{
|
2010-05-12 13:52:15 +04:00
|
|
|
if (!mTabChild)
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2010-02-20 20:05:20 +03:00
|
|
|
return mTabChild->GetPrincipal();
|
2012-09-13 07:50:40 +04:00
|
|
|
}
|
2013-12-12 05:51:56 +04:00
|
|
|
|
|
|
|
JSObject*
|
|
|
|
TabChildGlobal::GetGlobalJSObject()
|
|
|
|
{
|
|
|
|
NS_ENSURE_TRUE(mTabChild, nullptr);
|
|
|
|
nsCOMPtr<nsIXPConnectJSObjectHolder> ref = mTabChild->GetGlobal();
|
|
|
|
NS_ENSURE_TRUE(ref, nullptr);
|
|
|
|
return ref->GetJSObject();
|
|
|
|
}
|