mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge the last PGO-green inbound changeset to m-c.
This commit is contained in:
commit
a4657d67ce
@ -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;
|
||||
}
|
||||
|
||||
@ -738,14 +713,13 @@ ARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties* aAttribut
|
||||
{
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
||||
nsresult rv = HyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
|
||||
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">
|
||||
|
@ -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");
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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");
|
||||
|
||||
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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"
|
||||
|
||||
/*
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
@ -631,4 +626,4 @@ IDBFactory::Cmp(const jsval& aFirst,
|
||||
|
||||
*_retval = Key::CompareKeys(first, second);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -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")) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef mozilla_dom_indexeddb_serializationhelpers_h__
|
||||
#define mozilla_dom_indexeddb_serializationhelpers_h__
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
|
||||
#include "mozilla/dom/indexedDB/DatabaseInfo.h"
|
||||
#include "mozilla/dom/indexedDB/Key.h"
|
||||
|
@ -29,6 +29,7 @@ MOCHITEST_FILES = \
|
||||
test_autoIncrement_indexes.html \
|
||||
test_autoIncrement.html \
|
||||
test_bfcache.html \
|
||||
test_blob_archive.html \
|
||||
test_blob_simple.html \
|
||||
test_clear.html \
|
||||
test_complex_keyPaths.html \
|
||||
@ -101,6 +102,10 @@ MOCHITEST_FILES = \
|
||||
test_unique_index_update.html \
|
||||
third_party_iframe1.html \
|
||||
third_party_iframe2.html \
|
||||
test_app_isolation_inproc.html \
|
||||
test_app_isolation_oop.html \
|
||||
file_app_isolation.html \
|
||||
file_app_isolation.js \
|
||||
$(NULL)
|
||||
|
||||
# test_writer_starvation.html disabled for infinite loops, bug 595368
|
||||
|
88
dom/indexedDB/test/file_app_isolation.html
Normal file
88
dom/indexedDB/test/file_app_isolation.html
Normal file
@ -0,0 +1,88 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
foobar!
|
||||
</body>
|
||||
<script>
|
||||
var data = [
|
||||
{ id: "0", name: "foo" },
|
||||
];
|
||||
|
||||
var action = window.location.search.substring(1);
|
||||
var finished = false;
|
||||
var created = false; // We use that for 'read-no' action.
|
||||
|
||||
function finish(value) {
|
||||
value ? alert('success') : alert('failure');
|
||||
finished = true;
|
||||
}
|
||||
|
||||
var request = window.indexedDB.open('AppIsolationTest');
|
||||
|
||||
request.onupgradeneeded = function(event) {
|
||||
if (finished) {
|
||||
finish(false);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (action) {
|
||||
case 'read-no':
|
||||
created = true;
|
||||
break;
|
||||
case 'read-yes':
|
||||
finish(false);
|
||||
break;
|
||||
case 'write':
|
||||
created = true;
|
||||
|
||||
var db = event.target.result;
|
||||
|
||||
var objectStore = db.createObjectStore("test", { keyPath: "id" });
|
||||
for (var i in data) {
|
||||
objectStore.add(data[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
request.onsuccess = function(event) {
|
||||
if (finished) {
|
||||
finish(false);
|
||||
return;
|
||||
}
|
||||
|
||||
var db = event.target.result;
|
||||
|
||||
// Think about close the db!
|
||||
switch (action) {
|
||||
case 'read-no':
|
||||
db.close();
|
||||
|
||||
if (created) { // That means we have created it.
|
||||
indexedDB.deleteDatabase('AppIsolationTest').onsuccess = function() {
|
||||
finish(true);
|
||||
};
|
||||
} else {
|
||||
finish(false);
|
||||
}
|
||||
break;
|
||||
case 'read-yes':
|
||||
db.transaction("test").objectStore("test").get("0").onsuccess = function(event) {
|
||||
var name = event.target.result.name;
|
||||
db.close();
|
||||
|
||||
indexedDB.deleteDatabase('AppIsolationTest').onsuccess = function() {
|
||||
finish(name == 'foo');
|
||||
};
|
||||
};
|
||||
break;
|
||||
case 'write':
|
||||
db.close();
|
||||
|
||||
// Success only if the db was actually created.
|
||||
finish(created);
|
||||
break;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</html>
|
163
dom/indexedDB/test/file_app_isolation.js
Normal file
163
dom/indexedDB/test/file_app_isolation.js
Normal file
@ -0,0 +1,163 @@
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var fileTestOnCurrentOrigin = (location.protocol + '//' + location.host + location.pathname)
|
||||
.replace('test_', 'file_')
|
||||
.replace('_inproc', '').replace('_oop', '');
|
||||
|
||||
var previousPrefs = {
|
||||
mozBrowserFramesEnabled: undefined,
|
||||
oop_by_default: undefined,
|
||||
};
|
||||
|
||||
try {
|
||||
previousPrefs.mozBrowserFramesEnabled = SpecialPowers.getBoolPref('dom.mozBrowserFramesEnabled');
|
||||
} catch(e)
|
||||
{
|
||||
}
|
||||
|
||||
try {
|
||||
previousPrefs.oop_by_default = SpecialPowers.getBoolPref('dom.ipc.browser_frames.oop_by_default');
|
||||
} catch(e) {
|
||||
}
|
||||
|
||||
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
|
||||
SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", location.pathname.indexOf('_inproc') == -1);
|
||||
|
||||
SpecialPowers.addPermission("browser", true, window.document);
|
||||
|
||||
var gData = [
|
||||
// APP 1
|
||||
{
|
||||
app: 'http://example.org/manifest.webapp',
|
||||
action: 'read-no',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
{
|
||||
app: 'http://example.org/manifest.webapp',
|
||||
action: 'write',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
{
|
||||
app: 'http://example.org/manifest.webapp',
|
||||
action: 'read-yes',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
// APP 2
|
||||
{
|
||||
app: 'https://example.com/manifest.webapp',
|
||||
action: 'read-no',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
{
|
||||
app: 'https://example.com/manifest.webapp',
|
||||
action: 'write',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
{
|
||||
app: 'https://example.com/manifest.webapp',
|
||||
action: 'read-yes',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
// Browser
|
||||
{
|
||||
browser: true,
|
||||
action: 'read-no',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
{
|
||||
browser: true,
|
||||
action: 'write',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
{
|
||||
browser: true,
|
||||
action: 'read-yes',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
];
|
||||
|
||||
function runTest() {
|
||||
for (var i in gData) {
|
||||
var iframe = document.createElement('iframe');
|
||||
var data = gData[i];
|
||||
|
||||
if (data.app) {
|
||||
iframe.setAttribute('mozbrowser', '');
|
||||
iframe.setAttribute('mozapp', data.app);
|
||||
} else if (data.browser) {
|
||||
iframe.setAttribute('mozbrowser', '');
|
||||
}
|
||||
|
||||
if (data.app || data.browser) {
|
||||
iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
|
||||
is(e.detail.message, 'success', 'test number ' + i);
|
||||
|
||||
// document.getElementById('content').removeChild(iframe);
|
||||
|
||||
i++;
|
||||
if (i >= gData.length) {
|
||||
if (previousPrefs.mozBrowserFramesEnabled !== undefined) {
|
||||
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', previousPrefs.mozBrowserFramesEnabled);
|
||||
}
|
||||
if (previousPrefs.oop_by_default !== undefined) {
|
||||
SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", previousPrefs.oop_by_default);
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("browser", window.document);
|
||||
|
||||
indexedDB.deleteDatabase('AppIsolationTest').onsuccess = function() {
|
||||
SimpleTest.finish();
|
||||
};
|
||||
} else {
|
||||
gTestRunner.next();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
iframe.src = data.src + '?' + data.action;
|
||||
|
||||
document.getElementById('content').appendChild(iframe);
|
||||
|
||||
yield;
|
||||
}
|
||||
}
|
||||
|
||||
var gTestRunner = runTest();
|
||||
|
||||
function startTest() {
|
||||
var request = window.indexedDB.open('AppIsolationTest');
|
||||
var created = false;
|
||||
|
||||
request.onupgradeneeded = function(event) {
|
||||
created = true;
|
||||
var db = event.target.result;
|
||||
var data = [
|
||||
{ id: "0", name: "foo" },
|
||||
];
|
||||
var objectStore = db.createObjectStore("test", { keyPath: "id" });
|
||||
for (var i in data) {
|
||||
objectStore.add(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
request.onsuccess = function(event) {
|
||||
var db = event.target.result;
|
||||
is(created, true, "we should have created the db");
|
||||
|
||||
db.transaction("test").objectStore("test").get("0").onsuccess = function(event) {
|
||||
is(event.target.result.name, 'foo', 'data have been written');
|
||||
db.close();
|
||||
|
||||
gTestRunner.next();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// test_ipc.html executes all the tests in this directory in content process.
|
||||
// It will fail on this one for the moment.
|
||||
if (!SpecialPowers.isMainProcess()) {
|
||||
todo(false, "We should make this work on content process");
|
||||
SimpleTest.finish();
|
||||
} else {
|
||||
startTest();
|
||||
}
|
@ -41,8 +41,9 @@ function clearAllDatabases(callback) {
|
||||
idbManager.clearDatabasesForURI(uri);
|
||||
idbManager.getUsageForURI(uri, function(uri, usage, fileUsage) {
|
||||
if (usage) {
|
||||
throw new Error("getUsageForURI returned non-zero usage after " +
|
||||
"clearing all databases!");
|
||||
ok(false,
|
||||
"getUsageForURI returned non-zero usage after clearing all " +
|
||||
"databases!");
|
||||
}
|
||||
runCallback();
|
||||
});
|
||||
|
21
dom/indexedDB/test/test_app_isolation_inproc.html
Normal file
21
dom/indexedDB/test/test_app_isolation_inproc.html
Normal file
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=756645
|
||||
-->
|
||||
<head>
|
||||
<title>Test for IndexedDB app isolation (unique process)</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=756645">Mozilla Bug 756645</a>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript;version=1.7" src="file_app_isolation.js">
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
21
dom/indexedDB/test/test_app_isolation_oop.html
Normal file
21
dom/indexedDB/test/test_app_isolation_oop.html
Normal file
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=756645
|
||||
-->
|
||||
<head>
|
||||
<title>Test for IndexedDB app isolation (unique process)</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=756645">Mozilla Bug 756645</a>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript;version=1.7" src="file_app_isolation.js">
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
127
dom/indexedDB/test/test_blob_archive.html
Normal file
127
dom/indexedDB/test/test_blob_archive.html
Normal file
@ -0,0 +1,127 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Indexed Database Property Test</title>
|
||||
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
<script type="text/javascript;version=1.7">
|
||||
|
||||
function testSteps()
|
||||
{
|
||||
const BLOB_DATA =
|
||||
"504B03040A00000000002E6BF14000000000000000000000000005001C00746573742F" +
|
||||
"555409000337CA055039CA055075780B000104E803000004E8030000504B0304140000" +
|
||||
"0008002D6BF1401780E15015000000580200000A001C00746573742F612E7478745554" +
|
||||
"09000336CA05503ACA055075780B000104E803000004E8030000CB48CDC9C95728CF2F" +
|
||||
"CA49E1CA18658FB2A9C40600504B03040A00000000002F88EC40662E84701000000010" +
|
||||
"0000000A001C00746573742F622E74787455540900035A65FF4F42C5055075780B0001" +
|
||||
"04E803000004E803000068656C6C6F20776F726C642C2032210A504B01021E030A0000" +
|
||||
"0000002E6BF140000000000000000000000000050018000000000000001000FD410000" +
|
||||
"0000746573742F555405000337CA055075780B000104E803000004E8030000504B0102" +
|
||||
"1E031400000008002D6BF1401780E15015000000580200000A00180000000000010000" +
|
||||
"00B4813F000000746573742F612E747874555405000336CA055075780B000104E80300" +
|
||||
"0004E8030000504B01021E030A00000000002F88EC40662E847010000000100000000A" +
|
||||
"0018000000000001000000B48198000000746573742F622E74787455540500035A65FF" +
|
||||
"4F75780B000104E803000004E8030000504B05060000000003000300EB000000EC0000" +
|
||||
"000000";
|
||||
|
||||
const TEST_FILE_1 = "test/a.txt";
|
||||
const TEST_FILE_2 = "test/b.txt";
|
||||
|
||||
let TEST_FILE_1_CONTENTS = "";
|
||||
for (let i = 0; i < 50; i++) {
|
||||
TEST_FILE_1_CONTENTS += "hello world\n";
|
||||
}
|
||||
const TEST_FILE_2_CONTENTS = "hello world, 2!\n";
|
||||
|
||||
let binaryData = new Uint8Array(BLOB_DATA.length / 2);
|
||||
for (let i = 0, len = BLOB_DATA.length / 2; i < len; i++) {
|
||||
let hex = BLOB_DATA[i * 2] + BLOB_DATA[i * 2 + 1];
|
||||
binaryData[i] = parseInt(hex, 16);
|
||||
}
|
||||
|
||||
let request = indexedDB.open(window.location.pathname, 1);
|
||||
request.onerror = errorHandler;
|
||||
request.onupgradeneeded = grabEventAndContinueHandler;
|
||||
request.onsuccess = unexpectedSuccessHandler;
|
||||
let event = yield;
|
||||
|
||||
let db = event.target.result;
|
||||
db.onerror = errorHandler;
|
||||
|
||||
let objectStore = db.createObjectStore("foo", { autoIncrement: true });
|
||||
let index = objectStore.createIndex("foo", "index");
|
||||
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
event = yield;
|
||||
|
||||
let data = new Blob([binaryData]);
|
||||
|
||||
objectStore = db.transaction("foo", "readwrite").objectStore("foo");
|
||||
objectStore.add(data).onsuccess = grabEventAndContinueHandler;
|
||||
event = yield;
|
||||
|
||||
let key = event.target.result;
|
||||
|
||||
objectStore = db.transaction("foo").objectStore("foo");
|
||||
objectStore.get(key).onsuccess = grabEventAndContinueHandler;
|
||||
event = yield;
|
||||
|
||||
let archiveReader = new ArchiveReader(event.target.result);
|
||||
ok(archiveReader, "Got an ArchiveReader");
|
||||
|
||||
request = archiveReader.getFilenames();
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
request.onerror = errorHandler;
|
||||
event = yield;
|
||||
|
||||
is(event.target.result.length, 2, "Got 2 archive items");
|
||||
is(event.target.result[0], TEST_FILE_1,
|
||||
"First file is '" + TEST_FILE_1 + "'");
|
||||
is(event.target.result[1], TEST_FILE_2,
|
||||
"Second file is '" + TEST_FILE_2 + "'");
|
||||
|
||||
request = archiveReader.getFile(TEST_FILE_1);
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
request.onerror = errorHandler;
|
||||
event = yield;
|
||||
|
||||
let fileReader = new FileReader();
|
||||
fileReader.readAsText(event.target.result);
|
||||
fileReader.onload = grabEventAndContinueHandler;
|
||||
fileReader.onerror = errorHandler;
|
||||
event = yield;
|
||||
|
||||
// Don't use is() because it prints out 100 lines of text...
|
||||
ok(event.target.result == TEST_FILE_1_CONTENTS, "Correct text");
|
||||
|
||||
request = archiveReader.getFile(TEST_FILE_2);
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
request.onerror = errorHandler;
|
||||
event = yield;
|
||||
|
||||
fileReader = new FileReader();
|
||||
fileReader.readAsText(event.target.result);
|
||||
fileReader.onload = grabEventAndContinueHandler;
|
||||
fileReader.onerror = errorHandler;
|
||||
event = yield;
|
||||
|
||||
// Don't use is() because it prints out a newline...
|
||||
ok(event.target.result == TEST_FILE_2_CONTENTS, "Correct text");
|
||||
|
||||
finishTest();
|
||||
yield;
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript;version=1.7" src="helpers.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="runTest();"></body>
|
||||
|
||||
</html>
|
@ -53,6 +53,24 @@
|
||||
|
||||
is(event.target.result, BLOB_DATA.join(""), "Correct text");
|
||||
|
||||
info("Trying blob url");
|
||||
|
||||
objectStore = db.transaction("foo").objectStore("foo");
|
||||
objectStore.get(key).onsuccess = grabEventAndContinueHandler;
|
||||
event = yield;
|
||||
|
||||
let blobURL = URL.createObjectURL(event.target.result.blob);
|
||||
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", blobURL);
|
||||
xhr.onload = grabEventAndContinueHandler;
|
||||
xhr.send();
|
||||
yield;
|
||||
|
||||
URL.revokeObjectURL(blobURL);
|
||||
|
||||
is(xhr.responseText, BLOB_DATA.join(""), "Correct responseText");
|
||||
|
||||
objectStore = db.transaction("foo").objectStore("foo");
|
||||
objectStore.mozGetAll().onsuccess = grabEventAndContinueHandler;
|
||||
event = yield;
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef mozilla_dom_permission_message_utils_h__
|
||||
#define mozilla_dom_permission_message_utils_h__
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPrincipal.h"
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef TABMESSAGE_UTILS_H
|
||||
#define TABMESSAGE_UTILS_H
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
|
@ -172,6 +172,11 @@ TabParent::AnswerCreateWindow(PBrowserParent** retval)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only non-app, non-browser processes may call CreateWindow.
|
||||
if (GetApp() || IsBrowserElement()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get a new rendering area from the browserDOMWin. We don't want
|
||||
// to be starting any loads here, so get it with a null URI.
|
||||
nsCOMPtr<nsIFrameLoaderOwner> frameLoaderOwner;
|
||||
|
@ -7,7 +7,7 @@
|
||||
#ifndef DOM_PLUGINS_PLUGINMESSAGEUTILS_H
|
||||
#define DOM_PLUGINS_PLUGINMESSAGEUTILS_H
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "base/message_loop.h"
|
||||
|
||||
#include "mozilla/ipc/RPCChannel.h"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef dom_src_geolocation_IPC_serialiser
|
||||
#define dom_src_geolocation_IPC_serialiser
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "nsGeoPosition.h"
|
||||
#include "nsIDOMGeoPosition.h"
|
||||
|
||||
|
@ -1724,7 +1724,6 @@ let RILNetworkInterface = {
|
||||
NETWORK_STATE_UNKNOWN: Ci.nsINetworkInterface.NETWORK_STATE_UNKNOWN,
|
||||
NETWORK_STATE_CONNECTING: Ci.nsINetworkInterface.CONNECTING,
|
||||
NETWORK_STATE_CONNECTED: Ci.nsINetworkInterface.CONNECTED,
|
||||
NETWORK_STATE_SUSPENDED: Ci.nsINetworkInterface.SUSPENDED,
|
||||
NETWORK_STATE_DISCONNECTING: Ci.nsINetworkInterface.DISCONNECTING,
|
||||
NETWORK_STATE_DISCONNECTED: Ci.nsINetworkInterface.DISCONNECTED,
|
||||
|
||||
@ -1829,9 +1828,7 @@ let RILNetworkInterface = {
|
||||
},
|
||||
|
||||
connect: function connect(options) {
|
||||
if (this.connecting ||
|
||||
this.state == RIL.GECKO_NETWORK_STATE_CONNECTED ||
|
||||
this.state == RIL.GECKO_NETWORK_STATE_SUSPENDED) {
|
||||
if (this.connecting || this.connected) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -7,15 +7,14 @@
|
||||
/**
|
||||
* Information about networks that is exposed to network manager API consumers.
|
||||
*/
|
||||
[scriptable, uuid(49cc227c-3fe7-40a2-bdb5-55e9af797fde)]
|
||||
[scriptable, uuid(463ed2f3-1739-41bc-a967-1e816764f915)]
|
||||
interface nsINetworkInterface : nsISupports
|
||||
{
|
||||
const long NETWORK_STATE_UNKNOWN = -1;
|
||||
const long NETWORK_STATE_CONNECTING = 0;
|
||||
const long NETWORK_STATE_CONNECTED = 1;
|
||||
const long NETWORK_STATE_SUSPENDED = 2;
|
||||
const long NETWORK_STATE_DISCONNECTING = 3;
|
||||
const long NETWORK_STATE_DISCONNECTED = 4;
|
||||
const long NETWORK_STATE_DISCONNECTING = 2;
|
||||
const long NETWORK_STATE_DISCONNECTED = 3;
|
||||
|
||||
/**
|
||||
* Current network state, one of the NETWORK_STATE_* constants.
|
||||
|
@ -1416,9 +1416,8 @@ const DATACALL_FAIL_ERROR_UNSPECIFIED = 0xffff;
|
||||
const GECKO_NETWORK_STATE_UNKNOWN = -1;
|
||||
const GECKO_NETWORK_STATE_CONNECTING = 0;
|
||||
const GECKO_NETWORK_STATE_CONNECTED = 1;
|
||||
const GECKO_NETWORK_STATE_SUSPENDED = 2;
|
||||
const GECKO_NETWORK_STATE_DISCONNECTING = 3;
|
||||
const GECKO_NETWORK_STATE_DISCONNECTED = 4;
|
||||
const GECKO_NETWORK_STATE_DISCONNECTING = 2;
|
||||
const GECKO_NETWORK_STATE_DISCONNECTED = 3;
|
||||
|
||||
// Used for QUERY_AVAILABLE_NETWORKS status of "unknown"
|
||||
const GECKO_QAN_STATE_UNKNOWN = null;
|
||||
|
@ -54,7 +54,6 @@ const PDU_HEX_OCTET_SIZE = 4;
|
||||
const DEFAULT_EMERGENCY_NUMBERS = ["112", "911"];
|
||||
|
||||
let RILQUIRKS_CALLSTATE_EXTRA_UINT32 = libcutils.property_get("ro.moz.ril.callstate_extra_int");
|
||||
let RILQUIRKS_DATACALLSTATE_DOWN_IS_UP = libcutils.property_get("ro.moz.ril.callstate_down_is_up");
|
||||
// This may change at runtime since in RIL v6 and later, we get the version
|
||||
// number via the UNSOLICITED_RIL_CONNECTED parcel.
|
||||
let RILQUIRKS_V5_LEGACY = libcutils.property_get("ro.moz.ril.v5_legacy");
|
||||
@ -2495,11 +2494,6 @@ let RIL = {
|
||||
datacall.state = GECKO_NETWORK_STATE_DISCONNECTED;
|
||||
break;
|
||||
case DATACALL_ACTIVE_DOWN:
|
||||
datacall.state = GECKO_NETWORK_STATE_SUSPENDED;
|
||||
if (RILQUIRKS_DATACALLSTATE_DOWN_IS_UP) {
|
||||
datacall.state = GECKO_NETWORK_STATE_CONNECTED;
|
||||
}
|
||||
break;
|
||||
case DATACALL_ACTIVE_UP:
|
||||
datacall.state = GECKO_NETWORK_STATE_CONNECTED;
|
||||
break;
|
||||
|
@ -55,7 +55,7 @@ interface CanvasRenderingContext2D {
|
||||
attribute any fillStyle; // (default black)
|
||||
CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1);
|
||||
CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);
|
||||
CanvasPattern createPattern((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, DOMString? repetition);
|
||||
CanvasPattern createPattern((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, [TreatNullAs=EmptyString] DOMString repetition);
|
||||
|
||||
// shadows
|
||||
[Infallible]
|
||||
|
@ -1344,7 +1344,6 @@ let WifiNetworkInterface = {
|
||||
NETWORK_STATE_UNKNOWN: Ci.nsINetworkInterface.NETWORK_STATE_UNKNOWN,
|
||||
NETWORK_STATE_CONNECTING: Ci.nsINetworkInterface.CONNECTING,
|
||||
NETWORK_STATE_CONNECTED: Ci.nsINetworkInterface.CONNECTED,
|
||||
NETWORK_STATE_SUSPENDED: Ci.nsINetworkInterface.SUSPENDED,
|
||||
NETWORK_STATE_DISCONNECTING: Ci.nsINetworkInterface.DISCONNECTING,
|
||||
NETWORK_STATE_DISCONNECTED: Ci.nsINetworkInterface.DISCONNECTED,
|
||||
|
||||
|
@ -53,14 +53,8 @@ using mozilla::Preferences;
|
||||
// consistency.
|
||||
#define WORKER_STACK_SIZE 256 * sizeof(size_t) * 1024
|
||||
|
||||
// The stack limit the JS engine will check.
|
||||
#ifdef MOZ_ASAN
|
||||
// For ASan, we need more stack space, so we use all that is available
|
||||
#define WORKER_CONTEXT_NATIVE_STACK_LIMIT WORKER_STACK_SIZE
|
||||
#else
|
||||
// Half the size of the actual C stack, to be safe.
|
||||
#define WORKER_CONTEXT_NATIVE_STACK_LIMIT 128 * sizeof(size_t) * 1024
|
||||
#endif
|
||||
|
||||
// The maximum number of threads to use for workers, overridable via pref.
|
||||
#define MAX_WORKERS_PER_DOMAIN 10
|
||||
|
@ -94,7 +94,6 @@ nsWebBrowserContentPolicy::ShouldProcess(uint32_t contentType,
|
||||
}
|
||||
|
||||
nsIDocShell *shell = NS_CP_GetDocShellFromContext(requestingContext);
|
||||
bool allowed;
|
||||
if (shell && (!shell->PluginsAllowedInCurrentDoc())) {
|
||||
*shouldProcess = nsIContentPolicy::REJECT_TYPE;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ LIBRARY_NAME = mozcairo
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
ifdef GNU_CC
|
||||
OS_CFLAGS := $(filter-out -pedantic,$(OX_CFLAGS))
|
||||
OS_CXXFLAGS := $(filter-out -pedantic,$(OS_CXXFLAGS))
|
||||
ifeq ($(OS_TARGET),Android)
|
||||
MODULE_OPTIMIZE_FLAGS = -O2
|
||||
|
@ -8,7 +8,7 @@
|
||||
#ifndef IPC_ShadowLayerUtils_h
|
||||
#define IPC_ShadowLayerUtils_h
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "GLContext.h"
|
||||
#include "mozilla/WidgetUtils.h"
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <unistd.h>
|
||||
#include <ui/GraphicBuffer.h>
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "mozilla/layers/PGrallocBufferChild.h"
|
||||
#include "mozilla/layers/PGrallocBufferParent.h"
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <X11/extensions/Xrender.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
|
||||
#define MOZ_HAVE_SURFACEDESCRIPTORX11
|
||||
#define MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
|
||||
|
@ -50,7 +50,7 @@ typedef Observer<SensorAccuracy> ISensorAccuracyObserver;
|
||||
}
|
||||
}
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
|
||||
namespace IPC {
|
||||
/**
|
||||
|
@ -2,7 +2,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 "IPC/IPCMessageUtils.h";
|
||||
include "ipc/IPCMessageUtils.h";
|
||||
|
||||
using mozilla::void_t;
|
||||
|
||||
|
@ -17,9 +17,9 @@ FORCE_STATIC_LIB = 1
|
||||
LIBXUL_LIBRARY = 1
|
||||
EXPORT_LIBRARY = 1
|
||||
|
||||
EXPORTS_NAMESPACES = IPC mozilla/ipc
|
||||
EXPORTS_NAMESPACES = ipc mozilla/ipc
|
||||
|
||||
EXPORTS_IPC = IPCMessageUtils.h
|
||||
EXPORTS_ipc = IPCMessageUtils.h
|
||||
|
||||
EXPORTS_mozilla/ipc = \
|
||||
AsyncChannel.h \
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "nscore.h"
|
||||
#include "nsDebug.h"
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "mozilla/ipc/SharedMemory.h"
|
||||
|
||||
/**
|
||||
|
@ -8,7 +8,7 @@
|
||||
#ifndef mozilla_ipc_Transport_posix_h
|
||||
#define mozilla_ipc_Transport_posix_h 1
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -2,7 +2,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 "IPC/IPCMessageUtils.h";
|
||||
include "ipc/IPCMessageUtils.h";
|
||||
|
||||
using mozilla::void_t;
|
||||
|
||||
|
@ -59,7 +59,7 @@ Includes = (
|
||||
'prtime.h',
|
||||
'nscore.h',
|
||||
'IPCMessageStart.h',
|
||||
'IPC/IPCMessageUtils.h',
|
||||
'ipc/IPCMessageUtils.h',
|
||||
'nsAutoPtr.h',
|
||||
'nsStringGlue.h',
|
||||
'nsTArray.h',
|
||||
|
@ -335,7 +335,7 @@ frontend::CompileFunctionBody(JSContext *cx, HandleFunction fun, CompileOptions
|
||||
return false;
|
||||
|
||||
if (!NameFunctions(cx, pn))
|
||||
return NULL;
|
||||
return false;
|
||||
|
||||
if (fn->pn_body) {
|
||||
JS_ASSERT(fn->pn_body->isKind(PNK_ARGSBODY));
|
||||
|
@ -514,13 +514,6 @@ js::GCThingIsMarkedGray(void *thing)
|
||||
return reinterpret_cast<gc::Cell *>(thing)->isMarked(gc::GRAY);
|
||||
}
|
||||
|
||||
JS_FRIEND_API(JSCompartment*)
|
||||
js::GetGCThingCompartment(void *thing)
|
||||
{
|
||||
JS_ASSERT(thing);
|
||||
return reinterpret_cast<gc::Cell *>(thing)->compartment();
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js::VisitGrayWrapperTargets(JSCompartment *comp, GCThingCallback *callback, void *closure)
|
||||
{
|
||||
|
@ -277,9 +277,6 @@ TraceWeakMaps(WeakMapTracer *trc);
|
||||
extern JS_FRIEND_API(bool)
|
||||
GCThingIsMarkedGray(void *thing);
|
||||
|
||||
extern JS_FRIEND_API(JSCompartment*)
|
||||
GetGCThingCompartment(void *thing);
|
||||
|
||||
typedef void
|
||||
(GCThingCallback)(void *closure, void *gcthing);
|
||||
|
||||
|
@ -1198,7 +1198,17 @@ MaybeVerifyBarriers(JSContext *cx, bool always = false)
|
||||
} /* namespace gc */
|
||||
|
||||
static inline JSCompartment *
|
||||
GetObjectCompartment(JSObject *obj) { return reinterpret_cast<js::gc::Cell *>(obj)->compartment(); }
|
||||
GetGCThingCompartment(void *thing)
|
||||
{
|
||||
JS_ASSERT(thing);
|
||||
return reinterpret_cast<gc::Cell *>(thing)->compartment();
|
||||
}
|
||||
|
||||
static inline JSCompartment *
|
||||
GetObjectCompartment(JSObject *obj)
|
||||
{
|
||||
return GetGCThingCompartment(obj);
|
||||
}
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
|
@ -538,17 +538,16 @@ js::Int32ToString(JSContext *cx, int32_t si)
|
||||
if (!str)
|
||||
return NULL;
|
||||
|
||||
jschar *storage = str->inlineStorageBeforeInit();
|
||||
RangedPtr<jschar> end(storage + JSShortString::MAX_SHORT_LENGTH,
|
||||
storage, JSShortString::MAX_SHORT_LENGTH + 1);
|
||||
jschar buffer[JSShortString::MAX_SHORT_LENGTH + 1];
|
||||
RangedPtr<jschar> end(buffer + JSShortString::MAX_SHORT_LENGTH,
|
||||
buffer, JSShortString::MAX_SHORT_LENGTH + 1);
|
||||
*end = '\0';
|
||||
|
||||
RangedPtr<jschar> start = BackfillIndexInCharBuffer(ui, end);
|
||||
|
||||
if (si < 0)
|
||||
*--start = '-';
|
||||
|
||||
str->initAtOffsetInBuffer(start.get(), end - start);
|
||||
jschar *dst = str->init(end - start);
|
||||
PodCopy(dst, start.get(), end - start + 1);
|
||||
|
||||
c->dtoaCache.cache(10, si, str);
|
||||
return str;
|
||||
@ -1303,14 +1302,14 @@ IndexToString(JSContext *cx, uint32_t index)
|
||||
if (!str)
|
||||
return NULL;
|
||||
|
||||
jschar *storage = str->inlineStorageBeforeInit();
|
||||
size_t length = JSShortString::MAX_SHORT_LENGTH;
|
||||
const RangedPtr<jschar> end(storage + length, storage, length + 1);
|
||||
jschar buffer[JSShortString::MAX_SHORT_LENGTH + 1];
|
||||
RangedPtr<jschar> end(buffer + JSShortString::MAX_SHORT_LENGTH,
|
||||
buffer, JSShortString::MAX_SHORT_LENGTH + 1);
|
||||
*end = '\0';
|
||||
|
||||
RangedPtr<jschar> start = BackfillIndexInCharBuffer(index, end);
|
||||
|
||||
str->initAtOffsetInBuffer(start.get(), end - start);
|
||||
jschar *dst = str->init(end - start);
|
||||
PodCopy(dst, start.get(), end - start + 1);
|
||||
|
||||
c->dtoaCache.cache(10, index, str);
|
||||
return str;
|
||||
|
@ -1139,7 +1139,7 @@ ContextStack::saveFrameChain()
|
||||
{
|
||||
bool pushedSeg;
|
||||
if (!ensureOnTop(cx_, REPORT_ERROR, 0, CANT_EXTEND, &pushedSeg))
|
||||
return NULL;
|
||||
return false;
|
||||
|
||||
JS_ASSERT(pushedSeg);
|
||||
JS_ASSERT(!hasfp());
|
||||
|
@ -267,15 +267,6 @@ JSShortString::new_(JSContext *cx)
|
||||
return js_NewGCShortString(cx);
|
||||
}
|
||||
|
||||
JS_ALWAYS_INLINE void
|
||||
JSShortString::initAtOffsetInBuffer(const jschar *chars, size_t length)
|
||||
{
|
||||
JS_ASSERT(lengthFits(length + (chars - d.inlineStorage)));
|
||||
JS_ASSERT(chars >= d.inlineStorage && chars < d.inlineStorage + MAX_SHORT_LENGTH);
|
||||
d.lengthAndFlags = buildLengthAndFlags(length, FIXED_FLAGS);
|
||||
d.u1.chars = chars;
|
||||
}
|
||||
|
||||
JS_ALWAYS_INLINE void
|
||||
JSExternalString::init(const jschar *chars, size_t length, const JSStringFinalizer *fin)
|
||||
{
|
||||
@ -430,10 +421,6 @@ JSFlatString::finalize(js::FreeOp *fop)
|
||||
{
|
||||
JS_ASSERT(!isShort());
|
||||
|
||||
/*
|
||||
* This check depends on the fact that 'chars' is only initialized to the
|
||||
* beginning of inlineStorage. E.g., this is not the case for short strings.
|
||||
*/
|
||||
if (chars() != d.inlineStorage)
|
||||
fop->free_(const_cast<jschar *>(chars()));
|
||||
}
|
||||
@ -441,17 +428,20 @@ JSFlatString::finalize(js::FreeOp *fop)
|
||||
inline void
|
||||
JSShortString::finalize(js::FreeOp *fop)
|
||||
{
|
||||
JS_ASSERT(JSString::isShort());
|
||||
JS_ASSERT(isShort());
|
||||
|
||||
if (chars() != d.inlineStorage)
|
||||
fop->free_(const_cast<jschar *>(chars()));
|
||||
}
|
||||
|
||||
inline void
|
||||
JSAtom::finalize(js::FreeOp *fop)
|
||||
{
|
||||
JS_ASSERT(JSString::isAtom());
|
||||
if (getAllocKind() == js::gc::FINALIZE_STRING)
|
||||
JSFlatString::finalize(fop);
|
||||
else
|
||||
JS_ASSERT(getAllocKind() == js::gc::FINALIZE_SHORT_STRING);
|
||||
JS_ASSERT(JSString::isFlat());
|
||||
|
||||
if (chars() != d.inlineStorage)
|
||||
fop->free_(const_cast<jschar *>(chars()));
|
||||
}
|
||||
|
||||
inline void
|
||||
|
@ -17,6 +17,7 @@
|
||||
using namespace mozilla;
|
||||
using namespace js;
|
||||
|
||||
#ifdef DEBUG
|
||||
bool
|
||||
JSString::isShort() const
|
||||
{
|
||||
@ -24,18 +25,7 @@ JSString::isShort() const
|
||||
JS_ASSERT_IF(is_short, isFixed());
|
||||
return is_short;
|
||||
}
|
||||
|
||||
bool
|
||||
JSString::isFixed() const
|
||||
{
|
||||
return isFlat() && !isExtensible();
|
||||
}
|
||||
|
||||
bool
|
||||
JSString::isInline() const
|
||||
{
|
||||
return isFixed() && (d.u1.chars == d.inlineStorage || isShort());
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
JSString::isExternal() const
|
||||
|
@ -186,7 +186,7 @@ class JSString : public js::gc::Cell
|
||||
* Undepended 0011 0011
|
||||
* Extensible 0010 0010
|
||||
* Fixed 0100 isFlat && !isExtensible
|
||||
* Inline 0100 isFixed && (u1.chars == inlineStorage || isShort || isInt32)
|
||||
* Inline 0100 isFixed && (u1.chars == inlineStorage) || isInt32)
|
||||
* Short 0100 header in FINALIZE_SHORT_STRING arena
|
||||
* External 0100 header in FINALIZE_EXTERNAL_STRING arena
|
||||
* Int32 0110 x110 (NYI, Bug 654190)
|
||||
@ -330,10 +330,10 @@ class JSString : public js::gc::Cell
|
||||
return *(JSExtensibleString *)this;
|
||||
}
|
||||
|
||||
/* For hot code, prefer other type queries. */
|
||||
bool isShort() const;
|
||||
bool isFixed() const;
|
||||
bool isInline() const;
|
||||
JS_ALWAYS_INLINE
|
||||
bool isFixed() const {
|
||||
return isFlat() && !isExtensible();
|
||||
}
|
||||
|
||||
JS_ALWAYS_INLINE
|
||||
JSFixedString &asFixed() const {
|
||||
@ -341,6 +341,12 @@ class JSString : public js::gc::Cell
|
||||
return *(JSFixedString *)this;
|
||||
}
|
||||
|
||||
JS_ALWAYS_INLINE
|
||||
bool isInline() const {
|
||||
return isFixed() && (d.u1.chars == d.inlineStorage);
|
||||
}
|
||||
|
||||
/* For hot code, prefer other type queries. */
|
||||
bool isExternal() const;
|
||||
|
||||
JS_ALWAYS_INLINE
|
||||
@ -402,6 +408,7 @@ class JSString : public js::gc::Cell
|
||||
static inline js::ThingRootKind rootKind() { return js::THING_ROOT_STRING; }
|
||||
|
||||
#ifdef DEBUG
|
||||
bool isShort() const;
|
||||
void dump();
|
||||
bool equals(const char *s);
|
||||
#endif
|
||||
@ -593,12 +600,6 @@ class JSShortString : public JSInlineString
|
||||
public:
|
||||
static inline JSShortString *new_(JSContext *cx);
|
||||
|
||||
jschar *inlineStorageBeforeInit() {
|
||||
return d.inlineStorage;
|
||||
}
|
||||
|
||||
inline void initAtOffsetInBuffer(const jschar *chars, size_t length);
|
||||
|
||||
static const size_t MAX_SHORT_LENGTH = JSString::NUM_INLINE_CHARS +
|
||||
INLINE_EXTENSION_CHARS
|
||||
-1 /* null terminator */;
|
||||
@ -607,7 +608,7 @@ class JSShortString : public JSInlineString
|
||||
return length <= MAX_SHORT_LENGTH;
|
||||
}
|
||||
|
||||
/* Only called by the GC for strings with the FINALIZE_EXTERNAL_STRING kind. */
|
||||
/* Only called by the GC for strings with the FINALIZE_SHORT_STRING kind. */
|
||||
|
||||
JS_ALWAYS_INLINE void finalize(js::FreeOp *fop);
|
||||
};
|
||||
|
@ -938,17 +938,6 @@ xpc_qsJsvalToWcharStr(JSContext *cx, jsval v, jsval *pval, const PRUnichar **pst
|
||||
|
||||
namespace xpc {
|
||||
|
||||
bool
|
||||
StringToJsval(JSContext *cx, nsAString &str, JS::Value *rval)
|
||||
{
|
||||
// From the T_DOMSTRING case in XPCConvert::NativeData2JS.
|
||||
if (str.IsVoid()) {
|
||||
*rval = JSVAL_NULL;
|
||||
return true;
|
||||
}
|
||||
return NonVoidStringToJsval(cx, str, rval);
|
||||
}
|
||||
|
||||
bool
|
||||
NonVoidStringToJsval(JSContext *cx, nsAString &str, JS::Value *rval)
|
||||
{
|
||||
|
@ -21,10 +21,23 @@
|
||||
#include "xpcprivate.h"
|
||||
#include "nsStringBuffer.h"
|
||||
|
||||
// One-slot cache, because it turns out it's common for web pages to
|
||||
// get the same string a few times in a row. We get about a 40% cache
|
||||
// hit rate on this cache last it was measured. We'd get about 70%
|
||||
// hit rate with a hashtable with removal on finalization, but that
|
||||
// would take a lot more machinery.
|
||||
static nsStringBuffer* sCachedBuffer = nullptr;
|
||||
static JSString* sCachedString = nullptr;
|
||||
|
||||
static void
|
||||
FinalizeDOMString(const JSStringFinalizer *fin, jschar *chars)
|
||||
{
|
||||
nsStringBuffer::FromData(chars)->Release();
|
||||
nsStringBuffer* buf = nsStringBuffer::FromData(chars);
|
||||
if (buf == sCachedBuffer) {
|
||||
sCachedBuffer = nullptr;
|
||||
// No need to clear sCachedString
|
||||
}
|
||||
buf->Release();
|
||||
}
|
||||
|
||||
static const JSStringFinalizer sDOMStringFinalizer = { FinalizeDOMString };
|
||||
@ -47,6 +60,12 @@ XPCStringConvert::ReadableToJSVal(JSContext *cx,
|
||||
|
||||
nsStringBuffer *buf = nsStringBuffer::FromString(readable);
|
||||
if (buf) {
|
||||
if (buf == sCachedBuffer &&
|
||||
js::GetGCThingCompartment(sCachedString) == js::GetContextCompartment(cx)) {
|
||||
// We're done. Just return our existing string.
|
||||
return JS::StringValue(sCachedString);
|
||||
}
|
||||
|
||||
// yay, we can share the string's buffer!
|
||||
|
||||
str = JS_NewExternalString(cx,
|
||||
@ -55,6 +74,8 @@ XPCStringConvert::ReadableToJSVal(JSContext *cx,
|
||||
|
||||
if (str) {
|
||||
*sharedBuffer = buf;
|
||||
sCachedString = str;
|
||||
sCachedBuffer = buf;
|
||||
}
|
||||
} else {
|
||||
// blech, have to copy.
|
||||
|
@ -241,8 +241,16 @@ bool Base64Decode(JSContext *cx, JS::Value val, JS::Value *out);
|
||||
* Note, the ownership of the string buffer may be moved from str to rval.
|
||||
* If that happens, str will point to an empty string after this call.
|
||||
*/
|
||||
bool StringToJsval(JSContext *cx, nsAString &str, JS::Value *rval);
|
||||
bool NonVoidStringToJsval(JSContext *cx, nsAString &str, JS::Value *rval);
|
||||
inline bool StringToJsval(JSContext *cx, nsAString &str, JS::Value *rval)
|
||||
{
|
||||
// From the T_DOMSTRING case in XPCConvert::NativeData2JS.
|
||||
if (str.IsVoid()) {
|
||||
*rval = JSVAL_NULL;
|
||||
return true;
|
||||
}
|
||||
return NonVoidStringToJsval(cx, str, rval);
|
||||
}
|
||||
|
||||
nsIPrincipal *GetCompartmentPrincipal(JSCompartment *compartment);
|
||||
|
||||
|
@ -1206,7 +1206,7 @@ PresShell::CreatePreferenceStyleSheet()
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
NS_ASSERTION(!mPrefStyleSheet, "prefStyleSheet already exists");
|
||||
mPrefStyleSheet = new nsCSSStyleSheet();
|
||||
mPrefStyleSheet = new nsCSSStyleSheet(CORS_NONE);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), "about:PreferenceStyleSheet", nullptr);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -841,8 +841,8 @@ const nsIFrame::ChildListID nsIFrame::kNoReflowPrincipalList;
|
||||
nsIFrame::GetUsedMargin() const
|
||||
{
|
||||
nsMargin margin(0, 0, 0, 0);
|
||||
if ((mState & NS_FRAME_FIRST_REFLOW) &&
|
||||
!(mState & NS_FRAME_IN_REFLOW) ||
|
||||
if (((mState & NS_FRAME_FIRST_REFLOW) &&
|
||||
!(mState & NS_FRAME_IN_REFLOW)) ||
|
||||
(mState & NS_FRAME_IS_SVG_TEXT))
|
||||
return margin;
|
||||
|
||||
@ -864,8 +864,8 @@ nsIFrame::GetUsedMargin() const
|
||||
nsIFrame::GetUsedBorder() const
|
||||
{
|
||||
nsMargin border(0, 0, 0, 0);
|
||||
if ((mState & NS_FRAME_FIRST_REFLOW) &&
|
||||
!(mState & NS_FRAME_IN_REFLOW) ||
|
||||
if (((mState & NS_FRAME_FIRST_REFLOW) &&
|
||||
!(mState & NS_FRAME_IN_REFLOW)) ||
|
||||
(mState & NS_FRAME_IS_SVG_TEXT))
|
||||
return border;
|
||||
|
||||
@ -900,8 +900,8 @@ nsIFrame::GetUsedBorder() const
|
||||
nsIFrame::GetUsedPadding() const
|
||||
{
|
||||
nsMargin padding(0, 0, 0, 0);
|
||||
if ((mState & NS_FRAME_FIRST_REFLOW) &&
|
||||
!(mState & NS_FRAME_IN_REFLOW) ||
|
||||
if (((mState & NS_FRAME_FIRST_REFLOW) &&
|
||||
!(mState & NS_FRAME_IN_REFLOW)) ||
|
||||
(mState & NS_FRAME_IS_SVG_TEXT))
|
||||
return padding;
|
||||
|
||||
|
21
layout/reftests/forms/input-percentage-padding-ref.html
Normal file
21
layout/reftests/forms/input-percentage-padding-ref.html
Normal file
@ -0,0 +1,21 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
.container {
|
||||
width: 400px;
|
||||
background: #ddd;
|
||||
}
|
||||
.text-input {
|
||||
width: 200px; /* 50% */
|
||||
padding: 40px; /* 10% */
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<input type="text" class="text-input" />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
21
layout/reftests/forms/input-percentage-padding.html
Normal file
21
layout/reftests/forms/input-percentage-padding.html
Normal file
@ -0,0 +1,21 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
.container {
|
||||
width: 400px;
|
||||
background: #ddd;
|
||||
}
|
||||
.text-input {
|
||||
width: 50%; /* 200px */
|
||||
padding: 10%; /* 40px */
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<input type="text" class="text-input" />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -81,3 +81,5 @@ include output/reftest.list
|
||||
|
||||
# progress element
|
||||
include progress/reftest.list
|
||||
|
||||
== input-percentage-padding.html input-percentage-padding-ref.html
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user