This commit is contained in:
Wes Kocher 2014-10-21 19:09:09 -07:00
Родитель 199045efce 0dbdde564f
Коммит 6a1716e012
83 изменённых файлов: 1708 добавлений и 350 удалений

Просмотреть файл

@ -12,6 +12,7 @@
#include "nsAccUtils.h"
#include "nsIAccessibleRelation.h"
#include "nsIAccessibleTable.h"
#include "ProxyAccessible.h"
#include "RootAccessible.h"
#include "nsIAccessibleValue.h"
#include "nsMai.h"
@ -20,6 +21,7 @@
#include "nsAutoPtr.h"
#include "prprf.h"
#include "nsStateMap.h"
#include "mozilla/a11y/Platform.h"
#include "Relation.h"
#include "RootAccessible.h"
#include "States.h"
@ -133,9 +135,13 @@ struct MaiAtkObject
* The AccessibleWrap whose properties and features are exported
* via this object instance.
*/
AccessibleWrap* accWrap;
uintptr_t accWrap;
};
// This is or'd with the pointer in MaiAtkObject::accWrap if the wrap-ee is a
// proxy.
static const uintptr_t IS_PROXY = 1;
struct MaiAtkObjectClass
{
AtkObjectClass parent_class;
@ -248,7 +254,7 @@ AccessibleWrap::ShutdownAtkObject()
{
if (mAtkObject) {
if (IS_MAI_OBJECT(mAtkObject)) {
MAI_ATK_OBJECT(mAtkObject)->accWrap = nullptr;
MAI_ATK_OBJECT(mAtkObject)->accWrap = 0;
}
SetMaiHyperlink(nullptr);
g_object_unref(mAtkObject);
@ -582,8 +588,7 @@ initializeCB(AtkObject *aAtkObj, gpointer aData)
ATK_OBJECT_CLASS(parent_class)->initialize(aAtkObj, aData);
/* initialize object */
MAI_ATK_OBJECT(aAtkObj)->accWrap =
static_cast<AccessibleWrap*>(aData);
MAI_ATK_OBJECT(aAtkObj)->accWrap = reinterpret_cast<uintptr_t>(aData);
}
void
@ -591,7 +596,7 @@ finalizeCB(GObject *aObj)
{
if (!IS_MAI_OBJECT(aObj))
return;
NS_ASSERTION(MAI_ATK_OBJECT(aObj)->accWrap == nullptr, "AccWrap NOT null");
NS_ASSERTION(MAI_ATK_OBJECT(aObj)->accWrap == 0, "AccWrap NOT null");
// call parent finalize function
// finalize of GObjectClass will unref the accessible parent if has
@ -663,25 +668,33 @@ getDescriptionCB(AtkObject *aAtkObj)
AtkRole
getRoleCB(AtkObject *aAtkObj)
{
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap)
return ATK_ROLE_INVALID;
#ifdef DEBUG
NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap),
"Does not support nsIAccessibleText when it should");
#endif
if (aAtkObj->role != ATK_ROLE_INVALID)
return aAtkObj->role;
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
a11y::role role;
if (!accWrap) {
ProxyAccessible* proxy = GetProxy(aAtkObj);
if (!proxy)
return ATK_ROLE_INVALID;
role = proxy->Role();
} else {
#ifdef DEBUG
NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap),
"Does not support nsIAccessibleText when it should");
#endif
role = accWrap->Role();
}
#define ROLE(geckoRole, stringRole, atkRole, macRole, \
msaaRole, ia2Role, nameRule) \
case roles::geckoRole: \
aAtkObj->role = atkRole; \
break;
switch (accWrap->Role()) {
switch (role) {
#include "RoleMap.h"
default:
MOZ_CRASH("Unknown role.");
@ -879,19 +892,18 @@ TranslateStates(uint64_t aState, AtkStateSet* aStateSet)
AtkStateSet *
refStateSetCB(AtkObject *aAtkObj)
{
AtkStateSet *state_set = nullptr;
state_set = ATK_OBJECT_CLASS(parent_class)->ref_state_set(aAtkObj);
AtkStateSet *state_set = nullptr;
state_set = ATK_OBJECT_CLASS(parent_class)->ref_state_set(aAtkObj);
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap) {
TranslateStates(states::DEFUNCT, state_set);
return state_set;
}
// Map states
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
if (accWrap)
TranslateStates(accWrap->State(), state_set);
else if (ProxyAccessible* proxy = GetProxy(aAtkObj))
TranslateStates(proxy->State(), state_set);
else
TranslateStates(states::DEFUNCT, state_set);
return state_set;
return state_set;
}
static void
@ -946,7 +958,13 @@ AccessibleWrap*
GetAccessibleWrap(AtkObject* aAtkObj)
{
NS_ENSURE_TRUE(IS_MAI_OBJECT(aAtkObj), nullptr);
AccessibleWrap* accWrap = MAI_ATK_OBJECT(aAtkObj)->accWrap;
// Make sure its native is an AccessibleWrap not a proxy.
if (MAI_ATK_OBJECT(aAtkObj)->accWrap & IS_PROXY)
return nullptr;
AccessibleWrap* accWrap =
reinterpret_cast<AccessibleWrap*>(MAI_ATK_OBJECT(aAtkObj)->accWrap);
// Check if the accessible was deconstructed.
if (!accWrap)
@ -961,6 +979,50 @@ GetAccessibleWrap(AtkObject* aAtkObj)
return accWrap;
}
ProxyAccessible*
GetProxy(AtkObject* aObj)
{
if (!aObj || !(MAI_ATK_OBJECT(aObj)->accWrap & IS_PROXY))
return nullptr;
return reinterpret_cast<ProxyAccessible*>(MAI_ATK_OBJECT(aObj)->accWrap
& ~IS_PROXY);
}
static uint16_t
GetInterfacesForProxy(ProxyAccessible* aProxy)
{
return MAI_INTERFACE_COMPONENT;
}
void
a11y::ProxyCreated(ProxyAccessible* aProxy)
{
GType type = GetMaiAtkType(GetInterfacesForProxy(aProxy));
NS_ASSERTION(type, "why don't we have a type!");
AtkObject* obj =
reinterpret_cast<AtkObject *>
(g_object_new(type, nullptr));
if (!obj)
return;
uintptr_t inner = reinterpret_cast<uintptr_t>(aProxy) | IS_PROXY;
atk_object_initialize(obj, reinterpret_cast<gpointer>(inner));
obj->role = ATK_ROLE_INVALID;
obj->layer = ATK_LAYER_INVALID;
aProxy->SetWrapper(reinterpret_cast<uintptr_t>(obj) | IS_PROXY);
}
void
a11y::ProxyDestroyed(ProxyAccessible* aProxy)
{
auto obj = reinterpret_cast<MaiAtkObject*>(aProxy->GetWrapper() & ~IS_PROXY);
obj->accWrap = 0;
g_object_unref(obj);
aProxy->SetWrapper(0);
}
nsresult
AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
{

Просмотреть файл

@ -97,7 +97,7 @@ private:
static EAvailableAtkSignals gAvailableAtkSignals;
uint16_t CreateMaiInterfaces(void);
uint16_t CreateMaiInterfaces();
};
} // namespace a11y

Просмотреть файл

@ -35,6 +35,7 @@ LOCAL_INCLUDES += [
'/accessible/base',
'/accessible/generic',
'/accessible/html',
'/accessible/ipc',
'/accessible/xpcom',
'/accessible/xul',
'/other-licenses/atk-1.0',

Просмотреть файл

@ -13,6 +13,12 @@
#include "AccessibleWrap.h"
namespace mozilla {
namespace a11y {
class ProxyAccessible;
}
}
#define MAI_TYPE_ATK_OBJECT (mai_atk_object_get_type ())
#define MAI_ATK_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
MAI_TYPE_ATK_OBJECT, MaiAtkObject))
@ -29,6 +35,7 @@
GType mai_atk_object_get_type(void);
GType mai_util_get_type();
mozilla::a11y::AccessibleWrap* GetAccessibleWrap(AtkObject* aAtkObj);
mozilla::a11y::ProxyAccessible* GetProxy(AtkObject* aAtkObj);
extern int atkMajorVersion, atkMinorVersion;

Просмотреть файл

@ -232,6 +232,8 @@ public:
bool IsShow() const { return mEventType == nsIAccessibleEvent::EVENT_SHOW; }
bool IsHide() const { return mEventType == nsIAccessibleEvent::EVENT_HIDE; }
Accessible* Parent() const { return mParent; }
protected:
nsCOMPtr<nsINode> mNode;
nsRefPtr<Accessible> mParent;

Просмотреть файл

@ -8,6 +8,7 @@
#include "ApplicationAccessible.h"
#include "ARIAMap.h"
#include "DocAccessible-inl.h"
#include "DocAccessibleChild.h"
#include "nsAccessibilityService.h"
#include "RootAccessibleWrap.h"
@ -27,6 +28,8 @@
#include "nsServiceManagerUtils.h"
#include "nsIWebProgress.h"
#include "nsCoreUtils.h"
#include "nsXULAppAPI.h"
#include "mozilla/dom/ContentChild.h"
using namespace mozilla;
using namespace mozilla::a11y;
@ -418,6 +421,12 @@ DocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
docAcc->FireDelayedEvent(nsIAccessibleEvent::EVENT_REORDER,
ApplicationAcc());
if (IPCAccessibilityActive()) {
DocAccessibleChild* ipcDoc = new DocAccessibleChild(docAcc);
docAcc->SetIPCDoc(ipcDoc);
auto contentChild = dom::ContentChild::GetSingleton();
contentChild->SendPDocAccessibleConstructor(ipcDoc, nullptr, 0);
}
} else {
parentDocAcc->BindChildDocument(docAcc);
}

Просмотреть файл

@ -17,6 +17,7 @@ namespace a11y {
class Accessible;
class DocAccessible;
class DocAccessibleParent;
/**
* Manage the document accessible life cycle.
@ -65,6 +66,25 @@ public:
RemoveListeners(aDocument);
}
/*
* Notification that a top level document in a content process has gone away.
*/
void RemoteDocShutdown(DocAccessibleParent* aDoc)
{
DebugOnly<bool> result = mRemoteDocuments.RemoveElement(aDoc);
MOZ_ASSERT(result, "Why didn't we find the document!");
}
/*
* Notify of a new top level document in a content process.
*/
void RemoteDocAdded(DocAccessibleParent* aDoc)
{
MOZ_ASSERT(!mRemoteDocuments.Contains(aDoc),
"How did we already have the doc!");
mRemoteDocuments.AppendElement(aDoc);
}
#ifdef DEBUG
bool IsProcessingRefreshDriverNotification() const;
#endif
@ -144,6 +164,11 @@ private:
#endif
DocAccessibleHashtable mDocAccessibleCache;
/*
* The list of remote top level documents.
*/
nsTArray<DocAccessibleParent*> mRemoteDocuments;
};
/**

Просмотреть файл

@ -8,6 +8,7 @@
#include "Accessible-inl.h"
#include "nsEventShell.h"
#include "DocAccessible.h"
#include "DocAccessibleChild.h"
#include "nsAccessibilityService.h"
#include "nsTextEquivUtils.h"
#ifdef A11Y_LOG
@ -555,5 +556,15 @@ EventQueue::ProcessEventQueue()
if (!mDocument)
return;
if (IPCAccessibilityActive()) {
DocAccessibleChild* ipcDoc = mDocument->IPCDoc();
if (event->mEventType == nsIAccessibleEvent::EVENT_SHOW)
ipcDoc->ShowEvent(downcast_accEvent(event));
else if (event->mEventType == nsIAccessibleEvent::EVENT_HIDE)
ipcDoc->SendHideEvent(reinterpret_cast<uintptr_t>(event->GetAccessible()));
else
ipcDoc->SendEvent(event->GetEventType());
}
}
}

Просмотреть файл

@ -6,9 +6,11 @@
#include "NotificationController.h"
#include "DocAccessible-inl.h"
#include "DocAccessibleChild.h"
#include "TextLeafAccessible.h"
#include "TextUpdater.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Telemetry.h"
@ -217,8 +219,19 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
if (ownerContent) {
Accessible* outerDocAcc = mDocument->GetAccessible(ownerContent);
if (outerDocAcc && outerDocAcc->AppendChild(childDoc)) {
if (mDocument->AppendChildDocument(childDoc))
if (mDocument->AppendChildDocument(childDoc)) {
if (IPCAccessibilityActive()) {
DocAccessibleChild* ipcDoc = new DocAccessibleChild(childDoc);
childDoc->SetIPCDoc(ipcDoc);
auto contentChild = dom::ContentChild::GetSingleton();
DocAccessibleChild* parentIPCDoc = mDocument->IPCDoc();
uint64_t id = reinterpret_cast<uintptr_t>(outerDocAcc->UniqueID());
contentChild->SendPDocAccessibleConstructor(ipcDoc, parentIPCDoc,
id);
}
continue;
}
outerDocAcc->RemoveChild(childDoc);
}

Просмотреть файл

@ -7,6 +7,8 @@
namespace mozilla {
namespace a11y {
class ProxyAccessible;
enum EPlatformDisabledState {
ePlatformIsForceEnabled = -1,
ePlatformIsEnabled = 0,
@ -47,6 +49,17 @@ void PlatformInit();
*/
void PlatformShutdown();
/**
* called when a new ProxyAccessible is created, so the platform may setup a
* wrapper for it, or take other action.
*/
void ProxyCreated(ProxyAccessible*);
/**
* Called just before a ProxyAccessible is destroyed so its wrapper can be
* disposed of and other action taken.
*/
void ProxyDestroyed(ProxyAccessible*);
} // namespace a11y
} // namespace mozilla

Просмотреть файл

@ -783,7 +783,9 @@ enum Role {
/**
* Represent a keyboard or keypad key (ARIA role "key").
*/
KEY = 129
KEY = 129,
LAST_ROLE = KEY
};
} // namespace role

Просмотреть файл

@ -60,6 +60,7 @@ if CONFIG['A11Y_LOG']:
LOCAL_INCLUDES += [
'/accessible/generic',
'/accessible/html',
'/accessible/ipc',
'/accessible/xpcom',
'/accessible/xul',
'/dom/xbl',
@ -93,3 +94,5 @@ FINAL_LIBRARY = 'xul'
if CONFIG['MOZ_ENABLE_GTK']:
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
include('/ipc/chromium/chromium-config.mozbuild')

Просмотреть файл

@ -238,6 +238,19 @@ GetAccService()
return nsAccessibilityService::gAccessibilityService;
}
/**
* Return true if we're in a content process and not B2G.
*/
inline bool
IPCAccessibilityActive()
{
#ifdef MOZ_B2G
return false;
#else
return XRE_GetProcessType() != GeckoProcessType_Default;
#endif
}
/**
* Map nsIAccessibleEvents constants to strings. Used by
* nsIAccessibleRetrieval::getStringEventType() method.

Просмотреть файл

@ -6,6 +6,7 @@
#include "Accessible-inl.h"
#include "AccIterator.h"
#include "DocAccessible-inl.h"
#include "DocAccessibleChild.h"
#include "HTMLImageMapAccessible.h"
#include "nsAccCache.h"
#include "nsAccessiblePivot.h"
@ -83,7 +84,7 @@ DocAccessible::
mScrollPositionChangedTicks(0),
mLoadState(eTreeConstructionPending), mDocFlags(0), mLoadEventType(0),
mVirtualCursor(nullptr),
mPresShell(aPresShell)
mPresShell(aPresShell), mIPCDoc(nullptr)
{
mGenericTypes |= eDocument;
mStateFlags |= eNotNodeMapEntry;
@ -473,6 +474,12 @@ DocAccessible::Shutdown()
mChildDocuments.Clear();
// XXX thinking about ordering?
if (IPCAccessibilityActive()) {
DocAccessibleChild::Send__delete__(mIPCDoc);
MOZ_ASSERT(!mIPCDoc);
}
if (mVirtualCursor) {
mVirtualCursor->RemoveObserver(this);
mVirtualCursor = nullptr;
@ -1446,6 +1453,13 @@ DocAccessible::DoInitialUpdate()
nsRefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(Parent());
ParentDocument()->FireDelayedEvent(reorderEvent);
}
uint32_t childCount = ChildCount();
for (uint32_t i = 0; i < childCount; i++) {
Accessible* child = GetChildAt(i);
nsRefPtr<AccShowEvent> event = new AccShowEvent(child, child->GetContent());
FireDelayedEvent(event);
}
}
void

Просмотреть файл

@ -33,6 +33,7 @@ namespace a11y {
class DocManager;
class NotificationController;
class DocAccessibleChild;
class RelatedAccIterator;
template<class Class, class Arg>
class TNotification;
@ -519,6 +520,20 @@ protected:
*/
bool IsLoadEventTarget() const;
/**
* If this document is in a content process return the object responsible for
* communicating with the main process for it.
*/
DocAccessibleChild* IPCDoc() const { return mIPCDoc; }
/*
* Set the object responsible for communicating with the main process on
* behalf of this document.
*/
void SetIPCDoc(DocAccessibleChild* aIPCDoc) { mIPCDoc = aIPCDoc; }
friend class DocAccessibleChild;
/**
* Used to fire scrolling end event after page scroll.
*
@ -642,6 +657,9 @@ protected:
private:
nsIPresShell* mPresShell;
// Exclusively owned by IPDL so don't manually delete it!
DocAccessibleChild* mIPCDoc;
};
inline DocAccessible*

Просмотреть файл

@ -28,6 +28,7 @@ UNIFIED_SOURCES += [
LOCAL_INCLUDES += [
'/accessible/base',
'/accessible/html',
'/accessible/ipc',
'/accessible/xpcom',
'/accessible/xul',
'/content/base/src',
@ -54,3 +55,5 @@ else:
]
FINAL_LIBRARY = 'xul'
include('/ipc/chromium/chromium-config.mozbuild')

Просмотреть файл

@ -0,0 +1,54 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "DocAccessibleChild.h"
#include "Accessible-inl.h"
namespace mozilla {
namespace a11y {
void
SerializeTree(Accessible* aRoot, nsTArray<AccessibleData>& aTree)
{
uint64_t id = reinterpret_cast<uint64_t>(aRoot->UniqueID());
uint32_t role = aRoot->Role();
uint32_t childCount = aRoot->ChildCount();
nsString name;
aRoot->Name(name);
aTree.AppendElement(AccessibleData(id, role, childCount, name));
for (uint32_t i = 0; i < childCount; i++)
SerializeTree(aRoot->GetChildAt(i), aTree);
}
void
DocAccessibleChild::ShowEvent(AccShowEvent* aShowEvent)
{
Accessible* parent = aShowEvent->Parent();
uint64_t parentID = parent->IsDoc() ? 0 : reinterpret_cast<uint64_t>(parent->UniqueID());
uint32_t idxInParent = aShowEvent->GetAccessible()->IndexInParent();
nsTArray<AccessibleData> shownTree;
ShowEventData data(parentID, idxInParent, shownTree);
SerializeTree(aShowEvent->GetAccessible(), data.NewTree());
SendShowEvent(data);
}
bool
DocAccessibleChild::RecvState(const uint64_t& aID, uint64_t* aState)
{
Accessible* acc = mDoc->GetAccessibleByUniqueID((void*)aID);
if (!acc) {
*aState = states::DEFUNCT;
return true;
}
*aState = acc->State();
return true;
}
}
}

Просмотреть файл

@ -0,0 +1,48 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=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/. */
#ifndef mozilla_a11y_DocAccessibleChild_h
#define mozilla_a11y_DocAccessibleChild_h
#include "mozilla/a11y/DocAccessible.h"
#include "mozilla/a11y/PDocAccessibleChild.h"
#include "nsISupportsImpl.h"
namespace mozilla {
namespace a11y {
class AccShowEvent;
/*
* These objects handle content side communication for an accessible document,
* and their lifetime is the same as the document they represent.
*/
class DocAccessibleChild : public PDocAccessibleChild
{
public:
DocAccessibleChild(DocAccessible* aDoc) :
mDoc(aDoc)
{ MOZ_COUNT_CTOR(DocAccessibleChild); }
~DocAccessibleChild()
{
mDoc->SetIPCDoc(nullptr);
MOZ_COUNT_DTOR(DocAccessibleChild);
}
void ShowEvent(AccShowEvent* aShowEvent);
/*
* Return the state for the accessible with given ID.
*/
virtual bool RecvState(const uint64_t& aID, uint64_t* aState) MOZ_OVERRIDE;
private:
DocAccessible* mDoc;
};
}
}
#endif

Просмотреть файл

@ -0,0 +1,114 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "DocAccessibleParent.h"
#include "nsAutoPtr.h"
#include "mozilla/a11y/Platform.h"
namespace mozilla {
namespace a11y {
bool
DocAccessibleParent::RecvShowEvent(const ShowEventData& aData)
{
if (aData.NewTree().IsEmpty()) {
NS_ERROR("no children being added");
return false;
}
ProxyAccessible* parent = nullptr;
if (aData.ID()) {
ProxyEntry* e = mAccessibles.GetEntry(aData.ID());
if (e)
parent = e->mProxy;
} else {
parent = this;
}
// XXX This should really never happen, but sometimes we fail to fire the
// required show events.
if (!parent) {
NS_ERROR("adding child to unknown accessible");
return false;
}
uint32_t newChildIdx = aData.Idx();
if (newChildIdx > parent->ChildrenCount()) {
NS_ERROR("invalid index to add child at");
return false;
}
uint32_t consumed = AddSubtree(parent, aData.NewTree(), 0, newChildIdx);
MOZ_ASSERT(consumed == aData.NewTree().Length());
for (uint32_t i = 0; i < consumed; i++) {
uint64_t id = aData.NewTree()[i].ID();
MOZ_ASSERT(mAccessibles.GetEntry(id));
}
return consumed;
}
uint32_t
DocAccessibleParent::AddSubtree(ProxyAccessible* aParent,
const nsTArray<a11y::AccessibleData>& aNewTree,
uint32_t aIdx, uint32_t aIdxInParent)
{
if (aNewTree.Length() <= aIdx) {
NS_ERROR("bad index in serialized tree!");
return 0;
}
const AccessibleData& newChild = aNewTree[aIdx];
if (newChild.Role() > roles::LAST_ROLE) {
NS_ERROR("invalid role");
return 0;
}
auto role = static_cast<a11y::role>(newChild.Role());
ProxyAccessible* newProxy =
new ProxyAccessible(newChild.ID(), aParent, this, role, newChild.Name());
aParent->AddChildAt(aIdxInParent, newProxy);
mAccessibles.PutEntry(newChild.ID())->mProxy = newProxy;
ProxyCreated(newProxy);
uint32_t accessibles = 1;
uint32_t kids = newChild.ChildrenCount();
for (uint32_t i = 0; i < kids; i++) {
uint32_t consumed = AddSubtree(newProxy, aNewTree, aIdx + accessibles, i);
if (!consumed)
return 0;
accessibles += consumed;
}
MOZ_ASSERT(newProxy->ChildrenCount() == kids);
return accessibles;
}
bool
DocAccessibleParent::RecvHideEvent(const uint64_t& aRootID)
{
ProxyEntry* rootEntry = mAccessibles.GetEntry(aRootID);
if (!rootEntry) {
NS_ERROR("invalid root being removed!");
return true;
}
ProxyAccessible* root = rootEntry->mProxy;
if (!root) {
NS_ERROR("invalid root being removed!");
return true;
}
ProxyAccessible* parent = root->Parent();
parent->RemoveChild(root);
root->Shutdown();
return true;
}
}
}

Просмотреть файл

@ -0,0 +1,141 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=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/. */
#ifndef mozilla_a11y_DocAccessibleParent_h
#define mozilla_a11y_DocAccessibleParent_h
#include "nsAccessibilityService.h"
#include "ProxyAccessible.h"
#include "mozilla/a11y/PDocAccessibleParent.h"
#include "nsClassHashtable.h"
#include "nsHashKeys.h"
#include "nsISupportsImpl.h"
namespace mozilla {
namespace a11y {
/*
* These objects live in the main process and comunicate with and represent
* an accessible document in a content process.
*/
class DocAccessibleParent : public ProxyAccessible,
public PDocAccessibleParent
{
public:
DocAccessibleParent() :
mParentDoc(nullptr)
{ MOZ_COUNT_CTOR_INHERITED(DocAccessibleParent, ProxyAccessible); }
~DocAccessibleParent()
{
MOZ_COUNT_DTOR_INHERITED(DocAccessibleParent, ProxyAccessible);
MOZ_ASSERT(mChildDocs.Length() == 0);
MOZ_ASSERT(!mParentDoc);
}
/*
* Called when a message from a document in a child process notifies the main
* process it is firing an event.
*/
virtual bool RecvEvent(const uint32_t& aType) MOZ_OVERRIDE
{
return true;
}
virtual bool RecvShowEvent(const ShowEventData& aData) MOZ_OVERRIDE;
virtual bool RecvHideEvent(const uint64_t& aRootID) MOZ_OVERRIDE;
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE
{
MOZ_ASSERT(mChildDocs.IsEmpty(),
"why wheren't the child docs destroyed already?");
mParentDoc ? mParentDoc->RemoveChildDoc(this)
: GetAccService()->RemoteDocShutdown(this);
}
/*
* Return the main processes representation of the parent document (if any)
* of the document this object represents.
*/
DocAccessibleParent* Parent() const { return mParentDoc; }
/*
* Called when a document in a content process notifies the main process of a
* new child document.
*/
bool AddChildDoc(DocAccessibleParent* aChildDoc, uint64_t aParentID)
{
ProxyAccessible* outerDoc = mAccessibles.GetEntry(aParentID)->mProxy;
if (!outerDoc)
return false;
aChildDoc->mParent = outerDoc;
outerDoc->SetChildDoc(aChildDoc);
mChildDocs.AppendElement(aChildDoc);
aChildDoc->mParentDoc = this;
return true;
}
/*
* Called when the document in the content process this object represents
* notifies the main process a child document has been removed.
*/
void RemoveChildDoc(DocAccessibleParent* aChildDoc)
{
aChildDoc->mParent->SetChildDoc(nullptr);
mChildDocs.RemoveElement(aChildDoc);
aChildDoc->mParentDoc = nullptr;
MOZ_ASSERT(aChildDoc->mChildDocs.Length() == 0);
}
void RemoveAccessible(ProxyAccessible* aAccessible)
{
MOZ_ASSERT(mAccessibles.GetEntry(aAccessible->ID()));
mAccessibles.RemoveEntry(aAccessible->ID());
}
private:
class ProxyEntry : public PLDHashEntryHdr
{
public:
ProxyEntry(const void*) : mProxy(nullptr) {}
ProxyEntry(ProxyEntry&& aOther) :
mProxy(aOther.mProxy) { aOther.mProxy = nullptr; }
~ProxyEntry() { delete mProxy; }
typedef uint64_t KeyType;
typedef const void* KeyTypePointer;
bool KeyEquals(const void* aKey) const
{ return mProxy->ID() == (uint64_t)aKey; }
static const void* KeyToPointer(uint64_t aKey) { return (void*)aKey; }
static PLDHashNumber HashKey(const void* aKey) { return (uint64_t)aKey; }
enum { ALLOW_MEMMOVE = true };
ProxyAccessible* mProxy;
};
uint32_t AddSubtree(ProxyAccessible* aParent,
const nsTArray<AccessibleData>& aNewTree, uint32_t aIdx,
uint32_t aIdxInParent);
nsTArray<DocAccessibleParent*> mChildDocs;
DocAccessibleParent* mParentDoc;
/*
* Conceptually this is a map from IDs to proxies, but we store the ID in the
* proxy object so we can't use a real map.
*/
nsTHashtable<ProxyEntry> mAccessibles;
};
}
}
#endif

Просмотреть файл

@ -0,0 +1,47 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include protocol PContent;
namespace mozilla {
namespace a11y {
struct AccessibleData
{
uint64_t ID;
uint32_t Role;
uint32_t ChildrenCount;
nsString Name;
};
struct ShowEventData
{
uint64_t ID;
uint32_t Idx;
AccessibleData[] NewTree;
};
prio(normal upto high) sync protocol PDocAccessible
{
manager PContent;
parent:
__delete__();
/*
* Notify the parent process the document in the child process is firing an
* event.
*/
Event(uint32_t type);
ShowEvent(ShowEventData data);
HideEvent(uint64_t aRootID);
child:
prio(high) sync State(uint64_t aID) returns(uint64_t states);
};
}
}

Просмотреть файл

@ -0,0 +1,51 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ProxyAccessible.h"
#include "DocAccessibleParent.h"
#include "mozilla/unused.h"
#include "mozilla/a11y/Platform.h"
namespace mozilla {
namespace a11y {
void
ProxyAccessible::Shutdown()
{
MOZ_ASSERT(!mOuterDoc);
uint32_t childCount = mChildren.Length();
for (uint32_t idx = 0; idx < childCount; idx++)
mChildren[idx]->Shutdown();
mChildren.Clear();
ProxyDestroyed(this);
mDoc->RemoveAccessible(this);
}
void
ProxyAccessible::SetChildDoc(DocAccessibleParent* aParent)
{
if (aParent) {
MOZ_ASSERT(mChildren.IsEmpty());
mChildren.AppendElement(aParent);
mOuterDoc = true;
} else {
MOZ_ASSERT(mChildren.Length() == 1);
mChildren.Clear();
mOuterDoc = false;
}
}
uint64_t
ProxyAccessible::State() const
{
uint64_t state = 0;
unused << mDoc->SendState(mID, &state);
return state;
}
}
}

Просмотреть файл

@ -0,0 +1,94 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=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/. */
#ifndef mozilla_a11y_ProxyAccessible_h
#define mozilla_a11y_ProxyAccessible_h
#include "mozilla/a11y/Role.h"
#include "nsString.h"
#include "nsTArray.h"
namespace mozilla {
namespace a11y {
class DocAccessibleParent;
class ProxyAccessible
{
public:
ProxyAccessible(uint64_t aID, ProxyAccessible* aParent,
DocAccessibleParent* aDoc, role aRole,
const nsString& aName) :
mParent(aParent), mDoc(aDoc), mID(aID), mRole(aRole), mOuterDoc(false), mName(aName)
{
MOZ_COUNT_CTOR(ProxyAccessible);
}
~ProxyAccessible() { MOZ_COUNT_DTOR(ProxyAccessible); }
void AddChildAt(uint32_t aIdx, ProxyAccessible* aChild)
{ mChildren.InsertElementAt(aIdx, aChild); }
uint32_t ChildrenCount() const { return mChildren.Length(); }
void Shutdown();
void SetChildDoc(DocAccessibleParent*);
/**
* Remove The given child.
*/
void RemoveChild(ProxyAccessible* aChild)
{ mChildren.RemoveElement(aChild); }
/**
* Return the proxy for the parent of the wrapped accessible.
*/
ProxyAccessible* Parent() const { return mParent; }
/**
* Get the role of the accessible we're proxying.
*/
role Role() const { return mRole; }
/*
* Return the states for the proxied accessible.
*/
uint64_t State() const;
/**
* Allow the platform to store a pointers worth of data on us.
*/
uintptr_t GetWrapper() const { return mWrapper; }
void SetWrapper(uintptr_t aWrapper) { mWrapper = aWrapper; }
/*
* Return the ID of the accessible being proxied.
*/
uint64_t ID() const { return mID; }
protected:
ProxyAccessible() :
mParent(nullptr), mDoc(nullptr), mWrapper(0), mID(0)
{ MOZ_COUNT_CTOR(ProxyAccessible); }
protected:
ProxyAccessible* mParent;
private:
nsTArray<ProxyAccessible*> mChildren;
DocAccessibleParent* mDoc;
uintptr_t mWrapper;
uint64_t mID;
role mRole : 31;
bool mOuterDoc : 1;
nsString mName;
};
}
}
#endif

31
accessible/ipc/moz.build Normal file
Просмотреть файл

@ -0,0 +1,31 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
IPDL_SOURCES += ['PDocAccessible.ipdl']
# with --disable-accessibility we need to compile PDocAccessible.ipdl, but not
# the C++.
if CONFIG['ACCESSIBILITY']:
EXPORTS.mozilla.a11y += [
'DocAccessibleChild.h',
'DocAccessibleParent.h',
'ProxyAccessible.h'
]
SOURCES += [
'DocAccessibleChild.cpp',
'DocAccessibleParent.cpp',
'ProxyAccessible.cpp'
]
LOCAL_INCLUDES += [
'../base',
'../generic',
]
FINAL_LIBRARY = 'xul'
include('/ipc/chromium/chromium-config.mozbuild')

Просмотреть файл

@ -33,6 +33,15 @@ PlatformShutdown()
{
}
void
ProxyCreated(ProxyAccessible*)
{
}
void
ProxyDestroyed(ProxyAccessible*)
{
}
}
}

Просмотреть файл

@ -15,7 +15,7 @@ elif toolkit == 'cocoa':
else:
DIRS += ['other']
DIRS += ['base', 'generic', 'html', 'interfaces', 'jsat', 'xpcom']
DIRS += ['base', 'generic', 'html', 'interfaces', 'ipc', 'jsat', 'xpcom']
if CONFIG['MOZ_XUL']:
DIRS += ['xul']

Просмотреть файл

@ -18,3 +18,13 @@ void
a11y::PlatformShutdown()
{
}
void
a11y::ProxyCreated(ProxyAccessible*)
{
}
void
a11y::ProxyDestroyed(ProxyAccessible*)
{
}

Просмотреть файл

@ -34,3 +34,12 @@ a11y::PlatformShutdown()
nsWinUtils::ShutdownWindowEmulation();
}
void
a11y::ProxyCreated(ProxyAccessible*)
{
}
void
a11y::ProxyDestroyed(ProxyAccessible*)
{
}

Просмотреть файл

@ -851,7 +851,6 @@ pref("memory.system_memory_reporter", true);
// Don't dump memory reports on OOM, by default.
pref("memory.dump_reports_on_oom", false);
pref("layout.imagevisibility.enabled", true);
pref("layout.imagevisibility.numscrollportwidths", 1);
pref("layout.imagevisibility.numscrollportheights", 1);

Просмотреть файл

@ -15,15 +15,15 @@
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="82174cee5ede9f23aedad8a39f8b8cdc1ae710c4"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="73d68c9c91bc568ce7c888ac057b3f44bd1b2e79"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9f6b7471c881ee689183d681658cf2ba3dfc5610"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a7631963e5f702a0c6027f5575e5e0deeededea6"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

Просмотреть файл

@ -15,17 +15,17 @@
<remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
<default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
<!-- Gonk specific things and forks -->
<project name="platform_build" path="build" remote="b2g" revision="84923f1940625c47ff4c1fdf01b10fde3b7d909e">
<project name="platform_build" path="build" remote="b2g" revision="70eb0cb0977d6295e7da8896f9efb9f3ca1c13ea">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="82174cee5ede9f23aedad8a39f8b8cdc1ae710c4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="73d68c9c91bc568ce7c888ac057b3f44bd1b2e79"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c058843242068d0df7c107e09da31b53d2e08fa6"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9f6b7471c881ee689183d681658cf2ba3dfc5610"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a7631963e5f702a0c6027f5575e5e0deeededea6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>

Просмотреть файл

@ -17,10 +17,10 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="82174cee5ede9f23aedad8a39f8b8cdc1ae710c4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="73d68c9c91bc568ce7c888ac057b3f44bd1b2e79"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9f6b7471c881ee689183d681658cf2ba3dfc5610"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a7631963e5f702a0c6027f5575e5e0deeededea6"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

Просмотреть файл

@ -15,15 +15,15 @@
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="82174cee5ede9f23aedad8a39f8b8cdc1ae710c4"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="73d68c9c91bc568ce7c888ac057b3f44bd1b2e79"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9f6b7471c881ee689183d681658cf2ba3dfc5610"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a7631963e5f702a0c6027f5575e5e0deeededea6"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>

Просмотреть файл

@ -15,17 +15,17 @@
<remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
<default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
<!-- Gonk specific things and forks -->
<project name="platform_build" path="build" remote="b2g" revision="84923f1940625c47ff4c1fdf01b10fde3b7d909e">
<project name="platform_build" path="build" remote="b2g" revision="70eb0cb0977d6295e7da8896f9efb9f3ca1c13ea">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="82174cee5ede9f23aedad8a39f8b8cdc1ae710c4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="73d68c9c91bc568ce7c888ac057b3f44bd1b2e79"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c058843242068d0df7c107e09da31b53d2e08fa6"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9f6b7471c881ee689183d681658cf2ba3dfc5610"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a7631963e5f702a0c6027f5575e5e0deeededea6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>

Просмотреть файл

@ -15,15 +15,15 @@
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="82174cee5ede9f23aedad8a39f8b8cdc1ae710c4"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="73d68c9c91bc568ce7c888ac057b3f44bd1b2e79"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9f6b7471c881ee689183d681658cf2ba3dfc5610"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a7631963e5f702a0c6027f5575e5e0deeededea6"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

Просмотреть файл

@ -17,10 +17,10 @@
</project>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="82174cee5ede9f23aedad8a39f8b8cdc1ae710c4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="73d68c9c91bc568ce7c888ac057b3f44bd1b2e79"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9f6b7471c881ee689183d681658cf2ba3dfc5610"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a7631963e5f702a0c6027f5575e5e0deeededea6"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

Просмотреть файл

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "2bf3274b9e149c6a0ffc13be4c7d3a2f7236e311",
"revision": "d3b2bb39fd5873ff8d537a3267d21d20491c3d1d",
"repo_path": "/integration/gaia-central"
}

Просмотреть файл

@ -13,16 +13,16 @@
<remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
<default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
<!-- Gonk specific things and forks -->
<project name="platform_build" path="build" remote="b2g" revision="84923f1940625c47ff4c1fdf01b10fde3b7d909e">
<project name="platform_build" path="build" remote="b2g" revision="70eb0cb0977d6295e7da8896f9efb9f3ca1c13ea">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="82174cee5ede9f23aedad8a39f8b8cdc1ae710c4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="73d68c9c91bc568ce7c888ac057b3f44bd1b2e79"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9f6b7471c881ee689183d681658cf2ba3dfc5610"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a7631963e5f702a0c6027f5575e5e0deeededea6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
<project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>

Просмотреть файл

@ -11,12 +11,12 @@
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
<default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
<!-- Gonk specific things and forks -->
<project name="platform_build" path="build" remote="b2g" revision="84923f1940625c47ff4c1fdf01b10fde3b7d909e">
<project name="platform_build" path="build" remote="b2g" revision="70eb0cb0977d6295e7da8896f9efb9f3ca1c13ea">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="82174cee5ede9f23aedad8a39f8b8cdc1ae710c4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="73d68c9c91bc568ce7c888ac057b3f44bd1b2e79"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>

Просмотреть файл

@ -17,10 +17,10 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="82174cee5ede9f23aedad8a39f8b8cdc1ae710c4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="73d68c9c91bc568ce7c888ac057b3f44bd1b2e79"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9f6b7471c881ee689183d681658cf2ba3dfc5610"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a7631963e5f702a0c6027f5575e5e0deeededea6"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

Просмотреть файл

@ -13,16 +13,16 @@
<remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
<default remote="caf" revision="ics_chocolate_rb4.2" sync-j="4"/>
<!-- Gonk specific things and forks -->
<project name="platform_build" path="build" remote="b2g" revision="84923f1940625c47ff4c1fdf01b10fde3b7d909e">
<project name="platform_build" path="build" remote="b2g" revision="70eb0cb0977d6295e7da8896f9efb9f3ca1c13ea">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="82174cee5ede9f23aedad8a39f8b8cdc1ae710c4"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="73d68c9c91bc568ce7c888ac057b3f44bd1b2e79"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4d7f051cede6544f4c83580253c743c22b0cb279"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9f6b7471c881ee689183d681658cf2ba3dfc5610"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a7631963e5f702a0c6027f5575e5e0deeededea6"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

Просмотреть файл

@ -86,7 +86,7 @@ addEventListener("blur", function(event) {
});
if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) {
addEventListener("contextmenu", function (event) {
let handleContentContextMenu = function (event) {
let defaultPrevented = event.defaultPrevented;
if (!Services.prefs.getBoolPref("dom.event.contextmenu.enabled")) {
let plugin = null;
@ -112,7 +112,12 @@ if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) {
sendSyncMessage("contextmenu", { editFlags, spellInfo }, { event });
}
}, false);
}
Cc["@mozilla.org/eventlistenerservice;1"]
.getService(Ci.nsIEventListenerService)
.addSystemEventListener(global, "contextmenu", handleContentContextMenu, true);
} else {
addEventListener("mozUITour", function(event) {
if (!Services.prefs.getBoolPref("browser.uitour.enabled"))

Просмотреть файл

@ -120,6 +120,9 @@ BINPATH = bin
endif
DEFINES += -DBINPATH=$(BINPATH)
AB = $(firstword $(subst -, ,$(AB_CD)))
DEFINES += -DAB=$(AB)
DEFINES += -DMOZ_ICU_VERSION=$(MOZ_ICU_VERSION)
ifdef MOZ_NATIVE_ICU
DEFINES += -DMOZ_NATIVE_ICU

Просмотреть файл

@ -25,7 +25,7 @@
@APPNAME@/Contents/PkgInfo
@APPNAME@/Contents/Resources/firefox.icns
@APPNAME@/Contents/Resources/document.icns
@APPNAME@/Contents/Resources/en.lproj/*
@APPNAME@/Contents/Resources/@AB@.lproj/*
#endif
[@AB_CD@]

Просмотреть файл

@ -671,7 +671,6 @@ pref("full-screen-api.ignore-widgets", true);
// image visibility prefs.
// image visibility tries to only keep images near the viewport decoded instead
// of keeping all images decoded.
pref("layout.imagevisibility.enabled", true);
pref("layout.imagevisibility.numscrollportwidths", 1);
pref("layout.imagevisibility.numscrollportheights", 1);

Просмотреть файл

@ -111,6 +111,7 @@ NS_CP_ContentTypeName(uint32_t contentType)
CASE_RETURN( TYPE_CSP_REPORT );
CASE_RETURN( TYPE_XSLT );
CASE_RETURN( TYPE_BEACON );
CASE_RETURN( TYPE_FETCH );
default:
return "<Unknown Type>";
}

Просмотреть файл

@ -24,7 +24,7 @@ typedef unsigned long nsContentPolicyType;
* by launching a dialog to prompt the user for something).
*/
[scriptable,uuid(b6a71698-c117-441d-86b9-480cf06e3952)]
[scriptable,uuid(8afe3e5c-f916-48fd-8075-9579d3502e1d)]
interface nsIContentPolicy : nsISupports
{
/**
@ -150,6 +150,12 @@ interface nsIContentPolicy : nsISupports
*/
const nsContentPolicyType TYPE_BEACON = 19;
/**
* Indicates a load initiated by the fetch() function from the Fetch
* specification.
*/
const nsContentPolicyType TYPE_FETCH = 20;
/* When adding new content types, please update nsContentBlocker,
* NS_CP_ContentTypeName, nsCSPContext, all nsIContentPolicy
* implementations, and other things that are not listed here that are

Просмотреть файл

@ -709,6 +709,7 @@ CSP_ContentTypeToDirective(nsContentPolicyType aType)
case nsIContentPolicy::TYPE_WEBSOCKET:
case nsIContentPolicy::TYPE_XMLHTTPREQUEST:
case nsIContentPolicy::TYPE_BEACON:
case nsIContentPolicy::TYPE_FETCH:
return CSP_CONNECT_SRC;
case nsIContentPolicy::TYPE_OBJECT:

Просмотреть файл

@ -117,7 +117,7 @@ nsDOMFileReader::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
nsCOMPtr<nsPIDOMWindow> owner = do_QueryInterface(aGlobal.GetAsSupports());
if (!owner) {
NS_WARNING("Unexpected nsIJSNativeInitializer owner");
NS_WARNING("Unexpected owner");
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}

Просмотреть файл

@ -14,7 +14,6 @@
#include "nsIInterfaceRequestor.h"
#include "nsJSUtils.h"
#include "nsTArray.h"
#include "nsIJSNativeInitializer.h"
#include "prtime.h"
#include "nsITimer.h"
#include "nsIAsyncInputStream.h"

Просмотреть файл

@ -120,7 +120,8 @@ nsDataDocumentContentPolicy::ShouldLoad(uint32_t aContentType,
aContentType == nsIContentPolicy::TYPE_DOCUMENT ||
aContentType == nsIContentPolicy::TYPE_SUBDOCUMENT ||
aContentType == nsIContentPolicy::TYPE_SCRIPT ||
aContentType == nsIContentPolicy::TYPE_XSLT) {
aContentType == nsIContentPolicy::TYPE_XSLT ||
aContentType == nsIContentPolicy::TYPE_FETCH) {
*aDecision = nsIContentPolicy::REJECT_TYPE;
}

Просмотреть файл

@ -383,6 +383,7 @@ nsMixedContentBlocker::ShouldLoad(uint32_t aContentType,
// purposes and to avoid the assertion and warning for the default case.
case TYPE_CSP_REPORT:
case TYPE_DTD:
case TYPE_FETCH:
case TYPE_FONT:
case TYPE_OBJECT:
case TYPE_SCRIPT:

Просмотреть файл

@ -10,7 +10,6 @@
#include "mozilla/Attributes.h"
#include "nsGenericHTMLElement.h"
#include "nsIDOMHTMLOptionElement.h"
#include "nsIJSNativeInitializer.h"
#include "mozilla/dom/HTMLFormElement.h"
namespace mozilla {

Просмотреть файл

@ -174,6 +174,49 @@ GMPParent::LoadProcess()
return NS_OK;
}
void
AbortWaitingForGMPAsyncShutdown(nsITimer* aTimer, void* aClosure)
{
NS_WARNING("Timed out waiting for GMP async shutdown!");
GMPParent* parent = reinterpret_cast<GMPParent*>(aClosure);
nsRefPtr<GeckoMediaPluginService> service =
GeckoMediaPluginService::GetGeckoMediaPluginService();
if (service) {
service->AsyncShutdownComplete(parent);
}
}
nsresult
GMPParent::EnsureAsyncShutdownTimeoutSet()
{
if (mAsyncShutdownTimeout) {
return NS_OK;
}
nsresult rv;
mAsyncShutdownTimeout = do_CreateInstance(NS_TIMER_CONTRACTID, &rv);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
// Set timer to abort waiting for plugin to shutdown if it takes
// too long.
rv = mAsyncShutdownTimeout->SetTarget(mGMPThread);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
int32_t timeout = GMP_DEFAULT_ASYNC_SHUTDONW_TIMEOUT;
nsRefPtr<GeckoMediaPluginService> service =
GeckoMediaPluginService::GetGeckoMediaPluginService();
if (service) {
timeout = service->AsyncShutdownTimeoutMs();
}
return mAsyncShutdownTimeout->InitWithFuncCallback(
&AbortWaitingForGMPAsyncShutdown, this, timeout,
nsITimer::TYPE_ONE_SHOT);
}
void
GMPParent::CloseIfUnused()
{
@ -199,7 +242,8 @@ GMPParent::CloseIfUnused()
LOGD(("%s::%s: %p sending async shutdown notification", __CLASS__,
__FUNCTION__, this));
mAsyncShutdownInProgress = true;
if (!SendBeginAsyncShutdown()) {
if (!SendBeginAsyncShutdown() ||
NS_FAILED(EnsureAsyncShutdownTimeoutSet())) {
AbortAsyncShutdown();
}
}
@ -219,6 +263,11 @@ GMPParent::AbortAsyncShutdown()
MOZ_ASSERT(GMPThread() == NS_GetCurrentThread());
LOGD(("%s::%s: %p", __CLASS__, __FUNCTION__, this));
if (mAsyncShutdownTimeout) {
mAsyncShutdownTimeout->Cancel();
mAsyncShutdownTimeout = nullptr;
}
if (!mAsyncShutdownRequired || !mAsyncShutdownInProgress) {
return;
}
@ -289,6 +338,8 @@ GMPParent::Shutdown()
LOGD(("%s::%s: %p", __CLASS__, __FUNCTION__, this));
MOZ_ASSERT(GMPThread() == NS_GetCurrentThread());
MOZ_ASSERT(!mAsyncShutdownTimeout, "Should have canceled shutdown timeout");
if (mAbnormalShutdownInProgress) {
return;
}

Просмотреть файл

@ -170,6 +170,8 @@ private:
virtual bool RecvAsyncShutdownComplete() MOZ_OVERRIDE;
virtual bool RecvAsyncShutdownRequired() MOZ_OVERRIDE;
nsresult EnsureAsyncShutdownTimeoutSet();
GMPState mState;
nsCOMPtr<nsIFile> mDirectory; // plugin directory on disk
nsString mName; // base name of plugin on disk, UTF-16 because used for paths
@ -188,6 +190,7 @@ private:
nsTArray<nsRefPtr<GMPTimerParent>> mTimers;
nsTArray<nsRefPtr<GMPStorageParent>> mStorage;
nsCOMPtr<nsIThread> mGMPThread;
nsCOMPtr<nsITimer> mAsyncShutdownTimeout; // GMP Thread only.
// NodeId the plugin is assigned to, or empty if the the plugin is not
// assigned to a NodeId.
nsAutoCString mNodeId;

Просмотреть файл

@ -136,8 +136,8 @@ GeckoMediaPluginService::GetGeckoMediaPluginService()
NS_IMPL_ISUPPORTS(GeckoMediaPluginService, mozIGeckoMediaPluginService, nsIObserver)
#define GMP_DEFAULT_ASYNC_SHUTDONW_TIMEOUT 3000
static int32_t sMaxAsyncShutdownWaitMs = 0;
static bool sHaveSetTimeoutPrefCache = false;
GeckoMediaPluginService::GeckoMediaPluginService()
: mMutex("GeckoMediaPluginService::mMutex")
@ -147,9 +147,8 @@ GeckoMediaPluginService::GeckoMediaPluginService()
, mWaitingForPluginsAsyncShutdown(false)
{
MOZ_ASSERT(NS_IsMainThread());
static bool setTimeoutPrefCache = false;
if (!setTimeoutPrefCache) {
setTimeoutPrefCache = true;
if (!sHaveSetTimeoutPrefCache) {
sHaveSetTimeoutPrefCache = true;
Preferences::AddIntVarCache(&sMaxAsyncShutdownWaitMs,
"media.gmp.async-shutdown-timeout",
GMP_DEFAULT_ASYNC_SHUTDONW_TIMEOUT);
@ -162,6 +161,13 @@ GeckoMediaPluginService::~GeckoMediaPluginService()
MOZ_ASSERT(mAsyncShutdownPlugins.IsEmpty());
}
int32_t
GeckoMediaPluginService::AsyncShutdownTimeoutMs()
{
MOZ_ASSERT(sHaveSetTimeoutPrefCache);
return sMaxAsyncShutdownWaitMs;
}
nsresult
GeckoMediaPluginService::Init()
{
@ -205,16 +211,6 @@ GeckoMediaPluginService::Init()
return GetThread(getter_AddRefs(thread));
}
void
AbortWaitingForGMPAsyncShutdown(nsITimer* aTimer, void* aClosure)
{
NS_WARNING("Timed out waiting for GMP async shutdown!");
nsRefPtr<GeckoMediaPluginService> service = sSingletonService.get();
if (service) {
service->AbortAsyncShutdown();
}
}
NS_IMETHODIMP
GeckoMediaPluginService::Observe(nsISupports* aSubject,
const char* aTopic,
@ -533,9 +529,11 @@ GeckoMediaPluginService::AsyncShutdownComplete(GMPParent* aParent)
mAsyncShutdownPlugins.RemoveElement(aParent);
if (mAsyncShutdownPlugins.IsEmpty() && mShuttingDownOnGMPThread) {
// The main thread is waiting for async shutdown of plugins,
// The main thread may be waiting for async shutdown of plugins,
// which has completed. Break the main thread out of its waiting loop.
AbortAsyncShutdown();
nsRefPtr<nsIRunnable> task(NS_NewRunnableMethod(
this, &GeckoMediaPluginService::SetAsyncShutdownComplete));
NS_DispatchToMainThread(task);
}
}
@ -546,47 +544,6 @@ GeckoMediaPluginService::SetAsyncShutdownComplete()
mWaitingForPluginsAsyncShutdown = false;
}
void
GeckoMediaPluginService::AbortAsyncShutdown()
{
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
for (size_t i = 0; i < mAsyncShutdownPlugins.Length(); i++) {
mAsyncShutdownPlugins[i]->AbortAsyncShutdown();
}
mAsyncShutdownPlugins.Clear();
if (mAsyncShutdownTimeout) {
mAsyncShutdownTimeout->Cancel();
mAsyncShutdownTimeout = nullptr;
}
nsRefPtr<nsIRunnable> task(NS_NewRunnableMethod(
this, &GeckoMediaPluginService::SetAsyncShutdownComplete));
NS_DispatchToMainThread(task);
}
nsresult
GeckoMediaPluginService::SetAsyncShutdownTimeout()
{
MOZ_ASSERT(!mAsyncShutdownTimeout);
nsresult rv;
mAsyncShutdownTimeout = do_CreateInstance(NS_TIMER_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
NS_WARNING("Failed to create timer for async GMP shutdown");
return NS_OK;
}
// Set timer to abort waiting for plugins to shutdown if they take
// too long.
rv = mAsyncShutdownTimeout->SetTarget(mGMPThread);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
return mAsyncShutdownTimeout->InitWithFuncCallback(
&AbortWaitingForGMPAsyncShutdown, nullptr, sMaxAsyncShutdownWaitMs,
nsITimer::TYPE_ONE_SHOT);
}
void
GeckoMediaPluginService::UnloadPlugins()
{
@ -607,16 +564,7 @@ GeckoMediaPluginService::UnloadPlugins()
mPlugins.Clear();
}
if (!mAsyncShutdownPlugins.IsEmpty()) {
// We have plugins that require async shutdown. Set a timer to abort
// waiting if they take too long to shutdown.
if (NS_FAILED(SetAsyncShutdownTimeout())) {
mAsyncShutdownPlugins.Clear();
}
}
if (mAsyncShutdownPlugins.IsEmpty()) {
mAsyncShutdownPlugins.Clear();
nsRefPtr<nsIRunnable> task(NS_NewRunnableMethod(
this, &GeckoMediaPluginService::SetAsyncShutdownComplete));
NS_DispatchToMainThread(task);

Просмотреть файл

@ -28,6 +28,8 @@ namespace gmp {
class GMPParent;
#define GMP_DEFAULT_ASYNC_SHUTDONW_TIMEOUT 3000
class GeckoMediaPluginService MOZ_FINAL : public mozIGeckoMediaPluginService
, public nsIObserver
{
@ -45,6 +47,8 @@ public:
void AsyncShutdownComplete(GMPParent* aParent);
void AbortAsyncShutdown();
int32_t AsyncShutdownTimeoutMs();
private:
~GeckoMediaPluginService();
@ -122,7 +126,6 @@ private:
MainThreadOnly<bool> mWaitingForPluginsAsyncShutdown;
nsTArray<nsRefPtr<GMPParent>> mAsyncShutdownPlugins; // GMP Thread only.
nsCOMPtr<nsITimer> mAsyncShutdownTimeout; // GMP Thread only.
#ifndef MOZ_WIDGET_GONK
nsCOMPtr<nsIFile> mStorageBaseDir;

Просмотреть файл

@ -29,7 +29,6 @@ EXPORTS += [
'nsIDOMClassInfo.h',
'nsIDOMScriptObjectFactory.h',
'nsIGlobalObject.h',
'nsIJSNativeInitializer.h',
'nsIScriptContext.h',
'nsIScriptGlobalObject.h',
'nsIScriptNameSpaceManager.h',

Просмотреть файл

@ -50,7 +50,6 @@
// Window scriptable helper includes
#include "nsScriptNameSpaceManager.h"
#include "nsIJSNativeInitializer.h"
// DOM base includes
#include "nsIDOMWindow.h"
@ -1397,9 +1396,8 @@ BaseStubConstructor(nsIWeakReference* aWeakOwner,
return rv;
}
nsCOMPtr<nsIJSNativeInitializer> initializer(do_QueryInterface(native));
nsCOMPtr<nsIDOMGlobalObjectConstructor> constructor(do_QueryInterface(native));
if (initializer || constructor) {
if (constructor) {
// Initialize object using the current inner window, but only if
// the caller can access it.
nsCOMPtr<nsPIDOMWindow> owner = do_QueryReferent(aWeakOwner);
@ -1412,54 +1410,47 @@ BaseStubConstructor(nsIWeakReference* aWeakOwner,
return NS_ERROR_DOM_SECURITY_ERR;
}
if (initializer) {
rv = initializer->Initialize(currentInner, cx, obj, args);
if (NS_FAILED(rv)) {
return rv;
}
} else {
nsCOMPtr<nsIXPConnectWrappedJS> wrappedJS = do_QueryInterface(native);
nsCOMPtr<nsIXPConnectWrappedJS> wrappedJS = do_QueryInterface(native);
JS::Rooted<JSObject*> thisObject(cx, wrappedJS->GetJSObject());
if (!thisObject) {
return NS_ERROR_UNEXPECTED;
JS::Rooted<JSObject*> thisObject(cx, wrappedJS->GetJSObject());
if (!thisObject) {
return NS_ERROR_UNEXPECTED;
}
JSAutoCompartment ac(cx, thisObject);
JS::Rooted<JS::Value> funval(cx);
if (!JS_GetProperty(cx, thisObject, "constructor", &funval) ||
!funval.isObject()) {
return NS_ERROR_UNEXPECTED;
}
// Check if the object is even callable.
NS_ENSURE_STATE(JS::IsCallable(&funval.toObject()));
{
// wrap parameters in the target compartment
// we also pass in the calling window as the first argument
unsigned argc = args.length() + 1;
JS::AutoValueVector argv(cx);
if (!argv.resize(argc)) {
return NS_ERROR_OUT_OF_MEMORY;
}
JSAutoCompartment ac(cx, thisObject);
nsCOMPtr<nsIDOMWindow> currentWin(do_GetInterface(currentInner));
rv = WrapNative(cx, currentWin, &NS_GET_IID(nsIDOMWindow),
true, argv[0]);
JS::Rooted<JS::Value> funval(cx);
if (!JS_GetProperty(cx, thisObject, "constructor", &funval) ||
!funval.isObject()) {
return NS_ERROR_UNEXPECTED;
}
// Check if the object is even callable.
NS_ENSURE_STATE(JS::IsCallable(&funval.toObject()));
{
// wrap parameters in the target compartment
// we also pass in the calling window as the first argument
unsigned argc = args.length() + 1;
JS::AutoValueVector argv(cx);
if (!argv.resize(argc)) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMWindow> currentWin(do_GetInterface(currentInner));
rv = WrapNative(cx, currentWin, &NS_GET_IID(nsIDOMWindow),
true, argv[0]);
for (size_t i = 1; i < argc; ++i) {
argv[i].set(args[i - 1]);
if (!JS_WrapValue(cx, argv[i]))
return NS_ERROR_FAILURE;
}
JS::Rooted<JS::Value> frval(cx);
bool ret = JS_CallFunctionValue(cx, thisObject, funval, argv, &frval);
if (!ret) {
for (size_t i = 1; i < argc; ++i) {
argv[i].set(args[i - 1]);
if (!JS_WrapValue(cx, argv[i]))
return NS_ERROR_FAILURE;
}
}
JS::Rooted<JS::Value> frval(cx);
bool ret = JS_CallFunctionValue(cx, thisObject, funval, argv, &frval);
if (!ret) {
return NS_ERROR_FAILURE;
}
}
}

Просмотреть файл

@ -1,38 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#ifndef nsIJSNativeInitializer_h__
#define nsIJSNativeInitializer_h__
#include "nsISupports.h"
#define NS_IJSNATIVEINITIALIZER_IID \
{ 0xdb48eee5, 0x89a4, 0x4f18, \
{ 0x86, 0xd0, 0x4c, 0x4e, 0x9d, 0x4b, 0xf8, 0x7e } }
/**
* A JavaScript specific interface used to initialize new
* native objects, created as a result of calling a
* JavaScript constructor. The arguments are passed in
* their raw form as JS::Value's.
*/
class nsIJSNativeInitializer : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IJSNATIVEINITIALIZER_IID)
/**
* Initialize a newly created native instance using the owner of the
* constructor and the parameters passed into the JavaScript constructor.
*/
NS_IMETHOD Initialize(nsISupports* aOwner, JSContext *cx, JSObject *obj,
const JS::CallArgs& args) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIJSNativeInitializer,
NS_IJSNATIVEINITIALIZER_IID)
#endif // nsIJSNativeInitializer_h__

Просмотреть файл

@ -45,10 +45,9 @@ InternalRequest::GetRequestConstructorCopy(nsIGlobalObject* aGlobal, ErrorResult
copy->mOrigin = NS_ConvertUTF16toUTF8(location.mOrigin);
}
copy->mContext = nsIContentPolicy::TYPE_FETCH;
copy->mMode = mMode;
copy->mCredentialsMode = mCredentialsMode;
// FIXME(nsm): Add ContentType fetch to nsIContentPolicy and friends.
// Then set copy's mContext to that.
return copy.forget();
}

Просмотреть файл

@ -19,6 +19,9 @@
#include "TabChild.h"
#include "mozilla/Attributes.h"
#ifdef ACCESSIBILITY
#include "mozilla/a11y/DocAccessibleChild.h"
#endif
#include "mozilla/Preferences.h"
#include "mozilla/dom/ContentBridgeChild.h"
#include "mozilla/dom/ContentBridgeParent.h"
@ -731,6 +734,22 @@ ContentChild::InitXPCOM()
InitOnContentProcessCreated();
}
a11y::PDocAccessibleChild*
ContentChild::AllocPDocAccessibleChild(PDocAccessibleChild*, const uint64_t&)
{
MOZ_ASSERT(false, "should never call this!");
return nullptr;
}
bool
ContentChild::DeallocPDocAccessibleChild(a11y::PDocAccessibleChild* aChild)
{
#ifdef ACCESSIBILITY
delete static_cast<mozilla::a11y::DocAccessibleChild*>(aChild);
#endif
return true;
}
PMemoryReportRequestChild*
ContentChild::AllocPMemoryReportRequestChild(const uint32_t& aGeneration,
const bool &aAnonymize,

Просмотреть файл

@ -382,6 +382,8 @@ public:
const uint64_t& aID,
const bool& aIsForApp,
const bool& aIsForBrowser) MOZ_OVERRIDE;
virtual PDocAccessibleChild* AllocPDocAccessibleChild(PDocAccessibleChild*, const uint64_t&) MOZ_OVERRIDE;
virtual bool DeallocPDocAccessibleChild(PDocAccessibleChild*) MOZ_OVERRIDE;
void GetAvailableDictionaries(InfallibleTArray<nsString>& aDictionaries);

Просмотреть файл

@ -30,6 +30,10 @@
#include "CrashReporterParent.h"
#include "IHistory.h"
#include "mozIApplication.h"
#ifdef ACCESSIBILITY
#include "mozilla/a11y/DocAccessibleParent.h"
#include "nsAccessibilityService.h"
#endif
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/dom/DataStoreService.h"
#include "mozilla/dom/DOMStorageIPC.h"
@ -2706,6 +2710,42 @@ ContentParent::Observe(nsISupports* aSubject,
return NS_OK;
}
a11y::PDocAccessibleParent*
ContentParent::AllocPDocAccessibleParent(PDocAccessibleParent* aParent, const uint64_t&)
{
#ifdef ACCESSIBILITY
return new a11y::DocAccessibleParent();
#else
return nullptr;
#endif
}
bool
ContentParent::DeallocPDocAccessibleParent(PDocAccessibleParent* aParent)
{
#ifdef ACCESSIBILITY
delete static_cast<a11y::DocAccessibleParent*>(aParent);
#endif
return true;
}
bool
ContentParent::RecvPDocAccessibleConstructor(PDocAccessibleParent* aDoc, PDocAccessibleParent* aParentDoc, const uint64_t& aParentID)
{
#ifdef ACCESSIBILITY
auto doc = static_cast<a11y::DocAccessibleParent*>(aDoc);
if (aParentDoc) {
MOZ_ASSERT(aParentID);
auto parentDoc = static_cast<a11y::DocAccessibleParent*>(aParentDoc);
return parentDoc->AddChildDoc(doc, aParentID);
} else {
MOZ_ASSERT(!aParentID);
GetAccService()->RemoteDocAdded(doc);
}
#endif
return true;
}
PCompositorParent*
ContentParent::AllocPCompositorParent(mozilla::ipc::Transport* aTransport,
base::ProcessId aOtherProcess)

Просмотреть файл

@ -679,6 +679,11 @@ private:
int32_t* aSliceRefCnt,
bool* aResult) MOZ_OVERRIDE;
virtual PDocAccessibleParent* AllocPDocAccessibleParent(PDocAccessibleParent*, const uint64_t&) MOZ_OVERRIDE;
virtual bool DeallocPDocAccessibleParent(PDocAccessibleParent*) MOZ_OVERRIDE;
virtual bool RecvPDocAccessibleConstructor(PDocAccessibleParent* aDoc,
PDocAccessibleParent* aParentDoc, const uint64_t& aParentID) MOZ_OVERRIDE;
// If you add strong pointers to cycle collected objects here, be sure to
// release these objects in ShutDownProcess. See the comment there for more
// details.

Просмотреть файл

@ -14,6 +14,7 @@ include protocol PCompositor;
include protocol PContentBridge;
include protocol PCycleCollectWithLogs;
include protocol PCrashReporter;
include protocol PDocAccessible;
include protocol PExternalHelperApp;
include protocol PDeviceStorageRequest;
include protocol PFileDescriptorSet;
@ -333,6 +334,7 @@ prio(normal upto high) intr protocol PContent
manages PCellBroadcast;
manages PCrashReporter;
manages PCycleCollectWithLogs;
manages PDocAccessible;
manages PDeviceStorageRequest;
manages PFileSystemRequest;
manages PExternalHelperApp;
@ -491,6 +493,14 @@ child:
OnAppThemeChanged();
parent:
/**
* Tell the parent process a new accessible document has been created.
* aParentDoc is the accessible document it was created in if any, and
* aParentAcc is the id of the accessible in that document the new document
* is a child of.
*/
PDocAccessible(nullable PDocAccessible aParentDoc, uint64_t aParentAcc);
/**
* Tell the content process some attributes of itself. This is
* among the first information queried by content processes after

Просмотреть файл

@ -356,6 +356,7 @@ PluginHangUIParent::RecvUserResponse(const unsigned int& aResponse)
mModule->TerminateChildProcess(mMainThreadMessageLoop);
responseCode = 1;
} else if(aResponse & HANGUI_USER_RESPONSE_CONTINUE) {
mModule->OnHangUIContinue();
// User clicked Continue
responseCode = 2;
} else {

Просмотреть файл

@ -133,6 +133,7 @@ PluginModuleParent::PluginModuleParent(const char* aFilePath)
, mNPNIface(nullptr)
, mPlugin(nullptr)
, mTaskFactory(MOZ_THIS_IN_INITIALIZER_LIST())
, mHangAnnotationFlags(0)
#ifdef XP_WIN
, mPluginCpuUsageOnHang()
, mHangUIParent(nullptr)
@ -160,6 +161,8 @@ PluginModuleParent::PluginModuleParent(const char* aFilePath)
#ifdef MOZ_ENABLE_PROFILER_SPS
InitPluginProfiling();
#endif
mozilla::HangMonitor::RegisterAnnotator(*this);
}
PluginModuleParent::~PluginModuleParent()
@ -203,6 +206,8 @@ PluginModuleParent::~PluginModuleParent()
mHangUIParent = nullptr;
}
#endif
mozilla::HangMonitor::UnregisterAnnotator(*this);
}
#ifdef MOZ_CRASHREPORTER
@ -224,20 +229,8 @@ PluginModuleParent::WriteExtraDataForMinidump(AnnotationTable& notes)
filePos++;
notes.Put(NS_LITERAL_CSTRING("PluginFilename"), CS(pluginFile.substr(filePos).c_str()));
nsCString pluginName;
nsCString pluginVersion;
nsRefPtr<nsPluginHost> ph = nsPluginHost::GetInst();
if (ph) {
nsPluginTag* tag = ph->TagForPlugin(mPlugin);
if (tag) {
pluginName = tag->mName;
pluginVersion = tag->mVersion;
}
}
notes.Put(NS_LITERAL_CSTRING("PluginName"), pluginName);
notes.Put(NS_LITERAL_CSTRING("PluginVersion"), pluginVersion);
notes.Put(NS_LITERAL_CSTRING("PluginName"), mPluginName);
notes.Put(NS_LITERAL_CSTRING("PluginVersion"), mPluginVersion);
CrashReporterParent* crashReporter = CrashReporter();
if (crashReporter) {
@ -389,13 +382,52 @@ GetProcessCpuUsage(const InfallibleTArray<base::ProcessHandle>& processHandles,
} // anonymous namespace
#endif // #ifdef XP_WIN
void
PluginModuleParent::EnteredCxxStack()
{
mHangAnnotationFlags |= kInPluginCall;
}
void
PluginModuleParent::ExitedCxxStack()
{
mHangAnnotationFlags = 0;
#ifdef XP_WIN
FinishHangUI();
#endif
}
#endif // #ifdef XP_WIN
/**
* This function is always called by the HangMonitor thread.
*/
void
PluginModuleParent::AnnotateHang(mozilla::HangMonitor::HangAnnotations& aAnnotations)
{
uint32_t flags = mHangAnnotationFlags;
if (flags) {
/* We don't actually annotate anything specifically for kInPluginCall;
we use it to determine whether to annotate other things. It will
be pretty obvious from the ChromeHang stack that we're in a plugin
call when the hang occurred. */
if (flags & kHangUIShown) {
aAnnotations.AddAnnotation(NS_LITERAL_STRING("HangUIShown"),
true);
}
if (flags & kHangUIContinued) {
aAnnotations.AddAnnotation(NS_LITERAL_STRING("HangUIContinued"),
true);
}
if (flags & kHangUIDontShow) {
aAnnotations.AddAnnotation(NS_LITERAL_STRING("HangUIDontShow"),
true);
}
aAnnotations.AddAnnotation(NS_LITERAL_STRING("pluginName"), mPluginName);
aAnnotations.AddAnnotation(NS_LITERAL_STRING("pluginVersion"),
mPluginVersion);
}
}
#ifdef MOZ_CRASHREPORTER_INJECTOR
static bool
@ -531,6 +563,23 @@ PluginModuleParent::TerminateChildProcess(MessageLoop* aMsgLoop)
NS_WARNING("failed to kill subprocess!");
}
bool
PluginModuleParent::GetPluginDetails(nsACString& aPluginName,
nsACString& aPluginVersion)
{
nsRefPtr<nsPluginHost> host = nsPluginHost::GetInst();
if (!host) {
return false;
}
nsPluginTag* pluginTag = host->TagForPlugin(mPlugin);
if (!pluginTag) {
return false;
}
aPluginName = pluginTag->mName;
aPluginVersion = pluginTag->mVersion;
return true;
}
#ifdef XP_WIN
void
PluginModuleParent::EvaluateHangUIState(const bool aReset)
@ -566,21 +615,6 @@ PluginModuleParent::EvaluateHangUIState(const bool aReset)
SetChildTimeout(autoStopSecs);
}
bool
PluginModuleParent::GetPluginName(nsAString& aPluginName)
{
nsRefPtr<nsPluginHost> host = nsPluginHost::GetInst();
if (!host) {
return false;
}
nsPluginTag* pluginTag = host->TagForPlugin(mPlugin);
if (!pluginTag) {
return false;
}
CopyUTF8toUTF16(pluginTag->mName, aPluginName);
return true;
}
bool
PluginModuleParent::LaunchHangUI()
{
@ -593,7 +627,12 @@ PluginModuleParent::LaunchHangUI()
return false;
}
if (mHangUIParent->DontShowAgain()) {
return !mHangUIParent->WasLastHangStopped();
mHangAnnotationFlags |= kHangUIDontShow;
bool wasLastHangStopped = mHangUIParent->WasLastHangStopped();
if (!wasLastHangStopped) {
mHangAnnotationFlags |= kHangUIContinued;
}
return !wasLastHangStopped;
}
delete mHangUIParent;
mHangUIParent = nullptr;
@ -601,12 +640,9 @@ PluginModuleParent::LaunchHangUI()
mHangUIParent = new PluginHangUIParent(this,
Preferences::GetInt(kHangUITimeoutPref, 0),
Preferences::GetInt(kChildTimeoutPref, 0));
nsAutoString pluginName;
if (!GetPluginName(pluginName)) {
return false;
}
bool retval = mHangUIParent->Init(pluginName);
bool retval = mHangUIParent->Init(NS_ConvertUTF8toUTF16(mPluginName));
if (retval) {
mHangAnnotationFlags |= kHangUIShown;
/* Once the UI is shown we switch the timeout over to use
kChildTimeoutPref, allowing us to terminate a hung plugin
after kChildTimeoutPref seconds if the user doesn't respond to
@ -636,6 +672,12 @@ PluginModuleParent::FinishHangUI()
}
}
}
void
PluginModuleParent::OnHangUIContinue()
{
mHangAnnotationFlags |= kHangUIContinued;
}
#endif // XP_WIN
#ifdef MOZ_CRASHREPORTER
@ -1263,6 +1305,10 @@ PluginModuleParent::NPP_New(NPMIMEType pluginType, NPP instance,
return NS_ERROR_FAILURE;
}
if (mPluginName.IsEmpty()) {
GetPluginDetails(mPluginName, mPluginVersion);
}
// create the instance on the other side
InfallibleTArray<nsCString> names;
InfallibleTArray<nsCString> values;

Просмотреть файл

@ -9,6 +9,7 @@
#include "base/process.h"
#include "mozilla/FileUtils.h"
#include "mozilla/HangMonitor.h"
#include "mozilla/PluginLibrary.h"
#include "mozilla/plugins/ScopedMethodFactory.h"
#include "mozilla/plugins/PluginProcessParent.h"
@ -59,6 +60,7 @@ class PluginModuleParent
#ifdef MOZ_CRASHREPORTER_INJECTOR
, public CrashReporter::InjectorCrashCallback
#endif
, public mozilla::HangMonitor::Annotator
{
private:
typedef mozilla::PluginLibrary PluginLibrary;
@ -112,9 +114,22 @@ public:
void TerminateChildProcess(MessageLoop* aMsgLoop);
#ifdef XP_WIN
void
virtual void
EnteredCxxStack() MOZ_OVERRIDE;
virtual void
ExitedCxxStack() MOZ_OVERRIDE;
virtual void
AnnotateHang(mozilla::HangMonitor::HangAnnotations& aAnnotations) MOZ_OVERRIDE;
#ifdef XP_WIN
/**
* Called by Plugin Hang UI to notify that the user has clicked continue.
* Used for chrome hang annotations.
*/
void
OnHangUIContinue();
#endif // XP_WIN
protected:
@ -287,6 +302,16 @@ private:
nsString mBrowserDumpID;
nsString mHangID;
nsRefPtr<nsIObserver> mProfilerObserver;
enum HangAnnotationFlags
{
kInPluginCall = (1u << 0),
kHangUIShown = (1u << 1),
kHangUIContinued = (1u << 2),
kHangUIDontShow = (1u << 3)
};
Atomic<uint32_t> mHangAnnotationFlags;
nsCString mPluginName;
nsCString mPluginVersion;
#ifdef XP_WIN
InfallibleTArray<float> mPluginCpuUsageOnHang;
PluginHangUIParent *mHangUIParent;
@ -307,9 +332,6 @@ private:
void
EvaluateHangUIState(const bool aReset);
bool
GetPluginName(nsAString& aPluginName);
/**
* Launches the Plugin Hang UI.
*
@ -327,6 +349,9 @@ private:
FinishHangUI();
#endif
bool
GetPluginDetails(nsACString& aPluginName, nsACString& aPluginVersion);
#ifdef MOZ_X11
// Dup of plugin's X socket, used to scope its resources to this
// object instead of the plugin process's lifetime

Просмотреть файл

@ -10,7 +10,7 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
this.EXPORTED_SYMBOLS = ["SettingsRequestManager"];
this.EXPORTED_SYMBOLS = [];
Cu.import("resource://gre/modules/SettingsDB.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");

Просмотреть файл

@ -159,7 +159,7 @@ static bool SignMask(JSContext *cx, unsigned argc, Value *vp)
#define SIGN_MASK(type) \
static bool type##SignMask(JSContext *cx, unsigned argc, Value *vp) { \
return SignMask<Int32x4>(cx, argc, vp); \
return SignMask<type>(cx, argc, vp); \
}
SIGN_MASK(Float32x4);
SIGN_MASK(Int32x4);
@ -785,6 +785,25 @@ Int32x4BinaryScalar(JSContext *cx, unsigned argc, Value *vp)
return StoreResult<Int32x4>(cx, args, result);
}
template<typename In, template<typename C> class Op>
static bool
CompareFunc(JSContext *cx, unsigned argc, Value *vp)
{
typedef typename In::Elem InElem;
CallArgs args = CallArgsFromVp(argc, vp);
if (args.length() != 2 || !IsVectorObject<In>(args[0]) || !IsVectorObject<In>(args[1]))
return ErrorBadArgs(cx);
int32_t result[Int32x4::lanes];
InElem *left = TypedObjectMemory<InElem *>(args[0]);
InElem *right = TypedObjectMemory<InElem *>(args[1]);
for (unsigned i = 0; i < Int32x4::lanes; i++)
result[i] = Op<InElem>::apply(left[i], right[i]);
return StoreResult<Int32x4>(cx, args, result);
}
template<typename V, typename Vret>
static bool
FuncConvert(JSContext *cx, unsigned argc, Value *vp)

Просмотреть файл

@ -36,15 +36,15 @@
V(add, (BinaryFunc<Float32x4, Add, Float32x4>), 2, 0) \
V(and, (CoercedBinaryFunc<Float32x4, Int32x4, And, Float32x4>), 2, 0) \
V(div, (BinaryFunc<Float32x4, Div, Float32x4>), 2, 0) \
V(equal, (BinaryFunc<Float32x4, Equal, Int32x4>), 2, 0) \
V(greaterThan, (BinaryFunc<Float32x4, GreaterThan, Int32x4>), 2, 0) \
V(greaterThanOrEqual, (BinaryFunc<Float32x4, GreaterThanOrEqual, Int32x4>), 2, 0) \
V(lessThan, (BinaryFunc<Float32x4, LessThan, Int32x4>), 2, 0) \
V(lessThanOrEqual, (BinaryFunc<Float32x4, LessThanOrEqual, Int32x4>), 2, 0) \
V(equal, (CompareFunc<Float32x4, Equal>), 2, 0) \
V(greaterThan, (CompareFunc<Float32x4, GreaterThan>), 2, 0) \
V(greaterThanOrEqual, (CompareFunc<Float32x4, GreaterThanOrEqual>), 2, 0) \
V(lessThan, (CompareFunc<Float32x4, LessThan>), 2, 0) \
V(lessThanOrEqual, (CompareFunc<Float32x4, LessThanOrEqual>), 2, 0) \
V(max, (BinaryFunc<Float32x4, Maximum, Float32x4>), 2, 0) \
V(min, (BinaryFunc<Float32x4, Minimum, Float32x4>), 2, 0) \
V(mul, (BinaryFunc<Float32x4, Mul, Float32x4>), 2, 0) \
V(notEqual, (BinaryFunc<Float32x4, NotEqual, Int32x4>), 2, 0) \
V(notEqual, (CompareFunc<Float32x4, NotEqual>), 2, 0) \
V(or, (CoercedBinaryFunc<Float32x4, Int32x4, Or, Float32x4>), 2, 0) \
V(scale, (FuncWith<Float32x4, Scale>), 2, 0) \
V(sub, (BinaryFunc<Float32x4, Sub, Float32x4>), 2, 0) \
@ -82,9 +82,9 @@
#define INT32X4_BINARY_FUNCTION_LIST(V) \
V(add, (BinaryFunc<Int32x4, Add, Int32x4>), 2, 0) \
V(and, (BinaryFunc<Int32x4, And, Int32x4>), 2, 0) \
V(equal, (BinaryFunc<Int32x4, Equal, Int32x4>), 2, 0) \
V(greaterThan, (BinaryFunc<Int32x4, GreaterThan, Int32x4>), 2, 0) \
V(lessThan, (BinaryFunc<Int32x4, LessThan, Int32x4>), 2, 0) \
V(equal, (CompareFunc<Int32x4, Equal>), 2, 0) \
V(greaterThan, (CompareFunc<Int32x4, GreaterThan>), 2, 0) \
V(lessThan, (CompareFunc<Int32x4, LessThan>), 2, 0) \
V(mul, (BinaryFunc<Int32x4, Mul, Int32x4>), 2, 0) \
V(or, (BinaryFunc<Int32x4, Or, Int32x4>), 2, 0) \
V(sub, (BinaryFunc<Int32x4, Sub, Int32x4>), 2, 0) \

Просмотреть файл

@ -12,7 +12,6 @@
#include "nsServiceManagerUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsIXPConnect.h"
#include "nsIJSNativeInitializer.h"
#include "nsIServiceManager.h"
#include "nsIFile.h"
#include "nsString.h"

Просмотреть файл

@ -724,7 +724,6 @@ pref("app.orientation.default", "");
// back to the system.
pref("memory.free_dirty_pages", true);
pref("layout.imagevisibility.enabled", true);
pref("layout.imagevisibility.numscrollportwidths", 1);
pref("layout.imagevisibility.numscrollportheights", 1);

Просмотреть файл

@ -5,7 +5,7 @@
from setuptools import setup
PACKAGE_NAME = 'mozdevice'
PACKAGE_VERSION = '0.42'
PACKAGE_VERSION = '0.43'
deps = ['mozfile >= 1.0',
'mozlog >= 2.1',

Просмотреть файл

@ -63,6 +63,7 @@
#include "mozilla/PoisonIOInterposer.h"
#include "mozilla/StartupTimeline.h"
#if defined(MOZ_ENABLE_PROFILER_SPS)
#include "mozilla/HangMonitor.h"
#include "shared-libraries.h"
#endif
@ -72,6 +73,7 @@ namespace {
using namespace base;
using namespace mozilla;
using namespace mozilla::HangMonitor;
template<class EntryType>
class AutoHashtable : public nsTHashtable<EntryType>
@ -208,14 +210,38 @@ CombinedStacks::SizeOfExcludingThis() const {
class HangReports {
public:
size_t SizeOfExcludingThis() const;
/**
* This struct encapsulates information for an individual ChromeHang annotation.
* mHangIndex is the index of the corresponding ChromeHang.
*/
struct AnnotationInfo {
AnnotationInfo(uint32_t aHangIndex,
HangAnnotations* aAnnotations)
: mHangIndex(aHangIndex)
, mAnnotations(aAnnotations)
{}
AnnotationInfo(const AnnotationInfo& aOther)
: mHangIndex(aOther.mHangIndex)
, mAnnotations(aOther.mAnnotations)
{}
~AnnotationInfo() {}
uint32_t mHangIndex;
mutable nsAutoPtr<HangAnnotations> mAnnotations;
};
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
void AddHang(const Telemetry::ProcessedStack& aStack, uint32_t aDuration,
int32_t aSystemUptime, int32_t aFirefoxUptime);
int32_t aSystemUptime, int32_t aFirefoxUptime,
HangAnnotations* aAnnotations);
uint32_t GetDuration(unsigned aIndex) const;
int32_t GetSystemUptime(unsigned aIndex) const;
int32_t GetFirefoxUptime(unsigned aIndex) const;
const std::vector<AnnotationInfo>& GetAnnotationInfo() const;
const CombinedStacks& GetStacks() const;
private:
/**
* This struct encapsulates the data for an individual ChromeHang, excluding
* annotations.
*/
struct HangInfo {
// Hang duration (in seconds)
uint32_t mDuration;
@ -225,6 +251,7 @@ private:
int32_t mFirefoxUptime;
};
std::vector<HangInfo> mHangInfo;
std::vector<AnnotationInfo> mAnnotationInfo;
CombinedStacks mStacks;
};
@ -232,19 +259,30 @@ void
HangReports::AddHang(const Telemetry::ProcessedStack& aStack,
uint32_t aDuration,
int32_t aSystemUptime,
int32_t aFirefoxUptime) {
int32_t aFirefoxUptime,
HangAnnotations* aAnnotations) {
HangInfo info = { aDuration, aSystemUptime, aFirefoxUptime };
mHangInfo.push_back(info);
if (aAnnotations) {
AnnotationInfo ainfo(static_cast<uint32_t>(mHangInfo.size() - 1),
aAnnotations);
mAnnotationInfo.push_back(ainfo);
}
mStacks.AddStack(aStack);
}
size_t
HangReports::SizeOfExcludingThis() const {
HangReports::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
size_t n = 0;
n += mStacks.SizeOfExcludingThis();
// This is a crude approximation. See comment on
// CombinedStacks::SizeOfExcludingThis.
n += mHangInfo.capacity() * sizeof(HangInfo);
n += mAnnotationInfo.capacity() * sizeof(AnnotationInfo);
for (std::vector<AnnotationInfo>::const_iterator i = mAnnotationInfo.begin(),
e = mAnnotationInfo.end(); i != e; ++i) {
n += i->mAnnotations->SizeOfIncludingThis(aMallocSizeOf);
}
return n;
}
@ -268,6 +306,11 @@ HangReports::GetFirefoxUptime(unsigned aIndex) const {
return mHangInfo[aIndex].mFirefoxUptime;
}
const std::vector<HangReports::AnnotationInfo>&
HangReports::GetAnnotationInfo() const {
return mAnnotationInfo;
}
/**
* IOInterposeObserver recording statistics of main-thread I/O during execution,
* aimed at consumption by TelemetryImpl
@ -575,7 +618,8 @@ public:
static void RecordChromeHang(uint32_t aDuration,
Telemetry::ProcessedStack &aStack,
int32_t aSystemUptime,
int32_t aFirefoxUptime);
int32_t aFirefoxUptime,
HangAnnotations* aAnnotations);
#endif
static void RecordThreadHangStats(Telemetry::ThreadHangStats& aStats);
static nsresult GetHistogramEnumId(const char *name, Telemetry::ID *id);
@ -1798,7 +1842,9 @@ TelemetryImpl::GetChromeHangs(JSContext *cx, JS::MutableHandle<JS::Value> ret)
JS::Rooted<JSObject*> durationArray(cx, JS_NewArrayObject(cx, 0));
JS::Rooted<JSObject*> systemUptimeArray(cx, JS_NewArrayObject(cx, 0));
JS::Rooted<JSObject*> firefoxUptimeArray(cx, JS_NewArrayObject(cx, 0));
if (!durationArray || !systemUptimeArray || !firefoxUptimeArray) {
JS::Rooted<JSObject*> annotationsArray(cx, JS_NewArrayObject(cx, 0));
if (!durationArray || !systemUptimeArray || !firefoxUptimeArray ||
!annotationsArray) {
return NS_ERROR_FAILURE;
}
@ -1820,6 +1866,13 @@ TelemetryImpl::GetChromeHangs(JSContext *cx, JS::MutableHandle<JS::Value> ret)
return NS_ERROR_FAILURE;
}
ok = JS_DefineProperty(cx, fullReportObj, "annotations", annotationsArray,
JSPROP_ENUMERATE);
if (!ok) {
return NS_ERROR_FAILURE;
}
const size_t length = stacks.GetStackCount();
for (size_t i = 0; i < length; ++i) {
if (!JS_SetElement(cx, durationArray, i, mHangReports.GetDuration(i))) {
@ -1831,6 +1884,49 @@ TelemetryImpl::GetChromeHangs(JSContext *cx, JS::MutableHandle<JS::Value> ret)
if (!JS_SetElement(cx, firefoxUptimeArray, i, mHangReports.GetFirefoxUptime(i))) {
return NS_ERROR_FAILURE;
}
const std::vector<HangReports::AnnotationInfo>& annotationInfo =
mHangReports.GetAnnotationInfo();
uint32_t annotationsArrayIndex = 0;
for (std::vector<HangReports::AnnotationInfo>::const_iterator
ai = annotationInfo.begin(), e = annotationInfo.end(); ai != e;
++ai, ++annotationsArrayIndex) {
JS::Rooted<JSObject*> keyValueArray(cx, JS_NewArrayObject(cx, 0));
if (!keyValueArray) {
return NS_ERROR_FAILURE;
}
JS::RootedValue indexValue(cx);
indexValue.setNumber(ai->mHangIndex);
if (!JS_SetElement(cx, keyValueArray, 0, indexValue)) {
return NS_ERROR_FAILURE;
}
JS::Rooted<JSObject*> jsAnnotation(cx, JS_NewObject(cx, nullptr,
JS::NullPtr(),
JS::NullPtr()));
if (!jsAnnotation) {
return NS_ERROR_FAILURE;
}
nsAutoPtr<HangAnnotations::Enumerator> annotationsEnum;
if (!ai->mAnnotations->GetEnumerator(annotationsEnum.StartAssignment())) {
return NS_ERROR_FAILURE;
}
nsAutoString key;
nsAutoString value;
while (annotationsEnum->Next(key, value)) {
JS::RootedValue jsValue(cx);
jsValue.setString(JS_NewUCStringCopyN(cx, value.get(), value.Length()));
if (!JS_DefineUCProperty(cx, jsAnnotation, key.get(), key.Length(),
jsValue, JSPROP_ENUMERATE)) {
return NS_ERROR_FAILURE;
}
}
if (!JS_SetElement(cx, keyValueArray, 1, jsAnnotation)) {
return NS_ERROR_FAILURE;
}
if (!JS_SetElement(cx, annotationsArray, annotationsArrayIndex,
keyValueArray)) {
return NS_ERROR_FAILURE;
}
}
}
return NS_OK;
@ -2543,7 +2639,8 @@ void
TelemetryImpl::RecordChromeHang(uint32_t aDuration,
Telemetry::ProcessedStack &aStack,
int32_t aSystemUptime,
int32_t aFirefoxUptime)
int32_t aFirefoxUptime,
HangAnnotations* aAnnotations)
{
if (!sTelemetry || !sTelemetry->mCanRecord)
return;
@ -2551,7 +2648,8 @@ TelemetryImpl::RecordChromeHang(uint32_t aDuration,
MutexAutoLock hangReportMutex(sTelemetry->mHangReportsMutex);
sTelemetry->mHangReports.AddHang(aStack, aDuration,
aSystemUptime, aFirefoxUptime);
aSystemUptime, aFirefoxUptime,
aAnnotations);
}
#endif
@ -2641,7 +2739,7 @@ TelemetryImpl::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
n += mTrackedDBs.SizeOfExcludingThis(aMallocSizeOf);
{ // Scope for mHangReportsMutex lock
MutexAutoLock lock(mHangReportsMutex);
n += mHangReports.SizeOfExcludingThis();
n += mHangReports.SizeOfExcludingThis(aMallocSizeOf);
}
{ // Scope for mThreadHangStatsMutex lock
MutexAutoLock lock(mThreadHangStatsMutex);
@ -2797,10 +2895,11 @@ void Init()
void RecordChromeHang(uint32_t duration,
ProcessedStack &aStack,
int32_t aSystemUptime,
int32_t aFirefoxUptime)
int32_t aFirefoxUptime,
HangAnnotations* aAnnotations)
{
TelemetryImpl::RecordChromeHang(duration, aStack,
aSystemUptime, aFirefoxUptime);
aSystemUptime, aFirefoxUptime, aAnnotations);
}
#endif

Просмотреть файл

@ -17,6 +17,9 @@ namespace base {
}
namespace mozilla {
namespace HangMonitor {
class HangAnnotations;
}
namespace Telemetry {
#include "TelemetryHistogramEnums.h"
@ -195,12 +198,14 @@ class ProcessedStack;
* @param aStack - Array of PCs from the hung call stack
* @param aSystemUptime - System uptime at the time of the hang, in minutes
* @param aFirefoxUptime - Firefox uptime at the time of the hang, in minutes
* @param aAnnotations - Any annotations to be added to the report
*/
#if defined(MOZ_ENABLE_PROFILER_SPS)
void RecordChromeHang(uint32_t aDuration,
ProcessedStack &aStack,
int32_t aSystemUptime,
int32_t aFirefoxUptime);
int32_t aFirefoxUptime,
mozilla::HangMonitor::HangAnnotations* aAnnotations = nullptr);
#endif
class ThreadHangStats;

Просмотреть файл

@ -95,6 +95,35 @@ CopySections(const unsigned char *data, PIMAGE_NT_HEADERS old_headers, PMEMORYMO
}
}
static bool
CopyRegion(HANDLE hRemoteProcess, void* remoteAddress, void* localAddress, DWORD size, DWORD protect)
{
if (size > 0) {
// Copy the data from local->remote and set the memory protection
if (!VirtualAllocEx(hRemoteProcess, remoteAddress, size, MEM_COMMIT, PAGE_READWRITE))
return false;
if (!WriteProcessMemory(hRemoteProcess,
remoteAddress,
localAddress,
size,
nullptr)) {
#ifdef DEBUG_OUTPUT
OutputLastError("Error writing remote memory.\n");
#endif
return false;
}
DWORD oldProtect;
if (VirtualProtectEx(hRemoteProcess, remoteAddress, size, protect, &oldProtect) == 0) {
#ifdef DEBUG_OUTPUT
OutputLastError("Error protecting memory page");
#endif
return false;
}
}
return true;
}
// Protection flags for memory pages (Executable, Readable, Writeable)
static int ProtectionFlags[2][2][2] = {
{
@ -117,11 +146,20 @@ FinalizeSections(PMEMORYMODULE module, HANDLE hRemoteProcess)
#endif
int i;
int numSections = module->headers->FileHeader.NumberOfSections;
if (numSections < 1)
return false;
PIMAGE_SECTION_HEADER section = IMAGE_FIRST_SECTION(module->headers);
// Copy any data before the first section (i.e. the image header)
if (!CopyRegion(hRemoteProcess, module->remoteCodeBase, module->localCodeBase, section->VirtualAddress, PAGE_READONLY))
return false;
// loop through all sections and change access flags
for (i=0; i<module->headers->FileHeader.NumberOfSections; i++, section++) {
DWORD protect, oldProtect, size;
for (i=0; i<numSections; i++, section++) {
DWORD protect, size;
int executable = (section->Characteristics & IMAGE_SCN_MEM_EXECUTE) != 0;
int readable = (section->Characteristics & IMAGE_SCN_MEM_READ) != 0;
int writeable = (section->Characteristics & IMAGE_SCN_MEM_WRITE) != 0;
@ -132,39 +170,17 @@ FinalizeSections(PMEMORYMODULE module, HANDLE hRemoteProcess)
protect |= PAGE_NOCACHE;
}
void* remoteAddress = module->remoteCodeBase + section->VirtualAddress;
void* localAddress = module->localCodeBase + section->VirtualAddress;
// determine size of region
size = section->Misc.VirtualSize;
if (size > 0) {
void* remoteAddress = module->remoteCodeBase + section->VirtualAddress;
void* localAddress = module->localCodeBase + section->VirtualAddress;
#ifdef DEBUG_OUTPUT
fprintf(stderr, "Copying section %s to %p, size %x, executable %i readable %i writeable %i\n",
section->Name, remoteAddress, size, executable, readable, writeable);
#endif
// Copy the data from local->remote and set the memory protection
if (!VirtualAllocEx(hRemoteProcess, remoteAddress, size, MEM_COMMIT, PAGE_READWRITE))
return false;
if (!WriteProcessMemory(hRemoteProcess,
remoteAddress,
localAddress,
size,
nullptr)) {
#ifdef DEBUG_OUTPUT
OutputLastError("Error writing remote memory.\n");
#endif
return false;
}
if (VirtualProtectEx(hRemoteProcess, remoteAddress, size, protect, &oldProtect) == 0) {
#ifdef DEBUG_OUTPUT
OutputLastError("Error protecting memory page");
#endif
return false;
}
}
if (!CopyRegion(hRemoteProcess, remoteAddress, localAddress, size, protect))
return false;
}
return true;
}

Просмотреть файл

@ -37,7 +37,7 @@ function TouchEventHandler (window) {
let TouchEventHandler = {
enabled: false,
events: ['mousedown', 'mousemove', 'mouseup'],
events: ['mousedown', 'mousemove', 'mouseup', 'touchstart', 'touchend'],
start: function teh_start() {
if (this.enabled)
return false;
@ -61,18 +61,43 @@ function TouchEventHandler (window) {
}).bind(this));
},
handleEvent: function teh_handleEvent(evt) {
// Ignore all but real mouse event coming from physical mouse
// (especially ignore mouse event being dispatched from a touch event)
if (evt.button || evt.mozInputSource != Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE || evt.isSynthesized) {
return;
}
// The gaia system window use an hybrid system even on the device which is
// a mix of mouse/touch events. So let's not cancel *all* mouse events
// if it is the current target.
let content = this.getContent(evt.target);
let isSystemWindow = content.location.toString().indexOf("system.gaiamobile.org") != -1;
// App touchstart & touchend should also be dispatched on the system app
// to match on-device behavior.
if (evt.type.startsWith('touch') && !isSystemWindow) {
let sysFrame = content.realFrameElement;
let sysDocument = sysFrame.ownerDocument;
let sysWindow = sysDocument.defaultView;
let touchEvent = sysDocument.createEvent('touchevent');
let touch = evt.touches[0] || evt.changedTouches[0];
let point = sysDocument.createTouch(sysWindow, sysFrame, 0,
touch.pageX, touch.pageY,
touch.screenX, touch.screenY,
touch.clientX, touch.clientY,
1, 1, 0, 0);
let touches = sysDocument.createTouchList(point);
let targetTouches = touches;
let changedTouches = touches;
touchEvent.initTouchEvent(evt.type, true, true, sysWindow, 0,
false, false, false, false,
touches, targetTouches, changedTouches);
sysFrame.dispatchEvent(touchEvent);
return;
}
// Ignore all but real mouse event coming from physical mouse
// (especially ignore mouse event being dispatched from a touch event)
if (evt.button || evt.mozInputSource != Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE || evt.isSynthesized) {
return;
}
let eventTarget = this.target;
let type = '';
switch (evt.type) {

Просмотреть файл

@ -118,6 +118,8 @@ if CONFIG['MOZ_UNIVERSALCHARDET']:
if CONFIG['ACCESSIBILITY']:
DIRS += ['/accessible']
else:
DIRS += ['/accessible/ipc']
# toolkit

Просмотреть файл

@ -3132,20 +3132,12 @@ NS_METHOD nsWindow::EnableDragDrop(bool aEnable)
NS_METHOD nsWindow::CaptureMouse(bool aCapture)
{
TRACKMOUSEEVENT mTrack;
mTrack.cbSize = sizeof(TRACKMOUSEEVENT);
mTrack.dwFlags = TME_LEAVE;
mTrack.dwHoverTime = 0;
if (aCapture) {
mTrack.hwndTrack = mWnd;
::SetCapture(mWnd);
} else {
mTrack.hwndTrack = nullptr;
::ReleaseCapture();
}
sIsInMouseCapture = aCapture;
// Requests WM_MOUSELEAVE events for this window.
TrackMouseEvent(&mTrack);
return NS_OK;
}
@ -4865,6 +4857,15 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
case WM_MOUSEMOVE:
{
if (!mMousePresent) {
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(TRACKMOUSEEVENT);
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = mWnd;
// Request WM_MOUSELEAVE events for this window.
TrackMouseEvent(&tme);
}
mMousePresent = true;
// Suppress dispatch of pending events
@ -4932,6 +4933,12 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
}
break;
case WM_NCMOUSELEAVE:
// If upon mouse leave event, only WM_NCMOUSELEAVE message is sent, sending WM_MOUSELEAVE message
// makes the event being properly handled.
SendMessage(mWnd, WM_MOUSELEAVE, 0, 0);
break;
case WM_CONTEXTMENU:
{
// if the context menu is brought up from the keyboard, |lParam|

Просмотреть файл

@ -5,15 +5,21 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/HangMonitor.h"
#include <set>
#include "mozilla/BackgroundHangMonitor.h"
#include "mozilla/Monitor.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "mozilla/ProcessedStack.h"
#include "mozilla/Atomics.h"
#include "nsXULAppAPI.h"
#include "nsThreadUtils.h"
#include "mozilla/StaticPtr.h"
#include "nsAutoPtr.h"
#include "nsReadableUtils.h"
#include "nsStackWalk.h"
#include "nsThreadUtils.h"
#include "nsXULAppAPI.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
@ -68,6 +74,9 @@ static const int32_t DEFAULT_CHROME_HANG_INTERVAL = 5;
// Maximum number of PCs to gather from the stack
static const int32_t MAX_CALL_STACK_PCS = 400;
// Chrome hang annotators
static StaticAutoPtr<std::set<Annotator*>> gAnnotators;
#endif
// PrefChangedFunc
@ -113,6 +122,162 @@ Crash()
}
#ifdef REPORT_CHROME_HANGS
class ChromeHangAnnotations : public HangAnnotations
{
public:
ChromeHangAnnotations();
~ChromeHangAnnotations();
void AddAnnotation(const nsAString& aName, const int32_t aData) MOZ_OVERRIDE;
void AddAnnotation(const nsAString& aName, const double aData) MOZ_OVERRIDE;
void AddAnnotation(const nsAString& aName, const nsAString& aData) MOZ_OVERRIDE;
void AddAnnotation(const nsAString& aName, const nsACString& aData) MOZ_OVERRIDE;
void AddAnnotation(const nsAString& aName, const bool aData) MOZ_OVERRIDE;
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
bool IsEmpty() const MOZ_OVERRIDE;
bool GetEnumerator(Enumerator** aOutEnum) MOZ_OVERRIDE;
typedef std::pair<nsString, nsString> AnnotationType;
typedef std::vector<AnnotationType> VectorType;
typedef VectorType::const_iterator IteratorType;
private:
VectorType mAnnotations;
};
ChromeHangAnnotations::ChromeHangAnnotations()
{
MOZ_COUNT_CTOR(ChromeHangAnnotations);
}
ChromeHangAnnotations::~ChromeHangAnnotations()
{
MOZ_COUNT_DTOR(ChromeHangAnnotations);
}
void
ChromeHangAnnotations::AddAnnotation(const nsAString& aName, const int32_t aData)
{
nsString dataString;
dataString.AppendInt(aData);
AnnotationType annotation = std::make_pair(nsString(aName), dataString);
mAnnotations.push_back(annotation);
}
void
ChromeHangAnnotations::AddAnnotation(const nsAString& aName, const double aData)
{
nsString dataString;
dataString.AppendFloat(aData);
AnnotationType annotation = std::make_pair(nsString(aName), dataString);
mAnnotations.push_back(annotation);
}
void
ChromeHangAnnotations::AddAnnotation(const nsAString& aName, const nsAString& aData)
{
AnnotationType annotation = std::make_pair(nsString(aName), nsString(aData));
mAnnotations.push_back(annotation);
}
void
ChromeHangAnnotations::AddAnnotation(const nsAString& aName, const nsACString& aData)
{
nsString dataString;
AppendUTF8toUTF16(aData, dataString);
AnnotationType annotation = std::make_pair(nsString(aName), dataString);
mAnnotations.push_back(annotation);
}
void
ChromeHangAnnotations::AddAnnotation(const nsAString& aName, const bool aData)
{
nsString dataString;
dataString += aData ? NS_LITERAL_STRING("true") : NS_LITERAL_STRING("false");
AnnotationType annotation = std::make_pair(nsString(aName), dataString);
mAnnotations.push_back(annotation);
}
/**
* This class itself does not use synchronization but it (and its parent object)
* should be protected by mutual exclusion in some way. In Telemetry the chrome
* hang data is protected via TelemetryImpl::mHangReportsMutex.
*/
class ChromeHangAnnotationEnumerator : public HangAnnotations::Enumerator
{
public:
ChromeHangAnnotationEnumerator(const ChromeHangAnnotations::VectorType& aAnnotations);
~ChromeHangAnnotationEnumerator();
virtual bool Next(nsAString& aOutName, nsAString& aOutValue);
private:
ChromeHangAnnotations::IteratorType mIterator;
ChromeHangAnnotations::IteratorType mEnd;
};
ChromeHangAnnotationEnumerator::ChromeHangAnnotationEnumerator(
const ChromeHangAnnotations::VectorType& aAnnotations)
: mIterator(aAnnotations.begin())
, mEnd(aAnnotations.end())
{
MOZ_COUNT_CTOR(ChromeHangAnnotationEnumerator);
}
ChromeHangAnnotationEnumerator::~ChromeHangAnnotationEnumerator()
{
MOZ_COUNT_DTOR(ChromeHangAnnotationEnumerator);
}
bool
ChromeHangAnnotationEnumerator::Next(nsAString& aOutName, nsAString& aOutValue)
{
aOutName.Truncate();
aOutValue.Truncate();
if (mIterator == mEnd) {
return false;
}
aOutName = mIterator->first;
aOutValue = mIterator->second;
++mIterator;
return true;
}
bool
ChromeHangAnnotations::IsEmpty() const
{
return mAnnotations.empty();
}
size_t
ChromeHangAnnotations::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{
size_t result = sizeof(mAnnotations) +
mAnnotations.capacity() * sizeof(AnnotationType);
for (IteratorType i = mAnnotations.begin(), e = mAnnotations.end(); i != e;
++i) {
result += i->first.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
result += i->second.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
}
return result;
}
bool
ChromeHangAnnotations::GetEnumerator(HangAnnotations::Enumerator** aOutEnum)
{
if (!aOutEnum) {
return false;
}
*aOutEnum = nullptr;
if (mAnnotations.empty()) {
return false;
}
*aOutEnum = new ChromeHangAnnotationEnumerator(mAnnotations);
return true;
}
static void
ChromeStackWalker(uint32_t aFrameNumber, void* aPC, void* aSP, void* aClosure)
{
@ -163,6 +328,22 @@ GetChromeHangReport(Telemetry::ProcessedStack& aStack,
aFirefoxUptime = -1;
}
}
static void
ChromeHangAnnotatorCallout(ChromeHangAnnotations& aAnnotations)
{
gMonitor->AssertCurrentThreadOwns();
MOZ_ASSERT(gAnnotators);
if (!gAnnotators) {
return;
}
for (std::set<Annotator*>::iterator i = gAnnotators->begin(),
e = gAnnotators->end();
i != e; ++i) {
(*i)->AnnotateHang(aAnnotations);
}
}
#endif
void
@ -182,6 +363,7 @@ ThreadMain(void*)
Telemetry::ProcessedStack stack;
int32_t systemUptime = -1;
int32_t firefoxUptime = -1;
nsAutoPtr<ChromeHangAnnotations> annotations = new ChromeHangAnnotations();
#endif
while (true) {
@ -209,6 +391,7 @@ ThreadMain(void*)
// the minimum hang duration has been reached (not when the hang ends)
if (waitCount == 2) {
GetChromeHangReport(stack, systemUptime, firefoxUptime);
ChromeHangAnnotatorCallout(*annotations);
}
#else
// This is the crash-on-hang feature.
@ -226,9 +409,11 @@ ThreadMain(void*)
#ifdef REPORT_CHROME_HANGS
if (waitCount >= 2) {
uint32_t hangDuration = PR_IntervalToSeconds(now - lastTimestamp);
Telemetry::RecordChromeHang(hangDuration, stack,
systemUptime, firefoxUptime);
Telemetry::RecordChromeHang(hangDuration, stack, systemUptime,
firefoxUptime, annotations->IsEmpty() ?
nullptr : annotations.forget());
stack.Clear();
annotations = new ChromeHangAnnotations();
}
#endif
lastTimestamp = timestamp;
@ -268,6 +453,7 @@ Startup()
if (!winMainThreadHandle) {
return;
}
gAnnotators = new std::set<Annotator*>();
#endif
// Don't actually start measuring hangs until we hit the main event loop.
@ -306,6 +492,11 @@ Shutdown()
delete gMonitor;
gMonitor = nullptr;
#ifdef REPORT_CHROME_HANGS
// gAnnotators is a StaticAutoPtr, so we just need to null it out.
gAnnotators = nullptr;
#endif
}
static bool
@ -394,5 +585,25 @@ Suspend()
}
}
void
RegisterAnnotator(Annotator& aAnnotator)
{
#ifdef REPORT_CHROME_HANGS
MonitorAutoLock lock(*gMonitor);
MOZ_ASSERT(gAnnotators);
gAnnotators->insert(&aAnnotator);
#endif
}
void
UnregisterAnnotator(Annotator& aAnnotator)
{
#ifdef REPORT_CHROME_HANGS
MonitorAutoLock lock(*gMonitor);
MOZ_ASSERT(gAnnotators);
gAnnotators->erase(&aAnnotator);
#endif
}
} // namespace HangMonitor
} // namespace mozilla

Просмотреть файл

@ -7,6 +7,9 @@
#ifndef mozilla_HangMonitor_h
#define mozilla_HangMonitor_h
#include "mozilla/MemoryReporting.h"
#include "nsString.h"
namespace mozilla {
namespace HangMonitor {
@ -38,6 +41,57 @@ void Startup();
*/
void Shutdown();
/**
* This class declares an abstraction for a data type that encapsulates all
* of the annotations being reported by a registered hang Annotator.
*/
class HangAnnotations
{
public:
virtual ~HangAnnotations() {}
virtual void AddAnnotation(const nsAString& aName, const int32_t aData) = 0;
virtual void AddAnnotation(const nsAString& aName, const double aData) = 0;
virtual void AddAnnotation(const nsAString& aName, const nsAString& aData) = 0;
virtual void AddAnnotation(const nsAString& aName, const nsACString& aData) = 0;
virtual void AddAnnotation(const nsAString& aName, const bool aData) = 0;
class Enumerator
{
public:
virtual ~Enumerator() {}
virtual bool Next(nsAString& aOutName, nsAString& aOutValue) = 0;
};
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0;
virtual bool IsEmpty() const = 0;
virtual bool GetEnumerator(Enumerator **aOutEnum) = 0;
};
class Annotator
{
public:
/**
* NB: This function is always called by the HangMonitor thread.
* Plan accordingly.
*/
virtual void AnnotateHang(HangAnnotations& aAnnotations) = 0;
};
/**
* Registers an Annotator to be called when a hang is detected.
* @param aAnnotator Reference to an object that implements the
* HangMonitor::Annotator interface.
*/
void RegisterAnnotator(Annotator& aAnnotator);
/**
* Registers an Annotator that was previously registered via RegisterAnnotator.
* @param aAnnotator Reference to an object that implements the
* HangMonitor::Annotator interface.
*/
void UnregisterAnnotator(Annotator& aAnnotator);
/**
* Notify the hang monitor of activity which will reset its internal timer.
*