зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1489454 - Remove all trailing whitespaces (again) r=Ehsan
This also includes moving some files to the regular format. Differential Revision: https://phabricator.services.mozilla.com/D5249 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
c9c6290890
Коммит
aa37bde79b
|
@ -142,7 +142,7 @@ public:
|
|||
* with a value of "true".
|
||||
*/
|
||||
static bool IsDOMAttrTrue(const Accessible* aAccessible, nsAtom* aAttr);
|
||||
|
||||
|
||||
/**
|
||||
* Return true if the DOM node of given accessible has aria-selected="true"
|
||||
* attribute.
|
||||
|
|
|
@ -2516,7 +2516,7 @@ DocAccessible::ARIAActiveDescendantIDMaybeMoved(dom::Element* aElm)
|
|||
if (!acc) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// The active descendant might have just been inserted and may not be in the
|
||||
// tree yet. Therefore, schedule this async to ensure the tree is up to date.
|
||||
mNotificationController->ScheduleNotification<DocAccessible, Accessible>
|
||||
|
|
|
@ -1,183 +1,183 @@
|
|||
/* -*- 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/. */
|
||||
|
||||
#if defined(MOZILLA_INTERNAL_API)
|
||||
#error This code is NOT for internal Gecko use!
|
||||
#endif // defined(MOZILLA_INTERNAL_API)
|
||||
|
||||
#include "HandlerChildEnumerator.h"
|
||||
#include "HandlerTextLeaf.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
HandlerChildEnumerator::HandlerChildEnumerator(AccessibleHandler* aHandler,
|
||||
IGeckoBackChannel* aGeckoBackChannel)
|
||||
: mHandler(aHandler)
|
||||
, mGeckoBackChannel(aGeckoBackChannel)
|
||||
, mChildCount(0)
|
||||
, mNextChild(0)
|
||||
{
|
||||
MOZ_ASSERT(aHandler);
|
||||
MOZ_ASSERT(aGeckoBackChannel);
|
||||
}
|
||||
|
||||
HandlerChildEnumerator::HandlerChildEnumerator(
|
||||
const HandlerChildEnumerator& aEnumerator)
|
||||
: mHandler(aEnumerator.mHandler)
|
||||
, mGeckoBackChannel(aEnumerator.mGeckoBackChannel)
|
||||
, mChildCount(aEnumerator.mChildCount)
|
||||
, mNextChild(aEnumerator.mNextChild)
|
||||
{
|
||||
if (mChildCount == 0) {
|
||||
return;
|
||||
}
|
||||
mChildren = MakeUnique<VARIANT[]>(mChildCount);
|
||||
CopyMemory(mChildren.get(), aEnumerator.mChildren.get(),
|
||||
sizeof(VARIANT) * mChildCount);
|
||||
for (ULONG index = 0; index < mChildCount; ++index) {
|
||||
mChildren[index].pdispVal->AddRef();
|
||||
}
|
||||
}
|
||||
|
||||
HandlerChildEnumerator::~HandlerChildEnumerator()
|
||||
{
|
||||
ClearCache();
|
||||
}
|
||||
|
||||
void
|
||||
HandlerChildEnumerator::ClearCache()
|
||||
{
|
||||
if (!mChildren) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ULONG index = 0; index < mChildCount; ++index) {
|
||||
mChildren[index].pdispVal->Release();
|
||||
}
|
||||
|
||||
mChildren = nullptr;
|
||||
mChildCount = 0;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerChildEnumerator::MaybeCacheChildren()
|
||||
{
|
||||
if (mChildren) {
|
||||
// Already cached.
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
AccChildData* children;
|
||||
HRESULT hr = mGeckoBackChannel->get_AllChildren(&children, &mChildCount);
|
||||
if (FAILED(hr)) {
|
||||
mChildCount = 0;
|
||||
ClearCache();
|
||||
return hr;
|
||||
}
|
||||
|
||||
HWND hwnd = nullptr;
|
||||
hr = mHandler->get_windowHandle(&hwnd);
|
||||
MOZ_ASSERT(SUCCEEDED(hr));
|
||||
|
||||
RefPtr<IDispatch> parent;
|
||||
hr = mHandler->QueryInterface(IID_IDispatch, getter_AddRefs(parent));
|
||||
MOZ_ASSERT(SUCCEEDED(hr));
|
||||
|
||||
mChildren = MakeUnique<VARIANT[]>(mChildCount);
|
||||
for (ULONG index = 0; index < mChildCount; ++index) {
|
||||
AccChildData& data = children[index];
|
||||
VARIANT& child = mChildren[index];
|
||||
if (data.mAccessible) {
|
||||
RefPtr<IDispatch> disp;
|
||||
hr = data.mAccessible->QueryInterface(IID_IDispatch,
|
||||
getter_AddRefs(disp));
|
||||
data.mAccessible->Release();
|
||||
MOZ_ASSERT(SUCCEEDED(hr));
|
||||
if (FAILED(hr)) {
|
||||
child.vt = VT_EMPTY;
|
||||
continue;
|
||||
}
|
||||
child.vt = VT_DISPATCH;
|
||||
disp.forget(&child.pdispVal);
|
||||
} else {
|
||||
// Text leaf.
|
||||
RefPtr<IDispatch> leaf(
|
||||
new HandlerTextLeaf(parent, index, hwnd, data));
|
||||
child.vt = VT_DISPATCH;
|
||||
leaf.forget(&child.pdispVal);
|
||||
}
|
||||
}
|
||||
|
||||
::CoTaskMemFree(children);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
IMPL_IUNKNOWN_QUERY_HEAD(HandlerChildEnumerator)
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(IEnumVARIANT)
|
||||
IMPL_IUNKNOWN_QUERY_TAIL_AGGREGATED(mHandler)
|
||||
|
||||
/*** IEnumVARIANT ***/
|
||||
|
||||
HRESULT
|
||||
HandlerChildEnumerator::Clone(IEnumVARIANT** aPpEnum)
|
||||
{
|
||||
RefPtr<HandlerChildEnumerator> newEnum(new HandlerChildEnumerator(*this));
|
||||
newEnum.forget(aPpEnum);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerChildEnumerator::Next(ULONG aCelt, VARIANT* aRgVar,
|
||||
ULONG* aPCeltFetched)
|
||||
{
|
||||
if (!aRgVar || aCelt == 0) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
HRESULT hr = MaybeCacheChildren();
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
for (ULONG index = 0; index < aCelt; ++index) {
|
||||
if (mNextChild >= mChildCount) {
|
||||
// Less elements remaining than were requested.
|
||||
if (aPCeltFetched) {
|
||||
*aPCeltFetched = index;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
aRgVar[index] = mChildren[mNextChild];
|
||||
aRgVar[index].pdispVal->AddRef();
|
||||
++mNextChild;
|
||||
}
|
||||
*aPCeltFetched = aCelt;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerChildEnumerator::Reset()
|
||||
{
|
||||
mNextChild = 0;
|
||||
ClearCache();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerChildEnumerator::Skip(ULONG aCelt)
|
||||
{
|
||||
mNextChild += aCelt;
|
||||
if (mNextChild > mChildCount) {
|
||||
// Less elements remaining than the client requested to skip.
|
||||
return S_FALSE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
/* -*- 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/. */
|
||||
|
||||
#if defined(MOZILLA_INTERNAL_API)
|
||||
#error This code is NOT for internal Gecko use!
|
||||
#endif // defined(MOZILLA_INTERNAL_API)
|
||||
|
||||
#include "HandlerChildEnumerator.h"
|
||||
#include "HandlerTextLeaf.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
HandlerChildEnumerator::HandlerChildEnumerator(AccessibleHandler* aHandler,
|
||||
IGeckoBackChannel* aGeckoBackChannel)
|
||||
: mHandler(aHandler)
|
||||
, mGeckoBackChannel(aGeckoBackChannel)
|
||||
, mChildCount(0)
|
||||
, mNextChild(0)
|
||||
{
|
||||
MOZ_ASSERT(aHandler);
|
||||
MOZ_ASSERT(aGeckoBackChannel);
|
||||
}
|
||||
|
||||
HandlerChildEnumerator::HandlerChildEnumerator(
|
||||
const HandlerChildEnumerator& aEnumerator)
|
||||
: mHandler(aEnumerator.mHandler)
|
||||
, mGeckoBackChannel(aEnumerator.mGeckoBackChannel)
|
||||
, mChildCount(aEnumerator.mChildCount)
|
||||
, mNextChild(aEnumerator.mNextChild)
|
||||
{
|
||||
if (mChildCount == 0) {
|
||||
return;
|
||||
}
|
||||
mChildren = MakeUnique<VARIANT[]>(mChildCount);
|
||||
CopyMemory(mChildren.get(), aEnumerator.mChildren.get(),
|
||||
sizeof(VARIANT) * mChildCount);
|
||||
for (ULONG index = 0; index < mChildCount; ++index) {
|
||||
mChildren[index].pdispVal->AddRef();
|
||||
}
|
||||
}
|
||||
|
||||
HandlerChildEnumerator::~HandlerChildEnumerator()
|
||||
{
|
||||
ClearCache();
|
||||
}
|
||||
|
||||
void
|
||||
HandlerChildEnumerator::ClearCache()
|
||||
{
|
||||
if (!mChildren) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ULONG index = 0; index < mChildCount; ++index) {
|
||||
mChildren[index].pdispVal->Release();
|
||||
}
|
||||
|
||||
mChildren = nullptr;
|
||||
mChildCount = 0;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerChildEnumerator::MaybeCacheChildren()
|
||||
{
|
||||
if (mChildren) {
|
||||
// Already cached.
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
AccChildData* children;
|
||||
HRESULT hr = mGeckoBackChannel->get_AllChildren(&children, &mChildCount);
|
||||
if (FAILED(hr)) {
|
||||
mChildCount = 0;
|
||||
ClearCache();
|
||||
return hr;
|
||||
}
|
||||
|
||||
HWND hwnd = nullptr;
|
||||
hr = mHandler->get_windowHandle(&hwnd);
|
||||
MOZ_ASSERT(SUCCEEDED(hr));
|
||||
|
||||
RefPtr<IDispatch> parent;
|
||||
hr = mHandler->QueryInterface(IID_IDispatch, getter_AddRefs(parent));
|
||||
MOZ_ASSERT(SUCCEEDED(hr));
|
||||
|
||||
mChildren = MakeUnique<VARIANT[]>(mChildCount);
|
||||
for (ULONG index = 0; index < mChildCount; ++index) {
|
||||
AccChildData& data = children[index];
|
||||
VARIANT& child = mChildren[index];
|
||||
if (data.mAccessible) {
|
||||
RefPtr<IDispatch> disp;
|
||||
hr = data.mAccessible->QueryInterface(IID_IDispatch,
|
||||
getter_AddRefs(disp));
|
||||
data.mAccessible->Release();
|
||||
MOZ_ASSERT(SUCCEEDED(hr));
|
||||
if (FAILED(hr)) {
|
||||
child.vt = VT_EMPTY;
|
||||
continue;
|
||||
}
|
||||
child.vt = VT_DISPATCH;
|
||||
disp.forget(&child.pdispVal);
|
||||
} else {
|
||||
// Text leaf.
|
||||
RefPtr<IDispatch> leaf(
|
||||
new HandlerTextLeaf(parent, index, hwnd, data));
|
||||
child.vt = VT_DISPATCH;
|
||||
leaf.forget(&child.pdispVal);
|
||||
}
|
||||
}
|
||||
|
||||
::CoTaskMemFree(children);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
IMPL_IUNKNOWN_QUERY_HEAD(HandlerChildEnumerator)
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(IEnumVARIANT)
|
||||
IMPL_IUNKNOWN_QUERY_TAIL_AGGREGATED(mHandler)
|
||||
|
||||
/*** IEnumVARIANT ***/
|
||||
|
||||
HRESULT
|
||||
HandlerChildEnumerator::Clone(IEnumVARIANT** aPpEnum)
|
||||
{
|
||||
RefPtr<HandlerChildEnumerator> newEnum(new HandlerChildEnumerator(*this));
|
||||
newEnum.forget(aPpEnum);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerChildEnumerator::Next(ULONG aCelt, VARIANT* aRgVar,
|
||||
ULONG* aPCeltFetched)
|
||||
{
|
||||
if (!aRgVar || aCelt == 0) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
HRESULT hr = MaybeCacheChildren();
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
for (ULONG index = 0; index < aCelt; ++index) {
|
||||
if (mNextChild >= mChildCount) {
|
||||
// Less elements remaining than were requested.
|
||||
if (aPCeltFetched) {
|
||||
*aPCeltFetched = index;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
aRgVar[index] = mChildren[mNextChild];
|
||||
aRgVar[index].pdispVal->AddRef();
|
||||
++mNextChild;
|
||||
}
|
||||
*aPCeltFetched = aCelt;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerChildEnumerator::Reset()
|
||||
{
|
||||
mNextChild = 0;
|
||||
ClearCache();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerChildEnumerator::Skip(ULONG aCelt)
|
||||
{
|
||||
mNextChild += aCelt;
|
||||
if (mNextChild > mChildCount) {
|
||||
// Less elements remaining than the client requested to skip.
|
||||
return S_FALSE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -1,402 +1,402 @@
|
|||
/* -*- 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/. */
|
||||
|
||||
#if defined(MOZILLA_INTERNAL_API)
|
||||
#error This code is NOT for internal Gecko use!
|
||||
#endif // defined(MOZILLA_INTERNAL_API)
|
||||
|
||||
#include "HandlerTextLeaf.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
HandlerTextLeaf::HandlerTextLeaf(IDispatch* aParent,
|
||||
long aIndexInParent, HWND aHwnd,
|
||||
AccChildData& aData)
|
||||
: mParent(aParent)
|
||||
, mIndexInParent(aIndexInParent)
|
||||
, mHwnd(aHwnd)
|
||||
, mData(aData)
|
||||
{
|
||||
MOZ_ASSERT(aParent);
|
||||
}
|
||||
|
||||
HandlerTextLeaf::~HandlerTextLeaf()
|
||||
{
|
||||
if (mData.mText) {
|
||||
::SysFreeString(mData.mText);
|
||||
}
|
||||
}
|
||||
|
||||
IMPL_IUNKNOWN_QUERY_HEAD(HandlerTextLeaf)
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(IDispatch)
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(IAccessible)
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(IAccessible2)
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(IServiceProvider)
|
||||
IMPL_IUNKNOWN_QUERY_TAIL
|
||||
|
||||
/*** IDispatch ***/
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::GetTypeInfoCount(UINT *pctinfo)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/* -*- 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/. */
|
||||
|
||||
#if defined(MOZILLA_INTERNAL_API)
|
||||
#error This code is NOT for internal Gecko use!
|
||||
#endif // defined(MOZILLA_INTERNAL_API)
|
||||
|
||||
#include "HandlerTextLeaf.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
HandlerTextLeaf::HandlerTextLeaf(IDispatch* aParent,
|
||||
long aIndexInParent, HWND aHwnd,
|
||||
AccChildData& aData)
|
||||
: mParent(aParent)
|
||||
, mIndexInParent(aIndexInParent)
|
||||
, mHwnd(aHwnd)
|
||||
, mData(aData)
|
||||
{
|
||||
MOZ_ASSERT(aParent);
|
||||
}
|
||||
|
||||
HandlerTextLeaf::~HandlerTextLeaf()
|
||||
{
|
||||
if (mData.mText) {
|
||||
::SysFreeString(mData.mText);
|
||||
}
|
||||
}
|
||||
|
||||
IMPL_IUNKNOWN_QUERY_HEAD(HandlerTextLeaf)
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(IDispatch)
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(IAccessible)
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(IAccessible2)
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(IServiceProvider)
|
||||
IMPL_IUNKNOWN_QUERY_TAIL
|
||||
|
||||
/*** IDispatch ***/
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::GetTypeInfoCount(UINT *pctinfo)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
|
||||
{
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames,
|
||||
HandlerTextLeaf::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames,
|
||||
LCID lcid, DISPID *rgDispId)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
|
||||
WORD wFlags, DISPPARAMS *pDispParams,
|
||||
VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
|
||||
HandlerTextLeaf::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
|
||||
WORD wFlags, DISPPARAMS *pDispParams,
|
||||
VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
|
||||
UINT *puArgErr)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/*** IAccessible ***/
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/*** IAccessible ***/
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_accParent(IDispatch **ppdispParent)
|
||||
{
|
||||
if (!ppdispParent) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
RefPtr<IDispatch> parent(mParent);
|
||||
parent.forget(ppdispParent);
|
||||
{
|
||||
if (!ppdispParent) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
RefPtr<IDispatch> parent(mParent);
|
||||
parent.forget(ppdispParent);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_accChildCount(long *pcountChildren)
|
||||
{
|
||||
if (!pcountChildren) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*pcountChildren = 0;
|
||||
{
|
||||
if (!pcountChildren) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*pcountChildren = 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_accChild(VARIANT varChild, IDispatch **ppdispChild)
|
||||
{
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_accName(VARIANT varChild, BSTR *pszName)
|
||||
{
|
||||
if (varChild.lVal != CHILDID_SELF || !pszName) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*pszName = CopyBSTR(mData.mText);
|
||||
{
|
||||
if (varChild.lVal != CHILDID_SELF || !pszName) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*pszName = CopyBSTR(mData.mText);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_accValue(VARIANT varChild, BSTR *pszValue)
|
||||
{
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_accDescription(VARIANT varChild, BSTR *pszDescription)
|
||||
{
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_accRole(VARIANT varChild, VARIANT *pvarRole)
|
||||
{
|
||||
if (varChild.lVal != CHILDID_SELF || !pvarRole) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
pvarRole->vt = VT_I4;
|
||||
pvarRole->lVal = mData.mTextRole;
|
||||
{
|
||||
if (varChild.lVal != CHILDID_SELF || !pvarRole) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
pvarRole->vt = VT_I4;
|
||||
pvarRole->lVal = mData.mTextRole;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_accState(VARIANT varChild, VARIANT *pvarState)
|
||||
{
|
||||
if (varChild.lVal != CHILDID_SELF || !pvarState) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
pvarState->vt = VT_I4;
|
||||
pvarState->lVal = mData.mTextState;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (varChild.lVal != CHILDID_SELF || !pvarState) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
pvarState->vt = VT_I4;
|
||||
pvarState->lVal = mData.mTextState;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_accHelp(VARIANT varChild, BSTR *pszHelp)
|
||||
{
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_accHelpTopic(BSTR *pszHelpFile, VARIANT varChild,
|
||||
HandlerTextLeaf::get_accHelpTopic(BSTR *pszHelpFile, VARIANT varChild,
|
||||
long *pidTopic)
|
||||
{
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_accKeyboardShortcut(VARIANT varChild,
|
||||
HandlerTextLeaf::get_accKeyboardShortcut(VARIANT varChild,
|
||||
BSTR *pszKeyboardShortcut)
|
||||
{
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_accFocus(VARIANT *pvarChild)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_accSelection(VARIANT *pvarChildren)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_accDefaultAction(VARIANT varChild,
|
||||
HandlerTextLeaf::get_accDefaultAction(VARIANT varChild,
|
||||
BSTR *pszDefaultAction)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::accSelect(long flagsSelect, VARIANT varChild)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::accLocation(long *pxLeft, long *pyTop, long *pcxWidth,
|
||||
long *pcyHeight, VARIANT varChild)
|
||||
{
|
||||
if (varChild.lVal != CHILDID_SELF || !pxLeft || !pyTop || !pcxWidth ||
|
||||
!pcyHeight) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*pxLeft = mData.mTextLeft;
|
||||
*pyTop = mData.mTextTop;
|
||||
*pcxWidth = mData.mTextWidth;
|
||||
*pcyHeight = mData.mTextHeight;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::accNavigate(long navDir, VARIANT varStart,
|
||||
VARIANT *pvarEndUpAt)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::accLocation(long *pxLeft, long *pyTop, long *pcxWidth,
|
||||
long *pcyHeight, VARIANT varChild)
|
||||
{
|
||||
if (varChild.lVal != CHILDID_SELF || !pxLeft || !pyTop || !pcxWidth ||
|
||||
!pcyHeight) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*pxLeft = mData.mTextLeft;
|
||||
*pyTop = mData.mTextTop;
|
||||
*pcxWidth = mData.mTextWidth;
|
||||
*pcyHeight = mData.mTextHeight;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::accNavigate(long navDir, VARIANT varStart,
|
||||
VARIANT *pvarEndUpAt)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::accHitTest( long xLeft, long yTop, VARIANT *pvarChild)
|
||||
{
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::accDoDefaultAction(VARIANT varChild)
|
||||
{
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::put_accName(VARIANT varChild, BSTR szName)
|
||||
{
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::put_accValue(VARIANT varChild, BSTR szValue)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/*** IAccessible2 ***/
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/*** IAccessible2 ***/
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_nRelations(long* nRelations)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_relation(long relationIndex,
|
||||
HandlerTextLeaf::get_relation(long relationIndex,
|
||||
IAccessibleRelation** relation)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_relations(long maxRelations,
|
||||
IAccessibleRelation** relations,
|
||||
HandlerTextLeaf::get_relations(long maxRelations,
|
||||
IAccessibleRelation** relations,
|
||||
long* nRelations)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::role(long* role)
|
||||
{
|
||||
if (!role) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*role = mData.mTextRole;
|
||||
{
|
||||
if (!role) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*role = mData.mTextRole;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::scrollTo(IA2ScrollType scrollType)
|
||||
{
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::scrollToPoint(IA2CoordinateType coordinateType, long x,
|
||||
HandlerTextLeaf::scrollToPoint(IA2CoordinateType coordinateType, long x,
|
||||
long y)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_groupPosition(long* groupLevel, long* similarItemsInGroup,
|
||||
HandlerTextLeaf::get_groupPosition(long* groupLevel, long* similarItemsInGroup,
|
||||
long* positionInGroup)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_states(AccessibleStates* states)
|
||||
{
|
||||
if (!states) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*states = 0;
|
||||
{
|
||||
if (!states) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*states = 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_extendedRole(BSTR* extendedRole)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_localizedExtendedRole(BSTR* localizedExtendedRole)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_nExtendedStates(long* nExtendedStates)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_extendedStates(long maxExtendedStates,
|
||||
BSTR** extendedStates,
|
||||
HandlerTextLeaf::get_extendedStates(long maxExtendedStates,
|
||||
BSTR** extendedStates,
|
||||
long* nExtendedStates)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_localizedExtendedStates(long maxLocalizedExtendedStates,
|
||||
BSTR** localizedExtendedStates,
|
||||
HandlerTextLeaf::get_localizedExtendedStates(long maxLocalizedExtendedStates,
|
||||
BSTR** localizedExtendedStates,
|
||||
long* nLocalizedExtendedStates)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_uniqueID(long* uniqueID)
|
||||
{
|
||||
if (!uniqueID) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*uniqueID = mData.mTextId;
|
||||
{
|
||||
if (!uniqueID) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*uniqueID = mData.mTextId;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_windowHandle(HWND* windowHandle)
|
||||
{
|
||||
if (!windowHandle) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*windowHandle = mHwnd;
|
||||
{
|
||||
if (!windowHandle) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*windowHandle = mHwnd;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_indexInParent(long* indexInParent)
|
||||
{
|
||||
if (!indexInParent) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*indexInParent = mIndexInParent;
|
||||
{
|
||||
if (!indexInParent) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*indexInParent = mIndexInParent;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_locale(IA2Locale* locale)
|
||||
{
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::get_attributes(BSTR* attributes)
|
||||
{
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/*** IServiceProvider ***/
|
||||
|
||||
}
|
||||
|
||||
/*** IServiceProvider ***/
|
||||
|
||||
HRESULT
|
||||
HandlerTextLeaf::QueryService(REFGUID aServiceId, REFIID aIid,
|
||||
HandlerTextLeaf::QueryService(REFGUID aServiceId, REFIID aIid,
|
||||
void** aOutInterface)
|
||||
{
|
||||
if (aIid == IID_IAccessible2) {
|
||||
RefPtr<IAccessible2> ia2(this);
|
||||
ia2.forget(aOutInterface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
{
|
||||
if (aIid == IID_IAccessible2) {
|
||||
RefPtr<IAccessible2> ia2(this);
|
||||
ia2.forget(aOutInterface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -166,7 +166,7 @@ nsDSURIContentListener::DoContent(const nsACString& aContentType,
|
|||
maybeCloseWindowHelper->MaybeCloseWindow();
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9056,7 +9056,7 @@ nsDocShell::CopyFavicon(nsIURI* aOldURI,
|
|||
#endif
|
||||
}
|
||||
|
||||
struct InternalLoadData
|
||||
struct InternalLoadData
|
||||
{
|
||||
public:
|
||||
InternalLoadData(nsDocShell* aDocShell,
|
||||
|
@ -9206,7 +9206,7 @@ public:
|
|||
aSourceDocShell,
|
||||
aBaseURI,
|
||||
nullptr,
|
||||
nullptr)
|
||||
nullptr)
|
||||
{}
|
||||
|
||||
NS_IMETHOD
|
||||
|
@ -9305,7 +9305,7 @@ NS_IMPL_CYCLE_COLLECTION(LoadURIDelegateHandler, mLoadData.mDocShell,
|
|||
mLoadData.mURI, mLoadData.mOriginalURI,
|
||||
mLoadData.mResultPrincipalURI, mLoadData.mReferrer,
|
||||
mLoadData.mTriggeringPrincipal,
|
||||
mLoadData.mPrincipalToInherit,
|
||||
mLoadData.mPrincipalToInherit,
|
||||
mLoadData.mPostData, mLoadData.mHeadersData,
|
||||
mLoadData.mSHEntry, mLoadData.mSourceDocShell,
|
||||
mLoadData.mBaseURI)
|
||||
|
@ -9586,7 +9586,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
|||
if (NS_SUCCEEDED(rv) && promise) {
|
||||
const uint32_t flags = aFlags | INTERNAL_LOAD_FLAGS_DELEGATES_CHECKED;
|
||||
|
||||
RefPtr<LoadURIDelegateHandler> handler =
|
||||
RefPtr<LoadURIDelegateHandler> handler =
|
||||
new LoadURIDelegateHandler(this, aURI, aOriginalURI, aResultPrincipalURI,
|
||||
aKeepResultPrincipalURIIfSet,
|
||||
aLoadReplace, aReferrer, aReferrerPolicy,
|
||||
|
|
|
@ -236,7 +236,7 @@ CharacterData::ReplaceData(uint32_t aOffset, uint32_t aCount,
|
|||
aData.Length(), true);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -1968,7 +1968,7 @@ private:
|
|||
|
||||
/**
|
||||
* GetCustomInterface is somewhat like a GetInterface, but it is expected
|
||||
* that the implementation is provided by a custom element or via the
|
||||
* that the implementation is provided by a custom element or via the
|
||||
* the XBL implements keyword. To use this, create a public method that
|
||||
* wraps a call to GetCustomInterface.
|
||||
*/
|
||||
|
|
|
@ -272,7 +272,7 @@ Link::UpdatePreload(nsAtom* aName, const nsAttrValue* aValue,
|
|||
}
|
||||
} else {
|
||||
oldPolicyType = nsIContentPolicy::TYPE_INVALID;
|
||||
}
|
||||
}
|
||||
} else if (aName == nsGkAtoms::type) {
|
||||
nsAutoString oldType;
|
||||
nsAutoString notUsed;
|
||||
|
|
|
@ -517,7 +517,7 @@ Location::SetHrefWithBase(const nsAString& aHref, nsIURI* aBase,
|
|||
}
|
||||
|
||||
return SetURI(newUri, aReplace || inScriptTag);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class nsContentPolicy : public nsIContentPolicy
|
|||
//Helper method that applies policyMethod across all policies in mPolicies
|
||||
// with the given parameters
|
||||
nsresult CheckPolicy(CPMethod policyMethod,
|
||||
nsIURI *aURI,
|
||||
nsIURI *aURI,
|
||||
nsILoadInfo *aLoadInfo,
|
||||
const nsACString &mimeGuess,
|
||||
int16_t *decision);
|
||||
|
|
|
@ -282,7 +282,7 @@ public:
|
|||
virtual nsIGlobalObject* GetOwnerGlobal() const override;
|
||||
|
||||
EventTarget* GetTargetForEventTargetChain() override;
|
||||
|
||||
|
||||
using mozilla::dom::EventTarget::DispatchEvent;
|
||||
bool DispatchEvent(mozilla::dom::Event& aEvent,
|
||||
mozilla::dom::CallerType aCallerType,
|
||||
|
|
|
@ -226,7 +226,7 @@ nsPIDOMWindowInner*
|
|||
nsIGlobalObject::AsInnerWindow()
|
||||
{
|
||||
if (MOZ_LIKELY(mIsInnerWindow)) {
|
||||
return static_cast<nsPIDOMWindowInner*>(static_cast<nsGlobalWindowInner*>(this));
|
||||
return static_cast<nsPIDOMWindowInner*>(static_cast<nsGlobalWindowInner*>(this));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ struct FakeString {
|
|||
|
||||
nsString::char_type* BeginWriting()
|
||||
{
|
||||
MOZ_ASSERT(!(mDataFlags & nsString::DataFlags::REFCOUNTED) ||
|
||||
MOZ_ASSERT(!(mDataFlags & nsString::DataFlags::REFCOUNTED) ||
|
||||
!nsStringBuffer::FromData(mData)->IsReadonly());
|
||||
return mData;
|
||||
}
|
||||
|
|
|
@ -2306,7 +2306,7 @@ WebGLContext::GetVRFrame()
|
|||
{
|
||||
if (!gl)
|
||||
return nullptr;
|
||||
|
||||
|
||||
// Create a custom GLScreenBuffer for VR.
|
||||
if (!mVRScreen) {
|
||||
auto caps = gl->Screen()->mCaps;
|
||||
|
|
|
@ -400,7 +400,7 @@ class ScopedFakeVertexAttrib0 final
|
|||
bool mDidFake = false;
|
||||
|
||||
public:
|
||||
ScopedFakeVertexAttrib0(WebGLContext* const webgl,
|
||||
ScopedFakeVertexAttrib0(WebGLContext* const webgl,
|
||||
const uint64_t vertexCount, bool* const out_error)
|
||||
: mWebGL(webgl)
|
||||
{
|
||||
|
|
|
@ -345,7 +345,7 @@ ContentEventHandler::InitCommon(SelectionType aSelectionType)
|
|||
if (mSelection->Type() == SelectionType::eNormal) {
|
||||
normalSelection = mSelection;
|
||||
} else {
|
||||
normalSelection =
|
||||
normalSelection =
|
||||
selectionController->GetSelection(nsISelectionController::SELECTION_NORMAL);
|
||||
if (NS_WARN_IF(!normalSelection)) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
|
|
@ -6200,7 +6200,7 @@ EventStateManager::WheelPrefs::HonoursRootForAutoDir()
|
|||
}
|
||||
|
||||
// static
|
||||
Maybe<layers::APZWheelAction>
|
||||
Maybe<layers::APZWheelAction>
|
||||
EventStateManager::APZWheelActionFor(const WidgetWheelEvent* aEvent)
|
||||
{
|
||||
if (aEvent->mMessage != eWheel) {
|
||||
|
|
|
@ -90,7 +90,7 @@ public:
|
|||
return AddEventListener(aType, aListener, aUseCapture,
|
||||
Nullable<bool>(aWantsUntrusted));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method allows the removal of event listeners represented by
|
||||
* nsIDOMEventListener from the event target, with the same semantics as the
|
||||
|
@ -240,7 +240,7 @@ public:
|
|||
*
|
||||
* @note Only EventDispatcher should call this method.
|
||||
*/
|
||||
virtual void GetEventTargetParent(EventChainPreVisitor& aVisitor) = 0;
|
||||
virtual void GetEventTargetParent(EventChainPreVisitor& aVisitor) = 0;
|
||||
|
||||
/**
|
||||
* Called before the capture phase of the event flow and after event target
|
||||
|
@ -269,7 +269,7 @@ public:
|
|||
* @note Only EventDispatcher should call this method.
|
||||
*/
|
||||
virtual nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) = 0;
|
||||
|
||||
|
||||
protected:
|
||||
EventHandlerNonNull* GetEventHandler(nsAtom* aType);
|
||||
void SetEventHandler(nsAtom* aType, EventHandlerNonNull* aHandler);
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
|
||||
// This method returns false if aURI is not a known BlobURL. Otherwise it
|
||||
// returns true.
|
||||
//
|
||||
//
|
||||
// When true is returned, the aPrincipal out param is meaningful. It gets
|
||||
// set to the principal that a channel loaded from the blob would get if
|
||||
// the blob is not already revoked and to a NullPrincipal if the blob is
|
||||
|
|
|
@ -550,7 +550,7 @@ nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(
|
|||
IsHTMLElement(nsGkAtoms::area);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
nsGenericHTMLElement::GetEventTargetParentForAnchors(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
nsGenericHTMLElementBase::GetEventTargetParent(aVisitor);
|
||||
|
|
|
@ -1394,7 +1394,7 @@ nsHTMLDocument::Open(JSContext* cx,
|
|||
if (curDocShell) {
|
||||
curDocShell->GetSameTypeParent(getter_AddRefs(parent));
|
||||
}
|
||||
|
||||
|
||||
// We are using the same technique as in nsDocShell to figure
|
||||
// out the content policy type. If there is no same type parent,
|
||||
// we know we are loading a new top level document.
|
||||
|
@ -1983,7 +1983,7 @@ nsHTMLDocument::ResolveName(JSContext* aCx, const nsAString& aName,
|
|||
} else {
|
||||
// No named items were found, see if there's one registerd by id for aName.
|
||||
Element *e = entry->GetIdElement();
|
||||
|
||||
|
||||
if (!e || !nsGenericHTMLElement::ShouldExposeIdAsHTMLDocumentProperty(e)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
* MOZ_ASSERT(nWritten);
|
||||
* HookedFuncDelegateReq::Marshal(aTuple, nsDependentCSubstring(aBuf, aBufLen));
|
||||
* }
|
||||
*
|
||||
*
|
||||
* template<>
|
||||
* bool HookedFuncFB::Request::Unmarshal(ServerCallData& aScd, const IpdlTuple& aTuple,
|
||||
* void*& aBuf, int& aBufLen)
|
||||
|
@ -168,7 +168,7 @@ extern IdToPtrMap sIdToPtrMap;
|
|||
#else // defined(XP_WIN)
|
||||
|
||||
// Any methods we hook use the default calling convention.
|
||||
#define HOOK_CALL
|
||||
#define HOOK_CALL
|
||||
|
||||
#endif // defined(XP_WIN)
|
||||
|
||||
|
|
|
@ -56,18 +56,18 @@ FunctionBrokerChild::FunctionBrokerChild(FunctionBrokerThread* aThread,
|
|||
, mMonitor("FunctionBrokerChild Lock")
|
||||
{
|
||||
MOZ_ASSERT(aThread);
|
||||
PostToDispatchThread(NewNonOwningRunnableMethod<Endpoint<PFunctionBrokerChild>&&>(
|
||||
"FunctionBrokerChild::Bind", this, &FunctionBrokerChild::Bind,
|
||||
std::move(aEndpoint)));
|
||||
PostToDispatchThread(NewNonOwningRunnableMethod<Endpoint<PFunctionBrokerChild>&&>(
|
||||
"FunctionBrokerChild::Bind", this, &FunctionBrokerChild::Bind,
|
||||
std::move(aEndpoint)));
|
||||
}
|
||||
|
||||
void
|
||||
FunctionBrokerChild::Bind(Endpoint<PFunctionBrokerChild>&& aEndpoint)
|
||||
|
||||
void
|
||||
FunctionBrokerChild::Bind(Endpoint<PFunctionBrokerChild>&& aEndpoint)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(mThread->IsOnThread());
|
||||
DebugOnly<bool> ok = aEndpoint.Bind(this);
|
||||
MOZ_ASSERT(ok);
|
||||
}
|
||||
MOZ_RELEASE_ASSERT(mThread->IsOnThread());
|
||||
DebugOnly<bool> ok = aEndpoint.Bind(this);
|
||||
MOZ_ASSERT(ok);
|
||||
}
|
||||
|
||||
void
|
||||
FunctionBrokerChild::ShutdownOnDispatchThread()
|
||||
|
@ -75,8 +75,8 @@ FunctionBrokerChild::ShutdownOnDispatchThread()
|
|||
MOZ_ASSERT(mThread->IsOnThread());
|
||||
|
||||
// Set mShutdownDone and notify waiting thread (if any) that we are done.
|
||||
MonitorAutoLock lock(mMonitor);
|
||||
mShutdownDone = true;
|
||||
MonitorAutoLock lock(mMonitor);
|
||||
mShutdownDone = true;
|
||||
mMonitor.Notify();
|
||||
}
|
||||
|
||||
|
@ -84,14 +84,14 @@ void
|
|||
FunctionBrokerChild::ActorDestroy(ActorDestroyReason aWhy)
|
||||
{
|
||||
MOZ_ASSERT(mThread->IsOnThread());
|
||||
|
||||
// Queue up a task on the PD thread. When that task is executed then
|
||||
// we know that anything queued before ActorDestroy has completed.
|
||||
// At that point, we can set mShutdownDone and alert any waiting
|
||||
// threads that it is safe to destroy us.
|
||||
sInstance->PostToDispatchThread(NewNonOwningRunnableMethod(
|
||||
"FunctionBrokerChild::ShutdownOnDispatchThread", sInstance,
|
||||
&FunctionBrokerChild::ShutdownOnDispatchThread));
|
||||
|
||||
// Queue up a task on the PD thread. When that task is executed then
|
||||
// we know that anything queued before ActorDestroy has completed.
|
||||
// At that point, we can set mShutdownDone and alert any waiting
|
||||
// threads that it is safe to destroy us.
|
||||
sInstance->PostToDispatchThread(NewNonOwningRunnableMethod(
|
||||
"FunctionBrokerChild::ShutdownOnDispatchThread", sInstance,
|
||||
&FunctionBrokerChild::ShutdownOnDispatchThread));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -107,11 +107,11 @@ FunctionBrokerChild::Destroy()
|
|||
// on the FunctionBrokerThread have completed. At that point, we can
|
||||
// safely delete the actor.
|
||||
{
|
||||
MonitorAutoLock lock(sInstance->mMonitor);
|
||||
while (!sInstance->mShutdownDone) {
|
||||
// Release lock and wait. Regain lock when we are notified that
|
||||
// we have ShutdownOnDispatchThread.
|
||||
sInstance->mMonitor.Wait();
|
||||
MonitorAutoLock lock(sInstance->mMonitor);
|
||||
while (!sInstance->mShutdownDone) {
|
||||
// Release lock and wait. Regain lock when we are notified that
|
||||
// we have ShutdownOnDispatchThread.
|
||||
sInstance->mMonitor.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ IPCInternetBuffers::CopyFrom(const LPINTERNET_BUFFERSA& aBufs)
|
|||
|
||||
LPINTERNET_BUFFERSA inetBuf = aBufs;
|
||||
while (inetBuf) {
|
||||
MOZ_ASSERT(inetBuf->dwStructSize == sizeof(INTERNET_BUFFERSA));
|
||||
MOZ_ASSERT(inetBuf->dwStructSize == sizeof(INTERNET_BUFFERSA));
|
||||
Buffer* ipcBuf = mBuffers.AppendElement();
|
||||
|
||||
ipcBuf->mHeader.SetIsVoid(inetBuf->lpcszHeader == nullptr);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#define SECURITY_WIN32
|
||||
#include <security.h>
|
||||
#include <wininet.h>
|
||||
#include <schannel.h>
|
||||
#include <schannel.h>
|
||||
#include <commdlg.h>
|
||||
|
||||
#endif // defined(XP_WIN)
|
||||
|
@ -196,10 +196,10 @@ typedef struct _IPCInternetBuffers
|
|||
uint32_t mHeaderTotal;
|
||||
nsCString mBuffer;
|
||||
uint32_t mBufferTotal;
|
||||
bool operator==(const Buffer& o) const
|
||||
{
|
||||
return (o.mHeader == mHeader) && (o.mHeaderTotal == mHeaderTotal) &&
|
||||
(o.mBuffer == mBuffer) && (o.mBufferTotal == mBufferTotal);
|
||||
bool operator==(const Buffer& o) const
|
||||
{
|
||||
return (o.mHeader == mHeader) && (o.mHeaderTotal == mHeaderTotal) &&
|
||||
(o.mBuffer == mBuffer) && (o.mBufferTotal == mBufferTotal);
|
||||
}
|
||||
};
|
||||
nsTArray<Buffer> mBuffers;
|
||||
|
@ -328,11 +328,11 @@ struct ParamTraits<OpenFileNameRetIPC>
|
|||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::plugins::GetFileNameFunc> :
|
||||
public ContiguousEnumSerializerInclusive<mozilla::plugins::GetFileNameFunc,
|
||||
mozilla::plugins::OPEN_FUNC,
|
||||
mozilla::plugins::SAVE_FUNC>
|
||||
template <>
|
||||
struct ParamTraits<mozilla::plugins::GetFileNameFunc> :
|
||||
public ContiguousEnumSerializerInclusive<mozilla::plugins::GetFileNameFunc,
|
||||
mozilla::plugins::OPEN_FUNC,
|
||||
mozilla::plugins::SAVE_FUNC>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
@ -372,59 +372,59 @@ struct ParamTraits<IPCSchannelCred>
|
|||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<IPCInternetBuffers::Buffer>
|
||||
{
|
||||
typedef mozilla::plugins::IPCInternetBuffers::Buffer paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.mHeader);
|
||||
WriteParam(aMsg, aParam.mHeaderTotal);
|
||||
WriteParam(aMsg, aParam.mBuffer);
|
||||
WriteParam(aMsg, aParam.mBufferTotal);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->mHeader) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mHeaderTotal) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mBuffer) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mBufferTotal);
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog)
|
||||
{
|
||||
nsCString head = mozilla::plugins::FormatBlob(aParam.mHeader);
|
||||
nsCString buffer = mozilla::plugins::FormatBlob(aParam.mBuffer);
|
||||
std::string msg = StringPrintf("[%s, %d, %s, %d]",
|
||||
head.Data(), aParam.mHeaderTotal,
|
||||
buffer.Data(), aParam.mBufferTotal);
|
||||
aLog->append(msg.begin(), msg.end());
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<IPCInternetBuffers>
|
||||
{
|
||||
typedef mozilla::plugins::IPCInternetBuffers paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.mBuffers);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->mBuffers);
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog)
|
||||
{
|
||||
ParamTraits<nsTArray<IPCInternetBuffers::Buffer>>::Log(aParam.mBuffers, aLog);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<IPCInternetBuffers::Buffer>
|
||||
{
|
||||
typedef mozilla::plugins::IPCInternetBuffers::Buffer paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.mHeader);
|
||||
WriteParam(aMsg, aParam.mHeaderTotal);
|
||||
WriteParam(aMsg, aParam.mBuffer);
|
||||
WriteParam(aMsg, aParam.mBufferTotal);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->mHeader) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mHeaderTotal) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mBuffer) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mBufferTotal);
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog)
|
||||
{
|
||||
nsCString head = mozilla::plugins::FormatBlob(aParam.mHeader);
|
||||
nsCString buffer = mozilla::plugins::FormatBlob(aParam.mBuffer);
|
||||
std::string msg = StringPrintf("[%s, %d, %s, %d]",
|
||||
head.Data(), aParam.mHeaderTotal,
|
||||
buffer.Data(), aParam.mBufferTotal);
|
||||
aLog->append(msg.begin(), msg.end());
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<IPCInternetBuffers>
|
||||
{
|
||||
typedef mozilla::plugins::IPCInternetBuffers paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.mBuffers);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->mBuffers);
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog)
|
||||
{
|
||||
ParamTraits<nsTArray<IPCInternetBuffers::Buffer>>::Log(aParam.mBuffers, aLog);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<IPCPrintDlg>
|
||||
{
|
||||
|
|
|
@ -5,19 +5,19 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "FunctionBrokerParent.h"
|
||||
#include "FunctionBroker.h"
|
||||
#include "FunctionBrokerThread.h"
|
||||
#include "FunctionBroker.h"
|
||||
#include "FunctionBrokerThread.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
||||
#if defined(XP_WIN)
|
||||
UlongPairToIdMap sPairToIdMap;
|
||||
IdToUlongPairMap sIdToPairMap;
|
||||
PtrToIdMap sPtrToIdMap;
|
||||
IdToPtrMap sIdToPtrMap;
|
||||
#endif // defined(XP_WIN)
|
||||
|
||||
#if defined(XP_WIN)
|
||||
UlongPairToIdMap sPairToIdMap;
|
||||
IdToUlongPairMap sIdToPairMap;
|
||||
PtrToIdMap sPtrToIdMap;
|
||||
IdToPtrMap sIdToPtrMap;
|
||||
#endif // defined(XP_WIN)
|
||||
|
||||
/* static */ FunctionBrokerParent*
|
||||
FunctionBrokerParent::Create(Endpoint<PFunctionBrokerParent>&& aParentEnd)
|
||||
{
|
||||
|
@ -40,26 +40,26 @@ FunctionBrokerParent::FunctionBrokerParent(FunctionBrokerThread* aThread,
|
|||
, mShutdownDone(false)
|
||||
{
|
||||
MOZ_ASSERT(mThread);
|
||||
mThread->Dispatch(NewNonOwningRunnableMethod<Endpoint<PFunctionBrokerParent>&&>(
|
||||
"FunctionBrokerParent::Bind", this, &FunctionBrokerParent::Bind, std::move(aParentEnd)));
|
||||
}
|
||||
|
||||
FunctionBrokerParent::~FunctionBrokerParent()
|
||||
{
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
// Clean up any file permissions that we granted to the child process.
|
||||
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
||||
RemovePermissionsForProcess(OtherPid());
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
FunctionBrokerParent::Bind(Endpoint<PFunctionBrokerParent>&& aEnd)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(mThread->IsOnThread());
|
||||
DebugOnly<bool> ok = aEnd.Bind(this);
|
||||
MOZ_ASSERT(ok);
|
||||
}
|
||||
mThread->Dispatch(NewNonOwningRunnableMethod<Endpoint<PFunctionBrokerParent>&&>(
|
||||
"FunctionBrokerParent::Bind", this, &FunctionBrokerParent::Bind, std::move(aParentEnd)));
|
||||
}
|
||||
|
||||
FunctionBrokerParent::~FunctionBrokerParent()
|
||||
{
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
// Clean up any file permissions that we granted to the child process.
|
||||
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
||||
RemovePermissionsForProcess(OtherPid());
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
FunctionBrokerParent::Bind(Endpoint<PFunctionBrokerParent>&& aEnd)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(mThread->IsOnThread());
|
||||
DebugOnly<bool> ok = aEnd.Bind(this);
|
||||
MOZ_ASSERT(ok);
|
||||
}
|
||||
|
||||
void
|
||||
FunctionBrokerParent::ShutdownOnBrokerThread()
|
||||
|
@ -68,8 +68,8 @@ FunctionBrokerParent::ShutdownOnBrokerThread()
|
|||
Close();
|
||||
|
||||
// Notify waiting thread that we are done.
|
||||
MonitorAutoLock lock(mMonitor);
|
||||
mShutdownDone = true;
|
||||
MonitorAutoLock lock(mMonitor);
|
||||
mShutdownDone = true;
|
||||
mMonitor.Notify();
|
||||
}
|
||||
|
||||
|
@ -81,14 +81,14 @@ FunctionBrokerParent::Destroy(FunctionBrokerParent* aInst)
|
|||
|
||||
{
|
||||
// Hold the lock while we destroy the actor on the broker thread.
|
||||
MonitorAutoLock lock(aInst->mMonitor);
|
||||
aInst->mThread->Dispatch(NewNonOwningRunnableMethod(
|
||||
"FunctionBrokerParent::ShutdownOnBrokerThread", aInst,
|
||||
&FunctionBrokerParent::ShutdownOnBrokerThread));
|
||||
MonitorAutoLock lock(aInst->mMonitor);
|
||||
aInst->mThread->Dispatch(NewNonOwningRunnableMethod(
|
||||
"FunctionBrokerParent::ShutdownOnBrokerThread", aInst,
|
||||
&FunctionBrokerParent::ShutdownOnBrokerThread));
|
||||
|
||||
// Wait for broker thread to complete destruction.
|
||||
while (!aInst->mShutdownDone) {
|
||||
aInst->mMonitor.Wait();
|
||||
while (!aInst->mShutdownDone) {
|
||||
aInst->mMonitor.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,55 +98,55 @@ FunctionBrokerParent::Destroy(FunctionBrokerParent* aInst)
|
|||
void
|
||||
FunctionBrokerParent::ActorDestroy(ActorDestroyReason aWhy)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(mThread->IsOnThread());
|
||||
MOZ_RELEASE_ASSERT(mThread->IsOnThread());
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
FunctionBrokerParent::RecvBrokerFunction(const FunctionHookId &aFunctionId,
|
||||
const IpdlTuple &aInTuple,
|
||||
IpdlTuple *aOutTuple)
|
||||
{
|
||||
#if defined(XP_WIN)
|
||||
MOZ_ASSERT(mThread->IsOnThread());
|
||||
if (RunBrokeredFunction(OtherPid(), aFunctionId, aInTuple, aOutTuple)) {
|
||||
return IPC_OK();
|
||||
}
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE("BrokerFunction is currently only implemented on Windows.");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
FunctionBrokerParent::RunBrokeredFunction(base::ProcessId aClientId,
|
||||
const FunctionHookId &aFunctionId,
|
||||
const IPC::IpdlTuple &aInTuple,
|
||||
IPC::IpdlTuple *aOutTuple)
|
||||
{
|
||||
if ((size_t)aFunctionId >= FunctionHook::GetHooks()->Length()) {
|
||||
MOZ_ASSERT_UNREACHABLE("Invalid function ID");
|
||||
return false;
|
||||
}
|
||||
|
||||
FunctionHook* hook = FunctionHook::GetHooks()->ElementAt(aFunctionId);
|
||||
MOZ_ASSERT(hook->FunctionId() == aFunctionId);
|
||||
return hook->RunOriginalFunction(aClientId, aInTuple, aOutTuple);
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
|
||||
mozilla::SandboxPermissions FunctionBrokerParent::sSandboxPermissions;
|
||||
|
||||
// static
|
||||
void
|
||||
FunctionBrokerParent::RemovePermissionsForProcess(base::ProcessId aClientId)
|
||||
{
|
||||
sSandboxPermissions.RemovePermissionsForProcess(aClientId);
|
||||
}
|
||||
|
||||
#endif // defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
mozilla::ipc::IPCResult
|
||||
FunctionBrokerParent::RecvBrokerFunction(const FunctionHookId &aFunctionId,
|
||||
const IpdlTuple &aInTuple,
|
||||
IpdlTuple *aOutTuple)
|
||||
{
|
||||
#if defined(XP_WIN)
|
||||
MOZ_ASSERT(mThread->IsOnThread());
|
||||
if (RunBrokeredFunction(OtherPid(), aFunctionId, aInTuple, aOutTuple)) {
|
||||
return IPC_OK();
|
||||
}
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE("BrokerFunction is currently only implemented on Windows.");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
FunctionBrokerParent::RunBrokeredFunction(base::ProcessId aClientId,
|
||||
const FunctionHookId &aFunctionId,
|
||||
const IPC::IpdlTuple &aInTuple,
|
||||
IPC::IpdlTuple *aOutTuple)
|
||||
{
|
||||
if ((size_t)aFunctionId >= FunctionHook::GetHooks()->Length()) {
|
||||
MOZ_ASSERT_UNREACHABLE("Invalid function ID");
|
||||
return false;
|
||||
}
|
||||
|
||||
FunctionHook* hook = FunctionHook::GetHooks()->ElementAt(aFunctionId);
|
||||
MOZ_ASSERT(hook->FunctionId() == aFunctionId);
|
||||
return hook->RunOriginalFunction(aClientId, aInTuple, aOutTuple);
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
|
||||
mozilla::SandboxPermissions FunctionBrokerParent::sSandboxPermissions;
|
||||
|
||||
// static
|
||||
void
|
||||
FunctionBrokerParent::RemovePermissionsForProcess(base::ProcessId aClientId)
|
||||
{
|
||||
sSandboxPermissions.RemovePermissionsForProcess(aClientId);
|
||||
}
|
||||
|
||||
#endif // defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
|
||||
} // namespace plugins
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#define mozilla_plugins_functionbrokerparent_h
|
||||
|
||||
#include "mozilla/plugins/PFunctionBrokerParent.h"
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
#include "sandboxPermissions.h"
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
#include "sandboxPermissions.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -29,32 +29,32 @@ public:
|
|||
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
RecvBrokerFunction(const FunctionHookId &aFunctionId, const IpdlTuple &aInTuple,
|
||||
IpdlTuple *aOutTuple) override;
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
static mozilla::SandboxPermissions*
|
||||
GetSandboxPermissions() { return &sSandboxPermissions; }
|
||||
#endif // defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
mozilla::ipc::IPCResult
|
||||
RecvBrokerFunction(const FunctionHookId &aFunctionId, const IpdlTuple &aInTuple,
|
||||
IpdlTuple *aOutTuple) override;
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
static mozilla::SandboxPermissions*
|
||||
GetSandboxPermissions() { return &sSandboxPermissions; }
|
||||
#endif // defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
|
||||
private:
|
||||
explicit FunctionBrokerParent(FunctionBrokerThread* aThread,
|
||||
Endpoint<PFunctionBrokerParent>&& aParentEnd);
|
||||
~FunctionBrokerParent();
|
||||
~FunctionBrokerParent();
|
||||
void ShutdownOnBrokerThread();
|
||||
void Bind(Endpoint<PFunctionBrokerParent>&& aEnd);
|
||||
|
||||
static bool RunBrokeredFunction(base::ProcessId aClientId,
|
||||
const FunctionHookId &aFunctionId,
|
||||
const IPC::IpdlTuple &aInTuple,
|
||||
IPC::IpdlTuple *aOutTuple);
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
static void RemovePermissionsForProcess(base::ProcessId aClientId);
|
||||
static mozilla::SandboxPermissions sSandboxPermissions;
|
||||
#endif // defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
|
||||
|
||||
static bool RunBrokeredFunction(base::ProcessId aClientId,
|
||||
const FunctionHookId &aFunctionId,
|
||||
const IPC::IpdlTuple &aInTuple,
|
||||
IPC::IpdlTuple *aOutTuple);
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
static void RemovePermissionsForProcess(base::ProcessId aClientId);
|
||||
static mozilla::SandboxPermissions sSandboxPermissions;
|
||||
#endif // defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
|
||||
nsAutoPtr<FunctionBrokerThread> mThread;
|
||||
Monitor mMonitor;
|
||||
bool mShutdownDone;
|
||||
|
|
|
@ -12,44 +12,44 @@
|
|||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
||||
class FunctionBrokerThread
|
||||
{
|
||||
public:
|
||||
void Dispatch(already_AddRefed<nsIRunnable>&& aRunnable)
|
||||
{
|
||||
mThread->Dispatch(std::move(aRunnable), nsIEventTarget::NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
bool IsOnThread()
|
||||
{
|
||||
bool on;
|
||||
return NS_SUCCEEDED(mThread->IsOnCurrentThread(&on)) && on;
|
||||
}
|
||||
|
||||
static FunctionBrokerThread* Create()
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
||||
nsCOMPtr<nsIThread> thread;
|
||||
if (NS_FAILED(NS_NewNamedThread("Function Broker", getter_AddRefs(thread)))) {
|
||||
return nullptr;
|
||||
}
|
||||
return new FunctionBrokerThread(thread);
|
||||
}
|
||||
|
||||
~FunctionBrokerThread()
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
||||
mThread->Shutdown();
|
||||
}
|
||||
|
||||
private:
|
||||
explicit FunctionBrokerThread(nsIThread* aThread) : mThread(aThread)
|
||||
{
|
||||
MOZ_ASSERT(mThread);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIThread> mThread;
|
||||
};
|
||||
class FunctionBrokerThread
|
||||
{
|
||||
public:
|
||||
void Dispatch(already_AddRefed<nsIRunnable>&& aRunnable)
|
||||
{
|
||||
mThread->Dispatch(std::move(aRunnable), nsIEventTarget::NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
bool IsOnThread()
|
||||
{
|
||||
bool on;
|
||||
return NS_SUCCEEDED(mThread->IsOnCurrentThread(&on)) && on;
|
||||
}
|
||||
|
||||
static FunctionBrokerThread* Create()
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
||||
nsCOMPtr<nsIThread> thread;
|
||||
if (NS_FAILED(NS_NewNamedThread("Function Broker", getter_AddRefs(thread)))) {
|
||||
return nullptr;
|
||||
}
|
||||
return new FunctionBrokerThread(thread);
|
||||
}
|
||||
|
||||
~FunctionBrokerThread()
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
||||
mThread->Shutdown();
|
||||
}
|
||||
|
||||
private:
|
||||
explicit FunctionBrokerThread(nsIThread* aThread) : mThread(aThread)
|
||||
{
|
||||
MOZ_ASSERT(mThread);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIThread> mThread;
|
||||
};
|
||||
|
||||
} // namespace plugins
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -70,9 +70,9 @@ private:
|
|||
OpenFileNameRetIPC,NativeWindowHandle,
|
||||
IPCSchannelCred,IPCInternetBuffers,StringArray,
|
||||
IPCPrintDlg> IpdlTupleElement;
|
||||
#else
|
||||
typedef MaybeVariant<int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,
|
||||
int64_t,uint64_t,nsCString,bool> IpdlTupleElement;
|
||||
#else
|
||||
typedef MaybeVariant<int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,
|
||||
int64_t,uint64_t,nsCString,bool> IpdlTupleElement;
|
||||
#endif // defined(XP_WIN)
|
||||
|
||||
friend struct IPC::ParamTraits<IpdlTuple>;
|
||||
|
|
|
@ -67,7 +67,7 @@ nsContentSecurityManager::AllowTopLevelNavigationToDataURI(nsIChannel* aChannel)
|
|||
NS_ENSURE_SUCCESS(rv, true);
|
||||
nsAutoCString contentType;
|
||||
bool base64;
|
||||
rv = nsDataHandler::ParseURI(spec, contentType, nullptr,
|
||||
rv = nsDataHandler::ParseURI(spec, contentType, nullptr,
|
||||
base64, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, true);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
, mY1(0)
|
||||
, mX2(0)
|
||||
, mY2(0)
|
||||
{
|
||||
{
|
||||
/* caller must call Init later */\
|
||||
}
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ protected:
|
|||
// Holds the children in the prolog until the root element is added, after which they're
|
||||
// inserted in the document. However, if we're doing an XSLT transform this will
|
||||
// actually hold all the children of the source document, until the transform is
|
||||
// finished. After the transform is finished we'll just discard the children.
|
||||
// finished. After the transform is finished we'll just discard the children.
|
||||
nsTArray<nsCOMPtr<nsIContent>> mDocumentChildren;
|
||||
|
||||
static const int NS_ACCUMULATION_BUFFER_SIZE = 4096;
|
||||
|
|
|
@ -131,7 +131,7 @@ GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
|
|||
int32_t rectX, rectY, rectWidth, rectHeight;
|
||||
|
||||
screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
|
||||
|
||||
|
||||
screen->GetRect(&rectX, &rectY, &rectWidth, &rectHeight);
|
||||
screen->GetColorDepth(&colorDepth);
|
||||
screen->GetPixelDepth(&pixelDepth);
|
||||
|
|
|
@ -630,7 +630,7 @@ nsICODecoder::FinishMask()
|
|||
int32_t stride = mDownscaler->TargetSize().width * sizeof(uint32_t);
|
||||
DebugOnly<bool> ret =
|
||||
// We know the format is B8G8R8A8 because we always assume bmp's inside
|
||||
// ico's are transparent.
|
||||
// ico's are transparent.
|
||||
PremultiplyData(imageData, stride, SurfaceFormat::B8G8R8A8,
|
||||
imageData, stride, SurfaceFormat::B8G8R8A8, mDownscaler->TargetSize());
|
||||
MOZ_ASSERT(ret);
|
||||
|
|
|
@ -30,8 +30,8 @@ enum nsDateFormatSelector : long
|
|||
enum nsTimeFormatSelector : long
|
||||
{
|
||||
kTimeFormatNone = 0, // don't include the time in the format string
|
||||
kTimeFormatSeconds, // provides the time format with seconds in the given locale
|
||||
kTimeFormatNoSeconds // provides the time format without seconds in the given locale
|
||||
kTimeFormatSeconds, // provides the time format with seconds in the given locale
|
||||
kTimeFormatNoSeconds // provides the time format without seconds in the given locale
|
||||
};
|
||||
|
||||
class DateTimeFormat {
|
||||
|
|
|
@ -6158,7 +6158,7 @@ nsLayoutUtils::PaintTextShadow(const nsIFrame* aFrame,
|
|||
if (!shadowContext)
|
||||
continue;
|
||||
|
||||
|
||||
|
||||
|
||||
aDestCtx->Save();
|
||||
aDestCtx->NewPath();
|
||||
|
|
|
@ -121,7 +121,7 @@ private:
|
|||
{
|
||||
static Dst* QueryFrame(Src* aFrame) { return nullptr; }
|
||||
};
|
||||
|
||||
|
||||
// Specialization for any nsIFrame type to any nsIFrame type -- if the source
|
||||
// instance's mClass matches kFrameIID of the destination type then
|
||||
// downcasting is safe.
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include "mozilla/dom/CSSCounterStyleRule.h"
|
||||
#include "mozilla/dom/CSSFontFaceRule.h"
|
||||
#include "mozilla/dom/CSSFontFeatureValuesRule.h"
|
||||
#include "mozilla/dom/CSSFontFeatureValuesRule.h"
|
||||
#include "mozilla/dom/CSSImportRule.h"
|
||||
#include "mozilla/dom/CSSKeyframesRule.h"
|
||||
#include "mozilla/dom/CSSMediaRule.h"
|
||||
|
|
|
@ -243,7 +243,7 @@ nsTableCellFrame::DidSetComputedStyle(ComputedStyle* aOldComputedStyle)
|
|||
// row span needs to be clamped as we do not create rows in the cellmap
|
||||
// which do not have cells originating in them
|
||||
TableArea damageArea(colIndex, rowIndex, GetColSpan(),
|
||||
std::min(static_cast<uint32_t>(GetRowSpan()),
|
||||
std::min(static_cast<uint32_t>(GetRowSpan()),
|
||||
tableFrame->GetRowCount() - rowIndex));
|
||||
tableFrame->AddBCDamageArea(damageArea);
|
||||
}
|
||||
|
|
|
@ -192,7 +192,7 @@ public:
|
|||
"mColIndex out of sync with first continuation");
|
||||
return mColIndex;
|
||||
}
|
||||
|
||||
|
||||
void SetColIndex(int32_t aColIndex);
|
||||
|
||||
/** return the available isize given to this frame during its last reflow */
|
||||
|
|
|
@ -376,7 +376,7 @@ nsDisplayXULTextBox::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aB
|
|||
gfx::Point deviceOffset = LayoutDevicePoint::FromAppUnits(
|
||||
bounds.TopLeft(), appUnitsPerDevPixel).ToUnknownPoint();
|
||||
|
||||
RefPtr<mozilla::layout::TextDrawTarget> textDrawer =
|
||||
RefPtr<mozilla::layout::TextDrawTarget> textDrawer =
|
||||
new mozilla::layout::TextDrawTarget(aBuilder, aResources, aSc, aManager, this, bounds);
|
||||
RefPtr<gfxContext> captureCtx = gfxContext::CreateOrNull(textDrawer, deviceOffset);
|
||||
|
||||
|
|
|
@ -340,7 +340,7 @@ TreeBoxObject::ScrollToRow(int32_t aRow)
|
|||
if (!body) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
body->ScrollToRow(aRow);
|
||||
}
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ nsTreeColumn::GetX(mozilla::ErrorResult& aRv)
|
|||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return nsPresContext::AppUnitsToIntCSSPixels(frame->GetRect().x);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
/**
|
||||
* Initializes the NSS context.
|
||||
*
|
||||
*
|
||||
* @param NSSConfigDir The config dir containing the private key to use
|
||||
* @return 0 on success
|
||||
* -1 on error
|
||||
|
@ -34,7 +34,7 @@
|
|||
int
|
||||
NSSInitCryptoContext(const char *NSSConfigDir)
|
||||
{
|
||||
SECStatus status = NSS_Initialize(NSSConfigDir,
|
||||
SECStatus status = NSS_Initialize(NSSConfigDir,
|
||||
"", "", SECMOD_DB, NSS_INIT_READONLY);
|
||||
if (SECSuccess != status) {
|
||||
fprintf(stderr, "ERROR: Could not initialize NSS\n");
|
||||
|
@ -44,7 +44,7 @@ NSSInitCryptoContext(const char *NSSConfigDir)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Obtains a signing context.
|
||||
*
|
||||
* @param ctx A pointer to the signing context to fill
|
||||
|
@ -52,11 +52,11 @@ NSSInitCryptoContext(const char *NSSConfigDir)
|
|||
* -1 on error
|
||||
*/
|
||||
int
|
||||
NSSSignBegin(const char *certName,
|
||||
SGNContext **ctx,
|
||||
SECKEYPrivateKey **privKey,
|
||||
NSSSignBegin(const char *certName,
|
||||
SGNContext **ctx,
|
||||
SECKEYPrivateKey **privKey,
|
||||
CERTCertificate **cert,
|
||||
uint32_t *signatureLength)
|
||||
uint32_t *signatureLength)
|
||||
{
|
||||
secuPWData pwdata = { PW_NONE, 0 };
|
||||
if (!certName || !ctx || !privKey || !cert || !signatureLength) {
|
||||
|
@ -81,16 +81,16 @@ NSSSignBegin(const char *certName,
|
|||
*signatureLength = PK11_SignatureLen(*privKey);
|
||||
|
||||
if (*signatureLength > BLOCKSIZE) {
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"ERROR: Program must be compiled with a larger block size"
|
||||
" to support signing with signatures this large: %u.\n",
|
||||
" to support signing with signatures this large: %u.\n",
|
||||
*signatureLength);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check that the key length is large enough for our requirements */
|
||||
if (*signatureLength < XP_MIN_SIGNATURE_LEN_IN_BYTES) {
|
||||
fprintf(stderr, "ERROR: Key length must be >= %d bytes\n",
|
||||
fprintf(stderr, "ERROR: Key length must be >= %d bytes\n",
|
||||
XP_MIN_SIGNATURE_LEN_IN_BYTES);
|
||||
return -1;
|
||||
}
|
||||
|
@ -100,12 +100,12 @@ NSSSignBegin(const char *certName,
|
|||
fprintf(stderr, "ERROR: Could not create signature context\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (SGN_Begin(*ctx) != SECSuccess) {
|
||||
fprintf(stderr, "ERROR: Could not begin signature\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ WriteAndUpdateSignatures(FILE *fpDest, void *buffer,
|
|||
const char *err)
|
||||
{
|
||||
uint32_t k;
|
||||
if (!size) {
|
||||
if (!size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -148,8 +148,8 @@ WriteAndUpdateSignatures(FILE *fpDest, void *buffer,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusts each entry's content offset in the the passed in index by the
|
||||
/**
|
||||
* Adjusts each entry's content offset in the the passed in index by the
|
||||
* specified amount.
|
||||
*
|
||||
* @param indexBuf A buffer containing the MAR index
|
||||
|
@ -157,7 +157,7 @@ WriteAndUpdateSignatures(FILE *fpDest, void *buffer,
|
|||
* @param offsetAmount The amount to adjust each index entry by
|
||||
*/
|
||||
void
|
||||
AdjustIndexContentOffsets(char *indexBuf, uint32_t indexLength, uint32_t offsetAmount)
|
||||
AdjustIndexContentOffsets(char *indexBuf, uint32_t indexLength, uint32_t offsetAmount)
|
||||
{
|
||||
uint32_t *offsetToContent;
|
||||
char *indexBufLoc = indexBuf;
|
||||
|
@ -165,7 +165,7 @@ AdjustIndexContentOffsets(char *indexBuf, uint32_t indexLength, uint32_t offsetA
|
|||
/* Consume the index and adjust each index by the specified amount */
|
||||
while (indexBufLoc != (indexBuf + indexLength)) {
|
||||
/* Adjust the offset */
|
||||
offsetToContent = (uint32_t *)indexBufLoc;
|
||||
offsetToContent = (uint32_t *)indexBufLoc;
|
||||
*offsetToContent = ntohl(*offsetToContent);
|
||||
*offsetToContent += offsetAmount;
|
||||
*offsetToContent = htonl(*offsetToContent);
|
||||
|
@ -197,7 +197,7 @@ ReadWriteAndUpdateSignatures(FILE *fpSrc, FILE *fpDest, void *buffer,
|
|||
uint32_t ctxCount,
|
||||
const char *err)
|
||||
{
|
||||
if (!size) {
|
||||
if (!size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -223,10 +223,10 @@ ReadWriteAndUpdateSignatures(FILE *fpSrc, FILE *fpDest, void *buffer,
|
|||
* -2 on write error
|
||||
*/
|
||||
int
|
||||
ReadAndWrite(FILE *fpSrc, FILE *fpDest, void *buffer,
|
||||
uint32_t size, const char *err)
|
||||
ReadAndWrite(FILE *fpSrc, FILE *fpDest, void *buffer,
|
||||
uint32_t size, const char *err)
|
||||
{
|
||||
if (!size) {
|
||||
if (!size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ ReadAndWrite(FILE *fpSrc, FILE *fpDest, void *buffer,
|
|||
* Writes out a copy of the MAR at src but with the signature block stripped.
|
||||
*
|
||||
* @param src The path of the source MAR file
|
||||
* @param dest The path of the MAR file to write out that
|
||||
* @param dest The path of the MAR file to write out that
|
||||
has no signature block
|
||||
* @return 0 on success
|
||||
* -1 on error
|
||||
|
@ -255,7 +255,7 @@ ReadAndWrite(FILE *fpSrc, FILE *fpDest, void *buffer,
|
|||
int
|
||||
strip_signature_block(const char *src, const char * dest)
|
||||
{
|
||||
uint32_t offsetToIndex, dstOffsetToIndex, indexLength,
|
||||
uint32_t offsetToIndex, dstOffsetToIndex, indexLength,
|
||||
numSignatures = 0, leftOver;
|
||||
int32_t stripAmount = 0;
|
||||
int64_t oldPos, sizeOfEntireMAR = 0, realSizeOfSrcMAR, numBytesToCopy,
|
||||
|
@ -314,7 +314,7 @@ strip_signature_block(const char *src, const char * dest)
|
|||
|
||||
if (hasSignatureBlock) {
|
||||
/* Get the MAR length and adjust its size */
|
||||
if (fread(&sizeOfEntireMAR,
|
||||
if (fread(&sizeOfEntireMAR,
|
||||
sizeof(sizeOfEntireMAR), 1, fpSrc) != 1) {
|
||||
fprintf(stderr, "ERROR: Could read mar size\n");
|
||||
goto failure;
|
||||
|
@ -324,7 +324,7 @@ strip_signature_block(const char *src, const char * dest)
|
|||
fprintf(stderr, "ERROR: Source MAR is not of the right size\n");
|
||||
goto failure;
|
||||
}
|
||||
|
||||
|
||||
/* Get the num signatures in the source file so we know what to strip */
|
||||
if (fread(&numSignatures, sizeof(numSignatures), 1, fpSrc) != 1) {
|
||||
fprintf(stderr, "ERROR: Could read num signatures\n");
|
||||
|
@ -352,7 +352,7 @@ strip_signature_block(const char *src, const char * dest)
|
|||
fprintf(stderr, "ERROR: Could not skip past signature algorithm ID\n");
|
||||
}
|
||||
|
||||
stripAmount += sizeof(uint32_t) + sizeof(uint32_t) + signatureLen;
|
||||
stripAmount += sizeof(uint32_t) + sizeof(uint32_t) + signatureLen;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -419,13 +419,13 @@ strip_signature_block(const char *src, const char * dest)
|
|||
}
|
||||
|
||||
/* Write out the left over */
|
||||
if (ReadAndWrite(fpSrc, fpDest, buf,
|
||||
if (ReadAndWrite(fpSrc, fpDest, buf,
|
||||
leftOver, "left over content block")) {
|
||||
goto failure;
|
||||
}
|
||||
|
||||
/* Length of the index */
|
||||
if (ReadAndWrite(fpSrc, fpDest, &indexLength,
|
||||
if (ReadAndWrite(fpSrc, fpDest, &indexLength,
|
||||
sizeof(indexLength), "index length")) {
|
||||
goto failure;
|
||||
}
|
||||
|
@ -442,9 +442,9 @@ strip_signature_block(const char *src, const char * dest)
|
|||
if (hasSignatureBlock) {
|
||||
AdjustIndexContentOffsets(indexBuf, indexLength, -stripAmount);
|
||||
} else {
|
||||
AdjustIndexContentOffsets(indexBuf, indexLength,
|
||||
sizeof(sizeOfEntireMAR) +
|
||||
sizeof(numSignatures) -
|
||||
AdjustIndexContentOffsets(indexBuf, indexLength,
|
||||
sizeof(sizeOfEntireMAR) +
|
||||
sizeof(numSignatures) -
|
||||
stripAmount);
|
||||
}
|
||||
|
||||
|
@ -454,7 +454,7 @@ strip_signature_block(const char *src, const char * dest)
|
|||
}
|
||||
|
||||
rv = 0;
|
||||
failure:
|
||||
failure:
|
||||
if (fpSrc) {
|
||||
fclose(fpSrc);
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ failure:
|
|||
remove(dest);
|
||||
}
|
||||
|
||||
if (indexBuf) {
|
||||
if (indexBuf) {
|
||||
free(indexBuf);
|
||||
}
|
||||
|
||||
|
@ -803,7 +803,7 @@ failure:
|
|||
|
||||
/**
|
||||
* Writes out a copy of the MAR at src but with embedded signatures.
|
||||
* The passed in MAR file must not already be signed or an error will
|
||||
* The passed in MAR file must not already be signed or an error will
|
||||
* be returned.
|
||||
*
|
||||
* @param NSSConfigDir The NSS directory containing the private key for signing
|
||||
|
@ -816,18 +816,18 @@ failure:
|
|||
* -1 on error
|
||||
*/
|
||||
int
|
||||
mar_repackage_and_sign(const char *NSSConfigDir,
|
||||
mar_repackage_and_sign(const char *NSSConfigDir,
|
||||
const char * const *certNames,
|
||||
uint32_t certCount,
|
||||
const char *src,
|
||||
const char *dest)
|
||||
const char *src,
|
||||
const char *dest)
|
||||
{
|
||||
uint32_t offsetToIndex, dstOffsetToIndex, indexLength,
|
||||
uint32_t offsetToIndex, dstOffsetToIndex, indexLength,
|
||||
numSignatures = 0, leftOver,
|
||||
signatureAlgorithmID, signatureSectionLength = 0;
|
||||
uint32_t signatureLengths[MAX_SIGNATURES];
|
||||
int64_t oldPos, sizeOfEntireMAR = 0, realSizeOfSrcMAR,
|
||||
signaturePlaceholderOffset, numBytesToCopy,
|
||||
int64_t oldPos, sizeOfEntireMAR = 0, realSizeOfSrcMAR,
|
||||
signaturePlaceholderOffset, numBytesToCopy,
|
||||
numChunks, i;
|
||||
FILE *fpSrc = NULL, *fpDest = NULL;
|
||||
int rv = -1, hasSignatureBlock;
|
||||
|
@ -911,7 +911,7 @@ mar_repackage_and_sign(const char *NSSConfigDir,
|
|||
|
||||
if (hasSignatureBlock) {
|
||||
/* Get the MAR length and adjust its size */
|
||||
if (fread(&sizeOfEntireMAR,
|
||||
if (fread(&sizeOfEntireMAR,
|
||||
sizeof(sizeOfEntireMAR), 1, fpSrc) != 1) {
|
||||
fprintf(stderr, "ERROR: Could read mar size\n");
|
||||
goto failure;
|
||||
|
@ -921,7 +921,7 @@ mar_repackage_and_sign(const char *NSSConfigDir,
|
|||
fprintf(stderr, "ERROR: Source MAR is not of the right size\n");
|
||||
goto failure;
|
||||
}
|
||||
|
||||
|
||||
/* Get the num signatures in the source file */
|
||||
if (fread(&numSignatures, sizeof(numSignatures), 1, fpSrc) != 1) {
|
||||
fprintf(stderr, "ERROR: Could read num signatures\n");
|
||||
|
@ -1067,9 +1067,9 @@ mar_repackage_and_sign(const char *NSSConfigDir,
|
|||
if (hasSignatureBlock) {
|
||||
AdjustIndexContentOffsets(indexBuf, indexLength, signatureSectionLength);
|
||||
} else {
|
||||
AdjustIndexContentOffsets(indexBuf, indexLength,
|
||||
sizeof(sizeOfEntireMAR) +
|
||||
sizeof(numSignatures) +
|
||||
AdjustIndexContentOffsets(indexBuf, indexLength,
|
||||
sizeof(sizeOfEntireMAR) +
|
||||
sizeof(numSignatures) +
|
||||
signatureSectionLength);
|
||||
}
|
||||
|
||||
|
@ -1119,7 +1119,7 @@ mar_repackage_and_sign(const char *NSSConfigDir,
|
|||
}
|
||||
|
||||
rv = 0;
|
||||
failure:
|
||||
failure:
|
||||
if (fpSrc) {
|
||||
fclose(fpSrc);
|
||||
}
|
||||
|
@ -1132,7 +1132,7 @@ failure:
|
|||
remove(dest);
|
||||
}
|
||||
|
||||
if (indexBuf) {
|
||||
if (indexBuf) {
|
||||
free(indexBuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ GetPasswordString(void *arg, char *prompt)
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (isInputTerminal) {
|
||||
fprintf(stdout, "Please enter your password:\n");
|
||||
|
@ -97,7 +97,7 @@ GetPasswordString(void *arg, char *prompt)
|
|||
#endif
|
||||
|
||||
/* Strip off the newlines if present */
|
||||
if (phrase[PORT_Strlen(phrase)-1] == '\n' ||
|
||||
if (phrase[PORT_Strlen(phrase)-1] == '\n' ||
|
||||
phrase[PORT_Strlen(phrase)-1] == '\r') {
|
||||
phrase[PORT_Strlen(phrase)-1] = 0;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ SECU_FilePasswd(PK11SlotInfo *slot, PRBool retry, void *arg)
|
|||
}
|
||||
|
||||
char *
|
||||
SECU_GetModulePassword(PK11SlotInfo *slot, PRBool retry, void *arg)
|
||||
SECU_GetModulePassword(PK11SlotInfo *slot, PRBool retry, void *arg)
|
||||
{
|
||||
char prompt[255];
|
||||
secuPWData *pwdata = (secuPWData *)arg;
|
||||
|
@ -219,7 +219,7 @@ SECU_GetModulePassword(PK11SlotInfo *slot, PRBool retry, void *arg)
|
|||
/* it's already been dup'ed */
|
||||
return pw;
|
||||
case PW_EXTERNAL:
|
||||
sprintf(prompt,
|
||||
sprintf(prompt,
|
||||
"Press Enter, then enter PIN for \"%s\" on external device.\n",
|
||||
PK11_GetTokenName(slot));
|
||||
pw = GetPasswordString(NULL, prompt);
|
||||
|
|
|
@ -122,9 +122,9 @@ int mar_read(MarFile *mar, const MarItem *item, int offset, uint8_t *buf,
|
|||
* @param infoBlock The information to store in the product information block.
|
||||
* @return A non-zero value if an error occurs.
|
||||
*/
|
||||
int mar_create(const char *dest,
|
||||
int numfiles,
|
||||
char **files,
|
||||
int mar_create(const char *dest,
|
||||
int numfiles,
|
||||
char **files,
|
||||
struct ProductInformationBlock *infoBlock);
|
||||
|
||||
/**
|
||||
|
@ -147,7 +147,7 @@ int mar_extract(const char *path);
|
|||
* @param data On success, *data will point to a newly-allocated buffer
|
||||
* with the file's contents in it.
|
||||
* @param size On success, *size will be the size of the created buffer.
|
||||
*
|
||||
*
|
||||
* @return 0 on success, -1 on error
|
||||
*/
|
||||
int mar_read_entire_file(const char * filePath,
|
||||
|
@ -161,10 +161,10 @@ int mar_read_entire_file(const char * filePath,
|
|||
* certificate given, the second signature will be verified using the second
|
||||
* certificate given, etc. The signature count must exactly match the number of
|
||||
* certificates given, and all signature verifications must succeed.
|
||||
* We do not check that the certificate was issued by any trusted authority.
|
||||
* We assume it to be self-signed. We do not check whether the certificate
|
||||
* We do not check that the certificate was issued by any trusted authority.
|
||||
* We assume it to be self-signed. We do not check whether the certificate
|
||||
* is valid for this usage.
|
||||
*
|
||||
*
|
||||
* @param mar The already opened MAR file.
|
||||
* @param certData Pointer to the first element in an array of certificate
|
||||
* file data.
|
||||
|
@ -180,7 +180,7 @@ int mar_verify_signatures(MarFile *mar,
|
|||
const uint32_t *certDataSizes,
|
||||
uint32_t certCount);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Reads the product info block from the MAR file's additional block section.
|
||||
* The caller is responsible for freeing the fields in infoBlock
|
||||
* if the return is successful.
|
||||
|
@ -189,7 +189,7 @@ int mar_verify_signatures(MarFile *mar,
|
|||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int
|
||||
mar_read_product_info_block(MarFile *mar,
|
||||
mar_read_product_info_block(MarFile *mar,
|
||||
struct ProductInformationBlock *infoBlock);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -23,7 +23,7 @@ struct ProductInformationBlock;
|
|||
* of signatures in the MAR file.
|
||||
* @param hasAdditionalBlocks Optional out parameter specifying if the MAR
|
||||
* file has additional blocks or not.
|
||||
* @param offsetAdditionalBlocks Optional out parameter for the offset to the
|
||||
* @param offsetAdditionalBlocks Optional out parameter for the offset to the
|
||||
* first additional block. Value is only valid if
|
||||
* hasAdditionalBlocks is not equal to 0.
|
||||
* @param numAdditionalBlocks Optional out parameter for the number of
|
||||
|
@ -31,14 +31,14 @@ struct ProductInformationBlock;
|
|||
* has_additional_blocks is not equal to 0.
|
||||
* @return 0 on success and non-zero on failure.
|
||||
*/
|
||||
int get_mar_file_info(const char *path,
|
||||
int get_mar_file_info(const char *path,
|
||||
int *hasSignatureBlock,
|
||||
uint32_t *numSignatures,
|
||||
int *hasAdditionalBlocks,
|
||||
uint32_t *offsetAdditionalBlocks,
|
||||
uint32_t *numAdditionalBlocks);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Reads the product info block from the MAR file's additional block section.
|
||||
* The caller is responsible for freeing the fields in infoBlock
|
||||
* if the return is successful.
|
||||
|
@ -47,13 +47,13 @@ int get_mar_file_info(const char *path,
|
|||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int
|
||||
read_product_info_block(char *path,
|
||||
read_product_info_block(char *path,
|
||||
struct ProductInformationBlock *infoBlock);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Refreshes the product information block with the new information.
|
||||
* The input MAR must not be signed or the function call will fail.
|
||||
*
|
||||
*
|
||||
* @param path The path to the MAR file whose product info block
|
||||
* should be refreshed.
|
||||
* @param infoBlock Out parameter for where to store the result to
|
||||
|
@ -67,7 +67,7 @@ refresh_product_info_block(const char *path,
|
|||
* Writes out a copy of the MAR at src but with the signature block stripped.
|
||||
*
|
||||
* @param src The path of the source MAR file
|
||||
* @param dest The path of the MAR file to write out that
|
||||
* @param dest The path of the MAR file to write out that
|
||||
has no signature block
|
||||
* @return 0 on success
|
||||
* -1 on error
|
||||
|
|
|
@ -37,7 +37,7 @@ static int mar_push(struct MarItemStack *stack, uint32_t length, uint32_t flags,
|
|||
uint32_t n_offset, n_length, n_flags;
|
||||
uint32_t size;
|
||||
char *data;
|
||||
|
||||
|
||||
namelen = strlen(name);
|
||||
size = MAR_ITEM_SIZE(namelen);
|
||||
|
||||
|
@ -66,7 +66,7 @@ static int mar_push(struct MarItemStack *stack, uint32_t length, uint32_t flags,
|
|||
data += sizeof(n_flags);
|
||||
|
||||
memcpy(data, name, namelen + 1);
|
||||
|
||||
|
||||
stack->size_used += size;
|
||||
stack->last_offset += length;
|
||||
return 0;
|
||||
|
@ -100,24 +100,24 @@ static int mar_concat_file(FILE *fp, const char *path) {
|
|||
* Writes out the product information block to the specified file.
|
||||
*
|
||||
* @param fp The opened MAR file being created.
|
||||
* @param stack A pointer to the MAR item stack being used to create
|
||||
* @param stack A pointer to the MAR item stack being used to create
|
||||
* the MAR
|
||||
* @param infoBlock The product info block to store in the file.
|
||||
* @return 0 on success.
|
||||
*/
|
||||
static int
|
||||
mar_concat_product_info_block(FILE *fp,
|
||||
mar_concat_product_info_block(FILE *fp,
|
||||
struct MarItemStack *stack,
|
||||
struct ProductInformationBlock *infoBlock)
|
||||
{
|
||||
char buf[PIB_MAX_MAR_CHANNEL_ID_SIZE + PIB_MAX_PRODUCT_VERSION_SIZE];
|
||||
uint32_t additionalBlockID = 1, infoBlockSize, unused;
|
||||
if (!fp || !infoBlock ||
|
||||
if (!fp || !infoBlock ||
|
||||
!infoBlock->MARChannelID ||
|
||||
!infoBlock->productVersion) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* The MAR channel name must be < 64 bytes per the spec */
|
||||
if (strlen(infoBlock->MARChannelID) > PIB_MAX_MAR_CHANNEL_ID_SIZE) {
|
||||
return -1;
|
||||
|
@ -142,7 +142,7 @@ mar_concat_product_info_block(FILE *fp,
|
|||
|
||||
/* Write out the product info block size */
|
||||
infoBlockSize = htonl(infoBlockSize);
|
||||
if (fwrite(&infoBlockSize,
|
||||
if (fwrite(&infoBlockSize,
|
||||
sizeof(infoBlockSize), 1, fp) != 1) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -150,20 +150,20 @@ mar_concat_product_info_block(FILE *fp,
|
|||
|
||||
/* Write out the product info block ID */
|
||||
additionalBlockID = htonl(additionalBlockID);
|
||||
if (fwrite(&additionalBlockID,
|
||||
if (fwrite(&additionalBlockID,
|
||||
sizeof(additionalBlockID), 1, fp) != 1) {
|
||||
return -1;
|
||||
}
|
||||
additionalBlockID = ntohl(additionalBlockID);
|
||||
|
||||
/* Write out the channel name and NULL terminator */
|
||||
if (fwrite(infoBlock->MARChannelID,
|
||||
if (fwrite(infoBlock->MARChannelID,
|
||||
strlen(infoBlock->MARChannelID) + 1, 1, fp) != 1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Write out the product version string and NULL terminator */
|
||||
if (fwrite(infoBlock->productVersion,
|
||||
if (fwrite(infoBlock->productVersion,
|
||||
strlen(infoBlock->productVersion) + 1, 1, fp) != 1) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ mar_concat_product_info_block(FILE *fp,
|
|||
/* Write out the rest of the block that is unused */
|
||||
unused = infoBlockSize - (sizeof(infoBlockSize) +
|
||||
sizeof(additionalBlockID) +
|
||||
strlen(infoBlock->MARChannelID) +
|
||||
strlen(infoBlock->MARChannelID) +
|
||||
strlen(infoBlock->productVersion) + 2);
|
||||
memset(buf, 0, sizeof(buf));
|
||||
if (fwrite(buf, unused, 1, fp) != 1) {
|
||||
|
@ -180,10 +180,10 @@ mar_concat_product_info_block(FILE *fp,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Refreshes the product information block with the new information.
|
||||
* The input MAR must not be signed or the function call will fail.
|
||||
*
|
||||
*
|
||||
* @param path The path to the MAR file whose product info block
|
||||
* should be refreshed.
|
||||
* @param infoBlock Out parameter for where to store the result to
|
||||
|
@ -200,7 +200,7 @@ refresh_product_info_block(const char *path,
|
|||
int additionalBlocks, hasSignatureBlock;
|
||||
int64_t oldPos;
|
||||
|
||||
rv = get_mar_file_info(path,
|
||||
rv = get_mar_file_info(path,
|
||||
&hasSignatureBlock,
|
||||
&numSignatures,
|
||||
&additionalBlocks,
|
||||
|
@ -233,8 +233,8 @@ refresh_product_info_block(const char *path,
|
|||
oldPos = ftello(fp);
|
||||
|
||||
/* Read the additional block size */
|
||||
if (fread(&additionalBlockSize,
|
||||
sizeof(additionalBlockSize),
|
||||
if (fread(&additionalBlockSize,
|
||||
sizeof(additionalBlockSize),
|
||||
1, fp) != 1) {
|
||||
fclose(fp);
|
||||
return -1;
|
||||
|
@ -242,8 +242,8 @@ refresh_product_info_block(const char *path,
|
|||
additionalBlockSize = ntohl(additionalBlockSize);
|
||||
|
||||
/* Read the additional block ID */
|
||||
if (fread(&additionalBlockID,
|
||||
sizeof(additionalBlockID),
|
||||
if (fread(&additionalBlockID,
|
||||
sizeof(additionalBlockID),
|
||||
1, fp) != 1) {
|
||||
fclose(fp);
|
||||
return -1;
|
||||
|
@ -291,11 +291,11 @@ refresh_product_info_block(const char *path,
|
|||
* @param infoBlock The information to store in the product information block.
|
||||
* @return A non-zero value if an error occurs.
|
||||
*/
|
||||
int mar_create(const char *dest, int
|
||||
num_files, char **files,
|
||||
int mar_create(const char *dest, int
|
||||
num_files, char **files,
|
||||
struct ProductInformationBlock *infoBlock) {
|
||||
struct MarItemStack stack;
|
||||
uint32_t offset_to_index = 0, size_of_index,
|
||||
uint32_t offset_to_index = 0, size_of_index,
|
||||
numSignatures, numAdditionalSections;
|
||||
uint64_t sizeOfEntireMAR = 0;
|
||||
struct stat st;
|
||||
|
@ -315,9 +315,9 @@ int mar_create(const char *dest, int
|
|||
if (fwrite(&offset_to_index, sizeof(uint32_t), 1, fp) != 1)
|
||||
goto failure;
|
||||
|
||||
stack.last_offset = MAR_ID_SIZE +
|
||||
stack.last_offset = MAR_ID_SIZE +
|
||||
sizeof(offset_to_index) +
|
||||
sizeof(numSignatures) +
|
||||
sizeof(numSignatures) +
|
||||
sizeof(numAdditionalSections) +
|
||||
sizeof(sizeOfEntireMAR);
|
||||
|
||||
|
@ -332,10 +332,10 @@ int mar_create(const char *dest, int
|
|||
goto failure;
|
||||
}
|
||||
|
||||
/* Write out the number of additional sections, for now just 1
|
||||
/* Write out the number of additional sections, for now just 1
|
||||
for the product info block */
|
||||
numAdditionalSections = htonl(1);
|
||||
if (fwrite(&numAdditionalSections,
|
||||
if (fwrite(&numAdditionalSections,
|
||||
sizeof(numAdditionalSections), 1, fp) != 1) {
|
||||
goto failure;
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ int mar_create(const char *dest, int
|
|||
if (fwrite(stack.head, stack.size_used, 1, fp) != 1)
|
||||
goto failure;
|
||||
|
||||
/* To protect against invalid MAR files, we assumes that the MAR file
|
||||
/* To protect against invalid MAR files, we assumes that the MAR file
|
||||
size is less than or equal to MAX_SIZE_OF_MAR_FILE. */
|
||||
if (ftell(fp) > MAX_SIZE_OF_MAR_FILE) {
|
||||
goto failure;
|
||||
|
@ -379,7 +379,7 @@ int mar_create(const char *dest, int
|
|||
if (fwrite(&offset_to_index, sizeof(offset_to_index), 1, fp) != 1)
|
||||
goto failure;
|
||||
offset_to_index = ntohl(stack.last_offset);
|
||||
|
||||
|
||||
sizeOfEntireMAR = ((uint64_t)stack.last_offset) +
|
||||
stack.size_used +
|
||||
sizeof(size_of_index);
|
||||
|
@ -389,7 +389,7 @@ int mar_create(const char *dest, int
|
|||
sizeOfEntireMAR = NETWORK_TO_HOST64(sizeOfEntireMAR);
|
||||
|
||||
rv = 0;
|
||||
failure:
|
||||
failure:
|
||||
if (stack.head)
|
||||
free(stack.head);
|
||||
fclose(fp);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#define MAR_ID "MAR1"
|
||||
#define MAR_ID_SIZE 4
|
||||
|
||||
/* The signature block comes directly after the header block
|
||||
/* The signature block comes directly after the header block
|
||||
which is 16 bytes */
|
||||
#define SIGNATURE_BLOCK_OFFSET 16
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
MOZ_STATIC_ASSERT(MAX_SIZE_OF_MAR_FILE < ((int64_t)LONG_MAX),
|
||||
"max mar file size is too big");
|
||||
|
||||
/* We store at most the size up to the signature block + 4
|
||||
/* We store at most the size up to the signature block + 4
|
||||
bytes per BLOCKSIZE bytes */
|
||||
MOZ_STATIC_ASSERT(sizeof(BLOCKSIZE) < \
|
||||
(SIGNATURE_BLOCK_OFFSET + sizeof(uint32_t)),
|
||||
|
@ -40,7 +40,7 @@ MOZ_STATIC_ASSERT(sizeof(BLOCKSIZE) < \
|
|||
implementations of the signmar program. */
|
||||
#define MAX_SIGNATURE_LENGTH 2048
|
||||
|
||||
/* Each additional block has a unique ID.
|
||||
/* Each additional block has a unique ID.
|
||||
The product information block has an ID of 1. */
|
||||
#define PRODUCT_INFO_BLOCK_ID 1
|
||||
|
||||
|
@ -51,7 +51,7 @@ MOZ_STATIC_ASSERT(sizeof(BLOCKSIZE) < \
|
|||
#define PIB_MAX_PRODUCT_VERSION_SIZE 31
|
||||
|
||||
/* The mar program is compiled as a host bin so we don't have access to NSPR at
|
||||
runtime. For that reason we use ntohl, htonl, and define HOST_TO_NETWORK64
|
||||
runtime. For that reason we use ntohl, htonl, and define HOST_TO_NETWORK64
|
||||
instead of the NSPR equivalents. */
|
||||
#ifdef XP_WIN
|
||||
#include <winsock2.h>
|
||||
|
|
|
@ -33,7 +33,7 @@ static int mar_insert_item(MarFile *mar, const char *name, int namelen,
|
|||
uint32_t offset, uint32_t length, uint32_t flags) {
|
||||
MarItem *item, *root;
|
||||
uint32_t hash;
|
||||
|
||||
|
||||
item = (MarItem *) malloc(sizeof(MarItem) + namelen);
|
||||
if (!item)
|
||||
return -1;
|
||||
|
@ -223,7 +223,7 @@ void mar_close(MarFile *mar) {
|
|||
* of signatures in the MAR file.
|
||||
* @param hasAdditionalBlocks Optional out parameter specifying if the MAR
|
||||
* file has additional blocks or not.
|
||||
* @param offsetAdditionalBlocks Optional out parameter for the offset to the
|
||||
* @param offsetAdditionalBlocks Optional out parameter for the offset to the
|
||||
* first additional block. Value is only valid if
|
||||
* hasAdditionalBlocks is not equal to 0.
|
||||
* @param numAdditionalBlocks Optional out parameter for the number of
|
||||
|
@ -231,7 +231,7 @@ void mar_close(MarFile *mar) {
|
|||
* hasAdditionalBlocks is not equal to 0.
|
||||
* @return 0 on success and non-zero on failure.
|
||||
*/
|
||||
int get_mar_file_info_fp(FILE *fp,
|
||||
int get_mar_file_info_fp(FILE *fp,
|
||||
int *hasSignatureBlock,
|
||||
uint32_t *numSignatures,
|
||||
int *hasAdditionalBlocks,
|
||||
|
@ -239,7 +239,7 @@ int get_mar_file_info_fp(FILE *fp,
|
|||
uint32_t *numAdditionalBlocks)
|
||||
{
|
||||
uint32_t offsetToIndex, offsetToContent, signatureCount, signatureLen, i;
|
||||
|
||||
|
||||
/* One of hasSignatureBlock or hasAdditionalBlocks must be non NULL */
|
||||
if (!hasSignatureBlock && !hasAdditionalBlocks) {
|
||||
return -1;
|
||||
|
@ -270,8 +270,8 @@ int get_mar_file_info_fp(FILE *fp,
|
|||
*numSignatures = ntohl(*numSignatures);
|
||||
}
|
||||
|
||||
/* Skip to the first index entry past the index size field
|
||||
We do it in 2 calls because offsetToIndex + sizeof(uint32_t)
|
||||
/* Skip to the first index entry past the index size field
|
||||
We do it in 2 calls because offsetToIndex + sizeof(uint32_t)
|
||||
could oerflow in theory. */
|
||||
if (fseek(fp, offsetToIndex, SEEK_SET)) {
|
||||
return -1;
|
||||
|
@ -296,7 +296,7 @@ int get_mar_file_info_fp(FILE *fp,
|
|||
}
|
||||
}
|
||||
|
||||
/* If the caller doesn't care about the product info block
|
||||
/* If the caller doesn't care about the product info block
|
||||
value, then just return */
|
||||
if (!hasAdditionalBlocks) {
|
||||
return 0;
|
||||
|
@ -351,7 +351,7 @@ int get_mar_file_info_fp(FILE *fp,
|
|||
*offsetAdditionalBlocks = ftell(fp);
|
||||
}
|
||||
} else if (offsetAdditionalBlocks) {
|
||||
/* numAdditionalBlocks is not specified but offsetAdditionalBlocks
|
||||
/* numAdditionalBlocks is not specified but offsetAdditionalBlocks
|
||||
is, so fill it! */
|
||||
*offsetAdditionalBlocks = ftell(fp) + sizeof(uint32_t);
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ int get_mar_file_info_fp(FILE *fp,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Reads the product info block from the MAR file's additional block section.
|
||||
* The caller is responsible for freeing the fields in infoBlock
|
||||
* if the return is successful.
|
||||
|
@ -369,7 +369,7 @@ int get_mar_file_info_fp(FILE *fp,
|
|||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int
|
||||
read_product_info_block(char *path,
|
||||
read_product_info_block(char *path,
|
||||
struct ProductInformationBlock *infoBlock)
|
||||
{
|
||||
int rv;
|
||||
|
@ -385,7 +385,7 @@ read_product_info_block(char *path,
|
|||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Reads the product info block from the MAR file's additional block section.
|
||||
* The caller is responsible for freeing the fields in infoBlock
|
||||
* if the return is successful.
|
||||
|
@ -394,14 +394,14 @@ read_product_info_block(char *path,
|
|||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int
|
||||
mar_read_product_info_block(MarFile *mar,
|
||||
mar_read_product_info_block(MarFile *mar,
|
||||
struct ProductInformationBlock *infoBlock)
|
||||
{
|
||||
uint32_t i, offsetAdditionalBlocks, numAdditionalBlocks,
|
||||
additionalBlockSize, additionalBlockID;
|
||||
int hasAdditionalBlocks;
|
||||
|
||||
/* The buffer size is 97 bytes because the MAR channel name < 64 bytes, and
|
||||
/* The buffer size is 97 bytes because the MAR channel name < 64 bytes, and
|
||||
product version < 32 bytes + 3 NULL terminator bytes. */
|
||||
char buf[97] = { '\0' };
|
||||
if (get_mar_file_info_fp(mar->fp, NULL, NULL,
|
||||
|
@ -412,18 +412,18 @@ mar_read_product_info_block(MarFile *mar,
|
|||
}
|
||||
for (i = 0; i < numAdditionalBlocks; ++i) {
|
||||
/* Read the additional block size */
|
||||
if (fread(&additionalBlockSize,
|
||||
sizeof(additionalBlockSize),
|
||||
if (fread(&additionalBlockSize,
|
||||
sizeof(additionalBlockSize),
|
||||
1, mar->fp) != 1) {
|
||||
return -1;
|
||||
}
|
||||
additionalBlockSize = ntohl(additionalBlockSize) -
|
||||
sizeof(additionalBlockSize) -
|
||||
additionalBlockSize = ntohl(additionalBlockSize) -
|
||||
sizeof(additionalBlockSize) -
|
||||
sizeof(additionalBlockID);
|
||||
|
||||
/* Read the additional block ID */
|
||||
if (fread(&additionalBlockID,
|
||||
sizeof(additionalBlockID),
|
||||
if (fread(&additionalBlockID,
|
||||
sizeof(additionalBlockID),
|
||||
1, mar->fp) != 1) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -434,9 +434,9 @@ mar_read_product_info_block(MarFile *mar,
|
|||
int len;
|
||||
|
||||
/* This block must be at most 104 bytes.
|
||||
MAR channel name < 64 bytes, and product version < 32 bytes + 3 NULL
|
||||
terminator bytes. We only check for 96 though because we remove 8
|
||||
bytes above from the additionalBlockSize: We subtract
|
||||
MAR channel name < 64 bytes, and product version < 32 bytes + 3 NULL
|
||||
terminator bytes. We only check for 96 though because we remove 8
|
||||
bytes above from the additionalBlockSize: We subtract
|
||||
sizeof(additionalBlockSize) and sizeof(additionalBlockID) */
|
||||
if (additionalBlockSize > 96) {
|
||||
return -1;
|
||||
|
@ -466,9 +466,9 @@ mar_read_product_info_block(MarFile *mar,
|
|||
infoBlock->productVersion = NULL;
|
||||
return -1;
|
||||
}
|
||||
infoBlock->MARChannelID =
|
||||
infoBlock->MARChannelID =
|
||||
strdup(infoBlock->MARChannelID);
|
||||
infoBlock->productVersion =
|
||||
infoBlock->productVersion =
|
||||
strdup(infoBlock->productVersion);
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -558,7 +558,7 @@ int mar_read(MarFile *mar, const MarItem *item, int offset, uint8_t *buf,
|
|||
* of signatures in the MAR file.
|
||||
* @param hasAdditionalBlocks Optional out parameter specifying if the MAR
|
||||
* file has additional blocks or not.
|
||||
* @param offsetAdditionalBlocks Optional out parameter for the offset to the
|
||||
* @param offsetAdditionalBlocks Optional out parameter for the offset to the
|
||||
* first additional block. Value is only valid if
|
||||
* hasAdditionalBlocks is not equal to 0.
|
||||
* @param numAdditionalBlocks Optional out parameter for the number of
|
||||
|
@ -566,7 +566,7 @@ int mar_read(MarFile *mar, const MarItem *item, int offset, uint8_t *buf,
|
|||
* has_additional_blocks is not equal to 0.
|
||||
* @return 0 on success and non-zero on failure.
|
||||
*/
|
||||
int get_mar_file_info(const char *path,
|
||||
int get_mar_file_info(const char *path,
|
||||
int *hasSignatureBlock,
|
||||
uint32_t *numSignatures,
|
||||
int *hasAdditionalBlocks,
|
||||
|
@ -581,7 +581,7 @@ int get_mar_file_info(const char *path,
|
|||
return -1;
|
||||
}
|
||||
|
||||
rv = get_mar_file_info_fp(fp, hasSignatureBlock,
|
||||
rv = get_mar_file_info_fp(fp, hasSignatureBlock,
|
||||
numSignatures, hasAdditionalBlocks,
|
||||
offsetAdditionalBlocks, numAdditionalBlocks);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ int NSSInitCryptoContext(const char *NSSConfigDir);
|
|||
int mar_repackage_and_sign(const char *NSSConfigDir,
|
||||
const char * const *certNames,
|
||||
uint32_t certCount,
|
||||
const char *src,
|
||||
const char *src,
|
||||
const char * dest);
|
||||
|
||||
static void print_version() {
|
||||
|
@ -92,8 +92,8 @@ static void print_usage() {
|
|||
printf("This program does not handle unicode file paths properly\n");
|
||||
}
|
||||
|
||||
static int mar_test_callback(MarFile *mar,
|
||||
const MarItem *item,
|
||||
static int mar_test_callback(MarFile *mar,
|
||||
const MarItem *item,
|
||||
void *unused) {
|
||||
printf("%u\t0%o\t%s\n", item->length, item->flags, item->name);
|
||||
return 0;
|
||||
|
@ -257,18 +257,18 @@ int main(int argc, char **argv) {
|
|||
struct ProductInformationBlock infoBlock;
|
||||
uint32_t numSignatures, numAdditionalBlocks;
|
||||
int hasSignatureBlock, hasAdditionalBlock;
|
||||
if (!get_mar_file_info(argv[2],
|
||||
if (!get_mar_file_info(argv[2],
|
||||
&hasSignatureBlock,
|
||||
&numSignatures,
|
||||
&hasAdditionalBlock,
|
||||
&hasAdditionalBlock,
|
||||
NULL, &numAdditionalBlocks)) {
|
||||
if (hasSignatureBlock) {
|
||||
printf("Signature block found with %d signature%s\n",
|
||||
numSignatures,
|
||||
printf("Signature block found with %d signature%s\n",
|
||||
numSignatures,
|
||||
numSignatures != 1 ? "s" : "");
|
||||
}
|
||||
if (hasAdditionalBlock) {
|
||||
printf("%d additional block%s found:\n",
|
||||
printf("%d additional block%s found:\n",
|
||||
numAdditionalBlocks,
|
||||
numAdditionalBlocks != 1 ? "s" : "");
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ int main(int argc, char **argv) {
|
|||
if (rv) {
|
||||
/* Determine if the source MAR file has the new fields for signing */
|
||||
int hasSignatureBlock;
|
||||
if (get_mar_file_info(argv[2], &hasSignatureBlock,
|
||||
if (get_mar_file_info(argv[2], &hasSignatureBlock,
|
||||
NULL, NULL, NULL, NULL)) {
|
||||
fprintf(stderr, "ERROR: could not determine if MAR is old or new.\n");
|
||||
} else if (!hasSignatureBlock) {
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
#if defined(MAR_NSS)
|
||||
|
||||
/**
|
||||
/**
|
||||
* Loads the public key for the specified cert name from the NSS store.
|
||||
*
|
||||
*
|
||||
* @param certData The DER-encoded X509 certificate to extract the key from.
|
||||
* @param certDataSize The size of certData.
|
||||
* @param publicKey Out parameter for the public key to use.
|
||||
|
@ -49,7 +49,7 @@ NSS_LoadPublicKey(const unsigned char *certData, unsigned int certDataSize,
|
|||
}
|
||||
|
||||
CryptoX_Result
|
||||
NSS_VerifyBegin(VFYContext **ctx,
|
||||
NSS_VerifyBegin(VFYContext **ctx,
|
||||
SECKEYPublicKey * const *publicKey)
|
||||
{
|
||||
SECStatus status;
|
||||
|
@ -58,14 +58,14 @@ NSS_VerifyBegin(VFYContext **ctx,
|
|||
}
|
||||
|
||||
/* Check that the key length is large enough for our requirements */
|
||||
if ((SECKEY_PublicKeyStrength(*publicKey) * 8) <
|
||||
if ((SECKEY_PublicKeyStrength(*publicKey) * 8) <
|
||||
XP_MIN_SIGNATURE_LEN_IN_BYTES) {
|
||||
fprintf(stderr, "ERROR: Key length must be >= %d bytes\n",
|
||||
fprintf(stderr, "ERROR: Key length must be >= %d bytes\n",
|
||||
XP_MIN_SIGNATURE_LEN_IN_BYTES);
|
||||
return CryptoX_Error;
|
||||
}
|
||||
|
||||
*ctx = VFY_CreateContext(*publicKey, NULL,
|
||||
*ctx = VFY_CreateContext(*publicKey, NULL,
|
||||
SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION, NULL);
|
||||
if (*ctx == NULL) {
|
||||
return CryptoX_Error;
|
||||
|
@ -84,8 +84,8 @@ NSS_VerifyBegin(VFYContext **ctx,
|
|||
* @return CryptoX_Success on success, CryptoX_Error on error.
|
||||
*/
|
||||
CryptoX_Result
|
||||
NSS_VerifySignature(VFYContext * const *ctx,
|
||||
const unsigned char *signature,
|
||||
NSS_VerifySignature(VFYContext * const *ctx,
|
||||
const unsigned char *signature,
|
||||
unsigned int signatureLen)
|
||||
{
|
||||
SECItem signedItem;
|
||||
|
@ -113,13 +113,13 @@ NSS_VerifySignature(VFYContext * const *ctx,
|
|||
CryptoX_Result
|
||||
CryptoAPI_VerifySignature(HCRYPTHASH *hash,
|
||||
HCRYPTKEY *pubKey,
|
||||
const BYTE *signature,
|
||||
const BYTE *signature,
|
||||
DWORD signatureLen)
|
||||
{
|
||||
DWORD i;
|
||||
BOOL result;
|
||||
/* Windows APIs expect the bytes in the signature to be in little-endian
|
||||
* order, but we write the signature in big-endian order. Other APIs like
|
||||
/* Windows APIs expect the bytes in the signature to be in little-endian
|
||||
* order, but we write the signature in big-endian order. Other APIs like
|
||||
* NSS and OpenSSL expect big-endian order.
|
||||
*/
|
||||
BYTE *signatureReversed;
|
||||
|
@ -133,7 +133,7 @@ CryptoAPI_VerifySignature(HCRYPTHASH *hash,
|
|||
}
|
||||
|
||||
for (i = 0; i < signatureLen; i++) {
|
||||
signatureReversed[i] = signature[signatureLen - 1 - i];
|
||||
signatureReversed[i] = signature[signatureLen - 1 - i];
|
||||
}
|
||||
result = CryptVerifySignature(*hash, signatureReversed,
|
||||
signatureLen, *pubKey, NULL, 0);
|
||||
|
@ -141,9 +141,9 @@ CryptoAPI_VerifySignature(HCRYPTHASH *hash,
|
|||
return result ? CryptoX_Success : CryptoX_Error;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Obtains the public key for the passed in cert data
|
||||
*
|
||||
*
|
||||
* @param provider The cyrto provider
|
||||
* @param certData Data of the certificate to extract the public key from
|
||||
* @param sizeOfCertData The size of the certData buffer
|
||||
|
@ -151,7 +151,7 @@ CryptoAPI_VerifySignature(HCRYPTHASH *hash,
|
|||
* @param CryptoX_Success on success
|
||||
*/
|
||||
CryptoX_Result
|
||||
CryptoAPI_LoadPublicKey(HCRYPTPROV provider,
|
||||
CryptoAPI_LoadPublicKey(HCRYPTPROV provider,
|
||||
BYTE *certData,
|
||||
DWORD sizeOfCertData,
|
||||
HCRYPTKEY *publicKey)
|
||||
|
@ -164,15 +164,15 @@ CryptoAPI_LoadPublicKey(HCRYPTPROV provider,
|
|||
|
||||
blob.cbData = sizeOfCertData;
|
||||
blob.pbData = certData;
|
||||
if (!CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
|
||||
CERT_QUERY_CONTENT_FLAG_CERT,
|
||||
CERT_QUERY_FORMAT_FLAG_BINARY,
|
||||
0, NULL, NULL, NULL,
|
||||
if (!CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
|
||||
CERT_QUERY_CONTENT_FLAG_CERT,
|
||||
CERT_QUERY_FORMAT_FLAG_BINARY,
|
||||
0, NULL, NULL, NULL,
|
||||
NULL, NULL, (const void **)&context)) {
|
||||
return CryptoX_Error;
|
||||
}
|
||||
|
||||
if (!CryptImportPublicKeyInfo(provider,
|
||||
if (!CryptImportPublicKeyInfo(provider,
|
||||
PKCS_7_ASN_ENCODING | X509_ASN_ENCODING,
|
||||
&context->pCertInfo->SubjectPublicKeyInfo,
|
||||
publicKey)) {
|
||||
|
@ -189,7 +189,7 @@ CryptoAPI_LoadPublicKey(HCRYPTPROV provider,
|
|||
* 2. Enhanced provider with creating a new key set
|
||||
* 3. Default provider without creating a new key set
|
||||
* 4. Default provider without creating a new key set
|
||||
* #2 and #4 should not be needed because of the CRYPT_VERIFYCONTEXT,
|
||||
* #2 and #4 should not be needed because of the CRYPT_VERIFYCONTEXT,
|
||||
* but we add it just in case.
|
||||
*
|
||||
* @param provider Out parameter containing the provider handle.
|
||||
|
@ -198,25 +198,25 @@ CryptoAPI_LoadPublicKey(HCRYPTPROV provider,
|
|||
CryptoX_Result
|
||||
CryptoAPI_InitCryptoContext(HCRYPTPROV *provider)
|
||||
{
|
||||
if (!CryptAcquireContext(provider,
|
||||
NULL,
|
||||
MS_ENH_RSA_AES_PROV,
|
||||
PROV_RSA_AES,
|
||||
if (!CryptAcquireContext(provider,
|
||||
NULL,
|
||||
MS_ENH_RSA_AES_PROV,
|
||||
PROV_RSA_AES,
|
||||
CRYPT_VERIFYCONTEXT)) {
|
||||
if (!CryptAcquireContext(provider,
|
||||
NULL,
|
||||
MS_ENH_RSA_AES_PROV,
|
||||
PROV_RSA_AES,
|
||||
if (!CryptAcquireContext(provider,
|
||||
NULL,
|
||||
MS_ENH_RSA_AES_PROV,
|
||||
PROV_RSA_AES,
|
||||
CRYPT_NEWKEYSET | CRYPT_VERIFYCONTEXT)) {
|
||||
if (!CryptAcquireContext(provider,
|
||||
NULL,
|
||||
NULL,
|
||||
PROV_RSA_AES,
|
||||
if (!CryptAcquireContext(provider,
|
||||
NULL,
|
||||
NULL,
|
||||
PROV_RSA_AES,
|
||||
CRYPT_VERIFYCONTEXT)) {
|
||||
if (!CryptAcquireContext(provider,
|
||||
NULL,
|
||||
NULL,
|
||||
PROV_RSA_AES,
|
||||
if (!CryptAcquireContext(provider,
|
||||
NULL,
|
||||
NULL,
|
||||
PROV_RSA_AES,
|
||||
CRYPT_NEWKEYSET | CRYPT_VERIFYCONTEXT)) {
|
||||
*provider = CryptoX_InvalidHandleValue;
|
||||
return CryptoX_Error;
|
||||
|
@ -227,7 +227,7 @@ CryptoAPI_InitCryptoContext(HCRYPTPROV *provider)
|
|||
return CryptoX_Success;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Begins a signature verification hash context
|
||||
*
|
||||
* @param provider The crypt provider to use
|
||||
|
@ -248,7 +248,7 @@ CryptoAPI_VerifyBegin(HCRYPTPROV provider, HCRYPTHASH* hash)
|
|||
return result ? CryptoX_Success : CryptoX_Error;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Updates a signature verification hash context
|
||||
*
|
||||
* @param hash The hash context to udpate
|
||||
|
|
|
@ -104,22 +104,22 @@ void CryptoMac_FreePublicKey(CryptoX_PublicKey* aPublicKey);
|
|||
CryptoMac_FreePublicKey(aPublicKey)
|
||||
#define CryptoX_FreeCertificate(aCertificate)
|
||||
|
||||
#elif defined(XP_WIN)
|
||||
#elif defined(XP_WIN)
|
||||
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
|
||||
CryptoX_Result CryptoAPI_InitCryptoContext(HCRYPTPROV *provider);
|
||||
CryptoX_Result CryptoAPI_LoadPublicKey(HCRYPTPROV hProv,
|
||||
CryptoX_Result CryptoAPI_LoadPublicKey(HCRYPTPROV hProv,
|
||||
BYTE *certData,
|
||||
DWORD sizeOfCertData,
|
||||
HCRYPTKEY *publicKey);
|
||||
CryptoX_Result CryptoAPI_VerifyBegin(HCRYPTPROV provider, HCRYPTHASH* hash);
|
||||
CryptoX_Result CryptoAPI_VerifyUpdate(HCRYPTHASH* hash,
|
||||
CryptoX_Result CryptoAPI_VerifyUpdate(HCRYPTHASH* hash,
|
||||
BYTE *buf, DWORD len);
|
||||
CryptoX_Result CryptoAPI_VerifySignature(HCRYPTHASH *hash,
|
||||
HCRYPTKEY *pubKey,
|
||||
const BYTE *signature,
|
||||
const BYTE *signature,
|
||||
DWORD signatureLen);
|
||||
|
||||
#define CryptoX_InvalidHandleValue ((ULONG_PTR)NULL)
|
||||
|
|
|
@ -75,7 +75,7 @@ int mar_verify_signatures_for_fp(FILE *fp,
|
|||
*
|
||||
* @param fp The file pointer to read from.
|
||||
* @param buffer The buffer to store the read results.
|
||||
* @param size The number of bytes to read, buffer must be
|
||||
* @param size The number of bytes to read, buffer must be
|
||||
* at least of this size.
|
||||
* @param ctxs Pointer to the first element in an array of verify context.
|
||||
* @param count The number of elements in ctxs
|
||||
|
@ -85,12 +85,12 @@ int mar_verify_signatures_for_fp(FILE *fp,
|
|||
* -2 on verify update error
|
||||
*/
|
||||
int
|
||||
ReadAndUpdateVerifyContext(FILE *fp,
|
||||
ReadAndUpdateVerifyContext(FILE *fp,
|
||||
void *buffer,
|
||||
uint32_t size,
|
||||
uint32_t size,
|
||||
CryptoX_SignatureHandle *ctxs,
|
||||
uint32_t count,
|
||||
const char *err)
|
||||
const char *err)
|
||||
{
|
||||
uint32_t k;
|
||||
if (!fp || !buffer || !ctxs || count == 0 || !err) {
|
||||
|
@ -98,7 +98,7 @@ ReadAndUpdateVerifyContext(FILE *fp,
|
|||
return CryptoX_Error;
|
||||
}
|
||||
|
||||
if (!size) {
|
||||
if (!size) {
|
||||
return CryptoX_Success;
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ ReadAndUpdateVerifyContext(FILE *fp,
|
|||
* certificate given, the second signature will be verified using the second
|
||||
* certificate given, etc. The signature count must exactly match the number of
|
||||
* certificates given, and all signature verifications must succeed.
|
||||
*
|
||||
*
|
||||
* @param mar The file who's signature should be calculated
|
||||
* @param certData Pointer to the first element in an array of
|
||||
* certificate data
|
||||
|
@ -140,7 +140,7 @@ mar_verify_signatures(MarFile *mar,
|
|||
CryptoX_ProviderHandle provider = CryptoX_InvalidHandleValue;
|
||||
CryptoX_PublicKey keys[MAX_SIGNATURES];
|
||||
uint32_t k;
|
||||
|
||||
|
||||
memset(keys, 0, sizeof(keys));
|
||||
|
||||
if (!mar || !certData || !certDataSizes || certCount == 0) {
|
||||
|
@ -153,7 +153,7 @@ mar_verify_signatures(MarFile *mar,
|
|||
goto failure;
|
||||
}
|
||||
|
||||
if (CryptoX_Failed(CryptoX_InitCryptoProvider(&provider))) {
|
||||
if (CryptoX_Failed(CryptoX_InitCryptoProvider(&provider))) {
|
||||
fprintf(stderr, "ERROR: Could not init crytpo library.\n");
|
||||
goto failure;
|
||||
}
|
||||
|
@ -206,8 +206,8 @@ mar_extract_and_verify_signatures_fp(FILE *fp,
|
|||
fprintf(stderr, "ERROR: Invalid file pointer passed.\n");
|
||||
return CryptoX_Error;
|
||||
}
|
||||
|
||||
/* To protect against invalid MAR files, we assumes that the MAR file
|
||||
|
||||
/* To protect against invalid MAR files, we assumes that the MAR file
|
||||
size is less than or equal to MAX_SIZE_OF_MAR_FILE. */
|
||||
if (fseeko(fp, 0, SEEK_END)) {
|
||||
fprintf(stderr, "ERROR: Could not seek to the end of the MAR file.\n");
|
||||
|
@ -246,7 +246,7 @@ mar_extract_and_verify_signatures_fp(FILE *fp,
|
|||
return CryptoX_Error;
|
||||
}
|
||||
signatureAlgorithmIDs[i] = ntohl(signatureAlgorithmIDs[i]);
|
||||
|
||||
|
||||
if (fread(&signatureLen, sizeof(uint32_t), 1, fp) != 1) {
|
||||
fprintf(stderr, "ERROR: Could not read signatures length.\n");
|
||||
return CryptoX_Error;
|
||||
|
@ -319,7 +319,7 @@ mar_extract_and_verify_signatures_fp(FILE *fp,
|
|||
* certificate given, the second signature will be verified using the second
|
||||
* certificate given, etc. The signature count must exactly match the number of
|
||||
* certificates given, and all signature verifications must succeed.
|
||||
*
|
||||
*
|
||||
* @param fp An opened MAR file handle
|
||||
* @param provider A library provider
|
||||
* @param keys A pointer to the first element in an
|
||||
|
@ -359,7 +359,7 @@ mar_verify_signatures_for_fp(FILE *fp,
|
|||
|
||||
/* This function is only called when we have at least one signature,
|
||||
but to protected against future people who call this function we
|
||||
make sure a non zero value is passed in.
|
||||
make sure a non zero value is passed in.
|
||||
*/
|
||||
if (!signatureCount) {
|
||||
fprintf(stderr, "ERROR: There must be at least one signature.\n");
|
||||
|
@ -381,10 +381,10 @@ mar_verify_signatures_for_fp(FILE *fp,
|
|||
}
|
||||
|
||||
/* Bytes 0-3: MAR1
|
||||
Bytes 4-7: index offset
|
||||
Bytes 4-7: index offset
|
||||
Bytes 8-15: size of entire MAR
|
||||
*/
|
||||
if (CryptoX_Failed(ReadAndUpdateVerifyContext(fp, buf,
|
||||
if (CryptoX_Failed(ReadAndUpdateVerifyContext(fp, buf,
|
||||
SIGNATURE_BLOCK_OFFSET +
|
||||
sizeof(uint32_t),
|
||||
signatureHandles,
|
||||
|
@ -397,7 +397,7 @@ mar_verify_signatures_for_fp(FILE *fp,
|
|||
for (i = 0; i < signatureCount; i++) {
|
||||
/* Get the signature algorithm ID */
|
||||
if (CryptoX_Failed(ReadAndUpdateVerifyContext(fp,
|
||||
&buf,
|
||||
&buf,
|
||||
sizeof(uint32_t),
|
||||
signatureHandles,
|
||||
signatureCount,
|
||||
|
@ -405,9 +405,9 @@ mar_verify_signatures_for_fp(FILE *fp,
|
|||
goto failure;
|
||||
}
|
||||
|
||||
if (CryptoX_Failed(ReadAndUpdateVerifyContext(fp,
|
||||
if (CryptoX_Failed(ReadAndUpdateVerifyContext(fp,
|
||||
&signatureLengths[i],
|
||||
sizeof(uint32_t),
|
||||
sizeof(uint32_t),
|
||||
signatureHandles,
|
||||
signatureCount,
|
||||
"signature length"))) {
|
||||
|
|
|
@ -56,8 +56,8 @@ user_pref("string", "value");
|
|||
);
|
||||
|
||||
// Whitespace-only input.
|
||||
DEFAULT(R"(
|
||||
|
||||
DEFAULT(R"(
|
||||
|
||||
)" "\v \t \v \f",
|
||||
""
|
||||
);
|
||||
|
|
|
@ -483,7 +483,6 @@ nsAuthURLParser::ParseAuthority(const char *auth, int32_t authLen,
|
|||
// search backwards for @
|
||||
const char *p = auth + authLen - 1;
|
||||
for (; (*p != '@') && (p > auth); --p) {
|
||||
continue;
|
||||
}
|
||||
if ( *p == '@' ) {
|
||||
// auth = <user-info@server-info>
|
||||
|
|
|
@ -32,7 +32,7 @@ struct Permission
|
|||
, expireType(0)
|
||||
, expireTime(0)
|
||||
{}
|
||||
|
||||
|
||||
Permission(const nsCString& aOrigin,
|
||||
const nsCString& aType,
|
||||
const uint32_t aCapability,
|
||||
|
|
|
@ -722,7 +722,7 @@ nsHttpChannel::CheckFastBlocked()
|
|||
(mLoadInfo && mLoadInfo->GetDocumentHasUserInteracted())) {
|
||||
|
||||
LOG(("FastBlock passed (invalid) [this=%p]\n", this));
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -882,7 +882,7 @@ bool nsHttpTransaction::ShouldThrottle()
|
|||
// DontThrottle requests are expected to be long-standing media
|
||||
// streams and would just unnecessarily block running downloads.
|
||||
// If we want to ballance bandwidth for media responses against
|
||||
// running downloads, we need to find something smarter like
|
||||
// running downloads, we need to find something smarter like
|
||||
// changing the suspend/resume throttling intervals at-runtime.
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -328,7 +328,7 @@ AppendUTF16toUTF8(mozilla::Span<const char16_t> aSource, nsACString& aDest)
|
|||
// value as an unsigned byte. (This is not windows-1252!) If there are code
|
||||
// points above U+00FF, memory-safely produces garbage and will likely start
|
||||
// asserting in future debug builds. The nature of the garbage may differ
|
||||
// based on CPU architecture and must not be relied upon. The names say
|
||||
// based on CPU architecture and must not be relied upon. The names say
|
||||
// "ASCII" instead of "Latin1" for legacy reasons.
|
||||
|
||||
inline MOZ_MUST_USE bool
|
||||
|
|
Загрузка…
Ссылка в новой задаче