Merge mozilla-central into services-central

This commit is contained in:
Gregory Szorc 2012-06-25 13:40:04 -07:00
commit b686be9543
3745 changed files with 798254 additions and 7906 deletions

View File

@ -48,33 +48,6 @@ public:
virtual Accessible* AddNativeRootAccessible(void* aAtkAccessible) = 0;
virtual void RemoveNativeRootAccessible(Accessible* aRootAccessible) = 0;
/**
* Notification used to update the accessible tree when new content is
* inserted.
*/
virtual void ContentRangeInserted(nsIPresShell* aPresShell,
nsIContent* aContainer,
nsIContent* aStartChild,
nsIContent* aEndChild) = 0;
/**
* Notification used to update the accessible tree when content is removed.
*/
virtual void ContentRemoved(nsIPresShell* aPresShell, nsIContent* aContainer,
nsIContent* aChild) = 0;
/**
* Notify accessibility that anchor jump has been accomplished to the given
* target. Used by layout.
*/
virtual void NotifyOfAnchorJumpTo(nsIContent *aTarget) = 0;
/**
* Notify the accessibility service that the given presshell is
* being destroyed.
*/
virtual void PresShellDestroyed(nsIPresShell *aPresShell) = 0;
/**
* Fire accessible event of the given type for the given target.
*

View File

@ -280,6 +280,9 @@ LogShellLoadType(nsIDocShell* aDocShell)
case LOAD_PUSHSTATE:
printf("load pushstate; ");
break;
case LOAD_REPLACE_BYPASS_CACHE:
printf("replace bypass cache; ");
break;
case LOAD_ERROR_PAGE:
printf("error page;");
break;

View File

@ -122,16 +122,25 @@ public:
already_AddRefed<Accessible>
CreateOuterDocAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
/**
* Adds/remove ATK root accessible for gtk+ native window to/from children
* of the application accessible.
*/
virtual Accessible* AddNativeRootAccessible(void* aAtkAccessible);
virtual void RemoveNativeRootAccessible(Accessible* aRootAccessible);
virtual void ContentRangeInserted(nsIPresShell* aPresShell,
nsIContent* aContainer,
nsIContent* aStartChild,
nsIContent* aEndChild);
/**
* Notification used to update the accessible tree when new content is
* inserted.
*/
void ContentRangeInserted(nsIPresShell* aPresShell, nsIContent* aContainer,
nsIContent* aStartChild, nsIContent* aEndChild);
virtual void ContentRemoved(nsIPresShell* aPresShell, nsIContent* aContainer,
nsIContent* aChild);
/**
* Notification used to update the accessible tree when content is removed.
*/
void ContentRemoved(nsIPresShell* aPresShell, nsIContent* aContainer,
nsIContent* aChild);
virtual void UpdateText(nsIPresShell* aPresShell, nsIContent* aContent);
@ -153,9 +162,17 @@ public:
*/
void UpdateImageMap(nsImageFrame* aImageFrame);
virtual void NotifyOfAnchorJumpTo(nsIContent *aTarget);
/**
* Notify accessibility that anchor jump has been accomplished to the given
* target. Used by layout.
*/
void NotifyOfAnchorJumpTo(nsIContent *aTarget);
virtual void PresShellDestroyed(nsIPresShell* aPresShell);
/**
* Notify the accessibility service that the given presshell is
* being destroyed.
*/
void PresShellDestroyed(nsIPresShell* aPresShell);
/**
* Notify that presshell is activated.

View File

@ -90,81 +90,6 @@ ARIAGridAccessible::CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex)
return GetCellInRowAt(row, aColumnIndex);
}
NS_IMETHODIMP
ARIAGridAccessible::GetColumnIndexAt(PRInt32 aCellIndex,
PRInt32* aColumnIndex)
{
NS_ENSURE_ARG_POINTER(aColumnIndex);
*aColumnIndex = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
NS_ENSURE_ARG(aCellIndex >= 0);
PRInt32 rowCount = 0;
GetRowCount(&rowCount);
PRInt32 colsCount = 0;
GetColumnCount(&colsCount);
NS_ENSURE_ARG(aCellIndex < rowCount * colsCount);
*aColumnIndex = aCellIndex % colsCount;
return NS_OK;
}
NS_IMETHODIMP
ARIAGridAccessible::GetRowIndexAt(PRInt32 aCellIndex, PRInt32* aRowIndex)
{
NS_ENSURE_ARG_POINTER(aRowIndex);
*aRowIndex = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
NS_ENSURE_ARG(aCellIndex >= 0);
PRInt32 rowCount = 0;
GetRowCount(&rowCount);
PRInt32 colsCount = 0;
GetColumnCount(&colsCount);
NS_ENSURE_ARG(aCellIndex < rowCount * colsCount);
*aRowIndex = aCellIndex / colsCount;
return NS_OK;
}
NS_IMETHODIMP
ARIAGridAccessible::GetRowAndColumnIndicesAt(PRInt32 aCellIndex,
PRInt32* aRowIndex,
PRInt32* aColumnIndex)
{
NS_ENSURE_ARG_POINTER(aRowIndex);
*aRowIndex = -1;
NS_ENSURE_ARG_POINTER(aColumnIndex);
*aColumnIndex = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
NS_ENSURE_ARG(aCellIndex >= 0);
PRInt32 rowCount = 0;
GetRowCount(&rowCount);
PRInt32 colsCount = 0;
GetColumnCount(&colsCount);
NS_ENSURE_ARG(aCellIndex < rowCount * colsCount);
*aColumnIndex = aCellIndex % colsCount;
*aRowIndex = aCellIndex / colsCount;
return NS_OK;
}
bool
ARIAGridAccessible::IsColSelected(PRUint32 aColIdx)
{
@ -248,9 +173,35 @@ ARIAGridAccessible::SelectedCellCount()
PRUint32
ARIAGridAccessible::SelectedColCount()
{
PRUint32 colCount = 0;
GetSelectedColumnsArray(&colCount);
return colCount;
PRUint32 colCount = ColCount();
if (!colCount)
return 0;
AccIterator rowIter(this, filters::GetRow);
Accessible* row = rowIter.Next();
if (!row)
return 0;
nsTArray<bool> isColSelArray(colCount);
isColSelArray.AppendElements(colCount);
memset(isColSelArray.Elements(), true, colCount * sizeof(bool));
PRUint32 selColCount = colCount;
do {
if (nsAccUtils::IsARIASelected(row))
continue;
AccIterator cellIter(row, filters::GetCell);
Accessible* cell = nsnull;
for (PRUint32 colIdx = 0;
(cell = cellIter.Next()) && colIdx < colCount; colIdx++)
if (isColSelArray[colIdx] && !nsAccUtils::IsARIASelected(cell)) {
isColSelArray[colIdx] = false;
selColCount--;
}
} while ((row = rowIter.Next()));
return selColCount;
}
PRUint32
@ -325,92 +276,72 @@ ARIAGridAccessible::GetSelectedCells(nsIArray** aCells)
return NS_OK;
}
NS_IMETHODIMP
ARIAGridAccessible::GetSelectedCellIndices(PRUint32* aCellsCount,
PRInt32** aCells)
void
ARIAGridAccessible::SelectedCellIndices(nsTArray<PRUint32>* aCells)
{
NS_ENSURE_ARG_POINTER(aCellsCount);
*aCellsCount = 0;
NS_ENSURE_ARG_POINTER(aCells);
*aCells = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
PRInt32 rowCount = 0;
GetRowCount(&rowCount);
PRInt32 colCount = 0;
GetColumnCount(&colCount);
nsTArray<PRInt32> selCells(rowCount * colCount);
PRUint32 rowCount = RowCount(), colCount = ColCount();
AccIterator rowIter(this, filters::GetRow);
Accessible* row = nsnull;
for (PRInt32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
for (PRUint32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
if (nsAccUtils::IsARIASelected(row)) {
for (PRInt32 colIdx = 0; colIdx < colCount; colIdx++)
selCells.AppendElement(rowIdx * colCount + colIdx);
for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++)
aCells->AppendElement(rowIdx * colCount + colIdx);
continue;
}
AccIterator cellIter(row, filters::GetCell);
Accessible* cell = nsnull;
for (PRInt32 colIdx = 0; (cell = cellIter.Next()); colIdx++) {
for (PRUint32 colIdx = 0; (cell = cellIter.Next()); colIdx++) {
if (nsAccUtils::IsARIASelected(cell))
selCells.AppendElement(rowIdx * colCount + colIdx);
aCells->AppendElement(rowIdx * colCount + colIdx);
}
}
PRUint32 selCellsCount = selCells.Length();
if (!selCellsCount)
return NS_OK;
*aCells = static_cast<PRInt32*>(
nsMemory::Clone(selCells.Elements(), selCellsCount * sizeof(PRInt32)));
NS_ENSURE_TRUE(*aCells, NS_ERROR_OUT_OF_MEMORY);
*aCellsCount = selCellsCount;
return NS_OK;
}
NS_IMETHODIMP
ARIAGridAccessible::GetSelectedColumnIndices(PRUint32* aColumnCount,
PRInt32** aColumns)
void
ARIAGridAccessible::SelectedColIndices(nsTArray<PRUint32>* aCols)
{
NS_ENSURE_ARG_POINTER(aColumns);
return GetSelectedColumnsArray(aColumnCount, aColumns);
}
NS_IMETHODIMP
ARIAGridAccessible::GetSelectedRowIndices(PRUint32* aRowCount,
PRInt32** aRows)
{
NS_ENSURE_ARG_POINTER(aRowCount);
*aRowCount = 0;
NS_ENSURE_ARG_POINTER(aRows);
*aRows = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
PRInt32 rowCount = 0;
GetRowCount(&rowCount);
if (!rowCount)
return NS_OK;
nsTArray<PRInt32> selRows(rowCount);
PRUint32 colCount = ColCount();
if (!colCount)
return;
AccIterator rowIter(this, filters::GetRow);
Accessible* row = rowIter.Next();
if (!row)
return;
nsTArray<bool> isColSelArray(colCount);
isColSelArray.AppendElements(colCount);
memset(isColSelArray.Elements(), true, colCount * sizeof(bool));
do {
if (nsAccUtils::IsARIASelected(row))
continue;
AccIterator cellIter(row, filters::GetCell);
Accessible* cell = nsnull;
for (PRUint32 colIdx = 0;
(cell = cellIter.Next()) && colIdx < colCount; colIdx++)
if (isColSelArray[colIdx] && !nsAccUtils::IsARIASelected(cell)) {
isColSelArray[colIdx] = false;
}
} while ((row = rowIter.Next()));
for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++)
if (isColSelArray[colIdx])
aCols->AppendElement(colIdx);
}
void
ARIAGridAccessible::SelectedRowIndices(nsTArray<PRUint32>* aRows)
{
AccIterator rowIter(this, filters::GetRow);
Accessible* row = nsnull;
for (PRInt32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
for (PRUint32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
if (nsAccUtils::IsARIASelected(row)) {
selRows.AppendElement(rowIdx);
aRows->AppendElement(rowIdx);
continue;
}
@ -428,19 +359,8 @@ ARIAGridAccessible::GetSelectedRowIndices(PRUint32* aRowCount,
} while ((cell = cellIter.Next()));
if (isRowSelected)
selRows.AppendElement(rowIdx);
aRows->AppendElement(rowIdx);
}
PRUint32 selrowCount = selRows.Length();
if (!selrowCount)
return NS_OK;
*aRows = static_cast<PRInt32*>(
nsMemory::Clone(selRows.Elements(), selrowCount * sizeof(PRInt32)));
NS_ENSURE_TRUE(*aRows, NS_ERROR_OUT_OF_MEMORY);
*aRowCount = selrowCount;
return NS_OK;
}
void
@ -615,74 +535,6 @@ ARIAGridAccessible::SetARIASelected(Accessible* aAccessible,
return NS_OK;
}
nsresult
ARIAGridAccessible::GetSelectedColumnsArray(PRUint32* aColumnCount,
PRInt32** aColumns)
{
NS_ENSURE_ARG_POINTER(aColumnCount);
*aColumnCount = 0;
if (aColumns)
*aColumns = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
AccIterator rowIter(this, filters::GetRow);
Accessible* row = rowIter.Next();
if (!row)
return NS_OK;
PRInt32 colCount = 0;
GetColumnCount(&colCount);
if (!colCount)
return NS_OK;
PRInt32 selColCount = colCount;
nsTArray<bool> isColSelArray(selColCount);
isColSelArray.AppendElements(selColCount);
for (PRInt32 i = 0; i < selColCount; i++)
isColSelArray[i] = true;
do {
if (nsAccUtils::IsARIASelected(row))
continue;
PRInt32 colIdx = 0;
AccIterator cellIter(row, filters::GetCell);
Accessible* cell = nsnull;
for (colIdx = 0; (cell = cellIter.Next()); colIdx++) {
if (isColSelArray.SafeElementAt(colIdx, false) &&
!nsAccUtils::IsARIASelected(cell)) {
isColSelArray[colIdx] = false;
selColCount--;
}
}
} while ((row = rowIter.Next()));
if (!selColCount)
return NS_OK;
if (!aColumns) {
*aColumnCount = selColCount;
return NS_OK;
}
*aColumns = static_cast<PRInt32*>(
nsMemory::Alloc(selColCount * sizeof(PRInt32)));
NS_ENSURE_TRUE(*aColumns, NS_ERROR_OUT_OF_MEMORY);
*aColumnCount = selColCount;
for (PRInt32 colIdx = 0, idx = 0; colIdx < colCount; colIdx++) {
if (isColSelArray[colIdx])
(*aColumns)[idx++] = colIdx;
}
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// ARIAGridCellAccessible
////////////////////////////////////////////////////////////////////////////////

View File

@ -48,6 +48,9 @@ public:
virtual PRUint32 SelectedCellCount();
virtual PRUint32 SelectedColCount();
virtual PRUint32 SelectedRowCount();
virtual void SelectedCellIndices(nsTArray<PRUint32>* aCells);
virtual void SelectedColIndices(nsTArray<PRUint32>* aCols);
virtual void SelectedRowIndices(nsTArray<PRUint32>* aRows);
virtual void SelectCol(PRUint32 aColIdx);
virtual void SelectRow(PRUint32 aRowIdx);
virtual void UnselectCol(PRUint32 aColIdx);
@ -84,12 +87,6 @@ protected:
*/
nsresult SetARIASelected(Accessible* aAccessible, bool aIsSelected,
bool aNotify = true);
/**
* Helper method for GetSelectedColumnCount and GetSelectedColumns.
*/
nsresult GetSelectedColumnsArray(PRUint32 *acolumnCount,
PRInt32 **aColumns = nsnull);
};

View File

@ -57,18 +57,25 @@ public:
/**
* Return the column index of the cell with the given index.
*/
virtual PRInt32 ColIndexAt(PRUint32 aCellIdx) { return -1; }
virtual PRInt32 ColIndexAt(PRUint32 aCellIdx)
{ return aCellIdx % ColCount(); }
/**
* Return the row index of the cell with the given index.
*/
virtual PRInt32 RowIndexAt(PRUint32 aCellIdx) { return -1; }
virtual PRInt32 RowIndexAt(PRUint32 aCellIdx)
{ return aCellIdx / ColCount(); }
/**
* Get the row and column indices for the cell at the given index.
*/
virtual void RowAndColIndicesAt(PRUint32 aCellIdx, PRInt32* aRowIdx,
PRInt32* aColIdx) {}
PRInt32* aColIdx)
{
PRUint32 colCount = ColCount();
*aRowIdx = aCellIdx / colCount;
*aColIdx = aCellIdx % colCount;
}
/**
* Return the number of columns occupied by the cell at the given row and
@ -129,15 +136,20 @@ public:
*/
virtual void SelectedCells(nsTArray<Accessible*>* aCells) {}
/**
* Get the set of selected cell indices.
*/
virtual void SelectedCellIndices(nsTArray<PRUint32>* aCells) = 0;
/**
* Get the set of selected column indices.
*/
virtual void SelectedColIndices(nsTArray<PRUint32>* aCols) {}
virtual void SelectedColIndices(nsTArray<PRUint32>* aCols) = 0;
/**
* Get the set of selected row indices.
*/
virtual void SelectedRowIndices(nsTArray<PRUint32>* aRows) {}
virtual void SelectedRowIndices(nsTArray<PRUint32>* aRows) = 0;
/**
* Select the given column unselecting any other selected columns.

View File

@ -660,158 +660,52 @@ HTMLTableAccessible::GetSelectedCells(nsIArray** aCells)
return NS_OK;
}
NS_IMETHODIMP
HTMLTableAccessible::GetSelectedCellIndices(PRUint32* aNumCells,
PRInt32** aCells)
void
HTMLTableAccessible::SelectedCellIndices(nsTArray<PRUint32>* aCells)
{
NS_ENSURE_ARG_POINTER(aNumCells);
*aNumCells = 0;
NS_ENSURE_ARG_POINTER(aCells);
*aCells = nsnull;
PRInt32 rowCount = 0;
nsresult rv = GetRowCount(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 columnCount = 0;
rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
nsITableLayout *tableLayout = GetTableLayout();
NS_ENSURE_STATE(tableLayout);
if (!tableLayout)
return;
PRUint32 rowCount = RowCount(), colCount = ColCount();
nsCOMPtr<nsIDOMElement> domElement;
PRInt32 startRowIndex = 0, startColIndex = 0,
rowSpan, colSpan, actualRowSpan, actualColSpan;
bool isSelected = false;
PRInt32 cellsCount = columnCount * rowCount;
nsAutoArrayPtr<bool> states(new bool[cellsCount]);
NS_ENSURE_TRUE(states, NS_ERROR_OUT_OF_MEMORY);
for (PRUint32 rowIdx = 0; rowIdx < rowCount; rowIdx++) {
for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++) {
nsresult rv = tableLayout->GetCellDataAt(rowIdx, colIdx,
*getter_AddRefs(domElement),
startRowIndex, startColIndex,
rowSpan, colSpan,
actualRowSpan, actualColSpan,
isSelected);
PRInt32 rowIndex, index;
for (rowIndex = 0, index = 0; rowIndex < rowCount; rowIndex++) {
PRInt32 columnIndex;
for (columnIndex = 0; columnIndex < columnCount; columnIndex++, index++) {
rv = tableLayout->GetCellDataAt(rowIndex, columnIndex,
*getter_AddRefs(domElement),
startRowIndex, startColIndex,
rowSpan, colSpan,
actualRowSpan, actualColSpan,
isSelected);
if (NS_SUCCEEDED(rv) && startRowIndex == rowIndex &&
startColIndex == columnIndex && isSelected) {
states[index] = true;
(*aNumCells)++;
} else {
states[index] = false;
}
if (NS_SUCCEEDED(rv) && startRowIndex == rowIdx &&
startColIndex == colIdx && isSelected)
aCells->AppendElement(CellIndexAt(rowIdx, colIdx));
}
}
PRInt32 *cellsArray =
static_cast<PRInt32*>(nsMemory::Alloc((*aNumCells) * sizeof(PRInt32)));
NS_ENSURE_TRUE(cellsArray, NS_ERROR_OUT_OF_MEMORY);
PRInt32 curr = 0;
for (rowIndex = 0, index = 0; rowIndex < rowCount; rowIndex++) {
PRInt32 columnIndex;
for (columnIndex = 0; columnIndex < columnCount; columnIndex++, index++) {
if (states[index]) {
PRInt32 cellIndex = -1;
GetCellIndexAt(rowIndex, columnIndex, &cellIndex);
cellsArray[curr++] = cellIndex;
}
}
}
*aCells = cellsArray;
return NS_OK;
}
NS_IMETHODIMP
HTMLTableAccessible::GetSelectedColumnIndices(PRUint32* aNumColumns,
PRInt32** aColumns)
void
HTMLTableAccessible::SelectedColIndices(nsTArray<PRUint32>* aCols)
{
nsresult rv = NS_OK;
PRInt32 columnCount;
rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
bool *states = new bool[columnCount];
NS_ENSURE_TRUE(states, NS_ERROR_OUT_OF_MEMORY);
*aNumColumns = 0;
PRInt32 index;
for (index = 0; index < columnCount; index++) {
rv = IsColumnSelected(index, &states[index]);
NS_ENSURE_SUCCESS(rv, rv);
if (states[index]) {
(*aNumColumns)++;
}
}
PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumColumns) * sizeof(PRInt32));
if (!outArray) {
delete []states;
return NS_ERROR_OUT_OF_MEMORY;
}
PRInt32 curr = 0;
for (index = 0; index < columnCount; index++) {
if (states[index]) {
outArray[curr++] = index;
}
}
delete []states;
*aColumns = outArray;
return rv;
PRUint32 colCount = ColCount();
for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++)
if (IsColSelected(colIdx))
aCols->AppendElement(colIdx);
}
NS_IMETHODIMP
HTMLTableAccessible::GetSelectedRowIndices(PRUint32* aNumRows,
PRInt32** aRows)
void
HTMLTableAccessible::SelectedRowIndices(nsTArray<PRUint32>* aRows)
{
nsresult rv = NS_OK;
PRInt32 rowCount;
rv = GetRowCount(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
bool *states = new bool[rowCount];
NS_ENSURE_TRUE(states, NS_ERROR_OUT_OF_MEMORY);
*aNumRows = 0;
PRInt32 index;
for (index = 0; index < rowCount; index++) {
rv = IsRowSelected(index, &states[index]);
NS_ENSURE_SUCCESS(rv, rv);
if (states[index]) {
(*aNumRows)++;
}
}
PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumRows) * sizeof(PRInt32));
if (!outArray) {
delete []states;
return NS_ERROR_OUT_OF_MEMORY;
}
PRInt32 curr = 0;
for (index = 0; index < rowCount; index++) {
if (states[index]) {
outArray[curr++] = index;
}
}
delete []states;
*aRows = outArray;
return rv;
PRUint32 rowCount = RowCount();
for (PRUint32 rowIdx = 0; rowIdx < rowCount; rowIdx++)
if (IsRowSelected(rowIdx))
aRows->AppendElement(rowIdx);
}
Accessible*
@ -843,60 +737,38 @@ HTMLTableAccessible::CellIndexAt(PRUint32 aRowIdx, PRUint32 aColIdx)
return index;
}
NS_IMETHODIMP
HTMLTableAccessible::GetColumnIndexAt(PRInt32 aIndex, PRInt32* aColumn)
PRInt32
HTMLTableAccessible::ColIndexAt(PRUint32 aCellIdx)
{
NS_ENSURE_ARG_POINTER(aColumn);
if (IsDefunct())
return NS_ERROR_FAILURE;
nsITableLayout *tableLayout = GetTableLayout();
NS_ENSURE_STATE(tableLayout);
PRInt32 row;
nsresult rv = tableLayout->GetRowAndColumnByIndex(aIndex, &row, aColumn);
NS_ENSURE_SUCCESS(rv, rv);
return (row == -1 || *aColumn == -1) ? NS_ERROR_INVALID_ARG : NS_OK;
}
NS_IMETHODIMP
HTMLTableAccessible::GetRowIndexAt(PRInt32 aIndex, PRInt32* aRow)
{
NS_ENSURE_ARG_POINTER(aRow);
if (IsDefunct())
return NS_ERROR_FAILURE;
nsITableLayout *tableLayout = GetTableLayout();
NS_ENSURE_STATE(tableLayout);
PRInt32 column;
nsresult rv = tableLayout->GetRowAndColumnByIndex(aIndex, aRow, &column);
NS_ENSURE_SUCCESS(rv, rv);
return (*aRow == -1 || column == -1) ? NS_ERROR_INVALID_ARG : NS_OK;
}
NS_IMETHODIMP
HTMLTableAccessible::GetRowAndColumnIndicesAt(PRInt32 aIndex,
PRInt32* aRowIdx,
PRInt32* aColumnIdx)
{
NS_ENSURE_ARG_POINTER(aRowIdx);
*aRowIdx = -1;
NS_ENSURE_ARG_POINTER(aColumnIdx);
*aColumnIdx = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsITableLayout* tableLayout = GetTableLayout();
if (tableLayout)
tableLayout->GetRowAndColumnByIndex(aIndex, aRowIdx, aColumnIdx);
if (!tableLayout)
return -1;
return (*aRowIdx == -1 || *aColumnIdx == -1) ? NS_ERROR_INVALID_ARG : NS_OK;
PRInt32 rowIdx = -1, colIdx = -1;
tableLayout->GetRowAndColumnByIndex(aCellIdx, &rowIdx, &colIdx);
return colIdx;
}
PRInt32
HTMLTableAccessible::RowIndexAt(PRUint32 aCellIdx)
{
nsITableLayout* tableLayout = GetTableLayout();
if (!tableLayout)
return -1;
PRInt32 rowIdx = -1, colIdx = -1;
tableLayout->GetRowAndColumnByIndex(aCellIdx, &rowIdx, &colIdx);
return rowIdx;
}
void
HTMLTableAccessible::RowAndColIndicesAt(PRUint32 aCellIdx, PRInt32* aRowIdx,
PRInt32* aColIdx)
{
nsITableLayout* tableLayout = GetTableLayout();
if (tableLayout)
tableLayout->GetRowAndColumnByIndex(aCellIdx, aRowIdx, aColIdx);
}
PRUint32

View File

@ -104,6 +104,10 @@ public:
virtual PRUint32 RowCount();
virtual Accessible* CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex);
virtual PRInt32 CellIndexAt(PRUint32 aRowIdx, PRUint32 aColIdx);
virtual PRInt32 ColIndexAt(PRUint32 aCellIdx);
virtual PRInt32 RowIndexAt(PRUint32 aCellIdx);
virtual void RowAndColIndicesAt(PRUint32 aCellIdx, PRInt32* aRowIdx,
PRInt32* aColIdx);
virtual PRUint32 ColExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx);
virtual PRUint32 RowExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx);
virtual bool IsColSelected(PRUint32 aColIdx);
@ -112,6 +116,9 @@ public:
virtual PRUint32 SelectedCellCount();
virtual PRUint32 SelectedColCount();
virtual PRUint32 SelectedRowCount();
virtual void SelectedCellIndices(nsTArray<PRUint32>* aCells);
virtual void SelectedColIndices(nsTArray<PRUint32>* aCols);
virtual void SelectedRowIndices(nsTArray<PRUint32>* aRows);
virtual void SelectCol(PRUint32 aColIdx);
virtual void SelectRow(PRUint32 aRowIdx);
virtual void UnselectCol(PRUint32 aColIdx);

View File

@ -9,6 +9,8 @@
#include "Accessible.h"
#include "TableAccessible.h"
static const PRUint32 XPC_TABLE_DEFAULT_SIZE = 40;
nsresult
xpcAccessibleTable::GetCaption(nsIAccessible** aCaption)
{
@ -241,6 +243,138 @@ xpcAccessibleTable::GetSelectedRowCount(PRUint32* aSelectedRowCount)
return NS_OK;
}
nsresult
xpcAccessibleTable::GetSelectedCellIndices(PRUint32* aCellsArraySize,
PRInt32** aCellsArray)
{
NS_ENSURE_ARG_POINTER(aCellsArraySize);
*aCellsArraySize = 0;
NS_ENSURE_ARG_POINTER(aCellsArray);
*aCellsArray = 0;
if (!mTable)
return NS_ERROR_FAILURE;
nsAutoTArray<PRUint32, XPC_TABLE_DEFAULT_SIZE> cellsArray;
mTable->SelectedCellIndices(&cellsArray);
*aCellsArraySize = cellsArray.Length();
*aCellsArray = static_cast<PRInt32*>
(moz_xmalloc(*aCellsArraySize * sizeof(PRInt32)));
memcpy(*aCellsArray, cellsArray.Elements(),
*aCellsArraySize * sizeof(PRInt32));
return NS_OK;
}
nsresult
xpcAccessibleTable::GetSelectedColumnIndices(PRUint32* aColsArraySize,
PRInt32** aColsArray)
{
NS_ENSURE_ARG_POINTER(aColsArraySize);
*aColsArraySize = 0;
NS_ENSURE_ARG_POINTER(aColsArray);
*aColsArray = 0;
if (!mTable)
return NS_ERROR_FAILURE;
nsAutoTArray<PRUint32, XPC_TABLE_DEFAULT_SIZE> colsArray;
mTable->SelectedColIndices(&colsArray);
*aColsArraySize = colsArray.Length();
*aColsArray = static_cast<PRInt32*>
(moz_xmalloc(*aColsArraySize * sizeof(PRInt32)));
memcpy(*aColsArray, colsArray.Elements(),
*aColsArraySize * sizeof(PRInt32));
return NS_OK;
}
nsresult
xpcAccessibleTable::GetSelectedRowIndices(PRUint32* aRowsArraySize,
PRInt32** aRowsArray)
{
NS_ENSURE_ARG_POINTER(aRowsArraySize);
*aRowsArraySize = 0;
NS_ENSURE_ARG_POINTER(aRowsArray);
*aRowsArray = 0;
if (!mTable)
return NS_ERROR_FAILURE;
nsAutoTArray<PRUint32, XPC_TABLE_DEFAULT_SIZE> rowsArray;
mTable->SelectedRowIndices(&rowsArray);
*aRowsArraySize = rowsArray.Length();
*aRowsArray = static_cast<PRInt32*>
(moz_xmalloc(*aRowsArraySize * sizeof(PRInt32)));
memcpy(*aRowsArray, rowsArray.Elements(),
*aRowsArraySize * sizeof(PRInt32));
return NS_OK;
}
nsresult
xpcAccessibleTable::GetColumnIndexAt(PRInt32 aCellIdx, PRInt32* aColIdx)
{
NS_ENSURE_ARG_POINTER(aColIdx);
*aColIdx = -1;
if (!mTable)
return NS_ERROR_FAILURE;
if (aCellIdx < 0
|| static_cast<PRUint32>(aCellIdx)
>= mTable->RowCount() * mTable->ColCount())
return NS_ERROR_INVALID_ARG;
*aColIdx = mTable->ColIndexAt(aCellIdx);
return NS_OK;
}
nsresult
xpcAccessibleTable::GetRowIndexAt(PRInt32 aCellIdx, PRInt32* aRowIdx)
{
NS_ENSURE_ARG_POINTER(aRowIdx);
*aRowIdx = -1;
if (!mTable)
return NS_ERROR_FAILURE;
if (aCellIdx < 0
|| static_cast<PRUint32>(aCellIdx)
>= mTable->RowCount() * mTable->ColCount())
return NS_ERROR_INVALID_ARG;
*aRowIdx = mTable->RowIndexAt(aCellIdx);
return NS_OK;
}
nsresult
xpcAccessibleTable::GetRowAndColumnIndicesAt(PRInt32 aCellIdx, PRInt32* aRowIdx,
PRInt32* aColIdx)
{
NS_ENSURE_ARG_POINTER(aRowIdx);
*aRowIdx = -1;
NS_ENSURE_ARG_POINTER(aColIdx);
*aColIdx = -1;
if (!mTable)
return NS_ERROR_FAILURE;
if (aCellIdx < 0
|| static_cast<PRUint32>(aCellIdx)
>= mTable->RowCount() * mTable->ColCount())
return NS_ERROR_INVALID_ARG;
mTable->RowAndColIndicesAt(aCellIdx, aRowIdx, aColIdx);
return NS_OK;
}
nsresult
xpcAccessibleTable::GetSummary(nsAString& aSummary)
{
@ -298,7 +432,7 @@ xpcAccessibleTable::UnselectColumn(PRInt32 aColIdx)
if (!mTable)
return NS_ERROR_FAILURE;
if (aColIdx < 0 || aColIdx >= mTable->ColCount())
if (aColIdx < 0 || static_cast<PRUint32>(aColIdx) >= mTable->ColCount())
return NS_ERROR_INVALID_ARG;
mTable->UnselectCol(aColIdx);
@ -311,7 +445,7 @@ xpcAccessibleTable::UnselectRow(PRInt32 aRowIdx)
if (!mTable)
return NS_ERROR_FAILURE;
if (aRowIdx < 0 || aRowIdx >= mTable->RowCount())
if (aRowIdx < 0 || static_cast<PRUint32>(aRowIdx) >= mTable->RowCount())
return NS_ERROR_INVALID_ARG;
mTable->UnselectRow(aRowIdx);

View File

@ -30,6 +30,10 @@ public:
nsIAccessible** aCell);
nsresult GetCellIndexAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
PRInt32* aCellIndex);
nsresult GetColumnIndexAt(PRInt32 aCellIndex, PRInt32* aColumnIndex);
nsresult GetRowIndexAt(PRInt32 aCellIndex, PRInt32* aRowIndex);
nsresult GetRowAndColumnIndicesAt(PRInt32 aCellIndex, PRInt32* aRowIndex,
PRInt32* aColumnIndex);
nsresult GetColumnExtentAt(PRInt32 row, PRInt32 column,
PRInt32* aColumnExtent);
nsresult GetRowExtentAt(PRInt32 row, PRInt32 column,
@ -42,6 +46,12 @@ public:
nsresult GetSelectedCellCount(PRUint32* aSelectedCellCount);
nsresult GetSelectedColumnCount(PRUint32* aSelectedColumnCount);
nsresult GetSelectedRowCount(PRUint32* aSelectedRowCount);
nsresult GetSelectedCellIndices(PRUint32* aCellsArraySize,
PRInt32** aCellsArray);
nsresult GetSelectedColumnIndices(PRUint32* aColsArraySize,
PRInt32** aColsArray);
nsresult GetSelectedRowIndices(PRUint32* aRowsArraySize,
PRInt32** aRowsArray);
nsresult SelectColumn(PRInt32 aColIdx);
nsresult SelectRow(PRInt32 aRowIdx);
nsresult UnselectColumn(PRInt32 aColIdx);
@ -65,9 +75,12 @@ protected:
{ return xpcAccessibleTable::GetCellAt(rowIndex, columnIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetCellIndexAt(PRInt32 rowIndex, PRInt32 columnIndex, PRInt32 *_retval NS_OUTPARAM) \
{ return xpcAccessibleTable::GetCellIndexAt(rowIndex, columnIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetColumnIndexAt(PRInt32 cellIndex, PRInt32 *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetRowIndexAt(PRInt32 cellIndex, PRInt32 *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetRowAndColumnIndicesAt(PRInt32 cellIndex, PRInt32 *rowIndex NS_OUTPARAM, PRInt32 *columnIndex NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetColumnIndexAt(PRInt32 cellIndex, PRInt32 *_retval NS_OUTPARAM) \
{ return xpcAccessibleTable::GetColumnIndexAt(cellIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetRowIndexAt(PRInt32 cellIndex, PRInt32 *_retval NS_OUTPARAM) \
{ return xpcAccessibleTable::GetRowIndexAt(cellIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetRowAndColumnIndicesAt(PRInt32 cellIndex, PRInt32 *rowIndex NS_OUTPARAM, PRInt32 *columnIndex NS_OUTPARAM) \
{ return xpcAccessibleTable::GetRowAndColumnIndicesAt(cellIndex, rowIndex, columnIndex); } \
NS_SCRIPTABLE NS_IMETHOD GetColumnExtentAt(PRInt32 row, PRInt32 column, PRInt32* _retval NS_OUTPARAM) \
{ return xpcAccessibleTable::GetColumnExtentAt(row, column, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetRowExtentAt(PRInt32 row, PRInt32 column, PRInt32* _retval NS_OUTPARAM) \
@ -89,9 +102,15 @@ protected:
NS_SCRIPTABLE NS_IMETHOD GetSelectedRowCount(PRUint32* aSelectedRowCount) \
{ return xpcAccessibleTable::GetSelectedRowCount(aSelectedRowCount); } \
NS_SCRIPTABLE NS_IMETHOD GetSelectedCells(nsIArray * *aSelectedCells); \
NS_SCRIPTABLE NS_IMETHOD GetSelectedCellIndices(PRUint32 *cellsArraySize NS_OUTPARAM, PRInt32 **cellsArray NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetSelectedColumnIndices(PRUint32 *rowsArraySize NS_OUTPARAM, PRInt32 **rowsArray NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetSelectedRowIndices(PRUint32 *rowsArraySize NS_OUTPARAM, PRInt32 **rowsArray NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetSelectedCellIndices(PRUint32* cellsArraySize NS_OUTPARAM, \
PRInt32** cellsArray NS_OUTPARAM) \
{ return xpcAccessibleTable::GetSelectedCellIndices(cellsArraySize, cellsArray); } \
NS_SCRIPTABLE NS_IMETHOD GetSelectedColumnIndices(PRUint32* colsArraySize NS_OUTPARAM, \
PRInt32** colsArray NS_OUTPARAM) \
{ return xpcAccessibleTable::GetSelectedColumnIndices(colsArraySize, colsArray); } \
NS_SCRIPTABLE NS_IMETHOD GetSelectedRowIndices(PRUint32* rowsArraySize NS_OUTPARAM, \
PRInt32** rowsArray NS_OUTPARAM) \
{ return xpcAccessibleTable::GetSelectedRowIndices(rowsArraySize, rowsArray); } \
NS_SCRIPTABLE NS_IMETHOD SelectRow(PRInt32 aRowIdx) \
{ return xpcAccessibleTable::SelectRow(aRowIdx); } \
NS_SCRIPTABLE NS_IMETHOD SelectColumn(PRInt32 aColIdx) \

View File

@ -266,56 +266,6 @@ XULListboxAccessible::CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex)
return row->GetChildAt(aColumnIndex);
}
NS_IMETHODIMP
XULListboxAccessible::GetColumnIndexAt(PRInt32 aIndex, PRInt32* aColumn)
{
NS_ENSURE_ARG_POINTER(aColumn);
*aColumn = -1;
PRInt32 columnCount = 0;
nsresult rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
*aColumn = aIndex % columnCount;
return NS_OK;
}
NS_IMETHODIMP
XULListboxAccessible::GetRowIndexAt(PRInt32 aIndex, PRInt32* aRow)
{
NS_ENSURE_ARG_POINTER(aRow);
*aRow = -1;
PRInt32 columnCount = 0;
nsresult rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
*aRow = aIndex / columnCount;
return NS_OK;
}
NS_IMETHODIMP
XULListboxAccessible::GetRowAndColumnIndicesAt(PRInt32 aCellIndex,
PRInt32* aRowIndex,
PRInt32* aColumnIndex)
{
NS_ENSURE_ARG_POINTER(aRowIndex);
*aRowIndex = -1;
NS_ENSURE_ARG_POINTER(aColumnIndex);
*aColumnIndex = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
PRInt32 columnCount = 0;
nsresult rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
*aColumnIndex = aCellIndex % columnCount;
*aRowIndex = aCellIndex / columnCount;
return NS_OK;
}
bool
XULListboxAccessible::IsColSelected(PRUint32 aColIdx)
{
@ -454,18 +404,9 @@ XULListboxAccessible::GetSelectedCells(nsIArray** aCells)
return NS_OK;
}
NS_IMETHODIMP
XULListboxAccessible::GetSelectedCellIndices(PRUint32* aNumCells,
PRInt32** aCells)
void
XULListboxAccessible::SelectedCellIndices(nsTArray<PRUint32>* aCells)
{
NS_ENSURE_ARG_POINTER(aNumCells);
*aNumCells = 0;
NS_ENSURE_ARG_POINTER(aCells);
*aCells = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
do_QueryInterface(mContent);
NS_ASSERTION(control,
@ -474,91 +415,47 @@ XULListboxAccessible::GetSelectedCellIndices(PRUint32* aNumCells,
nsCOMPtr<nsIDOMNodeList> selectedItems;
control->GetSelectedItems(getter_AddRefs(selectedItems));
if (!selectedItems)
return NS_OK;
return;
PRUint32 selectedItemsCount = 0;
nsresult rv = selectedItems->GetLength(&selectedItemsCount);
NS_ENSURE_SUCCESS(rv, rv);
NS_ASSERTION(NS_SUCCEEDED(rv), "GetLength() Shouldn't fail!");
PRInt32 columnCount = 0;
rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 colCount = ColCount();
aCells->SetCapacity(selectedItemsCount * colCount);
aCells->AppendElements(selectedItemsCount * colCount);
PRUint32 cellsCount = selectedItemsCount * columnCount;
for (PRUint32 selItemsIdx = 0, cellsIdx = 0;
selItemsIdx < selectedItemsCount; selItemsIdx++) {
PRInt32 *cellsIdxArray =
static_cast<PRInt32*>(nsMemory::Alloc((cellsCount) * sizeof(PRInt32)));
NS_ENSURE_TRUE(cellsIdxArray, NS_ERROR_OUT_OF_MEMORY);
PRUint32 index = 0, cellsIdx = 0;
for (; index < selectedItemsCount; index++) {
nsCOMPtr<nsIDOMNode> itemNode;
selectedItems->Item(index, getter_AddRefs(itemNode));
selectedItems->Item(selItemsIdx, getter_AddRefs(itemNode));
nsCOMPtr<nsIDOMXULSelectControlItemElement> item =
do_QueryInterface(itemNode);
if (item) {
PRInt32 itemIdx = -1;
control->GetIndexOfItem(item, &itemIdx);
if (itemIdx != -1) {
PRInt32 colIdx = 0;
for (; colIdx < columnCount; colIdx++)
cellsIdxArray[cellsIdx++] = itemIdx * columnCount + colIdx;
}
if (itemIdx >= 0)
for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++, cellsIdx++)
aCells->ElementAt(cellsIdx) = itemIdx * colCount + colIdx;
}
}
*aNumCells = cellsCount;
*aCells = cellsIdxArray;
return NS_OK;
}
NS_IMETHODIMP
XULListboxAccessible::GetSelectedColumnIndices(PRUint32* aNumColumns,
PRInt32** aColumns)
void
XULListboxAccessible::SelectedColIndices(nsTArray<PRUint32>* aCols)
{
NS_ENSURE_ARG_POINTER(aNumColumns);
*aNumColumns = 0;
NS_ENSURE_ARG_POINTER(aColumns);
*aColumns = nsnull;
PRUint32 selColCount = SelectedColCount();
aCols->SetCapacity(selColCount);
if (IsDefunct())
return NS_ERROR_FAILURE;
PRUint32 columnCount = 0;
nsresult rv = GetSelectedColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
if (!columnCount)
return NS_OK;
PRInt32 *colsIdxArray =
static_cast<PRInt32*>(nsMemory::Alloc((columnCount) * sizeof(PRInt32)));
NS_ENSURE_TRUE(colsIdxArray, NS_ERROR_OUT_OF_MEMORY);
PRUint32 colIdx = 0;
for (; colIdx < columnCount; colIdx++)
colsIdxArray[colIdx] = colIdx;
*aNumColumns = columnCount;
*aColumns = colsIdxArray;
return NS_OK;
for (PRUint32 colIdx = 0; colIdx < selColCount; colIdx++)
aCols->AppendElement(colIdx);
}
NS_IMETHODIMP
XULListboxAccessible::GetSelectedRowIndices(PRUint32* aNumRows,
PRInt32** aRows)
void
XULListboxAccessible::SelectedRowIndices(nsTArray<PRUint32>* aRows)
{
NS_ENSURE_ARG_POINTER(aNumRows);
*aNumRows = 0;
NS_ENSURE_ARG_POINTER(aRows);
*aRows = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
do_QueryInterface(mContent);
NS_ASSERTION(control,
@ -567,38 +464,31 @@ XULListboxAccessible::GetSelectedRowIndices(PRUint32* aNumRows,
nsCOMPtr<nsIDOMNodeList> selectedItems;
control->GetSelectedItems(getter_AddRefs(selectedItems));
if (!selectedItems)
return NS_OK;
return;
PRUint32 selectedItemsCount = 0;
nsresult rv = selectedItems->GetLength(&selectedItemsCount);
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 rowCount = 0;
nsresult rv = selectedItems->GetLength(&rowCount);
NS_ASSERTION(NS_SUCCEEDED(rv), "GetLength() Shouldn't fail!");
if (!selectedItemsCount)
return NS_OK;
if (!rowCount)
return;
PRInt32 *rowsIdxArray =
static_cast<PRInt32*>(nsMemory::Alloc((selectedItemsCount) * sizeof(PRInt32)));
NS_ENSURE_TRUE(rowsIdxArray, NS_ERROR_OUT_OF_MEMORY);
aRows->SetCapacity(rowCount);
aRows->AppendElements(rowCount);
PRUint32 index = 0;
for (; index < selectedItemsCount; index++) {
for (PRUint32 rowIdx = 0; rowIdx < rowCount; rowIdx++) {
nsCOMPtr<nsIDOMNode> itemNode;
selectedItems->Item(index, getter_AddRefs(itemNode));
selectedItems->Item(rowIdx, getter_AddRefs(itemNode));
nsCOMPtr<nsIDOMXULSelectControlItemElement> item =
do_QueryInterface(itemNode);
if (item) {
PRInt32 itemIdx = -1;
control->GetIndexOfItem(item, &itemIdx);
if (itemIdx != -1)
rowsIdxArray[index] = itemIdx;
if (itemIdx >= 0)
aRows->ElementAt(rowIdx) = itemIdx;
}
}
*aNumRows = selectedItemsCount;
*aRows = rowsIdxArray;
return NS_OK;
}
void

View File

@ -82,6 +82,9 @@ public:
virtual PRUint32 SelectedCellCount();
virtual PRUint32 SelectedColCount();
virtual PRUint32 SelectedRowCount();
virtual void SelectedCellIndices(nsTArray<PRUint32>* aCells);
virtual void SelectedColIndices(nsTArray<PRUint32>* aCols);
virtual void SelectedRowIndices(nsTArray<PRUint32>* aRows);
virtual void SelectRow(PRUint32 aRowIdx);
virtual void UnselectRow(PRUint32 aRowIdx);

View File

@ -129,136 +129,36 @@ XULTreeGridAccessible::GetSelectedCells(nsIArray** aCells)
return NS_OK;
}
NS_IMETHODIMP
XULTreeGridAccessible::GetSelectedCellIndices(PRUint32* aCellsCount,
PRInt32** aCells)
void
XULTreeGridAccessible::SelectedCellIndices(nsTArray<PRUint32>* aCells)
{
NS_ENSURE_ARG_POINTER(aCellsCount);
*aCellsCount = 0;
NS_ENSURE_ARG_POINTER(aCells);
*aCells = nsnull;
PRUint32 colCount = ColCount(), rowCount = RowCount();
if (!mTreeView)
return NS_OK;
PRInt32 selectedrowCount = 0;
nsresult rv = GetSelectionCount(&selectedrowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 columnCount = 0;
rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 selectedCellCount = selectedrowCount * columnCount;
PRInt32* outArray = static_cast<PRInt32*>(
nsMemory::Alloc(selectedCellCount * sizeof(PRInt32)));
NS_ENSURE_TRUE(outArray, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsITreeSelection> selection;
rv = mTreeView->GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 rowCount = 0;
rv = GetRowCount(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
bool isSelected;
for (PRInt32 rowIdx = 0, arrayIdx = 0; rowIdx < rowCount; rowIdx++) {
selection->IsSelected(rowIdx, &isSelected);
if (isSelected) {
for (PRInt32 colIdx = 0; colIdx < columnCount; colIdx++)
outArray[arrayIdx++] = rowIdx * columnCount + colIdx;
}
}
*aCellsCount = selectedCellCount;
*aCells = outArray;
return NS_OK;
for (PRUint32 rowIdx = 0; rowIdx < rowCount; rowIdx++)
if (IsRowSelected(rowIdx))
for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++)
aCells->AppendElement(rowIdx * colCount + colIdx);
}
NS_IMETHODIMP
XULTreeGridAccessible::GetSelectedColumnIndices(PRUint32* acolumnCount,
PRInt32** aColumns)
void
XULTreeGridAccessible::SelectedColIndices(nsTArray<PRUint32>* aCols)
{
NS_ENSURE_ARG_POINTER(acolumnCount);
*acolumnCount = 0;
NS_ENSURE_ARG_POINTER(aColumns);
*aColumns = nsnull;
if (RowCount() != SelectedRowCount())
return;
if (IsDefunct())
return NS_ERROR_FAILURE;
// If all the row has been selected, then all the columns are selected.
// Because we can't select a column alone.
PRInt32 rowCount = 0;
nsresult rv = GetRowCount(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 selectedrowCount = 0;
rv = GetSelectionCount(&selectedrowCount);
NS_ENSURE_SUCCESS(rv, rv);
if (rowCount != selectedrowCount)
return NS_OK;
PRInt32 columnCount = 0;
rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32* outArray = static_cast<PRInt32*>(
nsMemory::Alloc(columnCount * sizeof(PRInt32)));
NS_ENSURE_TRUE(outArray, NS_ERROR_OUT_OF_MEMORY);
for (PRInt32 colIdx = 0; colIdx < columnCount; colIdx++)
outArray[colIdx] = colIdx;
*acolumnCount = columnCount;
*aColumns = outArray;
return NS_OK;
PRUint32 colCount = ColCount();
aCols->SetCapacity(colCount);
for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++)
aCols->AppendElement(colIdx);
}
NS_IMETHODIMP
XULTreeGridAccessible::GetSelectedRowIndices(PRUint32* arowCount,
PRInt32** aRows)
void
XULTreeGridAccessible::SelectedRowIndices(nsTArray<PRUint32>* aRows)
{
NS_ENSURE_ARG_POINTER(arowCount);
*arowCount = 0;
NS_ENSURE_ARG_POINTER(aRows);
*aRows = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
if (!mTreeView)
return NS_OK;
PRInt32 selectedrowCount = 0;
nsresult rv = GetSelectionCount(&selectedrowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32* outArray = static_cast<PRInt32*>(
nsMemory::Alloc(selectedrowCount * sizeof(PRInt32)));
NS_ENSURE_TRUE(outArray, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsITreeSelection> selection;
rv = mTreeView->GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 rowCount = 0;
rv = GetRowCount(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
bool isSelected;
for (PRInt32 rowIdx = 0, arrayIdx = 0; rowIdx < rowCount; rowIdx++) {
selection->IsSelected(rowIdx, &isSelected);
if (isSelected)
outArray[arrayIdx++] = rowIdx;
}
*arowCount = selectedrowCount;
*aRows = outArray;
return NS_OK;
PRUint32 rowCount = RowCount();
for (PRUint32 rowIdx = 0; rowIdx < rowCount; rowIdx++)
if (IsRowSelected(rowIdx))
aRows->AppendElement(rowIdx);
}
Accessible*
@ -280,57 +180,6 @@ XULTreeGridAccessible::CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex)
return rowAcc->GetCellAccessible(column);
}
NS_IMETHODIMP
XULTreeGridAccessible::GetColumnIndexAt(PRInt32 aCellIndex,
PRInt32* aColumnIndex)
{
NS_ENSURE_ARG_POINTER(aColumnIndex);
*aColumnIndex = -1;
PRInt32 columnCount = 0;
nsresult rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
*aColumnIndex = aCellIndex % columnCount;
return NS_OK;
}
NS_IMETHODIMP
XULTreeGridAccessible::GetRowIndexAt(PRInt32 aCellIndex, PRInt32* aRowIndex)
{
NS_ENSURE_ARG_POINTER(aRowIndex);
*aRowIndex = -1;
PRInt32 columnCount;
nsresult rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
*aRowIndex = aCellIndex / columnCount;
return NS_OK;
}
NS_IMETHODIMP
XULTreeGridAccessible::GetRowAndColumnIndicesAt(PRInt32 aCellIndex,
PRInt32* aRowIndex,
PRInt32* aColumnIndex)
{
NS_ENSURE_ARG_POINTER(aRowIndex);
*aRowIndex = -1;
NS_ENSURE_ARG_POINTER(aColumnIndex);
*aColumnIndex = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
PRInt32 columnCount = 0;
nsresult rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
*aColumnIndex = aCellIndex % columnCount;
*aRowIndex = aCellIndex / columnCount;
return NS_OK;
}
void
XULTreeGridAccessible::ColDescription(PRUint32 aColIdx, nsString& aDescription)
{

View File

@ -41,6 +41,9 @@ public:
virtual PRUint32 SelectedCellCount();
virtual PRUint32 SelectedColCount();
virtual PRUint32 SelectedRowCount();
virtual void SelectedCellIndices(nsTArray<PRUint32>* aCells);
virtual void SelectedColIndices(nsTArray<PRUint32>* aCols);
virtual void SelectedRowIndices(nsTArray<PRUint32>* aRows);
virtual void SelectRow(PRUint32 aRowIdx);
virtual void UnselectRow(PRUint32 aRowIdx);

View File

@ -22,7 +22,7 @@ DirectoryProvider.prototype = {
getFile: function dp_getFile(prop, persistent) {
#ifdef MOZ_WIDGET_GONK
let localProps = ["cachePDir", "webappsDir", "PrefD"];
let localProps = ["cachePDir", "webappsDir", "PrefD", "indexedDBPDir"];
if (localProps.indexOf(prop) != -1) {
prop.persistent = true;
let file = Cc["@mozilla.org/file/local;1"]
@ -37,4 +37,3 @@ DirectoryProvider.prototype = {
};
const NSGetFactory = XPCOMUtils.generateNSGetFactory([DirectoryProvider]);

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1339191265000">
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1340295852000">
<emItems>
<emItem blockID="i58" id="webmaster@buzzzzvideos.info">
<versionRange minVersion="0" maxVersion="*">
@ -27,8 +27,10 @@
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i47" id="youtube@youtube2.com">
</emItem>
<emItem blockID="i107" os="WINNT" id="{ABDE892B-13A8-4d1b-88E6-365A6E755758}">
<versionRange minVersion="0" maxVersion="15.0.4" severity="1">
</versionRange>
</emItem>
<emItem blockID="i88" id="anttoolbar@ant.com">
<versionRange minVersion="2.4.6.4" maxVersion="2.4.6.4" severity="1">
</versionRange>
@ -72,6 +74,10 @@
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i108" id="{28bfb930-7620-11e1-b0c4-0800200c9a66}">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i105" id="{95ff02bc-ffc6-45f0-a5c8-619b8226a9de}">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
@ -228,13 +234,8 @@
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i87" os="WINNT" id="afurladvisor@anchorfree.com">
<versionRange minVersion="0" maxVersion="*">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="13.0a1" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i47" id="youtube@youtube2.com">
</emItem>
<emItem blockID="i22" id="ShopperReports@ShopperReports.com">
<versionRange minVersion="3.1.22.0" maxVersion="3.1.22.0">
</versionRange>
@ -322,6 +323,10 @@
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i106" os="WINNT" id="{97E22097-9A2F-45b1-8DAF-36AD648C7EF4}">
<versionRange minVersion="0" maxVersion="15.0.4" severity="1">
</versionRange>
</emItem>
<emItem blockID="i11" id="yslow@yahoo-inc.com">
<versionRange minVersion="2.0.5" maxVersion="2.0.5">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">

View File

@ -1026,6 +1026,7 @@ pref("devtools.errorconsole.enabled", false);
pref("devtools.toolbar.enabled", false);
pref("devtools.toolbar.visible", false);
pref("devtools.gcli.allowSet", false);
pref("devtools.commands.dir", "");
// Enable the Inspector
pref("devtools.inspector.enabled", true);

View File

@ -187,9 +187,6 @@ var StarUI = {
this._itemId = aItemId !== undefined ? aItemId : this._itemId;
this.beginBatch();
// Consume dismiss clicks, see bug 400924
this.panel.popupBoxObject
.setConsumeRollupEvent(Ci.nsIPopupBoxObject.ROLLUP_CONSUME);
this.panel.openPopup(aAnchorElement, aPosition);
gEditItemOverlay.initPanel(this._itemId,

View File

@ -584,7 +584,7 @@ stack[anonid=browserStack][responsivemode] {
}
stack[anonid=browserStack][responsivemode] {
-moz-transition-properties: min-width, max-width, min-height, max-height;
-moz-transition-property: min-width, max-width, min-height, max-height;
}
stack[anonid=browserStack][responsivemode][notransition] {

View File

@ -1400,7 +1400,7 @@ var gBrowserInit = {
// Show the toolbar if it was previously visible
if (gPrefService.getBoolPref("devtools.toolbar.visible")) {
this.DeveloperToolbar.show();
DeveloperToolbar.show();
}
}
@ -6707,10 +6707,6 @@ var gIdentityHandler = {
// the popup is actually needed
this._identityPopup.hidden = false;
// Tell the popup to consume dismiss clicks, to avoid bug 395314
this._identityPopup.popupBoxObject
.setConsumeRollupEvent(Ci.nsIPopupBoxObject.ROLLUP_CONSUME);
// Update the popup strings
this.setPopupMessages(this._identityBox.className);
@ -7145,6 +7141,9 @@ let gPrivateBrowsingUI = {
* and the setter should only be used in tests.
*/
get privateWindow() {
if (!gBrowser)
return false;
return gBrowser.docShell.QueryInterface(Ci.nsILoadContext)
.usePrivateBrowsing;
}

View File

@ -137,6 +137,7 @@
footertype="promobox"
orient="vertical"
ignorekeys="true"
consumeoutsideclicks="true"
hidden="true"
onpopupshown="StarUI.panelShown(event);"
aria-labelledby="editBookmarkPanelTitle">
@ -259,6 +260,7 @@
type="arrow"
hidden="true"
noautofocus="true"
consumeoutsideclicks="true"
onpopupshown="gIdentityHandler.onPopupShown(event);"
level="top">
<hbox id="identity-popup-container" align="top">

View File

@ -3051,13 +3051,13 @@
if (doPosition) {
this.setAttribute("positionpinnedtabs", "true");
let scrollButtonWidth = this.mTabstrip._scrollButtonDown.scrollWidth;
let scrollButtonWidth = this.mTabstrip._scrollButtonDown.getBoundingClientRect().width;
let paddingStart = this.mTabstrip.scrollboxPaddingStart;
let width = 0;
for (let i = numPinned - 1; i >= 0; i--) {
let tab = this.childNodes[i];
width += tab.scrollWidth;
width += tab.getBoundingClientRect().width;
tab.style.MozMarginStart = - (width + scrollButtonWidth + paddingStart) + "px";
}

View File

@ -152,6 +152,7 @@ _BROWSER_FILES = \
browser_bug735471.js \
browser_bug743421.js \
browser_bug749738.js \
browser_bug763468.js \
browser_canonizeURL.js \
browser_customize.js \
browser_findbarClose.js \

View File

@ -0,0 +1,76 @@
/* 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/. */
// This test makes sure that opening a new tab in private browsing mode opens about:privatebrowsing
// initialization
const pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
const PREF = "browser.newtab.url";
function test() {
let newTabUrl = Services.prefs.getCharPref(PREF) || "about:blank";
waitForExplicitFinish();
// check whether the mode that we start off with is normal or not
ok(!pb.privateBrowsingEnabled, "private browsing is disabled");
// Open a new tab page in normal mode
openNewTab(function () {
// Check the new tab opened while in normal mode
is(gBrowser.selectedBrowser.currentURI.spec, newTabUrl,
"URL of NewTab should be browser.newtab.url in Normal mode");
// enter private browsing mode
togglePrivateBrowsing(function () {
ok(pb.privateBrowsingEnabled, "private browsing is enabled");
// Open a new tab page in private browsing mode
openNewTab(function () {
// Check the new tab opened while in private browsing mode
is(gBrowser.selectedBrowser.currentURI.spec, "about:privatebrowsing",
"URL of NewTab should be about:privatebrowsing in PB mode");
// exit private browsing mode
togglePrivateBrowsing(function () {
ok(!pb.privateBrowsingEnabled, "private browsing is disabled");
// Open a new tab page in normal mode to check if
// returning from pb mode restores everything as it should
openNewTab(function () {
// Check the new tab opened while in normal mode
is(gBrowser.selectedBrowser.currentURI.spec, newTabUrl,
"URL of NewTab should be browser.newtab.url in Normal mode");
gBrowser.removeTab(gBrowser.selectedTab);
gBrowser.removeTab(gBrowser.selectedTab);
finish();
});
});
});
});
});
}
function togglePrivateBrowsing(aCallback) {
let topic = "private-browsing-transition-complete";
Services.obs.addObserver(function observe() {
Services.obs.removeObserver(observe, topic);
executeSoon(aCallback);
}, topic, false);
pb.privateBrowsingEnabled = !pb.privateBrowsingEnabled;
}
function openNewTab(aCallback) {
// Open a new tab
BrowserOpenTab();
let browser = gBrowser.selectedBrowser;
browser.addEventListener("load", function onLoad() {
browser.removeEventListener("load", onLoad, true);
executeSoon(aCallback);
}, true);
}

View File

@ -247,7 +247,7 @@ function ensure_opentabs_match_db(aCallback) {
for (let i = 0; i < browserWin.gBrowser.tabContainer.childElementCount; i++) {
let browser = browserWin.gBrowser.getBrowserAtIndex(i);
let url = browser.currentURI.spec;
if (url == "about:blank")
if (browserWin.isBlankPageURL(url))
continue;
if (!(url in tabs))
tabs[url] = 1;

View File

@ -9,9 +9,13 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyGetter(this, "BROWSER_NEW_TAB_URL", function () {
const PREF = "browser.newtab.url";
const TOPIC = "private-browsing-transition-complete";
function getNewTabPageURL() {
return Services.prefs.getCharPref(PREF) || "about:blank";
if (("gPrivateBrowsingUI" in window) && gPrivateBrowsingUI.privateWindow)
return "about:privatebrowsing";
else
return Services.prefs.getCharPref(PREF) || "about:blank";
}
function update() {
@ -19,9 +23,12 @@ XPCOMUtils.defineLazyGetter(this, "BROWSER_NEW_TAB_URL", function () {
}
Services.prefs.addObserver(PREF, update, false);
Services.obs.addObserver(update, TOPIC, false);
addEventListener("unload", function onUnload() {
removeEventListener("unload", onUnload);
Services.prefs.removeObserver(PREF, update);
Services.obs.removeObserver(update, TOPIC);
});
return getNewTabPageURL();

View File

@ -302,10 +302,6 @@ const DownloadsPanel = {
return;
}
// Make sure that clicking outside the popup cannot reopen it accidentally.
this.panel.popupBoxObject.setConsumeRollupEvent(Ci.nsIPopupBoxObject
.ROLLUP_CONSUME);
// Ensure the anchor is visible. If that is not possible, show the panel
// anchored to the top area of the window, near the default anchor position.
DownloadsButton.getAnchor(function DP_OPIDR_callback(aAnchor) {

View File

@ -46,6 +46,7 @@
type="arrow"
orient="vertical"
level="top"
consumeoutsideclicks="true"
onpopupshown="DownloadsPanel.onPopupShown(event);"
onpopuphidden="DownloadsPanel.onPopupHidden(event);">
<!-- The following popup menu should be a child of the panel element,

View File

@ -36,8 +36,10 @@ function gen_test()
// Test item data and count. This also tests the ordering of the display.
let richlistbox = document.getElementById("downloadsListBox");
/* disabled for failing intermittently (bug 767828)
is(richlistbox.children.length, DownloadData.length,
"There is the correct number of richlistitems");
*/
for (let i = 0; i < richlistbox.children.length; i++) {
let element = richlistbox.children[i];
let dataItem = new DownloadsViewItemController(element).dataItem;

View File

@ -266,17 +266,14 @@ let MigratorPrototype = {
getService(Ci.nsIObserver);
browserGlue.observe(null, TOPIC_WILL_IMPORT_BOOKMARKS, "");
let bookmarksHTMLFile = Services.dirsvc.get("BMarks", Ci.nsIFile);
if (bookmarksHTMLFile.exists()) {
// Note doMigrate doesn't care about the success value of the
// callback.
BookmarkHTMLUtils.importFromURL(
NetUtil.newURI(bookmarksHTMLFile).spec, true, function(a) {
browserGlue.observe(null, TOPIC_DID_IMPORT_BOOKMARKS, "");
doMigrate();
});
return;
}
// Note doMigrate doesn't care about the success value of the
// callback.
BookmarkHTMLUtils.importFromURL(
"resource:///defaults/profile/bookmarks.html", true, function(a) {
browserGlue.observe(null, TOPIC_DID_IMPORT_BOOKMARKS, "");
doMigrate();
});
return;
}
}
doMigrate();

View File

@ -250,9 +250,6 @@ let UI = {
let event = document.createEvent("Events");
event.initEvent("tabviewframeinitialized", true, false);
dispatchEvent(event);
// XXX this can be removed when bug 731868 is fixed
event = null;
} catch(e) {
Utils.log(e);
} finally {

View File

@ -3,26 +3,136 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
let EXPORTED_SYMBOLS = [ ];
let EXPORTED_SYMBOLS = [ "GcliCommands" ];
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource:///modules/devtools/gcli.jsm");
Cu.import("resource:///modules/HUDService.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "HUDService",
"resource:///modules/HUDService.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "LayoutHelpers",
"resource:///modules/devtools/LayoutHelpers.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "console",
"resource:///modules/devtools/Console.jsm");
let prefSvc = "@mozilla.org/preferences-service;1";
XPCOMUtils.defineLazyGetter(this, "prefBranch", function() {
let prefService = Cc[prefSvc].getService(Ci.nsIPrefService);
return prefService.getBranch(null).QueryInterface(Ci.nsIPrefBranch2);
});
Cu.import("resource:///modules/devtools/GcliTiltCommands.jsm", {});
XPCOMUtils.defineLazyGetter(this, "Services", function () {
var obj = {};
Cu.import("resource://gre/modules/Services.jsm", obj);
return obj.Services;
});
XPCOMUtils.defineLazyGetter(this, "LayoutHelpers", function () {
var obj = {};
Cu.import("resource:///modules/devtools/LayoutHelpers.jsm", obj);
return obj.LayoutHelpers;
/**
* A place to store the names of the commands that we have added as a result of
* calling refreshAutoCommands(). Used by refreshAutoCommands to remove the
* added commands.
*/
let commands = [];
/**
* Exported API
*/
let GcliCommands = {
/**
* Called to look in a directory pointed at by the devtools.commands.dir pref
* for *.mozcmd files which are then loaded.
* @param nsIPrincipal aSandboxPrincipal Scope object for the Sandbox in which
* we eval the script from the .mozcmd file. This should be a chrome window.
*/
refreshAutoCommands: function GC_refreshAutoCommands(aSandboxPrincipal) {
// First get rid of the last set of commands
commands.forEach(function(name) {
gcli.removeCommand(name);
});
let dirName = prefBranch.getComplexValue("devtools.commands.dir",
Ci.nsISupportsString).data;
if (dirName == "") {
return;
}
let dir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
dir.initWithPath(dirName);
if (!dir.exists() || !dir.isDirectory()) {
throw new Error('\'' + dirName + '\' is not a directory.');
}
let en = dir.directoryEntries.QueryInterface(Ci.nsIDirectoryEnumerator);
while (true) {
let file = en.nextFile;
if (!file) {
break;
}
if (file.leafName.match(/.*\.mozcmd$/) && file.isFile() && file.isReadable()) {
loadCommandFile(file, aSandboxPrincipal);
}
}
},
};
/**
* Load the commands from a single file
* @param nsIFile aFile The file containing the commands that we should read
* @param nsIPrincipal aSandboxPrincipal Scope object for the Sandbox in which
* we eval the script from the .mozcmd file. This should be a chrome window.
*/
function loadCommandFile(aFile, aSandboxPrincipal) {
NetUtil.asyncFetch(aFile, function refresh_fetch(aStream, aStatus) {
if (!Components.isSuccessCode(aStatus)) {
console.error("NetUtil.asyncFetch(" + aFile.path + ",..) failed. Status=" + aStatus);
return;
}
let source = NetUtil.readInputStreamToString(aStream, aStream.available());
aStream.close();
let sandbox = new Cu.Sandbox(aSandboxPrincipal, {
sandboxPrototype: aSandboxPrincipal,
wantXrays: false,
sandboxName: aFile.path
});
let data = Cu.evalInSandbox(source, sandbox, "1.8", aFile.leafName, 1);
if (!Array.isArray(data)) {
console.error("Command file '" + aFile.leafName + "' does not have top level array.");
return;
}
data.forEach(function(commandSpec) {
gcli.addCommand(commandSpec);
commands.push(commandSpec.name);
});
}.bind(this));
}
/**
* 'cmd' command
*/
gcli.addCommand({
name: "cmd",
description: gcli.lookup("cmdDesc"),
});
/**
* 'cmd refresh' command
*/
gcli.addCommand({
name: "cmd refresh",
description: gcli.lookup("cmdRefreshDesc"),
exec: function Command_cmdRefresh(args, context) {
GcliCommands.refreshAutoCommands(context.environment.chromeDocument.defaultView);
}
});
/**
* 'echo' command

View File

@ -977,6 +977,9 @@ PropertiesView.prototype = {
let valueLabel = document.createElement("label");
let title = element.getElementsByClassName("title")[0];
// Use attribute flags to specify the element type and tooltip text.
this._setAttributes(element, aName, aFlags);
// Separator between the variable name and its value.
separatorLabel.className = "plain";
separatorLabel.setAttribute("value", ":");
@ -984,21 +987,6 @@ PropertiesView.prototype = {
// The variable information (type, class and/or value).
valueLabel.className = "value plain";
if (aFlags) {
// Use attribute flags to specify the element type and tooltip text.
let tooltip = [];
!aFlags.configurable ? element.setAttribute("non-configurable", "")
: tooltip.push("configurable");
!aFlags.enumerable ? element.setAttribute("non-enumerable", "")
: tooltip.push("enumerable");
!aFlags.writable ? element.setAttribute("non-writable", "")
: tooltip.push("writable");
element.setAttribute("tooltiptext", tooltip.join(", "));
}
if (aName === "this") { element.setAttribute("self", ""); }
// Handle the click event when pressing the element value label.
valueLabel.addEventListener("click", this._activateElementInputMode.bind({
scope: this,
@ -1029,6 +1017,36 @@ PropertiesView.prototype = {
return element;
},
/**
* Sets a variable's configurable, enumerable or writable attributes.
*
* @param object aVar
* The object to set the attributes on.
* @param object aName
* The varialbe name.
* @param object aFlags
* Contains configurable, enumerable or writable flags.
*/
_setAttributes: function DVP_setAttributes(aVar, aName, aFlags) {
if (aFlags) {
if (!aFlags.configurable) {
aVar.setAttribute("non-configurable", "");
}
if (!aFlags.enumerable) {
aVar.setAttribute("non-enumerable", "");
}
if (!aFlags.writable) {
aVar.setAttribute("non-writable", "");
}
}
if (aName === "this") {
aVar.setAttribute("self", "");
}
if (aName === "__proto__ ") {
aVar.setAttribute("proto", "");
}
},
/**
* Sets the specific grip for a variable.
* The grip should contain the value or the type & class, as defined in the
@ -1209,6 +1227,9 @@ PropertiesView.prototype = {
let separatorLabel = document.createElement("label");
let valueLabel = document.createElement("label");
// Use attribute flags to specify the element type and tooltip text.
this._setAttributes(element, pKey, aFlags);
if ("undefined" !== typeof pKey) {
// Use a key element to specify the property name.
nameLabel.className = "key plain";
@ -1228,21 +1249,6 @@ PropertiesView.prototype = {
title.appendChild(valueLabel);
}
if (aFlags) {
// Use attribute flags to specify the element type and tooltip text.
let tooltip = [];
!aFlags.configurable ? element.setAttribute("non-configurable", "")
: tooltip.push("configurable");
!aFlags.enumerable ? element.setAttribute("non-enumerable", "")
: tooltip.push("enumerable");
!aFlags.writable ? element.setAttribute("non-writable", "")
: tooltip.push("writable");
element.setAttribute("tooltiptext", tooltip.join(", "));
}
if (pKey === "__proto__ ") { element.setAttribute("proto", ""); }
// Handle the click event when pressing the element value label.
valueLabel.addEventListener("click", this._activateElementInputMode.bind({
scope: this,
@ -1498,6 +1504,7 @@ PropertiesView.prototype = {
} else {
arrow.addEventListener("click", function() { element.toggle(); }, false);
name.addEventListener("click", function() { element.toggle(); }, false);
name.addEventListener("mouseover", function() { element.updateTooltip(name); }, false);
}
title.appendChild(arrow);
@ -1728,6 +1735,52 @@ PropertiesView.prototype = {
}
});
/**
* Creates a tooltip for the element displaying certain attributes.
*
* @param object aAnchor
* The element which will anchor the tooltip.
*/
element.updateTooltip = function DVP_element_updateTooltip(aAnchor) {
let tooltip = document.getElementById("element-tooltip");
if (tooltip) {
document.documentElement.removeChild(tooltip);
}
tooltip = document.createElement("tooltip");
tooltip.id = "element-tooltip";
let configurableLabel = document.createElement("label");
configurableLabel.id = "configurableLabel";
configurableLabel.setAttribute("value", "configurable");
let enumerableLabel = document.createElement("label");
enumerableLabel.id = "enumerableLabel";
enumerableLabel.setAttribute("value", "enumerable");
let writableLabel = document.createElement("label");
writableLabel.id = "writableLabel";
writableLabel.setAttribute("value", "writable");
tooltip.setAttribute("orient", "horizontal")
tooltip.appendChild(configurableLabel);
tooltip.appendChild(enumerableLabel);
tooltip.appendChild(writableLabel);
if (element.hasAttribute("non-configurable")) {
configurableLabel.setAttribute("non-configurable", "");
}
if (element.hasAttribute("non-enumerable")) {
enumerableLabel.setAttribute("non-enumerable", "");
}
if (element.hasAttribute("non-writable")) {
writableLabel.setAttribute("non-writable", "");
}
document.documentElement.appendChild(tooltip);
aAnchor.setAttribute("tooltip", tooltip.id);
};
/**
* Generic function refreshing the internal state of the element when
* it's modified (e.g. a child detail, variable, property is added).

View File

@ -294,7 +294,12 @@ LayoutView.prototype = {
let clientRect = node.getBoundingClientRect();
let width = Math.round(clientRect.width);
let height = Math.round(clientRect.height);
this.doc.querySelector("#element-size").textContent = width + "x" + height;
let elt = this.doc.querySelector("#element-size");
let newLabel = width + "x" + height;
if (elt.textContent != newLabel) {
elt.textContent = newLabel;
}
// If the view is closed, no need to do anything more.
if (!this.isOpen) return;

View File

@ -19,6 +19,7 @@ body {
width: 100%;
padding: 6px 9px;
display: -moz-box;
vertical-align: top;
}
body[dir=rtl] > #header {

View File

@ -28,10 +28,10 @@ let ResponsiveUIManager = {
* @param aTab the tab targeted.
*/
toggle: function(aWindow, aTab) {
if (aTab.responsiveUI) {
aTab.responsiveUI.close();
if (aTab.__responsiveUI) {
aTab.__responsiveUI.close();
} else {
aTab.responsiveUI = new ResponsiveUI(aWindow, aTab);
aTab.__responsiveUI = new ResponsiveUI(aWindow, aTab);
}
},
}
@ -169,7 +169,7 @@ ResponsiveUI.prototype = {
this.container.removeAttribute("responsivemode");
this.stack.removeAttribute("responsivemode");
delete this.tab.responsiveUI;
delete this.tab.__responsiveUI;
},
/**

View File

@ -42,7 +42,7 @@ function test() {
}
function onUIOpen() {
instance = gBrowser.selectedTab.responsiveUI;
instance = gBrowser.selectedTab.__responsiveUI;
ok(instance, "instance of the module is attached to the tab.");
instance.stack.setAttribute("notransition", "true");

View File

@ -37,7 +37,7 @@ function test() {
}
function onUIOpen() {
instance = gBrowser.selectedTab.responsiveUI;
instance = gBrowser.selectedTab.__responsiveUI;
ok(instance, "instance of the module is attached to the tab.");
instance.stack.setAttribute("notransition", "true");

View File

@ -28,7 +28,7 @@ function test() {
// Menus are correctly updated?
is(document.getElementById("Tools:ResponsiveUI").getAttribute("checked"), "true", "menus checked");
instance = gBrowser.selectedTab.responsiveUI;
instance = gBrowser.selectedTab.__responsiveUI;
ok(instance, "instance of the module is attached to the tab.");
instance.transitionsEnabled = false;

View File

@ -14,13 +14,14 @@ const WEBCONSOLE_CONTENT_SCRIPT_URL =
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyGetter(this, "gcli", function() {
let obj = {};
Components.utils.import("resource:///modules/devtools/gcli.jsm", obj);
Components.utils.import("resource:///modules/devtools/GcliCommands.jsm", {});
return obj.gcli;
});
XPCOMUtils.defineLazyModuleGetter(this, "console",
"resource:///modules/devtools/Console.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "gcli",
"resource:///modules/devtools/gcli.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "GcliCommands",
"resource:///modules/devtools/GcliCommands.jsm");
/**
* A component to manage the global developer toolbar, which contains a GCLI
@ -43,6 +44,13 @@ function DeveloperToolbar(aChromeWindow, aToolbarElement)
this._webConsoleButton = this._doc
.getElementById("developer-toolbar-webconsole");
this._webConsoleButtonLabel = this._webConsoleButton.label;
try {
GcliCommands.refreshAutoCommands(aChromeWindow);
}
catch (ex) {
console.error(ex);
}
}
/**

View File

@ -693,4 +693,5 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
@BINPATH@/webapprt/components/components.manifest
@BINPATH@/webapprt/defaults/preferences/prefs.js
@BINPATH@/webapprt/modules/WebappRT.jsm
@BINPATH@/webapprt/modules/WebappsHandler.jsm
#endif

View File

@ -332,3 +332,13 @@ editResourceDesc=URL to edit
# 'line' parameter to the 'edit' command, which is displayed in a dialog
# when the user is using this command.
editLineToJumpToDesc=Line to jump to
# LOCALIZATION NOTE (cmdDesc) A very short description of the 'cmd'
# command. This string is designed to be shown in a menu alongside the command
# name, which is why it should be as short as possible.
cmdDesc=Manipulate the commands
# LOCALIZATION NOTE (cmdRefreshDesc) A very short description of the 'cmd refresh'
# command. This string is designed to be shown in a menu alongside the command
# name, which is why it should be as short as possible.
cmdRefreshDesc=Re-read mozcmd directory

View File

@ -23,3 +23,12 @@ geolocation.description=Do you want to share your location?
geolocation.sharelocation=Share Location
geolocation.dontshare=Don't Share
geolocation.remember=Remember my choice
# LOCALIZATION NOTE (webapps.install.title): %S will be replaced with the name
# of the webapp being installed.
webapps.install.title=Install %S
# LOCALIZATION NOTE (webapps.install.description): %S will be replaced with the
# name of the webapp being installed.
webapps.install.description=Do you want to install %S?
webapps.install.install=Install App
webapps.install.dontinstall=Don't Install

View File

@ -42,10 +42,10 @@ let WebappsInstaller = {
shell.install();
} catch (ex) {
Cu.reportError("Error installing app: " + ex);
return false;
return null;
}
return true;
return shell;
}
}
@ -107,16 +107,20 @@ function NativeApp(aData) {
}
this.shortDescription = sanitize(shortDesc);
this.appcacheDefined = (app.manifest.appcache_path != undefined);
this.manifest = app.manifest;
this.profileFolder = Services.dirsvc.get("ProfD", Ci.nsIFile);
// The app registry is the Firefox profile from which the app
// was installed.
this.registryFolder = Services.dirsvc.get("ProfD", Ci.nsIFile);
this.webappJson = {
"registryDir": this.profileFolder.path,
"registryDir": this.registryFolder.path,
"app": app
};
this.processFolder = Services.dirsvc.get("CurProcD", Ci.nsIFile);
this.runtimeFolder = Services.dirsvc.get("GreD", Ci.nsIFile);
}
#ifdef XP_WIN
@ -125,8 +129,8 @@ function NativeApp(aData) {
*
* The Windows installation process will generate the following files:
*
* ${FolderName} = app-origin;protocol;port
* e.g.: subdomain.example.com;http;-1
* ${FolderName} = protocol;app-origin[;port]
* e.g.: subdomain.example.com;http;85
*
* %APPDATA%/${FolderName}
* - webapp.ini
@ -170,6 +174,7 @@ WinNativeApp.prototype = {
this._createConfigFiles();
this._createShortcutFiles();
this._writeSystemKeys();
this._createAppProfile();
} catch (ex) {
this._removeInstallation();
throw(ex);
@ -191,8 +196,8 @@ WinNativeApp.prototype = {
}
// The ${InstallDir} format is as follows:
// host of the app origin + ";" +
// protocol
// + ";" + host of the app origin
// + ";" + port (only if port is not default)
this.installDir = Services.dirsvc.get("AppData", Ci.nsIFile);
let installDirLeaf = this.launchURI.scheme
@ -280,15 +285,29 @@ WinNativeApp.prototype = {
this.uninstallDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
},
/**
* Creates the profile to be used for this app.
*/
_createAppProfile: function() {
if (!this.appcacheDefined)
return;
let profSvc = Cc["@mozilla.org/toolkit/profile-service;1"]
.getService(Ci.nsIToolkitProfileService);
this.appProfile = profSvc.createDefaultProfileForApp(this.installDir.leafName,
null, null);
},
/**
* Copy the pre-built files into their destination folders.
*/
_copyPrebuiltFiles: function() {
let webapprt = this.processFolder.clone();
let webapprt = this.runtimeFolder.clone();
webapprt.append("webapprt-stub.exe");
webapprt.copyTo(this.installDir, this.appNameAsFilename + ".exe");
let uninstaller = this.processFolder.clone();
let uninstaller = this.runtimeFolder.clone();
uninstaller.append("webapp-uninstaller.exe");
uninstaller.copyTo(this.uninstallDir, this.uninstallerFile.leafName);
},
@ -313,7 +332,7 @@ WinNativeApp.prototype = {
writer.setString("Webapp", "Name", this.appName);
writer.setString("Webapp", "Profile", this.installDir.leafName);
writer.setString("Webapp", "Executable", this.appNameAsFilename);
writer.setString("WebappRT", "InstallDir", this.processFolder.path);
writer.setString("WebappRT", "InstallDir", this.runtimeFolder.path);
writer.writeFile(null, Ci.nsIINIParserWriter.WRITE_UTF16);
// ${UninstallDir}/shortcuts_log.ini
@ -495,6 +514,7 @@ MacNativeApp.prototype = {
this._createDirectoryStructure();
this._copyPrebuiltFiles();
this._createConfigFiles();
this._createAppProfile();
} catch (ex) {
this._removeInstallation(false);
throw(ex);
@ -533,8 +553,19 @@ MacNativeApp.prototype = {
this.resourcesDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
},
_createAppProfile: function() {
if (!this.appcacheDefined)
return;
let profSvc = Cc["@mozilla.org/toolkit/profile-service;1"]
.getService(Ci.nsIToolkitProfileService);
this.appProfile = profSvc.createDefaultProfileForApp(this.appProfileDir.leafName,
null, null);
},
_copyPrebuiltFiles: function() {
let webapprt = this.processFolder.clone();
let webapprt = this.runtimeFolder.clone();
webapprt.append("webapprt-stub");
webapprt.copyTo(this.macOSDir, "webapprt");
},
@ -695,6 +726,7 @@ LinuxNativeApp.prototype = {
this._createDirectoryStructure();
this._copyPrebuiltFiles();
this._createConfigFiles();
this._createAppProfile();
} catch (ex) {
this._removeInstallation();
throw(ex);
@ -719,11 +751,22 @@ LinuxNativeApp.prototype = {
},
_copyPrebuiltFiles: function() {
let webapprtPre = this.processFolder.clone();
let webapprtPre = this.runtimeFolder.clone();
webapprtPre.append(this.webapprt.leafName);
webapprtPre.copyTo(this.installDir, this.webapprt.leafName);
},
_createAppProfile: function() {
if (!this.appcacheDefined)
return;
let profSvc = Cc["@mozilla.org/toolkit/profile-service;1"]
.getService(Ci.nsIToolkitProfileService);
return profSvc.createDefaultProfileForApp(this.installDir.leafName,
null, null);
},
_createConfigFiles: function() {
// ${InstallDir}/webapp.json
let configJson = this.installDir.clone();
@ -740,7 +783,7 @@ LinuxNativeApp.prototype = {
let writer = factory.createINIParser(webappINI).QueryInterface(Ci.nsIINIParserWriter);
writer.setString("Webapp", "Name", this.appName);
writer.setString("Webapp", "Profile", this.uniqueName);
writer.setString("WebappRT", "InstallDir", this.processFolder.path);
writer.setString("WebappRT", "InstallDir", this.runtimeFolder.path);
writer.writeFile();
// $XDG_DATA_HOME/applications/owa-<webappuniquename>.desktop

View File

@ -109,8 +109,14 @@ let webappsUI = {
label: bundle.getString("webapps.install"),
accessKey: bundle.getString("webapps.install.accesskey"),
callback: function(notification) {
if (WebappsInstaller.install(aData)) {
DOMApplicationRegistry.confirmInstall(aData);
let app = WebappsInstaller.install(aData);
if (app) {
let localDir = null;
if (app.appcacheDefined && app.appProfile) {
localDir = app.appProfile.localDir;
}
DOMApplicationRegistry.confirmInstall(aData, false, localDir);
} else {
DOMApplicationRegistry.denyInstall(aData);
}

View File

@ -1009,10 +1009,6 @@ toolbar[iconsize="small"] #feed-button {
list-style-image: url(chrome://browser/skin/identity-icons-https-ev.png);
}
.mixedContent > #page-proxy-favicon[pageproxystate="valid"] {
list-style-image: url(chrome://browser/skin/identity-icons-https-mixed.png);
}
#identity-box:hover > #page-proxy-favicon {
-moz-image-region: rect(0, 32px, 16px, 16px);
}

View File

@ -168,6 +168,16 @@
opacity: 0.5;
}
#element-tooltip > label {
margin: 0 2px 0 2px;
}
#element-tooltip > label[non-enumerable],
#element-tooltip > label[non-configurable],
#element-tooltip > label[non-writable]{
text-decoration: line-through;
}
/**
* Property values colors
*/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 515 B

View File

@ -26,7 +26,6 @@ browser.jar:
skin/classic/browser/identity-icons-generic.png
skin/classic/browser/identity-icons-https.png
skin/classic/browser/identity-icons-https-ev.png
skin/classic/browser/identity-icons-https-mixed.png
skin/classic/browser/Info.png
skin/classic/browser/KUI-close.png
skin/classic/browser/monitor.png

View File

@ -1066,10 +1066,6 @@ toolbar[mode="icons"] #zoom-in-button {
list-style-image: url(chrome://browser/skin/identity-icons-https-ev.png);
}
.mixedContent > #page-proxy-favicon[pageproxystate="valid"] {
list-style-image: url(chrome://browser/skin/identity-icons-https-mixed.png);
}
#identity-box:hover:active > #page-proxy-favicon,
#identity-box[open=true] > #page-proxy-favicon {
-moz-image-region: rect(0, 32px, 16px, 16px);

View File

@ -170,6 +170,16 @@
opacity: 0.5;
}
#element-tooltip > label {
margin: 0 2px 0 2px;
}
#element-tooltip > label[non-enumerable],
#element-tooltip > label[non-configurable],
#element-tooltip > label[non-writable]{
text-decoration: line-through;
}
/**
* Property values colors
*/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

View File

@ -32,7 +32,6 @@ browser.jar:
skin/classic/browser/identity-icons-generic.png
skin/classic/browser/identity-icons-https.png
skin/classic/browser/identity-icons-https-ev.png
skin/classic/browser/identity-icons-https-mixed.png
skin/classic/browser/Info.png
skin/classic/browser/KUI-background.png
skin/classic/browser/KUI-close.png

View File

@ -708,7 +708,8 @@ toolbar[mode=full] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
padding: 3px 7px;
}
@navbarLargeIcons@ .toolbarbutton-1[type=menu]:not(#back-button):not(#forward-button):not(#feed-button) > .toolbarbutton-icon {
@navbarLargeIcons@ .toolbarbutton-1[type=menu]:not(#back-button):not(#forward-button):not(#feed-button) > .toolbarbutton-icon,
@navbarLargeIcons@ .toolbarbutton-1[type=menu] > .toolbarbutton-text /* hack for add-ons that forcefully display the label */ {
-moz-padding-end: 17px;
}
@ -1445,10 +1446,6 @@ html|*.urlbar-input:-moz-lwtheme:-moz-placeholder,
list-style-image: url(chrome://browser/skin/identity-icons-https-ev.png);
}
.mixedContent > #page-proxy-favicon[pageproxystate="valid"] {
list-style-image: url(chrome://browser/skin/identity-icons-https-mixed.png);
}
#identity-box:hover > #page-proxy-favicon {
-moz-image-region: rect(0, 32px, 16px, 16px);
}

View File

@ -168,6 +168,16 @@
opacity: 0.5;
}
#element-tooltip > label {
margin: 0 2px 0 2px;
}
#element-tooltip > label[non-enumerable],
#element-tooltip > label[non-configurable],
#element-tooltip > label[non-writable]{
text-decoration: line-through;
}
/**
* Property values colors
*/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 515 B

View File

@ -32,7 +32,6 @@ browser.jar:
skin/classic/browser/identity-icons-generic.png
skin/classic/browser/identity-icons-https.png
skin/classic/browser/identity-icons-https-ev.png
skin/classic/browser/identity-icons-https-mixed.png
skin/classic/browser/keyhole-forward-mask.svg
skin/classic/browser/KUI-background.png
skin/classic/browser/KUI-close.png
@ -230,7 +229,6 @@ browser.jar:
skin/classic/aero/browser/identity-icons-generic.png
skin/classic/aero/browser/identity-icons-https.png
skin/classic/aero/browser/identity-icons-https-ev.png
skin/classic/aero/browser/identity-icons-https-mixed.png
skin/classic/aero/browser/keyhole-forward-mask.svg
skin/classic/aero/browser/KUI-background.png
skin/classic/aero/browser/KUI-close.png

View File

@ -98,6 +98,7 @@ case "$target" in
fi
dnl set up compilers
TOOLCHAIN_PREFIX="$android_toolchain/bin/$android_tool_prefix-"
AS="$android_toolchain"/bin/"$android_tool_prefix"-as
CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++

View File

@ -105,7 +105,7 @@ public class DoCommand {
String ffxProvider = "org.mozilla.ffxcp";
String fenProvider = "org.mozilla.fencp";
private final String prgVersion = "SUTAgentAndroid Version 1.08";
private final String prgVersion = "SUTAgentAndroid Version 1.09";
public enum Command
{
@ -162,6 +162,7 @@ public class DoCommand {
INST ("inst"),
UPDT ("updt"),
UNINST ("uninst"),
UNINSTALL ("uninstall"),
TEST ("test"),
DBG ("dbg"),
TRACE ("trace"),
@ -356,9 +357,16 @@ public class DoCommand {
case UNINST:
if (Argc >= 2)
strReturn = UnInstallApp(Argv[1], cmdOut);
strReturn = UnInstallApp(Argv[1], cmdOut, true);
else
strReturn = sErrorPrefix + "Wrong number of arguments for inst command!";
strReturn = sErrorPrefix + "Wrong number of arguments for uninst command!";
break;
case UNINSTALL:
if (Argc >= 2)
strReturn = UnInstallApp(Argv[1], cmdOut, false);
else
strReturn = sErrorPrefix + "Wrong number of arguments for uninstall command!";
break;
case ALRT:
@ -3115,13 +3123,17 @@ private void CancelNotification()
return theArgs;
}
public String UnInstallApp(String sApp, OutputStream out)
public String UnInstallApp(String sApp, OutputStream out, boolean reboot)
{
String sRet = "";
try
{
pProc = Runtime.getRuntime().exec(this.getSuArgs("pm uninstall " + sApp + ";reboot;exit"));
if (reboot == true) {
pProc = Runtime.getRuntime().exec(this.getSuArgs("pm uninstall " + sApp + ";reboot;exit"));
} else {
pProc = Runtime.getRuntime().exec(this.getSuArgs("pm uninstall " + sApp + ";exit"));
}
RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
outThrd.start();
@ -3762,7 +3774,8 @@ private void CancelNotification()
"zip zipfile src - zip the source file/dir into zipfile\n" +
"rebt - reboot device\n" +
"inst /path/filename.apk - install the referenced apk file\n" +
"uninst packagename - uninstall the referenced package\n" +
"uninst packagename - uninstall the referenced package and reboot\n" +
"uninstall packagename - uninstall the referenced package without a reboot\n" +
"updt pkgname pkgfile - unpdate the referenced package\n" +
"clok - the current device time expressed as the" +
" number of millisecs since epoch\n" +

Binary file not shown.

Binary file not shown.

View File

@ -35,9 +35,10 @@
# "cert=nickname" tells the pgo server to use a particular certificate
# for this host. The certificate is referenced by its nickname that must
# not contain any spaces. The certificate key files (PKCS12 modules)
# for custom certification are loaded from build/pgo/ssltunnel/certs
# for custom certification are loaded from build/pgo/certs
# directory. When new certificate is added to this dir pgo/ssltunnel
# must be builded then.
# must be built then. This is only necessary for cases where we really do
# want specific certs.
#
# "redir=hostname" tells the pgo server is only used for https://
# hosts while processing the CONNECT tunnel request. It responds
@ -161,3 +162,40 @@ http://bug704464-1.example.com:80 privileged
http://bug704464-2.example.com:80 privileged
http://bug704464-3.example.com:80 privileged
http://bug702292.example.com:80 privileged
# W3C hosts.
# See http://www.w3.org/wiki/Testing/Requirements#The_Web_test_server_must_be_available_through_different_domain_names
http://w3c-test.org:80
http://w3c-test.org:81
http://w3c-test.org:82
http://w3c-test.org:83
http://www.w3c-test.org:80
http://www.w3c-test.org:81
http://www.w3c-test.org:82
http://www.w3c-test.org:83
http://www1.w3c-test.org:80
http://www1.w3c-test.org:81
http://www1.w3c-test.org:82
http://www1.w3c-test.org:83
http://www2.w3c-test.org:80
http://www2.w3c-test.org:81
http://www2.w3c-test.org:82
http://www2.w3c-test.org:83
# http://天気の良い日.w3c-test.org
http://xn--n8j6ds53lwwkrqhv28a.w3c-test.org:80
http://xn--n8j6ds53lwwkrqhv28a.w3c-test.org:81
http://xn--n8j6ds53lwwkrqhv28a.w3c-test.org:82
http://xn--n8j6ds53lwwkrqhv28a.w3c-test.org:83
# http://élève.w3c-test.org
http://xn--lve-6lad.w3c-test.org:80
http://xn--lve-6lad.w3c-test.org:81
http://xn--lve-6lad.w3c-test.org:82
http://xn--lve-6lad.w3c-test.org:83
# HTTPS versions of the above
https://w3c-test.org:443
https://www.w3c-test.org:443
https://www1.w3c-test.org:443
https://www2.w3c-test.org:443
https://xn--n8j6ds53lwwkrqhv28a.w3c-test.org:443
https://xn--lve-6lad.w3c-test.org:443
http://test.w3.org:80

41
build/unix/build-clang/build-clang.py Normal file → Executable file
View File

@ -13,6 +13,7 @@ import os.path
import shutil
import tarfile
import subprocess
import platform
def check_run(args):
r = subprocess.call(args)
@ -46,8 +47,7 @@ def with_env(env, f):
def build_tar_package(tar, name, base, directory):
name = os.path.realpath(name)
run_in(base, [tar, "-cjf", name, "--mtime=2012-01-01", "--owner=root",
directory])
run_in(base, [tar, "-cjf", name, directory])
def svn_co(url, directory, revision):
check_run(["svn", "co", "-r", revision, url, directory])
@ -74,7 +74,7 @@ def build_one_stage_aux(stage_dir, is_stage_one):
os.mkdir(stage_dir)
build_dir = stage_dir + "/build"
inst_dir = stage_dir + "/inst"
inst_dir = stage_dir + "/clang"
configure_opts = ["--enable-optimized",
"--prefix=%s" % inst_dir,
@ -84,6 +84,8 @@ def build_one_stage_aux(stage_dir, is_stage_one):
build_package(llvm_source_dir, build_dir, configure_opts)
isDarwin = platform.system() == "Darwin"
if not os.path.exists(source_dir):
os.makedirs(source_dir)
svn_co("http://llvm.org/svn/llvm-project/llvm/trunk",
@ -94,8 +96,12 @@ if not os.path.exists(source_dir):
compiler_rt_source_dir, llvm_revision)
os.symlink("../../clang", llvm_source_dir + "/tools/clang")
os.symlink("../../compiler-rt", llvm_source_dir + "/projects/compiler-rt")
patch("old-ld-hack.patch", 1, llvm_source_dir)
patch("compiler-rt-gnu89-inline.patch", 0, compiler_rt_source_dir)
if isDarwin:
patch("clang-no-ios.patch", 0, clang_source_dir)
patch("compiler-rt-no-ios.patch", 0, compiler_rt_source_dir)
else:
patch("old-ld-hack.patch", 1, llvm_source_dir)
patch("compiler-rt-gnu89-inline.patch", 0, compiler_rt_source_dir)
if os.path.exists(build_dir):
shutil.rmtree(build_dir)
@ -103,13 +109,28 @@ os.makedirs(build_dir)
stage1_dir = build_dir + '/stage1'
stage1_inst_dir = stage1_dir + '/clang'
build_one_stage({"CC" : "/tools/gcc-4.5-0moz3/bin/gcc -static-libgcc",
"CXX" : "/tools/gcc-4.5-0moz3/bin/g++ -static-libgcc -static-libstdc++"},
if isDarwin:
extra_cflags = ""
extra_cxxflags = ""
cc = "/usr/bin/clang"
cxx = "/usr/bin/clang++"
else:
extra_cflags = "-static-libgcc"
extra_cxxflags = "-static-libgcc -static-libstdc++"
cc = "/tools/gcc-4.5-0moz3/bin/gcc %s" % extra_cflags
cxx = "/tools/gcc-4.5-0moz3/bin/g++ %s" % extra_cxxflags
build_one_stage({"CC" : cc,
"CXX" : cxx },
stage1_dir, True)
if not isDarwin:
extra_cflags += " -fgnu89-inline"
stage2_dir = build_dir + '/stage2'
build_one_stage({"CC" : stage1_inst_dir + "/bin/clang -static-libgcc -fgnu89-inline",
"CXX" : stage1_inst_dir + "/bin/clang++ -static-libgcc -static-libstdc++"},
build_one_stage({"CC" : stage1_inst_dir + "/bin/clang %s" % extra_cflags,
"CXX" : stage1_inst_dir + "/bin/clang++ %s" % extra_cxxflags},
stage2_dir, False)
build_tar_package("/bin/tar", "clang.tar.bz2", stage3_dir, "clang")
build_tar_package("tar", "clang.tar.bz2", stage2_dir, "clang")

View File

@ -0,0 +1,15 @@
Index: runtime/compiler-rt/Makefile
===================================================================
--- runtime/compiler-rt/Makefile (revision 157958)
+++ runtime/compiler-rt/Makefile (working copy)
@@ -74,8 +74,8 @@
ifeq ($(OS),Darwin)
RuntimeDirs += darwin
RuntimeLibrary.darwin.Configs := \
- eprintf 10.4 osx ios cc_kext \
- asan_osx profile_osx profile_ios
+ eprintf 10.4 osx \
+ asan_osx profile_osx
endif
# On Linux, include a library which has all the runtime functions.

View File

@ -0,0 +1,29 @@
Index: make/platform/clang_darwin.mk
===================================================================
--- make/platform/clang_darwin.mk (revision 157958)
+++ make/platform/clang_darwin.mk (working copy)
@@ -47,7 +47,7 @@
# Configuration for targetting iOS, for some ARMv6 functions, which must be
# in the same linkage unit, and for a couple of other functions that didn't
# make it into libSystem.
-Configs += ios
+#Configs += ios
UniversalArchs.ios := $(call CheckArches,i386 x86_64 armv6 armv7,ios)
# Configuration for targetting OSX. These functions may not be in libSystem
@@ -56,13 +56,13 @@
UniversalArchs.osx := $(call CheckArches,i386 x86_64,osx)
# Configuration for use with kernel/kexts.
-Configs += cc_kext
+#Configs += cc_kext
UniversalArchs.cc_kext := $(call CheckArches,armv6 armv7 i386 x86_64,cc_kext)
# Configurations which define the profiling support functions.
Configs += profile_osx
UniversalArchs.profile_osx := $(call CheckArches,i386 x86_64,profile_osx)
-Configs += profile_ios
+#Configs += profile_ios
UniversalArchs.profile_ios := $(call CheckArches,i386 x86_64 armv6 armv7,profile_ios)
# Configurations which define the ASAN support functions.

View File

@ -0,0 +1,4 @@
#!/bin/sh
rm -rf clang
tar -xjf clang.tar.bz2

View File

@ -26,9 +26,13 @@ namespace std {
template ostream& ostream::_M_insert(unsigned long);
template ostream& ostream::_M_insert(long long);
template ostream& ostream::_M_insert(unsigned long long);
template ostream& ostream::_M_insert(bool);
template ostream& ostream::_M_insert(const void*);
template ostream& __ostream_insert(ostream&, const char*, streamsize);
template istream& istream::_M_extract(double&);
template istream& istream::_M_extract(float&);
template istream& istream::_M_extract(unsigned int&);
template istream& istream::_M_extract(unsigned long&);
#endif
#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)
/* Instantiate these templates to avoid GLIBCXX_3.4.14 symbol versions
@ -42,6 +46,7 @@ namespace std {
template string& string::operator=(string&&);
template wstring::basic_string(wstring&&);
template wstring& wstring::operator=(wstring&&);
template string& string::assign(string&&);
template wstring& wstring::assign(wstring&&);
#endif /* __GXX_EXPERIMENTAL_CXX0X__ */
#endif /* (__GNUC__ == 4) && (__GNUC_MINOR__ >= 5) */

View File

@ -137,6 +137,7 @@ MOZ_WEBM = @MOZ_WEBM@
MOZ_MEDIA_PLUGINS = @MOZ_MEDIA_PLUGINS@
MOZ_OMX_PLUGIN = @MOZ_OMX_PLUGIN@
MOZ_GSTREAMER = @MOZ_GSTREAMER@
MOZ_VP8 = @MOZ_VP8@
MOZ_VP8_ERROR_CONCEALMENT = @MOZ_VP8_ERROR_CONCEALMENT@
MOZ_VP8_ENCODER = @MOZ_VP8_ENCODER@
VPX_AS = @VPX_AS@
@ -170,6 +171,7 @@ MOZ_D3DX9_DLL = @MOZ_D3DX9_DLL@
MOZ_D3DCOMPILER_DLL = @MOZ_D3DCOMPILER_DLL@
MOZ_GL_PROVIDER = @MOZ_GL_PROVIDER@
MOZ_GL_DEFAULT_PROVIDER = @MOZ_GL_DEFAULT_PROVIDER@
MOZ_WEBRTC = @MOZ_WEBRTC@
JAVA=@JAVA@
@ -355,6 +357,7 @@ HAVE_64BIT_OS = @HAVE_64BIT_OS@
CC = @CC@
CXX = @CXX@
CPP = @CPP@
TOOLCHAIN_PREFIX = @TOOLCHAIN_PREFIX@
CC_VERSION = @CC_VERSION@
CXX_VERSION = @CXX_VERSION@

View File

@ -56,6 +56,8 @@ space :=$(nullstr) # EOL
core_winabspath = $(firstword $(subst /, ,$(call core_abspath,$(1)))):$(subst $(space),,$(patsubst %,\\%,$(wordlist 2,$(words $(subst /, ,$(call core_abspath,$(1)))), $(strip $(subst /, ,$(call core_abspath,$(1)))))))
RM = rm -f
# LIBXUL_DIST is not defined under js/src, thus we make it mean DIST there.
LIBXUL_DIST ?= $(DIST)
@ -734,8 +736,8 @@ OPTIMIZE_JARS_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/optimizeja
CREATE_PRECOMPLETE_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/createprecomplete.py)
EXPAND_LIBS_EXEC = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_exec.py $(if $@,--depend $(MDDEPDIR)/$(basename $(@F)).pp --target $@)
EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_gen.py $(if $@,--depend $(MDDEPDIR)/$(basename $(@F)).pp)
EXPAND_LIBS_EXEC = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_exec.py $(if $@,--depend $(MDDEPDIR)/$(@F).pp --target $@)
EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_gen.py $(if $@,--depend $(MDDEPDIR)/$(@F).pp)
EXPAND_AR = $(EXPAND_LIBS_EXEC) --extract -- $(AR)
EXPAND_CC = $(EXPAND_LIBS_EXEC) --uselist -- $(CC)
EXPAND_CCC = $(EXPAND_LIBS_EXEC) --uselist -- $(CCC)

View File

@ -286,7 +286,7 @@ endif
ifndef MOZ_AUTO_DEPS
ifneq (,$(OBJS)$(XPIDLSRCS)$(SIMPLE_PROGRAMS))
MDDEPFILES = $(addprefix $(MDDEPDIR)/,$(OBJS:.$(OBJ_SUFFIX)=.pp))
MDDEPFILES = $(addprefix $(MDDEPDIR)/,$(OBJS:=.pp))
ifndef NO_GEN_XPT
MDDEPFILES += $(addprefix $(MDDEPDIR)/,$(XPIDLSRCS:.idl=.h.pp) $(XPIDLSRCS:.idl=.xpt.pp))
endif
@ -633,7 +633,10 @@ endif
HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX),$(HOST_LIBS))
# Dependencies which, if modified, should cause everything to rebuild
GLOBAL_DEPS += Makefile Makefile.in $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
GLOBAL_DEPS += Makefile $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
ifndef NO_MAKEFILE_RULE
GLOBAL_DEPS += Makefile.in
endif
##############################################
include $(topsrcdir)/config/makefiles/target_libs.mk
@ -1147,16 +1150,20 @@ GARBAGE_DIRS += $(_JAVA_DIR)
# Update Makefiles
###############################################################################
ifndef NO_MAKEFILE_RULE
# Note: Passing depth to make-makefile is optional.
# It saves the script some work, though.
Makefile: Makefile.in
@$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH)
endif
ifndef NO_SUBMAKEFILES_RULE
ifdef SUBMAKEFILES
# VPATH does not work on some machines in this case, so add $(srcdir)
$(SUBMAKEFILES): % : $(srcdir)/%.in
$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $@
endif
endif
ifdef AUTOUPDATE_CONFIGURE
$(topsrcdir)/configure: $(topsrcdir)/configure.in

View File

@ -1059,3 +1059,5 @@ gst/gst.h
gst/app/gstappsink.h
gst/app/gstappsrc.h
gst/video/video.h
sys/msg.h
sys/ipc.h

View File

@ -171,6 +171,7 @@ if test -n "$gonkdir" ; then
ANDROID_NDK="${ANDROID_SOURCE}/ndk"
dnl set up compilers
TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
AS="$gonk_toolchain_prefix"as
CC="$gonk_toolchain_prefix"gcc
CXX="$gonk_toolchain_prefix"g++
@ -495,7 +496,7 @@ case "$target" in
AC_LANG_RESTORE
changequote(,)
_MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
_MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
changequote([,])
# Determine compiler version
@ -522,18 +523,22 @@ case "$target" in
fi
_CC_SUITE=8
_MSVS_VERSION=2005
AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
elif test "$_CC_MAJOR_VERSION" = "15"; then
_CC_SUITE=9
_MSVS_VERSION=2008
AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
elif test "$_CC_MAJOR_VERSION" = "16"; then
_CC_SUITE=10
_MSVS_VERSION=2010
AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
elif test "$_CC_MAJOR_VERSION" = "17"; then
_CC_SUITE=11
_MSVS_VERSION=2011
AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
else
@ -567,7 +572,7 @@ case "$target" in
fi
changequote(,)
_MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
_MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
changequote([,])
MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
if test -z "$MSMANIFEST_TOOL_VERSION"; then
@ -4250,9 +4255,12 @@ MOZ_WAVE=1
MOZ_MEDIA=
MOZ_OPUS=1
MOZ_WEBM=1
MOZ_WEBRTC=
MOZ_WEBRTC_SIGNALING=
MOZ_MEDIA_PLUGINS=
MOZ_MEDIA_NAVIGATOR=
MOZ_OMX_PLUGIN=
MOZ_VP8=
MOZ_VP8_ERROR_CONCEALMENT=
MOZ_VP8_ENCODER=
VPX_AS=
@ -5271,6 +5279,25 @@ if test "$NS_PRINTING"; then
AC_DEFINE(NS_PRINT_PREVIEW)
fi
dnl ========================================================
dnl = Enable WebRTC code
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(webrtc,
[ --enable-webrtc Enable support for WebRTC],
MOZ_WEBRTC=1,
MOZ_WEBRTC=)
if test -n "$MOZ_WEBRTC"; then
AC_DEFINE(MOZ_WEBRTC)
MOZ_MEDIA=1
MOZ_RAW=1
MOZ_VP8=1
MOZ_VP8_ENCODER=1
MOZ_VP8_ERROR_CONCEALMENT=1
fi
AC_SUBST(MOZ_WEBRTC)
dnl ========================================================
dnl = Enable Raw Codecs
dnl ========================================================
@ -5346,6 +5373,11 @@ MOZ_ARG_DISABLE_BOOL(webm,
MOZ_WEBM=,
MOZ_WEBM=1)
if test -n "$MOZ_WEBM"; then
AC_DEFINE(MOZ_WEBM)
MOZ_VP8=1
fi;
dnl ========================================================
dnl = Disable media plugin support
dnl ========================================================
@ -5397,8 +5429,8 @@ MOZ_ARG_WITH_BOOL(system-libvpx,
MOZ_LIBVPX_INCLUDES=
MOZ_LIBVPX_LIBS=
if test -n "$MOZ_WEBM"; then
AC_DEFINE(MOZ_WEBM)
if test -n "$MOZ_VP8"; then
AC_DEFINE(MOZ_VP8)
if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
fi
@ -5425,7 +5457,7 @@ AC_SUBST(MOZ_NATIVE_LIBVPX)
AC_SUBST(MOZ_LIBVPX_INCLUDES)
AC_SUBST(MOZ_LIBVPX_LIBS)
if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
if test "$MOZ_WEBM"; then
MOZ_SYDNEYAUDIO=1
MOZ_CUBEB=1
MOZ_MEDIA=1
@ -5437,7 +5469,9 @@ if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
MOZ_VORBIS=1
;;
esac
fi
if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
@ -7729,7 +7763,7 @@ MOZ_ARG_DISABLE_BOOL(md,
fi])
if test "$_cpp_md_flag"; then
COMPILER_DEPEND=1
_DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
_DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)'
dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
if test "$SOLARIS_SUNPRO_CC"; then
_DEPEND_CFLAGS=
@ -8299,6 +8333,7 @@ AC_SUBST(MOZ_FEEDS)
AC_SUBST(NS_PRINTING)
AC_SUBST(MOZ_WEBGL)
AC_SUBST(MOZ_HELP_VIEWER)
AC_SUBST(TOOLCHAIN_PREFIX)
AC_SUBST(JAVA)
AC_SUBST(JAVAC)
@ -8443,7 +8478,6 @@ AC_SUBST(MOZ_APP_UA_NAME)
AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
AC_SUBST(MOZ_APP_VERSION)
AC_SUBST(MOZ_APP_MAXVERSION)
AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
AC_SUBST(FIREFOX_VERSION)
@ -8600,6 +8634,7 @@ AC_SUBST(MOZ_MEDIA_PLUGINS)
AC_SUBST(MOZ_OMX_PLUGIN)
AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
AC_SUBST(MOZ_VP8_ENCODER)
AC_SUBST(MOZ_VP8)
AC_SUBST(MOZ_OGG)
AC_SUBST(MOZ_ALSA_LIBS)
AC_SUBST(MOZ_ALSA_CFLAGS)
@ -8877,6 +8912,52 @@ mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
AC_OUTPUT($MAKEFILES)
# Generate Makefiles for WebRTC directly from .gyp files
if test "${OS_TARGET}" = "WINNT"; then
if test "$HAVE_64BIT_OS"; then
OS_BITS=64
else
OS_BITS=32
fi
EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
fi
if test -n "$MOZ_WEBRTC"; then
AC_MSG_RESULT("generating WebRTC Makefiles...")
GYP_WEBRTC_OPTIONS="--format=mozmake -D build_with_mozilla=1 -D enable_protobuf=0 -D include_internal_video_render=0 ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
$PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
$GYP_WEBRTC_OPTIONS \
--generator-output=${_objdir}/media/webrtc/trunk \
${srcdir}/media/webrtc/trunk/peerconnection.gyp
if test "$?" != 0; then
AC_MSG_ERROR([failed to generate WebRTC Makefiles])
fi
# XXX disable until we land the tranche with signaling
if test -n "$MOZ_WEBRTC_SIGNALING"; then
AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
$PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
$GYP_WEBRTC_OPTIONS \
--generator-output=${_objdir}/media/webrtc/signaling \
${srcdir}/media/webrtc/signaling/signaling.gyp
if test "$?" != 0; then
AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
fi
fi
AC_MSG_RESULT("generating gtest Makefiles...")
# Ok to pass some extra -D's that are ignored here
$PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
$GYP_WEBRTC_OPTIONS \
--generator-output=${_objdir}/media/webrtc/trunk/testing/ \
${srcdir}/media/webrtc/trunk/testing/gtest.gyp
if test "$?" != 0; then
AC_MSG_ERROR([failed to generate gtest Makefiles])
fi
fi
# Populate the virtualenv
AC_MSG_RESULT([Populating Python virtualenv])
$MAKE -C build/virtualenv MACOSX_DEPLOYMENT_TARGET= || exit 1

View File

@ -265,4 +265,10 @@ inline mozilla::dom::Element* nsINode::AsElement()
return static_cast<mozilla::dom::Element*>(this);
}
inline const mozilla::dom::Element* nsINode::AsElement() const
{
MOZ_ASSERT(IsElement());
return static_cast<const mozilla::dom::Element*>(this);
}
#endif // mozilla_dom_Element_h__

View File

@ -2046,7 +2046,9 @@ public:
Element* aRoot,
PRInt32& aOutStartOffset,
PRInt32& aOutEndOffset);
static nsIEditor* GetHTMLEditor(nsPresContext* aPresContext);
private:
static bool InitializeEventTable();

View File

@ -250,6 +250,64 @@ public:
return OwnerDoc()->IsHTML();
}
/**
* Get the namespace that this element's tag is defined in
* @return the namespace
*/
inline PRInt32 GetNameSpaceID() const
{
return mNodeInfo->NamespaceID();
}
/**
* Get the NodeInfo for this element
* @return the nodes node info
*/
inline nsINodeInfo* NodeInfo() const
{
return mNodeInfo;
}
inline bool IsInNamespace(PRInt32 aNamespace) const
{
return mNodeInfo->NamespaceID() == aNamespace;
}
inline bool IsHTML() const
{
return IsInNamespace(kNameSpaceID_XHTML);
}
inline bool IsHTML(nsIAtom* aTag) const
{
return mNodeInfo->Equals(aTag, kNameSpaceID_XHTML);
}
inline bool IsSVG() const
{
return IsInNamespace(kNameSpaceID_SVG);
}
inline bool IsSVG(nsIAtom* aTag) const
{
return mNodeInfo->Equals(aTag, kNameSpaceID_SVG);
}
inline bool IsXUL() const
{
return IsInNamespace(kNameSpaceID_XUL);
}
inline bool IsMathML() const
{
return IsInNamespace(kNameSpaceID_MathML);
}
inline bool IsMathML(nsIAtom* aTag) const
{
return mNodeInfo->Equals(aTag, kNameSpaceID_MathML);
}
/**
* Returns an atom holding the name of the attribute of type ID on
* this content node (if applicable). Returns null for non-element

View File

@ -373,6 +373,7 @@ public:
* for which IsElement() is true. This is defined inline in Element.h.
*/
mozilla::dom::Element* AsElement();
const mozilla::dom::Element* AsElement() const;
/**
* Return this node as nsIContent. Should only be used for nodes for which
@ -476,15 +477,6 @@ public:
return mNodeInfo->LocalName();
}
/**
* Get the namespace that this element's tag is defined in
* @return the namespace
*/
PRInt32 GetNameSpaceID() const
{
return mNodeInfo->NamespaceID();
}
/**
* Get the tag for this element. This will always return a non-null atom
* pointer (as implied by the naming of the method). For elements this is
@ -496,55 +488,6 @@ public:
return mNodeInfo->NameAtom();
}
/**
* Get the NodeInfo for this element
* @return the nodes node info
*/
nsINodeInfo* NodeInfo() const
{
return mNodeInfo;
}
bool IsInNamespace(PRInt32 aNamespace) const
{
return mNodeInfo->NamespaceID() == aNamespace;
}
bool IsHTML() const
{
return IsInNamespace(kNameSpaceID_XHTML);
}
bool IsHTML(nsIAtom* aTag) const
{
return mNodeInfo->Equals(aTag, kNameSpaceID_XHTML);
}
bool IsSVG() const
{
return IsInNamespace(kNameSpaceID_SVG);
}
bool IsSVG(nsIAtom* aTag) const
{
return mNodeInfo->Equals(aTag, kNameSpaceID_SVG);
}
bool IsXUL() const
{
return IsInNamespace(kNameSpaceID_XUL);
}
bool IsMathML() const
{
return IsInNamespace(kNameSpaceID_MathML);
}
bool IsMathML(nsIAtom* aTag) const
{
return mNodeInfo->Equals(aTag, kNameSpaceID_MathML);
}
nsINode*
InsertBefore(nsINode *aNewChild, nsINode *aRefChild, nsresult *aReturn)
{
@ -1227,6 +1170,8 @@ public:
bool Contains(const nsINode* aOther) const;
nsresult Contains(nsIDOMNode* aOther, bool* aReturn);
bool UnoptimizableCCNode() const;
private:
nsIContent* GetNextNodeImpl(const nsINode* aRoot,

View File

@ -92,6 +92,7 @@ CPPSRCS = \
nsGkAtoms.cpp \
nsHTMLContentSerializer.cpp \
nsImageLoadingContent.cpp \
nsINode.cpp \
nsLineBreaker.cpp \
nsMappedAttributeElement.cpp \
nsMappedAttributes.cpp \

View File

@ -173,16 +173,17 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "mozilla/Base64.h"
#include "mozilla/Preferences.h"
#include "nsDOMMutationObserver.h"
#include "nsWrapperCacheInlines.h"
#include "nsIDOMDocumentType.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsICharsetDetector.h"
#include "nsICharsetDetectionObserver.h"
#include "nsIPlatformCharset.h"
#include "nsIEditor.h"
#include "nsIEditorDocShell.h"
#include "mozilla/Attributes.h"
#include "nsWrapperCacheInlines.h"
extern "C" int MOZ_XMLTranslateEntity(const char* ptr, const char* end,
const char** next, PRUnichar* result);
extern "C" int MOZ_XMLCheckQName(const char* ptr, const char* end,
@ -6250,6 +6251,12 @@ nsContentUtils::IsSubDocumentTabbable(nsIContent* aContent)
return false;
}
// If the subdocument lives in another process, the frame is
// tabbable.
if (nsEventStateManager::IsRemoteTarget(aContent)) {
return true;
}
// XXXbz should this use OwnerDoc() for GetSubDocumentFor?
// sXBL/XBL2 issue!
nsIDocument* subDoc = doc->GetSubDocumentFor(aContent);
@ -6917,3 +6924,18 @@ nsContentUtils::GetSelectionInTextControl(Selection* aSelection,
aOutStartOffset = NS_MIN(anchorOffset, focusOffset);
aOutEndOffset = NS_MAX(anchorOffset, focusOffset);
}
nsIEditor*
nsContentUtils::GetHTMLEditor(nsPresContext* aPresContext)
{
nsCOMPtr<nsISupports> container = aPresContext->GetContainer();
nsCOMPtr<nsIEditorDocShell> editorDocShell(do_QueryInterface(container));
bool isEditable;
if (!editorDocShell ||
NS_FAILED(editorDocShell->GetEditable(&isEditable)) || !isEditable)
return nsnull;
nsCOMPtr<nsIEditor> editor;
editorDocShell->GetEditor(getter_AddRefs(editor));
return editor;
}

View File

@ -1505,13 +1505,6 @@ nsFrameLoader::MaybeCreateDocShell()
mDocShell->SetChromeEventHandler(chromeEventHandler);
}
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (OwnerIsBrowserFrame() && os) {
mDocShell->SetIsBrowserFrame(true);
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
"in-process-browser-frame-shown", NULL);
}
// This is nasty, this code (the do_GetInterface(mDocShell) below)
// *must* come *after* the above call to
// mDocShell->SetChromeEventHandler() for the global window to get
@ -1538,6 +1531,22 @@ nsFrameLoader::MaybeCreateDocShell()
EnsureMessageManager();
if (OwnerIsBrowserFrame()) {
mDocShell->SetIsBrowserFrame(true);
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (os) {
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
"in-process-browser-frame-shown", NULL);
}
if (mMessageManager) {
mMessageManager->LoadFrameScript(
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js"),
/* allowDelayedLoad = */ true);
}
}
return NS_OK;
}
@ -1899,7 +1908,8 @@ nsFrameLoader::TryRemoteBrowser()
ContentParent* parent = ContentParent::GetNewOrUsed();
NS_ASSERTION(parent->IsAlive(), "Process parent should be alive; something is very wrong!");
mRemoteBrowser = parent->CreateTab(chromeFlags);
mRemoteBrowser = parent->CreateTab(chromeFlags,
/* aIsBrowserFrame = */ OwnerIsBrowserFrame());
if (mRemoteBrowser) {
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mOwnerContent);
mRemoteBrowser->SetOwnerElement(element);

File diff suppressed because it is too large Load Diff

View File

@ -777,6 +777,13 @@ protected:
*/
virtual void GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent);
/**
* Retrieve the size of the padding rect of this element.
*
* @param aSize the size of the padding rect
*/
nsIntSize GetPaddingRectSize();
nsIFrame* GetStyledFrame();
virtual mozilla::dom::Element* GetNameSpaceElement()

View File

@ -201,13 +201,14 @@ GK_ATOM(commandupdater, "commandupdater")
GK_ATOM(comment, "comment")
GK_ATOM(compact, "compact")
GK_ATOM(concat, "concat")
GK_ATOM(contenteditable, "contenteditable")
GK_ATOM(conditions, "conditions")
GK_ATOM(constructor, "constructor")
GK_ATOM(consumeoutsideclicks, "consumeoutsideclicks")
GK_ATOM(container, "container")
GK_ATOM(containment, "containment")
GK_ATOM(contains, "contains")
GK_ATOM(content, "content")
GK_ATOM(contenteditable, "contenteditable")
GK_ATOM(headerContentDisposition, "content-disposition")
GK_ATOM(headerContentLanguage, "content-language")
GK_ATOM(contentLocation, "content-location")

2054
content/base/src/nsINode.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -494,7 +494,6 @@
return root[select](q, resolver);
} catch(e){
if ( e.message.indexOf("ERR") > -1 ||
(e.name == "NamespaceError" && e.code == DOMException.NAMESPACE_ERR) ||
(e.name == "SyntaxError" && e.code == DOMException.SYNTAX_ERR) )
throw e;
}
@ -549,7 +548,7 @@
results = query(q, resolver);
} catch(e) {
pass = (e.message === "bad ERROR" ||
(e.name == "NamespaceError" && e.code == DOMException.NAMESPACE_ERR));
(e.name == "SyntaxError" && e.code == DOMException.SYNTAX_ERR));
}
assert( pass, type + ": " + name + " Bad Resolver #" + (i+1) + " (" + nq + ")" +

View File

@ -11,7 +11,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=320799
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=320799">Mozilla Bug 320799</a>
<p id="display">
<select id="s" style="width: 100px">
<select id="s" style="width: 100px; -moz-box-sizing: padding-box">
<option>This is a test, it really is a test I tell you</option>
</select>
<select id="s2">

View File

@ -302,6 +302,7 @@ NS_INTERFACE_MAP_BEGIN(nsTextMetrics)
NS_INTERFACE_MAP_END
struct nsCanvasBidiProcessor;
class CanvasRenderingContext2DUserData;
/**
** nsCanvasRenderingContext2D
@ -381,6 +382,7 @@ public:
nsRefPtr<gfxPath> mPath;
};
friend class PathAutoSaveRestore;
friend class CanvasRenderingContext2DUserData;
protected:
nsresult GetImageDataArray(JSContext* aCx, int32_t aX, int32_t aY,
@ -449,6 +451,7 @@ protected:
// If mCanvasElement is not provided, then a docshell is
nsCOMPtr<nsIDocShell> mDocShell;
nsTArray<CanvasRenderingContext2DUserData*> mUserDatas;
// our drawing surfaces, contexts, and layers
nsRefPtr<gfxContext> mThebes;
@ -755,6 +758,40 @@ protected:
friend struct nsCanvasBidiProcessor;
};
class CanvasRenderingContext2DUserData : public LayerUserData {
public:
CanvasRenderingContext2DUserData(nsCanvasRenderingContext2D *aContext)
: mContext(aContext)
{
aContext->mUserDatas.AppendElement(this);
}
~CanvasRenderingContext2DUserData()
{
if (mContext) {
mContext->mUserDatas.RemoveElement(this);
}
}
static void DidTransactionCallback(void* aData)
{
CanvasRenderingContext2DUserData* self =
static_cast<CanvasRenderingContext2DUserData*>(aData);
if (self->mContext) {
self->mContext->MarkContextClean();
}
}
bool IsForContext(nsCanvasRenderingContext2D *aContext)
{
return mContext == aContext;
}
void Forget()
{
mContext = nsnull;
}
private:
nsCanvasRenderingContext2D *mContext;
};
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsCanvasRenderingContext2D)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsCanvasRenderingContext2D)
@ -810,6 +847,10 @@ nsCanvasRenderingContext2D::nsCanvasRenderingContext2D()
nsCanvasRenderingContext2D::~nsCanvasRenderingContext2D()
{
Reset();
// Drop references from all CanvasRenderingContext2DUserDatas to this context
for (PRUint32 i = 0; i < mUserDatas.Length(); ++i) {
mUserDatas[i]->Forget();
}
sNumLivingContexts--;
if (!sNumLivingContexts) {
delete[] sUnpremultiplyTable;
@ -4154,19 +4195,6 @@ nsCanvasRenderingContext2D::SetMozImageSmoothingEnabled(bool val)
static PRUint8 g2DContextLayerUserData;
class CanvasRenderingContext2DUserData : public LayerUserData {
public:
CanvasRenderingContext2DUserData(nsHTMLCanvasElement *aContent)
: mContent(aContent) {}
static void DidTransactionCallback(void* aData)
{
static_cast<CanvasRenderingContext2DUserData*>(aData)->mContent->MarkContextClean();
}
private:
nsRefPtr<nsHTMLCanvasElement> mContent;
};
already_AddRefed<CanvasLayer>
nsCanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
CanvasLayer *aOldLayer,
@ -4175,10 +4203,14 @@ nsCanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
if (!EnsureSurface())
return nsnull;
if (!mResetLayer && aOldLayer &&
aOldLayer->HasUserData(&g2DContextLayerUserData)) {
NS_ADDREF(aOldLayer);
return aOldLayer;
if (!mResetLayer && aOldLayer) {
CanvasRenderingContext2DUserData* userData =
static_cast<CanvasRenderingContext2DUserData*>(
aOldLayer->GetUserData(&g2DContextLayerUserData));
if (userData && userData->IsForContext(this)) {
NS_ADDREF(aOldLayer);
return aOldLayer;
}
}
nsRefPtr<CanvasLayer> canvasLayer = aManager->CreateCanvasLayer();
@ -4200,7 +4232,7 @@ nsCanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
// releasing the reference to the element.
// The userData will receive DidTransactionCallbacks, which flush the
// the invalidation state to indicate that the canvas is up to date.
userData = new CanvasRenderingContext2DUserData(mCanvasElement);
userData = new CanvasRenderingContext2DUserData(this);
canvasLayer->SetDidTransactionCallback(
CanvasRenderingContext2DUserData::DidTransactionCallback, userData);
}

View File

@ -357,6 +357,7 @@ NS_INTERFACE_MAP_BEGIN(nsTextMetricsAzure)
NS_INTERFACE_MAP_END
struct nsCanvasBidiProcessorAzure;
class CanvasRenderingContext2DUserDataAzure;
// Cap sigma to avoid overly large temp surfaces.
static const Float SIGMA_MAX = 100;
@ -423,6 +424,8 @@ public:
nsresult LineTo(const Point& aPoint);
nsresult BezierTo(const Point& aCP1, const Point& aCP2, const Point& aCP3);
friend class CanvasRenderingContext2DUserDataAzure;
protected:
nsresult GetImageDataArray(JSContext* aCx, int32_t aX, int32_t aY,
uint32_t aWidth, uint32_t aHeight,
@ -504,6 +507,8 @@ protected:
// This is needed for drawing in drawAsyncXULElement
bool mIPC;
nsTArray<CanvasRenderingContext2DUserDataAzure*> mUserDatas;
// If mCanvasElement is not provided, then a docshell is
nsCOMPtr<nsIDocShell> mDocShell;
@ -935,6 +940,40 @@ protected:
friend struct nsCanvasBidiProcessorAzure;
};
class CanvasRenderingContext2DUserDataAzure : public LayerUserData {
public:
CanvasRenderingContext2DUserDataAzure(nsCanvasRenderingContext2DAzure *aContext)
: mContext(aContext)
{
aContext->mUserDatas.AppendElement(this);
}
~CanvasRenderingContext2DUserDataAzure()
{
if (mContext) {
mContext->mUserDatas.RemoveElement(this);
}
}
static void DidTransactionCallback(void* aData)
{
CanvasRenderingContext2DUserDataAzure* self =
static_cast<CanvasRenderingContext2DUserDataAzure*>(aData);
if (self->mContext) {
self->mContext->MarkContextClean();
}
}
bool IsForContext(nsCanvasRenderingContext2DAzure *aContext)
{
return mContext == aContext;
}
void Forget()
{
mContext = nsnull;
}
private:
nsCanvasRenderingContext2DAzure *mContext;
};
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsCanvasRenderingContext2DAzure)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsCanvasRenderingContext2DAzure)
@ -1029,6 +1068,10 @@ nsCanvasRenderingContext2DAzure::nsCanvasRenderingContext2DAzure()
nsCanvasRenderingContext2DAzure::~nsCanvasRenderingContext2DAzure()
{
Reset();
// Drop references from all CanvasRenderingContext2DUserDataAzure to this context
for (PRUint32 i = 0; i < mUserDatas.Length(); ++i) {
mUserDatas[i]->Forget();
}
sNumLivingContexts--;
if (!sNumLivingContexts) {
delete[] sUnpremultiplyTable;
@ -4399,19 +4442,6 @@ nsCanvasRenderingContext2DAzure::SetMozImageSmoothingEnabled(bool val)
static PRUint8 g2DContextLayerUserData;
class CanvasRenderingContext2DUserData : public LayerUserData {
public:
CanvasRenderingContext2DUserData(nsHTMLCanvasElement *aContent)
: mContent(aContent) {}
static void DidTransactionCallback(void* aData)
{
static_cast<CanvasRenderingContext2DUserData*>(aData)->mContent->MarkContextClean();
}
private:
nsRefPtr<nsHTMLCanvasElement> mContent;
};
already_AddRefed<CanvasLayer>
nsCanvasRenderingContext2DAzure::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
CanvasLayer *aOldLayer,
@ -4425,18 +4455,22 @@ nsCanvasRenderingContext2DAzure::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
mTarget->Flush();
}
if (!mResetLayer && aOldLayer &&
aOldLayer->HasUserData(&g2DContextLayerUserData)) {
if (!mResetLayer && aOldLayer) {
CanvasRenderingContext2DUserDataAzure* userData =
static_cast<CanvasRenderingContext2DUserDataAzure*>(
aOldLayer->GetUserData(&g2DContextLayerUserData));
if (userData && userData->IsForContext(this)) {
NS_ADDREF(aOldLayer);
return aOldLayer;
}
}
nsRefPtr<CanvasLayer> canvasLayer = aManager->CreateCanvasLayer();
if (!canvasLayer) {
NS_WARNING("CreateCanvasLayer returned null!");
return nsnull;
NS_WARNING("CreateCanvasLayer returned null!");
return nsnull;
}
CanvasRenderingContext2DUserData *userData = nsnull;
CanvasRenderingContext2DUserDataAzure *userData = nsnull;
if (aBuilder->IsPaintingToWindow()) {
// Make the layer tell us whenever a transaction finishes (including
// the current transaction), so we can clear our invalidation state and
@ -4450,9 +4484,9 @@ nsCanvasRenderingContext2DAzure::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
// releasing the reference to the element.
// The userData will receive DidTransactionCallbacks, which flush the
// the invalidation state to indicate that the canvas is up to date.
userData = new CanvasRenderingContext2DUserData(mCanvasElement);
userData = new CanvasRenderingContext2DUserDataAzure(this);
canvasLayer->SetDidTransactionCallback(
CanvasRenderingContext2DUserData::DidTransactionCallback, userData);
CanvasRenderingContext2DUserDataAzure::DidTransactionCallback, userData);
}
canvasLayer->SetUserData(&g2DContextLayerUserData, userData);

View File

@ -96,6 +96,7 @@ nsDOMKeyboardEvent::GetCharCode(PRUint32* aCharCode)
*aCharCode = ((nsKeyEvent*)mEvent)->charCode;
break;
default:
*aCharCode = 0;
break;
}
return NS_OK;

View File

@ -1678,10 +1678,10 @@ nsEventStateManager::IsRemoteTarget(nsIContent* target) {
// <frame/iframe mozbrowser>
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(target);
if (browserFrame) {
bool isRemote = false;
browserFrame->GetReallyIsBrowser(&isRemote);
if (isRemote) {
return true;
bool isBrowser = false;
browserFrame->GetReallyIsBrowser(&isBrowser);
if (isBrowser) {
return !!TabParent::GetFrom(target);
}
}
@ -3872,8 +3872,14 @@ public:
~MouseEnterLeaveDispatcher()
{
for (PRInt32 i = 0; i < mTargets.Count(); ++i) {
mESM->DispatchMouseEvent(mEvent, mType, mTargets[i], mRelatedTarget);
if (mType == NS_MOUSEENTER) {
for (PRInt32 i = mTargets.Count() - 1; i >= 0; --i) {
mESM->DispatchMouseEvent(mEvent, mType, mTargets[i], mRelatedTarget);
}
} else {
for (PRInt32 i = 0; i < mTargets.Count(); ++i) {
mESM->DispatchMouseEvent(mEvent, mType, mTargets[i], mRelatedTarget);
}
}
}

View File

@ -41,6 +41,9 @@ function sendMouseEvent(t, elem) {
synthesizeMouse(elem, r.width / 2, r.height / 2, {type: t});
}
var expectedMouseEnterTargets = [];
var expectedMouseLeaveTargets = [];
function runTests() {
outer = document.getElementById("outertest");
middle = document.getElementById("middletest");
@ -60,6 +63,7 @@ function runTests() {
checkRelatedTarget = true;
expectedRelatedEnter = outside;
expectedRelatedLeave = inner;
expectedMouseEnterTargets = ["outertest", "middletest", "innertest"];
sendMouseEvent("mousemove", inner);
is(mouseentercount, 3, "Unexpected mouseenter event count!");
is(mouseovercount, 1, "Unexpected mouseover event count!");
@ -67,6 +71,7 @@ function runTests() {
is(mouseleavecount, 0, "Unexpected mouseleave event count!");
expectedRelatedEnter = inner;
expectedRelatedLeave = outside;
expectedMouseLeaveTargets = ["innertest", "middletest", "outertest"];
sendMouseEvent("mousemove", outside);
is(mouseentercount, 3, "Unexpected mouseenter event count!");
is(mouseovercount, 1, "Unexpected mouseover event count!");
@ -132,6 +137,10 @@ function runTests() {
function menter(evt) {
++mouseentercount;
evt.stopPropagation();
if (expectedMouseEnterTargets.length) {
var t = expectedMouseEnterTargets.shift();
is(evt.target.id, t, "Wrong event target!");
}
is(evt.bubbles, false, evt.type + " should not bubble!");
is(evt.cancelable, false, evt.type + " is not cancelable!");
is(evt.target, evt.currentTarget, "Wrong event target!");
@ -145,6 +154,10 @@ function menter(evt) {
function mleave(evt) {
++mouseleavecount;
evt.stopPropagation();
if (expectedMouseLeaveTargets.length) {
var t = expectedMouseLeaveTargets.shift();
is(evt.target.id, t, "Wrong event target!");
}
is(evt.bubbles, false, evt.type + " should not bubble!");
is(evt.cancelable, false, evt.type + " is not cancelable!");
is(evt.target, evt.currentTarget, "Wrong event target!");

View File

@ -41,13 +41,13 @@ function t3(id,c,o,s,pid) {
function run_test() {
t3('span1',[0,0,20,20],[12,12,20,20],[0,0,20,20],'td1');
t3('td1' ,[1,1,69,44],[16,16,71,46],[0,0,71,46],'table1');
t3('td1' ,[1,1,69,44],[16,16,71,46],[0,0,69,46],'table1');
t3('tr1' ,[0,0,71,46],[16,16,71,46],[0,0,71,44],'table1');
t3('span2',[10,0,20,20],[27,12,30,20],[0,0,30,20],'td2');
t3('table1',[9,9,85,113],[10,10,103,131],[0,0,103,50],'body');
t3('span2',[10,0,20,20],[27,12,30,20],[0,0,20,20],'td2');
t3('table1',[9,9,85,113],[10,10,103,131],[0,0,85,50],'body');
t3('div1',[10,10,-1,131],[0,0,-1,151],[0,0,-1,85],'body');
t3('span2b',[10,0,20,20],[25,-1,30,20],[0,0,30,20],'body');
t3('span2b',[10,0,20,20],[25,-1,30,20],[0,0,20,20],'body');
// XXX not sure how to make reliable cross-platform tests for replaced-inline, inline
// t3('span2c',[10,2,18,2],[25,-1,30,6],[0,0,30,20],'body');
// t3('span2d',[0,0,0,0],[25,-1,10,19],[0,0,10,20],'body');
@ -60,24 +60,24 @@ function run_test() {
t3('div3',[10,10,-1,40],[0,151,-1,60],[0,0,-1,70],'body');
t3('span5' ,[0,0,20,20],[1,1,20,20],[0,0,20,20],'td5');
t3('td5' ,[7,7,22,22],[2,2,36,36],[0,0,36,36],'table5');
t3('td5' ,[7,7,22,22],[2,2,36,36],[0,0,22,36],'table5');
t3('tr5' ,[0,0,36,36],[2,2,36,36],[0,0,36,22],'table5');
t3('span6' ,[0,0,20,20],[20,58,20,20],[0,0,20,20],'div5');
t3('table5',[0,0,40,78],[0,0,40,78],[0,0,40,78],'div5');
t3('div5',[10,10,-1,78],[0,211,-1,98],[0,0,-1,70],'body');
t3('span7' ,[0,0,20,20],[1,1,20,20],[0,0,20,20],'td7');
t3('td7' ,[1,1,37,22],[9,9,39,24],[0,0,39,22],'table7');
t3('td7' ,[1,1,37,22],[9,9,39,24],[0,0,37,22],'table7');
t3('tr7' ,[0,0,39,24],[9,9,39,24],[0,0,39,22],'table7');
t3('span8' ,[0,0,20,20],[26,37,20,20],[0,0,20,20],'table7');
t3('table7',[7,7,43,54],[10,319,57,68],[0,0,57,50],'body');
t3('table7',[7,7,43,54],[10,319,57,68],[0,0,43,50],'body');
t3('div7',[10,10,-1,68],[0,309,-1,88],[0,0,-1,70],'body');
t3('span9' ,[0,0,20,20],[1,1,20,20],[0,0,20,20],'td9');
t3('td9' ,[1,1,22,22],[15,15,24,24],[0,0,24,24],'table9');
t3('td9' ,[1,1,22,22],[15,15,24,24],[0,0,22,24],'table9');
t3('tr9' ,[0,0,24,24],[15,15,24,24],[0,0,24,22],'table9');
t3('span10' ,[0,0,20,20],[17,43,20,20],[0,0,20,20],'table9');
t3('table9',[13,13,28,34],[10,407,54,60],[0,0,54,50],'body');
t3('table9',[13,13,28,34],[10,407,54,60],[0,0,28,50],'body');
t3('div9',[10,10,-1,0],[0,397,-1,20],[0,0,-1,70],'body');
t3('span11' ,[0,0,20,20],[1,1,20,20],[0,0,20,20],'td11');

View File

@ -68,9 +68,9 @@ function run_test() {
// without hard-coding the scrollbar width?
t3('div1',[20,20,-1,-1],[10,10,200,160],[0,0,230,20],'body');
t3('abs1',[20,20,-1,-1],[500,170,200,160],[0,0,230,20],'body');
t3('table1',[20,20,266,266],[10,170,306,306],[0,0,306,20],'body');
t3('table1',[20,20,266,266],[10,170,306,306],[0,0,266,20],'body');
t3('table2',[0,0,206,206],[0,0,206,206],[0,0,206,20],'table2parent');
t3('table3',[10,10,208,208],[0,0,228,228],[0,0,228,228],'table3parent');
t3('table3',[10,10,208,208],[0,0,228,228],[0,0,208,228],'table3parent');
t3('table3parent',[0,0,228,228],[300,100,228,228],[0,0,228,228],'body');
}
</script>
@ -106,4 +106,4 @@ run_test();
</pre>
</body>
</html>
</html>

View File

@ -549,6 +549,7 @@ MediaStreamGraphImpl::FinishStream(MediaStream* aStream)
{
if (aStream->mFinished)
return;
printf("MediaStreamGraphImpl::FinishStream\n");
LOG(PR_LOG_DEBUG, ("MediaStream %p will finish", aStream));
aStream->mFinished = true;
// Force at least one more iteration of the control loop, since we rely

View File

@ -191,7 +191,7 @@ nsresult nsGStreamerReader::ReadMetadata(nsVideoInfo* aInfo)
* stream but that are otherwise decodeable.
*/
guint flags[3] = {GST_PLAY_FLAG_VIDEO|GST_PLAY_FLAG_AUDIO,
~GST_PLAY_FLAG_AUDIO, ~GST_PLAY_FLAG_VIDEO};
static_cast<guint>(~GST_PLAY_FLAG_AUDIO), static_cast<guint>(~GST_PLAY_FLAG_VIDEO)};
guint default_flags, current_flags;
g_object_get(mPlayBin, "flags", &default_flags, NULL);

View File

@ -369,6 +369,17 @@ nsSVGUseElement::DestroyAnonymousContent()
nsContentUtils::DestroyAnonymousContent(&mClone);
}
bool
nsSVGUseElement::OurWidthAndHeightAreUsed() const
{
if (mClone) {
nsCOMPtr<nsIDOMSVGSVGElement> svg = do_QueryInterface(mClone);
nsCOMPtr<nsIDOMSVGSymbolElement> symbol = do_QueryInterface(mClone);
return svg || symbol;
}
return false;
}
//----------------------------------------------------------------------
// implementation helpers
@ -377,6 +388,7 @@ nsSVGUseElement::SyncWidthOrHeight(nsIAtom* aName)
{
NS_ASSERTION(aName == nsGkAtoms::width || aName == nsGkAtoms::height,
"The clue is in the function name");
NS_ASSERTION(OurWidthAndHeightAreUsed(), "Don't call this");
if (!mClone) {
return;

View File

@ -102,6 +102,12 @@ protected:
virtual LengthAttributesInfo GetLengthInfo();
virtual StringAttributesInfo GetStringInfo();
/**
* Returns true if our width and height should be used, or false if they
* should be ignored. As per the spec, this depends on the type of the
* element that we're referencing.
*/
bool OurWidthAndHeightAreUsed() const;
void SyncWidthOrHeight(nsIAtom *aName);
void LookupHref();
void TriggerReclone();

View File

@ -78,98 +78,327 @@ XBLFinalize(JSFreeOp *fop, JSObject *obj)
c->Drop();
}
static JSBool
XBLResolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags,
JSObject **objp)
// XBL fields are represented on elements inheriting that field a bit trickily.
// Initially the element itself won't have a property for the field. When an
// attempt is made to access the field, the element's resolve hook won't find
// it. But the XBL prototype object, in the prototype chain of the element,
// will resolve an accessor property for the field on the XBL prototype object.
// That accessor, when used, will then (via InstallXBLField below) reify a
// property for the field onto the actual XBL-backed element.
//
// The accessor property is a plain old property backed by a getter function and
// a setter function. These properties are backed by the FieldGetter and
// FieldSetter natives; they're created by XBLResolve. The precise field to be
// reified is identified using two extra slots on the getter/setter functions.
// XBLPROTO_SLOT stores the XBL prototype object that provides the field.
// FIELD_SLOT stores the name of the field, i.e. its JavaScript property name.
//
// This two-step field installation process -- reify an accessor on the
// prototype, then have that reify an own property on the actual element -- is
// admittedly convoluted. Better would be for XBL-backed elements to be proxies
// that could resolve fields onto themselves. But given that XBL bindings are
// associated with elements mutably -- you can add/remove/change -moz-binding
// whenever you want, alas -- doing so would require all elements to be proxies,
// which isn't performant now. So we do this two-step instead.
static const uint32_t XBLPROTO_SLOT = 0;
static const uint32_t FIELD_SLOT = 1;
static bool
ObjectHasISupportsPrivate(JS::Handle<JSObject*> obj)
{
// Note: if we get here, that means that the implementation for some binding
// was installed, which means that AllowScripts() tested true. Hence no need
// to do checks like that here.
// Default to not resolving things.
NS_ASSERTION(*objp, "Must have starting object");
JSClass* clasp = ::JS_GetClass(obj);
const uint32_t HAS_PRIVATE_NSISUPPORTS =
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS;
return (clasp->flags & HAS_PRIVATE_NSISUPPORTS) == HAS_PRIVATE_NSISUPPORTS;
}
JSObject* origObj = *objp;
*objp = NULL;
// Define a shadowing property on |this| for the XBL field defined by the
// contents of the callee's reserved slots. If the property was defined,
// *installed will be true, and idp will be set to the property name that was
// defined.
static JSBool
InstallXBLField(JSContext* cx,
JS::Handle<JSObject*> callee, JS::Handle<JSObject*> thisObj,
jsid* idp, bool* installed)
{
*installed = false;
if (!JSID_IS_STRING(id)) {
return JS_TRUE;
}
nsDependentJSString fieldName(id);
jsval slotVal = ::JS_GetReservedSlot(obj, 0);
NS_ASSERTION(!JSVAL_IS_VOID(slotVal), "How did that happen?");
nsXBLPrototypeBinding* protoBinding =
static_cast<nsXBLPrototypeBinding*>(JSVAL_TO_PRIVATE(slotVal));
NS_ASSERTION(protoBinding, "Must have prototype binding!");
nsXBLProtoImplField* field = protoBinding->FindField(fieldName);
if (!field) {
return JS_TRUE;
}
// We have this field. Time to install it. Get our node.
JSClass* nodeClass = ::JS_GetClass(origObj);
if (!nodeClass) {
return JS_FALSE;
}
if (~nodeClass->flags &
(JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS)) {
xpc::Throw(cx, NS_ERROR_UNEXPECTED);
return JS_FALSE;
}
// First ensure |this| is a reasonable XBL bound node.
//
// FieldAccessorGuard already determined whether |thisObj| was acceptable as
// |this| in terms of not throwing a TypeError. Assert this for good measure.
MOZ_ASSERT(ObjectHasISupportsPrivate(thisObj));
// But there are some cases where we must accept |thisObj| but not install a
// property on it, or otherwise touch it. Hence this split of |this|-vetting
// duties.
nsCOMPtr<nsIXPConnectWrappedNative> xpcWrapper =
do_QueryInterface(static_cast<nsISupports*>(::JS_GetPrivate(origObj)));
do_QueryInterface(static_cast<nsISupports*>(::JS_GetPrivate(thisObj)));
if (!xpcWrapper) {
// Looks like whatever |origObj| is it's not our nsIContent. It might well
// Looks like whatever |thisObj| is it's not our nsIContent. It might well
// be the proto our binding installed, however, where the private is the
// nsXBLDocumentInfo, so just baul out quietly. Do NOT throw an exception
// here.
// We could make this stricter by checking the class maybe, but whatever
return JS_TRUE;
//
// We could make this stricter by checking the class maybe, but whatever.
return true;
}
nsCOMPtr<nsIContent> content = do_QueryWrappedNative(xpcWrapper);
if (!content) {
nsCOMPtr<nsIContent> xblNode = do_QueryWrappedNative(xpcWrapper);
if (!xblNode) {
xpc::Throw(cx, NS_ERROR_UNEXPECTED);
return JS_FALSE;
return false;
}
// Now that |this| is okay, actually install the field. Some of this
// installation work could have been done in XBLResolve, but this splitting
// of work seems simplest to implement and friendliest regarding lifetimes
// and potential cycles.
// Because of the possibility (due to XBL binding inheritance, because each
// XBL binding lives in its own global object) that |this| might be in a
// different compartment from the callee (not to mention that this method can
// be called with an arbitrary |this| regardless of how insane XBL is), and
// because in this method we've entered |this|'s compartment (see in
// Field[GS]etter where we attempt a cross-compartment call), we must enter
// the callee's compartment to access its reserved slots.
nsXBLPrototypeBinding* protoBinding;
nsDependentJSString fieldName;
{
JSAutoEnterCompartment ac;
if (!ac.enter(cx, callee)) {
return false;
}
JS::Rooted<JSObject*> xblProto(cx);
xblProto = &js::GetFunctionNativeReserved(callee, XBLPROTO_SLOT).toObject();
JS::Value name = js::GetFunctionNativeReserved(callee, FIELD_SLOT);
JSFlatString* fieldStr = JS_ASSERT_STRING_IS_FLAT(name.toString());
fieldName.init(fieldStr);
MOZ_ALWAYS_TRUE(JS_ValueToId(cx, name, idp));
JS::Value slotVal = ::JS_GetReservedSlot(xblProto, 0);
protoBinding = static_cast<nsXBLPrototypeBinding*>(slotVal.toPrivate());
MOZ_ASSERT(protoBinding);
}
nsXBLProtoImplField* field = protoBinding->FindField(fieldName);
MOZ_ASSERT(field);
// This mirrors code in nsXBLProtoImpl::InstallImplementation
nsIDocument* doc = content->OwnerDoc();
nsIScriptGlobalObject* global = doc->GetScriptGlobalObject();
nsIScriptGlobalObject* global = xblNode->OwnerDoc()->GetScriptGlobalObject();
if (!global) {
return JS_TRUE;
return true;
}
nsCOMPtr<nsIScriptContext> context = global->GetContext();
if (!context) {
return JS_TRUE;
return true;
}
nsresult rv = field->InstallField(context, thisObj, xblNode->NodePrincipal(),
protoBinding->DocURI(), installed);
if (NS_SUCCEEDED(rv)) {
return true;
}
// Now we either resolve or fail
bool didInstall;
nsresult rv = field->InstallField(context, origObj,
content->NodePrincipal(),
protoBinding->DocURI(),
&didInstall);
if (NS_FAILED(rv)) {
if (!::JS_IsExceptionPending(cx)) {
xpc::Throw(cx, rv);
return JS_FALSE;
}
return false;
}
// Determine whether the |this| passed to this method is valid for an XBL field
// access (which is to say, an object with an nsISupports private), taking into
// account proxies and/or wrappers around |this|. There are three possible
// outcomes from calling this method:
//
// 1. An error was hit, and this method returned false. In this case, the
// caller should propagate it.
// 2. The |this| passed in was directly acceptable for XBL field access. This
// method returned true and set *thisObj to a |this| that can be used for
// field definition (i.e. that passes ObjectHasISupportsPrivate). In this
// case, the caller should install the field on *thisObj.
// 3. The |this| passed in was a proxy/wrapper around an object usable for
// XBL field access. The method recursively (and successfully) invoked the
// native on the unwrapped |this|, then it returned true and set *thisObj
// to null. In this case, the caller should itself return true.
//
// Thus this method implements the JS_CallNonGenericMethodOnProxy idiom in
// jsapi.h.
//
// Note that a |this| valid for field access is *not* necessarily one on which
// the field value will be installed. It's just one where calling the specified
// method on it won't unconditionally throw a TypeError. Confusing? Perhaps,
// but it's compatible with what we did before we implemented XBL fields using
// this technique.
inline bool
FieldAccessorGuard(JSContext *cx, unsigned argc, JS::Value *vp, JSNative native, JSObject **thisObj)
{
JS::Rooted<JSObject*> obj(cx, JS_THIS_OBJECT(cx, vp));
if (!obj) {
xpc::Throw(cx, NS_ERROR_UNEXPECTED);
return false;
}
if (didInstall) {
*objp = origObj;
if (ObjectHasISupportsPrivate(obj)) {
*thisObj = obj;
return true;
}
// else we didn't resolve this field after all
return JS_TRUE;
// |this| wasn't an unwrapped object passing the has-private-nsISupports test.
// So try to unwrap |this| and recursively call the native on it.
//
// This |protoClass| gunk is needed for the JS engine to report an error if an
// object of the wrong class was passed as |this|, so that it can complain
// that it expected an object of type |protoClass|. It would be better if the
// error didn't try to specify the expected class of objects -- particularly
// because there's no one class of objects -- but it's what the API wants, so
// pass a class that's marginally correct as an answer.
JSClass* protoClass;
{
JS::Rooted<JSObject*> callee(cx, &JS_CALLEE(cx, vp).toObject());
JS::Rooted<JSObject*> xblProto(cx);
xblProto = &js::GetFunctionNativeReserved(callee, XBLPROTO_SLOT).toObject();
JSAutoEnterCompartment ac;
if (!ac.enter(cx, xblProto)) {
return false;
}
protoClass = ::JS_GetClass(xblProto);
}
*thisObj = NULL;
return JS_CallNonGenericMethodOnProxy(cx, argc, vp, native, protoClass);
}
static JSBool
FieldGetter(JSContext *cx, unsigned argc, JS::Value *vp)
{
JS::Rooted<JSObject*> thisObj(cx);
if (!FieldAccessorGuard(cx, argc, vp, FieldGetter, thisObj.address())) {
return false;
}
if (!thisObj) {
return true; // FieldGetter was recursively invoked on an unwrapped |this|
}
bool installed = false;
JS::Rooted<JSObject*> callee(cx, &JS_CALLEE(cx, vp).toObject());
JS::Rooted<jsid> id(cx);
if (!InstallXBLField(cx, callee, thisObj, id.address(), &installed)) {
return false;
}
if (!installed) {
JS_SET_RVAL(cx, vp, JS::UndefinedValue());
return true;
}
JS::Rooted<JS::Value> v(cx);
if (!JS_GetPropertyById(cx, thisObj, id, v.address())) {
return false;
}
JS_SET_RVAL(cx, vp, v);
return true;
}
static JSBool
FieldSetter(JSContext *cx, unsigned argc, JS::Value *vp)
{
JS::Rooted<JSObject*> thisObj(cx);
if (!FieldAccessorGuard(cx, argc, vp, FieldSetter, thisObj.address())) {
return false;
}
if (!thisObj) {
return true; // FieldSetter was recursively invoked on an unwrapped |this|
}
bool installed = false;
JS::Rooted<JSObject*> callee(cx, &JS_CALLEE(cx, vp).toObject());
JS::Rooted<jsid> id(cx);
if (!InstallXBLField(cx, callee, thisObj, id.address(), &installed)) {
return false;
}
JS::Rooted<JS::Value> v(cx,
argc > 0 ? JS_ARGV(cx, vp)[0] : JS::UndefinedValue());
return JS_SetPropertyById(cx, thisObj, id, v.address());
}
static JSBool
XBLResolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags,
JSObject **objp)
{
*objp = NULL;
if (!JSID_IS_STRING(id)) {
return true;
}
nsXBLPrototypeBinding* protoBinding =
static_cast<nsXBLPrototypeBinding*>(::JS_GetReservedSlot(obj, 0).toPrivate());
MOZ_ASSERT(protoBinding);
// If the field's not present, don't resolve it. Also don't resolve it if the
// field is empty; see also nsXBLProtoImplField::InstallField which also must
// implement the not-empty requirement.
nsDependentJSString fieldName(id);
nsXBLProtoImplField* field = protoBinding->FindField(fieldName);
if (!field || field->IsEmpty()) {
return true;
}
// We have a field: now install a getter/setter pair which will resolve the
// field onto the actual object, when invoked.
JS::Rooted<JSObject*> global(cx, JS_GetGlobalForObject(cx, obj));
JS::Rooted<JSObject*> get(cx);
get = ::JS_GetFunctionObject(js::NewFunctionByIdWithReserved(cx, FieldGetter,
0, 0, global,
id));
if (!get) {
return false;
}
js::SetFunctionNativeReserved(get, XBLPROTO_SLOT, JS::ObjectValue(*obj));
js::SetFunctionNativeReserved(get, FIELD_SLOT,
JS::StringValue(JSID_TO_STRING(id)));
JS::Rooted<JSObject*> set(cx);
set = ::JS_GetFunctionObject(js::NewFunctionByIdWithReserved(cx, FieldSetter,
1, 0, global,
id));
if (!set) {
return false;
}
js::SetFunctionNativeReserved(set, XBLPROTO_SLOT, JS::ObjectValue(*obj));
js::SetFunctionNativeReserved(set, FIELD_SLOT,
JS::StringValue(JSID_TO_STRING(id)));
if (!::JS_DefinePropertyById(cx, obj, id, JS::UndefinedValue(),
JS_DATA_TO_FUNC_PTR(JSPropertyOp,
get.reference()),
JS_DATA_TO_FUNC_PTR(JSStrictPropertyOp,
set.reference()),
field->AccessorAttributes())) {
return false;
}
*objp = obj;
return true;
}
static JSBool
XBLEnumerate(JSContext *cx, JS::Handle<JSObject*> obj)
{
nsXBLPrototypeBinding* protoBinding =
static_cast<nsXBLPrototypeBinding*>(::JS_GetReservedSlot(obj, 0).toPrivate());
MOZ_ASSERT(protoBinding);
return protoBinding->ResolveAllFields(cx, obj);
}
nsXBLJSClass::nsXBLJSClass(const nsAFlatCString& aClassName)
@ -179,12 +408,12 @@ nsXBLJSClass::nsXBLJSClass(const nsAFlatCString& aClassName)
name = ToNewCString(aClassName);
flags =
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS |
JSCLASS_NEW_RESOLVE | JSCLASS_NEW_RESOLVE_GETS_START |
JSCLASS_NEW_RESOLVE |
// Our one reserved slot holds the relevant nsXBLPrototypeBinding
JSCLASS_HAS_RESERVED_SLOTS(1);
addProperty = delProperty = getProperty = ::JS_PropertyStub;
setProperty = ::JS_StrictPropertyStub;
enumerate = ::JS_EnumerateStub;
enumerate = XBLEnumerate;
resolve = (JSResolveOp)XBLResolve;
convert = ::JS_ConvertStub;
finalize = XBLFinalize;

View File

@ -88,7 +88,8 @@ nsXBLProtoImplField::InstallField(nsIScriptContext* aContext,
*aDidInstall = false;
if (mFieldTextLength == 0) {
// Empty fields are treated as not actually present.
if (IsEmpty()) {
return NS_OK;
}

View File

@ -41,6 +41,13 @@ public:
const PRUnichar* GetName() const { return mName; }
unsigned AccessorAttributes() const {
return JSPROP_SHARED | JSPROP_GETTER | JSPROP_SETTER |
(mJSAttributes & (JSPROP_ENUMERATE | JSPROP_PERMANENT));
}
bool IsEmpty() const { return mFieldTextLength == 0; }
protected:
nsXBLProtoImplField* mNext;
PRUnichar* mName;

View File

@ -116,8 +116,9 @@ addLoadEvent(function() {
is(found, true, "Enumeration is broken");
is(d.four, 9, "Shouldn't have rerun field six");
is(d.five, 5, "Should have run field 7");
is(d.five, 11, "Shouldn't have run field 7");
is(d.seven, 7, "Should be 7")
is(d.five, 5, "Should have run field 7");
d = $("display2");
is(typeof(d.eight), "undefined", "Recursive resolve should bail out");

Some files were not shown because too many files have changed in this diff Show More