mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
be4fef94e8
- Bug 711670: Setup the Mac Application Delegate earlier to respond to URLs clicked in external applications when updates are pending. r=mstange (2471469680) - Bug 1252889: On Windows use a 10 second pause instead of trying to invoke the JIT debugger with MOZ_DEBUG_CHILD_PROCESS. r=jimm (228cd75e4d) - Bug 1253850: On Windows change MOZ_DEBUG_CHILD_PROCESS back to JIT and add MOZ_DEBUG_CHILD_PAUSE for a 10 second pause. r=mchang (83cdaec0a7) - Bug 1259809 - Make CrashReporter::InitChildProcessTmpDir conditional on MOZ_CRASHREPORTER. r=aklotz (19672176dd) - Bug 1176703 - attempt to fix define issues with some compilers/envs, rs=me, CLOSED TREE, bustage (8e6f3a6b94) - Bug 1266292 - Remove unnecessary compiler checks for MSVS 2010 in gfx/2d/. r=bas (9c3acd9f5d) - Bug 1195788 - Set arithmetic composite clamp to true for D2D filter node. r=bas (5ba4191512) - Bug 1248223 - verify that stroke widths are finite for Skia. r=jmuizelaar (1f676f5c24) - Bug 1241918 - remove workarounds for zero-length dash intervals in HelpersSkia.h, r=jrmuizel (ce0665ab77) - crashreporter includes (c64d834706) - Add a driver crash guard to D3D11 DXVA. (bug 1253666, r=mattwoodrow) (8589eef61b) - Bug 1189918 - Theme overrides should work in safe mode for comm-central applications too. r=bsmedberg (535486b4c0) - Disable the WebGL crash guard on Android. (bug 1256371, r=snorp) a=merge (855cc66aef) - Bug 1265273 - Add two missing get_PBrowserParent() null checks. r=jimm. (b5f9ac0967) - Bug 1261599 - null check SendPBrowserConstructor return in ContentParent to avoid crashes on content process shutdown. r=smaug (28e2ad71b5) - Fix D3D11VideoCrashGuard missing a switch case in ContentParent. (bug 1263725, r=mattwoodrow) (07a5b63633) - Bug 1216371 - Load default theme from XPI in safe mode. r=bsmedberg (596bc54a13) - Bug 1216371 - Load default theme from XPI in safe mode. r=bsmedberg (596bc54a13) - Bug 1162965 - Use /dev/shm instead of /tmp for sandbox chroot if possible. r=kang (4fa3c77756) - Bug 1264226: Don't use '_COARSE' Posix clocks if not defined, r=jld (a173b195eb) - Bug 1259273 - Add sys_unlink to seccomp-bpf whitelist. r=jld (72ca2626f6) - Bug 1259283 - Add sys_fchown to seccomp whitelist. r=jld (628f3cd627) - Bug 1253194: Suppress -Wimplicit-fallthrough clang warning for intentional fallthrough in icu_utf.cc (which is imported code). r=bobowen (a503963ff2) - Bug 1257031 - Return more informative error code when encountering invalid integers rather than SEC_ERROR_BAD_DER. r=keeler (7f4955614a) - Bug 1153446 - Replace instances of double spacing with single spacing in nsserrors.properties. r=dkeeler (166f0bd1c4) - Bug 1256530 - Fix compiler warnings about casting to larger size. r=hsivonen (53020d1543) - Bug 1251235 - changed from naked pointers to UniquePtr to prevent resource leak. r=froydnj (953040a377) - Bug 1264887: |nsWifiScannerDBus|: Hold DBusConnection reference in |RefPtr|, r=josh (3d8b9b3f52) - Bug 1212056 - Add virtual dtor to WindowsWifiScannerInterface. r=jdm (ce00cf01e9) - code style (d7fea73856) - Bug 1222170 - fix initialization order in ScopedWLANObject; r=jimm (b515ea0273) - Bug 1204919 - Build osx_corewlan.mm with -Wno-error=objc-method-access to avoid bustage on some machines in warnings-on-errors builds. r=glandium. (f88b02868d) - Bug 1204277 - Disallow warnings in six more directories. r=glandium. (7e249cf4ab) - Bug 1248761 - Destroy VRHMDInfo objects on the compositor thread r=daoshengmu (ccf6af1fec) - Bug 1260530 - Add support for Oculus 1.3 runtime r=daoshengmu (f7ed5abb4f) - Bug 1242005 - Disable C4359 to allow compilation on VS2015; r=kip (71db7148f4) - Bug 1176158 - "Remove unused lang atoms (ko-xxx and x-symbol)" r=vladimir (25e46d1150) - Bug 1176158 - Part 2. Remove unused ko_xxx and x_symbols from gfxGDIFontList. r=jdaggett (9b213333e0) - Bug 1262304 - Add a pref to dump display lists for the content process. r=BenWa (c0a4e56542) - Bug 1180942 - Use cairo's image backend for drawing on linux. r=jrmuizel (83deed801b) - Bug 1254400 - Handle device reset for d3d9. r=dvander (170aaeb272) - Bug 1254400 - Make access to d3d9 device manager thread-safe. r=dvander (a6112d8b84) - Bug 1256547: When the DWM is disabled don't force presentation. r=milan (0fe31bfc50) - Bug 1229988 - verify that reference draw target is created after device reset and log failure in gfxWindowsPlatform::UpdateRenderMode. r=milan (32084a6688) - Bug 1250669. Don't init dwrite fonts if content device creation fails. r=dvander (4a55599c8b) - Include vendor and device ids in content process DXGI adapter matching. (bug 1228905, r=jrmuizel) (c9403d3798) - Bug 1233576. Ensure vsync timestamps are monotonic on Windows 10. r=kats (d075fb7230) - Bug 1249036 Check that DWMFlush executes correctly. r=kats (f460b09853) - Bug 1259248. Follow up to fix static analysis bustage (ab462300ff) - Bug 1259248. Add a comment about mfbt/Range.h (a78f7c2110) - Bug 1262681 - Draw target also has to be valid for us to demand a snapshot. r=bas (c4c0bfcaca) - Bug 1258313 - Allow snapping of 'pseudo' 3d transforms. r=jrmuizel (fc85ac9147) - Bug 1241060 - Skip non-2d sibling layers when calculating plugin window clipping under e10s. r=mstange (fc6836ab11) - Bug 1257288 - Have APZ hit testing respect scroll clips. r=kats (5f8db91909) - Bug 1255961 - Avoid zeroing out shmems (r=dvander) (cc0e856f83) - Bug 1251523 - Remove TextureFlags::DEALLOCATE_CLIENT from AndroidSurfaceTextureData r=nical (406a27e229) - Regenerate SyncObjects on device resets. (bug 1255711, r=bas) (8a83c23cdf) - Bug 1240659 - Add GonkNativeHandle::CreateDupNhObj() r=nical (3da777655e) - Bug 1238602 - Update ParamTraits<GonkNativeHandle>::Read() r=nical (969f8177fd) - Bug 1248923 - Store result in Update ParamTraits<GonkNativeHandle>::Read() r=nical (0052a996a0)
371 lines
10 KiB
C++
371 lines
10 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* 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/. */
|
|
|
|
#include "mozilla/dom/TabContext.h"
|
|
#include "mozilla/dom/PTabContext.h"
|
|
#include "mozilla/dom/TabParent.h"
|
|
#include "mozilla/dom/TabChild.h"
|
|
#include "nsIAppsService.h"
|
|
#include "nsIScriptSecurityManager.h"
|
|
#include "nsServiceManagerUtils.h"
|
|
|
|
#define NO_APP_ID (nsIScriptSecurityManager::NO_APP_ID)
|
|
|
|
using namespace mozilla::dom::ipc;
|
|
using namespace mozilla::layout;
|
|
|
|
namespace mozilla {
|
|
namespace dom {
|
|
|
|
TabContext::TabContext()
|
|
: mInitialized(false)
|
|
, mContainingAppId(NO_APP_ID)
|
|
, mOriginAttributes()
|
|
{
|
|
}
|
|
|
|
bool
|
|
TabContext::IsBrowserElement() const
|
|
{
|
|
return mOriginAttributes.mInBrowser;
|
|
}
|
|
|
|
bool
|
|
TabContext::IsBrowserOrApp() const
|
|
{
|
|
return HasOwnApp() || IsBrowserElement();
|
|
}
|
|
|
|
uint32_t
|
|
TabContext::OwnAppId() const
|
|
{
|
|
return mOriginAttributes.mAppId;
|
|
}
|
|
|
|
already_AddRefed<mozIApplication>
|
|
TabContext::GetOwnApp() const
|
|
{
|
|
nsCOMPtr<mozIApplication> ownApp = mOwnApp;
|
|
return ownApp.forget();
|
|
}
|
|
|
|
bool
|
|
TabContext::HasOwnApp() const
|
|
{
|
|
nsCOMPtr<mozIApplication> ownApp = GetOwnApp();
|
|
return !!ownApp;
|
|
}
|
|
|
|
uint32_t
|
|
TabContext::BrowserOwnerAppId() const
|
|
{
|
|
if (IsBrowserElement()) {
|
|
return mContainingAppId;
|
|
}
|
|
return NO_APP_ID;
|
|
}
|
|
|
|
already_AddRefed<mozIApplication>
|
|
TabContext::GetBrowserOwnerApp() const
|
|
{
|
|
nsCOMPtr<mozIApplication> ownerApp;
|
|
if (IsBrowserElement()) {
|
|
ownerApp = mContainingApp;
|
|
}
|
|
return ownerApp.forget();
|
|
}
|
|
|
|
bool
|
|
TabContext::HasBrowserOwnerApp() const
|
|
{
|
|
nsCOMPtr<mozIApplication> ownerApp = GetBrowserOwnerApp();
|
|
return !!ownerApp;
|
|
}
|
|
|
|
uint32_t
|
|
TabContext::AppOwnerAppId() const
|
|
{
|
|
if (HasOwnApp()) {
|
|
return mContainingAppId;
|
|
}
|
|
return NO_APP_ID;
|
|
}
|
|
|
|
already_AddRefed<mozIApplication>
|
|
TabContext::GetAppOwnerApp() const
|
|
{
|
|
nsCOMPtr<mozIApplication> ownerApp;
|
|
if (HasOwnApp()) {
|
|
ownerApp = mContainingApp;
|
|
}
|
|
return ownerApp.forget();
|
|
}
|
|
|
|
bool
|
|
TabContext::HasAppOwnerApp() const
|
|
{
|
|
nsCOMPtr<mozIApplication> ownerApp = GetAppOwnerApp();
|
|
return !!ownerApp;
|
|
}
|
|
|
|
uint32_t
|
|
TabContext::OwnOrContainingAppId() const
|
|
{
|
|
if (HasOwnApp()) {
|
|
return mOriginAttributes.mAppId;
|
|
}
|
|
|
|
return mContainingAppId;
|
|
}
|
|
|
|
already_AddRefed<mozIApplication>
|
|
TabContext::GetOwnOrContainingApp() const
|
|
{
|
|
nsCOMPtr<mozIApplication> ownOrContainingApp;
|
|
if (HasOwnApp()) {
|
|
ownOrContainingApp = mOwnApp;
|
|
} else {
|
|
ownOrContainingApp = mContainingApp;
|
|
}
|
|
|
|
return ownOrContainingApp.forget();
|
|
}
|
|
|
|
bool
|
|
TabContext::HasOwnOrContainingApp() const
|
|
{
|
|
nsCOMPtr<mozIApplication> ownOrContainingApp = GetOwnOrContainingApp();
|
|
return !!ownOrContainingApp;
|
|
}
|
|
|
|
bool
|
|
TabContext::SetTabContext(const TabContext& aContext)
|
|
{
|
|
NS_ENSURE_FALSE(mInitialized, false);
|
|
|
|
*this = aContext;
|
|
mInitialized = true;
|
|
|
|
return true;
|
|
}
|
|
|
|
const OriginAttributes&
|
|
TabContext::OriginAttributesRef() const
|
|
{
|
|
return mOriginAttributes;
|
|
}
|
|
|
|
const nsACString&
|
|
TabContext::SignedPkgOriginNoSuffix() const
|
|
{
|
|
return mSignedPkgOriginNoSuffix;
|
|
}
|
|
|
|
bool
|
|
TabContext::SetTabContext(mozIApplication* aOwnApp,
|
|
mozIApplication* aAppFrameOwnerApp,
|
|
const OriginAttributes& aOriginAttributes,
|
|
const nsACString& aSignedPkgOriginNoSuffix)
|
|
{
|
|
NS_ENSURE_FALSE(mInitialized, false);
|
|
|
|
// Get ids for both apps and only write to our member variables after we've
|
|
// verified that this worked.
|
|
uint32_t ownAppId = NO_APP_ID;
|
|
if (aOwnApp) {
|
|
nsresult rv = aOwnApp->GetLocalId(&ownAppId);
|
|
NS_ENSURE_SUCCESS(rv, false);
|
|
NS_ENSURE_TRUE(ownAppId != NO_APP_ID, false);
|
|
}
|
|
|
|
uint32_t containingAppId = NO_APP_ID;
|
|
if (aAppFrameOwnerApp) {
|
|
nsresult rv = aAppFrameOwnerApp->GetLocalId(&containingAppId);
|
|
NS_ENSURE_SUCCESS(rv, false);
|
|
NS_ENSURE_TRUE(containingAppId != NO_APP_ID, false);
|
|
}
|
|
|
|
// Veryify that app id matches mAppId passed in originAttributes
|
|
MOZ_RELEASE_ASSERT((aOwnApp && aOriginAttributes.mAppId == ownAppId) ||
|
|
(aAppFrameOwnerApp && aOriginAttributes.mAppId == containingAppId) ||
|
|
aOriginAttributes.mAppId == NO_APP_ID);
|
|
|
|
mInitialized = true;
|
|
mOriginAttributes = aOriginAttributes;
|
|
mContainingAppId = containingAppId;
|
|
mOwnApp = aOwnApp;
|
|
mContainingApp = aAppFrameOwnerApp;
|
|
mSignedPkgOriginNoSuffix = aSignedPkgOriginNoSuffix;
|
|
return true;
|
|
}
|
|
|
|
IPCTabContext
|
|
TabContext::AsIPCTabContext() const
|
|
{
|
|
nsAutoCString originSuffix;
|
|
mOriginAttributes.CreateSuffix(originSuffix);
|
|
return IPCTabContext(FrameIPCTabContext(originSuffix,
|
|
mContainingAppId,
|
|
mSignedPkgOriginNoSuffix));
|
|
}
|
|
|
|
static already_AddRefed<mozIApplication>
|
|
GetAppForId(uint32_t aAppId)
|
|
{
|
|
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
|
|
NS_ENSURE_TRUE(appsService, nullptr);
|
|
|
|
nsCOMPtr<mozIApplication> app;
|
|
appsService->GetAppByLocalId(aAppId, getter_AddRefs(app));
|
|
|
|
return app.forget();
|
|
}
|
|
|
|
MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
|
|
: mInvalidReason(nullptr)
|
|
{
|
|
uint32_t containingAppId = NO_APP_ID;
|
|
OriginAttributes originAttributes = OriginAttributes();
|
|
nsAutoCString originSuffix;
|
|
nsAutoCString signedPkgOriginNoSuffix;
|
|
|
|
switch(aParams.type()) {
|
|
case IPCTabContext::TPopupIPCTabContext: {
|
|
const PopupIPCTabContext &ipcContext = aParams.get_PopupIPCTabContext();
|
|
|
|
TabContext *context;
|
|
if (ipcContext.opener().type() == PBrowserOrId::TPBrowserParent) {
|
|
context = TabParent::GetFrom(ipcContext.opener().get_PBrowserParent());
|
|
if (!context) {
|
|
mInvalidReason = "Child is-browser process tried to "
|
|
"open a null tab.";
|
|
return;
|
|
}
|
|
if (context->IsBrowserElement() && !ipcContext.isBrowserElement()) {
|
|
// If the TabParent corresponds to a browser element, then it can only
|
|
// open other browser elements, for security reasons. We should have
|
|
// checked this before calling the TabContext constructor, so this is
|
|
// a fatal error.
|
|
mInvalidReason = "Child is-browser process tried to "
|
|
"open a non-browser tab.";
|
|
return;
|
|
}
|
|
} else if (ipcContext.opener().type() == PBrowserOrId::TPBrowserChild) {
|
|
context = static_cast<TabChild*>(ipcContext.opener().get_PBrowserChild());
|
|
} else if (ipcContext.opener().type() == PBrowserOrId::TTabId) {
|
|
// We should never get here because this PopupIPCTabContext is only
|
|
// used for allocating a new tab id, not for allocating a PBrowser.
|
|
mInvalidReason = "Child process tried to open an tab without the opener information.";
|
|
return;
|
|
} else {
|
|
// This should be unreachable because PopupIPCTabContext::opener is not a
|
|
// nullable field.
|
|
mInvalidReason = "PopupIPCTabContext::opener was null (?!).";
|
|
return;
|
|
}
|
|
|
|
// Browser elements can't nest other browser elements. So if
|
|
// our opener is browser element, we must be a new DOM window
|
|
// opened by it. In that case we inherit our containing app ID
|
|
// (if any).
|
|
//
|
|
// Otherwise, we're a new app window and we inherit from our
|
|
// opener app.
|
|
|
|
// FIXME bug 1212250 - use InheritFromDocToChildDocshell instead
|
|
// of copying attributes directly.
|
|
originAttributes = context->mOriginAttributes;
|
|
if (ipcContext.isBrowserElement()) {
|
|
containingAppId = context->OwnOrContainingAppId();
|
|
} else {
|
|
containingAppId = context->mContainingAppId;
|
|
}
|
|
break;
|
|
}
|
|
case IPCTabContext::TFrameIPCTabContext: {
|
|
const FrameIPCTabContext &ipcContext =
|
|
aParams.get_FrameIPCTabContext();
|
|
|
|
containingAppId = ipcContext.frameOwnerAppId();
|
|
signedPkgOriginNoSuffix = ipcContext.signedPkgOriginNoSuffix();
|
|
originSuffix = ipcContext.originSuffix();
|
|
originAttributes.PopulateFromSuffix(originSuffix);
|
|
break;
|
|
}
|
|
case IPCTabContext::TUnsafeIPCTabContext: {
|
|
// XXXcatalinb: This used *only* by ServiceWorkerClients::OpenWindow.
|
|
// It is meant as a temporary solution until service workers can
|
|
// provide a TabChild equivalent. Don't allow this on b2g since
|
|
// it might be used to escalate privileges.
|
|
#ifdef MOZ_B2G
|
|
mInvalidReason = "ServiceWorkerClients::OpenWindow is not supported.";
|
|
return;
|
|
#endif
|
|
if (!Preferences::GetBool("dom.serviceWorkers.enabled", false)) {
|
|
mInvalidReason = "ServiceWorkers should be enabled.";
|
|
return;
|
|
}
|
|
|
|
containingAppId = NO_APP_ID;
|
|
break;
|
|
}
|
|
default: {
|
|
MOZ_CRASH();
|
|
}
|
|
}
|
|
|
|
nsCOMPtr<mozIApplication> ownApp;
|
|
if (!originAttributes.mInBrowser) {
|
|
// mAppId corresponds to OwnOrContainingAppId; if mInBrowser is
|
|
// false then it's ownApp otherwise it's containingApp
|
|
ownApp = GetAppForId(originAttributes.mAppId);
|
|
if ((ownApp == nullptr) != (originAttributes.mAppId == NO_APP_ID)) {
|
|
mInvalidReason = "Got an ownAppId that didn't correspond to an app.";
|
|
return;
|
|
}
|
|
}
|
|
|
|
nsCOMPtr<mozIApplication> containingApp = GetAppForId(containingAppId);
|
|
if ((containingApp == nullptr) != (containingAppId == NO_APP_ID)) {
|
|
mInvalidReason = "Got a containingAppId that didn't correspond to an app.";
|
|
return;
|
|
}
|
|
|
|
bool rv;
|
|
rv = mTabContext.SetTabContext(ownApp,
|
|
containingApp,
|
|
originAttributes,
|
|
signedPkgOriginNoSuffix);
|
|
if (!rv) {
|
|
mInvalidReason = "Couldn't initialize TabContext.";
|
|
}
|
|
}
|
|
|
|
bool
|
|
MaybeInvalidTabContext::IsValid()
|
|
{
|
|
return mInvalidReason == nullptr;
|
|
}
|
|
|
|
const char*
|
|
MaybeInvalidTabContext::GetInvalidReason()
|
|
{
|
|
return mInvalidReason;
|
|
}
|
|
|
|
const TabContext&
|
|
MaybeInvalidTabContext::GetTabContext()
|
|
{
|
|
if (!IsValid()) {
|
|
MOZ_CRASH("Can't GetTabContext() if !IsValid().");
|
|
}
|
|
|
|
return mTabContext;
|
|
}
|
|
|
|
} // namespace dom
|
|
} // namespace mozilla
|