mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge mozilla-central to fx-team
This commit is contained in:
commit
d912c6ad42
2
CLOBBER
2
CLOBBER
@ -18,4 +18,4 @@
|
||||
# Modifying this file will now automatically clobber the buildbot machines \o/
|
||||
#
|
||||
|
||||
Bug 926091 says hello to bug 924992 by touching webidl
|
||||
Bug 918207 needed a clobber on every platform because we can't have nice things
|
||||
|
@ -871,6 +871,32 @@ refStateSetCB(AtkObject *aAtkObj)
|
||||
return state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
UpdateAtkRelation(RelationType aType, Accessible* aAcc,
|
||||
AtkRelationType aAtkType, AtkRelationSet* aAtkSet)
|
||||
{
|
||||
if (aAtkType == ATK_RELATION_NULL)
|
||||
return;
|
||||
|
||||
AtkRelation* atkRelation =
|
||||
atk_relation_set_get_relation_by_type(aAtkSet, aAtkType);
|
||||
if (atkRelation)
|
||||
atk_relation_set_remove(aAtkSet, atkRelation);
|
||||
|
||||
Relation rel(aAcc->RelationByType(aType));
|
||||
nsTArray<AtkObject*> targets;
|
||||
Accessible* tempAcc = nullptr;
|
||||
while ((tempAcc = rel.Next()))
|
||||
targets.AppendElement(AccessibleWrap::GetAtkObject(tempAcc));
|
||||
|
||||
if (targets.Length()) {
|
||||
atkRelation = atk_relation_new(targets.Elements(),
|
||||
targets.Length(), aAtkType);
|
||||
atk_relation_set_add(aAtkSet, atkRelation);
|
||||
g_object_unref(atkRelation);
|
||||
}
|
||||
}
|
||||
|
||||
AtkRelationSet *
|
||||
refRelationSetCB(AtkObject *aAtkObj)
|
||||
{
|
||||
@ -881,46 +907,12 @@ refRelationSetCB(AtkObject *aAtkObj)
|
||||
if (!accWrap)
|
||||
return relation_set;
|
||||
|
||||
// Keep in sync with AtkRelationType enum.
|
||||
static const RelationType relationTypes[] = {
|
||||
RelationType::CONTROLLED_BY,
|
||||
RelationType::CONTROLLER_FOR,
|
||||
RelationType::LABEL_FOR,
|
||||
RelationType::LABELLED_BY,
|
||||
RelationType::MEMBER_OF,
|
||||
RelationType::NODE_CHILD_OF,
|
||||
RelationType::FLOWS_TO,
|
||||
RelationType::FLOWS_FROM,
|
||||
RelationType::SUBWINDOW_OF,
|
||||
RelationType::EMBEDS,
|
||||
RelationType::EMBEDDED_BY,
|
||||
RelationType::POPUP_FOR,
|
||||
RelationType::PARENT_WINDOW_OF,
|
||||
RelationType::DESCRIBED_BY,
|
||||
RelationType::DESCRIPTION_FOR,
|
||||
RelationType::NODE_PARENT_OF
|
||||
};
|
||||
#define RELATIONTYPE(geckoType, geckoTypeName, atkType, msaaType, ia2Type) \
|
||||
UpdateAtkRelation(RelationType::geckoType, accWrap, atkType, relation_set);
|
||||
|
||||
for (uint32_t i = 0; i < ArrayLength(relationTypes); i++) {
|
||||
// Shift to 1 to skip ATK_RELATION_NULL.
|
||||
AtkRelationType atkType = static_cast<AtkRelationType>(i + 1);
|
||||
AtkRelation* atkRelation =
|
||||
atk_relation_set_get_relation_by_type(relation_set, atkType);
|
||||
if (atkRelation)
|
||||
atk_relation_set_remove(relation_set, atkRelation);
|
||||
#include "RelationTypeMap.h"
|
||||
|
||||
Relation rel(accWrap->RelationByType(relationTypes[i]));
|
||||
nsTArray<AtkObject*> targets;
|
||||
Accessible* tempAcc = nullptr;
|
||||
while ((tempAcc = rel.Next()))
|
||||
targets.AppendElement(AccessibleWrap::GetAtkObject(tempAcc));
|
||||
|
||||
if (targets.Length()) {
|
||||
atkRelation = atk_relation_new(targets.Elements(), targets.Length(), atkType);
|
||||
atk_relation_set_add(relation_set, atkRelation);
|
||||
g_object_unref(atkRelation);
|
||||
}
|
||||
}
|
||||
#undef RELATIONTYPE
|
||||
|
||||
return relation_set;
|
||||
}
|
||||
|
@ -4,7 +4,9 @@
|
||||
* 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 "nsIAccessibleRelation.h"
|
||||
#include "nsIAccessibleRole.h"
|
||||
#include "RelationType.h"
|
||||
#include "Role.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
@ -15,3 +17,10 @@ using namespace mozilla::a11y;
|
||||
"internal and xpcom roles differ!");
|
||||
#include "RoleMap.h"
|
||||
#undef ROLE
|
||||
|
||||
#define RELATIONTYPE(geckoType, stringType, atkType, msaaType, ia2Type) \
|
||||
static_assert(static_cast<uint32_t>(RelationType::geckoType) \
|
||||
== static_cast<uint32_t>(nsIAccessibleRelation::RELATION_ ## geckoType), \
|
||||
"internal and xpcom relations differ!");
|
||||
#include "RelationTypeMap.h"
|
||||
#undef RELATIONTYPE
|
112
accessible/src/base/RelationTypeMap.h
Normal file
112
accessible/src/base/RelationTypeMap.h
Normal file
@ -0,0 +1,112 @@
|
||||
/* -*- 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/. */
|
||||
|
||||
/**
|
||||
* Usage: declare the macro RELATIONTYPE()with the following arguments:
|
||||
* RELATIONTYPE(geckoType, geckoTypeName, atkType, msaaType, ia2Type)
|
||||
*/
|
||||
|
||||
RELATIONTYPE(LABELLED_BY,
|
||||
"labelled by",
|
||||
ATK_RELATION_LABELLED_BY,
|
||||
NAVRELATION_LABELLED_BY,
|
||||
IA2_RELATION_LABELLED_BY)
|
||||
|
||||
RELATIONTYPE(LABEL_FOR,
|
||||
"label for",
|
||||
ATK_RELATION_LABEL_FOR,
|
||||
NAVRELATION_LABEL_FOR,
|
||||
IA2_RELATION_LABEL_FOR)
|
||||
|
||||
RELATIONTYPE(DESCRIBED_BY,
|
||||
"described by",
|
||||
ATK_RELATION_DESCRIBED_BY,
|
||||
NAVRELATION_DESCRIBED_BY,
|
||||
IA2_RELATION_DESCRIBED_BY)
|
||||
|
||||
RELATIONTYPE(DESCRIPTION_FOR,
|
||||
"description for",
|
||||
ATK_RELATION_DESCRIPTION_FOR,
|
||||
NAVRELATION_DESCRIPTION_FOR,
|
||||
IA2_RELATION_DESCRIPTION_FOR)
|
||||
|
||||
RELATIONTYPE(NODE_CHILD_OF,
|
||||
"node child of",
|
||||
ATK_RELATION_NODE_CHILD_OF,
|
||||
NAVRELATION_NODE_CHILD_OF,
|
||||
IA2_RELATION_NODE_CHILD_OF)
|
||||
|
||||
RELATIONTYPE(NODE_PARENT_OF,
|
||||
"node parent of",
|
||||
ATK_RELATION_NODE_PARENT_OF,
|
||||
NAVRELATION_NODE_PARENT_OF,
|
||||
IA2_RELATION_NODE_PARENT_OF)
|
||||
|
||||
RELATIONTYPE(CONTROLLED_BY,
|
||||
"controlled by",
|
||||
ATK_RELATION_CONTROLLED_BY,
|
||||
NAVRELATION_CONTROLLED_BY,
|
||||
IA2_RELATION_CONTROLLED_BY)
|
||||
|
||||
RELATIONTYPE(CONTROLLER_FOR,
|
||||
"controller for",
|
||||
ATK_RELATION_CONTROLLER_FOR,
|
||||
NAVRELATION_CONTROLLER_FOR,
|
||||
IA2_RELATION_CONTROLLER_FOR)
|
||||
|
||||
RELATIONTYPE(FLOWS_TO,
|
||||
"flows to",
|
||||
ATK_RELATION_FLOWS_TO,
|
||||
NAVRELATION_FLOWS_TO,
|
||||
IA2_RELATION_FLOWS_TO)
|
||||
|
||||
RELATIONTYPE(FLOWS_FROM,
|
||||
"flows from",
|
||||
ATK_RELATION_FLOWS_FROM,
|
||||
NAVRELATION_FLOWS_FROM,
|
||||
IA2_RELATION_FLOWS_FROM)
|
||||
|
||||
RELATIONTYPE(MEMBER_OF,
|
||||
"member of",
|
||||
ATK_RELATION_MEMBER_OF,
|
||||
NAVRELATION_MEMBER_OF,
|
||||
IA2_RELATION_MEMBER_OF)
|
||||
|
||||
RELATIONTYPE(SUBWINDOW_OF,
|
||||
"subwindow of",
|
||||
ATK_RELATION_SUBWINDOW_OF,
|
||||
NAVRELATION_SUBWINDOW_OF,
|
||||
IA2_RELATION_SUBWINDOW_OF)
|
||||
|
||||
RELATIONTYPE(EMBEDS,
|
||||
"embeds",
|
||||
ATK_RELATION_EMBEDS,
|
||||
NAVRELATION_EMBEDS,
|
||||
IA2_RELATION_EMBEDS)
|
||||
|
||||
RELATIONTYPE(EMBEDDED_BY,
|
||||
"embedded by",
|
||||
ATK_RELATION_EMBEDDED_BY,
|
||||
NAVRELATION_EMBEDDED_BY,
|
||||
IA2_RELATION_EMBEDDED_BY)
|
||||
|
||||
RELATIONTYPE(POPUP_FOR,
|
||||
"popup for",
|
||||
ATK_RELATION_POPUP_FOR,
|
||||
NAVRELATION_POPUP_FOR,
|
||||
IA2_RELATION_POPUP_FOR)
|
||||
|
||||
RELATIONTYPE(PARENT_WINDOW_OF,
|
||||
"parent window of",
|
||||
ATK_RELATION_PARENT_WINDOW_OF,
|
||||
NAVRELATION_PARENT_WINDOW_OF,
|
||||
IA2_RELATION_PARENT_WINDOW_OF)
|
||||
|
||||
RELATIONTYPE(DEFAULT_BUTTON,
|
||||
"default button",
|
||||
ATK_RELATION_NULL,
|
||||
NAVRELATION_DEFAULT_BUTTON,
|
||||
IA2_RELATION_NULL)
|
@ -37,6 +37,7 @@ CPP_SOURCES += [
|
||||
'AccIterator.cpp',
|
||||
'ARIAMap.cpp',
|
||||
'ARIAStateMap.cpp',
|
||||
'Asserts.cpp',
|
||||
'DocManager.cpp',
|
||||
'EventQueue.cpp',
|
||||
'Filters.cpp',
|
||||
@ -49,7 +50,6 @@ CPP_SOURCES += [
|
||||
'nsCoreUtils.cpp',
|
||||
'nsEventShell.cpp',
|
||||
'nsTextEquivUtils.cpp',
|
||||
'RoleAsserts.cpp',
|
||||
'SelectionManager.cpp',
|
||||
'StyleInfo.cpp',
|
||||
'TextAttrs.cpp',
|
||||
|
@ -713,13 +713,22 @@ NS_IMETHODIMP
|
||||
nsAccessibilityService::GetStringRelationType(uint32_t aRelationType,
|
||||
nsAString& aString)
|
||||
{
|
||||
if (aRelationType >= ArrayLength(kRelationTypeNames)) {
|
||||
aString.AssignLiteral("unknown");
|
||||
NS_ENSURE_ARG(aRelationType <= static_cast<uint32_t>(RelationType::LAST));
|
||||
|
||||
#define RELATIONTYPE(geckoType, geckoTypeName, atkType, msaaType, ia2Type) \
|
||||
case RelationType::geckoType: \
|
||||
aString.AssignLiteral(geckoTypeName); \
|
||||
return NS_OK;
|
||||
|
||||
RelationType relationType = static_cast<RelationType>(aRelationType);
|
||||
switch (relationType) {
|
||||
#include "RelationTypeMap.h"
|
||||
default:
|
||||
aString.AssignLiteral("unknown");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
CopyUTF8toUTF16(kRelationTypeNames[aRelationType], aString);
|
||||
return NS_OK;
|
||||
#undef RELATIONTYPE
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -332,29 +332,5 @@ static const char kEventTypeNames[][40] = {
|
||||
"virtual cursor changed" // EVENT_VIRTUALCURSOR_CHANGED
|
||||
};
|
||||
|
||||
/**
|
||||
* Map nsIAccessibleRelation constants to strings. Used by
|
||||
* nsIAccessibleRetrieval::getStringRelationType() method.
|
||||
*/
|
||||
static const char kRelationTypeNames[][20] = {
|
||||
"labelled by", // RELATION_LABELLED_BY
|
||||
"label for", // RELATION_LABEL_FOR
|
||||
"described by", // RELATION_DESCRIBED_BY
|
||||
"description for", // RELATION_DESCRIPTION_FOR
|
||||
"node child of", // RELATION_NODE_CHILD_OF
|
||||
"node parent of", // RELATION_NODE_PARENT_OF
|
||||
"controlled by", // RELATION_CONTROLLED_BY
|
||||
"controller for", // RELATION_CONTROLLER_FOR
|
||||
"flows to", // RELATION_FLOWS_TO
|
||||
"flows from", // RELATION_FLOWS_FROM
|
||||
"member of", // RELATION_MEMBER_OF
|
||||
"subwindow of", // RELATION_SUBWINDOW_OF
|
||||
"embeds", // RELATION_EMBEDS
|
||||
"embedded by", // RELATION_EMBEDDED_BY
|
||||
"popup for", // RELATION_POPUP_FOR
|
||||
"parent window of", // RELATION_PARENT_WINDOW_OF
|
||||
"default button" // RELATION_DEFAULT_BUTTON
|
||||
};
|
||||
|
||||
#endif /* __nsIAccessibilityService_h__ */
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMNodeFilter.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMTreeWalker.h"
|
||||
#include "nsIDOMXULButtonElement.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
|
@ -60,8 +60,11 @@ ia2Accessible::get_nRelations(long* aNRelations)
|
||||
if (acc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
for (unsigned int idx = 0; idx < ArrayLength(sRelationTypesForIA2); idx++) {
|
||||
Relation rel = acc->RelationByType(sRelationTypesForIA2[idx]);
|
||||
for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs); idx++) {
|
||||
if (sRelationTypePairs[idx].second == IA2_RELATION_NULL)
|
||||
continue;
|
||||
|
||||
Relation rel = acc->RelationByType(sRelationTypePairs[idx].first);
|
||||
if (rel.Next())
|
||||
(*aNRelations)++;
|
||||
}
|
||||
@ -85,8 +88,11 @@ ia2Accessible::get_relation(long aRelationIndex,
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
long relIdx = 0;
|
||||
for (unsigned int idx = 0; idx < ArrayLength(sRelationTypesForIA2); idx++) {
|
||||
RelationType relationType = sRelationTypesForIA2[idx];
|
||||
for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs); idx++) {
|
||||
if (sRelationTypePairs[idx].second == IA2_RELATION_NULL)
|
||||
continue;
|
||||
|
||||
RelationType relationType = sRelationTypePairs[idx].first;
|
||||
Relation rel = acc->RelationByType(relationType);
|
||||
nsRefPtr<ia2AccessibleRelation> ia2Relation =
|
||||
new ia2AccessibleRelation(relationType, &rel);
|
||||
@ -120,9 +126,12 @@ ia2Accessible::get_relations(long aMaxRelations,
|
||||
if (acc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
for (unsigned int idx = 0; idx < ArrayLength(sRelationTypesForIA2) &&
|
||||
for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs) &&
|
||||
*aNRelations < aMaxRelations; idx++) {
|
||||
RelationType relationType = sRelationTypesForIA2[idx];
|
||||
if (sRelationTypePairs[idx].second == IA2_RELATION_NULL)
|
||||
continue;
|
||||
|
||||
RelationType relationType = sRelationTypePairs[idx].first;
|
||||
Relation rel = acc->RelationByType(relationType);
|
||||
nsRefPtr<ia2AccessibleRelation> ia2Rel =
|
||||
new ia2AccessibleRelation(relationType, &rel);
|
||||
|
@ -33,7 +33,7 @@ IMPL_IUNKNOWN_QUERY_TAIL
|
||||
// IAccessibleRelation
|
||||
|
||||
STDMETHODIMP
|
||||
ia2AccessibleRelation::get_relationType(BSTR *aRelationType)
|
||||
ia2AccessibleRelation::get_relationType(BSTR* aRelationType)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
@ -42,55 +42,13 @@ ia2AccessibleRelation::get_relationType(BSTR *aRelationType)
|
||||
|
||||
*aRelationType = nullptr;
|
||||
|
||||
#define RELATIONTYPE(geckoType, geckoTypeName, atkType, msaaType, ia2Type) \
|
||||
case RelationType::geckoType: \
|
||||
*aRelationType = ::SysAllocString(ia2Type); \
|
||||
break;
|
||||
|
||||
switch (mType) {
|
||||
case RelationType::CONTROLLED_BY:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_CONTROLLED_BY);
|
||||
break;
|
||||
case RelationType::CONTROLLER_FOR:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_CONTROLLER_FOR);
|
||||
break;
|
||||
case RelationType::DESCRIBED_BY:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_DESCRIBED_BY);
|
||||
break;
|
||||
case RelationType::DESCRIPTION_FOR:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_DESCRIPTION_FOR);
|
||||
break;
|
||||
case RelationType::EMBEDDED_BY:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_EMBEDDED_BY);
|
||||
break;
|
||||
case RelationType::EMBEDS:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_EMBEDS);
|
||||
break;
|
||||
case RelationType::FLOWS_FROM:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_FLOWS_FROM);
|
||||
break;
|
||||
case RelationType::FLOWS_TO:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_FLOWS_TO);
|
||||
break;
|
||||
case RelationType::LABEL_FOR:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_LABEL_FOR);
|
||||
break;
|
||||
case RelationType::LABELLED_BY:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_LABELED_BY);
|
||||
break;
|
||||
case RelationType::MEMBER_OF:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_MEMBER_OF);
|
||||
break;
|
||||
case RelationType::NODE_CHILD_OF:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_NODE_CHILD_OF);
|
||||
break;
|
||||
case RelationType::NODE_PARENT_OF:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_NODE_PARENT_OF);
|
||||
break;
|
||||
case RelationType::PARENT_WINDOW_OF:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_PARENT_WINDOW_OF);
|
||||
break;
|
||||
case RelationType::POPUP_FOR:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_POPUP_FOR);
|
||||
break;
|
||||
case RelationType::SUBWINDOW_OF:
|
||||
*aRelationType = ::SysAllocString(IA2_RELATION_SUBWINDOW_OF);
|
||||
break;
|
||||
#include "RelationTypeMap.h"
|
||||
}
|
||||
|
||||
return *aRelationType ? S_OK : E_OUTOFMEMORY;
|
||||
@ -166,4 +124,3 @@ ia2AccessibleRelation::get_targets(long aMaxTargets, IUnknown **aTargets,
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "IUnknownImpl.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
|
||||
#include <utility>
|
||||
#include "nsTArray.h"
|
||||
|
||||
#include "AccessibleRelation.h"
|
||||
@ -60,27 +61,20 @@ private:
|
||||
|
||||
|
||||
/**
|
||||
* Relations exposed to IAccessible2.
|
||||
* Gecko to IAccessible2 relation types map.
|
||||
*/
|
||||
static const RelationType sRelationTypesForIA2[] = {
|
||||
RelationType::LABELLED_BY,
|
||||
RelationType::LABEL_FOR,
|
||||
RelationType::DESCRIBED_BY,
|
||||
RelationType::DESCRIPTION_FOR,
|
||||
RelationType::NODE_CHILD_OF,
|
||||
RelationType::NODE_PARENT_OF,
|
||||
RelationType::CONTROLLED_BY,
|
||||
RelationType::CONTROLLER_FOR,
|
||||
RelationType::FLOWS_TO,
|
||||
RelationType::FLOWS_FROM,
|
||||
RelationType::MEMBER_OF,
|
||||
RelationType::SUBWINDOW_OF,
|
||||
RelationType::EMBEDS,
|
||||
RelationType::EMBEDDED_BY,
|
||||
RelationType::POPUP_FOR,
|
||||
RelationType::PARENT_WINDOW_OF
|
||||
|
||||
const WCHAR *const IA2_RELATION_NULL = L"";
|
||||
|
||||
#define RELATIONTYPE(geckoType, name, atkType, msaaType, ia2Type) \
|
||||
std::pair<RelationType, const WCHAR *const>(RelationType::geckoType, ia2Type),
|
||||
|
||||
static const std::pair<RelationType, const WCHAR *const> sRelationTypePairs[] = {
|
||||
#include "RelationTypeMap.h"
|
||||
};
|
||||
|
||||
#undef RELATIONTYPE
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -898,6 +898,11 @@ AccessibleWrap::accNavigate(
|
||||
Accessible* navAccessible = nullptr;
|
||||
Maybe<RelationType> xpRelation;
|
||||
|
||||
#define RELATIONTYPE(geckoType, stringType, atkType, msaaType, ia2Type) \
|
||||
case msaaType: \
|
||||
xpRelation.construct(RelationType::geckoType); \
|
||||
break;
|
||||
|
||||
switch(navDir) {
|
||||
case NAVDIR_FIRSTCHILD:
|
||||
if (!nsAccUtils::MustPrune(accessible))
|
||||
@ -920,62 +925,14 @@ AccessibleWrap::accNavigate(
|
||||
return E_NOTIMPL;
|
||||
|
||||
// MSAA relationship extensions to accNavigate
|
||||
case NAVRELATION_CONTROLLED_BY:
|
||||
xpRelation.construct(RelationType::CONTROLLED_BY);
|
||||
break;
|
||||
case NAVRELATION_CONTROLLER_FOR:
|
||||
xpRelation.construct(RelationType::CONTROLLER_FOR);
|
||||
break;
|
||||
case NAVRELATION_LABEL_FOR:
|
||||
xpRelation.construct(RelationType::LABEL_FOR);
|
||||
break;
|
||||
case NAVRELATION_LABELLED_BY:
|
||||
xpRelation.construct(RelationType::LABELLED_BY);
|
||||
break;
|
||||
case NAVRELATION_MEMBER_OF:
|
||||
xpRelation.construct(RelationType::MEMBER_OF);
|
||||
break;
|
||||
case NAVRELATION_NODE_CHILD_OF:
|
||||
xpRelation.construct(RelationType::NODE_CHILD_OF);
|
||||
break;
|
||||
case NAVRELATION_FLOWS_TO:
|
||||
xpRelation.construct(RelationType::FLOWS_TO);
|
||||
break;
|
||||
case NAVRELATION_FLOWS_FROM:
|
||||
xpRelation.construct(RelationType::FLOWS_FROM);
|
||||
break;
|
||||
case NAVRELATION_SUBWINDOW_OF:
|
||||
xpRelation.construct(RelationType::SUBWINDOW_OF);
|
||||
break;
|
||||
case NAVRELATION_EMBEDS:
|
||||
xpRelation.construct(RelationType::EMBEDS);
|
||||
break;
|
||||
case NAVRELATION_EMBEDDED_BY:
|
||||
xpRelation.construct(RelationType::EMBEDDED_BY);
|
||||
break;
|
||||
case NAVRELATION_POPUP_FOR:
|
||||
xpRelation.construct(RelationType::POPUP_FOR);
|
||||
break;
|
||||
case NAVRELATION_PARENT_WINDOW_OF:
|
||||
xpRelation.construct(RelationType::PARENT_WINDOW_OF);
|
||||
break;
|
||||
case NAVRELATION_DEFAULT_BUTTON:
|
||||
xpRelation.construct(RelationType::DEFAULT_BUTTON);
|
||||
break;
|
||||
case NAVRELATION_DESCRIBED_BY:
|
||||
xpRelation.construct(RelationType::DESCRIBED_BY);
|
||||
break;
|
||||
case NAVRELATION_DESCRIPTION_FOR:
|
||||
xpRelation.construct(RelationType::DESCRIPTION_FOR);
|
||||
break;
|
||||
case NAVRELATION_NODE_PARENT_OF:
|
||||
xpRelation.construct(RelationType::NODE_PARENT_OF);
|
||||
break;
|
||||
#include "RelationTypeMap.h"
|
||||
|
||||
default:
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
#undef RELATIONTYPE
|
||||
|
||||
pvarEndUpAt->vt = VT_EMPTY;
|
||||
|
||||
if (!xpRelation.empty()) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"revision": "ef355aa8244d698a5b226ac4ef2408a2eb0812bb",
|
||||
"revision": "a57a913f1dd723afa191124f27b8d9fc4b0cb1c0",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -594,7 +594,7 @@ pref("browser.gesture.twist.left", "cmd_gestureRotateLeft");
|
||||
pref("browser.gesture.twist.end", "cmd_gestureRotateEnd");
|
||||
pref("browser.gesture.tap", "cmd_fullZoomReset");
|
||||
|
||||
pref("browser.snapshots.limit", 0);
|
||||
pref("browser.snapshots.limit", 5);
|
||||
|
||||
// 0: Nothing happens
|
||||
// 1: Scrolling contents
|
||||
|
11
configure.in
11
configure.in
@ -222,6 +222,7 @@ if test -n "$gonkdir" ; then
|
||||
15)
|
||||
GONK_INCLUDES="-I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/frameworks/base/include -I$gonkdir/frameworks/base/services/camera -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib -I$gonkdir/dalvik/libnativehelper/include/nativehelper"
|
||||
MOZ_B2G_BT=1
|
||||
MOZ_B2G_BT_BLUEZ=1
|
||||
MOZ_B2G_CAMERA=1
|
||||
MOZ_OMX_DECODER=1
|
||||
AC_SUBST(MOZ_OMX_DECODER)
|
||||
@ -230,9 +231,15 @@ if test -n "$gonkdir" ; then
|
||||
17|18)
|
||||
GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include"
|
||||
if test -d "$gonkdir/external/bluetooth/bluez"; then
|
||||
GONK_INCLUDES+=" -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
|
||||
GONK_INCLUDES="$GONK_INCLUDES -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
|
||||
MOZ_B2G_BT=1
|
||||
MOZ_B2G_BT_BLUEZ=1
|
||||
fi
|
||||
if test -d "$gonkdir/external/bluetooth/bluedroid"; then
|
||||
MOZ_B2G_BT=1
|
||||
MOZ_B2G_BT_BLUEDROID=1
|
||||
fi
|
||||
|
||||
MOZ_B2G_CAMERA=1
|
||||
MOZ_OMX_DECODER=1
|
||||
AC_SUBST(MOZ_OMX_DECODER)
|
||||
@ -7301,6 +7308,8 @@ if test -n "$MOZ_B2G_BT"; then
|
||||
AC_DEFINE(MOZ_B2G_BT)
|
||||
fi
|
||||
AC_SUBST(MOZ_B2G_BT)
|
||||
AC_SUBST(MOZ_B2G_BT_BLUEZ)
|
||||
AC_SUBST(MOZ_B2G_BT_BLUEDROID)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable Pico Speech Synthesis (Gonk usually)
|
||||
|
@ -3119,6 +3119,7 @@ Element::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
|
||||
|
||||
nsAutoString contentType;
|
||||
doc->GetContentType(contentType);
|
||||
bool tryToCacheEncoder = !aIncludeSelf;
|
||||
|
||||
nsCOMPtr<nsIDocumentEncoder> docEncoder = doc->GetCachedEncoder();
|
||||
if (!docEncoder) {
|
||||
@ -3133,6 +3134,9 @@ Element::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
|
||||
// again as XML
|
||||
contentType.AssignLiteral("application/xml");
|
||||
docEncoder = do_CreateInstance(NS_DOC_ENCODER_CONTRACTID_BASE "application/xml");
|
||||
// Don't try to cache the encoder since it would point to a different
|
||||
// contentType once it has been reinitialized.
|
||||
tryToCacheEncoder = false;
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE_VOID(docEncoder);
|
||||
@ -3163,7 +3167,7 @@ Element::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
|
||||
}
|
||||
rv = docEncoder->EncodeToString(aMarkup);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
if (!aIncludeSelf) {
|
||||
if (tryToCacheEncoder) {
|
||||
doc->SetCachedEncoder(docEncoder.forget());
|
||||
}
|
||||
}
|
||||
|
@ -78,6 +78,7 @@
|
||||
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsContentCID.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "nsIMEStateManager.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsIMEStateManager.h"
|
||||
#include "nsContentEventHandler.h"
|
||||
#include "nsIContent.h"
|
||||
@ -1955,7 +1956,7 @@ nsEventStateManager::FireContextClick()
|
||||
}
|
||||
|
||||
nsIDocument* doc = mGestureDownContent->GetCurrentDoc();
|
||||
nsAutoHandlingUserInputStatePusher userInpStatePusher(true, &event, doc);
|
||||
AutoHandlingUserInputStatePusher userInpStatePusher(true, &event, doc);
|
||||
|
||||
// dispatch to DOM
|
||||
nsEventDispatcher::Dispatch(mGestureDownContent, mPresContext, &event,
|
||||
@ -5848,4 +5849,51 @@ nsEventStateManager::Prefs::GetAccessModifierMask(int32_t aItemType)
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
/* mozilla::AutoHandlingUserInputStatePusher */
|
||||
/******************************************************************/
|
||||
|
||||
AutoHandlingUserInputStatePusher::AutoHandlingUserInputStatePusher(
|
||||
bool aIsHandlingUserInput,
|
||||
WidgetEvent* aEvent,
|
||||
nsIDocument* aDocument) :
|
||||
mIsHandlingUserInput(aIsHandlingUserInput),
|
||||
mIsMouseDown(aEvent && aEvent->message == NS_MOUSE_BUTTON_DOWN),
|
||||
mResetFMMouseDownState(false)
|
||||
{
|
||||
if (!aIsHandlingUserInput) {
|
||||
return;
|
||||
}
|
||||
nsEventStateManager::StartHandlingUserInput();
|
||||
if (!mIsMouseDown) {
|
||||
return;
|
||||
}
|
||||
nsIPresShell::SetCapturingContent(nullptr, 0);
|
||||
nsIPresShell::AllowMouseCapture(true);
|
||||
if (!aDocument || !aEvent->mFlags.mIsTrusted) {
|
||||
return;
|
||||
}
|
||||
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
NS_ENSURE_TRUE_VOID(fm);
|
||||
fm->SetMouseButtonDownHandlingDocument(aDocument);
|
||||
mResetFMMouseDownState = true;
|
||||
}
|
||||
|
||||
AutoHandlingUserInputStatePusher::~AutoHandlingUserInputStatePusher()
|
||||
{
|
||||
if (!mIsHandlingUserInput) {
|
||||
return;
|
||||
}
|
||||
nsEventStateManager::StopHandlingUserInput();
|
||||
if (!mIsMouseDown) {
|
||||
return;
|
||||
}
|
||||
nsIPresShell::AllowMouseCapture(false);
|
||||
if (!mResetFMMouseDownState) {
|
||||
return;
|
||||
}
|
||||
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
NS_ENSURE_TRUE_VOID(fm);
|
||||
fm->SetMouseButtonDownHandlingDocument(nullptr);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
#ifndef nsEventStateManager_h__
|
||||
#define nsEventStateManager_h__
|
||||
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
@ -15,11 +14,11 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "Units.h"
|
||||
|
||||
class nsFrameLoader;
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIDocShell;
|
||||
@ -847,51 +846,19 @@ public:
|
||||
static void sClickHoldCallback ( nsITimer* aTimer, void* aESM ) ;
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* This class is used while processing real user input. During this time, popups
|
||||
* are allowed. For mousedown events, mouse capturing is also permitted.
|
||||
*/
|
||||
class nsAutoHandlingUserInputStatePusher
|
||||
class AutoHandlingUserInputStatePusher
|
||||
{
|
||||
public:
|
||||
nsAutoHandlingUserInputStatePusher(bool aIsHandlingUserInput,
|
||||
mozilla::WidgetEvent* aEvent,
|
||||
nsIDocument* aDocument)
|
||||
: mIsHandlingUserInput(aIsHandlingUserInput),
|
||||
mIsMouseDown(aEvent && aEvent->message == NS_MOUSE_BUTTON_DOWN),
|
||||
mResetFMMouseDownState(false)
|
||||
{
|
||||
if (aIsHandlingUserInput) {
|
||||
nsEventStateManager::StartHandlingUserInput();
|
||||
if (mIsMouseDown) {
|
||||
nsIPresShell::SetCapturingContent(nullptr, 0);
|
||||
nsIPresShell::AllowMouseCapture(true);
|
||||
if (aDocument && aEvent->mFlags.mIsTrusted) {
|
||||
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (fm) {
|
||||
fm->SetMouseButtonDownHandlingDocument(aDocument);
|
||||
mResetFMMouseDownState = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~nsAutoHandlingUserInputStatePusher()
|
||||
{
|
||||
if (mIsHandlingUserInput) {
|
||||
nsEventStateManager::StopHandlingUserInput();
|
||||
if (mIsMouseDown) {
|
||||
nsIPresShell::AllowMouseCapture(false);
|
||||
if (mResetFMMouseDownState) {
|
||||
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (fm) {
|
||||
fm->SetMouseButtonDownHandlingDocument(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
AutoHandlingUserInputStatePusher(bool aIsHandlingUserInput,
|
||||
WidgetEvent* aEvent,
|
||||
nsIDocument* aDocument);
|
||||
~AutoHandlingUserInputStatePusher();
|
||||
|
||||
protected:
|
||||
bool mIsHandlingUserInput;
|
||||
@ -904,6 +871,8 @@ private:
|
||||
static void operator delete(void* /*memory*/) {}
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
// Click and double-click events need to be handled even for content that
|
||||
// has no frame. This is required for Web compatibility.
|
||||
#define NS_EVENT_NEEDS_FRAME(event) \
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "mozilla/TextRange.h"
|
||||
|
||||
class nsPrivateTextRange MOZ_FINAL : public nsIPrivateTextRange
|
||||
{
|
||||
|
@ -17,23 +17,18 @@
|
||||
#include "AudioSampleFormat.h"
|
||||
#include "AudioChannelCommon.h"
|
||||
#include <algorithm>
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "mozilla/dom/TimeRanges.h"
|
||||
#include "AudioStream.h"
|
||||
|
||||
static bool
|
||||
IsAudioAPIEnabled()
|
||||
{
|
||||
return mozilla::Preferences::GetBool("media.audio_data.enabled", true);
|
||||
}
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Audio)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
extern bool IsAudioAPIEnabled();
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED4(HTMLAudioElement, HTMLMediaElement,
|
||||
nsIDOMHTMLMediaElement, nsIDOMHTMLAudioElement,
|
||||
nsITimerCallback, nsIAudioChannelAgentCallback)
|
||||
|
@ -807,9 +807,9 @@ HTMLFormElement::SubmitSubmission(nsFormSubmission* aFormSubmission)
|
||||
{
|
||||
nsAutoPopupStatePusher popupStatePusher(mSubmitPopupState);
|
||||
|
||||
nsAutoHandlingUserInputStatePusher userInpStatePusher(
|
||||
mSubmitInitiatedFromUserInput,
|
||||
nullptr, doc);
|
||||
AutoHandlingUserInputStatePusher userInpStatePusher(
|
||||
mSubmitInitiatedFromUserInput,
|
||||
nullptr, doc);
|
||||
|
||||
nsCOMPtr<nsIInputStream> postDataStream;
|
||||
rv = aFormSubmission->GetEncodedSubmission(actionURI,
|
||||
|
@ -992,6 +992,12 @@ static bool UseAudioChannelService()
|
||||
return Preferences::GetBool("media.useAudioChannelService");
|
||||
}
|
||||
|
||||
// Not static because it's used in HTMLAudioElement.
|
||||
bool IsAudioAPIEnabled()
|
||||
{
|
||||
return mozilla::Preferences::GetBool("media.audio_data.enabled", false);
|
||||
}
|
||||
|
||||
void HTMLMediaElement::UpdatePreloadAction()
|
||||
{
|
||||
PreloadAction nextAction = PRELOAD_UNDEFINED;
|
||||
@ -1537,6 +1543,11 @@ NS_IMETHODIMP HTMLMediaElement::SetVolume(double aVolume)
|
||||
uint32_t
|
||||
HTMLMediaElement::GetMozChannels(ErrorResult& aRv) const
|
||||
{
|
||||
if (!IsAudioAPIEnabled()) {
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!mDecoder && !mAudioStream) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return 0;
|
||||
@ -1556,6 +1567,11 @@ HTMLMediaElement::GetMozChannels(uint32_t* aMozChannels)
|
||||
uint32_t
|
||||
HTMLMediaElement::GetMozSampleRate(ErrorResult& aRv) const
|
||||
{
|
||||
if (!IsAudioAPIEnabled()) {
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!mDecoder && !mAudioStream) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return 0;
|
||||
@ -1647,6 +1663,11 @@ HTMLMediaElement::MozGetMetadata(JSContext* cx, JS::Value* aValue)
|
||||
uint32_t
|
||||
HTMLMediaElement::GetMozFrameBufferLength(ErrorResult& aRv) const
|
||||
{
|
||||
if (!IsAudioAPIEnabled()) {
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// The framebuffer (via MozAudioAvailable events) is only available
|
||||
// when reading vs. writing audio directly.
|
||||
if (!mDecoder) {
|
||||
@ -1668,6 +1689,11 @@ HTMLMediaElement::GetMozFrameBufferLength(uint32_t* aMozFrameBufferLength)
|
||||
void
|
||||
HTMLMediaElement::SetMozFrameBufferLength(uint32_t aMozFrameBufferLength, ErrorResult& aRv)
|
||||
{
|
||||
if (!IsAudioAPIEnabled()) {
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mDecoder) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
@ -3190,6 +3216,10 @@ nsresult HTMLMediaElement::DispatchAudioAvailableEvent(float* aFrameBuffer,
|
||||
// which frees the memory when it's destroyed.
|
||||
nsAutoArrayPtr<float> frameBuffer(aFrameBuffer);
|
||||
|
||||
if (!IsAudioAPIEnabled()) {
|
||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(OwnerDoc());
|
||||
nsRefPtr<HTMLMediaElement> kungFuDeathGrip = this;
|
||||
NS_ENSURE_TRUE(domDoc, NS_ERROR_INVALID_ARG);
|
||||
|
@ -62,7 +62,7 @@ static uint16_t LEUint16(const unsigned char* p)
|
||||
}
|
||||
|
||||
// Reads a little-endian encoded signed 16bit integer at p.
|
||||
static int16_t LEInt16(const unsigned char* p)
|
||||
inline int16_t LEInt16(const unsigned char* p)
|
||||
{
|
||||
return static_cast<int16_t>(LEUint16(p));
|
||||
}
|
||||
|
@ -59,7 +59,9 @@ static const uint32_t SEEK_FUZZ_USECS = 500000;
|
||||
|
||||
// The number of microseconds of "pre-roll" we use for Opus streams.
|
||||
// The specification recommends 80 ms.
|
||||
#ifdef MOZ_OPUS
|
||||
static const int64_t SEEK_OPUS_PREROLL = 80 * USECS_PER_MS;
|
||||
#endif /* MOZ_OPUS */
|
||||
|
||||
enum PageSyncResult {
|
||||
PAGE_SYNC_ERROR = 1,
|
||||
@ -86,8 +88,10 @@ OggReader::OggReader(AbstractMediaDecoder* aDecoder)
|
||||
mMonitor("OggReader"),
|
||||
mTheoraState(nullptr),
|
||||
mVorbisState(nullptr),
|
||||
#ifdef MOZ_OPUS
|
||||
mOpusState(nullptr),
|
||||
mOpusEnabled(MediaDecoder::IsOpusEnabled()),
|
||||
#endif /* MOZ_OPUS */
|
||||
mSkeletonState(nullptr),
|
||||
mVorbisSerial(0),
|
||||
mOpusSerial(0),
|
||||
@ -131,9 +135,11 @@ nsresult OggReader::ResetDecode(bool start)
|
||||
if (mVorbisState && NS_FAILED(mVorbisState->Reset())) {
|
||||
res = NS_ERROR_FAILURE;
|
||||
}
|
||||
#ifdef MOZ_OPUS
|
||||
if (mOpusState && NS_FAILED(mOpusState->Reset(start))) {
|
||||
res = NS_ERROR_FAILURE;
|
||||
}
|
||||
#endif /* MOZ_OPUS */
|
||||
if (mTheoraState && NS_FAILED(mTheoraState->Reset())) {
|
||||
res = NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -162,8 +168,10 @@ void OggReader::BuildSerialList(nsTArray<uint32_t>& aTracks)
|
||||
if (HasAudio()) {
|
||||
if (mVorbisState) {
|
||||
aTracks.AppendElement(mVorbisState->mSerial);
|
||||
} else if(mOpusState) {
|
||||
#ifdef MOZ_OPUS
|
||||
} else if (mOpusState) {
|
||||
aTracks.AppendElement(mOpusState->mSerial);
|
||||
#endif /* MOZ_OPUS */
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -220,6 +228,7 @@ nsresult OggReader::ReadMetadata(MediaInfo* aInfo,
|
||||
// bitstreams will be ignored.
|
||||
mTheoraState = static_cast<TheoraState*>(codecState);
|
||||
}
|
||||
#ifdef MOZ_OPUS
|
||||
if (codecState &&
|
||||
codecState->GetType() == OggCodecState::TYPE_OPUS &&
|
||||
!mOpusState)
|
||||
@ -231,6 +240,7 @@ nsresult OggReader::ReadMetadata(MediaInfo* aInfo,
|
||||
" See media.opus.enabled in about:config");
|
||||
}
|
||||
}
|
||||
#endif /* MOZ_OPUS */
|
||||
if (codecState &&
|
||||
codecState->GetType() == OggCodecState::TYPE_SKELETON &&
|
||||
!mSkeletonState)
|
||||
@ -254,7 +264,10 @@ nsresult OggReader::ReadMetadata(MediaInfo* aInfo,
|
||||
// Deactivate any non-primary bitstreams.
|
||||
for (uint32_t i = 0; i < bitstreams.Length(); i++) {
|
||||
OggCodecState* s = bitstreams[i];
|
||||
if (s != mVorbisState && s != mOpusState &&
|
||||
if (s != mVorbisState &&
|
||||
#ifdef MOZ_OPUS
|
||||
s != mOpusState &&
|
||||
#endif /* MOZ_OPUS */
|
||||
s != mTheoraState && s != mSkeletonState) {
|
||||
s->Deactivate();
|
||||
}
|
||||
@ -605,16 +618,22 @@ void OggReader::DownmixToStereo(nsAutoArrayPtr<AudioDataValue>& buffer,
|
||||
bool OggReader::DecodeAudioData()
|
||||
{
|
||||
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
|
||||
NS_ASSERTION(mVorbisState != nullptr || mOpusState != nullptr,
|
||||
"Need audio codec state to decode audio");
|
||||
DebugOnly<bool> haveCodecState = mVorbisState != nullptr
|
||||
#ifdef MOZ_OPUS
|
||||
|| mOpusState != nullptr
|
||||
#endif /* MOZ_OPUS */
|
||||
;
|
||||
NS_ASSERTION(haveCodecState, "Need audio codec state to decode audio");
|
||||
|
||||
// Read the next data packet. Skip any non-data packets we encounter.
|
||||
ogg_packet* packet = 0;
|
||||
OggCodecState* codecState;
|
||||
if (mVorbisState)
|
||||
codecState = static_cast<OggCodecState*>(mVorbisState);
|
||||
#ifdef MOZ_OPUS
|
||||
else
|
||||
codecState = static_cast<OggCodecState*>(mOpusState);
|
||||
#endif /* MOZ_OPUS */
|
||||
do {
|
||||
if (packet) {
|
||||
OggCodecState::ReleasePacket(packet);
|
||||
@ -661,7 +680,9 @@ void OggReader::SetChained(bool aIsChained) {
|
||||
bool OggReader::ReadOggChain()
|
||||
{
|
||||
bool chained = false;
|
||||
#ifdef MOZ_OPUS
|
||||
OpusState* newOpusState = nullptr;
|
||||
#endif /* MOZ_OPUS */
|
||||
VorbisState* newVorbisState = nullptr;
|
||||
int channels = 0;
|
||||
long rate = 0;
|
||||
@ -1340,10 +1361,12 @@ nsresult OggReader::SeekInUnbuffered(int64_t aTarget,
|
||||
if (HasVideo() && mTheoraState) {
|
||||
keyframeOffsetMs = mTheoraState->MaxKeyframeOffset();
|
||||
}
|
||||
#ifdef MOZ_OPUS
|
||||
// Add in the Opus pre-roll if necessary, as well.
|
||||
if (HasAudio() && mOpusState) {
|
||||
keyframeOffsetMs = std::max(keyframeOffsetMs, SEEK_OPUS_PREROLL);
|
||||
}
|
||||
#endif /* MOZ_OPUS */
|
||||
int64_t seekTarget = std::max(aStartTime, aTarget - keyframeOffsetMs);
|
||||
// Minimize the bisection search space using the known timestamps from the
|
||||
// buffered ranges.
|
||||
@ -1364,9 +1387,11 @@ nsresult OggReader::Seek(int64_t aTarget,
|
||||
MediaResource* resource = mDecoder->GetResource();
|
||||
NS_ENSURE_TRUE(resource != nullptr, NS_ERROR_FAILURE);
|
||||
int64_t adjustedTarget = aTarget;
|
||||
#ifdef MOZ_OPUS
|
||||
if (HasAudio() && mOpusState){
|
||||
adjustedTarget = std::max(aStartTime, aTarget - SEEK_OPUS_PREROLL);
|
||||
}
|
||||
#endif /* MOZ_OPUS */
|
||||
|
||||
if (adjustedTarget == aStartTime) {
|
||||
// We've seeked to the media start. Just seek to the offset of the first
|
||||
@ -1822,10 +1847,12 @@ nsresult OggReader::GetBuffered(TimeRanges* aBuffered, int64_t aStartTime)
|
||||
startTime = VorbisState::Time(&mVorbisInfo, granulepos);
|
||||
NS_ASSERTION(startTime > 0, "Must have positive start time");
|
||||
}
|
||||
#ifdef MOZ_OPUS
|
||||
else if (mOpusState && serial == mOpusSerial) {
|
||||
startTime = OpusState::Time(mOpusPreSkip, granulepos);
|
||||
NS_ASSERTION(startTime > 0, "Must have positive start time");
|
||||
}
|
||||
#endif /* MOZ_OPUS */
|
||||
else if (mTheoraState && serial == mTheoraSerial) {
|
||||
startTime = TheoraState::Time(&mTheoraInfo, granulepos);
|
||||
NS_ASSERTION(startTime > 0, "Must have positive start time");
|
||||
|
@ -62,8 +62,11 @@ public:
|
||||
int64_t aTimeThreshold);
|
||||
|
||||
virtual bool HasAudio() {
|
||||
return (mVorbisState != 0 && mVorbisState->mActive) ||
|
||||
(mOpusState != 0 && mOpusState->mActive);
|
||||
return (mVorbisState != 0 && mVorbisState->mActive)
|
||||
#ifdef MOZ_OPUS
|
||||
|| (mOpusState != 0 && mOpusState->mActive)
|
||||
#endif /* MOZ_OPUS */
|
||||
;
|
||||
}
|
||||
|
||||
virtual bool HasVideo() {
|
||||
@ -268,6 +271,7 @@ private:
|
||||
// Decode state of the Vorbis bitstream we're decoding, if we have audio.
|
||||
VorbisState* mVorbisState;
|
||||
|
||||
#ifdef MOZ_OPUS
|
||||
// Decode state of the Opus bitstream we're decoding, if we have one.
|
||||
OpusState *mOpusState;
|
||||
|
||||
@ -275,6 +279,7 @@ private:
|
||||
// contructor was called. We can't check it dynamically because
|
||||
// we're not on the main thread;
|
||||
bool mOpusEnabled;
|
||||
#endif /* MOZ_OPUS */
|
||||
|
||||
// Decode state of the Skeleton bitstream.
|
||||
SkeletonState* mSkeletonState;
|
||||
|
@ -15,9 +15,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=490705
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=490705">Mozilla Bug 490705</a>
|
||||
|
||||
<!-- mute audio, since there is no need to hear the sound for these tests -->
|
||||
<audio id='a1' controls></audio>
|
||||
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
@ -243,17 +240,19 @@ function audioEnded() {
|
||||
}
|
||||
|
||||
function initTest() {
|
||||
var a1 = document.getElementById('a1');
|
||||
var a1 = document.createElement("audio");
|
||||
a1.id = "a1";
|
||||
a1.addEventListener("ended", audioEnded, false);
|
||||
a1.addEventListener("loadedmetadata", loadedMetadata, false);
|
||||
a1.addEventListener("MozAudioAvailable", audioAvailable, false);
|
||||
a1.src = testFile;
|
||||
a1.muted = true;
|
||||
a1.play();
|
||||
document.body.appendChild(a1);
|
||||
}
|
||||
|
||||
window.addEventListener("load", function(e) {
|
||||
initTest();
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.audio_data.enabled", true]]}, initTest);
|
||||
}, false);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -24,9 +24,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=490705
|
||||
SimpleTest.finish();
|
||||
}
|
||||
function startTest() {
|
||||
var audio = adopt();
|
||||
audio.addEventListener("ended", endTest, false);
|
||||
audio.play();
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.audio_data.enabled", true]]}, function () {
|
||||
var audio = adopt();
|
||||
audio.addEventListener("ended", endTest, false);
|
||||
audio.play();
|
||||
});
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -68,7 +68,7 @@ function runTests() {
|
||||
}
|
||||
|
||||
window.addEventListener("load", function(e) {
|
||||
runTests();
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.audio_data.enabled", true]]}, runTests);
|
||||
}, false);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -12,31 +12,35 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=686137
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=686137">Mozilla Bug 686137</a>
|
||||
|
||||
<audio id="a1" controls muted preload="metadata"></audio>
|
||||
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
var testFile = "bug495794.ogg";
|
||||
var a1 = document.getElementById('a1');
|
||||
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.audio_data.enabled", true]]}, function () {
|
||||
var a1 = document.createElement("audio");
|
||||
a1.controls = true;
|
||||
a1.muted = true;
|
||||
a1.preload = "metadata";
|
||||
a1.addEventListener("loadedmetadata", metaDataLoaded, false);
|
||||
a1.src = "bug495794.ogg";
|
||||
a1.load();
|
||||
});
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function audioAvailable(event) {
|
||||
var a1 = event.target;
|
||||
a1.removeEventListener("MozAudioAvailable", audioAvailable);
|
||||
is( event.frameBuffer.length, 9001, "event.frameBuffer.length should be 9001.");
|
||||
is( event.frameBuffer.length, a1.mozFrameBufferLength, "event.frameBuffer.length should be " + a1.mozFrameBufferLength + ".");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function metaDataLoaded(){
|
||||
function metaDataLoaded(event){
|
||||
var a1 = event.target;
|
||||
a1.addEventListener("MozAudioAvailable", audioAvailable, false);
|
||||
a1.mozFrameBufferLength = 9001;
|
||||
a1.play();
|
||||
}
|
||||
|
||||
a1.addEventListener("loadedmetadata", metaDataLoaded, false);
|
||||
a1.src = testFile;
|
||||
a1.load();
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -12,9 +12,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=490705
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=490705">Mozilla Bug 490705</a>
|
||||
|
||||
<!-- mute audio, since there is no need to hear the sound for these tests -->
|
||||
<audio id="a1" preload="metadata" controls></audio>
|
||||
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
var testFile = "bug495794.ogg";
|
||||
@ -84,7 +81,12 @@ function audioEnded() {
|
||||
}
|
||||
|
||||
function initTest() {
|
||||
var a1 = document.getElementById('a1');
|
||||
var a1 = document.createElement("audio");
|
||||
a1.id = "a1";
|
||||
a1.preload = "metadata";
|
||||
a1.controls = true;
|
||||
document.body.appendChild(a1);
|
||||
|
||||
a1.addEventListener("ended", audioEnded, false);
|
||||
a1.addEventListener("loadedmetadata", loadedMetadata, false);
|
||||
a1.addEventListener("MozAudioAvailable", audioAvailable, false);
|
||||
@ -94,7 +96,7 @@ function initTest() {
|
||||
}
|
||||
|
||||
window.addEventListener("load", function(e) {
|
||||
initTest();
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.audio_data.enabled", true]]}, initTest);
|
||||
}, false);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -34,9 +34,12 @@ function audioavailable(e) {
|
||||
function startTest() {
|
||||
if (completed)
|
||||
return;
|
||||
var v = document.getElementById('v');
|
||||
v.addEventListener('MozAudioAvailable', audioavailable, false);
|
||||
v.play();
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.audio_data.enabled", true]]},
|
||||
function () {
|
||||
var v = document.getElementById('v');
|
||||
v.addEventListener('MozAudioAvailable', audioavailable, false);
|
||||
v.play();
|
||||
});
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -34,9 +34,12 @@ function audioavailable(e) {
|
||||
function startTest() {
|
||||
if (completed)
|
||||
return;
|
||||
var v = document.getElementById('v');
|
||||
v.addEventListener('MozAudioAvailable', audioavailable, false);
|
||||
v.play();
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.audio_data.enabled", true]]},
|
||||
function () {
|
||||
var v = document.getElementById('v');
|
||||
v.addEventListener('MozAudioAvailable', audioavailable, false);
|
||||
v.play();
|
||||
});
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -111,3 +111,4 @@ support-files =
|
||||
[test_waveShaperZeroLengthCurve.html]
|
||||
[test_audioDestinationNode.html]
|
||||
[test_mozaudiochannel.html]
|
||||
[test_waveDecoder.html]
|
||||
|
69
content/media/webaudio/test/test_waveDecoder.html
Normal file
69
content/media/webaudio/test/test_waveDecoder.html
Normal file
@ -0,0 +1,69 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<meta charset=utf-8>
|
||||
<head>
|
||||
<title>Test that we decode uint8 and sint16 wave files with correct conversion to float64</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
var testsDone = 0;
|
||||
var tests = ["UklGRjUrAABXQVZFZm10IBAAAAABAAEAESsAABErAAABAAgAZGF0YQMAAAD/AIA=",
|
||||
"UklGRkZWAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQYAAAD/fwCAAAA="];
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function base64ToUint8Buffer(b64) {
|
||||
var str = atob(b64)
|
||||
var u8 = new Uint8Array(str.length);
|
||||
for (var i = 0; i < str.length; ++i) {
|
||||
u8[i] = str.charCodeAt(i);
|
||||
}
|
||||
return u8;
|
||||
}
|
||||
|
||||
function fixupBufferSampleRate(u8, rate) {
|
||||
u8[24] = (rate & 0x000000ff) >> 0;
|
||||
u8[25] = (rate & 0x0000ff00) >> 8;
|
||||
u8[26] = (rate & 0x00ff0000) >> 16;
|
||||
u8[27] = (rate & 0xff000000) >> 24;
|
||||
}
|
||||
|
||||
function finishTest() {
|
||||
testsDone += 1;
|
||||
if (testsDone == tests.length) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
function decodeComplete(b) {
|
||||
ok(true, "Decoding succeeded.");
|
||||
is(b.numberOfChannels, 1, "Should have 1 channel.");
|
||||
is(b.length, 3, "Should have three samples.");
|
||||
var samples = b.getChannelData(0);
|
||||
ok(samples[0] > 0.99 && samples[0] < 1.01, "Check near 1.0. Got " + samples[0]);
|
||||
ok(samples[1] > -1.01 && samples[1] < -0.99, "Check near -1.0. Got " + samples[1]);
|
||||
ok(samples[2] > -0.01 && samples[2] < 0.01, "Check near 0.0. Got " + samples[2]);
|
||||
finishTest();
|
||||
}
|
||||
|
||||
function decodeFailed() {
|
||||
ok(false, "Decoding failed.");
|
||||
finishTest();
|
||||
}
|
||||
|
||||
addLoadEvent(function() {
|
||||
var context = new AudioContext();
|
||||
|
||||
for (var i = 0; i < tests.length; ++i) {
|
||||
var u8 = base64ToUint8Buffer(tests[i]);
|
||||
fixupBufferSampleRate(u8, context.sampleRate);
|
||||
context.decodeAudioData(u8.buffer, decodeComplete, decodeFailed);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -12,7 +12,7 @@
|
||||
using namespace mozilla::dom;
|
||||
|
||||
/* static */ bool
|
||||
InterAppComm::EnabledForScope(JSContext* /* unused */, JSObject* aObj)
|
||||
InterAppComm::EnabledForScope(JSContext* /* unused */, JS::Handle<JSObject*> aObj)
|
||||
{
|
||||
// Disable the constructors if they're disabled by the preference for sure.
|
||||
if (!Preferences::GetBool("dom.inter-app-communication-api.enabled", false)) {
|
||||
|
@ -17,7 +17,7 @@ namespace dom {
|
||||
class InterAppComm
|
||||
{
|
||||
public:
|
||||
static bool EnabledForScope(JSContext* /* unused */, JSObject* aObj);
|
||||
static bool EnabledForScope(JSContext* /* unused */, JS::Handle<JSObject*> aObj);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "mozilla/TextRange.h"
|
||||
|
||||
class nsIWidget;
|
||||
class nsPIDOMWindow;
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "nsWindowMemoryReporter.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMWindowCollection.h"
|
||||
#include "nsIEffectiveTLDService.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
@ -31,14 +32,70 @@ nsWindowMemoryReporter::nsWindowMemoryReporter()
|
||||
NS_IMPL_ISUPPORTS3(nsWindowMemoryReporter, nsIMemoryReporter, nsIObserver,
|
||||
nsSupportsWeakReference)
|
||||
|
||||
/* static */
|
||||
void
|
||||
static nsresult
|
||||
AddNonJSSizeOfWindowAndItsDescendents(nsGlobalWindow* aWindow,
|
||||
nsTabSizes* aSizes)
|
||||
{
|
||||
// Measure the window.
|
||||
nsWindowSizes windowSizes(moz_malloc_size_of);
|
||||
aWindow->AddSizeOfIncludingThis(&windowSizes);
|
||||
windowSizes.addToTabSizes(aSizes);
|
||||
|
||||
// Measure the inner window, if there is one.
|
||||
nsWindowSizes innerWindowSizes(moz_malloc_size_of);
|
||||
nsGlobalWindow* inner = aWindow->GetCurrentInnerWindowInternal();
|
||||
if (inner) {
|
||||
inner->AddSizeOfIncludingThis(&innerWindowSizes);
|
||||
innerWindowSizes.addToTabSizes(aSizes);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMWindowCollection> frames;
|
||||
nsresult rv = aWindow->GetFrames(getter_AddRefs(frames));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
uint32_t length;
|
||||
rv = frames->GetLength(&length);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Measure this window's descendents.
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
nsCOMPtr<nsIDOMWindow> child;
|
||||
rv = frames->Item(i, getter_AddRefs(child));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_STATE(child);
|
||||
|
||||
nsGlobalWindow* childWin =
|
||||
static_cast<nsGlobalWindow*>(static_cast<nsIDOMWindow *>(child.get()));
|
||||
|
||||
rv = AddNonJSSizeOfWindowAndItsDescendents(childWin, aSizes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
NonJSSizeOfTab(nsPIDOMWindow* aWindow, size_t* aDomSize, size_t* aStyleSize, size_t* aOtherSize)
|
||||
{
|
||||
nsGlobalWindow* window = static_cast<nsGlobalWindow*>(aWindow);
|
||||
|
||||
nsTabSizes sizes;
|
||||
nsresult rv = AddNonJSSizeOfWindowAndItsDescendents(window, &sizes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*aDomSize = sizes.mDom;
|
||||
*aStyleSize = sizes.mStyle;
|
||||
*aOtherSize = sizes.mOther;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsWindowMemoryReporter::Init()
|
||||
{
|
||||
MOZ_ASSERT(!sWindowReporter);
|
||||
sWindowReporter = new nsWindowMemoryReporter();
|
||||
ClearOnShutdown(&sWindowReporter);
|
||||
NS_RegisterMemoryReporter(sWindowReporter);
|
||||
RegisterNonJSSizeOfTab(NonJSSizeOfTab);
|
||||
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (os) {
|
||||
|
@ -12,10 +12,12 @@
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/PodOperations.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsArenaMemoryStats.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
// This should be used for any nsINode sub-class that has fields of its own
|
||||
// that it needs to measure; any sub-class that doesn't use it will inherit
|
||||
@ -25,25 +27,44 @@
|
||||
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
class nsWindowSizes {
|
||||
#define FOR_EACH_SIZE(macro) \
|
||||
macro(DOM, mDOMElementNodes) \
|
||||
macro(DOM, mDOMTextNodes) \
|
||||
macro(DOM, mDOMCDATANodes) \
|
||||
macro(DOM, mDOMCommentNodes) \
|
||||
macro(DOM, mDOMEventTargets) \
|
||||
macro(DOM, mDOMOther) \
|
||||
macro(Style, mStyleSheets) \
|
||||
macro(Other, mLayoutPresShell) \
|
||||
macro(Style, mLayoutStyleSets) \
|
||||
macro(Other, mLayoutTextRuns) \
|
||||
macro(Other, mLayoutPresContext) \
|
||||
macro(Other, mPropertyTables) \
|
||||
|
||||
public:
|
||||
nsWindowSizes(mozilla::MallocSizeOf aMallocSizeOf) {
|
||||
memset(this, 0, sizeof(nsWindowSizes));
|
||||
mMallocSizeOf = aMallocSizeOf;
|
||||
nsWindowSizes(mozilla::MallocSizeOf aMallocSizeOf)
|
||||
:
|
||||
#define ZERO_SIZE(kind, mSize) mSize(0),
|
||||
FOR_EACH_SIZE(ZERO_SIZE)
|
||||
#undef ZERO_SIZE
|
||||
mArenaStats(),
|
||||
mMallocSizeOf(aMallocSizeOf)
|
||||
{}
|
||||
|
||||
void addToTabSizes(nsTabSizes *sizes) const {
|
||||
#define ADD_TO_TAB_SIZES(kind, mSize) sizes->add(nsTabSizes::kind, mSize);
|
||||
FOR_EACH_SIZE(ADD_TO_TAB_SIZES)
|
||||
#undef ADD_TO_TAB_SIZES
|
||||
mArenaStats.addToTabSizes(sizes);
|
||||
}
|
||||
mozilla::MallocSizeOf mMallocSizeOf;
|
||||
|
||||
#define DECL_SIZE(kind, mSize) size_t mSize;
|
||||
FOR_EACH_SIZE(DECL_SIZE);
|
||||
#undef DECL_SIZE
|
||||
nsArenaMemoryStats mArenaStats;
|
||||
size_t mDOMElementNodes;
|
||||
size_t mDOMTextNodes;
|
||||
size_t mDOMCDATANodes;
|
||||
size_t mDOMCommentNodes;
|
||||
size_t mDOMEventTargets;
|
||||
size_t mDOMOther;
|
||||
size_t mStyleSheets;
|
||||
size_t mLayoutPresShell;
|
||||
size_t mLayoutStyleSets;
|
||||
size_t mLayoutTextRuns;
|
||||
size_t mLayoutPresContext;
|
||||
size_t mPropertyTables;
|
||||
mozilla::MallocSizeOf mMallocSizeOf;
|
||||
|
||||
#undef FOR_EACH_SIZE
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -561,8 +561,7 @@ BluetoothHfpManager::HandleVoiceConnectionChanged()
|
||||
NS_ENSURE_TRUE_VOID(connection);
|
||||
|
||||
nsCOMPtr<nsIDOMMozMobileConnectionInfo> voiceInfo;
|
||||
// TODO: Bug 921991 - B2G BT: support multiple sim cards
|
||||
connection->GetVoiceConnectionInfo(0, getter_AddRefs(voiceInfo));
|
||||
connection->GetVoiceConnectionInfo(getter_AddRefs(voiceInfo));
|
||||
NS_ENSURE_TRUE_VOID(voiceInfo);
|
||||
|
||||
nsString type;
|
||||
@ -598,8 +597,7 @@ BluetoothHfpManager::HandleVoiceConnectionChanged()
|
||||
* - manual: set mNetworkSelectionMode to 1 (manual)
|
||||
*/
|
||||
nsString mode;
|
||||
// TODO: Bug 921991 - B2G BT: support multiple sim cards
|
||||
connection->GetNetworkSelectionMode(0, mode);
|
||||
connection->GetNetworkSelectionMode(mode);
|
||||
if (mode.EqualsLiteral("manual")) {
|
||||
mNetworkSelectionMode = 1;
|
||||
} else {
|
||||
|
@ -292,9 +292,8 @@ BluetoothRilListener::StartMobileConnectionListening()
|
||||
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(provider, false);
|
||||
|
||||
// TODO: Bug 921991 - B2G BT: support multiple sim cards
|
||||
nsresult rv = provider->
|
||||
RegisterMobileConnectionMsg(0, mMobileConnectionListener);
|
||||
RegisterMobileConnectionMsg(mMobileConnectionListener);
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
@ -305,9 +304,8 @@ BluetoothRilListener::StopMobileConnectionListening()
|
||||
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(provider, false);
|
||||
|
||||
// TODO: Bug 921991 - B2G BT: support multiple sim cards
|
||||
nsresult rv = provider->
|
||||
UnregisterMobileConnectionMsg(0, mMobileConnectionListener);
|
||||
UnregisterMobileConnectionMsg(mMobileConnectionListener);
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,11 @@
|
||||
|
||||
#if defined(MOZ_B2G_BT)
|
||||
# if defined(MOZ_BLUETOOTH_GONK)
|
||||
# include "BluetoothGonkService.h"
|
||||
#ifdef MOZ_B2G_BT_BLUEZ
|
||||
#include "BluetoothGonkService.h"
|
||||
#else
|
||||
#include "BluetoothServiceBluedroid.h"
|
||||
#endif
|
||||
# elif defined(MOZ_BLUETOOTH_DBUS)
|
||||
# include "BluetoothDBusService.h"
|
||||
# else
|
||||
@ -304,9 +308,15 @@ BluetoothService::Create()
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_BLUETOOTH_GONK)
|
||||
#ifdef MOZ_B2G_BT_BLUEDROID
|
||||
return new BluetoothServiceBluedroid();
|
||||
#else
|
||||
return new BluetoothGonkService();
|
||||
#endif
|
||||
#elif defined(MOZ_BLUETOOTH_DBUS)
|
||||
#ifdef MOZ_B2G_BT_BLUEZ
|
||||
return new BluetoothDBusService();
|
||||
#endif
|
||||
#endif
|
||||
BT_WARNING("No platform support for bluetooth!");
|
||||
return nullptr;
|
||||
|
341
dom/bluetooth/BluetoothServiceBluedroid.cpp
Normal file
341
dom/bluetooth/BluetoothServiceBluedroid.cpp
Normal file
@ -0,0 +1,341 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/*
|
||||
** Copyright 2006, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
#include "BluetoothServiceBluedroid.h"
|
||||
#include "BluetoothReplyRunnable.h"
|
||||
#include "BluetoothUtils.h"
|
||||
#include "BluetoothUuid.h"
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "mozilla/ipc/UnixSocket.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::ipc;
|
||||
USING_BLUETOOTH_NAMESPACE
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::StartInternal()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::StopInternal()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::IsEnabledInternal()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::GetDefaultAdapterPathInternal(
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::GetConnectedDevicePropertiesInternal(
|
||||
uint16_t aProfileId, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::GetPairedDevicePropertiesInternal(
|
||||
const nsTArray<nsString>& aDeviceAddress, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::StartDiscoveryInternal(
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::StopDiscoveryInternal(
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::GetDevicePropertiesInternal(
|
||||
const BluetoothSignal& aSignal)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::SetProperty(BluetoothObjectType aType,
|
||||
const BluetoothNamedValue& aValue,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::GetDevicePath(const nsAString& aAdapterPath,
|
||||
const nsAString& aDeviceAddress,
|
||||
nsAString& aDevicePath)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::AddServiceRecords(const char* serviceName,
|
||||
unsigned long long uuidMsb,
|
||||
unsigned long long uuidLsb,
|
||||
int channel)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::RemoveServiceRecords(const char* serviceName,
|
||||
unsigned long long uuidMsb,
|
||||
unsigned long long uuidLsb,
|
||||
int channel)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::AddReservedServicesInternal(
|
||||
const nsTArray<uint32_t>& aServices,
|
||||
nsTArray<uint32_t>& aServiceHandlesContainer)
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::RemoveReservedServicesInternal(
|
||||
const nsTArray<uint32_t>& aServiceHandles)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::GetScoSocket(
|
||||
const nsAString& aObjectPath, bool aAuth, bool aEncrypt,
|
||||
mozilla::ipc::UnixSocketConsumer* aConsumer)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::GetServiceChannel(
|
||||
const nsAString& aDeviceAddress,
|
||||
const nsAString& aServiceUuid,
|
||||
BluetoothProfileManagerBase* aManager)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::UpdateSdpRecords(
|
||||
const nsAString& aDeviceAddress,
|
||||
BluetoothProfileManagerBase* aManager)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::CreatePairedDeviceInternal(
|
||||
const nsAString& aDeviceAddress, int aTimeout,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::RemoveDeviceInternal(
|
||||
const nsAString& aDeviceObjectPath,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::SetPinCodeInternal(
|
||||
const nsAString& aDeviceAddress, const nsAString& aPinCode,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::SetPasskeyInternal(
|
||||
const nsAString& aDeviceAddress, uint32_t aPasskey,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::SetPairingConfirmationInternal(
|
||||
const nsAString& aDeviceAddress, bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::SetAuthorizationInternal(
|
||||
const nsAString& aDeviceAddress, bool aAllow,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::PrepareAdapterInternal()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::Connect(const nsAString& aDeviceAddress,
|
||||
uint32_t aCod,
|
||||
uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::IsConnected(uint16_t aProfileId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::Disconnect(
|
||||
const nsAString& aDeviceAddress, uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::SendFile(const nsAString& aDeviceAddress,
|
||||
BlobParent* aBlobParent,
|
||||
BlobChild* aBlobChild,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::StopSendingFile(const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::ConfirmReceivingFile(
|
||||
const nsAString& aDeviceAddress, bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::ConnectSco(BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::DisconnectSco(BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::IsScoConnected(BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::SendMetaData(const nsAString& aTitle,
|
||||
const nsAString& aArtist,
|
||||
const nsAString& aAlbum,
|
||||
int64_t aMediaNumber,
|
||||
int64_t aTotalMediaCount,
|
||||
int64_t aDuration,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::SendPlayStatus(
|
||||
int64_t aDuration, int64_t aPosition,
|
||||
const nsAString& aPlayStatus,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::UpdatePlayStatus(
|
||||
uint32_t aDuration, uint32_t aPosition, ControlPlayStatus aPlayStatus)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::SendSinkMessage(const nsAString& aDeviceAddresses,
|
||||
const nsAString& aMessage)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::SendInputMessage(const nsAString& aDeviceAddresses,
|
||||
const nsAString& aMessage)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::AnswerWaitingCall(BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::IgnoreWaitingCall(BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::ToggleCalls(BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
|
189
dom/bluetooth/BluetoothServiceBluedroid.h
Normal file
189
dom/bluetooth/BluetoothServiceBluedroid.h
Normal file
@ -0,0 +1,189 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
/* 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_dom_bluetooth_bluetoothservicebluedroid_h__
|
||||
#define mozilla_dom_bluetooth_bluetoothservicebluedroid_h__
|
||||
|
||||
#include "BluetoothCommon.h"
|
||||
#include "BluetoothService.h"
|
||||
|
||||
class DBusMessage;
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
class BluetoothServiceBluedroid : public BluetoothService
|
||||
{
|
||||
public:
|
||||
virtual nsresult StartInternal();
|
||||
virtual nsresult StopInternal();
|
||||
virtual bool IsEnabledInternal();
|
||||
|
||||
virtual nsresult GetDefaultAdapterPathInternal(
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual nsresult GetConnectedDevicePropertiesInternal(uint16_t aProfileId,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual nsresult GetPairedDevicePropertiesInternal(
|
||||
const nsTArray<nsString>& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual nsresult StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable);
|
||||
virtual nsresult StopDiscoveryInternal(BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual nsresult
|
||||
GetDevicePropertiesInternal(const BluetoothSignal& aSignal);
|
||||
|
||||
virtual nsresult
|
||||
SetProperty(BluetoothObjectType aType,
|
||||
const BluetoothNamedValue& aValue,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual bool
|
||||
GetDevicePath(const nsAString& aAdapterPath,
|
||||
const nsAString& aDeviceAddress,
|
||||
nsAString& aDevicePath);
|
||||
|
||||
static bool
|
||||
AddServiceRecords(const char* serviceName,
|
||||
unsigned long long uuidMsb,
|
||||
unsigned long long uuidLsb,
|
||||
int channel);
|
||||
|
||||
static bool
|
||||
RemoveServiceRecords(const char* serviceName,
|
||||
unsigned long long uuidMsb,
|
||||
unsigned long long uuidLsb,
|
||||
int channel);
|
||||
|
||||
static bool
|
||||
AddReservedServicesInternal(const nsTArray<uint32_t>& aServices,
|
||||
nsTArray<uint32_t>& aServiceHandlesContainer);
|
||||
|
||||
static bool
|
||||
RemoveReservedServicesInternal(const nsTArray<uint32_t>& aServiceHandles);
|
||||
|
||||
virtual nsresult
|
||||
GetScoSocket(const nsAString& aObjectPath,
|
||||
bool aAuth,
|
||||
bool aEncrypt,
|
||||
mozilla::ipc::UnixSocketConsumer* aConsumer);
|
||||
|
||||
virtual nsresult
|
||||
GetServiceChannel(const nsAString& aDeviceAddress,
|
||||
const nsAString& aServiceUuid,
|
||||
BluetoothProfileManagerBase* aManager);
|
||||
|
||||
virtual bool
|
||||
UpdateSdpRecords(const nsAString& aDeviceAddress,
|
||||
BluetoothProfileManagerBase* aManager);
|
||||
|
||||
virtual nsresult
|
||||
CreatePairedDeviceInternal(const nsAString& aDeviceAddress,
|
||||
int aTimeout,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual nsresult
|
||||
RemoveDeviceInternal(const nsAString& aDeviceObjectPath,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual bool
|
||||
SetPinCodeInternal(const nsAString& aDeviceAddress, const nsAString& aPinCode,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual bool
|
||||
SetPasskeyInternal(const nsAString& aDeviceAddress, uint32_t aPasskey,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual bool
|
||||
SetPairingConfirmationInternal(const nsAString& aDeviceAddress, bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual bool
|
||||
SetAuthorizationInternal(const nsAString& aDeviceAddress, bool aAllow,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual nsresult
|
||||
PrepareAdapterInternal();
|
||||
|
||||
virtual void
|
||||
Connect(const nsAString& aDeviceAddress,
|
||||
uint32_t aCod,
|
||||
uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual bool
|
||||
IsConnected(uint16_t aProfileId);
|
||||
|
||||
virtual void
|
||||
Disconnect(const nsAString& aDeviceAddress, uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
SendFile(const nsAString& aDeviceAddress,
|
||||
BlobParent* aBlobParent,
|
||||
BlobChild* aBlobChild,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
StopSendingFile(const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
ConfirmReceivingFile(const nsAString& aDeviceAddress, bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
ConnectSco(BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
DisconnectSco(BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
IsScoConnected(BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
AnswerWaitingCall(BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
IgnoreWaitingCall(BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
ToggleCalls(BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
SendMetaData(const nsAString& aTitle,
|
||||
const nsAString& aArtist,
|
||||
const nsAString& aAlbum,
|
||||
int64_t aMediaNumber,
|
||||
int64_t aTotalMediaCount,
|
||||
int64_t aDuration,
|
||||
BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
||||
|
||||
virtual void
|
||||
SendPlayStatus(int64_t aDuration,
|
||||
int64_t aPosition,
|
||||
const nsAString& aPlayStatus,
|
||||
BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
||||
|
||||
virtual void
|
||||
UpdatePlayStatus(uint32_t aDuration,
|
||||
uint32_t aPosition,
|
||||
ControlPlayStatus aPlayStatus) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult
|
||||
SendSinkMessage(const nsAString& aDeviceAddresses,
|
||||
const nsAString& aMessage) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult
|
||||
SendInputMessage(const nsAString& aDeviceAddresses,
|
||||
const nsAString& aMessage) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
@ -27,11 +27,12 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
#ifdef MOZ_B2G_BT_BLUEZ
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/l2cap.h>
|
||||
#include <bluetooth/rfcomm.h>
|
||||
#include <bluetooth/sco.h>
|
||||
|
||||
#endif
|
||||
#include "BluetoothUnixSocketConnector.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
@ -43,6 +44,7 @@ static const int L2CAP_SO_SNDBUF = 400 * 1024; // 400 KB send buffer
|
||||
static const int L2CAP_SO_RCVBUF = 400 * 1024; // 400 KB receive buffer
|
||||
static const int L2CAP_MAX_MTU = 65000;
|
||||
|
||||
#ifdef MOZ_B2G_BT_BLUEZ
|
||||
static
|
||||
int get_bdaddr(const char *str, bdaddr_t *ba)
|
||||
{
|
||||
@ -62,6 +64,8 @@ void get_bdaddr_as_string(const bdaddr_t *ba, char *str) {
|
||||
b[5], b[4], b[3], b[2], b[1], b[0]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
BluetoothUnixSocketConnector::BluetoothUnixSocketConnector(
|
||||
BluetoothSocketType aType,
|
||||
int aChannel,
|
||||
@ -76,6 +80,7 @@ BluetoothUnixSocketConnector::BluetoothUnixSocketConnector(
|
||||
bool
|
||||
BluetoothUnixSocketConnector::SetUp(int aFd)
|
||||
{
|
||||
#ifdef MOZ_B2G_BT_BLUEZ
|
||||
int lm = 0;
|
||||
int sndbuf, rcvbuf;
|
||||
|
||||
@ -157,7 +162,7 @@ BluetoothUnixSocketConnector::SetUp(int aFd)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -167,6 +172,7 @@ BluetoothUnixSocketConnector::Create()
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
int fd = -1;
|
||||
|
||||
#ifdef MOZ_B2G_BT_BLUEZ
|
||||
switch (mType) {
|
||||
case BluetoothSocketType::RFCOMM:
|
||||
fd = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
|
||||
@ -193,7 +199,7 @@ BluetoothUnixSocketConnector::Create()
|
||||
BT_WARNING("Could not set up socket!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
return fd;
|
||||
}
|
||||
|
||||
@ -203,6 +209,7 @@ BluetoothUnixSocketConnector::CreateAddr(bool aIsServer,
|
||||
sockaddr_any& aAddr,
|
||||
const char* aAddress)
|
||||
{
|
||||
#ifdef MOZ_B2G_BT_BLUEZ
|
||||
// Set to BDADDR_ANY, if it's not a server, we'll reset.
|
||||
bdaddr_t bd_address_obj = {{0, 0, 0, 0, 0, 0}};
|
||||
|
||||
@ -242,6 +249,7 @@ BluetoothUnixSocketConnector::CreateAddr(bool aIsServer,
|
||||
BT_WARNING("Socket type unknown!");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -249,6 +257,7 @@ void
|
||||
BluetoothUnixSocketConnector::GetSocketAddr(const sockaddr_any& aAddr,
|
||||
nsAString& aAddrStr)
|
||||
{
|
||||
#ifdef MOZ_B2G_BT_BLUEZ
|
||||
char addr[18];
|
||||
switch (mType) {
|
||||
case BluetoothSocketType::RFCOMM:
|
||||
@ -265,4 +274,5 @@ BluetoothUnixSocketConnector::GetSocketAddr(const sockaddr_any& aAddr,
|
||||
MOZ_CRASH("Socket should be either RFCOMM or SCO!");
|
||||
}
|
||||
aAddrStr.AssignASCII(addr);
|
||||
#endif
|
||||
}
|
||||
|
@ -36,6 +36,14 @@ DEFINES += -DMOZ_BLUETOOTH_DBUS
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef MOZ_B2G_BT_BLUEZ
|
||||
DEFINES += -DMOZ_B2G_BT_BLUEZ
|
||||
endif
|
||||
|
||||
ifdef MOZ_B2G_BT_BLUEDROID
|
||||
DEFINES += -DMOZ_B2G_BT_BLUEDROID
|
||||
endif
|
||||
|
||||
# Add VPATH to LOCAL_INCLUDES so we are going to include the correct backend
|
||||
# subdirectory.
|
||||
LOCAL_INCLUDES += $(VPATH:%=-I%)
|
||||
|
@ -24,6 +24,9 @@ BEGIN_BLUETOOTH_NAMESPACE
|
||||
class BluetoothDBusService : public BluetoothService
|
||||
{
|
||||
public:
|
||||
BluetoothDBusService();
|
||||
~BluetoothDBusService();
|
||||
|
||||
bool IsReady();
|
||||
|
||||
virtual nsresult StartInternal() MOZ_OVERRIDE;
|
||||
@ -168,11 +171,6 @@ public:
|
||||
virtual nsresult
|
||||
SendInputMessage(const nsAString& aDeviceAddresses,
|
||||
const nsAString& aMessage) MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
BluetoothDBusService();
|
||||
~BluetoothDBusService();
|
||||
|
||||
private:
|
||||
/**
|
||||
* For DBus Control method of "UpdateNotification", event id should be
|
||||
|
@ -53,14 +53,19 @@ if CONFIG['MOZ_B2G_BT']:
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
||||
CPP_SOURCES += [
|
||||
'linux/BluetoothDBusService.cpp',
|
||||
'gonk/BluetoothGonkService.cpp',
|
||||
]
|
||||
if CONFIG['MOZ_B2G_BT_BLUEZ']:
|
||||
CPP_SOURCES += [
|
||||
'linux/BluetoothDBusService.cpp',
|
||||
'gonk/BluetoothGonkService.cpp',
|
||||
]
|
||||
if CONFIG['MOZ_B2G_BT_BLUEDROID']:
|
||||
CPP_SOURCES += [
|
||||
'BluetoothServiceBluedroid.cpp',
|
||||
]
|
||||
else:
|
||||
if CONFIG['MOZ_ENABLE_DBUS']:
|
||||
CPP_SOURCES += [
|
||||
'linux/BluetoothDBusService.cpp',
|
||||
'linux/BluetoothDBusService.cpp',
|
||||
]
|
||||
|
||||
EXPORTS.mozilla.dom.bluetooth.ipc += [
|
||||
|
@ -7,10 +7,10 @@
|
||||
#ifndef mozilla_tabs_TabParent_h
|
||||
#define mozilla_tabs_TabParent_h
|
||||
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/dom/PBrowserParent.h"
|
||||
#include "mozilla/dom/PContentDialogParent.h"
|
||||
#include "mozilla/dom/TabContext.h"
|
||||
#include "mozilla/TouchEvents.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAuthPromptProvider.h"
|
||||
#include "nsIBrowserDOMWindow.h"
|
||||
|
@ -33,7 +33,7 @@ interface nsIMobileConnectionListener : nsISupports
|
||||
* XPCOM component (in the content process) that provides the mobile
|
||||
* network information.
|
||||
*/
|
||||
[scriptable, uuid(84278a49-0f05-4585-b3f4-c74882ae5719)]
|
||||
[scriptable, uuid(c66652e0-0628-11e3-8ffd-0800200c9a66)]
|
||||
interface nsIMobileConnectionProvider : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -41,71 +41,47 @@ interface nsIMobileConnectionProvider : nsISupports
|
||||
* RadioInterfaceLayer in the chrome process. Only a content process that has
|
||||
* the 'mobileconnection' permission is allowed to register.
|
||||
*/
|
||||
void registerMobileConnectionMsg(in unsigned long clientId,
|
||||
in nsIMobileConnectionListener listener);
|
||||
void unregisterMobileConnectionMsg(in unsigned long clientId,
|
||||
in nsIMobileConnectionListener listener);
|
||||
void registerMobileConnectionMsg(in nsIMobileConnectionListener listener);
|
||||
void unregisterMobileConnectionMsg(in nsIMobileConnectionListener listener);
|
||||
|
||||
nsIDOMMozMobileConnectionInfo getVoiceConnectionInfo(in unsigned long clientId);
|
||||
nsIDOMMozMobileConnectionInfo getDataConnectionInfo(in unsigned long clientId);
|
||||
DOMString getIccId(in unsigned long clientId);
|
||||
DOMString getNetworkSelectionMode(in unsigned long clientId);
|
||||
readonly attribute nsIDOMMozMobileConnectionInfo voiceConnectionInfo;
|
||||
readonly attribute nsIDOMMozMobileConnectionInfo dataConnectionInfo;
|
||||
readonly attribute DOMString networkSelectionMode;
|
||||
|
||||
nsIDOMDOMRequest getNetworks(in unsigned long clientId,
|
||||
in nsIDOMWindow window);
|
||||
nsIDOMDOMRequest selectNetwork(in unsigned long clientId,
|
||||
in nsIDOMWindow window,
|
||||
in nsIDOMMozMobileNetworkInfo network);
|
||||
nsIDOMDOMRequest selectNetworkAutomatically(in unsigned long clientId,
|
||||
in nsIDOMWindow window);
|
||||
nsIDOMDOMRequest getNetworks(in nsIDOMWindow window);
|
||||
nsIDOMDOMRequest selectNetwork(in nsIDOMWindow window, in nsIDOMMozMobileNetworkInfo network);
|
||||
nsIDOMDOMRequest selectNetworkAutomatically(in nsIDOMWindow window);
|
||||
|
||||
nsIDOMDOMRequest setRoamingPreference(in unsigned long clientId,
|
||||
in nsIDOMWindow window,
|
||||
nsIDOMDOMRequest setRoamingPreference(in nsIDOMWindow window,
|
||||
in DOMString mode);
|
||||
nsIDOMDOMRequest getRoamingPreference(in unsigned long clientId,
|
||||
in nsIDOMWindow window);
|
||||
nsIDOMDOMRequest getRoamingPreference(in nsIDOMWindow window);
|
||||
|
||||
nsIDOMDOMRequest setVoicePrivacyMode(in unsigned long clientId,
|
||||
in nsIDOMWindow window,
|
||||
nsIDOMDOMRequest setVoicePrivacyMode(in nsIDOMWindow window,
|
||||
in bool enabled);
|
||||
nsIDOMDOMRequest getVoicePrivacyMode(in unsigned long clientId,
|
||||
in nsIDOMWindow window);
|
||||
nsIDOMDOMRequest getVoicePrivacyMode(in nsIDOMWindow window);
|
||||
|
||||
nsIDOMDOMRequest sendMMI(in unsigned long clientId,
|
||||
in nsIDOMWindow window,
|
||||
in DOMString mmi);
|
||||
nsIDOMDOMRequest cancelMMI(in unsigned long clientId,
|
||||
in nsIDOMWindow window);
|
||||
nsIDOMDOMRequest sendMMI(in nsIDOMWindow window, in DOMString mmi);
|
||||
nsIDOMDOMRequest cancelMMI(in nsIDOMWindow window);
|
||||
|
||||
nsIDOMDOMRequest getCallForwardingOption(in unsigned long clientId,
|
||||
in nsIDOMWindow window,
|
||||
nsIDOMDOMRequest getCallForwardingOption(in nsIDOMWindow window,
|
||||
in unsigned short reason);
|
||||
nsIDOMDOMRequest setCallForwardingOption(in unsigned long clientId,
|
||||
in nsIDOMWindow window,
|
||||
nsIDOMDOMRequest setCallForwardingOption(in nsIDOMWindow window,
|
||||
in nsIDOMMozMobileCFInfo CFInfo);
|
||||
|
||||
nsIDOMDOMRequest getCallBarringOption(in unsigned long clientId,
|
||||
in nsIDOMWindow window,
|
||||
in jsval option);
|
||||
nsIDOMDOMRequest setCallBarringOption(in unsigned long clientId,
|
||||
in nsIDOMWindow window,
|
||||
in jsval option);
|
||||
nsIDOMDOMRequest changeCallBarringPassword(in unsigned long clientId,
|
||||
in nsIDOMWindow window,
|
||||
nsIDOMDOMRequest getCallBarringOption(in nsIDOMWindow window,
|
||||
in jsval option);
|
||||
nsIDOMDOMRequest setCallBarringOption(in nsIDOMWindow window,
|
||||
in jsval option);
|
||||
nsIDOMDOMRequest changeCallBarringPassword(in nsIDOMWindow window,
|
||||
in jsval info);
|
||||
|
||||
nsIDOMDOMRequest setCallWaitingOption(in unsigned long clientId,
|
||||
in nsIDOMWindow window,
|
||||
nsIDOMDOMRequest setCallWaitingOption(in nsIDOMWindow window,
|
||||
in bool enabled);
|
||||
nsIDOMDOMRequest getCallWaitingOption(in unsigned long clientId,
|
||||
in nsIDOMWindow window);
|
||||
nsIDOMDOMRequest getCallWaitingOption(in nsIDOMWindow window);
|
||||
|
||||
nsIDOMDOMRequest setCallingLineIdRestriction(in unsigned long clientId,
|
||||
in nsIDOMWindow window,
|
||||
nsIDOMDOMRequest setCallingLineIdRestriction(in nsIDOMWindow window,
|
||||
in unsigned short clirMode);
|
||||
nsIDOMDOMRequest getCallingLineIdRestriction(in unsigned long clientId,
|
||||
in nsIDOMWindow window);
|
||||
nsIDOMDOMRequest getCallingLineIdRestriction(in nsIDOMWindow window);
|
||||
|
||||
nsIDOMDOMRequest exitEmergencyCbMode(in unsigned long clientId,
|
||||
in nsIDOMWindow window);
|
||||
nsIDOMDOMRequest exitEmergencyCbMode(in nsIDOMWindow window);
|
||||
};
|
||||
|
@ -83,9 +83,6 @@ MobileConnection::MobileConnection()
|
||||
mProvider = do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
|
||||
mWindow = nullptr;
|
||||
|
||||
// TODO: Bug 814629 - WebMobileConnection API: support multiple sim cards
|
||||
mClientId = 0;
|
||||
|
||||
// Not being able to acquire the provider isn't fatal since we check
|
||||
// for it explicitly below.
|
||||
if (!mProvider) {
|
||||
@ -104,7 +101,7 @@ MobileConnection::Init(nsPIDOMWindow* aWindow)
|
||||
|
||||
if (!CheckPermission("mobilenetwork") &&
|
||||
CheckPermission("mobileconnection")) {
|
||||
DebugOnly<nsresult> rv = mProvider->RegisterMobileConnectionMsg(mClientId, mListener);
|
||||
DebugOnly<nsresult> rv = mProvider->RegisterMobileConnectionMsg(mListener);
|
||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
|
||||
"Failed registering mobile connection messages with provider");
|
||||
|
||||
@ -117,7 +114,7 @@ MobileConnection::Shutdown()
|
||||
{
|
||||
if (mProvider && mListener) {
|
||||
mListener->Disconnect();
|
||||
mProvider->UnregisterMobileConnectionMsg(mClientId, mListener);
|
||||
mProvider->UnregisterMobileConnectionMsg(mListener);
|
||||
mProvider = nullptr;
|
||||
mListener = nullptr;
|
||||
}
|
||||
@ -176,7 +173,7 @@ MobileConnection::GetVoice(nsIDOMMozMobileConnectionInfo** voice)
|
||||
if (!mProvider || !CheckPermission("mobileconnection")) {
|
||||
return NS_OK;
|
||||
}
|
||||
return mProvider->GetVoiceConnectionInfo(mClientId, voice);
|
||||
return mProvider->GetVoiceConnectionInfo(voice);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -187,7 +184,7 @@ MobileConnection::GetData(nsIDOMMozMobileConnectionInfo** data)
|
||||
if (!mProvider || !CheckPermission("mobileconnection")) {
|
||||
return NS_OK;
|
||||
}
|
||||
return mProvider->GetDataConnectionInfo(mClientId, data);
|
||||
return mProvider->GetDataConnectionInfo(data);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -198,7 +195,7 @@ MobileConnection::GetNetworkSelectionMode(nsAString& networkSelectionMode)
|
||||
if (!mProvider || !CheckPermission("mobileconnection")) {
|
||||
return NS_OK;
|
||||
}
|
||||
return mProvider->GetNetworkSelectionMode(mClientId, networkSelectionMode);
|
||||
return mProvider->GetNetworkSelectionMode(networkSelectionMode);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -214,7 +211,7 @@ MobileConnection::GetNetworks(nsIDOMDOMRequest** request)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->GetNetworks(mClientId, GetOwner(), request);
|
||||
return mProvider->GetNetworks(GetOwner(), request);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -230,7 +227,7 @@ MobileConnection::SelectNetwork(nsIDOMMozMobileNetworkInfo* network, nsIDOMDOMRe
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->SelectNetwork(mClientId, GetOwner(), network, request);
|
||||
return mProvider->SelectNetwork(GetOwner(), network, request);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -246,7 +243,7 @@ MobileConnection::SelectNetworkAutomatically(nsIDOMDOMRequest** request)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->SelectNetworkAutomatically(mClientId, GetOwner(), request);
|
||||
return mProvider->SelectNetworkAutomatically(GetOwner(), request);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -262,7 +259,7 @@ MobileConnection::SetRoamingPreference(const nsAString& aMode, nsIDOMDOMRequest*
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->SetRoamingPreference(mClientId, GetOwner(), aMode, aDomRequest);
|
||||
return mProvider->SetRoamingPreference(GetOwner(), aMode, aDomRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -278,7 +275,7 @@ MobileConnection::GetRoamingPreference(nsIDOMDOMRequest** aDomRequest)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->GetRoamingPreference(mClientId, GetOwner(), aDomRequest);
|
||||
return mProvider->GetRoamingPreference(GetOwner(), aDomRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -294,7 +291,7 @@ MobileConnection::SetVoicePrivacyMode(bool aEnabled, nsIDOMDOMRequest** aDomRequ
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->SetVoicePrivacyMode(mClientId, GetOwner(), aEnabled, aDomRequest);
|
||||
return mProvider->SetVoicePrivacyMode(GetOwner(), aEnabled, aDomRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -310,7 +307,7 @@ MobileConnection::GetVoicePrivacyMode(nsIDOMDOMRequest** aDomRequest)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->GetVoicePrivacyMode(mClientId, GetOwner(), aDomRequest);
|
||||
return mProvider->GetVoicePrivacyMode(GetOwner(), aDomRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -325,7 +322,7 @@ MobileConnection::SendMMI(const nsAString& aMMIString,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->SendMMI(mClientId, GetOwner(), aMMIString, aRequest);
|
||||
return mProvider->SendMMI(GetOwner(), aMMIString, aRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -339,7 +336,7 @@ MobileConnection::CancelMMI(nsIDOMDOMRequest** aRequest)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->CancelMMI(mClientId, GetOwner(),aRequest);
|
||||
return mProvider->CancelMMI(GetOwner(), aRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -356,7 +353,7 @@ MobileConnection::GetCallForwardingOption(uint16_t aReason,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->GetCallForwardingOption(mClientId, GetOwner(), aReason, aRequest);
|
||||
return mProvider->GetCallForwardingOption(GetOwner(), aReason, aRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -373,7 +370,7 @@ MobileConnection::SetCallForwardingOption(nsIDOMMozMobileCFInfo* aCFInfo,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->SetCallForwardingOption(mClientId, GetOwner(), aCFInfo, aRequest);
|
||||
return mProvider->SetCallForwardingOption(GetOwner(), aCFInfo, aRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -390,7 +387,7 @@ MobileConnection::GetCallBarringOption(const JS::Value& aOption,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->GetCallBarringOption(mClientId, GetOwner(), aOption, aRequest);
|
||||
return mProvider->GetCallBarringOption(GetOwner(), aOption, aRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -407,7 +404,7 @@ MobileConnection::SetCallBarringOption(const JS::Value& aOption,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->SetCallBarringOption(mClientId, GetOwner(), aOption, aRequest);
|
||||
return mProvider->SetCallBarringOption(GetOwner(), aOption, aRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -424,7 +421,7 @@ MobileConnection::ChangeCallBarringPassword(const JS::Value& aInfo,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->ChangeCallBarringPassword(mClientId, GetOwner(), aInfo, aRequest);
|
||||
return mProvider->ChangeCallBarringPassword(GetOwner(), aInfo, aRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -440,7 +437,7 @@ MobileConnection::GetCallWaitingOption(nsIDOMDOMRequest** aRequest)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->GetCallWaitingOption(mClientId, GetOwner(), aRequest);
|
||||
return mProvider->GetCallWaitingOption(GetOwner(), aRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -457,7 +454,7 @@ MobileConnection::SetCallWaitingOption(bool aEnabled,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->SetCallWaitingOption(mClientId, GetOwner(), aEnabled, aRequest);
|
||||
return mProvider->SetCallWaitingOption(GetOwner(), aEnabled, aRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -473,7 +470,7 @@ MobileConnection::GetCallingLineIdRestriction(nsIDOMDOMRequest** aRequest)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->GetCallingLineIdRestriction(mClientId, GetOwner(), aRequest);
|
||||
return mProvider->GetCallingLineIdRestriction(GetOwner(), aRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -490,7 +487,7 @@ MobileConnection::SetCallingLineIdRestriction(unsigned short aClirMode,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->SetCallingLineIdRestriction(mClientId, GetOwner(), aClirMode, aRequest);
|
||||
return mProvider->SetCallingLineIdRestriction(GetOwner(), aClirMode, aRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -506,7 +503,7 @@ MobileConnection::ExitEmergencyCbMode(nsIDOMDOMRequest** aRequest)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->ExitEmergencyCbMode(mClientId, GetOwner(), aRequest);
|
||||
return mProvider->ExitEmergencyCbMode(GetOwner(), aRequest);
|
||||
}
|
||||
|
||||
// nsIMobileConnectionListener
|
||||
|
@ -48,8 +48,6 @@ private:
|
||||
nsRefPtr<Listener> mListener;
|
||||
nsWeakPtr mWindow;
|
||||
|
||||
uint32_t mClientId;
|
||||
|
||||
bool CheckPermission(const char* type);
|
||||
};
|
||||
|
||||
|
@ -44,8 +44,7 @@ this.PhoneNumberUtils = {
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
// Get network mcc
|
||||
// TODO: Bug 926740 - PhoneNumberUtils for multisim
|
||||
let voice = mobileConnection.getVoiceConnectionInfo(0);
|
||||
let voice = mobileConnection.voiceConnectionInfo;
|
||||
if (voice && voice.network && voice.network.mcc) {
|
||||
mcc = voice.network.mcc;
|
||||
}
|
||||
|
@ -88,13 +88,13 @@ const RIL_IPC_MSG_NAMES = [
|
||||
"RIL:StkCommand",
|
||||
"RIL:StkSessionEnd",
|
||||
"RIL:DataError",
|
||||
"RIL:SetCallForwardingOptions",
|
||||
"RIL:GetCallForwardingOptions",
|
||||
"RIL:SetCallBarringOptions",
|
||||
"RIL:GetCallBarringOptions",
|
||||
"RIL:SetCallForwardingOption",
|
||||
"RIL:GetCallForwardingOption",
|
||||
"RIL:SetCallBarringOption",
|
||||
"RIL:GetCallBarringOption",
|
||||
"RIL:ChangeCallBarringPassword",
|
||||
"RIL:SetCallWaitingOptions",
|
||||
"RIL:GetCallWaitingOptions",
|
||||
"RIL:SetCallWaitingOption",
|
||||
"RIL:GetCallWaitingOption",
|
||||
"RIL:SetCallingLineIdRestriction",
|
||||
"RIL:GetCallingLineIdRestriction",
|
||||
"RIL:CellBroadcastReceived",
|
||||
@ -384,13 +384,13 @@ CellBroadcastEtwsInfo.prototype = {
|
||||
popup: null
|
||||
};
|
||||
|
||||
function CallBarringOptions(options) {
|
||||
this.program = options.program;
|
||||
this.enabled = options.enabled;
|
||||
this.password = options.password;
|
||||
this.serviceClass = options.serviceClass;
|
||||
function CallBarringOption(option) {
|
||||
this.program = option.program;
|
||||
this.enabled = option.enabled;
|
||||
this.password = option.password;
|
||||
this.serviceClass = option.serviceClass;
|
||||
}
|
||||
CallBarringOptions.prototype = {
|
||||
CallBarringOption.prototype = {
|
||||
__exposedProps__ : {program: 'r',
|
||||
enabled: 'r',
|
||||
password: 'r',
|
||||
@ -449,30 +449,17 @@ IccCardLockError.prototype = {
|
||||
};
|
||||
|
||||
function RILContentHelper() {
|
||||
|
||||
this.numClients = gNumRadioInterfaces;
|
||||
debug("Number of clients: " + this.numClients);
|
||||
|
||||
this.rilContexts = [];
|
||||
for (let clientId = 0; clientId < this.numClients; clientId++) {
|
||||
this.rilContexts[clientId] = {
|
||||
cardState: RIL.GECKO_CARDSTATE_UNKNOWN,
|
||||
networkSelectionMode: RIL.GECKO_NETWORK_SELECTION_UNKNOWN,
|
||||
iccInfo: null,
|
||||
voiceConnectionInfo: new MobileConnectionInfo(),
|
||||
dataConnectionInfo: new MobileConnectionInfo()
|
||||
};
|
||||
}
|
||||
this.rilContext = {
|
||||
cardState: RIL.GECKO_CARDSTATE_UNKNOWN,
|
||||
networkSelectionMode: RIL.GECKO_NETWORK_SELECTION_UNKNOWN,
|
||||
iccInfo: null,
|
||||
voiceConnectionInfo: new MobileConnectionInfo(),
|
||||
dataConnectionInfo: new MobileConnectionInfo()
|
||||
};
|
||||
this.voicemailInfo = new VoicemailInfo();
|
||||
|
||||
this.initDOMRequestHelper(/* aWindow */ null, RIL_IPC_MSG_NAMES);
|
||||
this._windowsMap = [];
|
||||
this._selectingNetworks = [];
|
||||
this._mobileConnectionListeners = [];
|
||||
this._cellBroadcastListeners = [];
|
||||
this._voicemailListeners = [];
|
||||
this._iccListeners = [];
|
||||
|
||||
Services.obs.addObserver(this, "xpcom-shutdown", false);
|
||||
}
|
||||
|
||||
@ -538,103 +525,88 @@ RILContentHelper.prototype = {
|
||||
* 1. Should clear iccInfo to null if there is no card detected.
|
||||
* 2. Need to create corresponding object based on iccType.
|
||||
*/
|
||||
updateIccInfo: function updateIccInfo(clientId, newInfo) {
|
||||
let rilContext = this.rilContexts[clientId];
|
||||
|
||||
updateIccInfo: function updateIccInfo(newInfo) {
|
||||
// Card is not detected, clear iccInfo to null.
|
||||
if (!newInfo || !newInfo.iccType) {
|
||||
rilContext.iccInfo = null;
|
||||
this.rilContext.iccInfo = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// If iccInfo is null, new corresponding object based on iccType.
|
||||
if (!rilContext.iccInfo) {
|
||||
if (!this.rilContext.iccInfo) {
|
||||
if (newInfo.iccType === "ruim" || newInfo.iccType === "csim") {
|
||||
rilContext.iccInfo = new CdmaIccInfo();
|
||||
this.rilContext.iccInfo = new CdmaIccInfo();
|
||||
} else {
|
||||
rilContext.iccInfo = new GsmIccInfo();
|
||||
this.rilContext.iccInfo = new GsmIccInfo();
|
||||
}
|
||||
}
|
||||
|
||||
this.updateInfo(newInfo, rilContext.iccInfo);
|
||||
this.updateInfo(newInfo, this.rilContext.iccInfo);
|
||||
},
|
||||
|
||||
_windowsMap: null,
|
||||
|
||||
rilContexts: null,
|
||||
rilContext: null,
|
||||
|
||||
getRilContext: function getRilContext(clientId) {
|
||||
// Update ril contexts by sending IPC message to chrome only when the first
|
||||
getRilContext: function getRilContext() {
|
||||
// Update ril context by sending IPC message to chrome only when the first
|
||||
// time we require it. The information will be updated by following info
|
||||
// changed messages.
|
||||
this.getRilContext = function getRilContext(clientId) {
|
||||
return this.rilContexts[clientId];
|
||||
this.getRilContext = function getRilContext() {
|
||||
return this.rilContext;
|
||||
};
|
||||
|
||||
for (let cId = 0; cId < this.numClients; cId++) {
|
||||
let rilContext =
|
||||
cpmm.sendSyncMessage("RIL:GetRilContext", {clientId: cId})[0];
|
||||
if (!rilContext) {
|
||||
debug("Received null rilContext from chrome process.");
|
||||
continue;
|
||||
}
|
||||
this.rilContexts[cId].cardState = rilContext.cardState;
|
||||
this.rilContexts[cId].networkSelectionMode = rilContext.networkSelectionMode;
|
||||
this.updateIccInfo(cId, rilContext.iccInfo);
|
||||
this.updateConnectionInfo(rilContext.voice, this.rilContexts[cId].voiceConnectionInfo);
|
||||
this.updateConnectionInfo(rilContext.data, this.rilContexts[cId].dataConnectionInfo);
|
||||
let rilContext =
|
||||
cpmm.sendSyncMessage("RIL:GetRilContext", {clientId: 0})[0];
|
||||
if (!rilContext) {
|
||||
debug("Received null rilContext from chrome process.");
|
||||
return;
|
||||
}
|
||||
this.rilContext.cardState = rilContext.cardState;
|
||||
this.rilContext.networkSelectionMode = rilContext.networkSelectionMode;
|
||||
this.updateIccInfo(rilContext.iccInfo);
|
||||
this.updateConnectionInfo(rilContext.voice, this.rilContext.voiceConnectionInfo);
|
||||
this.updateConnectionInfo(rilContext.data, this.rilContext.dataConnectionInfo);
|
||||
|
||||
return this.rilContexts[clientId];
|
||||
},
|
||||
|
||||
/**
|
||||
* nsIIccProvider
|
||||
*/
|
||||
|
||||
get iccInfo() {
|
||||
//TODO: Bug 814637 - WebIccManager API: support multiple sim cards.
|
||||
let context = this.getRilContext(0);
|
||||
return context && context.iccInfo;
|
||||
},
|
||||
|
||||
get cardState() {
|
||||
//TODO: Bug 814637 - WebIccManager API: support multiple sim cards.
|
||||
let context = this.getRilContext(0);
|
||||
return context && context.cardState;
|
||||
return this.rilContext;
|
||||
},
|
||||
|
||||
/**
|
||||
* nsIMobileConnectionProvider
|
||||
*/
|
||||
|
||||
getVoiceConnectionInfo: function getVoiceConnectionInfo(clientId) {
|
||||
let context = this.getRilContext(clientId);
|
||||
get iccInfo() {
|
||||
let context = this.getRilContext();
|
||||
return context && context.iccInfo;
|
||||
},
|
||||
|
||||
get voiceConnectionInfo() {
|
||||
let context = this.getRilContext();
|
||||
return context && context.voiceConnectionInfo;
|
||||
},
|
||||
|
||||
getDataConnectionInfo: function getDataConnectionInfo(clientId) {
|
||||
let context = this.getRilContext(clientId);
|
||||
get dataConnectionInfo() {
|
||||
let context = this.getRilContext();
|
||||
return context && context.dataConnectionInfo;
|
||||
},
|
||||
|
||||
getIccId: function getIccId(clientId) {
|
||||
let context = this.getRilContext(clientId);
|
||||
return context && context.iccInfo.iccid;
|
||||
get cardState() {
|
||||
let context = this.getRilContext();
|
||||
return context && context.cardState;
|
||||
},
|
||||
|
||||
getNetworkSelectionMode: function getNetworkSelectionMode(clientId) {
|
||||
let context = this.getRilContext(clientId);
|
||||
get networkSelectionMode() {
|
||||
let context = this.getRilContext();
|
||||
return context && context.networkSelectionMode;
|
||||
},
|
||||
|
||||
/**
|
||||
* The networks that are currently trying to be selected (or "automatic").
|
||||
* This helps ensure that only one network per client is selected at a time.
|
||||
* The network that is currently trying to be selected (or "automatic").
|
||||
* This helps ensure that only one network is selected at a time.
|
||||
*/
|
||||
_selectingNetworks: null,
|
||||
_selectingNetwork: null,
|
||||
|
||||
getNetworks: function getNetworks(clientId, window) {
|
||||
getNetworks: function getNetworks(window) {
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
@ -644,7 +616,7 @@ RILContentHelper.prototype = {
|
||||
let requestId = this.getRequestId(request);
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:GetAvailableNetworks", {
|
||||
clientId: clientId,
|
||||
clientId: 0,
|
||||
data: {
|
||||
requestId: requestId
|
||||
}
|
||||
@ -652,14 +624,14 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
},
|
||||
|
||||
selectNetwork: function selectNetwork(clientId, window, network) {
|
||||
selectNetwork: function selectNetwork(window, network) {
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
|
||||
if (this._selectingNetworks[clientId]) {
|
||||
throw new Error("Already selecting a network: " + this._selectingNetworks[clientId]);
|
||||
if (this._selectingNetwork) {
|
||||
throw new Error("Already selecting a network: " + this._selectingNetwork);
|
||||
}
|
||||
|
||||
if (!network) {
|
||||
@ -677,8 +649,8 @@ RILContentHelper.prototype = {
|
||||
let request = Services.DOMRequest.createRequest(window);
|
||||
let requestId = this.getRequestId(request);
|
||||
|
||||
if (this.rilContexts[clientId].networkSelectionMode == RIL.GECKO_NETWORK_SELECTION_MANUAL &&
|
||||
this.rilContexts[clientId].voiceConnectionInfo.network === network) {
|
||||
if (this.rilContext.networkSelectionMode == RIL.GECKO_NETWORK_SELECTION_MANUAL &&
|
||||
this.rilContext.voiceConnectionInfo.network === network) {
|
||||
|
||||
// Already manually selected this network, so schedule
|
||||
// onsuccess to be fired on the next tick
|
||||
@ -686,10 +658,10 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
}
|
||||
|
||||
this._selectingNetworks[clientId] = network;
|
||||
this._selectingNetwork = network;
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:SelectNetwork", {
|
||||
clientId: clientId,
|
||||
clientId: 0,
|
||||
data: {
|
||||
requestId: requestId,
|
||||
mnc: network.mnc,
|
||||
@ -700,30 +672,30 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
},
|
||||
|
||||
selectNetworkAutomatically: function selectNetworkAutomatically(clientId, window) {
|
||||
selectNetworkAutomatically: function selectNetworkAutomatically(window) {
|
||||
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
|
||||
if (this._selectingNetworks[clientId]) {
|
||||
throw new Error("Already selecting a network: " + this._selectingNetworks[clientId]);
|
||||
if (this._selectingNetwork) {
|
||||
throw new Error("Already selecting a network: " + this._selectingNetwork);
|
||||
}
|
||||
|
||||
let request = Services.DOMRequest.createRequest(window);
|
||||
let requestId = this.getRequestId(request);
|
||||
|
||||
if (this.rilContexts[clientId].networkSelectionMode == RIL.GECKO_NETWORK_SELECTION_AUTOMATIC) {
|
||||
if (this.rilContext.networkSelectionMode == RIL.GECKO_NETWORK_SELECTION_AUTOMATIC) {
|
||||
// Already using automatic selection mode, so schedule
|
||||
// onsuccess to be be fired on the next tick
|
||||
this.dispatchFireRequestSuccess(requestId, null);
|
||||
return request;
|
||||
}
|
||||
|
||||
this._selectingNetworks[clientId] = "automatic";
|
||||
this._selectingNetwork = "automatic";
|
||||
cpmm.sendAsyncMessage("RIL:SelectNetworkAuto", {
|
||||
clientId: clientId,
|
||||
clientId: 0,
|
||||
data: {
|
||||
requestId: requestId
|
||||
}
|
||||
@ -731,7 +703,7 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
},
|
||||
|
||||
setRoamingPreference: function setRoamingPreference(clientId, window, mode) {
|
||||
setRoamingPreference: function setRoamingPreference(window, mode) {
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
@ -747,7 +719,7 @@ RILContentHelper.prototype = {
|
||||
}
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:SetRoamingPreference", {
|
||||
clientId: clientId,
|
||||
clientId: 0,
|
||||
data: {
|
||||
requestId: requestId,
|
||||
mode: mode
|
||||
@ -756,7 +728,7 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
},
|
||||
|
||||
getRoamingPreference: function getRoamingPreference(clientId, window) {
|
||||
getRoamingPreference: function getRoamingPreference(window) {
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
@ -766,7 +738,7 @@ RILContentHelper.prototype = {
|
||||
let requestId = this.getRequestId(request);
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:GetRoamingPreference", {
|
||||
clientId: clientId,
|
||||
clientId: 0,
|
||||
data: {
|
||||
requestId: requestId
|
||||
}
|
||||
@ -774,7 +746,7 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
},
|
||||
|
||||
setVoicePrivacyMode: function setVoicePrivacyMode(clientId, window, enabled) {
|
||||
setVoicePrivacyMode: function setVoicePrivacyMode(window, enabled) {
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
@ -784,7 +756,7 @@ RILContentHelper.prototype = {
|
||||
let requestId = this.getRequestId(request);
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:SetVoicePrivacyMode", {
|
||||
clientId: clientId,
|
||||
clientId: 0,
|
||||
data: {
|
||||
requestId: requestId,
|
||||
enabled: enabled
|
||||
@ -793,7 +765,7 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
},
|
||||
|
||||
getVoicePrivacyMode: function getVoicePrivacyMode(clientId, window) {
|
||||
getVoicePrivacyMode: function getVoicePrivacyMode(window) {
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
@ -803,7 +775,7 @@ RILContentHelper.prototype = {
|
||||
let requestId = this.getRequestId(request);
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:GetVoicePrivacyMode", {
|
||||
clientId: clientId,
|
||||
clientId: 0,
|
||||
data: {
|
||||
requestId: requestId
|
||||
}
|
||||
@ -879,7 +851,7 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
},
|
||||
|
||||
sendMMI: function sendMMI(clientId, window, mmi) {
|
||||
sendMMI: function sendMMI(window, mmi) {
|
||||
debug("Sending MMI " + mmi);
|
||||
if (!window) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
@ -892,7 +864,7 @@ RILContentHelper.prototype = {
|
||||
this._windowsMap[requestId] = window;
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:SendMMI", {
|
||||
clientId: clientId,
|
||||
clientId: 0,
|
||||
data: {
|
||||
mmi: mmi,
|
||||
requestId: requestId
|
||||
@ -901,7 +873,7 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
},
|
||||
|
||||
cancelMMI: function cancelMMI(clientId, window) {
|
||||
cancelMMI: function cancelMMI(window) {
|
||||
debug("Cancel MMI");
|
||||
if (!window) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
@ -910,7 +882,7 @@ RILContentHelper.prototype = {
|
||||
let request = Services.DOMRequest.createRequest(window);
|
||||
let requestId = this.getRequestId(request);
|
||||
cpmm.sendAsyncMessage("RIL:CancelMMI", {
|
||||
clientId: clientId,
|
||||
clientId: 0,
|
||||
data: {
|
||||
requestId: requestId
|
||||
}
|
||||
@ -1104,7 +1076,7 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
},
|
||||
|
||||
getCallForwardingOption: function getCallForwardingOption(clientId, window, reason) {
|
||||
getCallForwardingOption: function getCallForwardingOption(window, reason) {
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
@ -1118,8 +1090,8 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
}
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:GetCallForwardingOptions", {
|
||||
clientId: clientId,
|
||||
cpmm.sendAsyncMessage("RIL:GetCallForwardingOption", {
|
||||
clientId: 0,
|
||||
data: {
|
||||
requestId: requestId,
|
||||
reason: reason
|
||||
@ -1129,7 +1101,7 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
},
|
||||
|
||||
setCallForwardingOption: function setCallForwardingOption(clientId, window, cfInfo) {
|
||||
setCallForwardingOption: function setCallForwardingOption(window, cfInfo) {
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
@ -1145,8 +1117,8 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
}
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:SetCallForwardingOptions", {
|
||||
clientId: clientId,
|
||||
cpmm.sendAsyncMessage("RIL:SetCallForwardingOption", {
|
||||
clientId: 0,
|
||||
data: {
|
||||
requestId: requestId,
|
||||
active: cfInfo.active,
|
||||
@ -1160,7 +1132,7 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
},
|
||||
|
||||
getCallBarringOption: function getCallBarringOption(clientId, window, option) {
|
||||
getCallBarringOption: function getCallBarringOption(window, option) {
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
@ -1169,14 +1141,14 @@ RILContentHelper.prototype = {
|
||||
let requestId = this.getRequestId(request);
|
||||
|
||||
if (DEBUG) debug("getCallBarringOption: " + JSON.stringify(option));
|
||||
if (!this._isValidCallBarringOptions(option)) {
|
||||
if (!this._isValidCallBarringOption(option)) {
|
||||
this.dispatchFireRequestError(requestId,
|
||||
RIL.GECKO_ERROR_INVALID_PARAMETER);
|
||||
return request;
|
||||
}
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:GetCallBarringOptions", {
|
||||
clientId: clientId,
|
||||
cpmm.sendAsyncMessage("RIL:GetCallBarringOption", {
|
||||
clientId: 0,
|
||||
data: {
|
||||
requestId: requestId,
|
||||
program: option.program,
|
||||
@ -1187,7 +1159,7 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
},
|
||||
|
||||
setCallBarringOption: function setCallBarringOption(clientId, window, option) {
|
||||
setCallBarringOption: function setCallBarringOption(window, option) {
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
@ -1196,14 +1168,14 @@ RILContentHelper.prototype = {
|
||||
let requestId = this.getRequestId(request);
|
||||
|
||||
if (DEBUG) debug("setCallBarringOption: " + JSON.stringify(option));
|
||||
if (!this._isValidCallBarringOptions(option, true)) {
|
||||
if (!this._isValidCallBarringOption(option, true)) {
|
||||
this.dispatchFireRequestError(requestId,
|
||||
RIL.GECKO_ERROR_INVALID_PARAMETER);
|
||||
return request;
|
||||
}
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:SetCallBarringOptions", {
|
||||
clientId: clientId,
|
||||
cpmm.sendAsyncMessage("RIL:SetCallBarringOption", {
|
||||
clientId: 0,
|
||||
data: {
|
||||
requestId: requestId,
|
||||
program: option.program,
|
||||
@ -1215,7 +1187,7 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
},
|
||||
|
||||
changeCallBarringPassword: function changeCallBarringPassword(clientId, window, info) {
|
||||
changeCallBarringPassword: function changeCallBarringPassword(window, info) {
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
@ -1233,14 +1205,14 @@ RILContentHelper.prototype = {
|
||||
if (DEBUG) debug("changeCallBarringPassword: " + JSON.stringify(info));
|
||||
info.requestId = requestId;
|
||||
cpmm.sendAsyncMessage("RIL:ChangeCallBarringPassword", {
|
||||
clientId: clientId,
|
||||
clientId: 0,
|
||||
data: info
|
||||
});
|
||||
|
||||
return request;
|
||||
},
|
||||
|
||||
getCallWaitingOption: function getCallWaitingOption(clientId, window) {
|
||||
getCallWaitingOption: function getCallWaitingOption(window) {
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
@ -1248,8 +1220,8 @@ RILContentHelper.prototype = {
|
||||
let request = Services.DOMRequest.createRequest(window);
|
||||
let requestId = this.getRequestId(request);
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:GetCallWaitingOptions", {
|
||||
clientId: clientId,
|
||||
cpmm.sendAsyncMessage("RIL:GetCallWaitingOption", {
|
||||
clientId: 0,
|
||||
data: {
|
||||
requestId: requestId
|
||||
}
|
||||
@ -1258,7 +1230,7 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
},
|
||||
|
||||
setCallWaitingOption: function setCallWaitingOption(clientId, window, enabled) {
|
||||
setCallWaitingOption: function setCallWaitingOption(window, enabled) {
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
@ -1266,8 +1238,8 @@ RILContentHelper.prototype = {
|
||||
let request = Services.DOMRequest.createRequest(window);
|
||||
let requestId = this.getRequestId(request);
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:SetCallWaitingOptions", {
|
||||
clientId: clientId,
|
||||
cpmm.sendAsyncMessage("RIL:SetCallWaitingOption", {
|
||||
clientId: 0,
|
||||
data: {
|
||||
requestId: requestId,
|
||||
enabled: enabled
|
||||
@ -1277,7 +1249,7 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
},
|
||||
|
||||
getCallingLineIdRestriction: function getCallingLineIdRestriction(clientId, window) {
|
||||
getCallingLineIdRestriction: function getCallingLineIdRestriction(window) {
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
@ -1286,7 +1258,7 @@ RILContentHelper.prototype = {
|
||||
let requestId = this.getRequestId(request);
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:GetCallingLineIdRestriction", {
|
||||
clientId: clientId,
|
||||
clientId: 0,
|
||||
data: {
|
||||
requestId: requestId
|
||||
}
|
||||
@ -1296,7 +1268,7 @@ RILContentHelper.prototype = {
|
||||
},
|
||||
|
||||
setCallingLineIdRestriction:
|
||||
function setCallingLineIdRestriction(clientId, window, clirMode) {
|
||||
function setCallingLineIdRestriction(window, clirMode) {
|
||||
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
@ -1306,7 +1278,7 @@ RILContentHelper.prototype = {
|
||||
let requestId = this.getRequestId(request);
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:SetCallingLineIdRestriction", {
|
||||
clientId: clientId,
|
||||
clientId: 0,
|
||||
data: {
|
||||
requestId: requestId,
|
||||
clirMode: clirMode
|
||||
@ -1316,7 +1288,7 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
},
|
||||
|
||||
exitEmergencyCbMode: function exitEmergencyCbMode(clientId, window) {
|
||||
exitEmergencyCbMode: function exitEmergencyCbMode(window) {
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
@ -1325,7 +1297,7 @@ RILContentHelper.prototype = {
|
||||
let requestId = this.getRequestId(request);
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:ExitEmergencyCbMode", {
|
||||
clientId: clientId,
|
||||
clientId: 0,
|
||||
data: {
|
||||
requestId: requestId,
|
||||
}
|
||||
@ -1362,13 +1334,10 @@ RILContentHelper.prototype = {
|
||||
return this.getVoicemailInfo().displayName;
|
||||
},
|
||||
|
||||
registerListener: function registerListener(listenerType, clientId, listener) {
|
||||
if (!this[listenerType]) {
|
||||
return;
|
||||
}
|
||||
let listeners = this[listenerType][clientId];
|
||||
registerListener: function registerListener(listenerType, listener) {
|
||||
let listeners = this[listenerType];
|
||||
if (!listeners) {
|
||||
listeners = this[listenerType][clientId] = [];
|
||||
listeners = this[listenerType] = [];
|
||||
}
|
||||
|
||||
if (listeners.indexOf(listener) != -1) {
|
||||
@ -1379,11 +1348,8 @@ RILContentHelper.prototype = {
|
||||
if (DEBUG) debug("Registered " + listenerType + " listener: " + listener);
|
||||
},
|
||||
|
||||
unregisterListener: function unregisterListener(listenerType, clientId, listener) {
|
||||
if (!this[listenerType]) {
|
||||
return;
|
||||
}
|
||||
let listeners = this[listenerType][clientId];
|
||||
unregisterListener: function unregisterListener(listenerType, listener) {
|
||||
let listeners = this[listenerType];
|
||||
if (!listeners) {
|
||||
return;
|
||||
}
|
||||
@ -1395,50 +1361,44 @@ RILContentHelper.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
registerMobileConnectionMsg: function registerMobileConnectionMsg(clientId, listener) {
|
||||
registerMobileConnectionMsg: function registerMobileConnectionMsg(listener) {
|
||||
debug("Registering for mobile connection related messages");
|
||||
this.registerListener("_mobileConnectionListeners", clientId, listener);
|
||||
this.registerListener("_mobileConnectionListeners", listener);
|
||||
cpmm.sendAsyncMessage("RIL:RegisterMobileConnectionMsg");
|
||||
},
|
||||
|
||||
unregisterMobileConnectionMsg: function unregisteMobileConnectionMsg(clientId, listener) {
|
||||
this.unregisterListener("_mobileConnectionListeners", clientId, listener);
|
||||
unregisterMobileConnectionMsg: function unregisteMobileConnectionMsg(listener) {
|
||||
this.unregisterListener("_mobileConnectionListeners", listener);
|
||||
},
|
||||
|
||||
registerVoicemailMsg: function registerVoicemailMsg(listener) {
|
||||
debug("Registering for voicemail-related messages");
|
||||
//TODO: Bug 814634 - WebVoicemail API: support multiple sim cards.
|
||||
this.registerListener("_voicemailListeners", 0, listener);
|
||||
this.registerListener("_voicemailListeners", listener);
|
||||
cpmm.sendAsyncMessage("RIL:RegisterVoicemailMsg");
|
||||
},
|
||||
|
||||
unregisterVoicemailMsg: function unregisteVoicemailMsg(listener) {
|
||||
//TODO: Bug 814634 - WebVoicemail API: support multiple sim cards.
|
||||
this.unregisterListener("_voicemailListeners", 0, listener);
|
||||
this.unregisterListener("_voicemailListeners", listener);
|
||||
},
|
||||
|
||||
registerCellBroadcastMsg: function registerCellBroadcastMsg(listener) {
|
||||
debug("Registering for Cell Broadcast related messages");
|
||||
//TODO: Bug 921326 - Cellbroadcast API: support multiple sim cards
|
||||
this.registerListener("_cellBroadcastListeners", 0, listener);
|
||||
this.registerListener("_cellBroadcastListeners", listener);
|
||||
cpmm.sendAsyncMessage("RIL:RegisterCellBroadcastMsg");
|
||||
},
|
||||
|
||||
unregisterCellBroadcastMsg: function unregisterCellBroadcastMsg(listener) {
|
||||
//TODO: Bug 921326 - Cellbroadcast API: support multiple sim cards
|
||||
this.unregisterListener("_cellBroadcastListeners", 0, listener);
|
||||
this.unregisterListener("_cellBroadcastListeners", listener);
|
||||
},
|
||||
|
||||
registerIccMsg: function registerIccMsg(listener) {
|
||||
debug("Registering for ICC related messages");
|
||||
//TODO: Bug 814637 - WebIccManager API: support multiple sim cards.
|
||||
this.registerListener("_iccListeners", 0, listener);
|
||||
this.registerListener("_iccListeners", listener);
|
||||
cpmm.sendAsyncMessage("RIL:RegisterIccMsg");
|
||||
},
|
||||
|
||||
unregisterIccMsg: function unregisterIccMsg(listener) {
|
||||
//TODO: Bug 814637 - WebIccManager API: support multiple sim cards.
|
||||
this.unregisterListener("_iccListeners", 0, listener);
|
||||
this.unregisterListener("_iccListeners", listener);
|
||||
},
|
||||
|
||||
// nsIObserver
|
||||
@ -1518,43 +1478,35 @@ RILContentHelper.prototype = {
|
||||
debug("Received message '" + msg.name + "': " + JSON.stringify(msg.json));
|
||||
|
||||
let data = msg.json.data;
|
||||
let clientId = msg.json.clientId;
|
||||
switch (msg.name) {
|
||||
case "RIL:CardStateChanged":
|
||||
if (this.rilContexts[clientId].cardState != data.cardState) {
|
||||
this.rilContexts[clientId].cardState = data.cardState;
|
||||
this._deliverEvent(clientId,
|
||||
"_iccListeners",
|
||||
if (this.rilContext.cardState != data.cardState) {
|
||||
this.rilContext.cardState = data.cardState;
|
||||
this._deliverEvent("_iccListeners",
|
||||
"notifyCardStateChanged",
|
||||
null);
|
||||
}
|
||||
break;
|
||||
case "RIL:IccInfoChanged":
|
||||
this.updateIccInfo(clientId, data);
|
||||
this._deliverEvent(clientId,
|
||||
"_iccListeners",
|
||||
"notifyIccInfoChanged",
|
||||
null);
|
||||
this.updateIccInfo(data);
|
||||
this._deliverEvent("_iccListeners", "notifyIccInfoChanged", null);
|
||||
break;
|
||||
case "RIL:VoiceInfoChanged":
|
||||
this.updateConnectionInfo(data,
|
||||
this.rilContexts[clientId].voiceConnectionInfo);
|
||||
this._deliverEvent(clientId,
|
||||
"_mobileConnectionListeners",
|
||||
this.rilContext.voiceConnectionInfo);
|
||||
this._deliverEvent("_mobileConnectionListeners",
|
||||
"notifyVoiceChanged",
|
||||
null);
|
||||
break;
|
||||
case "RIL:DataInfoChanged":
|
||||
this.updateConnectionInfo(data,
|
||||
this.rilContexts[clientId].dataConnectionInfo);
|
||||
this._deliverEvent(clientId,
|
||||
"_mobileConnectionListeners",
|
||||
this.rilContext.dataConnectionInfo);
|
||||
this._deliverEvent("_mobileConnectionListeners",
|
||||
"notifyDataChanged",
|
||||
null);
|
||||
break;
|
||||
case "RIL:OtaStatusChanged":
|
||||
this._deliverEvent(clientId,
|
||||
"_mobileConnectionListeners",
|
||||
this._deliverEvent("_mobileConnectionListeners",
|
||||
"notifyOtaStatusChanged",
|
||||
[data]);
|
||||
break;
|
||||
@ -1562,18 +1514,18 @@ RILContentHelper.prototype = {
|
||||
this.handleGetAvailableNetworks(data);
|
||||
break;
|
||||
case "RIL:NetworkSelectionModeChanged":
|
||||
this.rilContexts[clientId].networkSelectionMode = data.mode;
|
||||
this.rilContext.networkSelectionMode = data.mode;
|
||||
break;
|
||||
case "RIL:SelectNetwork":
|
||||
this.handleSelectNetwork(clientId, data,
|
||||
this.handleSelectNetwork(data,
|
||||
RIL.GECKO_NETWORK_SELECTION_MANUAL);
|
||||
break;
|
||||
case "RIL:SelectNetworkAuto":
|
||||
this.handleSelectNetwork(clientId, data,
|
||||
this.handleSelectNetwork(data,
|
||||
RIL.GECKO_NETWORK_SELECTION_AUTOMATIC);
|
||||
break;
|
||||
case "RIL:VoicemailNotification":
|
||||
this.handleVoicemailNotification(clientId, data);
|
||||
this.handleVoicemailNotification(data);
|
||||
break;
|
||||
case "RIL:VoicemailInfoChanged":
|
||||
this.updateInfo(data, this.voicemailInfo);
|
||||
@ -1608,8 +1560,7 @@ RILContentHelper.prototype = {
|
||||
}
|
||||
break;
|
||||
case "RIL:USSDReceived":
|
||||
this._deliverEvent(clientId,
|
||||
"_mobileConnectionListeners",
|
||||
this._deliverEvent("_mobileConnectionListeners",
|
||||
"notifyUssdReceived",
|
||||
[data.message, data.sessionEnded]);
|
||||
break;
|
||||
@ -1618,11 +1569,11 @@ RILContentHelper.prototype = {
|
||||
this.handleSendCancelMMI(data);
|
||||
break;
|
||||
case "RIL:StkCommand":
|
||||
this._deliverEvent(clientId, "_iccListeners", "notifyStkCommand",
|
||||
this._deliverEvent("_iccListeners", "notifyStkCommand",
|
||||
[JSON.stringify(data)]);
|
||||
break;
|
||||
case "RIL:StkSessionEnd":
|
||||
this._deliverEvent(clientId, "_iccListeners", "notifyStkSessionEnd", null);
|
||||
this._deliverEvent("_iccListeners", "notifyStkSessionEnd", null);
|
||||
break;
|
||||
case "RIL:IccOpenChannel":
|
||||
this.handleSimpleRequest(data.requestId, data.errorMsg,
|
||||
@ -1641,35 +1592,34 @@ RILContentHelper.prototype = {
|
||||
this.handleSimpleRequest(data.requestId, data.errorMsg, null);
|
||||
break;
|
||||
case "RIL:DataError":
|
||||
this.updateConnectionInfo(data, this.rilContexts[clientId].dataConnectionInfo);
|
||||
this._deliverEvent(clientId, "_mobileConnectionListeners", "notifyDataError",
|
||||
this.updateConnectionInfo(data, this.rilContext.dataConnectionInfo);
|
||||
this._deliverEvent("_mobileConnectionListeners", "notifyDataError",
|
||||
[data.errorMsg]);
|
||||
break;
|
||||
case "RIL:GetCallForwardingOptions":
|
||||
this.handleGetCallForwardingOptions(data);
|
||||
case "RIL:GetCallForwardingOption":
|
||||
this.handleGetCallForwardingOption(data);
|
||||
break;
|
||||
case "RIL:SetCallForwardingOptions":
|
||||
case "RIL:SetCallForwardingOption":
|
||||
this.handleSimpleRequest(data.requestId, data.errorMsg, null);
|
||||
break;
|
||||
case "RIL:GetCallBarringOptions":
|
||||
this.handleGetCallBarringOptions(data);
|
||||
case "RIL:GetCallBarringOption":
|
||||
this.handleGetCallBarringOption(data);
|
||||
break;
|
||||
case "RIL:SetCallBarringOptions":
|
||||
case "RIL:SetCallBarringOption":
|
||||
this.handleSimpleRequest(data.requestId, data.errorMsg, null);
|
||||
break;
|
||||
case "RIL:ChangeCallBarringPassword":
|
||||
this.handleSimpleRequest(data.requestId, data.errorMsg, null);
|
||||
break;
|
||||
case "RIL:GetCallWaitingOptions":
|
||||
case "RIL:GetCallWaitingOption":
|
||||
this.handleSimpleRequest(data.requestId, data.errorMsg,
|
||||
data.enabled);
|
||||
break;
|
||||
case "RIL:SetCallWaitingOptions":
|
||||
case "RIL:SetCallWaitingOption":
|
||||
this.handleSimpleRequest(data.requestId, data.errorMsg, null);
|
||||
break;
|
||||
case "RIL:CfStateChanged":
|
||||
this._deliverEvent(clientId,
|
||||
"_mobileConnectionListeners",
|
||||
this._deliverEvent("_mobileConnectionListeners",
|
||||
"notifyCFStateChange",
|
||||
[data.success, data.action,
|
||||
data.reason, data.number,
|
||||
@ -1683,8 +1633,7 @@ RILContentHelper.prototype = {
|
||||
break;
|
||||
case "RIL:CellBroadcastReceived": {
|
||||
let message = new CellBroadcastMessage(data);
|
||||
this._deliverEvent(clientId,
|
||||
"_cellBroadcastListeners",
|
||||
this._deliverEvent("_cellBroadcastListeners",
|
||||
"notifyMessageReceived",
|
||||
[message]);
|
||||
break;
|
||||
@ -1700,8 +1649,7 @@ RILContentHelper.prototype = {
|
||||
this.handleExitEmergencyCbMode(data);
|
||||
break;
|
||||
case "RIL:EmergencyCbModeChanged":
|
||||
this._deliverEvent(clientId,
|
||||
"_mobileConnectionListeners",
|
||||
this._deliverEvent("_mobileConnectionListeners",
|
||||
"notifyEmergencyCbModeChanged",
|
||||
[data.active, data.timeoutMs]);
|
||||
break;
|
||||
@ -1742,9 +1690,9 @@ RILContentHelper.prototype = {
|
||||
this.fireRequestSuccess(message.requestId, networks);
|
||||
},
|
||||
|
||||
handleSelectNetwork: function handleSelectNetwork(clientId, message, mode) {
|
||||
this._selectingNetworks[clientId] = null;
|
||||
this.rilContexts[clientId].networkSelectionMode = mode;
|
||||
handleSelectNetwork: function handleSelectNetwork(message, mode) {
|
||||
this._selectingNetwork = null;
|
||||
this.rilContext.networkSelectionMode = mode;
|
||||
|
||||
if (message.errorMsg) {
|
||||
this.fireRequestError(message.requestId, message.errorMsg);
|
||||
@ -1793,8 +1741,7 @@ RILContentHelper.prototype = {
|
||||
ObjectWrapper.wrap(result, window));
|
||||
},
|
||||
|
||||
handleVoicemailNotification: function handleVoicemailNotification(clientId, message) {
|
||||
// TODO: Bug 818352 - B2G Multi-SIM: voicemail - add subscription id in nsIRILContentHelper
|
||||
handleVoicemailNotification: function handleVoicemailNotification(message) {
|
||||
let changed = false;
|
||||
if (!this.voicemailStatus) {
|
||||
this.voicemailStatus = new VoicemailStatus();
|
||||
@ -1824,8 +1771,7 @@ RILContentHelper.prototype = {
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
this._deliverEvent(clientId,
|
||||
"_voicemailListeners",
|
||||
this._deliverEvent("_voicemailListeners",
|
||||
"notifyStatusChanged",
|
||||
[this.voicemailStatus]);
|
||||
}
|
||||
@ -1840,7 +1786,7 @@ RILContentHelper.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
handleGetCallForwardingOptions: function handleGetCallForwardingOptions(message) {
|
||||
handleGetCallForwardingOption: function handleGetCallForwardingOption(message) {
|
||||
if (message.errorMsg) {
|
||||
this.fireRequestError(message.requestId, message.errorMsg);
|
||||
return;
|
||||
@ -1850,12 +1796,12 @@ RILContentHelper.prototype = {
|
||||
this.fireRequestSuccess(message.requestId, message.rules);
|
||||
},
|
||||
|
||||
handleGetCallBarringOptions: function handleGetCallBarringOptions(message) {
|
||||
handleGetCallBarringOption: function handleGetCallBarringOption(message) {
|
||||
if (!message.success) {
|
||||
this.fireRequestError(message.requestId, message.errorMsg);
|
||||
} else {
|
||||
let options = new CallBarringOptions(message);
|
||||
this.fireRequestSuccess(message.requestId, options);
|
||||
let option = new CallBarringOption(message);
|
||||
this.fireRequestSuccess(message.requestId, option);
|
||||
}
|
||||
},
|
||||
|
||||
@ -1931,11 +1877,8 @@ RILContentHelper.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
_deliverEvent: function _deliverEvent(clientId, listenerType, name, args) {
|
||||
if (!this[listenerType]) {
|
||||
return;
|
||||
}
|
||||
let thisListeners = this[listenerType][clientId];
|
||||
_deliverEvent: function _deliverEvent(listenerType, name, args) {
|
||||
let thisListeners = this[listenerType];
|
||||
if (!thisListeners) {
|
||||
return;
|
||||
}
|
||||
@ -2006,18 +1949,18 @@ RILContentHelper.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Helper for guarding us against invalid options for call barring.
|
||||
* Helper for guarding us against invalid option for call barring.
|
||||
*/
|
||||
_isValidCallBarringOptions:
|
||||
function _isValidCallBarringOptions(options, usedForSetting) {
|
||||
if (!options ||
|
||||
options.serviceClass == null ||
|
||||
!this._isValidCallBarringProgram(options.program)) {
|
||||
_isValidCallBarringOption:
|
||||
function _isValidCallBarringOption(option, usedForSetting) {
|
||||
if (!option ||
|
||||
option.serviceClass == null ||
|
||||
!this._isValidCallBarringProgram(option.program)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// For setting callbarring options, |enabled| and |password| are required.
|
||||
if (usedForSetting && (options.enabled == null || options.password == null)) {
|
||||
// For setting callbarring option, |enabled| and |password| are required.
|
||||
if (usedForSetting && (option.enabled == null || option.password == null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -90,13 +90,13 @@ const RIL_IPC_MOBILECONNECTION_MSG_NAMES = [
|
||||
"RIL:SendMMI",
|
||||
"RIL:CancelMMI",
|
||||
"RIL:RegisterMobileConnectionMsg",
|
||||
"RIL:SetCallForwardingOptions",
|
||||
"RIL:GetCallForwardingOptions",
|
||||
"RIL:SetCallBarringOptions",
|
||||
"RIL:GetCallBarringOptions",
|
||||
"RIL:SetCallForwardingOption",
|
||||
"RIL:GetCallForwardingOption",
|
||||
"RIL:SetCallBarringOption",
|
||||
"RIL:GetCallBarringOption",
|
||||
"RIL:ChangeCallBarringPassword",
|
||||
"RIL:SetCallWaitingOptions",
|
||||
"RIL:GetCallWaitingOptions",
|
||||
"RIL:SetCallWaitingOption",
|
||||
"RIL:GetCallWaitingOption",
|
||||
"RIL:SetCallingLineIdRestriction",
|
||||
"RIL:GetCallingLineIdRestriction",
|
||||
"RIL:SetRoamingPreference",
|
||||
@ -935,25 +935,25 @@ RadioInterface.prototype = {
|
||||
case "RIL:UpdateIccContact":
|
||||
this.workerMessenger.sendWithIPCMessage(msg, "updateICCContact");
|
||||
break;
|
||||
case "RIL:SetCallForwardingOptions":
|
||||
this.setCallForwardingOptions(msg.target, msg.json.data);
|
||||
case "RIL:SetCallForwardingOption":
|
||||
this.setCallForwardingOption(msg.target, msg.json.data);
|
||||
break;
|
||||
case "RIL:GetCallForwardingOptions":
|
||||
case "RIL:GetCallForwardingOption":
|
||||
this.workerMessenger.sendWithIPCMessage(msg, "queryCallForwardStatus");
|
||||
break;
|
||||
case "RIL:SetCallBarringOptions":
|
||||
case "RIL:SetCallBarringOption":
|
||||
this.workerMessenger.sendWithIPCMessage(msg, "setCallBarring");
|
||||
break;
|
||||
case "RIL:GetCallBarringOptions":
|
||||
case "RIL:GetCallBarringOption":
|
||||
this.workerMessenger.sendWithIPCMessage(msg, "queryCallBarringStatus");
|
||||
break;
|
||||
case "RIL:ChangeCallBarringPassword":
|
||||
this.workerMessenger.sendWithIPCMessage(msg, "changeCallBarringPassword");
|
||||
break;
|
||||
case "RIL:SetCallWaitingOptions":
|
||||
case "RIL:SetCallWaitingOption":
|
||||
this.workerMessenger.sendWithIPCMessage(msg, "setCallWaiting");
|
||||
break;
|
||||
case "RIL:GetCallWaitingOptions":
|
||||
case "RIL:GetCallWaitingOption":
|
||||
this.workerMessenger.sendWithIPCMessage(msg, "queryCallWaiting");
|
||||
break;
|
||||
case "RIL:SetCallingLineIdRestriction":
|
||||
@ -2406,12 +2406,12 @@ RadioInterface.prototype = {
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
setCallForwardingOptions: function setCallForwardingOptions(target, message) {
|
||||
if (DEBUG) this.debug("setCallForwardingOptions: " + JSON.stringify(message));
|
||||
setCallForwardingOption: function setCallForwardingOption(target, message) {
|
||||
if (DEBUG) this.debug("setCallForwardingOption: " + JSON.stringify(message));
|
||||
message.serviceClass = RIL.ICC_SERVICE_CLASS_VOICE;
|
||||
this.workerMessenger.send("setCallForward", message, (function(response) {
|
||||
this._sendCfStateChanged(response);
|
||||
target.sendAsyncMessage("RIL:SetCallForwardingOptions", {
|
||||
target.sendAsyncMessage("RIL:SetCallForwardingOption", {
|
||||
clientId: this.clientId,
|
||||
data: response
|
||||
});
|
||||
|
@ -114,11 +114,11 @@ partial interface HTMLMediaElement {
|
||||
// used within MozAudioAvailable events to be changed. The new size must
|
||||
// be between 512 and 16384. The default size, for a media element with
|
||||
// audio is (mozChannels * 1024).
|
||||
[GetterThrows]
|
||||
[Pref="media.audio_data.enabled", GetterThrows]
|
||||
readonly attribute unsigned long mozChannels;
|
||||
[GetterThrows]
|
||||
[Pref="media.audio_data.enabled", GetterThrows]
|
||||
readonly attribute unsigned long mozSampleRate;
|
||||
[Throws]
|
||||
[Pref="media.audio_data.enabled", Throws]
|
||||
attribute unsigned long mozFrameBufferLength;
|
||||
|
||||
// Mozilla extension: return embedded metadata from the stream as a
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "mozilla/dom/DocumentFragment.h"
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Selection.h"
|
||||
#include "mozilla/Util.h"
|
||||
|
@ -14,7 +14,7 @@ DIRS += [
|
||||
if CONFIG['MOZ_B2G_RIL']:
|
||||
DIRS += ['ril']
|
||||
|
||||
if CONFIG['MOZ_B2G_BT']:
|
||||
if CONFIG['MOZ_B2G_BT_BLUEZ']:
|
||||
DIRS += ['dbus']
|
||||
|
||||
if CONFIG['MOZ_B2G_RIL'] or CONFIG['MOZ_B2G_BT']:
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/un.h>
|
||||
#include <netinet/in.h>
|
||||
#ifdef MOZ_B2G_BT
|
||||
#ifdef MOZ_B2G_BT_BLUEZ
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/sco.h>
|
||||
#include <bluetooth/l2cap.h>
|
||||
@ -31,7 +31,7 @@ union sockaddr_any {
|
||||
sockaddr_un un;
|
||||
sockaddr_in in;
|
||||
sockaddr_in6 in6;
|
||||
#ifdef MOZ_B2G_BT
|
||||
#ifdef MOZ_B2G_BT_BLUEZ
|
||||
sockaddr_sco sco;
|
||||
sockaddr_rc rc;
|
||||
sockaddr_l2 l2;
|
||||
|
@ -25,6 +25,37 @@
|
||||
|
||||
class nsISupports; // Needed for ObjectPrivateVisitor.
|
||||
|
||||
namespace JS {
|
||||
|
||||
struct TabSizes
|
||||
{
|
||||
enum Kind {
|
||||
Objects,
|
||||
Strings,
|
||||
Private,
|
||||
Other
|
||||
};
|
||||
|
||||
TabSizes() { mozilla::PodZero(this); }
|
||||
|
||||
void add(Kind kind, size_t n) {
|
||||
switch (kind) {
|
||||
case Objects: objects += n; break;
|
||||
case Strings: strings += n; break;
|
||||
case Private: private_ += n; break;
|
||||
case Other: other += n; break;
|
||||
default: MOZ_CRASH("bad TabSizes kind");
|
||||
}
|
||||
}
|
||||
|
||||
size_t objects;
|
||||
size_t strings;
|
||||
size_t private_;
|
||||
size_t other;
|
||||
};
|
||||
|
||||
} // namespace JS
|
||||
|
||||
namespace js {
|
||||
|
||||
// In memory reporting, we have concept of "sundries", line items which are too
|
||||
@ -57,11 +88,12 @@ struct InefficientNonFlatteningStringHashPolicy
|
||||
// In some classes, one or more of the macro arguments aren't used. We use '_'
|
||||
// for those.
|
||||
//
|
||||
#define DECL_SIZE(gc, mSize) size_t mSize;
|
||||
#define ZERO_SIZE(gc, mSize) mSize(0),
|
||||
#define COPY_OTHER_SIZE(gc, mSize) mSize(other.mSize),
|
||||
#define ADD_OTHER_SIZE(gc, mSize) mSize += other.mSize;
|
||||
#define ADD_SIZE_TO_N_IF_LIVE_GC_THING(gc, mSize) n += (gc) ? mSize : 0;
|
||||
#define DECL_SIZE(kind, gc, mSize) size_t mSize;
|
||||
#define ZERO_SIZE(kind, gc, mSize) mSize(0),
|
||||
#define COPY_OTHER_SIZE(kind, gc, mSize) mSize(other.mSize),
|
||||
#define ADD_OTHER_SIZE(kind, gc, mSize) mSize += other.mSize;
|
||||
#define ADD_SIZE_TO_N_IF_LIVE_GC_THING(kind, gc, mSize) n += (js::gc == js::IsLiveGCThing) ? mSize : 0;
|
||||
#define ADD_TO_TAB_SIZES(kind, gc, mSize) sizes->add(JS::TabSizes::kind, mSize);
|
||||
|
||||
// Used to annotate which size_t fields measure live GC things and which don't.
|
||||
enum {
|
||||
@ -72,17 +104,17 @@ enum {
|
||||
struct ZoneStatsPod
|
||||
{
|
||||
#define FOR_EACH_SIZE(macro) \
|
||||
macro(NotLiveGCThing, gcHeapArenaAdmin) \
|
||||
macro(NotLiveGCThing, unusedGCThings) \
|
||||
macro(IsLiveGCThing, lazyScriptsGCHeap) \
|
||||
macro(NotLiveGCThing, lazyScriptsMallocHeap) \
|
||||
macro(IsLiveGCThing, ionCodesGCHeap) \
|
||||
macro(IsLiveGCThing, typeObjectsGCHeap) \
|
||||
macro(NotLiveGCThing, typeObjectsMallocHeap) \
|
||||
macro(NotLiveGCThing, typePool) \
|
||||
macro(IsLiveGCThing, stringsShortGCHeap) \
|
||||
macro(IsLiveGCThing, stringsNormalGCHeap) \
|
||||
macro(NotLiveGCThing, stringsNormalMallocHeap)
|
||||
macro(Other, NotLiveGCThing, gcHeapArenaAdmin) \
|
||||
macro(Other, NotLiveGCThing, unusedGCThings) \
|
||||
macro(Other, IsLiveGCThing, lazyScriptsGCHeap) \
|
||||
macro(Other, NotLiveGCThing, lazyScriptsMallocHeap) \
|
||||
macro(Other, IsLiveGCThing, ionCodesGCHeap) \
|
||||
macro(Other, IsLiveGCThing, typeObjectsGCHeap) \
|
||||
macro(Other, NotLiveGCThing, typeObjectsMallocHeap) \
|
||||
macro(Other, NotLiveGCThing, typePool) \
|
||||
macro(Strings, IsLiveGCThing, stringsShortGCHeap) \
|
||||
macro(Strings, IsLiveGCThing, stringsNormalGCHeap) \
|
||||
macro(Strings, NotLiveGCThing, stringsNormalMallocHeap)
|
||||
|
||||
ZoneStatsPod()
|
||||
: FOR_EACH_SIZE(ZERO_SIZE)
|
||||
@ -101,6 +133,11 @@ struct ZoneStatsPod
|
||||
return n;
|
||||
}
|
||||
|
||||
void addToTabSizes(JS::TabSizes *sizes) const {
|
||||
FOR_EACH_SIZE(ADD_TO_TAB_SIZES)
|
||||
// Do nothing with |extra|.
|
||||
}
|
||||
|
||||
FOR_EACH_SIZE(DECL_SIZE)
|
||||
void *extra; // This field can be used by embedders.
|
||||
|
||||
@ -115,16 +152,16 @@ namespace JS {
|
||||
struct ObjectsExtraSizes
|
||||
{
|
||||
#define FOR_EACH_SIZE(macro) \
|
||||
macro(js::NotLiveGCThing, mallocHeapSlots) \
|
||||
macro(js::NotLiveGCThing, mallocHeapElementsNonAsmJS) \
|
||||
macro(js::NotLiveGCThing, mallocHeapElementsAsmJS) \
|
||||
macro(js::NotLiveGCThing, nonHeapElementsAsmJS) \
|
||||
macro(js::NotLiveGCThing, nonHeapCodeAsmJS) \
|
||||
macro(js::NotLiveGCThing, mallocHeapAsmJSModuleData) \
|
||||
macro(js::NotLiveGCThing, mallocHeapArgumentsData) \
|
||||
macro(js::NotLiveGCThing, mallocHeapRegExpStatics) \
|
||||
macro(js::NotLiveGCThing, mallocHeapPropertyIteratorData) \
|
||||
macro(js::NotLiveGCThing, mallocHeapCtypesData)
|
||||
macro(Objects, NotLiveGCThing, mallocHeapSlots) \
|
||||
macro(Objects, NotLiveGCThing, mallocHeapElementsNonAsmJS) \
|
||||
macro(Objects, NotLiveGCThing, mallocHeapElementsAsmJS) \
|
||||
macro(Objects, NotLiveGCThing, nonHeapElementsAsmJS) \
|
||||
macro(Objects, NotLiveGCThing, nonHeapCodeAsmJS) \
|
||||
macro(Objects, NotLiveGCThing, mallocHeapAsmJSModuleData) \
|
||||
macro(Objects, NotLiveGCThing, mallocHeapArgumentsData) \
|
||||
macro(Objects, NotLiveGCThing, mallocHeapRegExpStatics) \
|
||||
macro(Objects, NotLiveGCThing, mallocHeapPropertyIteratorData) \
|
||||
macro(Objects, NotLiveGCThing, mallocHeapCtypesData)
|
||||
|
||||
ObjectsExtraSizes()
|
||||
: FOR_EACH_SIZE(ZERO_SIZE)
|
||||
@ -141,6 +178,10 @@ struct ObjectsExtraSizes
|
||||
return n;
|
||||
}
|
||||
|
||||
void addToTabSizes(TabSizes *sizes) const {
|
||||
FOR_EACH_SIZE(ADD_TO_TAB_SIZES)
|
||||
}
|
||||
|
||||
FOR_EACH_SIZE(DECL_SIZE)
|
||||
int dummy; // present just to absorb the trailing comma from FOR_EACH_SIZE(ZERO_SIZE)
|
||||
|
||||
@ -151,11 +192,11 @@ struct ObjectsExtraSizes
|
||||
struct CodeSizes
|
||||
{
|
||||
#define FOR_EACH_SIZE(macro) \
|
||||
macro(_, ion) \
|
||||
macro(_, baseline) \
|
||||
macro(_, regexp) \
|
||||
macro(_, other) \
|
||||
macro(_, unused)
|
||||
macro(_, _, ion) \
|
||||
macro(_, _, baseline) \
|
||||
macro(_, _, regexp) \
|
||||
macro(_, _, other) \
|
||||
macro(_, _, unused)
|
||||
|
||||
CodeSizes()
|
||||
: FOR_EACH_SIZE(ZERO_SIZE)
|
||||
@ -256,17 +297,17 @@ struct NotableStringInfo : public StringInfo
|
||||
struct RuntimeSizes
|
||||
{
|
||||
#define FOR_EACH_SIZE(macro) \
|
||||
macro(_, object) \
|
||||
macro(_, atomsTable) \
|
||||
macro(_, contexts) \
|
||||
macro(_, dtoa) \
|
||||
macro(_, temporary) \
|
||||
macro(_, regexpData) \
|
||||
macro(_, interpreterStack) \
|
||||
macro(_, gcMarker) \
|
||||
macro(_, mathCache) \
|
||||
macro(_, scriptData) \
|
||||
macro(_, scriptSources)
|
||||
macro(_, _, object) \
|
||||
macro(_, _, atomsTable) \
|
||||
macro(_, _, contexts) \
|
||||
macro(_, _, dtoa) \
|
||||
macro(_, _, temporary) \
|
||||
macro(_, _, regexpData) \
|
||||
macro(_, _, interpreterStack) \
|
||||
macro(_, _, gcMarker) \
|
||||
macro(_, _, mathCache) \
|
||||
macro(_, _, scriptData) \
|
||||
macro(_, _, scriptSources)
|
||||
|
||||
RuntimeSizes()
|
||||
: FOR_EACH_SIZE(ZERO_SIZE)
|
||||
@ -335,35 +376,35 @@ struct ZoneStats : js::ZoneStatsPod
|
||||
struct CompartmentStats
|
||||
{
|
||||
#define FOR_EACH_SIZE(macro) \
|
||||
macro(js::IsLiveGCThing, objectsGCHeapOrdinary) \
|
||||
macro(js::IsLiveGCThing, objectsGCHeapFunction) \
|
||||
macro(js::IsLiveGCThing, objectsGCHeapDenseArray) \
|
||||
macro(js::IsLiveGCThing, objectsGCHeapSlowArray) \
|
||||
macro(js::IsLiveGCThing, objectsGCHeapCrossCompartmentWrapper) \
|
||||
macro(js::NotLiveGCThing, objectsPrivate) \
|
||||
macro(js::IsLiveGCThing, shapesGCHeapTreeGlobalParented) \
|
||||
macro(js::IsLiveGCThing, shapesGCHeapTreeNonGlobalParented) \
|
||||
macro(js::IsLiveGCThing, shapesGCHeapDict) \
|
||||
macro(js::IsLiveGCThing, shapesGCHeapBase) \
|
||||
macro(js::NotLiveGCThing, shapesMallocHeapTreeTables) \
|
||||
macro(js::NotLiveGCThing, shapesMallocHeapDictTables) \
|
||||
macro(js::NotLiveGCThing, shapesMallocHeapTreeShapeKids) \
|
||||
macro(js::NotLiveGCThing, shapesMallocHeapCompartmentTables) \
|
||||
macro(js::IsLiveGCThing, scriptsGCHeap) \
|
||||
macro(js::NotLiveGCThing, scriptsMallocHeapData) \
|
||||
macro(js::NotLiveGCThing, baselineData) \
|
||||
macro(js::NotLiveGCThing, baselineStubsFallback) \
|
||||
macro(js::NotLiveGCThing, baselineStubsOptimized) \
|
||||
macro(js::NotLiveGCThing, ionData) \
|
||||
macro(js::NotLiveGCThing, typeInferenceTypeScripts) \
|
||||
macro(js::NotLiveGCThing, typeInferencePendingArrays) \
|
||||
macro(js::NotLiveGCThing, typeInferenceAllocationSiteTables) \
|
||||
macro(js::NotLiveGCThing, typeInferenceArrayTypeTables) \
|
||||
macro(js::NotLiveGCThing, typeInferenceObjectTypeTables) \
|
||||
macro(js::NotLiveGCThing, compartmentObject) \
|
||||
macro(js::NotLiveGCThing, crossCompartmentWrappersTable) \
|
||||
macro(js::NotLiveGCThing, regexpCompartment) \
|
||||
macro(js::NotLiveGCThing, debuggeesSet)
|
||||
macro(Objects, IsLiveGCThing, objectsGCHeapOrdinary) \
|
||||
macro(Objects, IsLiveGCThing, objectsGCHeapFunction) \
|
||||
macro(Objects, IsLiveGCThing, objectsGCHeapDenseArray) \
|
||||
macro(Objects, IsLiveGCThing, objectsGCHeapSlowArray) \
|
||||
macro(Objects, IsLiveGCThing, objectsGCHeapCrossCompartmentWrapper) \
|
||||
macro(Private, NotLiveGCThing, objectsPrivate) \
|
||||
macro(Other, IsLiveGCThing, shapesGCHeapTreeGlobalParented) \
|
||||
macro(Other, IsLiveGCThing, shapesGCHeapTreeNonGlobalParented) \
|
||||
macro(Other, IsLiveGCThing, shapesGCHeapDict) \
|
||||
macro(Other, IsLiveGCThing, shapesGCHeapBase) \
|
||||
macro(Other, NotLiveGCThing, shapesMallocHeapTreeTables) \
|
||||
macro(Other, NotLiveGCThing, shapesMallocHeapDictTables) \
|
||||
macro(Other, NotLiveGCThing, shapesMallocHeapTreeShapeKids) \
|
||||
macro(Other, NotLiveGCThing, shapesMallocHeapCompartmentTables) \
|
||||
macro(Other, IsLiveGCThing, scriptsGCHeap) \
|
||||
macro(Other, NotLiveGCThing, scriptsMallocHeapData) \
|
||||
macro(Other, NotLiveGCThing, baselineData) \
|
||||
macro(Other, NotLiveGCThing, baselineStubsFallback) \
|
||||
macro(Other, NotLiveGCThing, baselineStubsOptimized) \
|
||||
macro(Other, NotLiveGCThing, ionData) \
|
||||
macro(Other, NotLiveGCThing, typeInferenceTypeScripts) \
|
||||
macro(Other, NotLiveGCThing, typeInferencePendingArrays) \
|
||||
macro(Other, NotLiveGCThing, typeInferenceAllocationSiteTables) \
|
||||
macro(Other, NotLiveGCThing, typeInferenceArrayTypeTables) \
|
||||
macro(Other, NotLiveGCThing, typeInferenceObjectTypeTables) \
|
||||
macro(Other, NotLiveGCThing, compartmentObject) \
|
||||
macro(Other, NotLiveGCThing, crossCompartmentWrappersTable) \
|
||||
macro(Other, NotLiveGCThing, regexpCompartment) \
|
||||
macro(Other, NotLiveGCThing, debuggeesSet)
|
||||
|
||||
CompartmentStats()
|
||||
: FOR_EACH_SIZE(ZERO_SIZE)
|
||||
@ -391,6 +432,12 @@ struct CompartmentStats
|
||||
return n;
|
||||
}
|
||||
|
||||
void addToTabSizes(TabSizes *sizes) const {
|
||||
FOR_EACH_SIZE(ADD_TO_TAB_SIZES);
|
||||
objectsExtra.addToTabSizes(sizes);
|
||||
// Do nothing with |extra|.
|
||||
}
|
||||
|
||||
FOR_EACH_SIZE(DECL_SIZE)
|
||||
ObjectsExtraSizes objectsExtra;
|
||||
void *extra; // This field can be used by embedders.
|
||||
@ -401,12 +448,12 @@ struct CompartmentStats
|
||||
struct RuntimeStats
|
||||
{
|
||||
#define FOR_EACH_SIZE(macro) \
|
||||
macro(_, gcHeapChunkTotal) \
|
||||
macro(_, gcHeapDecommittedArenas) \
|
||||
macro(_, gcHeapUnusedChunks) \
|
||||
macro(_, gcHeapUnusedArenas) \
|
||||
macro(_, gcHeapChunkAdmin) \
|
||||
macro(_, gcHeapGCThings) \
|
||||
macro(_, _, gcHeapChunkTotal) \
|
||||
macro(_, _, gcHeapDecommittedArenas) \
|
||||
macro(_, _, gcHeapUnusedChunks) \
|
||||
macro(_, _, gcHeapUnusedArenas) \
|
||||
macro(_, _, gcHeapChunkAdmin) \
|
||||
macro(_, _, gcHeapGCThings) \
|
||||
|
||||
RuntimeStats(mozilla::MallocSizeOf mallocSizeOf)
|
||||
: FOR_EACH_SIZE(ZERO_SIZE)
|
||||
@ -488,6 +535,17 @@ UserCompartmentCount(JSRuntime *rt);
|
||||
extern JS_PUBLIC_API(size_t)
|
||||
PeakSizeOfTemporary(const JSRuntime *rt);
|
||||
|
||||
extern JS_PUBLIC_API(bool)
|
||||
AddSizeOfTab(JSRuntime *rt, JSObject *obj, mozilla::MallocSizeOf mallocSizeOf,
|
||||
ObjectPrivateVisitor *opv, TabSizes *sizes);
|
||||
|
||||
} // namespace JS
|
||||
|
||||
#undef DECL_SIZE
|
||||
#undef ZERO_SIZE
|
||||
#undef COPY_OTHER_SIZE
|
||||
#undef ADD_OTHER_SIZE
|
||||
#undef ADD_SIZE_TO_N_IF_LIVE_GC_THING
|
||||
#undef ADD_TO_TAB_SIZES
|
||||
|
||||
#endif /* js_MemoryMetrics_h */
|
||||
|
@ -26,6 +26,28 @@ js::TraceRuntime(JSTracer *trc)
|
||||
MarkRuntime(trc);
|
||||
}
|
||||
|
||||
static void
|
||||
IterateCompartmentsArenasCells(JSRuntime *rt, Zone *zone, void *data,
|
||||
JSIterateCompartmentCallback compartmentCallback,
|
||||
IterateArenaCallback arenaCallback,
|
||||
IterateCellCallback cellCallback)
|
||||
{
|
||||
for (CompartmentsInZoneIter comp(zone); !comp.done(); comp.next())
|
||||
(*compartmentCallback)(rt, data, comp);
|
||||
|
||||
for (size_t thingKind = 0; thingKind != FINALIZE_LIMIT; thingKind++) {
|
||||
JSGCTraceKind traceKind = MapAllocToTraceKind(AllocKind(thingKind));
|
||||
size_t thingSize = Arena::thingSize(AllocKind(thingKind));
|
||||
|
||||
for (ArenaIter aiter(zone, AllocKind(thingKind)); !aiter.done(); aiter.next()) {
|
||||
ArenaHeader *aheader = aiter.get();
|
||||
(*arenaCallback)(rt, data, aheader->getArena(), traceKind, thingSize);
|
||||
for (CellIterUnderGC iter(aheader); !iter.done(); iter.next())
|
||||
(*cellCallback)(rt, data, iter.getCell(), traceKind, thingSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
js::IterateZonesCompartmentsArenasCells(JSRuntime *rt, void *data,
|
||||
IterateZoneCallback zoneCallback,
|
||||
@ -37,24 +59,25 @@ js::IterateZonesCompartmentsArenasCells(JSRuntime *rt, void *data,
|
||||
|
||||
for (ZonesIter zone(rt); !zone.done(); zone.next()) {
|
||||
(*zoneCallback)(rt, data, zone);
|
||||
|
||||
for (CompartmentsInZoneIter comp(zone); !comp.done(); comp.next())
|
||||
(*compartmentCallback)(rt, data, comp);
|
||||
|
||||
for (size_t thingKind = 0; thingKind != FINALIZE_LIMIT; thingKind++) {
|
||||
JSGCTraceKind traceKind = MapAllocToTraceKind(AllocKind(thingKind));
|
||||
size_t thingSize = Arena::thingSize(AllocKind(thingKind));
|
||||
|
||||
for (ArenaIter aiter(zone, AllocKind(thingKind)); !aiter.done(); aiter.next()) {
|
||||
ArenaHeader *aheader = aiter.get();
|
||||
(*arenaCallback)(rt, data, aheader->getArena(), traceKind, thingSize);
|
||||
for (CellIterUnderGC iter(aheader); !iter.done(); iter.next())
|
||||
(*cellCallback)(rt, data, iter.getCell(), traceKind, thingSize);
|
||||
}
|
||||
}
|
||||
IterateCompartmentsArenasCells(rt, zone, data,
|
||||
compartmentCallback, arenaCallback, cellCallback);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
js::IterateZoneCompartmentsArenasCells(JSRuntime *rt, Zone *zone, void *data,
|
||||
IterateZoneCallback zoneCallback,
|
||||
JSIterateCompartmentCallback compartmentCallback,
|
||||
IterateArenaCallback arenaCallback,
|
||||
IterateCellCallback cellCallback)
|
||||
{
|
||||
AutoPrepareForTracing prop(rt);
|
||||
|
||||
(*zoneCallback)(rt, data, zone);
|
||||
IterateCompartmentsArenasCells(rt, zone, data,
|
||||
compartmentCallback, arenaCallback, cellCallback);
|
||||
}
|
||||
|
||||
void
|
||||
js::IterateChunks(JSRuntime *rt, void *data, IterateChunkCallback chunkCallback)
|
||||
{
|
||||
|
@ -1274,9 +1274,9 @@ typedef void (*IterateCellCallback)(JSRuntime *rt, void *data, void *thing,
|
||||
JSGCTraceKind traceKind, size_t thingSize);
|
||||
|
||||
/*
|
||||
* This function calls |compartmentCallback| on every compartment,
|
||||
* |arenaCallback| on every in-use arena, and |cellCallback| on every in-use
|
||||
* cell in the GC heap.
|
||||
* This function calls |zoneCallback| on every zone, |compartmentCallback| on
|
||||
* every compartment, |arenaCallback| on every in-use arena, and |cellCallback|
|
||||
* on every in-use cell in the GC heap.
|
||||
*/
|
||||
extern void
|
||||
IterateZonesCompartmentsArenasCells(JSRuntime *rt, void *data,
|
||||
@ -1285,6 +1285,17 @@ IterateZonesCompartmentsArenasCells(JSRuntime *rt, void *data,
|
||||
IterateArenaCallback arenaCallback,
|
||||
IterateCellCallback cellCallback);
|
||||
|
||||
/*
|
||||
* This function is like IterateZonesCompartmentsArenasCells, but does it for a
|
||||
* single zone.
|
||||
*/
|
||||
extern void
|
||||
IterateZoneCompartmentsArenasCells(JSRuntime *rt, Zone *zone, void *data,
|
||||
IterateZoneCallback zoneCallback,
|
||||
JSIterateCompartmentCallback compartmentCallback,
|
||||
IterateArenaCallback arenaCallback,
|
||||
IterateCellCallback cellCallback);
|
||||
|
||||
/*
|
||||
* Invoke chunkCallback on every in-use chunk.
|
||||
*/
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "js/OldDebugAPI.h"
|
||||
#include "vm/ArgumentsObject.h"
|
||||
#include "vm/Interpreter.h"
|
||||
#include "vm/ProxyObject.h"
|
||||
#include "vm/RegExpStaticsObject.h"
|
||||
#include "vm/Shape.h"
|
||||
|
||||
@ -5680,8 +5681,24 @@ JSObject::addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::Objects
|
||||
}
|
||||
|
||||
// Other things may be measured in the future if DMD indicates it is worthwhile.
|
||||
// Note that sizes->private_ is measured elsewhere.
|
||||
if (is<ArgumentsObject>()) {
|
||||
if (is<JSFunction>() ||
|
||||
is<JSObject>() ||
|
||||
is<ArrayObject>() ||
|
||||
is<CallObject>() ||
|
||||
is<RegExpObject>() ||
|
||||
is<ProxyObject>())
|
||||
{
|
||||
// Do nothing. But this function is hot, and we win by getting the
|
||||
// common cases out of the way early. Some stats on the most common
|
||||
// classes, as measured during a vanilla browser session:
|
||||
// - (53.7%, 53.7%): Function
|
||||
// - (18.0%, 71.7%): Object
|
||||
// - (16.9%, 88.6%): Array
|
||||
// - ( 3.9%, 92.5%): Call
|
||||
// - ( 2.8%, 95.3%): RegExp
|
||||
// - ( 1.0%, 96.4%): Proxy
|
||||
|
||||
} else if (is<ArgumentsObject>()) {
|
||||
sizes->mallocHeapArgumentsData += as<ArgumentsObject>().sizeOfMisc(mallocSizeOf);
|
||||
} else if (is<RegExpStaticsObject>()) {
|
||||
sizes->mallocHeapRegExpStatics += as<RegExpStaticsObject>().sizeOfData(mallocSizeOf);
|
||||
|
@ -378,7 +378,7 @@ class JSObject : public js::ObjectImpl
|
||||
static void shrinkSlots(js::ThreadSafeContext *cx, js::HandleObject obj, uint32_t oldCount,
|
||||
uint32_t newCount);
|
||||
|
||||
bool hasDynamicSlots() const { return slots != nullptr; }
|
||||
bool hasDynamicSlots() const { return !!slots; }
|
||||
|
||||
protected:
|
||||
static inline bool updateSlotsForSpan(js::ThreadSafeContext *cx,
|
||||
|
@ -23,8 +23,9 @@
|
||||
#include "vm/WrapperObject.h"
|
||||
|
||||
using mozilla::DebugOnly;
|
||||
using mozilla::OldMove;
|
||||
using mozilla::MallocSizeOf;
|
||||
using mozilla::MoveRef;
|
||||
using mozilla::OldMove;
|
||||
using mozilla::PodEqual;
|
||||
|
||||
using namespace js;
|
||||
@ -268,13 +269,10 @@ StatsCellCallback(JSRuntime *rt, void *data, void *thing, JSGCTraceKind traceKin
|
||||
|
||||
obj->addSizeOfExcludingThis(rtStats->mallocSizeOf_, &cStats->objectsExtra);
|
||||
|
||||
// JSObject::sizeOfExcludingThis() doesn't measure objectsPrivate,
|
||||
// so we do it here.
|
||||
if (ObjectPrivateVisitor *opv = closure->opv) {
|
||||
nsISupports *iface;
|
||||
if (opv->getISupports_(obj, &iface) && iface) {
|
||||
if (opv->getISupports_(obj, &iface) && iface)
|
||||
cStats->objectsPrivate += opv->sizeOfIncludingThis(iface);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -338,7 +336,6 @@ StatsCellCallback(JSRuntime *rt, void *data, void *thing, JSGCTraceKind traceKin
|
||||
JSScript *script = static_cast<JSScript *>(thing);
|
||||
CompartmentStats *cStats = GetCompartmentStats(script->compartment());
|
||||
cStats->scriptsGCHeap += thingSize;
|
||||
|
||||
cStats->scriptsMallocHeapData += script->sizeOfData(rtStats->mallocSizeOf_);
|
||||
cStats->typeInferenceTypeScripts += script->sizeOfTypeScript(rtStats->mallocSizeOf_);
|
||||
#ifdef JS_ION
|
||||
@ -446,14 +443,12 @@ JS::CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats, ObjectPrivateVisit
|
||||
StatsClosure closure(rtStats, opv);
|
||||
if (!closure.init())
|
||||
return false;
|
||||
rtStats->runtime.scriptSources = 0;
|
||||
IterateZonesCompartmentsArenasCells(rt, &closure, StatsZoneCallback, StatsCompartmentCallback,
|
||||
StatsArenaCallback, StatsCellCallback);
|
||||
|
||||
// Take the "explicit/js/runtime/" measurements.
|
||||
rt->addSizeOfIncludingThis(rtStats->mallocSizeOf_, &rtStats->runtime);
|
||||
|
||||
rtStats->gcHeapGCThings = 0;
|
||||
for (size_t i = 0; i < rtStats->zoneStatsVector.length(); i++) {
|
||||
ZoneStats &zStats = rtStats->zoneStatsVector[i];
|
||||
|
||||
@ -531,3 +526,62 @@ JS::PeakSizeOfTemporary(const JSRuntime *rt)
|
||||
return rt->tempLifoAlloc.peakSizeOfExcludingThis();
|
||||
}
|
||||
|
||||
namespace JS {
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
AddSizeOfTab(JSRuntime *rt, JSObject *obj, MallocSizeOf mallocSizeOf, ObjectPrivateVisitor *opv,
|
||||
TabSizes *sizes)
|
||||
{
|
||||
class SimpleJSRuntimeStats : public JS::RuntimeStats
|
||||
{
|
||||
public:
|
||||
SimpleJSRuntimeStats(MallocSizeOf mallocSizeOf)
|
||||
: JS::RuntimeStats(mallocSizeOf)
|
||||
{}
|
||||
|
||||
virtual void initExtraZoneStats(JS::Zone *zone, JS::ZoneStats *zStats)
|
||||
MOZ_OVERRIDE
|
||||
{}
|
||||
|
||||
virtual void initExtraCompartmentStats(
|
||||
JSCompartment *c, JS::CompartmentStats *cStats) MOZ_OVERRIDE
|
||||
{}
|
||||
};
|
||||
|
||||
SimpleJSRuntimeStats rtStats(mallocSizeOf);
|
||||
|
||||
JS::Zone *zone = GetObjectZone(obj);
|
||||
|
||||
if (!rtStats.compartmentStatsVector.reserve(zone->compartments.length()))
|
||||
return false;
|
||||
|
||||
if (!rtStats.zoneStatsVector.reserve(1))
|
||||
return false;
|
||||
|
||||
// Take the per-compartment measurements.
|
||||
StatsClosure closure(&rtStats, opv);
|
||||
if (!closure.init())
|
||||
return false;
|
||||
IterateZoneCompartmentsArenasCells(rt, zone, &closure, StatsZoneCallback,
|
||||
StatsCompartmentCallback, StatsArenaCallback,
|
||||
StatsCellCallback);
|
||||
|
||||
JS_ASSERT(rtStats.zoneStatsVector.length() == 1);
|
||||
rtStats.zTotals.add(rtStats.zoneStatsVector[0]);
|
||||
|
||||
for (size_t i = 0; i < rtStats.compartmentStatsVector.length(); i++) {
|
||||
CompartmentStats &cStats = rtStats.compartmentStatsVector[i];
|
||||
rtStats.cTotals.add(cStats);
|
||||
}
|
||||
|
||||
for (CompartmentsInZoneIter comp(zone); !comp.done(); comp.next())
|
||||
comp->compartmentStats = NULL;
|
||||
|
||||
rtStats.zTotals.addToTabSizes(sizes);
|
||||
rtStats.cTotals.addToTabSizes(sizes);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace JS
|
||||
|
||||
|
@ -2416,7 +2416,7 @@ class OrphanReporter : public JS::ObjectPrivateVisitor
|
||||
{
|
||||
}
|
||||
|
||||
virtual size_t sizeOfIncludingThis(nsISupports *aSupports) {
|
||||
virtual size_t sizeOfIncludingThis(nsISupports *aSupports) MOZ_OVERRIDE {
|
||||
size_t n = 0;
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aSupports);
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=773533#c11 explains
|
||||
@ -2674,6 +2674,25 @@ JSReporter::CollectReports(WindowPaths *windowPaths,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
JSSizeOfTab(JSObject *obj, size_t *jsObjectsSize, size_t *jsStringsSize,
|
||||
size_t *jsPrivateSize, size_t *jsOtherSize)
|
||||
{
|
||||
JSRuntime *rt = nsXPConnect::GetRuntimeInstance()->Runtime();
|
||||
|
||||
TabSizes sizes;
|
||||
OrphanReporter orphanReporter(XPCConvert::GetISupportsFromJSObject);
|
||||
NS_ENSURE_TRUE(JS::AddSizeOfTab(rt, obj, moz_malloc_size_of,
|
||||
&orphanReporter, &sizes),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
*jsObjectsSize = sizes.objects;
|
||||
*jsStringsSize = sizes.strings;
|
||||
*jsPrivateSize = sizes.private_;
|
||||
*jsOtherSize = sizes.other;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace xpc
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
@ -3040,6 +3059,7 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
|
||||
RegisterJSMainRuntimeTemporaryPeakDistinguishedAmount(JSMainRuntimeTemporaryPeakDistinguishedAmount);
|
||||
RegisterJSMainRuntimeCompartmentsSystemDistinguishedAmount(JSMainRuntimeCompartmentsSystemDistinguishedAmount);
|
||||
RegisterJSMainRuntimeCompartmentsUserDistinguishedAmount(JSMainRuntimeCompartmentsUserDistinguishedAmount);
|
||||
mozilla::RegisterJSSizeOfTab(JSSizeOfTab);
|
||||
|
||||
// Install a JavaScript 'debugger' keyword handler in debug builds only
|
||||
#ifdef DEBUG
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
@ -5,16 +7,75 @@
|
||||
#ifndef nsArenaMemoryStats_h
|
||||
#define nsArenaMemoryStats_h
|
||||
|
||||
#define FRAME_ID_STAT_FIELD(classname) mArena##classname
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/PodOperations.h"
|
||||
|
||||
struct nsArenaMemoryStats {
|
||||
#define FRAME_ID(classname) size_t FRAME_ID_STAT_FIELD(classname);
|
||||
#include "nsFrameIdList.h"
|
||||
#undef FRAME_ID
|
||||
size_t mLineBoxes;
|
||||
size_t mRuleNodes;
|
||||
size_t mStyleContexts;
|
||||
class nsTabSizes {
|
||||
public:
|
||||
enum Kind {
|
||||
DOM, // DOM stuff.
|
||||
Style, // Style stuff.
|
||||
Other // Everything else.
|
||||
};
|
||||
|
||||
nsTabSizes() { mozilla::PodZero(this); }
|
||||
|
||||
void add(Kind kind, size_t n)
|
||||
{
|
||||
switch (kind) {
|
||||
case DOM: mDom += n; break;
|
||||
case Style: mStyle += n; break;
|
||||
case Other: mOther += n; break;
|
||||
default: MOZ_CRASH("bad nsTabSizes kind");
|
||||
}
|
||||
}
|
||||
|
||||
size_t mDom;
|
||||
size_t mStyle;
|
||||
size_t mOther;
|
||||
};
|
||||
|
||||
#define FRAME_ID_STAT_FIELD(classname) mArena##classname
|
||||
|
||||
struct nsArenaMemoryStats {
|
||||
#define FOR_EACH_SIZE(macro) \
|
||||
macro(Other, mLineBoxes) \
|
||||
macro(Style, mRuleNodes) \
|
||||
macro(Style, mStyleContexts) \
|
||||
macro(Other, mOther)
|
||||
|
||||
nsArenaMemoryStats()
|
||||
:
|
||||
#define ZERO_SIZE(kind, mSize) mSize(0),
|
||||
FOR_EACH_SIZE(ZERO_SIZE)
|
||||
#undef ZERO_SIZE
|
||||
#define FRAME_ID(classname) FRAME_ID_STAT_FIELD(classname)(),
|
||||
#include "nsFrameIdList.h"
|
||||
#undef FRAME_ID
|
||||
dummy()
|
||||
{}
|
||||
|
||||
void addToTabSizes(nsTabSizes *sizes) const
|
||||
{
|
||||
#define ADD_TO_TAB_SIZES(kind, mSize) sizes->add(nsTabSizes::kind, mSize);
|
||||
FOR_EACH_SIZE(ADD_TO_TAB_SIZES)
|
||||
#undef ADD_TO_TAB_SIZES
|
||||
#define FRAME_ID(classname) \
|
||||
sizes->add(nsTabSizes::Other, FRAME_ID_STAT_FIELD(classname));
|
||||
#include "nsFrameIdList.h"
|
||||
#undef FRAME_ID
|
||||
}
|
||||
|
||||
#define DECL_SIZE(kind, mSize) size_t mSize;
|
||||
FOR_EACH_SIZE(DECL_SIZE)
|
||||
#undef DECL_SIZE
|
||||
#define FRAME_ID(classname) size_t FRAME_ID_STAT_FIELD(classname);
|
||||
#include "nsFrameIdList.h"
|
||||
#undef FRAME_ID
|
||||
int dummy; // present just to absorb the trailing comma from FRAME_ID in the
|
||||
// constructor
|
||||
|
||||
#undef FOR_EACH_SIZE
|
||||
};
|
||||
|
||||
#endif // nsArenaMemoryStats_h
|
||||
|
@ -6091,8 +6091,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
|
||||
if (aEvent->message == NS_KEY_DOWN) {
|
||||
mNoDelayedKeyEvents = true;
|
||||
} else if (!mNoDelayedKeyEvents) {
|
||||
nsDelayedEvent* event =
|
||||
new nsDelayedKeyEvent(aEvent->AsKeyboardEvent());
|
||||
DelayedEvent* event = new DelayedKeyEvent(aEvent->AsKeyboardEvent());
|
||||
if (!mDelayedEvents.AppendElement(event)) {
|
||||
delete event;
|
||||
}
|
||||
@ -6313,7 +6312,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
|
||||
if (aEvent->message == NS_MOUSE_BUTTON_DOWN) {
|
||||
mNoDelayedMouseEvents = true;
|
||||
} else if (!mNoDelayedMouseEvents && aEvent->message == NS_MOUSE_BUTTON_UP) {
|
||||
nsDelayedEvent* event = new nsDelayedMouseEvent(aEvent->AsMouseEvent());
|
||||
DelayedEvent* event = new DelayedMouseEvent(aEvent->AsMouseEvent());
|
||||
if (!mDelayedEvents.AppendElement(event)) {
|
||||
delete event;
|
||||
}
|
||||
@ -6846,8 +6845,8 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, nsEventStatus* aStatus)
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoHandlingUserInputStatePusher userInpStatePusher(isHandlingUserInput,
|
||||
aEvent, mDocument);
|
||||
AutoHandlingUserInputStatePusher userInpStatePusher(isHandlingUserInput,
|
||||
aEvent, mDocument);
|
||||
|
||||
if (aEvent->mFlags.mIsTrusted && aEvent->message == NS_MOUSE_MOVE) {
|
||||
nsIPresShell::AllowMouseCapture(
|
||||
@ -7606,9 +7605,9 @@ PresShell::FireOrClearDelayedEvents(bool aFireEvents)
|
||||
nsCOMPtr<nsIDocument> doc = mDocument;
|
||||
while (!mIsDestroying && mDelayedEvents.Length() &&
|
||||
!doc->EventHandlingSuppressed()) {
|
||||
nsAutoPtr<nsDelayedEvent> ev(mDelayedEvents[0].forget());
|
||||
nsAutoPtr<DelayedEvent> ev(mDelayedEvents[0].forget());
|
||||
mDelayedEvents.RemoveElementAt(0);
|
||||
ev->Dispatch(this);
|
||||
ev->Dispatch();
|
||||
}
|
||||
if (!doc->EventHandlingSuppressed()) {
|
||||
mDelayedEvents.Clear();
|
||||
@ -8319,6 +8318,56 @@ nsIPresShell::RemovePostRefreshObserver(nsAPostRefreshObserver* aObserver)
|
||||
// End of protected and private methods on the PresShell
|
||||
//------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//-- Delayed event Classes Impls
|
||||
//------------------------------------------------------------------
|
||||
|
||||
PresShell::DelayedInputEvent::DelayedInputEvent() :
|
||||
DelayedEvent(),
|
||||
mEvent(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
PresShell::DelayedInputEvent::~DelayedInputEvent()
|
||||
{
|
||||
delete mEvent;
|
||||
}
|
||||
|
||||
void
|
||||
PresShell::DelayedInputEvent::Dispatch()
|
||||
{
|
||||
if (!mEvent || !mEvent->widget) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIWidget> widget = mEvent->widget;
|
||||
nsEventStatus status;
|
||||
widget->DispatchEvent(mEvent, status);
|
||||
}
|
||||
|
||||
PresShell::DelayedMouseEvent::DelayedMouseEvent(WidgetMouseEvent* aEvent) :
|
||||
DelayedInputEvent()
|
||||
{
|
||||
WidgetMouseEvent* mouseEvent =
|
||||
new WidgetMouseEvent(aEvent->mFlags.mIsTrusted,
|
||||
aEvent->message,
|
||||
aEvent->widget,
|
||||
aEvent->reason,
|
||||
aEvent->context);
|
||||
mouseEvent->AssignMouseEventData(*aEvent, false);
|
||||
mEvent = mouseEvent;
|
||||
}
|
||||
|
||||
PresShell::DelayedKeyEvent::DelayedKeyEvent(WidgetKeyboardEvent* aEvent) :
|
||||
DelayedInputEvent()
|
||||
{
|
||||
WidgetKeyboardEvent* keyEvent =
|
||||
new WidgetKeyboardEvent(aEvent->mFlags.mIsTrusted,
|
||||
aEvent->message,
|
||||
aEvent->widget);
|
||||
keyEvent->AssignKeyEventData(*aEvent, false);
|
||||
mEvent = keyEvent;
|
||||
}
|
||||
|
||||
// Start of DEBUG only code
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -34,9 +34,8 @@
|
||||
#include "nsContentUtils.h" // For AddScriptBlocker().
|
||||
#include "nsRefreshDriver.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
|
||||
class nsRange;
|
||||
class nsIDragService;
|
||||
@ -547,67 +546,35 @@ protected:
|
||||
return rv;
|
||||
}
|
||||
|
||||
class nsDelayedEvent
|
||||
class DelayedEvent
|
||||
{
|
||||
public:
|
||||
virtual ~nsDelayedEvent() {};
|
||||
virtual void Dispatch(PresShell* aShell) {}
|
||||
virtual ~DelayedEvent() { }
|
||||
virtual void Dispatch() { }
|
||||
};
|
||||
|
||||
class nsDelayedInputEvent : public nsDelayedEvent
|
||||
class DelayedInputEvent : public DelayedEvent
|
||||
{
|
||||
public:
|
||||
virtual void Dispatch(PresShell* aShell)
|
||||
{
|
||||
if (mEvent && mEvent->widget) {
|
||||
nsCOMPtr<nsIWidget> w = mEvent->widget;
|
||||
nsEventStatus status;
|
||||
w->DispatchEvent(mEvent, status);
|
||||
}
|
||||
}
|
||||
virtual void Dispatch() MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
nsDelayedInputEvent()
|
||||
: nsDelayedEvent(), mEvent(nullptr) {}
|
||||
|
||||
virtual ~nsDelayedInputEvent()
|
||||
{
|
||||
delete mEvent;
|
||||
}
|
||||
DelayedInputEvent();
|
||||
virtual ~DelayedInputEvent();
|
||||
|
||||
mozilla::WidgetInputEvent* mEvent;
|
||||
};
|
||||
|
||||
class nsDelayedMouseEvent : public nsDelayedInputEvent
|
||||
class DelayedMouseEvent : public DelayedInputEvent
|
||||
{
|
||||
public:
|
||||
nsDelayedMouseEvent(mozilla::WidgetMouseEvent* aEvent) :
|
||||
nsDelayedInputEvent()
|
||||
{
|
||||
mozilla::WidgetMouseEvent* mouseEvent =
|
||||
new mozilla::WidgetMouseEvent(aEvent->mFlags.mIsTrusted,
|
||||
aEvent->message,
|
||||
aEvent->widget,
|
||||
aEvent->reason,
|
||||
aEvent->context);
|
||||
mouseEvent->AssignMouseEventData(*aEvent, false);
|
||||
mEvent = mouseEvent;
|
||||
}
|
||||
DelayedMouseEvent(mozilla::WidgetMouseEvent* aEvent);
|
||||
};
|
||||
|
||||
class nsDelayedKeyEvent : public nsDelayedInputEvent
|
||||
class DelayedKeyEvent : public DelayedInputEvent
|
||||
{
|
||||
public:
|
||||
nsDelayedKeyEvent(mozilla::WidgetKeyboardEvent* aEvent) :
|
||||
nsDelayedInputEvent()
|
||||
{
|
||||
mozilla::WidgetKeyboardEvent* keyEvent =
|
||||
new mozilla::WidgetKeyboardEvent(aEvent->mFlags.mIsTrusted,
|
||||
aEvent->message,
|
||||
aEvent->widget);
|
||||
keyEvent->AssignKeyEventData(*aEvent, false);
|
||||
mEvent = keyEvent;
|
||||
}
|
||||
DelayedKeyEvent(mozilla::WidgetKeyboardEvent* aEvent);
|
||||
};
|
||||
|
||||
// Check if aEvent is a mouse event and record the mouse location for later
|
||||
@ -759,7 +726,7 @@ protected:
|
||||
// Reflow roots that need to be reflowed.
|
||||
nsTArray<nsIFrame*> mDirtyRoots;
|
||||
|
||||
nsTArray<nsAutoPtr<nsDelayedEvent> > mDelayedEvents;
|
||||
nsTArray<nsAutoPtr<DelayedEvent> > mDelayedEvents;
|
||||
nsRevocableEventPtr<nsRunnableMethod<PresShell> > mResizeEvent;
|
||||
nsCOMPtr<nsITimer> mAsyncResizeEventTimer;
|
||||
private:
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "nsISelectionPrivate.h"
|
||||
#include "nsRange.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "mozilla/TextRange.h"
|
||||
|
||||
struct CachedOffsetForFrame;
|
||||
class nsAutoScrollTimer;
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/Selection.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "mozilla/TextRange.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
@ -145,7 +145,6 @@ extern "C" {
|
||||
#endif /* #if defined(XP_MACOSX) && !defined(__LP64__) */
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::plugins;
|
||||
using namespace mozilla::layers;
|
||||
|
||||
class PluginBackgroundSink : public ReadbackSink {
|
||||
@ -1791,7 +1790,7 @@ nsObjectFrame::PaintPlugin(nsDisplayListBuilder* aBuilder,
|
||||
// double pass render. If this plugin isn't oop, the register window message
|
||||
// will be ignored.
|
||||
NPEvent pluginEvent;
|
||||
pluginEvent.event = DoublePassRenderingEvent();
|
||||
pluginEvent.event = plugins::DoublePassRenderingEvent();
|
||||
pluginEvent.wParam = 0;
|
||||
pluginEvent.lParam = 0;
|
||||
if (pluginEvent.event)
|
||||
|
@ -2420,8 +2420,9 @@ private:
|
||||
};
|
||||
|
||||
template<>
|
||||
struct nsTArray_CopyElements<nsStyleFilter>
|
||||
: public nsTArray_CopyWithConstructors<nsStyleFilter> {};
|
||||
struct nsTArray_CopyChooser<nsStyleFilter> {
|
||||
typedef nsTArray_CopyWithConstructors<nsStyleFilter> Type;
|
||||
};
|
||||
|
||||
struct nsStyleSVGReset {
|
||||
nsStyleSVGReset();
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "nsPopupSetFrame.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMScreen.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsFrameManager.h"
|
||||
@ -1650,7 +1651,7 @@ nsMenuPopupFrame::FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent, bool& doAction
|
||||
aKeyEvent->GetTimeStamp(&keyTime);
|
||||
|
||||
if (charCode == 0) {
|
||||
if (keyCode == NS_VK_BACK) {
|
||||
if (keyCode == nsIDOMKeyEvent::DOM_VK_BACK_SPACE) {
|
||||
if (!isMenu && !mIncrementalString.IsEmpty()) {
|
||||
mIncrementalString.SetLength(mIncrementalString.Length() - 1);
|
||||
return nullptr;
|
||||
|
@ -1846,7 +1846,8 @@ nsXULPopupManager::HandleKeyboardNavigation(uint32_t aKeyCode)
|
||||
return false;
|
||||
|
||||
nsNavigationDirection theDirection;
|
||||
NS_ASSERTION(aKeyCode >= NS_VK_END && aKeyCode <= NS_VK_DOWN, "Illegal key code");
|
||||
NS_ASSERTION(aKeyCode >= nsIDOMKeyEvent::DOM_VK_END &&
|
||||
aKeyCode <= nsIDOMKeyEvent::DOM_VK_DOWN, "Illegal key code");
|
||||
theDirection = NS_DIRECTION_FROM_KEY_CODE(itemFrame, aKeyCode);
|
||||
|
||||
// if a popup is open, first check for navigation within the popup
|
||||
@ -2354,8 +2355,8 @@ nsXULMenuCommandEvent::Run()
|
||||
if (mCloseMenuMode != CloseMenuMode_None)
|
||||
menuFrame->SelectMenu(false);
|
||||
|
||||
nsAutoHandlingUserInputStatePusher userInpStatePusher(mUserInput, nullptr,
|
||||
shell->GetDocument());
|
||||
AutoHandlingUserInputStatePusher userInpStatePusher(mUserInput, nullptr,
|
||||
shell->GetDocument());
|
||||
nsContentUtils::DispatchXULCommand(mMenu, mIsTrusted, nullptr, shell,
|
||||
mControl, mAlt, mShift, mMeta);
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ int main(int argc, char **argv) {
|
||||
with the import and export command line arguments. */
|
||||
else if (argv[1][0] == '-' &&
|
||||
argv[1][1] == 'D' &&
|
||||
(argv[1][2] == '0' + certCount || argv[1][2] == '\0')) {
|
||||
(argv[1][2] == (char)('0' + certCount) || argv[1][2] == '\0')) {
|
||||
if (certCount >= MAX_SIGNATURES) {
|
||||
print_usage();
|
||||
return -1;
|
||||
|
@ -615,10 +615,9 @@ def main():
|
||||
if not os.path.exists(fennec_ids) and options.robocopIds:
|
||||
fennec_ids = options.robocopIds
|
||||
dm.pushFile(fennec_ids, os.path.join(deviceRoot, "fennec_ids.txt"))
|
||||
options.extraPrefs.append('robocop.logfile="%s/robocop.log"' % deviceRoot)
|
||||
options.extraPrefs.append('browser.search.suggest.enabled=true')
|
||||
options.extraPrefs.append('browser.search.suggest.prompted=true')
|
||||
options.extraPrefs.append('layout.css.devPixelsPerPx="1.0"')
|
||||
options.extraPrefs.append('layout.css.devPixelsPerPx=1.0')
|
||||
options.extraPrefs.append('browser.chrome.dynamictoolbar=false')
|
||||
|
||||
if (options.dm_trans == 'adb' and options.robocopApk):
|
||||
|
@ -155,6 +155,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Run sizeOfTab() to make sure it doesn't crash. We can't check the result
|
||||
// values because they're non-deterministic.
|
||||
let jsObjectsSize = {};
|
||||
let jsStringsSize = {};
|
||||
let jsOtherSize = {};
|
||||
let domSize = {};
|
||||
let styleSize = {};
|
||||
let otherSize = {};
|
||||
let totalSize = {};
|
||||
let jsMilliseconds = {};
|
||||
let nonJSMilliseconds = {};
|
||||
mgr.sizeOfTab(window, jsObjectsSize, jsStringsSize, jsOtherSize,
|
||||
domSize, styleSize, otherSize, totalSize,
|
||||
jsMilliseconds, nonJSMilliseconds);
|
||||
|
||||
let e = mgr.enumerateReporters();
|
||||
while (e.hasMoreElements()) {
|
||||
let r = e.getNext().QueryInterface(Ci.nsIMemoryReporter);
|
||||
|
@ -239,16 +239,10 @@
|
||||
<!-- Localization note: readyState is a HTML5 API MediaElement-specific attribute and should not be localized. -->
|
||||
<td class="statLabel">readyState</td> <td class="statValue"><span class="statReadyState"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="statLabel">&stats.channels;</td> <td class="statValue"><span class="statChannels"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<!-- Localization note: networkState is a HTML5 API MediaElement-specific attribute and should not be localized. -->
|
||||
<td class="statLabel">networkState</td> <td class="statValue"><span class="statNetState"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="statLabel">&stats.sampleRate;</td> <td class="statValue"><span class="statSampleRate"/></td>
|
||||
</tr>
|
||||
<tr style="height: 1em;"/>
|
||||
|
||||
<tr>
|
||||
@ -1218,9 +1212,6 @@
|
||||
if (v.muted)
|
||||
volume += " (muted)";
|
||||
s.volume.textContent = volume;
|
||||
|
||||
s.channels.textContent = v.mozChannels;
|
||||
s.sampRate.textContent = (v.mozSampleRate / 1000).toFixed(3) + " kHz";
|
||||
},
|
||||
|
||||
keyHandler : function(event) {
|
||||
@ -1410,8 +1401,6 @@
|
||||
this.stats.size = document.getAnonymousElementByAttribute(binding, "class", "statSize");
|
||||
this.stats.activity = document.getAnonymousElementByAttribute(binding, "class", "statActivity");
|
||||
this.stats.volume = document.getAnonymousElementByAttribute(binding, "class", "statVolume");
|
||||
this.stats.channels = document.getAnonymousElementByAttribute(binding, "class", "statChannels");
|
||||
this.stats.sampRate = document.getAnonymousElementByAttribute(binding, "class", "statSampleRate");
|
||||
this.stats.readyState = document.getAnonymousElementByAttribute(binding, "class", "statReadyState");
|
||||
this.stats.netState = document.getAnonymousElementByAttribute(binding, "class", "statNetState");
|
||||
this.stats.framesParsed = document.getAnonymousElementByAttribute(binding, "class", "statFramesParsed");
|
||||
|
@ -89,7 +89,7 @@ ifdef MOZ_B2G_RIL #{
|
||||
STATIC_LIBS += mozril_s
|
||||
endif #}
|
||||
|
||||
ifdef MOZ_B2G_BT #{
|
||||
ifdef MOZ_B2G_BT_BLUEZ #{
|
||||
STATIC_LIBS += mozdbus_s
|
||||
ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
|
||||
OS_LIBS += -ldbus
|
||||
|
@ -17,8 +17,6 @@
|
||||
<!ENTITY stats.activityEnded "Ended">
|
||||
<!ENTITY stats.activitySeeking "(seeking)">
|
||||
<!ENTITY stats.volume "Volume">
|
||||
<!ENTITY stats.channels "Channels">
|
||||
<!ENTITY stats.sampleRate "Sample Rate">
|
||||
<!ENTITY stats.framesParsed "Frames parsed">
|
||||
<!ENTITY stats.framesDecoded "Frames decoded">
|
||||
<!ENTITY stats.framesPresented "Frames presented">
|
||||
|
@ -620,11 +620,13 @@ SyncProfile* TableTicker::GetBacktrace()
|
||||
TickSample sample;
|
||||
sample.threadProfile = profile;
|
||||
|
||||
#if defined(HAVE_NATIVE_UNWIND)
|
||||
#if defined(XP_WIN) || defined(LINUX)
|
||||
tickcontext_t context;
|
||||
sample.PopulateContext(&context);
|
||||
#elif defined(XP_MACOSX)
|
||||
sample.PopulateContext(nullptr);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
sample.isSamplingCurrentThread = true;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsPoint.h"
|
||||
#include "nsRegion.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsWidgetInitData.h" // for nsWindowType
|
||||
#include "nsIWidgetListener.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "Layers.h"
|
||||
#include "gfxPlatform.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
/**
|
||||
XXX TODO XXX
|
||||
|
@ -64,6 +64,8 @@ struct EventFlags;
|
||||
|
||||
// TextEvents.h
|
||||
struct AlternativeCharCode;
|
||||
|
||||
// TextRange.h
|
||||
struct TextRangeStyle;
|
||||
struct TextRange;
|
||||
|
||||
|
@ -11,13 +11,12 @@
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/EventForwards.h" // for KeyNameIndex, temporarily
|
||||
#include "nsColor.h"
|
||||
#include "mozilla/TextRange.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsITransferable.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
/******************************************************************************
|
||||
@ -149,148 +148,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* mozilla::TextRangeStyle
|
||||
******************************************************************************/
|
||||
|
||||
struct TextRangeStyle
|
||||
{
|
||||
enum {
|
||||
LINESTYLE_NONE = NS_STYLE_TEXT_DECORATION_STYLE_NONE,
|
||||
LINESTYLE_SOLID = NS_STYLE_TEXT_DECORATION_STYLE_SOLID,
|
||||
LINESTYLE_DOTTED = NS_STYLE_TEXT_DECORATION_STYLE_DOTTED,
|
||||
LINESTYLE_DASHED = NS_STYLE_TEXT_DECORATION_STYLE_DASHED,
|
||||
LINESTYLE_DOUBLE = NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE,
|
||||
LINESTYLE_WAVY = NS_STYLE_TEXT_DECORATION_STYLE_WAVY
|
||||
};
|
||||
|
||||
enum {
|
||||
DEFINED_NONE = 0x00,
|
||||
DEFINED_LINESTYLE = 0x01,
|
||||
DEFINED_FOREGROUND_COLOR = 0x02,
|
||||
DEFINED_BACKGROUND_COLOR = 0x04,
|
||||
DEFINED_UNDERLINE_COLOR = 0x08
|
||||
};
|
||||
|
||||
// Initialize all members, because TextRange instances may be compared by
|
||||
// memcomp.
|
||||
TextRangeStyle()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
mDefinedStyles = DEFINED_NONE;
|
||||
mLineStyle = LINESTYLE_NONE;
|
||||
mIsBoldLine = false;
|
||||
mForegroundColor = mBackgroundColor = mUnderlineColor = NS_RGBA(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
bool IsDefined() const { return mDefinedStyles != DEFINED_NONE; }
|
||||
|
||||
bool IsLineStyleDefined() const
|
||||
{
|
||||
return (mDefinedStyles & DEFINED_LINESTYLE) != 0;
|
||||
}
|
||||
|
||||
bool IsForegroundColorDefined() const
|
||||
{
|
||||
return (mDefinedStyles & DEFINED_FOREGROUND_COLOR) != 0;
|
||||
}
|
||||
|
||||
bool IsBackgroundColorDefined() const
|
||||
{
|
||||
return (mDefinedStyles & DEFINED_BACKGROUND_COLOR) != 0;
|
||||
}
|
||||
|
||||
bool IsUnderlineColorDefined() const
|
||||
{
|
||||
return (mDefinedStyles & DEFINED_UNDERLINE_COLOR) != 0;
|
||||
}
|
||||
|
||||
bool IsNoChangeStyle() const
|
||||
{
|
||||
return !IsForegroundColorDefined() && !IsBackgroundColorDefined() &&
|
||||
IsLineStyleDefined() && mLineStyle == LINESTYLE_NONE;
|
||||
}
|
||||
|
||||
bool Equals(const TextRangeStyle& aOther)
|
||||
{
|
||||
if (mDefinedStyles != aOther.mDefinedStyles)
|
||||
return false;
|
||||
if (IsLineStyleDefined() && (mLineStyle != aOther.mLineStyle ||
|
||||
!mIsBoldLine != !aOther.mIsBoldLine))
|
||||
return false;
|
||||
if (IsForegroundColorDefined() &&
|
||||
(mForegroundColor != aOther.mForegroundColor))
|
||||
return false;
|
||||
if (IsBackgroundColorDefined() &&
|
||||
(mBackgroundColor != aOther.mBackgroundColor))
|
||||
return false;
|
||||
if (IsUnderlineColorDefined() &&
|
||||
(mUnderlineColor != aOther.mUnderlineColor))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator !=(const TextRangeStyle &aOther)
|
||||
{
|
||||
return !Equals(aOther);
|
||||
}
|
||||
|
||||
bool operator ==(const TextRangeStyle &aOther)
|
||||
{
|
||||
return Equals(aOther);
|
||||
}
|
||||
|
||||
uint8_t mDefinedStyles;
|
||||
uint8_t mLineStyle; // DEFINED_LINESTYLE
|
||||
|
||||
bool mIsBoldLine; // DEFINED_LINESTYLE
|
||||
|
||||
nscolor mForegroundColor; // DEFINED_FOREGROUND_COLOR
|
||||
nscolor mBackgroundColor; // DEFINED_BACKGROUND_COLOR
|
||||
nscolor mUnderlineColor; // DEFINED_UNDERLINE_COLOR
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* mozilla::TextRange
|
||||
******************************************************************************/
|
||||
|
||||
// Sync with nsIPrivateTextRange.h when you change these constants.
|
||||
#define NS_TEXTRANGE_CARETPOSITION 0x01
|
||||
#define NS_TEXTRANGE_RAWINPUT 0x02
|
||||
#define NS_TEXTRANGE_SELECTEDRAWTEXT 0x03
|
||||
#define NS_TEXTRANGE_CONVERTEDTEXT 0x04
|
||||
#define NS_TEXTRANGE_SELECTEDCONVERTEDTEXT 0x05
|
||||
|
||||
struct TextRange
|
||||
{
|
||||
TextRange() :
|
||||
mStartOffset(0), mEndOffset(0), mRangeType(0)
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t mStartOffset;
|
||||
// XXX Storing end offset makes the initializing code very complicated.
|
||||
// We should replace it with mLength.
|
||||
uint32_t mEndOffset;
|
||||
uint32_t mRangeType;
|
||||
|
||||
TextRangeStyle mRangeStyle;
|
||||
|
||||
uint32_t Length() const { return mEndOffset - mStartOffset; }
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* mozilla::TextRangeArray
|
||||
*
|
||||
* XXX This should be replaced with nsTArray<TextRange>.
|
||||
******************************************************************************/
|
||||
|
||||
typedef TextRange* TextRangeArray;
|
||||
|
||||
/******************************************************************************
|
||||
* mozilla::WidgetTextEvent
|
||||
*
|
||||
|
162
widget/TextRange.h
Normal file
162
widget/TextRange.h
Normal file
@ -0,0 +1,162 @@
|
||||
/* -*- 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 mozilla_TextRage_h_
|
||||
#define mozilla_TextRage_h_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "nsColor.h"
|
||||
#include "nsStyleConsts.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/******************************************************************************
|
||||
* mozilla::TextRangeStyle
|
||||
******************************************************************************/
|
||||
|
||||
struct TextRangeStyle
|
||||
{
|
||||
enum
|
||||
{
|
||||
LINESTYLE_NONE = NS_STYLE_TEXT_DECORATION_STYLE_NONE,
|
||||
LINESTYLE_SOLID = NS_STYLE_TEXT_DECORATION_STYLE_SOLID,
|
||||
LINESTYLE_DOTTED = NS_STYLE_TEXT_DECORATION_STYLE_DOTTED,
|
||||
LINESTYLE_DASHED = NS_STYLE_TEXT_DECORATION_STYLE_DASHED,
|
||||
LINESTYLE_DOUBLE = NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE,
|
||||
LINESTYLE_WAVY = NS_STYLE_TEXT_DECORATION_STYLE_WAVY
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
DEFINED_NONE = 0x00,
|
||||
DEFINED_LINESTYLE = 0x01,
|
||||
DEFINED_FOREGROUND_COLOR = 0x02,
|
||||
DEFINED_BACKGROUND_COLOR = 0x04,
|
||||
DEFINED_UNDERLINE_COLOR = 0x08
|
||||
};
|
||||
|
||||
// Initialize all members, because TextRange instances may be compared by
|
||||
// memcomp.
|
||||
TextRangeStyle()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
mDefinedStyles = DEFINED_NONE;
|
||||
mLineStyle = LINESTYLE_NONE;
|
||||
mIsBoldLine = false;
|
||||
mForegroundColor = mBackgroundColor = mUnderlineColor = NS_RGBA(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
bool IsDefined() const { return mDefinedStyles != DEFINED_NONE; }
|
||||
|
||||
bool IsLineStyleDefined() const
|
||||
{
|
||||
return (mDefinedStyles & DEFINED_LINESTYLE) != 0;
|
||||
}
|
||||
|
||||
bool IsForegroundColorDefined() const
|
||||
{
|
||||
return (mDefinedStyles & DEFINED_FOREGROUND_COLOR) != 0;
|
||||
}
|
||||
|
||||
bool IsBackgroundColorDefined() const
|
||||
{
|
||||
return (mDefinedStyles & DEFINED_BACKGROUND_COLOR) != 0;
|
||||
}
|
||||
|
||||
bool IsUnderlineColorDefined() const
|
||||
{
|
||||
return (mDefinedStyles & DEFINED_UNDERLINE_COLOR) != 0;
|
||||
}
|
||||
|
||||
bool IsNoChangeStyle() const
|
||||
{
|
||||
return !IsForegroundColorDefined() && !IsBackgroundColorDefined() &&
|
||||
IsLineStyleDefined() && mLineStyle == LINESTYLE_NONE;
|
||||
}
|
||||
|
||||
bool Equals(const TextRangeStyle& aOther)
|
||||
{
|
||||
if (mDefinedStyles != aOther.mDefinedStyles)
|
||||
return false;
|
||||
if (IsLineStyleDefined() && (mLineStyle != aOther.mLineStyle ||
|
||||
!mIsBoldLine != !aOther.mIsBoldLine))
|
||||
return false;
|
||||
if (IsForegroundColorDefined() &&
|
||||
(mForegroundColor != aOther.mForegroundColor))
|
||||
return false;
|
||||
if (IsBackgroundColorDefined() &&
|
||||
(mBackgroundColor != aOther.mBackgroundColor))
|
||||
return false;
|
||||
if (IsUnderlineColorDefined() &&
|
||||
(mUnderlineColor != aOther.mUnderlineColor))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator !=(const TextRangeStyle &aOther)
|
||||
{
|
||||
return !Equals(aOther);
|
||||
}
|
||||
|
||||
bool operator ==(const TextRangeStyle &aOther)
|
||||
{
|
||||
return Equals(aOther);
|
||||
}
|
||||
|
||||
uint8_t mDefinedStyles;
|
||||
uint8_t mLineStyle; // DEFINED_LINESTYLE
|
||||
|
||||
bool mIsBoldLine; // DEFINED_LINESTYLE
|
||||
|
||||
nscolor mForegroundColor; // DEFINED_FOREGROUND_COLOR
|
||||
nscolor mBackgroundColor; // DEFINED_BACKGROUND_COLOR
|
||||
nscolor mUnderlineColor; // DEFINED_UNDERLINE_COLOR
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* mozilla::TextRange
|
||||
******************************************************************************/
|
||||
|
||||
// Sync with nsIPrivateTextRange.h when you change these constants.
|
||||
#define NS_TEXTRANGE_CARETPOSITION 0x01
|
||||
#define NS_TEXTRANGE_RAWINPUT 0x02
|
||||
#define NS_TEXTRANGE_SELECTEDRAWTEXT 0x03
|
||||
#define NS_TEXTRANGE_CONVERTEDTEXT 0x04
|
||||
#define NS_TEXTRANGE_SELECTEDCONVERTEDTEXT 0x05
|
||||
|
||||
struct TextRange
|
||||
{
|
||||
TextRange() :
|
||||
mStartOffset(0), mEndOffset(0), mRangeType(0)
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t mStartOffset;
|
||||
// XXX Storing end offset makes the initializing code very complicated.
|
||||
// We should replace it with mLength.
|
||||
uint32_t mEndOffset;
|
||||
uint32_t mRangeType;
|
||||
|
||||
TextRangeStyle mRangeStyle;
|
||||
|
||||
uint32_t Length() const { return mEndOffset - mStartOffset; }
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* mozilla::TextRangeArray
|
||||
*
|
||||
* XXX This should be replaced with nsTArray<TextRange>.
|
||||
******************************************************************************/
|
||||
|
||||
typedef TextRange* TextRangeArray;
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_TextRage_h_
|
@ -11,8 +11,9 @@
|
||||
#include "nsIIdleServiceInternal.h"
|
||||
#include "nsTArray.h"
|
||||
#include "AndroidJavaWrappers.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "mozilla/TextRange.h"
|
||||
|
||||
class gfxASurface;
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include "nsCRT.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
#include "gfxASurface.h"
|
||||
|
@ -30,7 +30,7 @@
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "mozilla/a11y/Accessible.h"
|
||||
#endif
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
|
||||
#include "nsGtkIMModule.h"
|
||||
|
||||
|
@ -118,6 +118,7 @@ EXPORTS.mozilla += [
|
||||
'MiscEvents.h',
|
||||
'MouseEvents.h',
|
||||
'TextEvents.h',
|
||||
'TextRange.h',
|
||||
'TouchEvents.h',
|
||||
'WidgetUtils.h',
|
||||
]
|
||||
|
@ -5,13 +5,15 @@
|
||||
#ifndef nsIWidgetListener_h__
|
||||
#define nsIWidgetListener_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsIXULWindow.h"
|
||||
#include "nsRegion.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mozilla/EventForwards.h"
|
||||
|
||||
class nsView;
|
||||
class nsIntRegion;
|
||||
class nsIPresShell;
|
||||
class nsIWidget;
|
||||
class nsIXULWindow;
|
||||
|
||||
/**
|
||||
* sizemode is an adjunct to widget size
|
||||
@ -43,34 +45,35 @@ public:
|
||||
* this is likely a listener for a view, which can be determined using
|
||||
* GetView. If both methods return null, this will be an nsWebBrowser.
|
||||
*/
|
||||
virtual nsIXULWindow* GetXULWindow() { return nullptr; }
|
||||
virtual nsIXULWindow* GetXULWindow();
|
||||
|
||||
/**
|
||||
* If this listener is for an nsView, return it.
|
||||
*/
|
||||
virtual nsView* GetView() { return nullptr; }
|
||||
virtual nsView* GetView();
|
||||
|
||||
/**
|
||||
* Return the presshell for this widget listener.
|
||||
*/
|
||||
virtual nsIPresShell* GetPresShell() { return nullptr; }
|
||||
virtual nsIPresShell* GetPresShell();
|
||||
|
||||
/**
|
||||
* Called when a window is moved to location (x, y). Returns true if the
|
||||
* notification was handled. Coordinates are outer window screen coordinates.
|
||||
*/
|
||||
virtual bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY) { return false; }
|
||||
virtual bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY);
|
||||
|
||||
/**
|
||||
* Called when a window is resized to (width, height). Returns true if the
|
||||
* notification was handled. Coordinates are outer window screen coordinates.
|
||||
*/
|
||||
virtual bool WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHeight) { return false; }
|
||||
virtual bool WindowResized(nsIWidget* aWidget,
|
||||
int32_t aWidth, int32_t aHeight);
|
||||
|
||||
/**
|
||||
* Called when the size mode (minimized, maximized, fullscreen) is changed.
|
||||
*/
|
||||
virtual void SizeModeChanged(nsSizeMode sizeMode) { }
|
||||
virtual void SizeModeChanged(nsSizeMode aSizeMode);
|
||||
|
||||
/**
|
||||
* Called when the z-order of the window is changed. Returns true if the
|
||||
@ -79,36 +82,37 @@ public:
|
||||
* window to place below. On return, aActualBelow will be set to the
|
||||
* window actually behind. This generally only applies to Windows.
|
||||
*/
|
||||
virtual bool ZLevelChanged(bool aImmediate, nsWindowZ *aPlacement,
|
||||
nsIWidget* aRequestBelow, nsIWidget** aActualBelow) { return false; }
|
||||
virtual bool ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement,
|
||||
nsIWidget* aRequestBelow,
|
||||
nsIWidget** aActualBelow);
|
||||
|
||||
/**
|
||||
* Called when the window is activated and focused.
|
||||
*/
|
||||
virtual void WindowActivated() { }
|
||||
virtual void WindowActivated();
|
||||
|
||||
/**
|
||||
* Called when the window is deactivated and no longer focused.
|
||||
*/
|
||||
virtual void WindowDeactivated() { }
|
||||
virtual void WindowDeactivated();
|
||||
|
||||
/**
|
||||
* Called when the show/hide toolbar button on the Mac titlebar is pressed.
|
||||
*/
|
||||
virtual void OSToolbarButtonPressed() { }
|
||||
virtual void OSToolbarButtonPressed();
|
||||
|
||||
/**
|
||||
* Called when a request is made to close the window. Returns true if the
|
||||
* notification was handled. Returns true if the notification was handled.
|
||||
*/
|
||||
virtual bool RequestWindowClose(nsIWidget* aWidget) { return false; }
|
||||
virtual bool RequestWindowClose(nsIWidget* aWidget);
|
||||
|
||||
/*
|
||||
* Indicate that a paint is about to occur on this window. This is called
|
||||
* at a time when it's OK to change the geometry of this widget or of
|
||||
* other widgets. Must be called before every call to PaintWindow.
|
||||
*/
|
||||
virtual void WillPaintWindow(nsIWidget* aWidget) { }
|
||||
virtual void WillPaintWindow(nsIWidget* aWidget);
|
||||
|
||||
/**
|
||||
* Paint the specified region of the window. Returns true if the
|
||||
@ -116,7 +120,7 @@ public:
|
||||
* This is called at a time when it is not OK to change the geometry of
|
||||
* this widget or of other widgets.
|
||||
*/
|
||||
virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion) { return false; }
|
||||
virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion);
|
||||
|
||||
/**
|
||||
* Indicates that a paint occurred.
|
||||
@ -124,21 +128,18 @@ public:
|
||||
* this widget or of other widgets.
|
||||
* Must be called after every call to PaintWindow.
|
||||
*/
|
||||
virtual void DidPaintWindow() { }
|
||||
virtual void DidPaintWindow();
|
||||
|
||||
/**
|
||||
* Request that layout schedules a repaint on the next refresh driver tick.
|
||||
*/
|
||||
virtual void RequestRepaint() { }
|
||||
virtual void RequestRepaint();
|
||||
|
||||
/**
|
||||
* Handle an event.
|
||||
*/
|
||||
virtual nsEventStatus HandleEvent(mozilla::WidgetGUIEvent* aEvent,
|
||||
bool aUseAttachedEvents)
|
||||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
bool aUseAttachedEvents);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -2808,6 +2808,14 @@ nsWindow::GetDPI()
|
||||
return float(rootWindow->height()/heightInches);
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
nsWindow::DispatchEvent(WidgetGUIEvent* aEvent)
|
||||
{
|
||||
nsEventStatus status;
|
||||
DispatchEvent(aEvent, status);
|
||||
return status;
|
||||
}
|
||||
|
||||
void
|
||||
nsWindow::DispatchActivateEvent(void)
|
||||
{
|
||||
@ -3170,3 +3178,37 @@ nsWindow::GetGLFrameBufferFormat()
|
||||
return LOCAL_GL_NONE;
|
||||
}
|
||||
|
||||
void
|
||||
nsWindow::ProcessMotionEvent()
|
||||
{
|
||||
if (mPinchEvent.needDispatch) {
|
||||
double distance = DistanceBetweenPoints(mPinchEvent.centerPoint,
|
||||
mPinchEvent.touchPoint);
|
||||
distance *= 2;
|
||||
mPinchEvent.delta = distance - mPinchEvent.prevDistance;
|
||||
nsIntPoint centerPoint(mPinchEvent.centerPoint.x(),
|
||||
mPinchEvent.centerPoint.y());
|
||||
DispatchGestureEvent(NS_SIMPLE_GESTURE_MAGNIFY_UPDATE,
|
||||
0, mPinchEvent.delta, centerPoint);
|
||||
mPinchEvent.prevDistance = distance;
|
||||
}
|
||||
if (mMoveEvent.needDispatch) {
|
||||
WidgetMouseEvent event(true, NS_MOUSE_MOVE, this,
|
||||
WidgetMouseEvent::eReal);
|
||||
|
||||
event.refPoint.x = nscoord(mMoveEvent.pos.x());
|
||||
event.refPoint.y = nscoord(mMoveEvent.pos.y());
|
||||
|
||||
event.InitBasicModifiers(mMoveEvent.modifiers & Qt::ControlModifier,
|
||||
mMoveEvent.modifiers & Qt::AltModifier,
|
||||
mMoveEvent.modifiers & Qt::ShiftModifier,
|
||||
mMoveEvent.modifiers & Qt::MetaModifier);
|
||||
event.clickCount = 0;
|
||||
|
||||
DispatchEvent(&event);
|
||||
mMoveEvent.needDispatch = false;
|
||||
}
|
||||
|
||||
mTimerStarted = false;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
#include "nsBaseWidget.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
@ -183,12 +183,7 @@ public:
|
||||
void DispatchDeactivateEventOnTopLevelWindow(void);
|
||||
void DispatchResizeEvent(nsIntRect &aRect, nsEventStatus &aStatus);
|
||||
|
||||
nsEventStatus DispatchEvent(mozilla::WidgetGUIEvent* aEvent)
|
||||
{
|
||||
nsEventStatus status;
|
||||
DispatchEvent(aEvent, status);
|
||||
return status;
|
||||
}
|
||||
nsEventStatus DispatchEvent(mozilla::WidgetGUIEvent* aEvent);
|
||||
|
||||
// Some of the nsIWidget methods
|
||||
virtual bool IsEnabled() const;
|
||||
@ -378,35 +373,7 @@ private:
|
||||
// event (like a keypress or mouse click).
|
||||
void UserActivity();
|
||||
|
||||
inline void ProcessMotionEvent() {
|
||||
if (mPinchEvent.needDispatch) {
|
||||
double distance = DistanceBetweenPoints(mPinchEvent.centerPoint, mPinchEvent.touchPoint);
|
||||
distance *= 2;
|
||||
mPinchEvent.delta = distance - mPinchEvent.prevDistance;
|
||||
nsIntPoint centerPoint(mPinchEvent.centerPoint.x(), mPinchEvent.centerPoint.y());
|
||||
DispatchGestureEvent(NS_SIMPLE_GESTURE_MAGNIFY_UPDATE,
|
||||
0, mPinchEvent.delta, centerPoint);
|
||||
mPinchEvent.prevDistance = distance;
|
||||
}
|
||||
if (mMoveEvent.needDispatch) {
|
||||
WidgetMouseEvent event(true, NS_MOUSE_MOVE, this,
|
||||
WidgetMouseEvent::eReal);
|
||||
|
||||
event.refPoint.x = nscoord(mMoveEvent.pos.x());
|
||||
event.refPoint.y = nscoord(mMoveEvent.pos.y());
|
||||
|
||||
event.InitBasicModifiers(mMoveEvent.modifiers & Qt::ControlModifier,
|
||||
mMoveEvent.modifiers & Qt::AltModifier,
|
||||
mMoveEvent.modifiers & Qt::ShiftModifier,
|
||||
mMoveEvent.modifiers & Qt::MetaModifier);
|
||||
event.clickCount = 0;
|
||||
|
||||
DispatchEvent(&event);
|
||||
mMoveEvent.needDispatch = false;
|
||||
}
|
||||
|
||||
mTimerStarted = false;
|
||||
}
|
||||
inline void ProcessMotionEvent();
|
||||
|
||||
void DispatchMotionToMainThread() {
|
||||
if (!mTimerStarted) {
|
||||
|
@ -95,6 +95,38 @@ public:
|
||||
* mozilla::widget::ModifierKeyState
|
||||
*****************************************************************************/
|
||||
|
||||
ModifierKeyState::ModifierKeyState()
|
||||
{
|
||||
Update();
|
||||
}
|
||||
|
||||
ModifierKeyState::ModifierKeyState(bool aIsShiftDown,
|
||||
bool aIsControlDown,
|
||||
bool aIsAltDown)
|
||||
{
|
||||
Update();
|
||||
Unset(MODIFIER_SHIFT | MODIFIER_CONTROL | MODIFIER_ALT | MODIFIER_ALTGRAPH);
|
||||
Modifiers modifiers = 0;
|
||||
if (aIsShiftDown) {
|
||||
modifiers |= MODIFIER_SHIFT;
|
||||
}
|
||||
if (aIsControlDown) {
|
||||
modifiers |= MODIFIER_CONTROL;
|
||||
}
|
||||
if (aIsAltDown) {
|
||||
modifiers |= MODIFIER_ALT;
|
||||
}
|
||||
if (modifiers) {
|
||||
Set(modifiers);
|
||||
}
|
||||
}
|
||||
|
||||
ModifierKeyState::ModifierKeyState(Modifiers aModifiers) :
|
||||
mModifiers(aModifiers)
|
||||
{
|
||||
EnsureAltGr();
|
||||
}
|
||||
|
||||
void
|
||||
ModifierKeyState::Update()
|
||||
{
|
||||
@ -124,6 +156,22 @@ ModifierKeyState::Update()
|
||||
EnsureAltGr();
|
||||
}
|
||||
|
||||
void
|
||||
ModifierKeyState::Unset(Modifiers aRemovingModifiers)
|
||||
{
|
||||
mModifiers &= ~aRemovingModifiers;
|
||||
// Note that we don't need to unset AltGr flag here automatically.
|
||||
// For nsEditor, we need to remove Alt and Control flags but AltGr isn't
|
||||
// checked in nsEditor, so, it can be kept.
|
||||
}
|
||||
|
||||
void
|
||||
ModifierKeyState::Set(Modifiers aAddingModifiers)
|
||||
{
|
||||
mModifiers |= aAddingModifiers;
|
||||
EnsureAltGr();
|
||||
}
|
||||
|
||||
void
|
||||
ModifierKeyState::InitInputEvent(WidgetInputEvent& aInputEvent) const
|
||||
{
|
||||
@ -170,6 +218,72 @@ ModifierKeyState::InitMouseEvent(WidgetInputEvent& aMouseEvent) const
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ModifierKeyState::IsShift() const
|
||||
{
|
||||
return (mModifiers & MODIFIER_SHIFT) != 0;
|
||||
}
|
||||
|
||||
bool
|
||||
ModifierKeyState::IsControl() const
|
||||
{
|
||||
return (mModifiers & MODIFIER_CONTROL) != 0;
|
||||
}
|
||||
|
||||
bool
|
||||
ModifierKeyState::IsAlt() const
|
||||
{
|
||||
return (mModifiers & MODIFIER_ALT) != 0;
|
||||
}
|
||||
|
||||
bool
|
||||
ModifierKeyState::IsAltGr() const
|
||||
{
|
||||
return IsControl() && IsAlt();
|
||||
}
|
||||
|
||||
bool
|
||||
ModifierKeyState::IsWin() const
|
||||
{
|
||||
return (mModifiers & MODIFIER_OS) != 0;
|
||||
}
|
||||
|
||||
bool
|
||||
ModifierKeyState::IsCapsLocked() const
|
||||
{
|
||||
return (mModifiers & MODIFIER_CAPSLOCK) != 0;
|
||||
}
|
||||
|
||||
bool
|
||||
ModifierKeyState::IsNumLocked() const
|
||||
{
|
||||
return (mModifiers & MODIFIER_NUMLOCK) != 0;
|
||||
}
|
||||
|
||||
bool
|
||||
ModifierKeyState::IsScrollLocked() const
|
||||
{
|
||||
return (mModifiers & MODIFIER_SCROLLLOCK) != 0;
|
||||
}
|
||||
|
||||
Modifiers
|
||||
ModifierKeyState::GetModifiers() const
|
||||
{
|
||||
return mModifiers;
|
||||
}
|
||||
|
||||
void
|
||||
ModifierKeyState::EnsureAltGr()
|
||||
{
|
||||
// If both Control key and Alt key are pressed, it means AltGr is pressed.
|
||||
// Ideally, we should check whether the current keyboard layout has AltGr
|
||||
// or not. However, setting AltGr flags for keyboard which doesn't have
|
||||
// AltGr must not be serious bug. So, it should be OK for now.
|
||||
if (IsAltGr()) {
|
||||
mModifiers |= MODIFIER_ALTGRAPH;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* mozilla::widget::UniCharsAndModifiers
|
||||
*****************************************************************************/
|
||||
@ -236,6 +350,50 @@ UniCharsAndModifiers::operator+(const UniCharsAndModifiers& aOther) const
|
||||
* mozilla::widget::VirtualKey
|
||||
*****************************************************************************/
|
||||
|
||||
// static
|
||||
VirtualKey::ShiftState
|
||||
VirtualKey::ModifiersToShiftState(Modifiers aModifiers)
|
||||
{
|
||||
ShiftState state = 0;
|
||||
if (aModifiers & MODIFIER_SHIFT) {
|
||||
state |= STATE_SHIFT;
|
||||
}
|
||||
if (aModifiers & MODIFIER_CONTROL) {
|
||||
state |= STATE_CONTROL;
|
||||
}
|
||||
if (aModifiers & MODIFIER_ALT) {
|
||||
state |= STATE_ALT;
|
||||
}
|
||||
if (aModifiers & MODIFIER_CAPSLOCK) {
|
||||
state |= STATE_CAPSLOCK;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
// static
|
||||
Modifiers
|
||||
VirtualKey::ShiftStateToModifiers(ShiftState aShiftState)
|
||||
{
|
||||
Modifiers modifiers = 0;
|
||||
if (aShiftState & STATE_SHIFT) {
|
||||
modifiers |= MODIFIER_SHIFT;
|
||||
}
|
||||
if (aShiftState & STATE_CONTROL) {
|
||||
modifiers |= MODIFIER_CONTROL;
|
||||
}
|
||||
if (aShiftState & STATE_ALT) {
|
||||
modifiers |= MODIFIER_ALT;
|
||||
}
|
||||
if (aShiftState & STATE_CAPSLOCK) {
|
||||
modifiers |= MODIFIER_CAPSLOCK;
|
||||
}
|
||||
if ((modifiers & (MODIFIER_ALT | MODIFIER_CONTROL)) ==
|
||||
(MODIFIER_ALT | MODIFIER_CONTROL)) {
|
||||
modifiers |= MODIFIER_ALTGRAPH;
|
||||
}
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
inline PRUnichar
|
||||
VirtualKey::GetCompositeChar(ShiftState aShiftState, PRUnichar aBaseChar) const
|
||||
{
|
||||
@ -752,6 +910,12 @@ NativeKey::ComputeUnicharFromScanCode() const
|
||||
MAPVK_VK_TO_CHAR, mKeyboardLayout));
|
||||
}
|
||||
|
||||
void
|
||||
NativeKey::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent) const
|
||||
{
|
||||
InitKeyEvent(aKeyEvent, mModKeyState);
|
||||
}
|
||||
|
||||
void
|
||||
NativeKey::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent,
|
||||
const ModifierKeyState& aModKeyState) const
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsString.h"
|
||||
#include "nsWindowBase.h"
|
||||
#include "nsWindowDefs.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include <windows.h>
|
||||
|
||||
@ -54,84 +55,36 @@ static const uint32_t sModifierKeyMap[][3] = {
|
||||
|
||||
class KeyboardLayout;
|
||||
|
||||
class ModifierKeyState {
|
||||
class ModifierKeyState
|
||||
{
|
||||
public:
|
||||
ModifierKeyState()
|
||||
{
|
||||
Update();
|
||||
}
|
||||
ModifierKeyState();
|
||||
ModifierKeyState(bool aIsShiftDown, bool aIsControlDown, bool aIsAltDown);
|
||||
ModifierKeyState(Modifiers aModifiers);
|
||||
|
||||
ModifierKeyState(bool aIsShiftDown, bool aIsControlDown, bool aIsAltDown)
|
||||
{
|
||||
Update();
|
||||
Unset(MODIFIER_SHIFT | MODIFIER_CONTROL | MODIFIER_ALT | MODIFIER_ALTGRAPH);
|
||||
Modifiers modifiers = 0;
|
||||
if (aIsShiftDown) {
|
||||
modifiers |= MODIFIER_SHIFT;
|
||||
}
|
||||
if (aIsControlDown) {
|
||||
modifiers |= MODIFIER_CONTROL;
|
||||
}
|
||||
if (aIsAltDown) {
|
||||
modifiers |= MODIFIER_ALT;
|
||||
}
|
||||
if (modifiers) {
|
||||
Set(modifiers);
|
||||
}
|
||||
}
|
||||
MOZ_ALWAYS_INLINE void Update();
|
||||
|
||||
ModifierKeyState(Modifiers aModifiers) :
|
||||
mModifiers(aModifiers)
|
||||
{
|
||||
EnsureAltGr();
|
||||
}
|
||||
|
||||
void Update();
|
||||
|
||||
void Unset(Modifiers aRemovingModifiers)
|
||||
{
|
||||
mModifiers &= ~aRemovingModifiers;
|
||||
// Note that we don't need to unset AltGr flag here automatically.
|
||||
// For nsEditor, we need to remove Alt and Control flags but AltGr isn't
|
||||
// checked in nsEditor, so, it can be kept.
|
||||
}
|
||||
|
||||
void Set(Modifiers aAddingModifiers)
|
||||
{
|
||||
mModifiers |= aAddingModifiers;
|
||||
EnsureAltGr();
|
||||
}
|
||||
MOZ_ALWAYS_INLINE void Unset(Modifiers aRemovingModifiers);
|
||||
MOZ_ALWAYS_INLINE void Set(Modifiers aAddingModifiers);
|
||||
|
||||
void InitInputEvent(WidgetInputEvent& aInputEvent) const;
|
||||
|
||||
bool IsShift() const { return (mModifiers & MODIFIER_SHIFT) != 0; }
|
||||
bool IsControl() const { return (mModifiers & MODIFIER_CONTROL) != 0; }
|
||||
bool IsAlt() const { return (mModifiers & MODIFIER_ALT) != 0; }
|
||||
bool IsAltGr() const { return IsControl() && IsAlt(); }
|
||||
bool IsWin() const { return (mModifiers & MODIFIER_OS) != 0; }
|
||||
MOZ_ALWAYS_INLINE bool IsShift() const;
|
||||
MOZ_ALWAYS_INLINE bool IsControl() const;
|
||||
MOZ_ALWAYS_INLINE bool IsAlt() const;
|
||||
MOZ_ALWAYS_INLINE bool IsAltGr() const;
|
||||
MOZ_ALWAYS_INLINE bool IsWin() const;
|
||||
|
||||
bool IsCapsLocked() const { return (mModifiers & MODIFIER_CAPSLOCK) != 0; }
|
||||
bool IsNumLocked() const { return (mModifiers & MODIFIER_NUMLOCK) != 0; }
|
||||
bool IsScrollLocked() const
|
||||
{
|
||||
return (mModifiers & MODIFIER_SCROLLLOCK) != 0;
|
||||
}
|
||||
MOZ_ALWAYS_INLINE bool IsCapsLocked() const;
|
||||
MOZ_ALWAYS_INLINE bool IsNumLocked() const;
|
||||
MOZ_ALWAYS_INLINE bool IsScrollLocked() const;
|
||||
|
||||
Modifiers GetModifiers() const { return mModifiers; }
|
||||
MOZ_ALWAYS_INLINE Modifiers GetModifiers() const;
|
||||
|
||||
private:
|
||||
Modifiers mModifiers;
|
||||
|
||||
void EnsureAltGr()
|
||||
{
|
||||
// If both Control key and Alt key are pressed, it means AltGr is pressed.
|
||||
// Ideally, we should check whether the current keyboard layout has AltGr
|
||||
// or not. However, setting AltGr flags for keyboard which doesn't have
|
||||
// AltGr must not be serious bug. So, it should be OK for now.
|
||||
if (IsAltGr()) {
|
||||
mModifiers |= MODIFIER_ALTGRAPH;
|
||||
}
|
||||
}
|
||||
MOZ_ALWAYS_INLINE void EnsureAltGr();
|
||||
|
||||
void InitMouseEvent(WidgetInputEvent& aMouseEvent) const;
|
||||
};
|
||||
@ -196,45 +149,8 @@ public:
|
||||
|
||||
typedef uint8_t ShiftState;
|
||||
|
||||
static ShiftState ModifiersToShiftState(Modifiers aModifiers)
|
||||
{
|
||||
ShiftState state = 0;
|
||||
if (aModifiers & MODIFIER_SHIFT) {
|
||||
state |= STATE_SHIFT;
|
||||
}
|
||||
if (aModifiers & MODIFIER_CONTROL) {
|
||||
state |= STATE_CONTROL;
|
||||
}
|
||||
if (aModifiers & MODIFIER_ALT) {
|
||||
state |= STATE_ALT;
|
||||
}
|
||||
if (aModifiers & MODIFIER_CAPSLOCK) {
|
||||
state |= STATE_CAPSLOCK;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
static Modifiers ShiftStateToModifiers(ShiftState aShiftState)
|
||||
{
|
||||
Modifiers modifiers = 0;
|
||||
if (aShiftState & STATE_SHIFT) {
|
||||
modifiers |= MODIFIER_SHIFT;
|
||||
}
|
||||
if (aShiftState & STATE_CONTROL) {
|
||||
modifiers |= MODIFIER_CONTROL;
|
||||
}
|
||||
if (aShiftState & STATE_ALT) {
|
||||
modifiers |= MODIFIER_ALT;
|
||||
}
|
||||
if (aShiftState & STATE_CAPSLOCK) {
|
||||
modifiers |= MODIFIER_CAPSLOCK;
|
||||
}
|
||||
if ((modifiers & (MODIFIER_ALT | MODIFIER_CONTROL)) ==
|
||||
(MODIFIER_ALT | MODIFIER_CONTROL)) {
|
||||
modifiers |= MODIFIER_ALTGRAPH;
|
||||
}
|
||||
return modifiers;
|
||||
}
|
||||
static ShiftState ModifiersToShiftState(Modifiers aModifiers);
|
||||
static Modifiers ShiftStateToModifiers(ShiftState aShiftState);
|
||||
|
||||
private:
|
||||
union KeyShiftState
|
||||
@ -428,10 +344,7 @@ private:
|
||||
*/
|
||||
void InitKeyEvent(WidgetKeyboardEvent& aKeyEvent,
|
||||
const ModifierKeyState& aModKeyState) const;
|
||||
void InitKeyEvent(WidgetKeyboardEvent& aKeyEvent) const
|
||||
{
|
||||
InitKeyEvent(aKeyEvent, mModKeyState);
|
||||
}
|
||||
void InitKeyEvent(WidgetKeyboardEvent& aKeyEvent) const;
|
||||
|
||||
/**
|
||||
* Dispatches the key event. Returns true if the event is consumed.
|
||||
|
@ -61,6 +61,7 @@ CPP_SOURCES += [
|
||||
'nsWidgetFactory.cpp',
|
||||
'nsWinGesture.cpp',
|
||||
'nsWindow.cpp',
|
||||
'nsWindowBase.cpp',
|
||||
'nsWindowDbg.cpp',
|
||||
'nsWindowGfx.cpp',
|
||||
]
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "nsIWidget.h"
|
||||
#include "nsWindowBase.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "mozilla/TextRange.h"
|
||||
|
||||
#include <msctf.h>
|
||||
#include <textstor.h>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user