mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Merge from mozilla-central.
--HG-- rename : js/src/sharkctl.cpp => js/src/devtools/sharkctl.cpp rename : js/src/sharkctl.h => js/src/devtools/sharkctl.h rename : js/src/MemoryMetrics.cpp => js/src/jsmemorymetrics.cpp
This commit is contained in:
commit
25cb077cb2
@ -69,7 +69,7 @@ endif
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
GARBAGE_DIRS += dist _javagen _profile _tests staticlib
|
||||
DIST_GARBAGE = config.cache config.log config.status config-defs.h \
|
||||
DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
|
||||
config/autoconf.mk \
|
||||
unallmakefiles mozilla-config.h \
|
||||
netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#include "Accessible.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccCollector
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -56,7 +58,7 @@ AccCollector::EnsureNGetObject(uint32_t aIndex)
|
||||
uint32_t childCount = mRoot->ChildCount();
|
||||
while (mRootChildIdx < childCount) {
|
||||
Accessible* child = mRoot->GetChildAt(mRootChildIdx++);
|
||||
if (!mFilterFunc(child))
|
||||
if (!(mFilterFunc(child) & filters::eMatch))
|
||||
continue;
|
||||
|
||||
AppendObject(child);
|
||||
@ -73,7 +75,7 @@ AccCollector::EnsureNGetIndex(Accessible* aAccessible)
|
||||
uint32_t childCount = mRoot->ChildCount();
|
||||
while (mRootChildIdx < childCount) {
|
||||
Accessible* child = mRoot->GetChildAt(mRootChildIdx++);
|
||||
if (!mFilterFunc(child))
|
||||
if (!(mFilterFunc(child) & filters::eMatch))
|
||||
continue;
|
||||
|
||||
AppendObject(child);
|
||||
@ -103,7 +105,8 @@ EmbeddedObjCollector::GetIndexAt(Accessible* aAccessible)
|
||||
if (aAccessible->mIndexOfEmbeddedChild != -1)
|
||||
return aAccessible->mIndexOfEmbeddedChild;
|
||||
|
||||
return mFilterFunc(aAccessible) ? EnsureNGetIndex(aAccessible) : -1;
|
||||
return mFilterFunc(aAccessible) & filters::eMatch ?
|
||||
EnsureNGetIndex(aAccessible) : -1;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2,14 +2,18 @@
|
||||
* 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 AccCollector_h_
|
||||
#define AccCollector_h_
|
||||
#ifndef mozilla_a11y_AccCollector_h__
|
||||
#define mozilla_a11y_AccCollector_h__
|
||||
|
||||
#include "filters.h"
|
||||
#include "AccFilters.h"
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
class Accessible;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
/**
|
||||
* Collect accessible children complying with filter function. Provides quick
|
||||
* access to accessible by index.
|
||||
@ -82,7 +86,10 @@ protected:
|
||||
|
||||
virtual void AppendObject(Accessible* aAccessible);
|
||||
|
||||
friend class Accessible;
|
||||
friend class ::Accessible;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
60
accessible/src/base/AccFilters.cpp
Normal file
60
accessible/src/base/AccFilters.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "AccFilters.h"
|
||||
|
||||
#include "Accessible-inl.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "Role.h"
|
||||
#include "States.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
using namespace mozilla::a11y::filters;
|
||||
|
||||
uint32_t
|
||||
filters::GetSelected(Accessible* aAccessible)
|
||||
{
|
||||
if (aAccessible->State() & states::SELECTED)
|
||||
return eMatch | eSkipSubtree;
|
||||
|
||||
return eSkip;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
filters::GetSelectable(Accessible* aAccessible)
|
||||
{
|
||||
if (aAccessible->InteractiveState() & states::SELECTABLE)
|
||||
return eMatch | eSkipSubtree;
|
||||
|
||||
return eSkip;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
filters::GetRow(Accessible* aAccessible)
|
||||
{
|
||||
a11y::role role = aAccessible->Role();
|
||||
if (role == roles::ROW)
|
||||
return eMatch | eSkipSubtree;
|
||||
|
||||
// Look for rows inside rowgroup.
|
||||
if (role == roles::SECTION)
|
||||
return eSkip;
|
||||
|
||||
return eSkipSubtree;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
filters::GetCell(Accessible* aAccessible)
|
||||
{
|
||||
a11y::role role = aAccessible->Role();
|
||||
return role == roles::GRID_CELL || role == roles::ROWHEADER ||
|
||||
role == roles::COLUMNHEADER ? eMatch : eSkipSubtree;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
filters::GetEmbeddedObject(Accessible* aAccessible)
|
||||
{
|
||||
return nsAccUtils::IsEmbeddedObject(aAccessible) ?
|
||||
eMatch | eSkipSubtree : eSkipSubtree;
|
||||
}
|
55
accessible/src/base/AccFilters.h
Normal file
55
accessible/src/base/AccFilters.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_a11y_Filters_h__
|
||||
#define mozilla_a11y_Filters_h__
|
||||
|
||||
#include "mozilla/StandardInteger.h"
|
||||
|
||||
class Accessible;
|
||||
|
||||
/**
|
||||
* Predefined filters used for nsAccIterator and nsAccCollector.
|
||||
*/
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
namespace filters {
|
||||
|
||||
enum EResult {
|
||||
eSkip = 0,
|
||||
eMatch = 1,
|
||||
eSkipSubtree = 2
|
||||
};
|
||||
|
||||
/**
|
||||
* Return true if the traversed accessible complies with filter.
|
||||
*/
|
||||
typedef uint32_t (*FilterFuncPtr) (Accessible*);
|
||||
|
||||
/**
|
||||
* Matches selected/selectable accessibles in subtree.
|
||||
*/
|
||||
uint32_t GetSelected(Accessible* aAccessible);
|
||||
uint32_t GetSelectable(Accessible* aAccessible);
|
||||
|
||||
/**
|
||||
* Matches row accessibles in subtree.
|
||||
*/
|
||||
uint32_t GetRow(Accessible* aAccessible);
|
||||
|
||||
/**
|
||||
* Matches cell accessibles in children.
|
||||
*/
|
||||
uint32_t GetCell(Accessible* aAccessible);
|
||||
|
||||
/**
|
||||
* Matches embedded objects in children.
|
||||
*/
|
||||
uint32_t GetEmbeddedObject(Accessible* aAccessible);
|
||||
|
||||
} // namespace filters
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
@ -18,9 +18,8 @@ using namespace mozilla::a11y;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AccIterator::AccIterator(Accessible* aAccessible,
|
||||
filters::FilterFuncPtr aFilterFunc,
|
||||
IterationType aIterationType) :
|
||||
mFilterFunc(aFilterFunc), mIsDeep(aIterationType != eFlatNav)
|
||||
filters::FilterFuncPtr aFilterFunc) :
|
||||
mFilterFunc(aFilterFunc)
|
||||
{
|
||||
mState = new IteratorState(aAccessible);
|
||||
}
|
||||
@ -40,19 +39,19 @@ AccIterator::Next()
|
||||
while (mState) {
|
||||
Accessible* child = mState->mParent->GetChildAt(mState->mIndex++);
|
||||
if (!child) {
|
||||
IteratorState *tmp = mState;
|
||||
IteratorState* tmp = mState;
|
||||
mState = mState->mParentState;
|
||||
delete tmp;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
bool isComplying = mFilterFunc(child);
|
||||
if (isComplying)
|
||||
uint32_t result = mFilterFunc(child);
|
||||
if (result & filters::eMatch)
|
||||
return child;
|
||||
|
||||
if (mIsDeep) {
|
||||
IteratorState *childState = new IteratorState(child, mState);
|
||||
if (!(result & filters::eSkipSubtree)) {
|
||||
IteratorState* childState = new IteratorState(child, mState);
|
||||
mState = childState;
|
||||
}
|
||||
}
|
||||
|
@ -4,13 +4,15 @@
|
||||
* 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 nsAccIterator_h_
|
||||
#define nsAccIterator_h_
|
||||
#ifndef mozilla_a11y_AccIterator_h__
|
||||
#define mozilla_a11y_AccIterator_h__
|
||||
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "filters.h"
|
||||
#include "nscore.h"
|
||||
#include "DocAccessible.h"
|
||||
#include "AccFilters.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
/**
|
||||
* AccIterable is a basic interface for iterators over accessibles.
|
||||
@ -33,24 +35,7 @@ private:
|
||||
class AccIterator : public AccIterable
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Used to define iteration type.
|
||||
*/
|
||||
enum IterationType {
|
||||
/**
|
||||
* Navigation happens through direct children.
|
||||
*/
|
||||
eFlatNav,
|
||||
|
||||
/**
|
||||
* Navigation through subtree excluding iterator root; if the accessible
|
||||
* complies with filter, iterator ignores its children.
|
||||
*/
|
||||
eTreeNav
|
||||
};
|
||||
|
||||
AccIterator(Accessible* aRoot, filters::FilterFuncPtr aFilterFunc,
|
||||
IterationType aIterationType = eFlatNav);
|
||||
AccIterator(Accessible* aRoot, filters::FilterFuncPtr aFilterFunc);
|
||||
virtual ~AccIterator();
|
||||
|
||||
/**
|
||||
@ -70,12 +55,11 @@ private:
|
||||
|
||||
Accessible* mParent;
|
||||
int32_t mIndex;
|
||||
IteratorState *mParentState;
|
||||
IteratorState* mParentState;
|
||||
};
|
||||
|
||||
filters::FilterFuncPtr mFilterFunc;
|
||||
bool mIsDeep;
|
||||
IteratorState *mState;
|
||||
IteratorState* mState;
|
||||
};
|
||||
|
||||
|
||||
@ -282,4 +266,7 @@ private:
|
||||
nsRefPtr<Accessible> mAcc;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -19,8 +19,8 @@ CPPSRCS = \
|
||||
AccEvent.cpp \
|
||||
AccGroupInfo.cpp \
|
||||
AccIterator.cpp \
|
||||
AccFilters.cpp \
|
||||
ARIAStateMap.cpp \
|
||||
filters.cpp \
|
||||
FocusManager.cpp \
|
||||
NotificationController.cpp \
|
||||
nsAccDocManager.cpp \
|
||||
|
@ -19,11 +19,12 @@ namespace a11y {
|
||||
*/
|
||||
struct RelationCopyHelper
|
||||
{
|
||||
RelationCopyHelper(AccIterable* aFirstIter, AccIterable* aLastIter) :
|
||||
RelationCopyHelper(mozilla::a11y::AccIterable* aFirstIter,
|
||||
mozilla::a11y::AccIterable* aLastIter) :
|
||||
mFirstIter(aFirstIter), mLastIter(aLastIter) { }
|
||||
|
||||
AccIterable* mFirstIter;
|
||||
AccIterable* mLastIter;
|
||||
mozilla::a11y::AccIterable* mFirstIter;
|
||||
mozilla::a11y::AccIterable* mLastIter;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -38,7 +39,8 @@ public:
|
||||
Relation(const RelationCopyHelper aRelation) :
|
||||
mFirstIter(aRelation.mFirstIter), mLastIter(aRelation.mLastIter) { }
|
||||
|
||||
Relation(AccIterable* aIter) : mFirstIter(aIter), mLastIter(aIter) { }
|
||||
Relation(mozilla::a11y::AccIterable* aIter) :
|
||||
mFirstIter(aIter), mLastIter(aIter) { }
|
||||
|
||||
Relation(Accessible* aAcc) :
|
||||
mFirstIter(nullptr), mLastIter(nullptr)
|
||||
@ -67,7 +69,7 @@ public:
|
||||
return RelationCopyHelper(mFirstIter.forget(), mLastIter);
|
||||
}
|
||||
|
||||
inline void AppendIter(AccIterable* aIter)
|
||||
inline void AppendIter(mozilla::a11y::AccIterable* aIter)
|
||||
{
|
||||
if (mLastIter)
|
||||
mLastIter->mNextIter = aIter;
|
||||
@ -83,7 +85,7 @@ public:
|
||||
inline void AppendTarget(Accessible* aAcc)
|
||||
{
|
||||
if (aAcc)
|
||||
AppendIter(new SingleAccIterator(aAcc));
|
||||
AppendIter(new mozilla::a11y::SingleAccIterator(aAcc));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -116,8 +118,8 @@ public:
|
||||
private:
|
||||
Relation& operator = (const Relation&);
|
||||
|
||||
nsAutoPtr<AccIterable> mFirstIter;
|
||||
AccIterable* mLastIter;
|
||||
nsAutoPtr<mozilla::a11y::AccIterable> mFirstIter;
|
||||
mozilla::a11y::AccIterable* mLastIter;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
|
@ -1,44 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "filters.h"
|
||||
|
||||
#include "Accessible-inl.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "Role.h"
|
||||
#include "States.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
bool
|
||||
filters::GetSelected(Accessible* aAccessible)
|
||||
{
|
||||
return aAccessible->State() & states::SELECTED;
|
||||
}
|
||||
|
||||
bool
|
||||
filters::GetSelectable(Accessible* aAccessible)
|
||||
{
|
||||
return aAccessible->InteractiveState() & states::SELECTABLE;
|
||||
}
|
||||
|
||||
bool
|
||||
filters::GetRow(Accessible* aAccessible)
|
||||
{
|
||||
return aAccessible->Role() == roles::ROW;
|
||||
}
|
||||
|
||||
bool
|
||||
filters::GetCell(Accessible* aAccessible)
|
||||
{
|
||||
roles::Role role = aAccessible->Role();
|
||||
return role == roles::GRID_CELL || role == roles::ROWHEADER ||
|
||||
role == roles::COLUMNHEADER;
|
||||
}
|
||||
|
||||
bool
|
||||
filters::GetEmbeddedObject(Accessible* aAccessible)
|
||||
{
|
||||
return nsAccUtils::IsEmbeddedObject(aAccessible);
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/* 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 a11yFilters_h_
|
||||
#define a11yFilters_h_
|
||||
|
||||
class Accessible;
|
||||
|
||||
/**
|
||||
* Predefined filters used for nsAccIterator and nsAccCollector.
|
||||
*/
|
||||
namespace filters {
|
||||
|
||||
/**
|
||||
* Return true if the traversed accessible complies with filter.
|
||||
*/
|
||||
typedef bool (*FilterFuncPtr) (Accessible*);
|
||||
|
||||
bool GetSelected(Accessible* aAccessible);
|
||||
bool GetSelectable(Accessible* aAccessible);
|
||||
bool GetRow(Accessible* aAccessible);
|
||||
bool GetCell(Accessible* aAccessible);
|
||||
bool GetEmbeddedObject(Accessible* aAccessible);
|
||||
}
|
||||
|
||||
#endif
|
@ -103,7 +103,7 @@ public:
|
||||
* these accessibles share the same DOM node. The primary accessible "owns"
|
||||
* that DOM node in terms it gets stored in the accessible to node map.
|
||||
*/
|
||||
virtual bool IsPrimaryForNode() const;
|
||||
virtual bool IsPrimaryForNode() const;//hello
|
||||
|
||||
/**
|
||||
* Interface methods on nsIAccessible shared with ISimpleDOM.
|
||||
|
53
accessible/src/generic/ARIAGridAccessible-inl.h
Normal file
53
accessible/src/generic/ARIAGridAccessible-inl.h
Normal file
@ -0,0 +1,53 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_a11y_ARIAGridAccessible_inl_h__
|
||||
#define mozilla_a11y_ARIAGridAccessible_inl_h__
|
||||
|
||||
#include "ARIAGridAccessible.h"
|
||||
|
||||
#include "AccIterator.h"
|
||||
|
||||
inline Accessible*
|
||||
mozilla::a11y::ARIAGridCellAccessible::TableFor(Accessible* aRow) const
|
||||
{
|
||||
if (aRow) {
|
||||
Accessible* table = aRow->Parent();
|
||||
if (table) {
|
||||
roles::Role tableRole = table->Role();
|
||||
if (tableRole == roles::SECTION) { // if there's a rowgroup.
|
||||
table = table->Parent();
|
||||
if (table)
|
||||
tableRole = table->Role();
|
||||
}
|
||||
|
||||
return tableRole == roles::TABLE || tableRole == roles::TREE_TABLE ?
|
||||
table : nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline int32_t
|
||||
mozilla::a11y::ARIAGridCellAccessible::RowIndexFor(Accessible* aRow) const
|
||||
{
|
||||
Accessible* table = TableFor(aRow);
|
||||
if (table) {
|
||||
int32_t rowIdx = 0;
|
||||
Accessible* row = nullptr;
|
||||
AccIterator rowIter(table, filters::GetRow);
|
||||
while ((row = rowIter.Next()) && row != aRow)
|
||||
rowIdx++;
|
||||
|
||||
if (row)
|
||||
return rowIdx;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
@ -3,7 +3,7 @@
|
||||
* 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 "ARIAGridAccessible.h"
|
||||
#include "ARIAGridAccessible-inl.h"
|
||||
|
||||
#include "Accessible-inl.h"
|
||||
#include "AccIterator.h"
|
||||
@ -551,19 +551,10 @@ ARIAGridCellAccessible::GetTable(nsIAccessibleTable** aTable)
|
||||
NS_ENSURE_ARG_POINTER(aTable);
|
||||
*aTable = nullptr;
|
||||
|
||||
Accessible* thisRow = Parent();
|
||||
if (!thisRow || thisRow->Role() != roles::ROW)
|
||||
return NS_OK;
|
||||
Accessible* table = TableFor(Row());
|
||||
if (table)
|
||||
CallQueryInterface(table, aTable);
|
||||
|
||||
Accessible* table = thisRow->Parent();
|
||||
if (!table)
|
||||
return NS_OK;
|
||||
|
||||
roles::Role tableRole = table->Role();
|
||||
if (tableRole != roles::TABLE && tableRole != roles::TREE_TABLE)
|
||||
return NS_OK;
|
||||
|
||||
CallQueryInterface(table, aTable);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -603,23 +594,7 @@ ARIAGridCellAccessible::GetRowIndex(int32_t* aRowIndex)
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
Accessible* row = Parent();
|
||||
if (!row)
|
||||
return NS_OK;
|
||||
|
||||
Accessible* table = row->Parent();
|
||||
if (!table)
|
||||
return NS_OK;
|
||||
|
||||
*aRowIndex = 0;
|
||||
|
||||
int32_t indexInTable = row->IndexInParent();
|
||||
for (int32_t idx = 0; idx < indexInTable; idx++) {
|
||||
row = table->GetChildAt(idx);
|
||||
if (row->Role() == roles::ROW)
|
||||
(*aRowIndex)++;
|
||||
}
|
||||
|
||||
*aRowIndex = RowIndexFor(Row());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -743,9 +718,8 @@ ARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties* aAttribut
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Expose "table-cell-index" attribute.
|
||||
|
||||
Accessible* thisRow = Parent();
|
||||
if (!thisRow || thisRow->Role() != roles::ROW)
|
||||
Accessible* thisRow = Row();
|
||||
if (!thisRow)
|
||||
return NS_OK;
|
||||
|
||||
int32_t colIdx = 0, colCount = 0;
|
||||
@ -761,29 +735,10 @@ ARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties* aAttribut
|
||||
colCount++;
|
||||
}
|
||||
|
||||
Accessible* table = thisRow->Parent();
|
||||
if (!table)
|
||||
return NS_OK;
|
||||
|
||||
roles::Role tableRole = table->Role();
|
||||
if (tableRole != roles::TABLE && tableRole != roles::TREE_TABLE)
|
||||
return NS_OK;
|
||||
|
||||
int32_t rowIdx = 0;
|
||||
childCount = table->ChildCount();
|
||||
for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
|
||||
Accessible* child = table->GetChildAt(childIdx);
|
||||
if (child == thisRow)
|
||||
break;
|
||||
|
||||
if (child->Role() == roles::ROW)
|
||||
rowIdx++;
|
||||
}
|
||||
|
||||
int32_t idx = rowIdx * colCount + colIdx;
|
||||
int32_t rowIdx = RowIndexFor(thisRow);
|
||||
|
||||
nsAutoString stringIdx;
|
||||
stringIdx.AppendInt(idx);
|
||||
stringIdx.AppendInt(rowIdx * colCount + colIdx);
|
||||
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::tableCellIndex,
|
||||
stringIdx);
|
||||
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
virtual void UnselectRow(uint32_t aRowIdx);
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Return true if the given row index is valid.
|
||||
*/
|
||||
@ -114,6 +115,27 @@ public:
|
||||
virtual void Shutdown();
|
||||
virtual void ApplyARIAState(uint64_t* aState) const;
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Return a containing row.
|
||||
*/
|
||||
Accessible* Row() const
|
||||
{
|
||||
Accessible* row = Parent();
|
||||
return row && row->Role() == roles::ROW ? row : nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a table for the given row.
|
||||
*/
|
||||
Accessible* TableFor(Accessible* aRow) const;
|
||||
|
||||
/**
|
||||
* Return index of the given row.
|
||||
*/
|
||||
int32_t RowIndexFor(Accessible* aRow) const;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
|
@ -2728,7 +2728,7 @@ Accessible::SelectedItems()
|
||||
if (!selectedItems)
|
||||
return nullptr;
|
||||
|
||||
AccIterator iter(this, filters::GetSelected, AccIterator::eTreeNav);
|
||||
AccIterator iter(this, filters::GetSelected);
|
||||
nsIAccessible* selected = nullptr;
|
||||
while ((selected = iter.Next()))
|
||||
selectedItems->AppendElement(selected, false);
|
||||
@ -2742,7 +2742,7 @@ uint32_t
|
||||
Accessible::SelectedItemCount()
|
||||
{
|
||||
uint32_t count = 0;
|
||||
AccIterator iter(this, filters::GetSelected, AccIterator::eTreeNav);
|
||||
AccIterator iter(this, filters::GetSelected);
|
||||
Accessible* selected = nullptr;
|
||||
while ((selected = iter.Next()))
|
||||
++count;
|
||||
@ -2753,7 +2753,7 @@ Accessible::SelectedItemCount()
|
||||
Accessible*
|
||||
Accessible::GetSelectedItem(uint32_t aIndex)
|
||||
{
|
||||
AccIterator iter(this, filters::GetSelected, AccIterator::eTreeNav);
|
||||
AccIterator iter(this, filters::GetSelected);
|
||||
Accessible* selected = nullptr;
|
||||
|
||||
uint32_t index = 0;
|
||||
@ -2767,7 +2767,7 @@ bool
|
||||
Accessible::IsItemSelected(uint32_t aIndex)
|
||||
{
|
||||
uint32_t index = 0;
|
||||
AccIterator iter(this, filters::GetSelectable, AccIterator::eTreeNav);
|
||||
AccIterator iter(this, filters::GetSelectable);
|
||||
Accessible* selected = nullptr;
|
||||
while ((selected = iter.Next()) && index < aIndex)
|
||||
index++;
|
||||
@ -2780,7 +2780,7 @@ bool
|
||||
Accessible::AddItemToSelection(uint32_t aIndex)
|
||||
{
|
||||
uint32_t index = 0;
|
||||
AccIterator iter(this, filters::GetSelectable, AccIterator::eTreeNav);
|
||||
AccIterator iter(this, filters::GetSelectable);
|
||||
Accessible* selected = nullptr;
|
||||
while ((selected = iter.Next()) && index < aIndex)
|
||||
index++;
|
||||
@ -2795,7 +2795,7 @@ bool
|
||||
Accessible::RemoveItemFromSelection(uint32_t aIndex)
|
||||
{
|
||||
uint32_t index = 0;
|
||||
AccIterator iter(this, filters::GetSelectable, AccIterator::eTreeNav);
|
||||
AccIterator iter(this, filters::GetSelectable);
|
||||
Accessible* selected = nullptr;
|
||||
while ((selected = iter.Next()) && index < aIndex)
|
||||
index++;
|
||||
@ -2812,7 +2812,7 @@ Accessible::SelectAll()
|
||||
bool success = false;
|
||||
Accessible* selectable = nullptr;
|
||||
|
||||
AccIterator iter(this, filters::GetSelectable, AccIterator::eTreeNav);
|
||||
AccIterator iter(this, filters::GetSelectable);
|
||||
while((selectable = iter.Next())) {
|
||||
success = true;
|
||||
selectable->SetSelected(true);
|
||||
@ -2826,7 +2826,7 @@ Accessible::UnselectAll()
|
||||
bool success = false;
|
||||
Accessible* selected = nullptr;
|
||||
|
||||
AccIterator iter(this, filters::GetSelected, AccIterator::eTreeNav);
|
||||
AccIterator iter(this, filters::GetSelected);
|
||||
while ((selected = iter.Next())) {
|
||||
success = true;
|
||||
selected->SetSelected(false);
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
class AccEvent;
|
||||
class AccGroupInfo;
|
||||
class EmbeddedObjCollector;
|
||||
class KeyBinding;
|
||||
class Accessible;
|
||||
class HyperTextAccessible;
|
||||
@ -32,6 +31,7 @@ struct nsRoleMapEntry;
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class EmbeddedObjCollector;
|
||||
class HTMLImageMapAccessible;
|
||||
class HTMLLIAccessible;
|
||||
class ImageAccessible;
|
||||
@ -875,9 +875,9 @@ protected:
|
||||
uint32_t mFlags;
|
||||
friend class DocAccessible;
|
||||
|
||||
nsAutoPtr<EmbeddedObjCollector> mEmbeddedObjCollector;
|
||||
nsAutoPtr<mozilla::a11y::EmbeddedObjCollector> mEmbeddedObjCollector;
|
||||
int32_t mIndexOfEmbeddedChild;
|
||||
friend class EmbeddedObjCollector;
|
||||
friend class mozilla::a11y::EmbeddedObjCollector;
|
||||
|
||||
nsAutoPtr<AccGroupInfo> mGroupInfo;
|
||||
friend class AccGroupInfo;
|
||||
|
@ -33,6 +33,14 @@ class nsAccessiblePivot;
|
||||
|
||||
const uint32_t kDefaultCacheSize = 256;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class RelatedAccIterator;
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
class DocAccessible : public HyperTextAccessibleWrap,
|
||||
public nsIAccessibleDocument,
|
||||
public nsIDocumentObserver,
|
||||
@ -567,7 +575,7 @@ protected:
|
||||
typedef nsTArray<nsAutoPtr<AttrRelProvider> > AttrRelProviderArray;
|
||||
nsClassHashtable<nsStringHashKey, AttrRelProviderArray> mDependentIDsHash;
|
||||
|
||||
friend class RelatedAccIterator;
|
||||
friend class mozilla::a11y::RelatedAccIterator;
|
||||
|
||||
/**
|
||||
* Used for our caching algorithm. We store the list of nodes that should be
|
||||
|
@ -28,6 +28,14 @@
|
||||
];
|
||||
testTableIndexes("grid", idxes);
|
||||
|
||||
idxes = [
|
||||
[0, 1, 2],
|
||||
[3, 4, 5],
|
||||
[6, 7, 8],
|
||||
[9, 10, 11]
|
||||
];
|
||||
testTableIndexes("grid-rowgroups", idxes);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// a bit crazy ARIA grid
|
||||
idxes = [
|
||||
@ -51,6 +59,9 @@
|
||||
<a target="_blank"
|
||||
title="nsHTMLTableCellAccessible is used in dojo's crazy ARIA grid"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=513848">Mozilla Bug 513848</a>
|
||||
<a target="_blank"
|
||||
title="ARIA grid with rowgroup breaks table row/col counting and indices"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=761853">Mozilla Bug 761853</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
@ -80,6 +91,31 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div role="grid" id="grid-rowgroups">
|
||||
<div role="row">
|
||||
<span role="columnheader">grid-rowgroups-col1</span>
|
||||
<span role="columnheader">grid-rowgroups-col2</span>
|
||||
<span role="columnheader">grid-rowgroups-col3</span>
|
||||
</div>
|
||||
<div role="rowgroup">
|
||||
<div role="row">
|
||||
<span role="rowheader">grid-rowgroups-row1</span>
|
||||
<span role="gridcell">grid-rowgroups-cell1</span>
|
||||
<span role="gridcell">grid-rowgroups-cell2</span>
|
||||
</div>
|
||||
<div role="row">
|
||||
<span role="rowheader">grid-rowgroups-row2</span>
|
||||
<span role="gridcell">grid-rowgroups-cell3</span>
|
||||
<span role="gridcell">grid-rowgroups-cell4</span>
|
||||
</div>
|
||||
</div>
|
||||
<div role="row">
|
||||
<span role="rowheader">grid-rowgroups-row3</span>
|
||||
<span role="gridcell">grid-rowgroups-cell5</span>
|
||||
<span role="gridcell">grid-rowgroups-cell6</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div role="grid" id="grid2">
|
||||
<div role="row">
|
||||
<table role="presentation">
|
||||
|
@ -103,3 +103,6 @@ SettingsListener.observe('debug.log-animations.enabled', false, function(value)
|
||||
Services.prefs.setBoolPref('layers.offmainthreadcomposition.log-animations', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('debug.dev-mode', false, function(value) {
|
||||
Services.prefs.setBoolPref('dom.mozApps.dev_mode', value);
|
||||
});
|
||||
|
@ -13,10 +13,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
|
||||
const messageManager = Cc["@mozilla.org/globalmessagemanager;1"]
|
||||
.getService(Ci.nsIMessageBroadcaster);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// MozKeyboard
|
||||
// -----------------------------------------------------------------------
|
||||
@ -39,9 +35,6 @@ MozKeyboard.prototype = {
|
||||
}),
|
||||
|
||||
init: function mozKeyboardInit(win) {
|
||||
messageManager.loadFrameScript(kFormsFrameScript, true);
|
||||
messageManager.addMessageListener("Forms:Input", this);
|
||||
|
||||
Services.obs.addObserver(this, "inner-window-destroyed", false);
|
||||
Services.obs.addObserver(this, 'in-process-browser-frame-shown', false);
|
||||
Services.obs.addObserver(this, 'remote-browser-frame-shown', false);
|
||||
@ -56,7 +49,9 @@ MozKeyboard.prototype = {
|
||||
|
||||
uninit: function mozKeyboardUninit() {
|
||||
Services.obs.removeObserver(this, "inner-window-destroyed");
|
||||
messageManager.removeMessageListener("Forms:Input", this);
|
||||
if (this._messageManager) {
|
||||
this._messageManager.removeMessageListener("Forms:Input", this);
|
||||
}
|
||||
this._window = null;
|
||||
this._utils = null;
|
||||
this._focusHandler = null;
|
||||
@ -70,19 +65,19 @@ MozKeyboard.prototype = {
|
||||
},
|
||||
|
||||
setSelectedOption: function mozKeyboardSetSelectedOption(index) {
|
||||
messageManager.broadcastAsyncMessage("Forms:Select:Choice", {
|
||||
this._messageManager.broadcastAsyncMessage("Forms:Select:Choice", {
|
||||
"index": index
|
||||
});
|
||||
},
|
||||
|
||||
setValue: function mozKeyboardSetValue(value) {
|
||||
messageManager.broadcastAsyncMessage("Forms:Input:Value", {
|
||||
this._messageManager.broadcastAsyncMessage("Forms:Input:Value", {
|
||||
"value": value
|
||||
});
|
||||
},
|
||||
|
||||
setSelectedOptions: function mozKeyboardSetSelectedOptions(indexes) {
|
||||
messageManager.broadcastAsyncMessage("Forms:Select:Choice", {
|
||||
this._messageManager.broadcastAsyncMessage("Forms:Select:Choice", {
|
||||
"indexes": indexes || []
|
||||
});
|
||||
},
|
||||
@ -122,6 +117,7 @@ MozKeyboard.prototype = {
|
||||
case 'in-process-browser-frame-shown': {
|
||||
let frameLoader = subject.QueryInterface(Ci.nsIFrameLoader);
|
||||
let mm = frameLoader.messageManager;
|
||||
this._messageManager = mm;
|
||||
mm.addMessageListener("Forms:Input", this);
|
||||
try {
|
||||
mm.loadFrameScript(kFormsFrameScript, true);
|
||||
|
@ -160,6 +160,7 @@
|
||||
@BINPATH@/components/dom_telephony.xpt
|
||||
@BINPATH@/components/dom_wifi.xpt
|
||||
@BINPATH@/components/dom_system_gonk.xpt
|
||||
@BINPATH@/components/dom_icc.xpt
|
||||
#endif
|
||||
@BINPATH@/components/dom_battery.xpt
|
||||
#ifdef MOZ_B2G_BT
|
||||
|
@ -46,8 +46,11 @@ function SP_Pretty_Key(aElemKey) {
|
||||
|
||||
if (elemMod.match("accel")) {
|
||||
if (navigator.platform.indexOf("Mac") !== -1) {
|
||||
elemString += keysbundle.GetStringFromName("VK_META") +
|
||||
keysbundle.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
// XXX bug 779642 Use "Cmd-" literal vs cloverleaf meta-key until
|
||||
// Orion adds variable height lines
|
||||
// elemString += keysbundle.GetStringFromName("VK_META_CMD") +
|
||||
// keysbundle.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
elemString += "Cmd-";
|
||||
} else {
|
||||
elemString += keysbundle.GetStringFromName("VK_CONTROL") +
|
||||
keysbundle.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
|
@ -169,6 +169,7 @@
|
||||
@BINPATH@/components/dom_telephony.xpt
|
||||
@BINPATH@/components/dom_wifi.xpt
|
||||
@BINPATH@/components/dom_system_gonk.xpt
|
||||
@BINPATH@/components/dom_icc.xpt
|
||||
#endif
|
||||
@BINPATH@/components/dom_battery.xpt
|
||||
#ifdef MOZ_B2G_BT
|
||||
|
@ -6,7 +6,7 @@
|
||||
<ShortName>Twitter</ShortName>
|
||||
<Description>Realtime Twitter Search</Description>
|
||||
<InputEncoding>UTF-8</InputEncoding>
|
||||
<Image width="16" height="16">data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A/v7+D/7+/j/+/v5g/v7+YP7+/mD+/v5I/v7+KP///wD///8A////AP///wD///8A////AP///wD+/v4H/v7+UPbv4pHgx47B1K9Y3tWwWN7Ur1je3sKCx+rbuKj+/v5n/v7+GP///wD///8A////AP///wD+/v4Y+fbweM2ycMe2iB7/vI0f/8STIf/KlyL/zJki/8yZIv/LmCL/0ahK5/Hp1JH+/v4Y////AP///wD///8A7OTTaquHN+CujkXPs5ZTv6N6G/+2iB7/xpUh/8yZIv/MmSL/zJki/8yZIv/Kmy738OjUi////wD///8A////AMKtfY7w6+Ef////AP///wD///8A3sqbp8iWIf/MmSL/zJki/8yZIv/MmSL/y5gi/8mePO7+/v4w////AP///wD///8A////AP///wD+/v4H/v7+V9CtWN3KmCL/zJki/8yZIv/MmSL/zJki/8yZIv/JlyH/5tSqp/7+/mD+/v4/////AP///wD///8A+PXvJtGyZdXNnS/3y5gi/8qYIv/LmCL/zJki/8yZIv/MmSL/y5gi/82iPO7LqVfe0byMmf///wD///8A/v7+D/Do1JHKmy73ypci/8KSIP+/jyD/xpQh/8uYIv/MmSL/zJki/8qYIv+/jyD/rIEd/9nKqH7///8A////APPu4TzAlSz3wZEg/7mLH/+sgR3/uZdGz7mLH//JlyH/zJki/8yZIv/GlSH/to0r9eXbxD/Vx6dg////AP7+/h/p38WhtIsq9al/HP+kfyjuybaKgf///wCzjzjlwJAg/8qYIv/JlyH/u4wf/8CkYrn///8A////AP///wDj2sRMnHUa/7meYa7Vx6dg////AP///wD///8A2MmnYK6DHf++jiD/vo4g/62CHf/k2sQ/////AP///wD///8A8OvhH/f07w////8A////AP///wD///8A////AP///wC/p3Cfpnwc/66GKvPg1LZ8////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////ANXHp2DJtoqByLWKgf///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AADgPwAAwA8AAIAHAAB4BwAA+AMAAPAAAADgAQAA4AMAAMEDAADPhwAA/48AAP/nAAD//wAA//8AAA==</Image>
|
||||
<Image width="16" height="16">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAABZWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNC40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iPgogICAgICAgICA8eG1wOkNyZWF0b3JUb29sPkFjb3JuIHZlcnNpb24gMy4zPC94bXA6Q3JlYXRvclRvb2w+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgqo9EsfAAACMUlEQVQ4jX2TMWtTURTHf+e+l1CTtCapLuLgoIuOolPB+AlqDekgpeDSufoFmoIfwNmtCKKmtYNUcJAGQcVBQSyFKuImOthE+9q0zXv37/ASWxvwwB3Ouefc8z/87jFJmGEAEuKImWHUmwFUPOcbBjVYT/M0h0cSkgAZdbm+LwkkO+wfPUgWAliTUCIGZE1CVYjNsL4iW25PI38NaCO7y6/kK6PBGY2XPjoANluTtvhzAUAVYrv3LsMzsgC21LrDSHGBY8MTDJdvgl4zYu/p+nGAEACvU5wenbbFVpHQ3dbMxS8Adv9HnlxmliiCeG8PnBFm8khnSeJtAJOELW1eAF5RKB4nau+APcHxCPkMsoeYy4IXwjOUD9jdfqlq+cqBAlQAPhG1L+GCHLmRKXwyRWerx8YDGCCCDMB3AGs0gvQBcyfIFy/R+Q2JT4ha6gEMeoX/cMXYSJ0azsB0vbTCVmueON4FuVSZgh7fvgkI6WyBtALAetMcDVISiX+A2Q7ZIQN8v9/frtClUIKk+0LV0bcGRv1q4pjsJTt9A3vO/i4D/1HsE2azRK0Y52YBaOAkyfU/i2onI1VLNzBu4ayL8IgukJAbzuITMFfVRGnN5puhaiQHGJdbYyQaxxhDXCZXcOnEISQxdKI1HDOaKL+x+WaouUrcF5dSiDMbBN3PiHOY/0AnChDbGBs495RqeVkgaxAcLu4POLAwrK6GgzENxHoLJajLsaqQxwqOXKbx/2zlH1DoZhoGHT3iAAAAAElFTkSuQmCC</Image>
|
||||
<SearchForm>https://twitter.com/search/</SearchForm>
|
||||
<Url type="text/html" method="GET" template="https://twitter.com/search/{searchTerms}">
|
||||
<Param name="partner" value="Firefox"/>
|
||||
|
@ -13,7 +13,7 @@ define([AC_SUBST],
|
||||
[ifdef([AC_SUBST_$1], ,
|
||||
[define([AC_SUBST_$1], )dnl
|
||||
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
|
||||
(''' $1 ''', r''' [$]$1 ''')
|
||||
(''' $1 ''', r''' [$]$1 ''')
|
||||
AC_DIVERT_POP()dnl
|
||||
])])
|
||||
|
||||
@ -26,7 +26,7 @@ dnl AC_SOMETHING(foo,AC_DEFINE(),bar)
|
||||
define([_MOZ_AC_DEFINE], defn([AC_DEFINE]))
|
||||
define([AC_DEFINE],
|
||||
[cat >> confdefs.pytmp <<\EOF
|
||||
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
|
||||
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
|
||||
EOF
|
||||
ifelse($#, 2, _MOZ_AC_DEFINE([$1], [$2]), $#, 3, _MOZ_AC_DEFINE([$1], [$2], [$3]),_MOZ_AC_DEFINE([$1]))dnl
|
||||
])
|
||||
@ -36,7 +36,7 @@ dnl python.
|
||||
define([_MOZ_AC_DEFINE_UNQUOTED], defn([AC_DEFINE_UNQUOTED]))
|
||||
define([AC_DEFINE_UNQUOTED],
|
||||
[cat >> confdefs.pytmp <<EOF
|
||||
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
|
||||
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
|
||||
EOF
|
||||
ifelse($#, 2, _MOZ_AC_DEFINE_UNQUOTED($1, $2), $#, 3, _MOZ_AC_DEFINE_UNQUOTED($1, $2, $3),_MOZ_AC_DEFINE_UNQUOTED($1))dnl
|
||||
])
|
||||
@ -80,24 +80,19 @@ cat > $CONFIG_STATUS <<EOF
|
||||
#!${PYTHON}
|
||||
# coding=$encoding
|
||||
|
||||
import os, sys
|
||||
import os
|
||||
dnl topsrcdir is the top source directory in native form, as opposed to a
|
||||
dnl form suitable for make.
|
||||
topsrcdir = '''${WIN_TOP_SRC:-$srcdir}'''
|
||||
if not os.path.isabs(topsrcdir):
|
||||
topsrcdir = os.path.normpath(os.path.join(os.path.dirname(<<<__file__>>>), topsrcdir))
|
||||
dnl Don't rely on virtualenv here. Standalone js doesn't use it.
|
||||
sys.path.append(os.path.join(topsrcdir, ${extra_python_path}'build'))
|
||||
from ConfigStatus import config_status
|
||||
|
||||
args = {
|
||||
'topsrcdir': topsrcdir,
|
||||
'topobjdir': os.path.dirname(<<<__file__>>>),
|
||||
topobjdir = os.path.dirname(<<<__file__>>>)
|
||||
|
||||
dnl All defines and substs are stored with an additional space at the beginning
|
||||
dnl and at the end of the string, to avoid any problem with values starting or
|
||||
dnl ending with quotes.
|
||||
'defines': [(name[1:-1], value[1:-1]) for name, value in [
|
||||
defines = [(name[1:-1], value[1:-1]) for name, value in [
|
||||
EOF
|
||||
|
||||
dnl confdefs.pytmp contains AC_DEFINEs, in the expected format, but
|
||||
@ -106,9 +101,9 @@ sed 's/$/,/' confdefs.pytmp >> $CONFIG_STATUS
|
||||
rm confdefs.pytmp confdefs.h
|
||||
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
] ],
|
||||
] ]
|
||||
|
||||
'substs': [(name[1:-1], value[1:-1]) for name, value in [
|
||||
substs = [(name[1:-1], value[1:-1]) for name, value in [
|
||||
EOF
|
||||
|
||||
dnl The MOZ_DIVERSION_SUBST output diversion contains AC_SUBSTs, in the
|
||||
@ -118,51 +113,58 @@ undivert(MOZ_DIVERSION_SUBST)dnl
|
||||
EOF
|
||||
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
] ],
|
||||
] ]
|
||||
|
||||
dnl List of files to apply AC_SUBSTs to. This is the list of files given
|
||||
dnl as an argument to AC_OUTPUT ($1)
|
||||
'files': [
|
||||
files = [
|
||||
EOF
|
||||
|
||||
for out in $1; do
|
||||
echo " '$out'," >> $CONFIG_STATUS
|
||||
echo " '$out'," >> $CONFIG_STATUS
|
||||
done
|
||||
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
],
|
||||
]
|
||||
|
||||
dnl List of header files to apply AC_DEFINEs to. This is stored in the
|
||||
dnl AC_LIST_HEADER m4 macro by AC_CONFIG_HEADER.
|
||||
'headers': [
|
||||
headers = [
|
||||
EOF
|
||||
|
||||
ifdef(<<<AC_LIST_HEADER>>>, <<<
|
||||
HEADERS="AC_LIST_HEADER"
|
||||
for header in $HEADERS; do
|
||||
echo " '$header'," >> $CONFIG_STATUS
|
||||
echo " '$header'," >> $CONFIG_STATUS
|
||||
done
|
||||
>>>)dnl
|
||||
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
],
|
||||
]
|
||||
|
||||
dnl List of AC_DEFINEs that aren't to be exposed in ALLDEFINES
|
||||
'non_global_defines': [
|
||||
non_global_defines = [
|
||||
EOF
|
||||
|
||||
if test -n "$_NON_GLOBAL_ACDEFINES"; then
|
||||
for var in $_NON_GLOBAL_ACDEFINES; do
|
||||
echo " '$var'," >> $CONFIG_STATUS
|
||||
echo " '$var'," >> $CONFIG_STATUS
|
||||
done
|
||||
fi
|
||||
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
]
|
||||
}
|
||||
cat >> $CONFIG_STATUS <<EOF
|
||||
]
|
||||
|
||||
__all__ = ['topobjdir', 'topsrcdir', 'defines', 'non_global_defines', 'substs', 'files', 'headers']
|
||||
|
||||
dnl Do the actual work
|
||||
config_status(**args)
|
||||
if __name__ == '__main__':
|
||||
args = dict([(name, globals()[name]) for name in __all__])
|
||||
import sys
|
||||
dnl Don't rely on virtualenv here. Standalone js doesn't use it.
|
||||
sys.path.append(os.path.join(topsrcdir, ${extra_python_path}'build'))
|
||||
from ConfigStatus import config_status
|
||||
config_status(**args)
|
||||
EOF
|
||||
changequote([, ])
|
||||
chmod +x $CONFIG_STATUS
|
||||
|
@ -44,7 +44,7 @@ def InvokeClWithDependencyGeneration(cmdline):
|
||||
if ret != 0 or target == "":
|
||||
sys.exit(ret)
|
||||
|
||||
depsdir = os.path.normpath(os.path.join(os.path.dirname(target), ".deps"))
|
||||
depsdir = os.path.normpath(os.path.join(os.curdir, ".deps"))
|
||||
depstarget = os.path.join(depsdir, depstarget)
|
||||
if not os.path.isdir(depsdir):
|
||||
try:
|
||||
|
@ -30,6 +30,9 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/HashFunctions.h"
|
||||
|
||||
#include "nsIAppsService.h"
|
||||
#include "mozIApplication.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
static bool gCodeBasePrincipalSupport = false;
|
||||
@ -1299,10 +1302,45 @@ nsPrincipal::GetAppStatus()
|
||||
|
||||
// Installed apps have a valid app id (not NO_APP_ID or UNKNOWN_APP_ID)
|
||||
// and they are not inside a mozbrowser.
|
||||
return mAppId != nsIScriptSecurityManager::NO_APP_ID &&
|
||||
mAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID && !mInMozBrowser
|
||||
? nsIPrincipal::APP_STATUS_INSTALLED
|
||||
: nsIPrincipal::APP_STATUS_NOT_INSTALLED;
|
||||
if (mAppId == nsIScriptSecurityManager::NO_APP_ID ||
|
||||
mAppId == nsIScriptSecurityManager::UNKNOWN_APP_ID || mInMozBrowser) {
|
||||
return nsIPrincipal::APP_STATUS_NOT_INSTALLED;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(appsService, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
|
||||
|
||||
nsCOMPtr<mozIDOMApplication> domApp;
|
||||
appsService->GetAppByLocalId(mAppId, getter_AddRefs(domApp));
|
||||
nsCOMPtr<mozIApplication> app = do_QueryInterface(domApp);
|
||||
NS_ENSURE_TRUE(app, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
|
||||
|
||||
uint16_t status = nsIPrincipal::APP_STATUS_INSTALLED;
|
||||
NS_ENSURE_SUCCESS(app->GetAppStatus(&status),
|
||||
nsIPrincipal::APP_STATUS_NOT_INSTALLED);
|
||||
|
||||
nsCAutoString origin;
|
||||
NS_ENSURE_SUCCESS(GetOrigin(getter_Copies(origin)),
|
||||
nsIPrincipal::APP_STATUS_NOT_INSTALLED);
|
||||
nsString appOrigin;
|
||||
NS_ENSURE_SUCCESS(app->GetOrigin(appOrigin),
|
||||
nsIPrincipal::APP_STATUS_NOT_INSTALLED);
|
||||
|
||||
// We go from string -> nsIURI -> origin to be sure we
|
||||
// compare two punny-encoded origins.
|
||||
nsCOMPtr<nsIURI> appURI;
|
||||
NS_ENSURE_SUCCESS(NS_NewURI(getter_AddRefs(appURI), appOrigin),
|
||||
nsIPrincipal::APP_STATUS_NOT_INSTALLED);
|
||||
|
||||
nsCAutoString appOriginPunned;
|
||||
NS_ENSURE_SUCCESS(GetOriginForURI(appURI, getter_Copies(appOriginPunned)),
|
||||
nsIPrincipal::APP_STATUS_NOT_INSTALLED);
|
||||
|
||||
if (!appOriginPunned.Equals(origin)) {
|
||||
return nsIPrincipal::APP_STATUS_NOT_INSTALLED;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/************************************************************************************************************************/
|
||||
|
@ -129,13 +129,13 @@ var gData = [
|
||||
app: "http://example.org/manifest.webapp",
|
||||
src: "file:///",
|
||||
isapp: true,
|
||||
test: [ "eo-unique" ],
|
||||
test: [ "eo-unique", "in-app-not-installed" ],
|
||||
},
|
||||
{
|
||||
app: "http://example.org/manifest.webapp",
|
||||
src: "file:///tmp/",
|
||||
isapp: true,
|
||||
test: [ "eo-unique" ],
|
||||
test: [ "eo-unique", "in-app-not-installed" ],
|
||||
},
|
||||
// iframe inside an app is part of the app.
|
||||
{
|
||||
@ -281,12 +281,11 @@ function checkIFrame(aFrame, data) {
|
||||
}
|
||||
|
||||
if (data.isapp) {
|
||||
is(principal.appStatus, Ci.nsIPrincipal.APP_STATUS_INSTALLED,
|
||||
'this should be an installed app');
|
||||
isnot(principal.appId, Ci.nsIScriptSecurityManager.NO_APP_ID,
|
||||
"installed app should have a valid appId");
|
||||
isnot(principal.appId, Ci.nsIScriptSecurityManager.UNKNOWN_APP_ID,
|
||||
"installed app should have a valid appId");
|
||||
if (data.test.indexOf("in-app-not-installed") != -1) {
|
||||
is(principal.appStatus, Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED, 'this should not be an installed app');
|
||||
} else {
|
||||
is(principal.appStatus, Ci.nsIPrincipal.APP_STATUS_INSTALLED, 'this should be an installed app');
|
||||
}
|
||||
} else {
|
||||
is(principal.appStatus, Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED,
|
||||
'this should not be an installed app');
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef mozilla_RegistryMessageUtils_h
|
||||
#define mozilla_RegistryMessageUtils_h
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
struct SerializedURI
|
||||
|
@ -1500,7 +1500,7 @@ $(CURDIR)/$(MDDEPDIR):
|
||||
$(MKDIR) -p $@
|
||||
|
||||
ifneq (,$(filter-out all chrome default export realchrome tools clean clobber clobber_all distclean realclean,$(MAKECMDGOALS)))
|
||||
MDDEPEND_FILES := $(strip $(wildcard $(MDDEPDIR)/*.pp))
|
||||
MDDEPEND_FILES := $(strip $(wildcard $(foreach file,$(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS) $(TARGETS) $(XPIDLSRCS:.idl=.h) $(XPIDLSRCS:.idl=.xpt),$(MDDEPDIR)/$(notdir $(file)).pp) $(addprefix $(MDDEPDIR)/,$(EXTRA_MDDEPEND_FILES))))
|
||||
|
||||
ifneq (,$(MDDEPEND_FILES))
|
||||
# The script mddepend.pl checks the dependencies and writes to stdout
|
||||
|
@ -1067,3 +1067,7 @@ gst/app/gstappsrc.h
|
||||
gst/video/video.h
|
||||
sys/msg.h
|
||||
sys/ipc.h
|
||||
sys/thr.h
|
||||
sys/user.h
|
||||
kvm.h
|
||||
spawn.h
|
||||
|
@ -1483,10 +1483,12 @@ public:
|
||||
const nsAString& aCrossOriginAttr) = 0;
|
||||
|
||||
/**
|
||||
* Called by nsParser to preload style sheets. Can also be merged into
|
||||
* the parser if and when the parser is merged with libgklayout.
|
||||
* Called by nsParser to preload style sheets. Can also be merged into the
|
||||
* parser if and when the parser is merged with libgklayout. aCrossOriginAttr
|
||||
* should be a void string if the attr is not present.
|
||||
*/
|
||||
virtual void PreloadStyle(nsIURI* aURI, const nsAString& aCharset) = 0;
|
||||
virtual void PreloadStyle(nsIURI* aURI, const nsAString& aCharset,
|
||||
const nsAString& aCrossOriginAttr) = 0;
|
||||
|
||||
/**
|
||||
* Called by the chrome registry to load style sheets. Can be put
|
||||
|
@ -38,6 +38,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(FileIOObject,
|
||||
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(error)
|
||||
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(progress)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mError)
|
||||
// Can't traverse mChannel because it's a multithreaded object.
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(FileIOObject,
|
||||
@ -47,6 +48,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(FileIOObject,
|
||||
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(error)
|
||||
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(progress)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mError)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mChannel)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
FileIOObject::FileIOObject()
|
||||
|
@ -173,7 +173,7 @@ nsBlobProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
|
||||
rv = info->mFile->GetType(type);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRUint64 size;
|
||||
uint64_t size;
|
||||
rv = info->mFile->GetSize(&size);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -350,7 +350,7 @@ nsContentSink::DoProcessLinkHeader()
|
||||
{
|
||||
nsAutoString value;
|
||||
mDocument->GetHeaderData(nsGkAtoms::link, value);
|
||||
ProcessLinkHeader(nullptr, value);
|
||||
ProcessLinkHeader(value);
|
||||
}
|
||||
|
||||
// check whether the Link header field applies to the context resource
|
||||
@ -440,8 +440,7 @@ nsContentSink::Decode5987Format(nsAString& aEncoded) {
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsContentSink::ProcessLinkHeader(nsIContent* aElement,
|
||||
const nsAString& aLinkData)
|
||||
nsContentSink::ProcessLinkHeader(const nsAString& aLinkData)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
@ -640,7 +639,7 @@ nsContentSink::ProcessLinkHeader(nsIContent* aElement,
|
||||
|
||||
href.Trim(" \t\n\r\f"); // trim HTML5 whitespace
|
||||
if (!href.IsEmpty() && !rel.IsEmpty()) {
|
||||
rv = ProcessLink(aElement, anchor, href, rel,
|
||||
rv = ProcessLink(anchor, href, rel,
|
||||
// prefer RFC 5987 variant over non-I18zed version
|
||||
titleStar.IsEmpty() ? title : titleStar,
|
||||
type, media);
|
||||
@ -661,7 +660,7 @@ nsContentSink::ProcessLinkHeader(nsIContent* aElement,
|
||||
|
||||
href.Trim(" \t\n\r\f"); // trim HTML5 whitespace
|
||||
if (!href.IsEmpty() && !rel.IsEmpty()) {
|
||||
rv = ProcessLink(aElement, anchor, href, rel,
|
||||
rv = ProcessLink(anchor, href, rel,
|
||||
// prefer RFC 5987 variant over non-I18zed version
|
||||
titleStar.IsEmpty() ? title : titleStar,
|
||||
type, media);
|
||||
@ -672,8 +671,7 @@ nsContentSink::ProcessLinkHeader(nsIContent* aElement,
|
||||
|
||||
|
||||
nsresult
|
||||
nsContentSink::ProcessLink(nsIContent* aElement,
|
||||
const nsSubstring& aAnchor, const nsSubstring& aHref,
|
||||
nsContentSink::ProcessLink(const nsSubstring& aAnchor, const nsSubstring& aHref,
|
||||
const nsSubstring& aRel, const nsSubstring& aTitle,
|
||||
const nsSubstring& aType, const nsSubstring& aMedia)
|
||||
{
|
||||
@ -690,7 +688,7 @@ nsContentSink::ProcessLink(nsIContent* aElement,
|
||||
bool hasPrefetch = linkTypes & PREFETCH;
|
||||
// prefetch href if relation is "next" or "prefetch"
|
||||
if (hasPrefetch || (linkTypes & NEXT)) {
|
||||
PrefetchHref(aHref, aElement, hasPrefetch);
|
||||
PrefetchHref(aHref, nullptr, hasPrefetch);
|
||||
}
|
||||
|
||||
if (!aHref.IsEmpty() && (linkTypes & DNS_PREFETCH)) {
|
||||
@ -703,7 +701,7 @@ nsContentSink::ProcessLink(nsIContent* aElement,
|
||||
}
|
||||
|
||||
bool isAlternate = linkTypes & ALTERNATE;
|
||||
return ProcessStyleLink(aElement, aHref, isAlternate, aTitle, aType,
|
||||
return ProcessStyleLink(nullptr, aHref, isAlternate, aTitle, aType,
|
||||
aMedia);
|
||||
}
|
||||
|
||||
@ -739,9 +737,15 @@ nsContentSink::ProcessStyleLink(nsIContent* aElement,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_ASSERTION(!aElement ||
|
||||
aElement->NodeType() == nsIDOMNode::PROCESSING_INSTRUCTION_NODE,
|
||||
"We only expect processing instructions here");
|
||||
|
||||
// If this is a fragment parser, we don't want to observe.
|
||||
// We don't support CORS for processing instructions
|
||||
bool isAlternate;
|
||||
rv = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia, aAlternate,
|
||||
CORS_NONE,
|
||||
mRunsToCompletion ? nullptr : this, &isAlternate);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -146,9 +146,8 @@ protected:
|
||||
nsresult ProcessHTTPHeaders(nsIChannel* aChannel);
|
||||
nsresult ProcessHeaderData(nsIAtom* aHeader, const nsAString& aValue,
|
||||
nsIContent* aContent = nullptr);
|
||||
nsresult ProcessLinkHeader(nsIContent* aElement,
|
||||
const nsAString& aLinkData);
|
||||
nsresult ProcessLink(nsIContent* aElement, const nsSubstring& aAnchor,
|
||||
nsresult ProcessLinkHeader(const nsAString& aLinkData);
|
||||
nsresult ProcessLink(const nsSubstring& aAnchor,
|
||||
const nsSubstring& aHref, const nsSubstring& aRel,
|
||||
const nsSubstring& aTitle, const nsSubstring& aType,
|
||||
const nsSubstring& aMedia);
|
||||
|
@ -62,7 +62,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMFileReader,
|
||||
FileIOObject)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFile)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mPrincipal)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mChannel)
|
||||
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(load)
|
||||
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(loadstart)
|
||||
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(loadend)
|
||||
@ -338,6 +337,13 @@ nsDOMFileReader::DoOnStopRequest(nsIRequest *aRequest,
|
||||
nsAString& aSuccessEvent,
|
||||
nsAString& aTerminationEvent)
|
||||
{
|
||||
// Make sure we drop all the objects that could hold files open now.
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
mChannel.swap(channel);
|
||||
|
||||
nsCOMPtr<nsIDOMBlob> file;
|
||||
mFile.swap(file);
|
||||
|
||||
aSuccessEvent = NS_LITERAL_STRING(LOAD_STR);
|
||||
aTerminationEvent = NS_LITERAL_STRING(LOADEND_STR);
|
||||
|
||||
@ -357,7 +363,7 @@ nsDOMFileReader::DoOnStopRequest(nsIRequest *aRequest,
|
||||
rv = GetAsText(mCharset, mFileData, mDataLen, mResult);
|
||||
break;
|
||||
case FILE_AS_DATAURL:
|
||||
rv = GetAsDataURL(mFile, mFileData, mDataLen, mResult);
|
||||
rv = GetAsDataURL(file, mFileData, mDataLen, mResult);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -7762,7 +7762,8 @@ NS_IMPL_ISUPPORTS1(StubCSSLoaderObserver, nsICSSLoaderObserver)
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::PreloadStyle(nsIURI* uri, const nsAString& charset)
|
||||
nsDocument::PreloadStyle(nsIURI* uri, const nsAString& charset,
|
||||
const nsAString& aCrossOriginAttr)
|
||||
{
|
||||
// The CSSLoader will retain this object after we return.
|
||||
nsCOMPtr<nsICSSLoaderObserver> obs = new StubCSSLoaderObserver();
|
||||
@ -7770,7 +7771,8 @@ nsDocument::PreloadStyle(nsIURI* uri, const nsAString& charset)
|
||||
// Charset names are always ASCII.
|
||||
CSSLoader()->LoadSheet(uri, NodePrincipal(),
|
||||
NS_LossyConvertUTF16toASCII(charset),
|
||||
obs);
|
||||
obs,
|
||||
nsGenericElement::StringToCORSMode(aCrossOriginAttr));
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -877,7 +877,8 @@ public:
|
||||
virtual void MaybePreLoadImage(nsIURI* uri,
|
||||
const nsAString &aCrossOriginAttr);
|
||||
|
||||
virtual void PreloadStyle(nsIURI* uri, const nsAString& charset);
|
||||
virtual void PreloadStyle(nsIURI* uri, const nsAString& charset,
|
||||
const nsAString& aCrossOriginAttr);
|
||||
|
||||
virtual nsresult LoadChromeSheetSync(nsIURI* uri, bool isAgentSheet,
|
||||
nsCSSStyleSheet** sheet);
|
||||
|
@ -822,6 +822,11 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
|
||||
}
|
||||
|
||||
nsFrameJSScriptExecutorHolder* holder = sCachedScripts->Get(aURL);
|
||||
if (!holder) {
|
||||
TryCacheLoadAndCompileScript(aURL, EXECUTE_IF_CANT_CACHE);
|
||||
holder = sCachedScripts->Get(aURL);
|
||||
}
|
||||
|
||||
if (holder) {
|
||||
nsContentUtils::ThreadJSContextStack()->Push(mCx);
|
||||
{
|
||||
@ -838,7 +843,12 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
|
||||
nsContentUtils::ThreadJSContextStack()->Pop(&unused);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameScriptExecutor::TryCacheLoadAndCompileScript(const nsAString& aURL,
|
||||
CacheFailedBehavior aBehavior)
|
||||
{
|
||||
nsCString url = NS_ConvertUTF16toUTF8(aURL);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), url);
|
||||
@ -907,8 +917,9 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
|
||||
JS_AddNamedScriptRoot(mCx, &(holder->mScript),
|
||||
"Cached message manager script");
|
||||
sCachedScripts->Put(aURL, holder);
|
||||
} else if (aBehavior == EXECUTE_IF_CANT_CACHE) {
|
||||
(void) JS_ExecuteScript(mCx, global, script, nullptr);
|
||||
}
|
||||
(void) JS_ExecuteScript(mCx, global, script, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -224,6 +224,9 @@ protected:
|
||||
// Call this when you want to destroy mCx.
|
||||
void DestroyCx();
|
||||
void LoadFrameScriptInternal(const nsAString& aURL);
|
||||
enum CacheFailedBehavior { EXECUTE_IF_CANT_CACHE, DONT_EXECUTE };
|
||||
void TryCacheLoadAndCompileScript(const nsAString& aURL,
|
||||
CacheFailedBehavior aBehavior = DONT_EXECUTE);
|
||||
bool InitTabChildGlobalInternal(nsISupports* aScope);
|
||||
static void Traverse(nsFrameScriptExecutor *tmp,
|
||||
nsCycleCollectionTraversalCallback &cb);
|
||||
|
@ -2273,9 +2273,9 @@ nsObjectLoadingContent::LoadFallback(FallbackType aType, bool aNotify) {
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
NS_ASSERTION(thisContent, "must be a content");
|
||||
|
||||
if (!thisContent->IsHTML()) {
|
||||
// Don't let custom fallback handlers run outside HTML
|
||||
LOG(("OBJLC [%p]: Non-HTML content, forcing eFallbackAlternate", this));
|
||||
if (!thisContent->IsHTML() || mContentType.IsEmpty()) {
|
||||
// Don't let custom fallback handlers run outside HTML, tags without a
|
||||
// determined type should always just be alternate content
|
||||
aType = eFallbackAlternate;
|
||||
}
|
||||
|
||||
|
@ -276,8 +276,8 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument,
|
||||
uri->Clone(getter_AddRefs(clonedURI));
|
||||
NS_ENSURE_TRUE(clonedURI, NS_ERROR_OUT_OF_MEMORY);
|
||||
rv = doc->CSSLoader()->
|
||||
LoadStyleLink(thisContent, clonedURI, title, media, isAlternate, aObserver,
|
||||
&isAlternate);
|
||||
LoadStyleLink(thisContent, clonedURI, title, media, isAlternate,
|
||||
GetCORSMode(), aObserver, &isAlternate);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Don't propagate LoadStyleLink() errors further than this, since some
|
||||
// consumers (e.g. nsXMLContentSink) will completely abort on innocuous
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "nsIStyleSheet.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/CORSMode.h"
|
||||
|
||||
#define PREFETCH 0x00000001
|
||||
#define DNS_PREFETCH 0x00000002
|
||||
@ -76,6 +77,12 @@ protected:
|
||||
|
||||
nsIStyleSheet* GetStyleSheet() { return mStyleSheet; }
|
||||
|
||||
virtual mozilla::CORSMode GetCORSMode() const
|
||||
{
|
||||
// Default to no CORS
|
||||
return mozilla::CORS_NONE;
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* @param aOldDocument should be non-null only if we're updating because we
|
||||
|
@ -1120,7 +1120,7 @@ nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal,
|
||||
// -moz-binding is blacklisted.
|
||||
bool didSanitize = false;
|
||||
// Create a sheet to hold the parsed CSS
|
||||
nsRefPtr<nsCSSStyleSheet> sheet = new nsCSSStyleSheet();
|
||||
nsRefPtr<nsCSSStyleSheet> sheet = new nsCSSStyleSheet(CORS_NONE);
|
||||
sheet->SetURIs(aDocument->GetDocumentURI(), nullptr, aBaseURI);
|
||||
sheet->SetPrincipal(aDocument->NodePrincipal());
|
||||
// Create the CSS parser, and parse the CSS text.
|
||||
|
@ -1470,7 +1470,7 @@ nsXMLHttpRequest::GetAllResponseHeaders(nsString& aResponseHeaders)
|
||||
aResponseHeaders.AppendLiteral("\r\n");
|
||||
}
|
||||
|
||||
PRInt32 length;
|
||||
int32_t length;
|
||||
if (NS_SUCCEEDED(mChannel->GetContentLength(&length))) {
|
||||
aResponseHeaders.AppendLiteral("Content-Length: ");
|
||||
aResponseHeaders.AppendInt(length);
|
||||
@ -1531,7 +1531,7 @@ nsXMLHttpRequest::GetResponseHeader(const nsACString& header,
|
||||
|
||||
// Content Length:
|
||||
else if (header.LowerCaseEqualsASCII("content-length")) {
|
||||
PRInt32 length;
|
||||
int32_t length;
|
||||
if (NS_SUCCEEDED(mChannel->GetContentLength(&length))) {
|
||||
_retval.AppendInt(length);
|
||||
}
|
||||
|
@ -54,9 +54,11 @@ DoDrawImageSecurityCheck(nsHTMLCanvasElement *aCanvasElement,
|
||||
if (CORSUsed)
|
||||
return;
|
||||
|
||||
// Ignore document.domain in this check.
|
||||
bool subsumes;
|
||||
nsresult rv =
|
||||
aCanvasElement->NodePrincipal()->Subsumes(aPrincipal, &subsumes);
|
||||
aCanvasElement->NodePrincipal()->SubsumesIgnoringDomain(aPrincipal,
|
||||
&subsumes);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && subsumes) {
|
||||
// This canvas has access to that image anyway
|
||||
|
@ -57,6 +57,8 @@ MOCHITEST_FILES = \
|
||||
test_bug753758.html \
|
||||
test_bug764125.html \
|
||||
test_drawImage_edge_cases.html \
|
||||
test_drawImage_document_domain.html \
|
||||
file_drawImage_document_domain.html \
|
||||
$(NULL)
|
||||
|
||||
ifneq (1_Linux,$(MOZ_SUITE)_$(OS_ARCH))
|
||||
|
30
content/canvas/test/file_drawImage_document_domain.html
Normal file
30
content/canvas/test/file_drawImage_document_domain.html
Normal file
@ -0,0 +1,30 @@
|
||||
<!DOCTYPE html>
|
||||
<canvas id="c" width="1" height="1"></canvas>
|
||||
<img id="img" src="image_green-1x1.png">
|
||||
<script>
|
||||
window.onmessage = function(ev) {
|
||||
if (ev.data != "start") {
|
||||
parent.postMessage({ msg: "unknown_message", data: ev.data }, "*");
|
||||
return;
|
||||
}
|
||||
|
||||
// Set document.domain to itself, so we trigger the
|
||||
// "set effective script origin" cases.
|
||||
document.domain = document.domain
|
||||
var ctx = document.getElementById("c").getContext("2d");
|
||||
ctx.drawImage(document.getElementById("img"), 0, 0);
|
||||
try {
|
||||
var data = ctx.getImageData(0, 0, 1, 1).data;
|
||||
parent.postMessage(
|
||||
{
|
||||
msg: "color",
|
||||
data: "rgba(" + data[0] + ", " + data[1] + ", " + data[2] + ", " + data[3]/255 + ")"
|
||||
},
|
||||
"*");
|
||||
} catch (e) {
|
||||
parent.postMessage({ msg: "exception", data: e.toString() }, "*");
|
||||
}
|
||||
|
||||
parent.postMessage({ msg: "done" }, "*");
|
||||
}
|
||||
</script>
|
@ -16125,12 +16125,9 @@ function test_2d_pattern_repeat_undefined() {
|
||||
var canvas = document.getElementById('c496');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
var undefinedHandler = IsAzureEnabled() ? todo : ok;
|
||||
|
||||
var _thrown = undefined; try {
|
||||
ctx.createPattern(canvas, undefined);
|
||||
// XXXbz TODO fix bug 784869
|
||||
} catch (e) { _thrown = e }; undefinedHandler(_thrown && _thrown.name == "SyntaxError" && _thrown.code == DOMException.SYNTAX_ERR, "should throw SyntaxError");
|
||||
} catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "SyntaxError" && _thrown.code == DOMException.SYNTAX_ERR, "should throw SyntaxError");
|
||||
|
||||
|
||||
}
|
||||
|
48
content/canvas/test/test_drawImage_document_domain.html
Normal file
48
content/canvas/test/test_drawImage_document_domain.html
Normal file
@ -0,0 +1,48 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=567511
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 567511</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=567511">Mozilla Bug 567511</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<iframe src="file_drawImage_document_domain.html"></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 567511 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
window.onmessage = function(ev) {
|
||||
if (ev.data.msg == "done") {
|
||||
SimpleTest.finish();
|
||||
} else if (ev.data.msg == "exception") {
|
||||
ok(false, ev.data.data);
|
||||
} else if (ev.data.msg == "color") {
|
||||
is(ev.data.data, "rgba(0, 255, 0, 1)", "Should get correct color");
|
||||
} else if (ev.data.msg == "unknown_message") {
|
||||
ok(false, "Unknown message to child: " + ev.data.data);
|
||||
} else {
|
||||
ok(false, "Unknown message from child: " + ev.data.msg);
|
||||
}
|
||||
}
|
||||
|
||||
function doTest() {
|
||||
frames[0].postMessage("start", "*");
|
||||
}
|
||||
|
||||
addLoadEvent(doTest);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -51,6 +51,30 @@
|
||||
* update the tests for bug 689564 and bug 659350 as needed.
|
||||
*/
|
||||
|
||||
#ifdef ID_TO_EVENT
|
||||
#ifdef EVENT
|
||||
#error "Don't define EVENT"
|
||||
#endif /* EVENT */
|
||||
#ifdef WINDOW_ONLY_EVENT
|
||||
#error "Don't define WINDOW_ONLY_EVENT"
|
||||
#endif /* WINDOW_ONLY_EVENT */
|
||||
#ifdef TOUCH_EVENT
|
||||
#error "Don't define TOUCH_EVENT"
|
||||
#endif /* TOUCH_EVENT */
|
||||
#ifdef DOCUMENT_ONLY_EVENT
|
||||
#error "Don't define DOCUMENT_ONLY_EVENT"
|
||||
#endif /* DOCUMENT_ONLY_EVENT */
|
||||
#ifdef NON_IDL_EVENT
|
||||
#error "Don't define NON_IDL_EVENT"
|
||||
#endif /* NON_IDL_EVENT */
|
||||
|
||||
#define EVENT ID_TO_EVENT
|
||||
#define WINDOW_ONLY_EVENT ID_TO_EVENT
|
||||
#define TOUCH_EVENT ID_TO_EVENT
|
||||
#define DOCUMENT_ONLY_EVENT ID_TO_EVENT
|
||||
#define NON_IDL_EVENT ID_TO_EVENT
|
||||
#endif
|
||||
|
||||
#ifdef DEFINED_FORWARDED_EVENT
|
||||
#error "Don't define DEFINED_FORWARDED_EVENT"
|
||||
#endif /* DEFINED_FORWARDED_EVENT */
|
||||
@ -635,31 +659,44 @@ NON_IDL_EVENT(SVGZoom,
|
||||
NS_SVG_ZOOM,
|
||||
EventNameType_None,
|
||||
NS_SVGZOOM_EVENT)
|
||||
|
||||
// Only map the ID to the real event name when ID_TO_EVENT is defined.
|
||||
#ifndef ID_TO_EVENT
|
||||
// This is a bit hackish, but SVG's event names are weird.
|
||||
NON_IDL_EVENT(zoom,
|
||||
NS_SVG_ZOOM,
|
||||
EventNameType_SVGSVG,
|
||||
NS_EVENT_NULL)
|
||||
#endif
|
||||
// Only map the ID to the real event name when ID_TO_EVENT is defined.
|
||||
#ifndef ID_TO_EVENT
|
||||
NON_IDL_EVENT(begin,
|
||||
NS_SMIL_BEGIN,
|
||||
EventNameType_SMIL,
|
||||
NS_EVENT_NULL)
|
||||
#endif
|
||||
NON_IDL_EVENT(beginEvent,
|
||||
NS_SMIL_BEGIN,
|
||||
EventNameType_None,
|
||||
NS_SMIL_TIME_EVENT)
|
||||
// Only map the ID to the real event name when ID_TO_EVENT is defined.
|
||||
#ifndef ID_TO_EVENT
|
||||
NON_IDL_EVENT(end,
|
||||
NS_SMIL_END,
|
||||
EventNameType_SMIL,
|
||||
NS_EVENT_NULL)
|
||||
#endif
|
||||
NON_IDL_EVENT(endEvent,
|
||||
NS_SMIL_END,
|
||||
EventNameType_None,
|
||||
NS_SMIL_TIME_EVENT)
|
||||
// Only map the ID to the real event name when ID_TO_EVENT is defined.
|
||||
#ifndef ID_TO_EVENT
|
||||
NON_IDL_EVENT(repeat,
|
||||
NS_SMIL_REPEAT,
|
||||
EventNameType_SMIL,
|
||||
NS_EVENT_NULL)
|
||||
#endif
|
||||
NON_IDL_EVENT(repeatEvent,
|
||||
NS_SMIL_REPEAT,
|
||||
EventNameType_None,
|
||||
@ -781,3 +818,11 @@ NON_IDL_EVENT(animationiteration,
|
||||
#undef NON_IDL_EVENT
|
||||
#endif /* DEFINED_NON_IDL_EVENT */
|
||||
|
||||
#ifdef ID_TO_EVENT
|
||||
#undef EVENT
|
||||
#undef WINDOW_ONLY_EVENT
|
||||
#undef TOUCH_EVENT
|
||||
#undef DOCUMENT_ONLY_EVENT
|
||||
#undef NON_IDL_EVENT
|
||||
#endif /* ID_TO_EVENT */
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
/* This must occur *after* base/basictypes.h to avoid typedefs conflicts. */
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsError.h"
|
||||
#include "nsDOMEvent.h"
|
||||
@ -35,71 +35,6 @@
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
static const char* const sEventNames[] = {
|
||||
"mousedown", "mouseup", "click", "dblclick", "mouseenter", "mouseleave", "mouseover",
|
||||
"mouseout", "MozMouseHittest", "mousemove", "contextmenu", "keydown", "keyup", "keypress",
|
||||
"focus", "blur", "load", "popstate", "beforescriptexecute",
|
||||
"afterscriptexecute", "beforeunload", "unload",
|
||||
"hashchange", "readystatechange", "abort", "error",
|
||||
"submit", "reset", "change", "select", "input", "invalid", "text",
|
||||
"compositionstart", "compositionend", "compositionupdate",
|
||||
"popupshowing", "popupshown",
|
||||
"popuphiding", "popuphidden", "close", "command", "broadcast", "commandupdate",
|
||||
"dragenter", "dragover", "dragexit", "dragdrop", "draggesture",
|
||||
"drag", "dragend", "dragstart", "dragleave", "drop", "resize",
|
||||
"scroll", "overflow", "underflow", "overflowchanged",
|
||||
"DOMSubtreeModified", "DOMNodeInserted", "DOMNodeRemoved",
|
||||
"DOMNodeRemovedFromDocument", "DOMNodeInsertedIntoDocument",
|
||||
"DOMAttrModified", "DOMCharacterDataModified",
|
||||
"DOMActivate", "DOMFocusIn", "DOMFocusOut",
|
||||
"pageshow", "pagehide", "DOMMouseScroll", "MozMousePixelScroll", "wheel",
|
||||
"offline", "online", "copy", "cut", "paste", "open", "message", "show",
|
||||
"SVGLoad", "SVGUnload", "SVGAbort", "SVGError", "SVGResize", "SVGScroll",
|
||||
"SVGZoom",
|
||||
"beginEvent", "endEvent", "repeatEvent",
|
||||
#ifdef MOZ_MEDIA
|
||||
"loadstart", "progress", "suspend", "emptied", "stalled", "play", "pause",
|
||||
"loadedmetadata", "loadeddata", "waiting", "playing", "canplay",
|
||||
"canplaythrough", "seeking", "seeked", "timeupdate", "ended", "ratechange",
|
||||
"durationchange", "volumechange", "MozAudioAvailable",
|
||||
#endif // MOZ_MEDIA
|
||||
"MozAfterPaint",
|
||||
"MozBeforeResize",
|
||||
"mozfullscreenchange",
|
||||
"mozfullscreenerror",
|
||||
"mozpointerlockchange",
|
||||
"mozpointerlockerror",
|
||||
"MozSwipeGesture",
|
||||
"MozMagnifyGestureStart",
|
||||
"MozMagnifyGestureUpdate",
|
||||
"MozMagnifyGesture",
|
||||
"MozRotateGestureStart",
|
||||
"MozRotateGestureUpdate",
|
||||
"MozRotateGesture",
|
||||
"MozTapGesture",
|
||||
"MozPressTapGesture",
|
||||
"MozEdgeUIGesture",
|
||||
"MozTouchDown",
|
||||
"MozTouchMove",
|
||||
"MozTouchUp",
|
||||
"touchstart",
|
||||
"touchend",
|
||||
"touchmove",
|
||||
"touchcancel",
|
||||
"touchenter",
|
||||
"touchleave",
|
||||
"MozScrolledAreaChanged",
|
||||
"transitionend",
|
||||
"animationstart",
|
||||
"animationend",
|
||||
"animationiteration",
|
||||
"devicemotion",
|
||||
"deviceorientation",
|
||||
"deviceproximity",
|
||||
"userproximity",
|
||||
"devicelight"
|
||||
};
|
||||
|
||||
static char *sPopupAllowedEvents;
|
||||
|
||||
|
||||
@ -1236,300 +1171,10 @@ nsDOMEvent::GetClientCoords(nsPresContext* aPresContext,
|
||||
const char* nsDOMEvent::GetEventName(uint32_t aEventType)
|
||||
{
|
||||
switch(aEventType) {
|
||||
case NS_MOUSE_BUTTON_DOWN:
|
||||
return sEventNames[eDOMEvents_mousedown];
|
||||
case NS_MOUSE_BUTTON_UP:
|
||||
return sEventNames[eDOMEvents_mouseup];
|
||||
case NS_MOUSE_CLICK:
|
||||
return sEventNames[eDOMEvents_click];
|
||||
case NS_MOUSE_DOUBLECLICK:
|
||||
return sEventNames[eDOMEvents_dblclick];
|
||||
case NS_MOUSEENTER:
|
||||
return sEventNames[eDOMEvents_mouseenter];
|
||||
case NS_MOUSELEAVE:
|
||||
return sEventNames[eDOMEvents_mouseleave];
|
||||
case NS_MOUSE_ENTER_SYNTH:
|
||||
return sEventNames[eDOMEvents_mouseover];
|
||||
case NS_MOUSE_EXIT_SYNTH:
|
||||
return sEventNames[eDOMEvents_mouseout];
|
||||
case NS_MOUSE_MOZHITTEST:
|
||||
return sEventNames[eDOMEvents_MozMouseHittest];
|
||||
case NS_MOUSE_MOVE:
|
||||
return sEventNames[eDOMEvents_mousemove];
|
||||
case NS_KEY_UP:
|
||||
return sEventNames[eDOMEvents_keyup];
|
||||
case NS_KEY_DOWN:
|
||||
return sEventNames[eDOMEvents_keydown];
|
||||
case NS_KEY_PRESS:
|
||||
return sEventNames[eDOMEvents_keypress];
|
||||
case NS_COMPOSITION_START:
|
||||
return sEventNames[eDOMEvents_compositionstart];
|
||||
case NS_COMPOSITION_UPDATE:
|
||||
return sEventNames[eDOMEvents_compositionupdate];
|
||||
case NS_COMPOSITION_END:
|
||||
return sEventNames[eDOMEvents_compositionend];
|
||||
case NS_FOCUS_CONTENT:
|
||||
return sEventNames[eDOMEvents_focus];
|
||||
case NS_BLUR_CONTENT:
|
||||
return sEventNames[eDOMEvents_blur];
|
||||
case NS_XUL_CLOSE:
|
||||
return sEventNames[eDOMEvents_close];
|
||||
case NS_LOAD:
|
||||
return sEventNames[eDOMEvents_load];
|
||||
case NS_POPSTATE:
|
||||
return sEventNames[eDOMEvents_popstate];
|
||||
case NS_BEFORE_SCRIPT_EXECUTE:
|
||||
return sEventNames[eDOMEvents_beforescriptexecute];
|
||||
case NS_AFTER_SCRIPT_EXECUTE:
|
||||
return sEventNames[eDOMEvents_afterscriptexecute];
|
||||
case NS_BEFORE_PAGE_UNLOAD:
|
||||
return sEventNames[eDOMEvents_beforeunload];
|
||||
case NS_PAGE_UNLOAD:
|
||||
return sEventNames[eDOMEvents_unload];
|
||||
case NS_HASHCHANGE:
|
||||
return sEventNames[eDOMEvents_hashchange];
|
||||
case NS_READYSTATECHANGE:
|
||||
return sEventNames[eDOMEvents_readystatechange];
|
||||
case NS_IMAGE_ABORT:
|
||||
return sEventNames[eDOMEvents_abort];
|
||||
case NS_LOAD_ERROR:
|
||||
return sEventNames[eDOMEvents_error];
|
||||
case NS_FORM_SUBMIT:
|
||||
return sEventNames[eDOMEvents_submit];
|
||||
case NS_FORM_RESET:
|
||||
return sEventNames[eDOMEvents_reset];
|
||||
case NS_FORM_CHANGE:
|
||||
return sEventNames[eDOMEvents_change];
|
||||
case NS_FORM_SELECTED:
|
||||
return sEventNames[eDOMEvents_select];
|
||||
case NS_FORM_INPUT:
|
||||
return sEventNames[eDOMEvents_input];
|
||||
case NS_FORM_INVALID:
|
||||
return sEventNames[eDOMEvents_invalid];
|
||||
case NS_RESIZE_EVENT:
|
||||
return sEventNames[eDOMEvents_resize];
|
||||
case NS_SCROLL_EVENT:
|
||||
return sEventNames[eDOMEvents_scroll];
|
||||
case NS_TEXT_TEXT:
|
||||
return sEventNames[eDOMEvents_text];
|
||||
case NS_XUL_POPUP_SHOWING:
|
||||
return sEventNames[eDOMEvents_popupShowing];
|
||||
case NS_XUL_POPUP_SHOWN:
|
||||
return sEventNames[eDOMEvents_popupShown];
|
||||
case NS_XUL_POPUP_HIDING:
|
||||
return sEventNames[eDOMEvents_popupHiding];
|
||||
case NS_XUL_POPUP_HIDDEN:
|
||||
return sEventNames[eDOMEvents_popupHidden];
|
||||
case NS_XUL_COMMAND:
|
||||
return sEventNames[eDOMEvents_command];
|
||||
case NS_XUL_BROADCAST:
|
||||
return sEventNames[eDOMEvents_broadcast];
|
||||
case NS_XUL_COMMAND_UPDATE:
|
||||
return sEventNames[eDOMEvents_commandupdate];
|
||||
case NS_DRAGDROP_ENTER:
|
||||
return sEventNames[eDOMEvents_dragenter];
|
||||
case NS_DRAGDROP_OVER_SYNTH:
|
||||
return sEventNames[eDOMEvents_dragover];
|
||||
case NS_DRAGDROP_EXIT_SYNTH:
|
||||
return sEventNames[eDOMEvents_dragexit];
|
||||
case NS_DRAGDROP_DRAGDROP:
|
||||
return sEventNames[eDOMEvents_dragdrop];
|
||||
case NS_DRAGDROP_GESTURE:
|
||||
return sEventNames[eDOMEvents_draggesture];
|
||||
case NS_DRAGDROP_DRAG:
|
||||
return sEventNames[eDOMEvents_drag];
|
||||
case NS_DRAGDROP_END:
|
||||
return sEventNames[eDOMEvents_dragend];
|
||||
case NS_DRAGDROP_START:
|
||||
return sEventNames[eDOMEvents_dragstart];
|
||||
case NS_DRAGDROP_LEAVE_SYNTH:
|
||||
return sEventNames[eDOMEvents_dragleave];
|
||||
case NS_DRAGDROP_DROP:
|
||||
return sEventNames[eDOMEvents_drop];
|
||||
case NS_SCROLLPORT_OVERFLOW:
|
||||
return sEventNames[eDOMEvents_overflow];
|
||||
case NS_SCROLLPORT_UNDERFLOW:
|
||||
return sEventNames[eDOMEvents_underflow];
|
||||
case NS_SCROLLPORT_OVERFLOWCHANGED:
|
||||
return sEventNames[eDOMEvents_overflowchanged];
|
||||
case NS_MUTATION_SUBTREEMODIFIED:
|
||||
return sEventNames[eDOMEvents_subtreemodified];
|
||||
case NS_MUTATION_NODEINSERTED:
|
||||
return sEventNames[eDOMEvents_nodeinserted];
|
||||
case NS_MUTATION_NODEREMOVED:
|
||||
return sEventNames[eDOMEvents_noderemoved];
|
||||
case NS_MUTATION_NODEREMOVEDFROMDOCUMENT:
|
||||
return sEventNames[eDOMEvents_noderemovedfromdocument];
|
||||
case NS_MUTATION_NODEINSERTEDINTODOCUMENT:
|
||||
return sEventNames[eDOMEvents_nodeinsertedintodocument];
|
||||
case NS_MUTATION_ATTRMODIFIED:
|
||||
return sEventNames[eDOMEvents_attrmodified];
|
||||
case NS_MUTATION_CHARACTERDATAMODIFIED:
|
||||
return sEventNames[eDOMEvents_characterdatamodified];
|
||||
case NS_CONTEXTMENU:
|
||||
return sEventNames[eDOMEvents_contextmenu];
|
||||
case NS_UI_ACTIVATE:
|
||||
return sEventNames[eDOMEvents_DOMActivate];
|
||||
case NS_UI_FOCUSIN:
|
||||
return sEventNames[eDOMEvents_DOMFocusIn];
|
||||
case NS_UI_FOCUSOUT:
|
||||
return sEventNames[eDOMEvents_DOMFocusOut];
|
||||
case NS_PAGE_SHOW:
|
||||
return sEventNames[eDOMEvents_pageshow];
|
||||
case NS_PAGE_HIDE:
|
||||
return sEventNames[eDOMEvents_pagehide];
|
||||
case NS_MOUSE_SCROLL:
|
||||
return sEventNames[eDOMEvents_DOMMouseScroll];
|
||||
case NS_MOUSE_PIXEL_SCROLL:
|
||||
return sEventNames[eDOMEvents_MozMousePixelScroll];
|
||||
case NS_WHEEL_WHEEL:
|
||||
return sEventNames[eDOMEvents_wheel];
|
||||
case NS_OFFLINE:
|
||||
return sEventNames[eDOMEvents_offline];
|
||||
case NS_ONLINE:
|
||||
return sEventNames[eDOMEvents_online];
|
||||
case NS_COPY:
|
||||
return sEventNames[eDOMEvents_copy];
|
||||
case NS_CUT:
|
||||
return sEventNames[eDOMEvents_cut];
|
||||
case NS_PASTE:
|
||||
return sEventNames[eDOMEvents_paste];
|
||||
case NS_OPEN:
|
||||
return sEventNames[eDOMEvents_open];
|
||||
case NS_MESSAGE:
|
||||
return sEventNames[eDOMEvents_message];
|
||||
case NS_SHOW_EVENT:
|
||||
return sEventNames[eDOMEvents_show];
|
||||
case NS_SVG_LOAD:
|
||||
return sEventNames[eDOMEvents_SVGLoad];
|
||||
case NS_SVG_UNLOAD:
|
||||
return sEventNames[eDOMEvents_SVGUnload];
|
||||
case NS_SVG_ABORT:
|
||||
return sEventNames[eDOMEvents_SVGAbort];
|
||||
case NS_SVG_ERROR:
|
||||
return sEventNames[eDOMEvents_SVGError];
|
||||
case NS_SVG_RESIZE:
|
||||
return sEventNames[eDOMEvents_SVGResize];
|
||||
case NS_SVG_SCROLL:
|
||||
return sEventNames[eDOMEvents_SVGScroll];
|
||||
case NS_SVG_ZOOM:
|
||||
return sEventNames[eDOMEvents_SVGZoom];
|
||||
case NS_TOUCH_START:
|
||||
return sEventNames[eDOMEvents_touchstart];
|
||||
case NS_TOUCH_MOVE:
|
||||
return sEventNames[eDOMEvents_touchmove];
|
||||
case NS_TOUCH_END:
|
||||
return sEventNames[eDOMEvents_touchend];
|
||||
case NS_TOUCH_ENTER:
|
||||
return sEventNames[eDOMEvents_touchenter];
|
||||
case NS_TOUCH_LEAVE:
|
||||
return sEventNames[eDOMEvents_touchleave];
|
||||
case NS_TOUCH_CANCEL:
|
||||
return sEventNames[eDOMEvents_touchcancel];
|
||||
case NS_SMIL_BEGIN:
|
||||
return sEventNames[eDOMEvents_beginEvent];
|
||||
case NS_SMIL_END:
|
||||
return sEventNames[eDOMEvents_endEvent];
|
||||
case NS_SMIL_REPEAT:
|
||||
return sEventNames[eDOMEvents_repeatEvent];
|
||||
#ifdef MOZ_MEDIA
|
||||
case NS_LOADSTART:
|
||||
return sEventNames[eDOMEvents_loadstart];
|
||||
case NS_PROGRESS:
|
||||
return sEventNames[eDOMEvents_progress];
|
||||
case NS_SUSPEND:
|
||||
return sEventNames[eDOMEvents_suspend];
|
||||
case NS_EMPTIED:
|
||||
return sEventNames[eDOMEvents_emptied];
|
||||
case NS_STALLED:
|
||||
return sEventNames[eDOMEvents_stalled];
|
||||
case NS_PLAY:
|
||||
return sEventNames[eDOMEvents_play];
|
||||
case NS_PAUSE:
|
||||
return sEventNames[eDOMEvents_pause];
|
||||
case NS_LOADEDMETADATA:
|
||||
return sEventNames[eDOMEvents_loadedmetadata];
|
||||
case NS_LOADEDDATA:
|
||||
return sEventNames[eDOMEvents_loadeddata];
|
||||
case NS_WAITING:
|
||||
return sEventNames[eDOMEvents_waiting];
|
||||
case NS_PLAYING:
|
||||
return sEventNames[eDOMEvents_playing];
|
||||
case NS_CANPLAY:
|
||||
return sEventNames[eDOMEvents_canplay];
|
||||
case NS_CANPLAYTHROUGH:
|
||||
return sEventNames[eDOMEvents_canplaythrough];
|
||||
case NS_SEEKING:
|
||||
return sEventNames[eDOMEvents_seeking];
|
||||
case NS_SEEKED:
|
||||
return sEventNames[eDOMEvents_seeked];
|
||||
case NS_TIMEUPDATE:
|
||||
return sEventNames[eDOMEvents_timeupdate];
|
||||
case NS_ENDED:
|
||||
return sEventNames[eDOMEvents_ended];
|
||||
case NS_RATECHANGE:
|
||||
return sEventNames[eDOMEvents_ratechange];
|
||||
case NS_DURATIONCHANGE:
|
||||
return sEventNames[eDOMEvents_durationchange];
|
||||
case NS_VOLUMECHANGE:
|
||||
return sEventNames[eDOMEvents_volumechange];
|
||||
case NS_MOZAUDIOAVAILABLE:
|
||||
return sEventNames[eDOMEvents_mozaudioavailable];
|
||||
#endif
|
||||
case NS_AFTERPAINT:
|
||||
return sEventNames[eDOMEvents_afterpaint];
|
||||
case NS_BEFORERESIZE_EVENT:
|
||||
return sEventNames[eDOMEvents_beforeresize];
|
||||
case NS_SIMPLE_GESTURE_SWIPE:
|
||||
return sEventNames[eDOMEvents_MozSwipeGesture];
|
||||
case NS_SIMPLE_GESTURE_MAGNIFY_START:
|
||||
return sEventNames[eDOMEvents_MozMagnifyGestureStart];
|
||||
case NS_SIMPLE_GESTURE_MAGNIFY_UPDATE:
|
||||
return sEventNames[eDOMEvents_MozMagnifyGestureUpdate];
|
||||
case NS_SIMPLE_GESTURE_MAGNIFY:
|
||||
return sEventNames[eDOMEvents_MozMagnifyGesture];
|
||||
case NS_SIMPLE_GESTURE_ROTATE_START:
|
||||
return sEventNames[eDOMEvents_MozRotateGestureStart];
|
||||
case NS_SIMPLE_GESTURE_ROTATE_UPDATE:
|
||||
return sEventNames[eDOMEvents_MozRotateGestureUpdate];
|
||||
case NS_SIMPLE_GESTURE_ROTATE:
|
||||
return sEventNames[eDOMEvents_MozRotateGesture];
|
||||
case NS_SIMPLE_GESTURE_TAP:
|
||||
return sEventNames[eDOMEvents_MozTapGesture];
|
||||
case NS_SIMPLE_GESTURE_PRESSTAP:
|
||||
return sEventNames[eDOMEvents_MozPressTapGesture];
|
||||
case NS_SIMPLE_GESTURE_EDGEUI:
|
||||
return sEventNames[eDOMEvents_MozEdgeUIGesture];
|
||||
case NS_MOZTOUCH_DOWN:
|
||||
return sEventNames[eDOMEvents_MozTouchDown];
|
||||
case NS_MOZTOUCH_MOVE:
|
||||
return sEventNames[eDOMEvents_MozTouchMove];
|
||||
case NS_MOZTOUCH_UP:
|
||||
return sEventNames[eDOMEvents_MozTouchUp];
|
||||
case NS_SCROLLEDAREACHANGED:
|
||||
return sEventNames[eDOMEvents_MozScrolledAreaChanged];
|
||||
case NS_TRANSITION_END:
|
||||
return sEventNames[eDOMEvents_transitionend];
|
||||
case NS_ANIMATION_START:
|
||||
return sEventNames[eDOMEvents_animationstart];
|
||||
case NS_ANIMATION_END:
|
||||
return sEventNames[eDOMEvents_animationend];
|
||||
case NS_ANIMATION_ITERATION:
|
||||
return sEventNames[eDOMEvents_animationiteration];
|
||||
case NS_DEVICE_MOTION:
|
||||
return sEventNames[eDOMEvents_devicemotion];
|
||||
case NS_DEVICE_ORIENTATION:
|
||||
return sEventNames[eDOMEvents_deviceorientation];
|
||||
case NS_DEVICE_PROXIMITY:
|
||||
return sEventNames[eDOMEvents_deviceproximity];
|
||||
case NS_USER_PROXIMITY:
|
||||
return sEventNames[eDOMEvents_userproximity];
|
||||
case NS_DEVICE_LIGHT:
|
||||
return sEventNames[eDOMEvents_devicelight];
|
||||
case NS_FULLSCREENCHANGE:
|
||||
return sEventNames[eDOMEvents_mozfullscreenchange];
|
||||
case NS_FULLSCREENERROR:
|
||||
return sEventNames[eDOMEvents_mozfullscreenerror];
|
||||
#define ID_TO_EVENT(name_, _id, _type, _struct) \
|
||||
case _id: return #name_;
|
||||
#include "nsEventNameList.h"
|
||||
#undef ID_TO_EVENT
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -27,160 +27,6 @@ class nsDOMEvent : public nsIDOMEvent,
|
||||
{
|
||||
public:
|
||||
|
||||
// Note: this enum must be kept in sync with sEventNames in nsDOMEvent.cpp
|
||||
enum nsDOMEvents {
|
||||
eDOMEvents_mousedown=0,
|
||||
eDOMEvents_mouseup,
|
||||
eDOMEvents_click,
|
||||
eDOMEvents_dblclick,
|
||||
eDOMEvents_mouseenter,
|
||||
eDOMEvents_mouseleave,
|
||||
eDOMEvents_mouseover,
|
||||
eDOMEvents_mouseout,
|
||||
eDOMEvents_MozMouseHittest,
|
||||
eDOMEvents_mousemove,
|
||||
eDOMEvents_contextmenu,
|
||||
eDOMEvents_keydown,
|
||||
eDOMEvents_keyup,
|
||||
eDOMEvents_keypress,
|
||||
eDOMEvents_focus,
|
||||
eDOMEvents_blur,
|
||||
eDOMEvents_load,
|
||||
eDOMEvents_popstate,
|
||||
eDOMEvents_beforescriptexecute,
|
||||
eDOMEvents_afterscriptexecute,
|
||||
eDOMEvents_beforeunload,
|
||||
eDOMEvents_unload,
|
||||
eDOMEvents_hashchange,
|
||||
eDOMEvents_readystatechange,
|
||||
eDOMEvents_abort,
|
||||
eDOMEvents_error,
|
||||
eDOMEvents_submit,
|
||||
eDOMEvents_reset,
|
||||
eDOMEvents_change,
|
||||
eDOMEvents_select,
|
||||
eDOMEvents_input,
|
||||
eDOMEvents_invalid,
|
||||
eDOMEvents_text,
|
||||
eDOMEvents_compositionstart,
|
||||
eDOMEvents_compositionend,
|
||||
eDOMEvents_compositionupdate,
|
||||
eDOMEvents_popupShowing,
|
||||
eDOMEvents_popupShown,
|
||||
eDOMEvents_popupHiding,
|
||||
eDOMEvents_popupHidden,
|
||||
eDOMEvents_close,
|
||||
eDOMEvents_command,
|
||||
eDOMEvents_broadcast,
|
||||
eDOMEvents_commandupdate,
|
||||
eDOMEvents_dragenter,
|
||||
eDOMEvents_dragover,
|
||||
eDOMEvents_dragexit,
|
||||
eDOMEvents_dragdrop,
|
||||
eDOMEvents_draggesture,
|
||||
eDOMEvents_drag,
|
||||
eDOMEvents_dragend,
|
||||
eDOMEvents_dragstart,
|
||||
eDOMEvents_dragleave,
|
||||
eDOMEvents_drop,
|
||||
eDOMEvents_resize,
|
||||
eDOMEvents_scroll,
|
||||
eDOMEvents_overflow,
|
||||
eDOMEvents_underflow,
|
||||
eDOMEvents_overflowchanged,
|
||||
eDOMEvents_subtreemodified,
|
||||
eDOMEvents_nodeinserted,
|
||||
eDOMEvents_noderemoved,
|
||||
eDOMEvents_noderemovedfromdocument,
|
||||
eDOMEvents_nodeinsertedintodocument,
|
||||
eDOMEvents_attrmodified,
|
||||
eDOMEvents_characterdatamodified,
|
||||
eDOMEvents_DOMActivate,
|
||||
eDOMEvents_DOMFocusIn,
|
||||
eDOMEvents_DOMFocusOut,
|
||||
eDOMEvents_pageshow,
|
||||
eDOMEvents_pagehide,
|
||||
eDOMEvents_DOMMouseScroll,
|
||||
eDOMEvents_MozMousePixelScroll,
|
||||
eDOMEvents_wheel,
|
||||
eDOMEvents_offline,
|
||||
eDOMEvents_online,
|
||||
eDOMEvents_copy,
|
||||
eDOMEvents_cut,
|
||||
eDOMEvents_paste,
|
||||
eDOMEvents_open,
|
||||
eDOMEvents_message,
|
||||
eDOMEvents_show,
|
||||
eDOMEvents_SVGLoad,
|
||||
eDOMEvents_SVGUnload,
|
||||
eDOMEvents_SVGAbort,
|
||||
eDOMEvents_SVGError,
|
||||
eDOMEvents_SVGResize,
|
||||
eDOMEvents_SVGScroll,
|
||||
eDOMEvents_SVGZoom,
|
||||
eDOMEvents_beginEvent,
|
||||
eDOMEvents_endEvent,
|
||||
eDOMEvents_repeatEvent,
|
||||
#ifdef MOZ_MEDIA
|
||||
eDOMEvents_loadstart,
|
||||
eDOMEvents_progress,
|
||||
eDOMEvents_suspend,
|
||||
eDOMEvents_emptied,
|
||||
eDOMEvents_stalled,
|
||||
eDOMEvents_play,
|
||||
eDOMEvents_pause,
|
||||
eDOMEvents_loadedmetadata,
|
||||
eDOMEvents_loadeddata,
|
||||
eDOMEvents_waiting,
|
||||
eDOMEvents_playing,
|
||||
eDOMEvents_canplay,
|
||||
eDOMEvents_canplaythrough,
|
||||
eDOMEvents_seeking,
|
||||
eDOMEvents_seeked,
|
||||
eDOMEvents_timeupdate,
|
||||
eDOMEvents_ended,
|
||||
eDOMEvents_ratechange,
|
||||
eDOMEvents_durationchange,
|
||||
eDOMEvents_volumechange,
|
||||
eDOMEvents_mozaudioavailable,
|
||||
#endif
|
||||
eDOMEvents_afterpaint,
|
||||
eDOMEvents_beforeresize,
|
||||
eDOMEvents_mozfullscreenchange,
|
||||
eDOMEvents_mozfullscreenerror,
|
||||
eDOMEvents_mozpointerlockchange,
|
||||
eDOMEvents_mozpointerlockerror,
|
||||
eDOMEvents_MozSwipeGesture,
|
||||
eDOMEvents_MozMagnifyGestureStart,
|
||||
eDOMEvents_MozMagnifyGestureUpdate,
|
||||
eDOMEvents_MozMagnifyGesture,
|
||||
eDOMEvents_MozRotateGestureStart,
|
||||
eDOMEvents_MozRotateGestureUpdate,
|
||||
eDOMEvents_MozRotateGesture,
|
||||
eDOMEvents_MozTapGesture,
|
||||
eDOMEvents_MozPressTapGesture,
|
||||
eDOMEvents_MozEdgeUIGesture,
|
||||
eDOMEvents_MozTouchDown,
|
||||
eDOMEvents_MozTouchMove,
|
||||
eDOMEvents_MozTouchUp,
|
||||
eDOMEvents_touchstart,
|
||||
eDOMEvents_touchend,
|
||||
eDOMEvents_touchmove,
|
||||
eDOMEvents_touchcancel,
|
||||
eDOMEvents_touchenter,
|
||||
eDOMEvents_touchleave,
|
||||
eDOMEvents_MozScrolledAreaChanged,
|
||||
eDOMEvents_transitionend,
|
||||
eDOMEvents_animationstart,
|
||||
eDOMEvents_animationend,
|
||||
eDOMEvents_animationiteration,
|
||||
eDOMEvents_devicemotion,
|
||||
eDOMEvents_deviceorientation,
|
||||
eDOMEvents_deviceproximity,
|
||||
eDOMEvents_userproximity,
|
||||
eDOMEvents_devicelight
|
||||
};
|
||||
|
||||
nsDOMEvent(nsPresContext* aPresContext, nsEvent* aEvent);
|
||||
virtual ~nsDOMEvent();
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "nsDOMNotifyPaintEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsClientRect.h"
|
||||
|
@ -4,7 +4,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
|
||||
#include "nsDOMScrollAreaEvent.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
@ -4,7 +4,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include "nsAsyncDOMEvent.h"
|
||||
|
||||
#include "Link.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
class nsHTMLLinkElement : public nsGenericHTMLElement,
|
||||
@ -63,6 +65,10 @@ public:
|
||||
bool aCompileEventHandlers);
|
||||
virtual void UnbindFromTree(bool aDeep = true,
|
||||
bool aNullParent = true);
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult);
|
||||
void CreateAndDispatchEvent(nsIDocument* aDoc, const nsAString& aEventName);
|
||||
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
const nsAString& aValue, bool aNotify)
|
||||
@ -94,6 +100,7 @@ protected:
|
||||
nsAString& aType,
|
||||
nsAString& aMedia,
|
||||
bool* aIsAlternate);
|
||||
virtual CORSMode GetCORSMode() const;
|
||||
protected:
|
||||
virtual void GetItemValueText(nsAString& text);
|
||||
virtual void SetItemValueText(const nsAString& text);
|
||||
@ -242,6 +249,22 @@ nsHTMLLinkElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
UpdateStyleSheetInternal(oldDoc);
|
||||
}
|
||||
|
||||
bool
|
||||
nsHTMLLinkElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None &&
|
||||
aAttribute == nsGkAtoms::crossorigin) {
|
||||
ParseCORSValue(aValue, aResult);
|
||||
return true;
|
||||
}
|
||||
|
||||
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
||||
aResult);
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLLinkElement::CreateAndDispatchEvent(nsIDocument* aDoc,
|
||||
const nsAString& aEventName)
|
||||
@ -443,6 +466,12 @@ nsHTMLLinkElement::GetStyleSheetInfo(nsAString& aTitle,
|
||||
return;
|
||||
}
|
||||
|
||||
CORSMode
|
||||
nsHTMLLinkElement::GetCORSMode() const
|
||||
{
|
||||
return AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin));
|
||||
}
|
||||
|
||||
nsEventStates
|
||||
nsHTMLLinkElement::IntrinsicState() const
|
||||
{
|
||||
|
@ -918,7 +918,8 @@ class FileMediaResource : public MediaResource
|
||||
public:
|
||||
FileMediaResource(nsMediaDecoder* aDecoder, nsIChannel* aChannel, nsIURI* aURI) :
|
||||
MediaResource(aDecoder, aChannel, aURI), mSize(-1),
|
||||
mLock("FileMediaResource.mLock")
|
||||
mLock("FileMediaResource.mLock"),
|
||||
mSizeInitialized(false)
|
||||
{
|
||||
}
|
||||
~FileMediaResource()
|
||||
@ -955,7 +956,11 @@ public:
|
||||
*aIsReliable = true;
|
||||
return 100*1024*1024; // arbitray, use 100MB/s
|
||||
}
|
||||
virtual int64_t GetLength() { return mSize; }
|
||||
virtual int64_t GetLength() {
|
||||
MutexAutoLock lock(mLock);
|
||||
EnsureLengthInitialized();
|
||||
return mSize;
|
||||
}
|
||||
virtual int64_t GetNextCachedData(int64_t aOffset)
|
||||
{
|
||||
return (aOffset < mSize) ? aOffset : -1;
|
||||
@ -974,6 +979,9 @@ public:
|
||||
nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges);
|
||||
|
||||
private:
|
||||
// Ensures mSize is initialized, if it can be.
|
||||
void EnsureLengthInitialized();
|
||||
|
||||
// The file size, or -1 if not known. Immutable after Open().
|
||||
int64_t mSize;
|
||||
|
||||
@ -991,6 +999,11 @@ private:
|
||||
// Input stream for the media data. This can be used from any
|
||||
// thread.
|
||||
nsCOMPtr<nsIInputStream> mInput;
|
||||
|
||||
// Whether we've attempted to initialize mSize. Note that mSize can be -1
|
||||
// when mSizeInitialized is true if we tried and failed to get the size
|
||||
// of the file.
|
||||
bool mSizeInitialized;
|
||||
};
|
||||
|
||||
class LoadedEvent : public nsRunnable
|
||||
@ -1015,8 +1028,27 @@ private:
|
||||
nsRefPtr<nsMediaDecoder> mDecoder;
|
||||
};
|
||||
|
||||
void FileMediaResource::EnsureLengthInitialized()
|
||||
{
|
||||
mLock.AssertCurrentThreadOwns();
|
||||
if (mSizeInitialized) {
|
||||
return;
|
||||
}
|
||||
mSizeInitialized = true;
|
||||
// Get the file size and inform the decoder.
|
||||
uint64_t size;
|
||||
nsresult res = mInput->Available(&size);
|
||||
if (NS_SUCCEEDED(res) && size <= PR_INT64_MAX) {
|
||||
mSize = (int64_t)size;
|
||||
nsCOMPtr<nsIRunnable> event = new LoadedEvent(mDecoder);
|
||||
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult FileMediaResource::GetCachedRanges(nsTArray<MediaByteRange>& aRanges)
|
||||
{
|
||||
MutexAutoLock lock(mLock);
|
||||
EnsureLengthInitialized();
|
||||
if (mSize == -1) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -1071,16 +1103,6 @@ nsresult FileMediaResource::Open(nsIStreamListener** aStreamListener)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Get the file size and inform the decoder.
|
||||
uint64_t size;
|
||||
rv = mInput->Available(&size);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(size <= PR_INT64_MAX, NS_ERROR_FILE_TOO_BIG);
|
||||
|
||||
mSize = (int64_t)size;
|
||||
|
||||
nsCOMPtr<nsIRunnable> event = new LoadedEvent(mDecoder);
|
||||
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1140,6 +1162,7 @@ MediaResource* FileMediaResource::CloneData(nsMediaDecoder* aDecoder)
|
||||
nsresult FileMediaResource::ReadFromCache(char* aBuffer, int64_t aOffset, uint32_t aCount)
|
||||
{
|
||||
MutexAutoLock lock(mLock);
|
||||
EnsureLengthInitialized();
|
||||
if (!mInput || !mSeekable)
|
||||
return NS_ERROR_FAILURE;
|
||||
int64_t offset = 0;
|
||||
@ -1169,6 +1192,7 @@ nsresult FileMediaResource::ReadFromCache(char* aBuffer, int64_t aOffset, uint32
|
||||
nsresult FileMediaResource::Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes)
|
||||
{
|
||||
MutexAutoLock lock(mLock);
|
||||
EnsureLengthInitialized();
|
||||
if (!mInput)
|
||||
return NS_ERROR_FAILURE;
|
||||
return mInput->Read(aBuffer, aCount, aBytes);
|
||||
@ -1181,6 +1205,7 @@ nsresult FileMediaResource::Seek(int32_t aWhence, int64_t aOffset)
|
||||
MutexAutoLock lock(mLock);
|
||||
if (!mSeekable)
|
||||
return NS_ERROR_FAILURE;
|
||||
EnsureLengthInitialized();
|
||||
return mSeekable->Seek(aWhence, aOffset);
|
||||
}
|
||||
|
||||
@ -1191,6 +1216,7 @@ int64_t FileMediaResource::Tell()
|
||||
MutexAutoLock lock(mLock);
|
||||
if (!mSeekable)
|
||||
return 0;
|
||||
EnsureLengthInitialized();
|
||||
|
||||
int64_t offset = 0;
|
||||
mSeekable->Tell(&offset);
|
||||
|
@ -914,10 +914,7 @@ MediaStreamGraphImpl::UpdateStreamOrderForStream(nsTArray<MediaStream*>* aStack,
|
||||
}
|
||||
return;
|
||||
}
|
||||
SourceMediaStream* s = stream->AsSourceStream();
|
||||
if (s) {
|
||||
DetermineWhetherStreamIsConsumed(stream);
|
||||
}
|
||||
DetermineWhetherStreamIsConsumed(stream);
|
||||
ProcessedMediaStream* ps = stream->AsProcessedStream();
|
||||
if (ps) {
|
||||
aStack->AppendElement(stream);
|
||||
@ -946,6 +943,7 @@ MediaStreamGraphImpl::UpdateStreamOrder()
|
||||
MediaStream* stream = oldStreams[i];
|
||||
stream->mHasBeenOrdered = false;
|
||||
stream->mKnowIsConsumed = false;
|
||||
stream->mIsConsumed = false;
|
||||
stream->mIsOnOrderingStack = false;
|
||||
stream->mInBlockingSet = false;
|
||||
ProcessedMediaStream* ps = stream->AsProcessedStream();
|
||||
|
@ -436,10 +436,12 @@ nsWaveReader::LoadFormatChunk()
|
||||
// Make sure metadata is fairly sane. The rate check is fairly arbitrary,
|
||||
// but the channels check is intentionally limited to mono or stereo
|
||||
// because that's what the audio backend currently supports.
|
||||
unsigned int actualFrameSize = sampleFormat == 8 ? 1 : 2 * channels;
|
||||
if (rate < 100 || rate > 96000 ||
|
||||
channels < 1 || channels > MAX_CHANNELS ||
|
||||
(frameSize != 1 && frameSize != 2 && frameSize != 4) ||
|
||||
(sampleFormat != 8 && sampleFormat != 16)) {
|
||||
(sampleFormat != 8 && sampleFormat != 16) ||
|
||||
frameSize != actualFrameSize) {
|
||||
NS_WARNING("Invalid WAVE metadata");
|
||||
return false;
|
||||
}
|
||||
|
@ -358,6 +358,10 @@ nsSMILAnimationController::DoSample(bool aSkipUnchangedContainers)
|
||||
NS_ERROR("Shouldn't be sampling after document has disconnected");
|
||||
return;
|
||||
}
|
||||
if (mRunningSample) {
|
||||
NS_ERROR("Shouldn't be recursively sampling");
|
||||
return;
|
||||
}
|
||||
|
||||
mResampleNeeded = false;
|
||||
// Set running sample flag -- do this before flushing styles so that when we
|
||||
|
@ -167,9 +167,8 @@ nsSMILInstanceTime::IsDependentOn(const nsSMILInstanceTime& aOther) const
|
||||
if (myBaseTime == &aOther)
|
||||
return true;
|
||||
|
||||
// mVisited is mutable
|
||||
mozilla::AutoRestore<bool> setVisited(const_cast<nsSMILInstanceTime*>(this)->mVisited);
|
||||
const_cast<nsSMILInstanceTime*>(this)->mVisited = true;
|
||||
mozilla::AutoRestore<bool> setVisited(mVisited);
|
||||
mVisited = true;
|
||||
return myBaseTime->IsDependentOn(aOther);
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ protected:
|
||||
kWasDynamicEndpoint = 8
|
||||
};
|
||||
uint8_t mFlags; // Combination of kDynamic, kMayUpdate, etc.
|
||||
bool mVisited; // (mutable) Cycle tracking
|
||||
mutable bool mVisited; // Cycle tracking
|
||||
|
||||
// Additional reference count to determine if this instance time is currently
|
||||
// used as a fixed endpoint in any intervals. Instance times that are used in
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "nsStyleLinkElement.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
typedef nsSVGElement nsSVGStyleElementBase;
|
||||
|
||||
class nsSVGStyleElement : public nsSVGStyleElementBase,
|
||||
@ -48,6 +50,10 @@ public:
|
||||
bool aNotify);
|
||||
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
||||
bool aNotify);
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult);
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
@ -76,6 +82,8 @@ protected:
|
||||
nsAString& aType,
|
||||
nsAString& aMedia,
|
||||
bool* aIsAlternate);
|
||||
virtual CORSMode GetCORSMode() const;
|
||||
|
||||
/**
|
||||
* Common method to call from the various mutation observer methods.
|
||||
* aContent is a content node that's either the one that changed or its
|
||||
@ -184,6 +192,22 @@ nsSVGStyleElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGStyleElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None &&
|
||||
aAttribute == nsGkAtoms::crossorigin) {
|
||||
ParseCORSValue(aValue, aResult);
|
||||
return true;
|
||||
}
|
||||
|
||||
return nsSVGStyleElementBase::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
||||
aResult);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIMutationObserver methods
|
||||
|
||||
@ -317,3 +341,9 @@ nsSVGStyleElement::GetStyleSheetInfo(nsAString& aTitle,
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
CORSMode
|
||||
nsSVGStyleElement::GetCORSMode() const
|
||||
{
|
||||
return AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin));
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define SerializedLoadContext_h
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "nsILoadContext.h"
|
||||
|
||||
/*
|
||||
|
@ -260,7 +260,7 @@ nsDSURIContentListener::SetParentContentListener(nsIURIContentListener*
|
||||
bool nsDSURIContentListener::CheckOneFrameOptionsPolicy(nsIRequest *request,
|
||||
const nsAString& policy) {
|
||||
static const char allowFrom[] = "allow-from ";
|
||||
const PRUint32 allowFromLen = ArrayLength(allowFrom) - 1;
|
||||
const uint32_t allowFromLen = ArrayLength(allowFrom) - 1;
|
||||
bool isAllowFrom =
|
||||
StringHead(policy, allowFromLen).LowerCaseEqualsLiteral(allowFrom);
|
||||
|
||||
|
@ -75,6 +75,7 @@ ifdef MOZ_B2G_RIL
|
||||
PARALLEL_DIRS += \
|
||||
telephony \
|
||||
wifi \
|
||||
icc \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
"use strict"
|
||||
|
||||
function debug(s) {
|
||||
//dump("-*- AppsService: " + s + "\n");
|
||||
//dump("-*- AppsService.js: " + s + "\n");
|
||||
}
|
||||
|
||||
const Cc = Components.classes;
|
||||
@ -19,57 +19,32 @@ const APPS_SERVICE_CID = Components.ID("{05072afa-92fe-45bf-ae22-39b69c117058}")
|
||||
function AppsService()
|
||||
{
|
||||
debug("AppsService Constructor");
|
||||
this.inParent = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime)
|
||||
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
debug("inParent: " + this.inParent);
|
||||
if (this.inParent) {
|
||||
Cu.import("resource://gre/modules/Webapps.jsm");
|
||||
} else {
|
||||
this.cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Ci.nsISyncMessageSender);
|
||||
}
|
||||
let inParent = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime)
|
||||
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
debug("inParent: " + inParent);
|
||||
Cu.import(inParent ? "resource://gre/modules/Webapps.jsm" :
|
||||
"resource://gre/modules/AppsServiceChild.jsm");
|
||||
}
|
||||
|
||||
AppsService.prototype = {
|
||||
getAppByManifestURL: function getAppByManifestURL(aManifestURL) {
|
||||
debug("GetAppByManifestURL( " + aManifestURL + " )");
|
||||
if (this.inParent) {
|
||||
return DOMApplicationRegistry.getAppByManifestURL(aManifestURL);
|
||||
} else {
|
||||
return this.cpmm.sendSyncMessage("WebApps:GetAppByManifestURL",
|
||||
{ url: aManifestURL })[0];
|
||||
}
|
||||
return DOMApplicationRegistry.getAppByManifestURL(aManifestURL);
|
||||
},
|
||||
|
||||
getAppLocalIdByManifestURL: function getAppLocalIdByManifestURL(aManifestURL) {
|
||||
debug("getAppLocalIdByManifestURL( " + aManifestURL + " )");
|
||||
if (this.inParent) {
|
||||
return DOMApplicationRegistry.getAppLocalIdByManifestURL(aManifestURL);
|
||||
} else {
|
||||
let res = this.cpmm.sendSyncMessage("WebApps:GetAppLocalIdByManifestURL",
|
||||
{ url: aManifestURL })[0];
|
||||
return res.id;
|
||||
}
|
||||
return DOMApplicationRegistry.getAppLocalIdByManifestURL(aManifestURL);
|
||||
},
|
||||
|
||||
getAppByLocalId: function getAppByLocalId(aLocalId) {
|
||||
debug("getAppByLocalId( " + aLocalId + " )");
|
||||
if (this.inParent) {
|
||||
return DOMApplicationRegistry.getAppByLocalId(aLocalId);
|
||||
} else {
|
||||
return this.cpmm.sendSyncMessage("WebApps:GetAppByLocalId",
|
||||
{ id: aLocalId })[0];
|
||||
}
|
||||
return DOMApplicationRegistry.getAppByLocalId(aLocalId);
|
||||
},
|
||||
|
||||
getManifestURLByLocalId: function getManifestURLByLocalId(aLocalId) {
|
||||
debug("getManifestURLByLocalId( " + aLocalId + " )");
|
||||
if (this.inParent) {
|
||||
return DOMApplicationRegistry.getManifestURLByLocalId(aLocalId);
|
||||
} else {
|
||||
return this.cpmm.sendSyncMessage("WebApps:GetManifestURLByLocalId",
|
||||
{ id: aLocalId })[0];
|
||||
}
|
||||
return DOMApplicationRegistry.getManifestURLByLocalId(aLocalId);
|
||||
},
|
||||
|
||||
classID : APPS_SERVICE_CID,
|
||||
|
82
dom/apps/src/AppsServiceChild.jsm
Normal file
82
dom/apps/src/AppsServiceChild.jsm
Normal file
@ -0,0 +1,82 @@
|
||||
/* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const Cu = Components.utils;
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
// This module exposes a subset of the functionnalities of the parent DOM
|
||||
// Registry to content processes, to be be used from the AppsService component.
|
||||
|
||||
let EXPORTED_SYMBOLS = ["DOMApplicationRegistry"];
|
||||
|
||||
Cu.import("resource://gre/modules/AppsUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function debug(s) {
|
||||
//dump("-*- AppsServiceChild.jsm: " + s + "\n");
|
||||
}
|
||||
|
||||
let DOMApplicationRegistry = {
|
||||
init: function init() {
|
||||
debug("init");
|
||||
this.cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Ci.nsISyncMessageSender);
|
||||
|
||||
["Webapps:AddApp", "Webapps:RemoveApp"].forEach((function(aMsgName) {
|
||||
this.cpmm.addMessageListener(aMsgName, this);
|
||||
}).bind(this));
|
||||
|
||||
// We need to prime the cache with the list of apps.
|
||||
// XXX shoud we do this async and block callers if it's not yet there?
|
||||
this.webapps = this.cpmm.sendSyncMessage("Webapps:GetList", { })[0];
|
||||
Services.obs.addObserver(this, "xpcom-shutdown", false);
|
||||
},
|
||||
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
// cpmm.addMessageListener causes the DOMApplicationRegistry object to live
|
||||
// forever if we don't clean up properly.
|
||||
this.webapps = null;
|
||||
["Webapps:AddApp", "Webapps:RemoveApp"].forEach((function(aMsgName) {
|
||||
this.cpmm.removeMessageListener(aMsgName, this);
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
receiveMessage: function receiveMessage(aMessage) {
|
||||
debug("Received " + aMessage.name + " message.");
|
||||
let msg = aMessage.json;
|
||||
switch (aMessage.name) {
|
||||
case "Webapps:AddApp":
|
||||
this.webapps[msg.id] = msg.app;
|
||||
break;
|
||||
case "Webapps:RemoveApp":
|
||||
delete this.webapps[msg.id];
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
getAppByManifestURL: function getAppByManifestURL(aManifestURL) {
|
||||
debug("getAppByManifestURL " + aManifestURL);
|
||||
return AppsUtils.getAppByManifestURL(this.webapps, aManifestURL);
|
||||
},
|
||||
|
||||
getAppLocalIdByManifestURL: function getAppLocalIdByManifestURL(aManifestURL) {
|
||||
debug("getAppLocalIdByManifestURL " + aManifestURL);
|
||||
return AppsUtils.getAppLocalIdByManifestURL(this.webapps, aManifestURL);
|
||||
},
|
||||
|
||||
getAppByLocalId: function getAppByLocalId(aLocalId) {
|
||||
debug("getAppByLocalId " + aLocalId);
|
||||
return AppsUtils.getAppByLocalId(this.webapps, aLocalId);
|
||||
},
|
||||
|
||||
getManifestURLByLocalId: function getManifestURLByLocalId(aLocalId) {
|
||||
debug("getManifestURLByLocalId " + aLocalId);
|
||||
return AppsUtils.getManifestURLByLocalId(this.webapps, aLocalId);
|
||||
}
|
||||
}
|
||||
|
||||
DOMApplicationRegistry.init();
|
108
dom/apps/src/AppsUtils.jsm
Normal file
108
dom/apps/src/AppsUtils.jsm
Normal file
@ -0,0 +1,108 @@
|
||||
/* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const Cu = Components.utils;
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cr = Components.results;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
// Shared code for AppsServiceChild.jsm and Webapps.jsm
|
||||
|
||||
let EXPORTED_SYMBOLS = ["AppsUtils"];
|
||||
|
||||
function debug(s) {
|
||||
//dump("-*- AppsUtils.jsm: " + s + "\n");
|
||||
}
|
||||
|
||||
let AppsUtils = {
|
||||
// Clones a app, without the manifest.
|
||||
cloneAppObject: function cloneAppObject(aApp) {
|
||||
return {
|
||||
installOrigin: aApp.installOrigin,
|
||||
origin: aApp.origin,
|
||||
receipts: aApp.receipts ? JSON.parse(JSON.stringify(aApp.receipts)) : null,
|
||||
installTime: aApp.installTime,
|
||||
manifestURL: aApp.manifestURL,
|
||||
appStatus: aApp.appStatus,
|
||||
localId: aApp.localId,
|
||||
progress: aApp.progress || 0.0,
|
||||
status: aApp.status || "installed"
|
||||
};
|
||||
},
|
||||
|
||||
cloneAsMozIApplication: function cloneAsMozIApplication(aApp) {
|
||||
let res = this.cloneAppObject(aApp);
|
||||
res.hasPermission = function(aPermission) {
|
||||
let uri = Services.io.newURI(this.origin, null, null);
|
||||
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
// This helper checks an URI inside |aApp|'s origin and part of |aApp| has a
|
||||
// specific permission. It is not checking if browsers inside |aApp| have such
|
||||
// permission.
|
||||
let principal = secMan.getAppCodebasePrincipal(uri, aApp.localId,
|
||||
/*mozbrowser*/false);
|
||||
let perm = Services.perms.testExactPermissionFromPrincipal(principal,
|
||||
aPermission);
|
||||
return (perm === Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
};
|
||||
res.QueryInterface = XPCOMUtils.generateQI([Ci.mozIDOMApplication,
|
||||
Ci.mozIApplication]);
|
||||
return res;
|
||||
},
|
||||
|
||||
getAppByManifestURL: function getAppByManifestURL(aApps, aManifestURL) {
|
||||
debug("getAppByManifestURL " + aManifestURL);
|
||||
// This could be O(1) if |webapps| was a dictionary indexed on manifestURL
|
||||
// which should be the unique app identifier.
|
||||
// It's currently O(n).
|
||||
for (let id in aApps) {
|
||||
let app = aApps[id];
|
||||
if (app.manifestURL == aManifestURL) {
|
||||
return this.cloneAsMozIApplication(app);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
getAppLocalIdByManifestURL: function getAppLocalIdByManifestURL(aApps, aManifestURL) {
|
||||
debug("getAppLocalIdByManifestURL " + aManifestURL);
|
||||
for (let id in aApps) {
|
||||
if (aApps[id].manifestURL == aManifestURL) {
|
||||
return aApps[id].localId;
|
||||
}
|
||||
}
|
||||
|
||||
return Ci.nsIScriptSecurityManager.NO_APP_ID;
|
||||
},
|
||||
|
||||
getAppByLocalId: function getAppByLocalId(aApps, aLocalId) {
|
||||
debug("getAppByLocalId " + aLocalId);
|
||||
for (let id in aApps) {
|
||||
let app = aApps[id];
|
||||
if (app.localId == aLocalId) {
|
||||
return this.cloneAsMozIApplication(app);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
getManifestURLByLocalId: function getManifestURLByLocalId(aApps, aLocalId) {
|
||||
debug("getManifestURLByLocalId " + aLocalId);
|
||||
for (let id in aApps) {
|
||||
let app = aApps[id];
|
||||
if (app.localId == aLocalId) {
|
||||
return app.manifestURL;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
@ -18,6 +18,8 @@ EXTRA_COMPONENTS = \
|
||||
|
||||
EXTRA_PP_JS_MODULES += \
|
||||
Webapps.jsm \
|
||||
AppsServiceChild.jsm \
|
||||
AppsUtils.jsm \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -15,6 +15,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
Cu.import('resource://gre/modules/ActivitiesService.jsm');
|
||||
Cu.import("resource://gre/modules/AppsUtils.jsm");
|
||||
|
||||
const WEBAPP_RUNTIME = Services.appinfo.ID == "webapprt@mozilla.org";
|
||||
|
||||
@ -50,16 +51,16 @@ XPCOMUtils.defineLazyGetter(this, "msgmgr", function() {
|
||||
let DOMApplicationRegistry = {
|
||||
appsFile: null,
|
||||
webapps: { },
|
||||
children: [ ],
|
||||
allAppsLaunchable: false,
|
||||
|
||||
init: function() {
|
||||
this.messages = ["Webapps:Install", "Webapps:Uninstall",
|
||||
"Webapps:GetSelf",
|
||||
"Webapps:GetInstalled", "Webapps:GetNotInstalled",
|
||||
"Webapps:Launch", "Webapps:GetAll",
|
||||
"Webapps:InstallPackage", "Webapps:GetBasePath",
|
||||
"WebApps:GetAppByManifestURL", "WebApps:GetAppLocalIdByManifestURL",
|
||||
"WebApps:GetAppByLocalId", "WebApps:GetManifestURLByLocalId"];
|
||||
"Webapps:GetSelf",
|
||||
"Webapps:GetInstalled", "Webapps:GetNotInstalled",
|
||||
"Webapps:Launch", "Webapps:GetAll",
|
||||
"Webapps:InstallPackage", "Webapps:GetBasePath",
|
||||
"Webapps:GetList"];
|
||||
|
||||
this.messages.forEach((function(msgName) {
|
||||
ppmm.addMessageListener(msgName, this);
|
||||
@ -80,6 +81,11 @@ let DOMApplicationRegistry = {
|
||||
if (!this.webapps[id].localId) {
|
||||
this.webapps[id].localId = this._nextLocalId();
|
||||
}
|
||||
|
||||
// Default to a non privileged status.
|
||||
if (this.webapps[id].appStatus === undefined) {
|
||||
this.webapps[id].appStatus = Ci.nsIPrincipal.APP_STATUS_INSTALLED;
|
||||
}
|
||||
};
|
||||
}).bind(this));
|
||||
}
|
||||
@ -250,18 +256,9 @@ let DOMApplicationRegistry = {
|
||||
case "Webapps:GetBasePath":
|
||||
return FileUtils.getFile(DIRECTORY_NAME, ["webapps"], true).path;
|
||||
break;
|
||||
case "WebApps:GetAppByManifestURL":
|
||||
return this.getAppByManifestURL(msg.url);
|
||||
break;
|
||||
case "WebApps:GetAppLocalIdByManifestURL":
|
||||
return { id: this.getAppLocalIdByManifestURL(msg.url) };
|
||||
break;
|
||||
case "WebApps:GetAppByLocalId":
|
||||
return this.getAppByLocalId(msg.id);
|
||||
break;
|
||||
case "WebApps:GetManifestURLByLocalId":
|
||||
return this.getManifestURLByLocalId(msg.id);
|
||||
break;
|
||||
case "Webapps:GetList":
|
||||
this.children.push(aMessage.target);
|
||||
return this.webapps;
|
||||
}
|
||||
},
|
||||
|
||||
@ -282,20 +279,6 @@ let DOMApplicationRegistry = {
|
||||
});
|
||||
},
|
||||
|
||||
// clones a app object, without the manifest
|
||||
_cloneAppObject: function(aApp) {
|
||||
let clone = {
|
||||
installOrigin: aApp.installOrigin,
|
||||
origin: aApp.origin,
|
||||
receipts: aApp.receipts ? JSON.parse(JSON.stringify(aApp.receipts)) : null,
|
||||
installTime: aApp.installTime,
|
||||
manifestURL: aApp.manifestURL,
|
||||
progress: aApp.progress || 0.0,
|
||||
status: aApp.status || "installed"
|
||||
};
|
||||
return clone;
|
||||
},
|
||||
|
||||
denyInstall: function(aData) {
|
||||
let packageId = aData.app.packageId;
|
||||
if (packageId) {
|
||||
@ -331,7 +314,8 @@ let DOMApplicationRegistry = {
|
||||
app.origin = "app://" + id;
|
||||
}
|
||||
|
||||
let appObject = this._cloneAppObject(app);
|
||||
let appObject = AppsUtils.cloneAppObject(app);
|
||||
appObject.appStatus = app.appStatus || Ci.nsIPrincipal.APP_STATUS_INSTALLED;
|
||||
appObject.installTime = app.installTime = Date.now();
|
||||
let appNote = JSON.stringify(appObject);
|
||||
appNote.id = id;
|
||||
@ -366,6 +350,9 @@ let DOMApplicationRegistry = {
|
||||
this._saveApps((function() {
|
||||
ppmm.broadcastAsyncMessage("Webapps:Install:Return:OK", aData);
|
||||
Services.obs.notifyObservers(this, "webapps-sync-install", appNote);
|
||||
this.children.forEach(function(aMsgMgr) {
|
||||
aMsgMgr.broadcastAsyncMessage("Webapps:AddApp", { id: id, app: appObject });
|
||||
});
|
||||
}).bind(this));
|
||||
|
||||
#ifdef MOZ_SYS_MSG
|
||||
@ -566,7 +553,7 @@ let DOMApplicationRegistry = {
|
||||
}
|
||||
|
||||
found = true;
|
||||
let appNote = JSON.stringify(this._cloneAppObject(app));
|
||||
let appNote = JSON.stringify(AppsUtils.cloneAppObject(app));
|
||||
appNote.id = id;
|
||||
|
||||
this._readManifests([{ id: id }], (function unregisterManifest(aResult) {
|
||||
@ -585,6 +572,9 @@ let DOMApplicationRegistry = {
|
||||
this._saveApps((function() {
|
||||
ppmm.broadcastAsyncMessage("Webapps:Uninstall:Return:OK", aData);
|
||||
Services.obs.notifyObservers(this, "webapps-sync-uninstall", appNote);
|
||||
this.children.forEach(function(aMsgMgr) {
|
||||
aMsgMgr.broadcastAsyncMessage("Webapps:RemoveApp", { id: id });
|
||||
});
|
||||
}).bind(this));
|
||||
}
|
||||
|
||||
@ -599,7 +589,7 @@ let DOMApplicationRegistry = {
|
||||
let id = this._appId(aData.origin);
|
||||
|
||||
if (id && this._isLaunchable(this.webapps[id].origin)) {
|
||||
let app = this._cloneAppObject(this.webapps[id]);
|
||||
let app = AppsUtils.cloneAppObject(this.webapps[id]);
|
||||
aData.apps.push(app);
|
||||
tmp.push({ id: id });
|
||||
}
|
||||
@ -618,7 +608,7 @@ let DOMApplicationRegistry = {
|
||||
for (let id in this.webapps) {
|
||||
if (this.webapps[id].installOrigin == aData.origin &&
|
||||
this._isLaunchable(this.webapps[id].origin)) {
|
||||
aData.apps.push(this._cloneAppObject(this.webapps[id]));
|
||||
aData.apps.push(AppsUtils.cloneAppObject(this.webapps[id]));
|
||||
tmp.push({ id: id });
|
||||
}
|
||||
}
|
||||
@ -636,7 +626,7 @@ let DOMApplicationRegistry = {
|
||||
|
||||
for (let id in this.webapps) {
|
||||
if (!this._isLaunchable(this.webapps[id].origin)) {
|
||||
aData.apps.push(this._cloneAppObject(this.webapps[id]));
|
||||
aData.apps.push(AppsUtils.cloneAppObject(this.webapps[id]));
|
||||
tmp.push({ id: id });
|
||||
}
|
||||
}
|
||||
@ -653,7 +643,7 @@ let DOMApplicationRegistry = {
|
||||
let tmp = [];
|
||||
|
||||
for (let id in this.webapps) {
|
||||
let app = this._cloneAppObject(this.webapps[id]);
|
||||
let app = AppsUtils.cloneAppObject(this.webapps[id]);
|
||||
if (!this._isLaunchable(app.origin))
|
||||
continue;
|
||||
|
||||
@ -692,78 +682,30 @@ let DOMApplicationRegistry = {
|
||||
if (!this.webapps[aId])
|
||||
return null;
|
||||
|
||||
let app = this._cloneAppObject(this.webapps[aId]);
|
||||
let app = AppsUtils.cloneAppObject(this.webapps[aId]);
|
||||
return app;
|
||||
},
|
||||
|
||||
getAppByManifestURL: function(aManifestURL) {
|
||||
// This could be O(1) if |webapps| was a dictionary indexed on manifestURL
|
||||
// which should be the unique app identifier.
|
||||
// It's currently O(n).
|
||||
for (let id in this.webapps) {
|
||||
let app = this.webapps[id];
|
||||
if (app.manifestURL == aManifestURL) {
|
||||
let res = this._cloneAppObject(app);
|
||||
res.hasPermission = function(permission) {
|
||||
let localId = DOMApplicationRegistry.getAppLocalIdByManifestURL(
|
||||
this.manifestURL);
|
||||
let uri = Services.io.newURI(this.manifestURL, null, null);
|
||||
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
// XXX for the purposes of permissions checking, this helper
|
||||
// should always be called on !isBrowser frames, so we
|
||||
// assume false here.
|
||||
let principal = secMan.getAppCodebasePrincipal(uri, localId,
|
||||
/*mozbrowser*/false);
|
||||
let perm = Services.perms.testExactPermissionFromPrincipal(principal,
|
||||
permission);
|
||||
return (perm === Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
};
|
||||
res.QueryInterface = XPCOMUtils.generateQI([Ci.mozIDOMApplication,
|
||||
Ci.mozIApplication]);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return AppsUtils.getAppByManifestURL(this.webapps, aManifestURL);
|
||||
},
|
||||
|
||||
getAppByLocalId: function(aLocalId) {
|
||||
for (let id in this.webapps) {
|
||||
let app = this.webapps[id];
|
||||
if (app.localId == aLocalId) {
|
||||
return this._cloneAppObject(app);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return AppsUtils.getAppByLocalId(this.webapps, aLocalId);
|
||||
},
|
||||
|
||||
getManifestURLByLocalId: function(aLocalId) {
|
||||
for (let id in this.webapps) {
|
||||
let app = this.webapps[id];
|
||||
if (app.localId == aLocalId) {
|
||||
return app.manifestURL;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return AppsUtils.getManifestURLByLocalId(this.webapps, aLocalId);
|
||||
},
|
||||
|
||||
getAppLocalIdByManifestURL: function(aManifestURL) {
|
||||
for (let id in this.webapps) {
|
||||
if (this.webapps[id].manifestURL == aManifestURL) {
|
||||
return this.webapps[id].localId;
|
||||
}
|
||||
}
|
||||
|
||||
return Ci.nsIScriptSecurityManager.NO_APP_ID;
|
||||
return AppsUtils.getAppLocalIdByManifestURL(this.webapps, aManifestURL);
|
||||
},
|
||||
|
||||
getAllWithoutManifests: function(aCallback) {
|
||||
let result = {};
|
||||
for (let id in this.webapps) {
|
||||
let app = this._cloneAppObject(this.webapps[id]);
|
||||
let app = AppsUtils.cloneAppObject(this.webapps[id]);
|
||||
result[id] = app;
|
||||
}
|
||||
aCallback(result);
|
||||
|
@ -36,7 +36,9 @@
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "Connection.h"
|
||||
#ifdef MOZ_B2G_RIL
|
||||
#include "MobileConnection.h"
|
||||
#endif
|
||||
#include "nsIIdleObserver.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsNetUtil.h"
|
||||
@ -116,6 +118,9 @@ NS_INTERFACE_MAP_BEGIN(Navigator)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorTelephony)
|
||||
#endif
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMozNavigatorNetwork)
|
||||
#ifdef MOZ_B2G_RIL
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMozNavigatorMobileConnection)
|
||||
#endif
|
||||
#ifdef MOZ_B2G_BT
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorBluetooth)
|
||||
#endif
|
||||
@ -178,10 +183,12 @@ Navigator::Invalidate()
|
||||
mConnection = nullptr;
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
if (mMobileConnection) {
|
||||
mMobileConnection->Shutdown();
|
||||
mMobileConnection = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT
|
||||
if (mBluetooth) {
|
||||
@ -1185,6 +1192,10 @@ Navigator::GetMozConnection(nsIDOMMozConnection** aConnection)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
//*****************************************************************************
|
||||
// Navigator::nsINavigatorMobileConnection
|
||||
//*****************************************************************************
|
||||
NS_IMETHODIMP
|
||||
Navigator::GetMozMobileConnection(nsIDOMMozMobileConnection** aMobileConnection)
|
||||
{
|
||||
@ -1215,6 +1226,7 @@ Navigator::GetMozMobileConnection(nsIDOMMozMobileConnection** aMobileConnection)
|
||||
NS_ADDREF(*aMobileConnection = mMobileConnection);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif // MOZ_B2G_RIL
|
||||
|
||||
#ifdef MOZ_B2G_BT
|
||||
//*****************************************************************************
|
||||
|
@ -15,6 +15,9 @@
|
||||
#include "nsINavigatorBattery.h"
|
||||
#include "nsIDOMNavigatorSms.h"
|
||||
#include "nsIDOMNavigatorNetwork.h"
|
||||
#ifdef MOZ_B2G_RIL
|
||||
#include "nsINavigatorMobileConnection.h"
|
||||
#endif
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "DeviceStorage.h"
|
||||
@ -62,7 +65,9 @@ class SmsManager;
|
||||
|
||||
namespace network {
|
||||
class Connection;
|
||||
#ifdef MOZ_B2G_RIL
|
||||
class MobileConnection;
|
||||
#endif
|
||||
} // namespace Connection;
|
||||
|
||||
namespace power {
|
||||
@ -83,6 +88,9 @@ class Navigator : public nsIDOMNavigator
|
||||
, public nsIDOMNavigatorTelephony
|
||||
#endif
|
||||
, public nsIDOMMozNavigatorNetwork
|
||||
#ifdef MOZ_B2G_RIL
|
||||
, public nsIMozNavigatorMobileConnection
|
||||
#endif
|
||||
#ifdef MOZ_B2G_BT
|
||||
, public nsIDOMNavigatorBluetooth
|
||||
#endif
|
||||
@ -108,6 +116,9 @@ public:
|
||||
NS_DECL_NSIDOMNAVIGATORTELEPHONY
|
||||
#endif
|
||||
NS_DECL_NSIDOMMOZNAVIGATORNETWORK
|
||||
#ifdef MOZ_B2G_RIL
|
||||
NS_DECL_NSIMOZNAVIGATORMOBILECONNECTION
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT
|
||||
NS_DECL_NSIDOMNAVIGATORBLUETOOTH
|
||||
@ -156,7 +167,9 @@ private:
|
||||
nsCOMPtr<nsIDOMMozVoicemail> mVoicemail;
|
||||
#endif
|
||||
nsRefPtr<network::Connection> mConnection;
|
||||
#ifdef MOZ_B2G_RIL
|
||||
nsRefPtr<network::MobileConnection> mMobileConnection;
|
||||
#endif
|
||||
#ifdef MOZ_B2G_BT
|
||||
nsCOMPtr<nsIDOMBluetoothManager> mBluetooth;
|
||||
#endif
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef mozilla_dom_ScreenOrientation_h
|
||||
#define mozilla_dom_ScreenOrientation_h
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -501,7 +501,9 @@ using mozilla::dom::indexedDB::IDBWrapperCache;
|
||||
#include "nsIDOMSmsFilter.h"
|
||||
#include "nsIDOMSmsCursor.h"
|
||||
#include "nsIDOMConnection.h"
|
||||
#ifdef MOZ_B2G_RIL
|
||||
#include "nsIDOMMobileConnection.h"
|
||||
#endif
|
||||
#include "USSDReceivedEvent.h"
|
||||
#include "mozilla/dom/network/Utils.h"
|
||||
|
||||
@ -511,6 +513,8 @@ using mozilla::dom::indexedDB::IDBWrapperCache;
|
||||
#include "CallEvent.h"
|
||||
#include "nsIDOMVoicemail.h"
|
||||
#include "nsIDOMVoicemailEvent.h"
|
||||
#include "nsIDOMIccManager.h"
|
||||
#include "StkCommandEvent.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT
|
||||
@ -1490,8 +1494,10 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
NS_DEFINE_CLASSINFO_DATA(MozConnection, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
NS_DEFINE_CLASSINFO_DATA(MozMobileConnection, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
#endif
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(USSDReceivedEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
@ -1676,6 +1682,10 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
EVENTTARGET_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(MozVoicemailEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(MozIccManager, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(MozStkCommandEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT
|
||||
@ -2486,6 +2496,9 @@ nsDOMClassInfo::Init()
|
||||
#endif
|
||||
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMMozNavigatorNetwork,
|
||||
network::IsAPIEnabled())
|
||||
#ifdef MOZ_B2G_RIL
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMozNavigatorMobileConnection)
|
||||
#endif
|
||||
#ifdef MOZ_B2G_BT
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorBluetooth)
|
||||
#endif
|
||||
@ -4128,10 +4141,12 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
DOM_CLASSINFO_MAP_BEGIN(MozMobileConnection, nsIDOMMozMobileConnection)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozMobileConnection)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
#endif
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(USSDReceivedEvent, nsIDOMUSSDReceivedEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMUSSDReceivedEvent)
|
||||
@ -4477,6 +4492,17 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozVoicemailEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEvent)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(MozIccManager, nsIDOMMozIccManager)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozIccManager)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(MozStkCommandEvent, nsIDOMMozStkCommandEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozStkCommandEvent)
|
||||
DOM_CLASSINFO_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT
|
||||
|
@ -407,7 +407,9 @@ DOMCI_CLASS(MozSmsFilter)
|
||||
DOMCI_CLASS(MozSmsCursor)
|
||||
|
||||
DOMCI_CLASS(MozConnection)
|
||||
#ifdef MOZ_B2G_RIL
|
||||
DOMCI_CLASS(MozMobileConnection)
|
||||
#endif
|
||||
|
||||
DOMCI_CLASS(USSDReceivedEvent)
|
||||
|
||||
@ -519,6 +521,8 @@ DOMCI_CLASS(TelephonyCall)
|
||||
DOMCI_CLASS(CallEvent)
|
||||
DOMCI_CLASS(MozVoicemail)
|
||||
DOMCI_CLASS(MozVoicemailEvent)
|
||||
DOMCI_CLASS(MozIccManager)
|
||||
DOMCI_CLASS(MozStkCommandEvent)
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT
|
||||
|
@ -10,7 +10,14 @@
|
||||
#
|
||||
# Valid fields for all descriptors:
|
||||
# * nativeType - The native type (concrete class or XPCOM interface) that
|
||||
# instances of this interface will unwrap to (required).
|
||||
# instances of this interface will unwrap to. If not
|
||||
# specified, defaults to "mozilla::dom::InterfaceName" for
|
||||
# non-worker non-external-or-callback interfaces, to
|
||||
# "mozilla::dom::workers::InterfaceName" for worker
|
||||
# non-external interfaces, to 'nsIDOM' followed by the
|
||||
# interface name for non-worker external-or-callback
|
||||
# interfaces, and to "JSObject" for worker external-or-callback
|
||||
# interfaces.
|
||||
# * headerFile - The file in which the nativeType is declared (defaults
|
||||
# to an educated guess).
|
||||
# * castable - Indicates whether the value in the wrapper can be cast to
|
||||
@ -56,13 +63,10 @@ DOMInterfaces = {
|
||||
|
||||
'Blob': [
|
||||
{
|
||||
'nativeType': 'nsIDOMBlob',
|
||||
'headerFile': 'nsIDOMFile.h',
|
||||
},
|
||||
{
|
||||
'workers': True,
|
||||
'nativeType': 'JSObject',
|
||||
'headerFile': 'jsapi.h',
|
||||
}],
|
||||
|
||||
'CanvasRenderingContext2D': [
|
||||
@ -98,29 +102,20 @@ DOMInterfaces = {
|
||||
},
|
||||
{
|
||||
'workers': True,
|
||||
'nativeType': 'JSObject',
|
||||
'headerFile': 'jsapi.h',
|
||||
}],
|
||||
|
||||
'Event': [
|
||||
{
|
||||
'nativeType': 'nsIDOMEvent',
|
||||
},
|
||||
{
|
||||
'workers': True,
|
||||
'nativeType': 'JSObject',
|
||||
'headerFile': 'jsapi.h',
|
||||
}],
|
||||
|
||||
'EventListener': [
|
||||
{
|
||||
'nativeType': 'nsIDOMEventListener',
|
||||
'prefable': True
|
||||
},
|
||||
{
|
||||
'workers': True,
|
||||
'nativeType': 'JSObject',
|
||||
'headerFile': 'jsapi.h'
|
||||
}],
|
||||
|
||||
'EventTarget': [
|
||||
@ -132,19 +127,15 @@ DOMInterfaces = {
|
||||
},
|
||||
{
|
||||
'workers': True,
|
||||
'nativeType': 'mozilla::dom::workers::EventTarget',
|
||||
'headerFile': 'mozilla/dom/workers/bindings/EventTarget.h',
|
||||
'concrete': False
|
||||
}],
|
||||
|
||||
'FormData': [
|
||||
{
|
||||
'nativeType': 'nsIDOMFormData',
|
||||
},
|
||||
{
|
||||
'workers': True,
|
||||
'nativeType': 'JSObject',
|
||||
'headerFile': 'jsapi.h',
|
||||
}],
|
||||
|
||||
'IID': [
|
||||
@ -154,8 +145,6 @@ DOMInterfaces = {
|
||||
},
|
||||
{
|
||||
'workers': True,
|
||||
'nativeType': 'JSObject',
|
||||
'headerFile': 'jsapi.h',
|
||||
}],
|
||||
|
||||
'InputStream': [
|
||||
@ -165,8 +154,6 @@ DOMInterfaces = {
|
||||
},
|
||||
{
|
||||
'workers': True,
|
||||
'nativeType': 'JSObject',
|
||||
'headerFile': 'jsapi.h',
|
||||
}],
|
||||
|
||||
'MozChannel': [
|
||||
@ -176,8 +163,6 @@ DOMInterfaces = {
|
||||
},
|
||||
{
|
||||
'workers': True,
|
||||
'nativeType': 'JSObject',
|
||||
'headerFile': 'jsapi.h',
|
||||
}],
|
||||
|
||||
'Performance': {
|
||||
@ -219,7 +204,6 @@ DOMInterfaces = {
|
||||
},
|
||||
{
|
||||
'workers': True,
|
||||
'nativeType': 'mozilla::dom::workers::XMLHttpRequest',
|
||||
'headerFile': 'mozilla/dom/workers/bindings/XMLHttpRequest.h',
|
||||
}],
|
||||
|
||||
@ -233,7 +217,6 @@ DOMInterfaces = {
|
||||
{
|
||||
'workers': True,
|
||||
'concrete': False,
|
||||
'nativeType': 'mozilla::dom::workers::XMLHttpRequestEventTarget',
|
||||
'headerFile': 'mozilla/dom/workers/bindings/XMLHttpRequestEventTarget.h'
|
||||
}],
|
||||
|
||||
@ -245,7 +228,6 @@ DOMInterfaces = {
|
||||
},
|
||||
{
|
||||
'workers': True,
|
||||
'nativeType': 'mozilla::dom::workers::XMLHttpRequestUpload',
|
||||
'headerFile': 'mozilla/dom/workers/bindings/XMLHttpRequestUpload.h'
|
||||
}],
|
||||
|
||||
@ -254,7 +236,6 @@ DOMInterfaces = {
|
||||
####################################
|
||||
|
||||
'TestInterface' : {
|
||||
'nativeType': 'mozilla::dom::TestInterface',
|
||||
'headerFile': 'TestBindingHeader.h',
|
||||
'register': False,
|
||||
'resultNotAddRefed': [ 'receiveWeakSelf', 'receiveWeakNullableSelf',
|
||||
@ -272,7 +253,6 @@ DOMInterfaces = {
|
||||
},
|
||||
|
||||
'TestNonCastableInterface' : {
|
||||
'nativeType': 'mozilla::dom::TestNonCastableInterface',
|
||||
'headerFile': 'TestBindingHeader.h',
|
||||
'register': False,
|
||||
'castable': False
|
||||
@ -285,7 +265,6 @@ DOMInterfaces = {
|
||||
},
|
||||
|
||||
'TestNonWrapperCacheInterface' : {
|
||||
'nativeType': 'mozilla::dom::TestNonWrapperCacheInterface',
|
||||
'headerFile': 'TestBindingHeader.h',
|
||||
'register': False,
|
||||
'wrapperCache': False
|
||||
@ -298,7 +277,6 @@ DOMInterfaces = {
|
||||
},
|
||||
|
||||
'IndirectlyImplementedInterface': {
|
||||
'nativeType': 'mozilla::dom::IndirectlyImplementedInterface',
|
||||
'headerFile': 'TestBindingHeader.h',
|
||||
'register': False,
|
||||
'castable': False,
|
||||
@ -306,52 +284,44 @@ DOMInterfaces = {
|
||||
},
|
||||
|
||||
'OnlyForUseInConstructor' : {
|
||||
'nativeType': 'mozilla::dom::OnlyForUseInConstructor',
|
||||
'headerFile': 'TestBindingHeader.h',
|
||||
'register': False
|
||||
},
|
||||
|
||||
|
||||
'TestIndexedGetterInterface' : {
|
||||
'nativeType': 'mozilla::dom::TestIndexedGetterInterface',
|
||||
'headerFile': 'TestBindingHeader.h',
|
||||
'register': False,
|
||||
'infallible': [ 'length' ]
|
||||
},
|
||||
|
||||
'TestNamedGetterInterface' : {
|
||||
'nativeType': 'mozilla::dom::TestNamedGetterInterface',
|
||||
'headerFile': 'TestBindingHeader.h',
|
||||
'register': False
|
||||
},
|
||||
|
||||
'TestIndexedAndNamedGetterInterface' : {
|
||||
'nativeType': 'mozilla::dom::TestIndexedAndNamedGetterInterface',
|
||||
'headerFile': 'TestBindingHeader.h',
|
||||
'register': False,
|
||||
'infallible': [ 'length' ]
|
||||
},
|
||||
|
||||
'TestIndexedSetterInterface' : {
|
||||
'nativeType': 'mozilla::dom::TestIndexedSetterInterface',
|
||||
'headerFile': 'TestBindingHeader.h',
|
||||
'register': False
|
||||
},
|
||||
|
||||
'TestNamedSetterInterface' : {
|
||||
'nativeType': 'mozilla::dom::TestNamedSetterInterface',
|
||||
'headerFile': 'TestBindingHeader.h',
|
||||
'register': False
|
||||
},
|
||||
|
||||
'TestIndexedAndNamedSetterInterface' : {
|
||||
'nativeType': 'mozilla::dom::TestIndexedAndNamedSetterInterface',
|
||||
'headerFile': 'TestBindingHeader.h',
|
||||
'register': False
|
||||
},
|
||||
|
||||
'TestIndexedAndNamedGetterAndSetterInterface' : {
|
||||
'nativeType': 'mozilla::dom::TestIndexedAndNamedGetterAndSetterInterface',
|
||||
'headerFile': 'TestBindingHeader.h',
|
||||
'register': False,
|
||||
'infallible': [ 'length', '__stringifier' ],
|
||||
@ -361,12 +331,11 @@ DOMInterfaces = {
|
||||
|
||||
# These are temporary, until they've been converted to use new DOM bindings
|
||||
def addExternalIface(iface, nativeType=None, headerFile=None):
|
||||
if nativeType is None:
|
||||
nativeType = 'nsIDOM' + iface
|
||||
domInterface = {
|
||||
'nativeType': nativeType,
|
||||
'concrete': False
|
||||
}
|
||||
if not nativeType is None:
|
||||
domInterface['nativeType'] = nativeType
|
||||
if not headerFile is None:
|
||||
domInterface['headerFile'] = headerFile
|
||||
DOMInterfaces[iface] = domInterface
|
||||
|
@ -1470,11 +1470,29 @@ class CastableObjectUnwrapper():
|
||||
"""
|
||||
def __init__(self, descriptor, source, target, codeOnFailure):
|
||||
assert descriptor.castable
|
||||
|
||||
self.substitution = { "type" : descriptor.nativeType,
|
||||
"protoID" : "prototypes::id::" + descriptor.name,
|
||||
"source" : source,
|
||||
"target" : target,
|
||||
"codeOnFailure" : CGIndenter(CGGeneric(codeOnFailure), 4).define() }
|
||||
if descriptor.hasXPConnectImpls:
|
||||
# We don't use xpc_qsUnwrapThis because it will always throw on
|
||||
# unwrap failure, whereas we want to control whether we throw or
|
||||
# not.
|
||||
self.substitution["codeOnFailure"] = CGIndenter(CGGeneric(string.Template(
|
||||
"${type} *objPtr;\n"
|
||||
"xpc_qsSelfRef objRef;\n"
|
||||
"JS::Value val = JS::ObjectValue(*${source});\n"
|
||||
"nsresult rv = xpc_qsUnwrapArg<${type}>(cx, val, &objPtr, &objRef.ptr, &val);\n"
|
||||
"if (NS_FAILED(rv)) {\n"
|
||||
"${codeOnFailure}\n"
|
||||
"}\n"
|
||||
"// We should be castable!\n"
|
||||
"MOZ_ASSERT(!objRef.ptr);\n"
|
||||
"// We should have an object, too!\n"
|
||||
"MOZ_ASSERT(objPtr);\n"
|
||||
"${target} = objPtr;").substitute(self.substitution)), 4).define()
|
||||
|
||||
def __str__(self):
|
||||
return string.Template(
|
||||
@ -2670,7 +2688,7 @@ if (!%(resultStr)s) {
|
||||
# NB: setValue(..., True) calls JS_WrapValue(), so is fallible
|
||||
return (setValue(result, True), False)
|
||||
|
||||
if type.isObject():
|
||||
if type.isObject() or type.isSpiderMonkeyInterface():
|
||||
# See comments in WrapNewBindingObject explaining why we need
|
||||
# to wrap here.
|
||||
if type.nullable():
|
||||
@ -2794,7 +2812,7 @@ def getRetvalDeclarationForType(returnType, descriptorProvider,
|
||||
return CGGeneric("JSObject*"), False
|
||||
if returnType.tag() is IDLType.Tags.any:
|
||||
return CGGeneric("JS::Value"), False
|
||||
if returnType.isObject():
|
||||
if returnType.isObject() or returnType.isSpiderMonkeyInterface():
|
||||
return CGGeneric("JSObject*"), False
|
||||
if returnType.isSequence():
|
||||
nullable = returnType.nullable()
|
||||
@ -3301,6 +3319,7 @@ class FakeCastableDescriptor():
|
||||
self.workers = descriptor.workers
|
||||
self.nativeType = descriptor.nativeType
|
||||
self.name = descriptor.name
|
||||
self.hasXPConnectImpls = descriptor.hasXPConnectImpls
|
||||
|
||||
class CGAbstractBindingMethod(CGAbstractStaticMethod):
|
||||
"""
|
||||
|
@ -127,11 +127,27 @@ class Descriptor(DescriptorProvider):
|
||||
self.interface = interface
|
||||
|
||||
# Read the desc, and fill in the relevant defaults.
|
||||
self.nativeType = desc['nativeType']
|
||||
ifaceName = self.interface.identifier.name
|
||||
if self.interface.isExternal() or self.interface.isCallback():
|
||||
if self.workers:
|
||||
nativeTypeDefault = "JSObject"
|
||||
else:
|
||||
nativeTypeDefault = "nsIDOM" + ifaceName
|
||||
else:
|
||||
if self.workers:
|
||||
nativeTypeDefault = "mozilla::dom::workers::" + ifaceName
|
||||
else:
|
||||
nativeTypeDefault = "mozilla::dom::" + ifaceName
|
||||
|
||||
self.nativeType = desc.get('nativeType', nativeTypeDefault)
|
||||
self.hasInstanceInterface = desc.get('hasInstanceInterface', None)
|
||||
|
||||
headerDefault = self.nativeType
|
||||
headerDefault = headerDefault.replace("::", "/") + ".h"
|
||||
# Do something sane for JSObject
|
||||
if self.nativeType == "JSObject":
|
||||
headerDefault = "jsapi.h"
|
||||
else:
|
||||
headerDefault = self.nativeType
|
||||
headerDefault = headerDefault.replace("::", "/") + ".h"
|
||||
self.headerFile = desc.get('headerFile', headerDefault)
|
||||
|
||||
if self.interface.isCallback() or self.interface.isExternal():
|
||||
@ -145,6 +161,8 @@ class Descriptor(DescriptorProvider):
|
||||
self.notflattened = desc.get('notflattened', False)
|
||||
self.register = desc.get('register', True)
|
||||
|
||||
self.hasXPConnectImpls = desc.get('hasXPConnectImpls', False)
|
||||
|
||||
# If we're concrete, we need to crawl our ancestor interfaces and mark
|
||||
# them as having a concrete descendant.
|
||||
self.concrete = desc.get('concrete', not self.interface.isExternal())
|
||||
|
@ -94,7 +94,7 @@ CSS2Properties.webidl: $(topsrcdir)/layout/style/nsCSSPropList.h \
|
||||
$(webidl_base)/CSS2PropertiesProps.h \
|
||||
$(srcdir)/GenerateCSS2PropertiesWebIDL.py \
|
||||
$(GLOBAL_DEPS)
|
||||
$(CPP) -I$(topsrcdir)/layout/style $(webidl_base)/CSS2PropertiesProps.h | \
|
||||
$(CPP) $(DEFINES) $(ACDEFINES) -I$(topsrcdir)/layout/style $(webidl_base)/CSS2PropertiesProps.h | \
|
||||
PYTHONDONTWRITEBYTECODE=1 $(PYTHON) \
|
||||
$(srcdir)/GenerateCSS2PropertiesWebIDL.py $(webidl_base)/CSS2Properties.webidl.in > CSS2Properties.webidl
|
||||
|
||||
|
@ -330,6 +330,7 @@ public:
|
||||
void PassUint8ClampedArray(Uint8ClampedArray&, ErrorResult&);
|
||||
void PassFloat32Array(Float32Array&, ErrorResult&);
|
||||
void PassFloat64Array(Float64Array&, ErrorResult&);
|
||||
JSObject* ReceiveUint8Array(ErrorResult&);
|
||||
|
||||
// String types
|
||||
void PassString(const nsAString&, ErrorResult&);
|
||||
|
@ -228,6 +228,7 @@ interface TestInterface {
|
||||
void passUint8ClampedArray(Uint8ClampedArray arg);
|
||||
void passFloat32Array(Float32Array arg);
|
||||
void passFloat64Array(Float64Array arg);
|
||||
Uint8Array receiveUint8Array();
|
||||
|
||||
// String types
|
||||
void passString(DOMString arg);
|
||||
|
@ -17,6 +17,8 @@ namespace dom {
|
||||
namespace devicestorage {
|
||||
|
||||
DeviceStorageRequestParent::DeviceStorageRequestParent(const DeviceStorageParams& aParams)
|
||||
: mMutex("DeviceStorageRequestParent::mMutex")
|
||||
, mActorDestoryed(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(DeviceStorageRequestParent);
|
||||
|
||||
@ -127,6 +129,8 @@ NS_IMPL_THREADSAFE_RELEASE(DeviceStorageRequestParent);
|
||||
void
|
||||
DeviceStorageRequestParent::ActorDestroy(ActorDestroyReason)
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
mActorDestoryed = true;
|
||||
int32_t count = mRunnables.Length();
|
||||
for (int32_t index = 0; index < count; index++) {
|
||||
mRunnables[index]->Cancel();
|
||||
|
@ -37,9 +37,8 @@ private:
|
||||
public:
|
||||
CancelableRunnable(DeviceStorageRequestParent* aParent)
|
||||
: mParent(aParent)
|
||||
, mCanceled(false)
|
||||
{
|
||||
mParent->AddRunnable(this);
|
||||
mCanceled = !(mParent->AddRunnable(this));
|
||||
}
|
||||
|
||||
virtual ~CancelableRunnable() {
|
||||
@ -49,17 +48,11 @@ private:
|
||||
nsresult rv = NS_OK;
|
||||
if (!mCanceled) {
|
||||
rv = CancelableRun();
|
||||
|
||||
nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &CancelableRunnable::RemoveRunnable);
|
||||
NS_DispatchToMainThread(event);
|
||||
mParent->RemoveRunnable(this);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
void RemoveRunnable() {
|
||||
mParent->RemoveRunnable(this);
|
||||
}
|
||||
|
||||
void Cancel() {
|
||||
mCanceled = true;
|
||||
}
|
||||
@ -189,14 +182,22 @@ private:
|
||||
};
|
||||
|
||||
protected:
|
||||
void AddRunnable(CancelableRunnable* aRunnable) {
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
bool AddRunnable(CancelableRunnable* aRunnable) {
|
||||
MutexAutoLock lock(mMutex);
|
||||
if (mActorDestoryed)
|
||||
return false;
|
||||
|
||||
mRunnables.AppendElement(aRunnable);
|
||||
return true;
|
||||
}
|
||||
|
||||
void RemoveRunnable(CancelableRunnable* aRunnable) {
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
MutexAutoLock lock(mMutex);
|
||||
mRunnables.RemoveElement(aRunnable);
|
||||
}
|
||||
|
||||
Mutex mMutex;
|
||||
bool mActorDestoryed;
|
||||
nsTArray<nsRefPtr<CancelableRunnable> > mRunnables;
|
||||
};
|
||||
|
||||
|
@ -264,7 +264,23 @@ DeviceStorageFile::Write(InfallibleTArray<uint8_t>& aBits) {
|
||||
nsresult
|
||||
DeviceStorageFile::Remove()
|
||||
{
|
||||
mFile->Remove(true);
|
||||
NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
bool check;
|
||||
nsresult rv = mFile->Exists(&check);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (!check) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
rv = mFile->Remove(true);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<IOEventComplete> iocomplete = new IOEventComplete(mFile, "deleted");
|
||||
NS_DispatchToMainThread(iocomplete);
|
||||
return NS_OK;
|
||||
@ -1096,7 +1112,6 @@ public:
|
||||
mFile->Remove();
|
||||
|
||||
nsRefPtr<nsRunnable> r;
|
||||
|
||||
bool check = false;
|
||||
mFile->mFile->Exists(&check);
|
||||
if (check) {
|
||||
|
@ -38,6 +38,7 @@ DOM_SRCDIRS += \
|
||||
dom/system/gonk \
|
||||
dom/telephony \
|
||||
dom/wifi \
|
||||
dom/icc/src \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
14
dom/icc/Makefile.in
Normal file
14
dom/icc/Makefile.in
Normal file
@ -0,0 +1,14 @@
|
||||
# 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/.
|
||||
|
||||
DEPTH = @DEPTH@
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
PARALLEL_DIRS = interfaces src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
21
dom/icc/interfaces/Makefile.in
Normal file
21
dom/icc/interfaces/Makefile.in
Normal file
@ -0,0 +1,21 @@
|
||||
# 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/.
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
XPIDL_MODULE = dom_icc
|
||||
|
||||
include $(topsrcdir)/dom/dom-config.mk
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIDOMIccManager.idl \
|
||||
SimToolKit.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
377
dom/icc/interfaces/SimToolKit.idl
Normal file
377
dom/icc/interfaces/SimToolKit.idl
Normal file
@ -0,0 +1,377 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsIDOMEvent.idl"
|
||||
|
||||
interface nsIDOMEvent;
|
||||
|
||||
dictionary MozStkTextMessage
|
||||
{
|
||||
/**
|
||||
* Text String.
|
||||
*
|
||||
* @see TS 11.14, clause 12.15, Text String.
|
||||
*/
|
||||
DOMString text;
|
||||
|
||||
/**
|
||||
* Indicate this text message is high priority or normal priority.
|
||||
*
|
||||
* @see TS 11.14, clause 12.6, Command Qualifier, Display Text, bit 1.
|
||||
*
|
||||
* High priority text shall be displayed on the screen immediately, except if
|
||||
* there is a conflict of priority level of alerting such as incoming calls
|
||||
* or a low battery warning. In that situation, the resolution is left to
|
||||
* the terminal. If the command is rejected in spite of the high priority,
|
||||
* the terminal shall inform the ICC with resultCode is
|
||||
* TERMINAL_CRNTLY_UNABLE_TO_PROCESS in MozStkResponse.
|
||||
*
|
||||
* true: high priority
|
||||
* false: normal priority
|
||||
*/
|
||||
boolean isHighPriority;
|
||||
|
||||
/**
|
||||
* Need to wait for user to clear message or not.
|
||||
*
|
||||
* @see TS 11.14, clause 12.6, Command Qualifier, Display Text, bit 8.
|
||||
*
|
||||
* If this attribute is true, but user doesn't give any input within a period
|
||||
* of time(said 30 secs), the terminal shall inform the ICC with resultCode
|
||||
* is NO_RESPONSE_FROM_USER in MozStkResponse.
|
||||
*
|
||||
* true: Wait for user to clear message.
|
||||
* false: clear message after a delay.
|
||||
*/
|
||||
boolean userClear;
|
||||
|
||||
/**
|
||||
* Need to response immediately or not.
|
||||
*
|
||||
* @see TS 11.14, clause 12.43, Immediate response.
|
||||
*
|
||||
* When this attribute is true, the terminal shall immediately send
|
||||
* MozStkResponse with resultCode is OK.
|
||||
*
|
||||
* true: The terminal shall send response immediately.
|
||||
* false: otherwise.
|
||||
*/
|
||||
boolean responseNeeded;
|
||||
};
|
||||
|
||||
dictionary MozStkItem
|
||||
{
|
||||
/**
|
||||
* Identifier of item.
|
||||
*
|
||||
* The identifier is a single byte between '01' and 'FF'. Each item shall
|
||||
* have a unique identifier within an Item list.
|
||||
*/
|
||||
unsigned short identifier;
|
||||
|
||||
/**
|
||||
* Text string of item.
|
||||
*/
|
||||
DOMString text;
|
||||
};
|
||||
|
||||
dictionary MozStkMenu
|
||||
{
|
||||
/**
|
||||
* Array of MozStkItem.
|
||||
*
|
||||
* @see TS 11.14, clause 12.9
|
||||
*/
|
||||
jsval items; // MozStkItem[]
|
||||
|
||||
/**
|
||||
* Presentation type, one of TYPE_*.
|
||||
*/
|
||||
unsigned short presentationType;
|
||||
|
||||
/**
|
||||
* Title of the menu.
|
||||
*/
|
||||
DOMString title;
|
||||
|
||||
/**
|
||||
* Default item identifier of the menu.
|
||||
*/
|
||||
unsigned short defaultItem;
|
||||
|
||||
/**
|
||||
* Help information available or not.
|
||||
*
|
||||
* @see TS 11.14, clause 12.6, Command Qualifier, SET UP MENU, bit 8.
|
||||
*
|
||||
* true: help information available.
|
||||
* false: no help information available.
|
||||
*/
|
||||
boolean isHelpAvailable;
|
||||
};
|
||||
|
||||
dictionary MozStkInput
|
||||
{
|
||||
/**
|
||||
* Text for the ME to display in conjunction with asking the user to respond.
|
||||
*/
|
||||
DOMString text;
|
||||
|
||||
/**
|
||||
* Minimum length of response.
|
||||
*/
|
||||
unsigned short minLength;
|
||||
|
||||
/**
|
||||
* Maximum length of response.
|
||||
*/
|
||||
unsigned short maxLength;
|
||||
|
||||
/**
|
||||
* Text for the ME to display, corresponds to a default text string offered
|
||||
* by the ICC.
|
||||
*/
|
||||
DOMString defaultText;
|
||||
|
||||
/**
|
||||
* Input format.
|
||||
*
|
||||
* @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 1.
|
||||
*
|
||||
* true: Alphabet set.
|
||||
* false: Digits only.
|
||||
*/
|
||||
boolean isAlphabet;
|
||||
|
||||
/**
|
||||
* Alphabet encoding.
|
||||
*
|
||||
* @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 2.
|
||||
*
|
||||
* true: UCS2 alphabet.
|
||||
* false: default SMS alphabet.
|
||||
*/
|
||||
boolean isUCS2;
|
||||
|
||||
/**
|
||||
* Visibility of input.
|
||||
*
|
||||
* @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 3.
|
||||
*
|
||||
* true: User input shall not be revealed in any way.
|
||||
* false: ME may echo user input on the display.
|
||||
*/
|
||||
boolean hideInput;
|
||||
|
||||
/**
|
||||
* Yes/No response is requested.
|
||||
*
|
||||
* @see TS 11.14, clause 12.6, Command Qualifier, GET INKEY, bit 3.
|
||||
*
|
||||
* true: Yes/No response is requested, and character sets
|
||||
* (Alphabet set and UCS2) are disabled.
|
||||
* false: Character sets (Alphabet set and UCS2) are enabled.
|
||||
*/
|
||||
boolean isYesNoRequested;
|
||||
|
||||
/**
|
||||
* User input in packed or unpacked format.
|
||||
*
|
||||
* @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 4.
|
||||
*
|
||||
* true: User input to be in SMS packed format.
|
||||
* false: User input to be in unpacked format.
|
||||
*/
|
||||
boolean isPacked;
|
||||
|
||||
/**
|
||||
* Help information available or not.
|
||||
*
|
||||
* @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT/GET INKEY, bit 8.
|
||||
*
|
||||
* true: help information available.
|
||||
* false: no help information available.
|
||||
*/
|
||||
boolean isHelpAvailable;
|
||||
};
|
||||
|
||||
dictionary MozStkBrowserSetting
|
||||
{
|
||||
/**
|
||||
* Confirm message to launch browser.
|
||||
*
|
||||
* @see MozStkTextMessage for the detail specification of
|
||||
* confirmMessage.
|
||||
*/
|
||||
jsval confirmMessage;
|
||||
|
||||
/**
|
||||
* The URL to be opened by browser.
|
||||
*/
|
||||
DOMString url;
|
||||
|
||||
/**
|
||||
* One of STK_BROWSER_MODE_*.
|
||||
*
|
||||
* @see nsIDOMMozIccManager.STK_BROWSER_MODE_*
|
||||
*/
|
||||
unsigned short mode;
|
||||
};
|
||||
|
||||
dictionary MozStkSetUpCall
|
||||
{
|
||||
/**
|
||||
* The Dialling number.
|
||||
*/
|
||||
DOMString address;
|
||||
|
||||
/**
|
||||
* The text message used in user confirmation phase.
|
||||
*
|
||||
* @see MozStkTextMessage for the detail specification of
|
||||
* confirmMessage.
|
||||
*/
|
||||
jsval confirmMessage;
|
||||
|
||||
/**
|
||||
* The text message used in call set up phase.
|
||||
*
|
||||
* @see MozStkTextMessage for the detail specification of
|
||||
* callMessage.
|
||||
*/
|
||||
jsval callMessage;
|
||||
};
|
||||
|
||||
dictionary MozStkCommand
|
||||
{
|
||||
/**
|
||||
* The number of command issued by ICC. And it is assigned
|
||||
* by ICC may take any hexadecimal value betweean '01' and 'FE'.
|
||||
*
|
||||
* @see TS 11.14, clause 6.5.1
|
||||
*/
|
||||
unsigned short commandNumber;
|
||||
|
||||
/**
|
||||
* One of STK_CMD_*
|
||||
*/
|
||||
unsigned short typeOfCommand;
|
||||
|
||||
/**
|
||||
* Qualifiers specific to the command.
|
||||
*/
|
||||
unsigned short commandQualifier;
|
||||
|
||||
/**
|
||||
* options varies accrording to the typeOfCommand in MozStkCommand.
|
||||
*
|
||||
* When typeOfCommand is
|
||||
* - STK_DISPLAY_TEXT
|
||||
* - STK_SET_UP_IDLE_MODE_TEXT
|
||||
* - STK_REFRESH
|
||||
* - STK_SEND_{SS|USSD|SMS|DTMF},
|
||||
* options is MozStkTextMessage.
|
||||
*
|
||||
* When typeOfCommand is
|
||||
* - STK_SELECT_ITEM
|
||||
* - STK_SET_UP_MENU
|
||||
* options is MozStkMenu.
|
||||
*
|
||||
* When typeOfCommand is
|
||||
* - STK_GET_INKEY
|
||||
* - STK_GET_INPUT,
|
||||
* options is MozStkInput.
|
||||
*
|
||||
* When typeOfCommand is
|
||||
* - STK_LAUNCH_BROWSER
|
||||
* options is MozStkBrowserSetting.
|
||||
*
|
||||
* When typeOfCommand is
|
||||
* - STK_SET_UP_CALL
|
||||
* options is MozStkSetUpCall.
|
||||
*/
|
||||
jsval options;
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(06bbc6fa-9b59-4db6-b66b-3b26f9c379df)]
|
||||
interface nsIDOMMozStkCommandEvent : nsIDOMEvent
|
||||
{
|
||||
/**
|
||||
* See nsIDOMMozStkCommand for the detail of command.
|
||||
*/
|
||||
[implicit_jscontext]
|
||||
readonly attribute jsval command;
|
||||
};
|
||||
|
||||
dictionary MozStkResponse
|
||||
{
|
||||
/**
|
||||
* commandNumber from MozStkCommand.
|
||||
*
|
||||
* @see MozStkCommand.commandNumber
|
||||
*/
|
||||
unsigned short commandNumber;
|
||||
|
||||
/**
|
||||
* One of MozStkCommand.typeOfCommand
|
||||
*
|
||||
* @see MozStkCommand.typeOfCommand
|
||||
*/
|
||||
unsigned short typeOfCommand;
|
||||
|
||||
/**
|
||||
* Qualifiers specific to the command.
|
||||
*
|
||||
* @see MozStkCommand.commandQualifier
|
||||
*/
|
||||
unsigned short commandQualifier;
|
||||
|
||||
/**
|
||||
* One of RESULT_*
|
||||
*/
|
||||
unsigned short resultCode;
|
||||
|
||||
/**
|
||||
* The identifier of the item selected by user.
|
||||
*
|
||||
* @see MozStkItem.identifier
|
||||
*/
|
||||
unsigned short itemIdentifier;
|
||||
|
||||
/**
|
||||
* User input.
|
||||
*/
|
||||
DOMString input;
|
||||
|
||||
/**
|
||||
* Alphabet encoding.
|
||||
*
|
||||
* @see MozStkInput.isUCS2
|
||||
*/
|
||||
boolean isUCS2;
|
||||
|
||||
/**
|
||||
* YES/NO response.
|
||||
*
|
||||
* @see MozStkInput.isYesNoRequested
|
||||
*/
|
||||
boolean isYesNo;
|
||||
|
||||
/**
|
||||
* Packed or unpacked format.
|
||||
*
|
||||
* @see MozStkInput.isPacked
|
||||
*/
|
||||
boolean isPacked;
|
||||
|
||||
/**
|
||||
* User has confirmed or rejected the call during STK_CMD_CALL_SET_UP.
|
||||
*
|
||||
* @see RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM
|
||||
*
|
||||
* true: Confirmed by User.
|
||||
* false: Rejected by User.
|
||||
*/
|
||||
boolean hasConfirmed;
|
||||
};
|
175
dom/icc/interfaces/nsIDOMIccManager.idl
Normal file
175
dom/icc/interfaces/nsIDOMIccManager.idl
Normal file
@ -0,0 +1,175 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsIDOMEventTarget.idl"
|
||||
#include "SimToolKit.idl"
|
||||
|
||||
interface nsIDOMEventListener;
|
||||
|
||||
[scriptable, builtinclass, uuid(6ca8ac2b-0c7b-40bf-8eb3-dbd16f89d82f)]
|
||||
interface nsIDOMMozIccManager : nsIDOMEventTarget
|
||||
{
|
||||
/**
|
||||
* STK Menu Presentation types.
|
||||
*/
|
||||
const unsigned short STK_MENU_TYPE_NOT_SPECIFIED = 0x00;
|
||||
const unsigned short STK_MENU_TYPE_DATA_VALUES = 0x01;
|
||||
const unsigned short STK_MENU_TYPE_NAVIGATION_OPTIONS = 0x03;
|
||||
|
||||
/**
|
||||
* Browser launch mode.
|
||||
*/
|
||||
const unsigned short STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED = 0x00;
|
||||
const unsigned short STK_BROWSER_MODE_USING_EXISTING_BROWSER = 0x02;
|
||||
const unsigned short STK_BROWSER_MODE_USING_NEW_BROWSER = 0x03;
|
||||
|
||||
/**
|
||||
* STK Proactive commands.
|
||||
*
|
||||
* @see TS 11.14, clause 13.4
|
||||
*/
|
||||
const unsigned short STK_CMD_REFRESH = 0x01;
|
||||
const unsigned short STK_CMD_SET_UP_CALL = 0x10;
|
||||
const unsigned short STK_CMD_SEND_SS = 0x11;
|
||||
const unsigned short STK_CMD_SEND_USSD = 0x12;
|
||||
const unsigned short STK_CMD_SEND_SMS = 0x13;
|
||||
const unsigned short STK_CMD_SEND_DTMF = 0x14;
|
||||
const unsigned short STK_CMD_LAUNCH_BROWSER = 0x15;
|
||||
const unsigned short STK_CMD_DISPLAY_TEXT = 0x21;
|
||||
const unsigned short STK_CMD_GET_INKEY = 0x22;
|
||||
const unsigned short STK_CMD_GET_INPUT = 0x23;
|
||||
const unsigned short STK_CMD_SELECT_ITEM = 0x24;
|
||||
const unsigned short STK_CMD_SET_UP_MENU = 0x25;
|
||||
const unsigned short STK_CMD_SET_UP_IDLE_MODE_TEXT = 0x28;
|
||||
|
||||
/**
|
||||
* STK Result code.
|
||||
*
|
||||
* @see TS 11.14, clause 12.12
|
||||
*
|
||||
* Results '0X' and '1X' indicate that the command has been performed.
|
||||
*/
|
||||
/** Command performed successfully */
|
||||
const unsigned short STK_RESULT_OK = 0x00;
|
||||
|
||||
/** Command performed with partial comprehension */
|
||||
const unsigned short STK_RESULT_PRFRMD_WITH_PARTIAL_COMPREHENSION = 0x01;
|
||||
|
||||
/** Command performed, with missing information */
|
||||
const unsigned short STK_RESULT_PRFRMD_WITH_MISSING_INFO = 0x02;
|
||||
|
||||
/** REFRESH performed with additional EFs read */
|
||||
const unsigned short STK_RESULT_PRFRMD_WITH_ADDITIONAL_EFS_READ = 0x03;
|
||||
|
||||
/** Command performed successfully, limited service */
|
||||
const unsigned short STK_RESULT_PRFRMD_LIMITED_SERVICE = 0x06;
|
||||
|
||||
/** Proactive UICC session terminated by the user */
|
||||
const unsigned short STK_RESULT_UICC_SESSION_TERM_BY_USER = 0x10;
|
||||
|
||||
/** Backward move in the proactive UICC session requested by the user */
|
||||
const unsigned short STK_RESULT_BACKWARD_MOVE_BY_USER = 0x11;
|
||||
|
||||
/** No response from user */
|
||||
const unsigned short STK_RESULT_NO_RESPONSE_FROM_USER = 0x12;
|
||||
|
||||
/** Help information required by the user */
|
||||
const unsigned short STK_RESULT_HELP_INFO_REQUIRED = 0x13;
|
||||
|
||||
/** USSD or SS transaction terminated by the user */
|
||||
const unsigned short STK_RESULT_USSD_SS_SESSION_TERM_BY_USER = 0x14;
|
||||
|
||||
/**
|
||||
* Results '2X' indicate to the UICC that it may be worth re-trying the
|
||||
* command at a later opportunity.
|
||||
*/
|
||||
/** Terminal currently unable to process command */
|
||||
const unsigned short STK_RESULT_TERMINAL_CRNTLY_UNABLE_TO_PROCESS = 0x20;
|
||||
|
||||
/** Network currently unable to process command */
|
||||
const unsigned short STK_RESULT_NETWORK_CRNTLY_UNABLE_TO_PROCESS = 0x21;
|
||||
|
||||
/** User did not accept the proactive command */
|
||||
const unsigned short STK_RESULT_USER_NOT_ACCEPT = 0x22;
|
||||
|
||||
/** User cleared down call before connection or network release */
|
||||
const unsigned short STK_RESULT_USER_CLEAR_DOWN_CALL = 0x23;
|
||||
|
||||
/** Launch browser generic error code */
|
||||
const unsigned short STK_RESULT_LAUNCH_BROWSER_ERROR = 0x26;
|
||||
|
||||
/**
|
||||
* Results '3X' indicate that it is not worth the UICC re-trying with an
|
||||
* identical command, as it will only get the same response. However, the
|
||||
* decision to retry lies with the application.
|
||||
*/
|
||||
/** Command beyond terminal's capabilities */
|
||||
const unsigned short STK_RESULT_BEYOND_TERMINAL_CAPABILITY = 0x30;
|
||||
|
||||
/** Command type not understood by terminal */
|
||||
const unsigned short STK_RESULT_CMD_TYPE_NOT_UNDERSTOOD = 0x31;
|
||||
|
||||
/** Command data not understood by terminal */
|
||||
const unsigned short STK_RESULT_CMD_DATA_NOT_UNDERSTOOD = 0x32;
|
||||
|
||||
/** Command number not known by terminal */
|
||||
const unsigned short STK_RESULT_CMD_NUM_NOT_KNOWN = 0x33;
|
||||
|
||||
/** SS Return Error */
|
||||
const unsigned short STK_RESULT_SS_RETURN_ERROR = 0x34;
|
||||
|
||||
/** SMS RP-ERROR */
|
||||
const unsigned short STK_RESULT_SMS_RP_ERROR = 0x35;
|
||||
|
||||
/** Error, required values are missing */
|
||||
const unsigned short STK_RESULT_REQUIRED_VALUES_MISSING = 0x36;
|
||||
|
||||
/** USSD Return Error */
|
||||
const unsigned short STK_RESULT_USSD_RETURN_ERROR = 0x37;
|
||||
|
||||
/** MultipleCard commands error */
|
||||
const unsigned short STK_RESULT_MULTI_CARDS_CMD_ERROR = 0x38;
|
||||
|
||||
/**
|
||||
* Interaction with call control by USIM or MO short message control by
|
||||
* USIM, permanent problem
|
||||
*/
|
||||
const unsigned short STK_RESULT_USIM_CALL_CONTROL_PERMANENT = 0x39;
|
||||
|
||||
/** Bearer Independent Protocol error */
|
||||
const unsigned short STK_RESULT_BIP_ERROR = 0x3a;
|
||||
|
||||
/**
|
||||
* Send the response back to ICC after an attempt to execute STK Proactive
|
||||
* Command.
|
||||
*
|
||||
* @param response
|
||||
* The response that will be sent to ICC.
|
||||
* @see MozStkResponse for the detail of response.
|
||||
*/
|
||||
void sendStkResponse(in jsval response);
|
||||
|
||||
/**
|
||||
* Send the "Menu Selection" Envelope command to ICC for menu selection.
|
||||
*
|
||||
* @param itemIdentifier
|
||||
* The identifier of the item selected by user.
|
||||
* @param helpRequested
|
||||
* true if user requests to provide help information, false otherwise.
|
||||
*/
|
||||
void sendStkMenuSelection(in unsigned short itemIdentifier,
|
||||
in boolean helpRequested);
|
||||
|
||||
/**
|
||||
* The 'stkcommand' event is notified whenever STK Proactive Command is
|
||||
* issued from ICC.
|
||||
*/
|
||||
attribute nsIDOMEventListener onstkcommand;
|
||||
|
||||
/**
|
||||
* 'stksessionend' event is notified whenever STK Session is terminated by
|
||||
* ICC.
|
||||
*/
|
||||
attribute nsIDOMEventListener onstksessionend;
|
||||
};
|
166
dom/icc/src/IccManager.cpp
Normal file
166
dom/icc/src/IccManager.cpp
Normal file
@ -0,0 +1,166 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsIDOMClassInfo.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "IccManager.h"
|
||||
#include "SimToolKit.h"
|
||||
#include "StkCommandEvent.h"
|
||||
|
||||
#define NS_RILCONTENTHELPER_CONTRACTID "@mozilla.org/ril/content-helper;1"
|
||||
|
||||
#define STKCOMMAND_EVENTNAME NS_LITERAL_STRING("stkcommand")
|
||||
#define STKSESSIONEND_EVENTNAME NS_LITERAL_STRING("stksessionend")
|
||||
|
||||
DOMCI_DATA(MozIccManager, mozilla::dom::icc::IccManager)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace icc {
|
||||
|
||||
const char* kStkCommandTopic = "icc-manager-stk-command";
|
||||
const char* kStkSessionEndTopic = "icc-manager-stk-session-end";
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(IccManager)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(IccManager,
|
||||
nsDOMEventTargetHelper)
|
||||
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(stkcommand)
|
||||
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(stksessionend)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(IccManager,
|
||||
nsDOMEventTargetHelper)
|
||||
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(stkcommand)
|
||||
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(stksessionend)
|
||||
tmp->mProvider = nullptr;
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(IccManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMozIccManager)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMozIccManager)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozIccManager)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(IccManager, nsDOMEventTargetHelper)
|
||||
NS_IMPL_RELEASE_INHERITED(IccManager, nsDOMEventTargetHelper)
|
||||
|
||||
IccManager::IccManager()
|
||||
{
|
||||
mProvider = do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
|
||||
|
||||
// Not being able to acquire the provider isn't fatal since we check
|
||||
// for it explicitly below.
|
||||
if (!mProvider) {
|
||||
NS_WARNING("Could not acquire nsIMobileConnectionProvider!");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
IccManager::Init(nsPIDOMWindow* aWindow)
|
||||
{
|
||||
BindToOwner(aWindow);
|
||||
|
||||
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
||||
if (!obs) {
|
||||
NS_WARNING("Could not acquire nsIObserverService!");
|
||||
return;
|
||||
}
|
||||
|
||||
obs->AddObserver(this, kStkCommandTopic, false);
|
||||
obs->AddObserver(this, kStkSessionEndTopic, false);
|
||||
}
|
||||
|
||||
void
|
||||
IccManager::Shutdown()
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
||||
if (!obs) {
|
||||
NS_WARNING("Could not acquire nsIObserverService!");
|
||||
return;
|
||||
}
|
||||
|
||||
obs->RemoveObserver(this, kStkCommandTopic);
|
||||
obs->RemoveObserver(this, kStkSessionEndTopic);
|
||||
}
|
||||
|
||||
// nsIObserver
|
||||
|
||||
NS_IMETHODIMP
|
||||
IccManager::Observe(nsISupports* aSubject,
|
||||
const char* aTopic,
|
||||
const PRUnichar* aData)
|
||||
{
|
||||
if (!strcmp(aTopic, kStkCommandTopic)) {
|
||||
nsString stkMsg;
|
||||
stkMsg.Assign(aData);
|
||||
nsRefPtr<StkCommandEvent> event = StkCommandEvent::Create(stkMsg);
|
||||
|
||||
NS_ASSERTION(event, "This should never fail!");
|
||||
|
||||
nsresult rv = event->Dispatch(ToIDOMEventTarget(), STKCOMMAND_EVENTNAME);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!strcmp(aTopic, kStkSessionEndTopic)) {
|
||||
InternalDispatchEvent(STKSESSIONEND_EVENTNAME);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MOZ_NOT_REACHED("Unknown observer topic!");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIDOMMozIccManager
|
||||
|
||||
NS_IMETHODIMP
|
||||
IccManager::SendStkResponse(const JS::Value& aResponse)
|
||||
{
|
||||
if (!mProvider) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mProvider->SendStkResponse(GetOwner(), aResponse);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
IccManager::SendStkMenuSelection(uint16_t aItemIdentifier, bool aHelpRequested)
|
||||
{
|
||||
if (!mProvider) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mProvider->SendStkMenuSelection(GetOwner(), aItemIdentifier, aHelpRequested);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
IccManager::InternalDispatchEvent(const nsAString& aType)
|
||||
{
|
||||
nsRefPtr<nsDOMEvent> event = new nsDOMEvent(nullptr, nullptr);
|
||||
nsresult rv = event->InitEvent(aType, false, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = event->SetTrusted(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool dummy;
|
||||
rv = DispatchEvent(event, &dummy);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_EVENT_HANDLER(IccManager, stkcommand)
|
||||
NS_IMPL_EVENT_HANDLER(IccManager, stksessionend)
|
||||
|
||||
} // namespace icc
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
57
dom/icc/src/IccManager.h
Normal file
57
dom/icc/src/IccManager.h
Normal file
@ -0,0 +1,57 @@
|
||||
/* 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_icc_IccManager_h
|
||||
#define mozilla_dom_icc_IccManager_h
|
||||
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
#include "nsIDOMIccManager.h"
|
||||
#include "nsIMobileConnectionProvider.h"
|
||||
#include "nsIObserver.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace icc {
|
||||
|
||||
class IccManager : public nsDOMEventTargetHelper
|
||||
, public nsIDOMMozIccManager
|
||||
, public nsIObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSIDOMMOZICCMANAGER
|
||||
|
||||
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
|
||||
|
||||
IccManager();
|
||||
|
||||
void Init(nsPIDOMWindow *aWindow);
|
||||
void Shutdown();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(IccManager,
|
||||
nsDOMEventTargetHelper)
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIMobileConnectionProvider> mProvider;
|
||||
|
||||
nsIDOMEventTarget*
|
||||
ToIDOMEventTarget() const
|
||||
{
|
||||
return static_cast<nsDOMEventTargetHelper*>(
|
||||
const_cast<IccManager*>(this));
|
||||
}
|
||||
|
||||
nsresult InternalDispatchEvent(const nsAString& aType);
|
||||
|
||||
NS_DECL_EVENT_HANDLER(stkcommand)
|
||||
NS_DECL_EVENT_HANDLER(stksessionend)
|
||||
};
|
||||
|
||||
} // namespace icc
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_icc_IccManager_h
|
35
dom/icc/src/Makefile.in
Normal file
35
dom/icc/src/Makefile.in
Normal file
@ -0,0 +1,35 @@
|
||||
# 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/.
|
||||
|
||||
DEPTH = @DEPTH@
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = $(srcdir)
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
LIBRARY_NAME = dom_icc_s
|
||||
LIBXUL_LIBRARY = 1
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/dom/dom-config.mk
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla/dom/icc
|
||||
|
||||
EXPORTS_mozilla/dom/icc = \
|
||||
StkCommandEvent.h \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
IccManager.cpp \
|
||||
StkCommandEvent.cpp \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(topsrcdir)/content/events/src \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
55
dom/icc/src/StkCommandEvent.cpp
Normal file
55
dom/icc/src/StkCommandEvent.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsIDOMClassInfo.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "SimToolKit.h"
|
||||
#include "StkCommandEvent.h"
|
||||
|
||||
#include "nsJSON.h"
|
||||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
DOMCI_DATA(MozStkCommandEvent, mozilla::dom::icc::StkCommandEvent)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace icc {
|
||||
|
||||
already_AddRefed<StkCommandEvent>
|
||||
StkCommandEvent::Create(nsAString& aMessage)
|
||||
{
|
||||
nsRefPtr<StkCommandEvent> event = new StkCommandEvent();
|
||||
event->mCommand = aMessage;
|
||||
return event.forget();
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(StkCommandEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(StkCommandEvent, nsDOMEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(StkCommandEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMozStkCommandEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozStkCommandEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
StkCommandEvent::GetCommand(JSContext* aCx, jsval* aCommand)
|
||||
|
||||
{
|
||||
nsCOMPtr<nsIJSON> json(new nsJSON());
|
||||
|
||||
if (!mCommand.IsEmpty()) {
|
||||
nsresult rv = json->DecodeToJSVal(mCommand, aCx, aCommand);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
*aCommand = JSVAL_VOID;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
64
dom/icc/src/StkCommandEvent.h
Normal file
64
dom/icc/src/StkCommandEvent.h
Normal file
@ -0,0 +1,64 @@
|
||||
/* 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_icc_stkcommandevent_h
|
||||
#define mozilla_dom_icc_stkcommandevent_h
|
||||
|
||||
#include "nsDOMEvent.h"
|
||||
#include "SimToolKit.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace icc {
|
||||
|
||||
class StkCommandEvent : public nsDOMEvent,
|
||||
public nsIDOMMozStkCommandEvent
|
||||
{
|
||||
nsString mCommand;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
NS_DECL_NSIDOMMOZSTKCOMMANDEVENT
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(StkCommandEvent, nsDOMEvent)
|
||||
|
||||
static already_AddRefed<StkCommandEvent>
|
||||
Create(nsAString& aMessage);
|
||||
|
||||
nsresult
|
||||
Dispatch(nsIDOMEventTarget* aTarget, const nsAString& aEventType)
|
||||
{
|
||||
NS_ASSERTION(aTarget, "Null pointer!");
|
||||
NS_ASSERTION(!aEventType.IsEmpty(), "Empty event type!");
|
||||
|
||||
nsresult rv = InitEvent(aEventType, false, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = SetTrusted(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIDOMEvent* thisEvent =
|
||||
static_cast<nsDOMEvent*>(const_cast<StkCommandEvent*>(this));
|
||||
|
||||
bool dummy;
|
||||
rv = aTarget->DispatchEvent(thisEvent, &dummy);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
StkCommandEvent()
|
||||
: nsDOMEvent(nullptr, nullptr)
|
||||
{ }
|
||||
|
||||
~StkCommandEvent()
|
||||
{ }
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // mozilla_dom_icc_stkcommandevent_h
|
@ -208,11 +208,6 @@ IDBFactory::Create(ContentParent* aContentParent,
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCString origin;
|
||||
nsresult rv =
|
||||
IndexedDatabaseManager::GetASCIIOriginFromWindow(nullptr, origin);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal =
|
||||
do_CreateInstance("@mozilla.org/nullprincipal;1");
|
||||
NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE);
|
||||
@ -232,7 +227,7 @@ IDBFactory::Create(ContentParent* aContentParent,
|
||||
NS_ASSERTION(xpc, "This should never be null!");
|
||||
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> globalHolder;
|
||||
rv = xpc->CreateSandbox(cx, principal, getter_AddRefs(globalHolder));
|
||||
nsresult rv = xpc->CreateSandbox(cx, principal, getter_AddRefs(globalHolder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSObject* global;
|
||||
|
@ -986,7 +986,7 @@ IndexedDatabaseManager::GetASCIIOriginFromWindow(nsPIDOMWindow* aWindow,
|
||||
aASCIIOrigin.AssignLiteral("chrome");
|
||||
}
|
||||
else {
|
||||
nsresult rv = nsContentUtils::GetASCIIOrigin(principal, aASCIIOrigin);
|
||||
nsresult rv = principal->GetExtendedOrigin(aASCIIOrigin);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
if (aASCIIOrigin.EqualsLiteral("null")) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user