mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 22:28:36 +00:00
39a4e30ae8
- pointer style (db52d9c32) - Bug 1158407 - Stop using this one weird allocation fallback for MCreateThisWithTemplate. (r=terrence) (5b489cd5d) - Bug 1170124 - Remove unnecessary type monitoring in jit::InvokeFunction. r=bhackett (1603ee063) - Bug 1141865 - Part 2: Plumb new.target on the stack and make it accessible to JSNatives. (r=jorendorff, r=jandem, r=shu) (25cfa92ec) - Bug 1129795 - Convert rest of docshell/ to Gecko style. r=mccr8 (20acc2d82) - Bug 1162309 - Part 1: Remove instances of #ifdef PR_LOGGING in uriloader. r=froydnj (8768f60c0) - Bug 1162309 - Part 2: Remove instances of #ifdef PR_LOGGING in docshell. r=froydnj (e9de046f3) - Bug 1096908 - forward network security messages to the content process; r=hurley (69b38e624) - Bug 1156493 - e10s: move .cacheKey to nsICacheInfoChannel so child channels can get/set it, r=jduell (507efbe2b) - Bug 1017758 - Use infallible getters for appId/isInBrowserElement/unknownAppId; r=bz (8021f0ae8)
188 lines
4.2 KiB
C++
188 lines
4.2 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/Assertions.h"
|
|
#include "mozilla/LoadContext.h"
|
|
|
|
namespace mozilla {
|
|
|
|
NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor)
|
|
|
|
LoadContext::LoadContext(nsIPrincipal* aPrincipal,
|
|
nsILoadContext* aOptionalBase)
|
|
: mTopFrameElement(nullptr)
|
|
, mNestedFrameId(0)
|
|
, mIsContent(true)
|
|
, mUsePrivateBrowsing(false)
|
|
, mUseRemoteTabs(false)
|
|
#ifdef DEBUG
|
|
, mIsNotNull(true)
|
|
#endif
|
|
{
|
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aPrincipal->GetAppId(&mAppId)));
|
|
MOZ_ALWAYS_TRUE(
|
|
NS_SUCCEEDED(aPrincipal->GetIsInBrowserElement(&mIsInBrowserElement)));
|
|
|
|
if (!aOptionalBase) {
|
|
return;
|
|
}
|
|
|
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aOptionalBase->GetIsContent(&mIsContent)));
|
|
MOZ_ALWAYS_TRUE(
|
|
NS_SUCCEEDED(aOptionalBase->GetUsePrivateBrowsing(&mUsePrivateBrowsing)));
|
|
MOZ_ALWAYS_TRUE(
|
|
NS_SUCCEEDED(aOptionalBase->GetUseRemoteTabs(&mUseRemoteTabs)));
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// LoadContext::nsILoadContext
|
|
//-----------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP
|
|
LoadContext::GetAssociatedWindow(nsIDOMWindow**)
|
|
{
|
|
MOZ_ASSERT(mIsNotNull);
|
|
|
|
// can't support this in the parent process
|
|
return NS_ERROR_UNEXPECTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
LoadContext::GetTopWindow(nsIDOMWindow**)
|
|
{
|
|
MOZ_ASSERT(mIsNotNull);
|
|
|
|
// can't support this in the parent process
|
|
return NS_ERROR_UNEXPECTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
LoadContext::GetTopFrameElement(nsIDOMElement** aElement)
|
|
{
|
|
nsCOMPtr<nsIDOMElement> element = do_QueryReferent(mTopFrameElement);
|
|
element.forget(aElement);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
LoadContext::GetNestedFrameId(uint64_t* aId)
|
|
{
|
|
NS_ENSURE_ARG(aId);
|
|
*aId = mNestedFrameId;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
LoadContext::IsAppOfType(uint32_t, bool*)
|
|
{
|
|
MOZ_ASSERT(mIsNotNull);
|
|
|
|
// don't expect we need this in parent (Thunderbird/SeaMonkey specific?)
|
|
return NS_ERROR_UNEXPECTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
LoadContext::GetIsContent(bool* aIsContent)
|
|
{
|
|
MOZ_ASSERT(mIsNotNull);
|
|
|
|
NS_ENSURE_ARG_POINTER(aIsContent);
|
|
|
|
*aIsContent = mIsContent;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
LoadContext::GetUsePrivateBrowsing(bool* aUsePrivateBrowsing)
|
|
{
|
|
MOZ_ASSERT(mIsNotNull);
|
|
|
|
NS_ENSURE_ARG_POINTER(aUsePrivateBrowsing);
|
|
|
|
*aUsePrivateBrowsing = mUsePrivateBrowsing;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
LoadContext::SetUsePrivateBrowsing(bool aUsePrivateBrowsing)
|
|
{
|
|
MOZ_ASSERT(mIsNotNull);
|
|
|
|
// We shouldn't need this on parent...
|
|
return NS_ERROR_UNEXPECTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
LoadContext::SetPrivateBrowsing(bool aUsePrivateBrowsing)
|
|
{
|
|
MOZ_ASSERT(mIsNotNull);
|
|
|
|
// We shouldn't need this on parent...
|
|
return NS_ERROR_UNEXPECTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
LoadContext::GetUseRemoteTabs(bool* aUseRemoteTabs)
|
|
{
|
|
MOZ_ASSERT(mIsNotNull);
|
|
|
|
NS_ENSURE_ARG_POINTER(aUseRemoteTabs);
|
|
|
|
*aUseRemoteTabs = mUseRemoteTabs;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
LoadContext::SetRemoteTabs(bool aUseRemoteTabs)
|
|
{
|
|
MOZ_ASSERT(mIsNotNull);
|
|
|
|
// We shouldn't need this on parent...
|
|
return NS_ERROR_UNEXPECTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
LoadContext::GetIsInBrowserElement(bool* aIsInBrowserElement)
|
|
{
|
|
MOZ_ASSERT(mIsNotNull);
|
|
|
|
NS_ENSURE_ARG_POINTER(aIsInBrowserElement);
|
|
|
|
*aIsInBrowserElement = mIsInBrowserElement;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
LoadContext::GetAppId(uint32_t* aAppId)
|
|
{
|
|
MOZ_ASSERT(mIsNotNull);
|
|
|
|
NS_ENSURE_ARG_POINTER(aAppId);
|
|
|
|
*aAppId = mAppId;
|
|
return NS_OK;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// LoadContext::nsIInterfaceRequestor
|
|
//-----------------------------------------------------------------------------
|
|
NS_IMETHODIMP
|
|
LoadContext::GetInterface(const nsIID& aIID, void** aResult)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(aResult);
|
|
*aResult = nullptr;
|
|
|
|
if (aIID.Equals(NS_GET_IID(nsILoadContext))) {
|
|
*aResult = static_cast<nsILoadContext*>(this);
|
|
NS_ADDREF_THIS();
|
|
return NS_OK;
|
|
}
|
|
|
|
return NS_NOINTERFACE;
|
|
}
|
|
|
|
} // namespace mozilla
|