mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge last PGO-green changeset of mozilla-inbound to mozilla-central
This commit is contained in:
commit
462ae26b9e
@ -362,73 +362,59 @@ nsAccessibleWrap::GetAtkObject(nsIAccessible * acc)
|
||||
PRUint16
|
||||
nsAccessibleWrap::CreateMaiInterfaces(void)
|
||||
{
|
||||
PRUint16 interfacesBits = 0;
|
||||
PRUint16 interfacesBits = 0;
|
||||
|
||||
// Add Interfaces for each nsIAccessible.ext interfaces
|
||||
|
||||
// the Component interface are supported by all nsIAccessible
|
||||
interfacesBits |= 1 << MAI_INTERFACE_COMPONENT;
|
||||
// The Component interface is supported by all accessibles.
|
||||
interfacesBits |= 1 << MAI_INTERFACE_COMPONENT;
|
||||
|
||||
// Add Action interface if the action count is more than zero.
|
||||
if (ActionCount() > 0)
|
||||
interfacesBits |= 1 << MAI_INTERFACE_ACTION;
|
||||
|
||||
//nsIAccessibleText
|
||||
nsCOMPtr<nsIAccessibleText> accessInterfaceText;
|
||||
QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accessInterfaceText));
|
||||
if (accessInterfaceText) {
|
||||
interfacesBits |= 1 << MAI_INTERFACE_TEXT;
|
||||
}
|
||||
// Text, Editabletext, and Hypertext interface.
|
||||
nsHyperTextAccessible* hyperText = AsHyperText();
|
||||
if (hyperText && hyperText->IsTextRole()) {
|
||||
interfacesBits |= 1 << MAI_INTERFACE_TEXT;
|
||||
interfacesBits |= 1 << MAI_INTERFACE_EDITABLE_TEXT;
|
||||
if (!nsAccUtils::MustPrune(this))
|
||||
interfacesBits |= 1 << MAI_INTERFACE_HYPERTEXT;
|
||||
}
|
||||
|
||||
//nsIAccessibleEditableText
|
||||
nsCOMPtr<nsIAccessibleEditableText> accessInterfaceEditableText;
|
||||
QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
|
||||
getter_AddRefs(accessInterfaceEditableText));
|
||||
if (accessInterfaceEditableText) {
|
||||
interfacesBits |= 1 << MAI_INTERFACE_EDITABLE_TEXT;
|
||||
}
|
||||
// Value interface.
|
||||
nsCOMPtr<nsIAccessibleValue> accessInterfaceValue;
|
||||
QueryInterface(NS_GET_IID(nsIAccessibleValue),
|
||||
getter_AddRefs(accessInterfaceValue));
|
||||
if (accessInterfaceValue) {
|
||||
interfacesBits |= 1 << MAI_INTERFACE_VALUE;
|
||||
}
|
||||
|
||||
//nsIAccessibleValue
|
||||
nsCOMPtr<nsIAccessibleValue> accessInterfaceValue;
|
||||
QueryInterface(NS_GET_IID(nsIAccessibleValue),
|
||||
getter_AddRefs(accessInterfaceValue));
|
||||
if (accessInterfaceValue) {
|
||||
interfacesBits |= 1 << MAI_INTERFACE_VALUE;
|
||||
}
|
||||
// Document interface.
|
||||
if (IsDoc())
|
||||
interfacesBits |= 1 << MAI_INTERFACE_DOCUMENT;
|
||||
|
||||
// document accessible
|
||||
if (IsDoc())
|
||||
interfacesBits |= 1 << MAI_INTERFACE_DOCUMENT;
|
||||
if (IsImage())
|
||||
interfacesBits |= 1 << MAI_INTERFACE_IMAGE;
|
||||
|
||||
if (IsImageAccessible())
|
||||
interfacesBits |= 1 << MAI_INTERFACE_IMAGE;
|
||||
|
||||
// HyperLinkAccessible
|
||||
// HyperLink interface.
|
||||
if (IsLink())
|
||||
interfacesBits |= 1 << MAI_INTERFACE_HYPERLINK_IMPL;
|
||||
|
||||
if (!nsAccUtils::MustPrune(this)) { // These interfaces require children
|
||||
//nsIAccessibleHypertext
|
||||
if (IsHyperText()) {
|
||||
interfacesBits |= 1 << MAI_INTERFACE_HYPERTEXT;
|
||||
}
|
||||
|
||||
//nsIAccessibleTable
|
||||
nsCOMPtr<nsIAccessibleTable> accessInterfaceTable;
|
||||
QueryInterface(NS_GET_IID(nsIAccessibleTable),
|
||||
getter_AddRefs(accessInterfaceTable));
|
||||
if (accessInterfaceTable) {
|
||||
interfacesBits |= 1 << MAI_INTERFACE_TABLE;
|
||||
}
|
||||
|
||||
//nsIAccessibleSelection
|
||||
if (IsSelect()) {
|
||||
interfacesBits |= 1 << MAI_INTERFACE_SELECTION;
|
||||
}
|
||||
if (!nsAccUtils::MustPrune(this)) { // These interfaces require children
|
||||
// Table interface.
|
||||
nsCOMPtr<nsIAccessibleTable> accessInterfaceTable;
|
||||
QueryInterface(NS_GET_IID(nsIAccessibleTable),
|
||||
getter_AddRefs(accessInterfaceTable));
|
||||
if (accessInterfaceTable) {
|
||||
interfacesBits |= 1 << MAI_INTERFACE_TABLE;
|
||||
}
|
||||
|
||||
// Selection interface.
|
||||
if (IsSelect()) {
|
||||
interfacesBits |= 1 << MAI_INTERFACE_SELECTION;
|
||||
}
|
||||
}
|
||||
|
||||
return interfacesBits;
|
||||
return interfacesBits;
|
||||
}
|
||||
|
||||
static GType
|
||||
|
@ -14,35 +14,35 @@ extern "C" {
|
||||
const gchar* getDescriptionCB(AtkObject* aAtkObj);
|
||||
|
||||
static void
|
||||
getImagePositionCB(AtkImage *aImage, gint *aAccX, gint *aAccY,
|
||||
getImagePositionCB(AtkImage* aImage, gint* aAccX, gint* aAccY,
|
||||
AtkCoordType aCoordType)
|
||||
{
|
||||
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aImage));
|
||||
if (!accWrap || !accWrap->IsImageAccessible())
|
||||
return;
|
||||
nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aImage));
|
||||
if (!accWrap || !accWrap->IsImage())
|
||||
return;
|
||||
|
||||
nsHTMLImageAccessible* image = accWrap->AsImage();
|
||||
PRUint32 geckoCoordType = (aCoordType == ATK_XY_WINDOW) ?
|
||||
nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE;
|
||||
// Returned in screen coordinates
|
||||
image->GetImagePosition(geckoCoordType, aAccX, aAccY);
|
||||
nsHTMLImageAccessible* image = accWrap->AsImage();
|
||||
PRUint32 geckoCoordType = (aCoordType == ATK_XY_WINDOW) ?
|
||||
nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE;
|
||||
// Returned in screen coordinates
|
||||
image->GetImagePosition(geckoCoordType, aAccX, aAccY);
|
||||
}
|
||||
|
||||
static const gchar*
|
||||
getImageDescriptionCB(AtkImage *aImage)
|
||||
getImageDescriptionCB(AtkImage* aImage)
|
||||
{
|
||||
return getDescriptionCB(ATK_OBJECT(aImage));
|
||||
return getDescriptionCB(ATK_OBJECT(aImage));
|
||||
}
|
||||
|
||||
static void
|
||||
getImageSizeCB(AtkImage *aImage, gint *aAccWidth, gint *aAccHeight)
|
||||
getImageSizeCB(AtkImage* aImage, gint* aAccWidth, gint* aAccHeight)
|
||||
{
|
||||
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aImage));
|
||||
if (!accWrap || !accWrap->IsImageAccessible())
|
||||
return;
|
||||
nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aImage));
|
||||
if (!accWrap || !accWrap->IsImage())
|
||||
return;
|
||||
|
||||
accWrap->AsImage()->GetImageSize(aAccWidth, aAccHeight);
|
||||
accWrap->AsImage()->GetImageSize(aAccWidth, aAccHeight);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,14 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AccEvent, Release)
|
||||
nsAccessible*
|
||||
AccEvent::GetAccessibleForNode() const
|
||||
{
|
||||
return mNode ? GetAccService()->GetAccessible(mNode, nsnull) : nsnull;
|
||||
if (mNode) {
|
||||
nsDocAccessible* document =
|
||||
GetAccService()->GetDocAccessible(mNode->OwnerDoc());
|
||||
if (document)
|
||||
return document->GetAccessible(mNode);
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -345,15 +345,8 @@ FocusManager::FocusedDOMNode() const
|
||||
}
|
||||
|
||||
// Otherwise the focus can be on DOM document.
|
||||
nsCOMPtr<nsIDOMWindow> focusedWnd;
|
||||
DOMFocusManager->GetFocusedWindow(getter_AddRefs(focusedWnd));
|
||||
if (focusedWnd) {
|
||||
nsCOMPtr<nsIDOMDocument> DOMDoc;
|
||||
focusedWnd->GetDocument(getter_AddRefs(DOMDoc));
|
||||
nsCOMPtr<nsIDocument> DOMDocNode(do_QueryInterface(DOMDoc));
|
||||
return DOMDocNode;
|
||||
}
|
||||
return nsnull;
|
||||
nsPIDOMWindow* focusedWnd = DOMFocusManager->GetFocusedWindow();
|
||||
return focusedWnd ? focusedWnd->GetExtantDoc() : nsnull;
|
||||
}
|
||||
|
||||
nsIDocument*
|
||||
|
@ -461,7 +461,7 @@ public:
|
||||
inline bool IsHTMLListItem() const { return mFlags & eHTMLListItemAccessible; }
|
||||
mozilla::a11y::HTMLLIAccessible* AsHTMLListItem();
|
||||
|
||||
inline bool IsImageAccessible() const { return mFlags & eImageAccessible; }
|
||||
inline bool IsImage() const { return mFlags & eImageAccessible; }
|
||||
nsHTMLImageAccessible* AsImage();
|
||||
|
||||
bool IsImageMapAccessible() const { return mFlags & eImageMapAccessible; }
|
||||
|
@ -80,24 +80,14 @@ ARIAGridAccessible::RowCount()
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ARIAGridAccessible::GetCellAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
|
||||
nsIAccessible** aCell)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCell);
|
||||
*aCell = nsnull;
|
||||
nsAccessible*
|
||||
ARIAGridAccessible::CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex)
|
||||
{
|
||||
nsAccessible* row = GetRowAt(aRowIndex);
|
||||
if (!row)
|
||||
return nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAccessible *row = GetRowAt(aRowIndex);
|
||||
NS_ENSURE_ARG(row);
|
||||
|
||||
nsAccessible *cell = GetCellInRowAt(row, aColumnIndex);
|
||||
NS_ENSURE_ARG(cell);
|
||||
|
||||
NS_ADDREF(*aCell = cell);
|
||||
return NS_OK;
|
||||
return GetCellInRowAt(row, aColumnIndex);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
// TableAccessible
|
||||
virtual PRUint32 ColCount();
|
||||
virtual PRUint32 RowCount();
|
||||
virtual nsAccessible* CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex);
|
||||
virtual void UnselectCol(PRUint32 aColIdx);
|
||||
virtual void UnselectRow(PRUint32 aRowIdx);
|
||||
|
||||
|
@ -102,17 +102,10 @@ role
|
||||
RootAccessible::NativeRole()
|
||||
{
|
||||
// If it's a <dialog> or <wizard>, use roles::DIALOG instead
|
||||
dom::Element *root = mDocument->GetRootElement();
|
||||
if (root) {
|
||||
nsCOMPtr<nsIDOMElement> rootElement(do_QueryInterface(root));
|
||||
if (rootElement) {
|
||||
nsAutoString name;
|
||||
rootElement->GetLocalName(name);
|
||||
if (name.EqualsLiteral("dialog") || name.EqualsLiteral("wizard")) {
|
||||
return roles::DIALOG; // Always at the root
|
||||
}
|
||||
}
|
||||
}
|
||||
dom::Element* rootElm = mDocument->GetRootElement();
|
||||
if (rootElm && (rootElm->Tag() == nsGkAtoms::dialog ||
|
||||
rootElm->Tag() == nsGkAtoms::wizard))
|
||||
return roles::DIALOG;
|
||||
|
||||
return nsDocAccessibleWrap::NativeRole();
|
||||
}
|
||||
@ -144,33 +137,28 @@ RootAccessible::GetChromeFlags()
|
||||
PRUint64
|
||||
RootAccessible::NativeState()
|
||||
{
|
||||
PRUint64 states = nsDocAccessibleWrap::NativeState();
|
||||
PRUint64 state = nsDocAccessibleWrap::NativeState();
|
||||
if (state & states::DEFUNCT)
|
||||
return state;
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
PRUint32 chromeFlags = GetChromeFlags();
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE)
|
||||
states |= states::SIZEABLE;
|
||||
state |= states::SIZEABLE;
|
||||
// If it has a titlebar it's movable
|
||||
// XXX unless it's minimized or maximized, but not sure
|
||||
// how to detect that
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_TITLEBAR)
|
||||
states |= states::MOVEABLE;
|
||||
state |= states::MOVEABLE;
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_MODAL)
|
||||
states |= states::MODAL;
|
||||
state |= states::MODAL;
|
||||
#endif
|
||||
|
||||
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (fm) {
|
||||
nsCOMPtr<nsIDOMWindow> rootWindow;
|
||||
GetWindow(getter_AddRefs(rootWindow));
|
||||
if (fm && fm->GetActiveWindow() == mDocument->GetWindow())
|
||||
state |= states::ACTIVE;
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> activeWindow;
|
||||
fm->GetActiveWindow(getter_AddRefs(activeWindow));
|
||||
if (activeWindow == rootWindow)
|
||||
states |= states::ACTIVE;
|
||||
}
|
||||
|
||||
return states;
|
||||
return state;
|
||||
}
|
||||
|
||||
const char* const docEvents[] = {
|
||||
|
@ -77,7 +77,7 @@ private:
|
||||
inline nsHTMLImageAccessible*
|
||||
nsAccessible::AsImage()
|
||||
{
|
||||
return IsImageAccessible() ?
|
||||
return IsImage() ?
|
||||
static_cast<nsHTMLImageAccessible*>(this) : nsnull;
|
||||
}
|
||||
|
||||
|
@ -533,6 +533,8 @@ PRUint32
|
||||
nsHTMLTableAccessible::ColCount()
|
||||
{
|
||||
nsITableLayout* tableLayout = GetTableLayout();
|
||||
if (!tableLayout)
|
||||
return 0;
|
||||
|
||||
PRInt32 rowCount = 0, colCount = 0;
|
||||
tableLayout->GetTableSize(rowCount, colCount);
|
||||
@ -543,6 +545,8 @@ PRUint32
|
||||
nsHTMLTableAccessible::RowCount()
|
||||
{
|
||||
nsITableLayout* tableLayout = GetTableLayout();
|
||||
if (!tableLayout)
|
||||
return 0;
|
||||
|
||||
PRInt32 rowCount = 0, colCount = 0;
|
||||
tableLayout->GetTableSize(rowCount, colCount);
|
||||
@ -842,28 +846,23 @@ nsHTMLTableAccessible::GetSelectedRowIndices(PRUint32 *aNumRows,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetCellAt(PRInt32 aRow, PRInt32 aColumn,
|
||||
nsIAccessible **aTableCellAccessible)
|
||||
{
|
||||
nsAccessible*
|
||||
nsHTMLTableAccessible::CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> cellElement;
|
||||
nsresult rv = GetCellAt(aRow, aColumn, *getter_AddRefs(cellElement));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
GetCellAt(aRowIndex, aColumnIndex, *getter_AddRefs(cellElement));
|
||||
if (!cellElement)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIContent> cellContent(do_QueryInterface(cellElement));
|
||||
if (!cellContent)
|
||||
return nsnull;
|
||||
|
||||
nsAccessible* cell = mDoc->GetAccessible(cellContent);
|
||||
|
||||
if (!cell) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (cell != this) {
|
||||
// XXX bug 576838: crazy tables (like table6 in tables/test_table2.html) may
|
||||
// return itself as a cell what makes Orca hang.
|
||||
NS_ADDREF(*aTableCellAccessible = cell);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
// XXX bug 576838: crazy tables (like table6 in tables/test_table2.html) may
|
||||
// return itself as a cell what makes Orca hang.
|
||||
return cell == this ? nsnull : cell;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
|
@ -99,6 +99,7 @@ public:
|
||||
virtual void Summary(nsString& aSummary);
|
||||
virtual PRUint32 ColCount();
|
||||
virtual PRUint32 RowCount();
|
||||
virtual nsAccessible* CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex);
|
||||
virtual PRInt32 CellIndexAt(PRUint32 aRowIdx, PRUint32 aColIdx);
|
||||
virtual void UnselectCol(PRUint32 aColIdx);
|
||||
virtual void UnselectRow(PRUint32 aRowIdx);
|
||||
|
@ -74,6 +74,7 @@ var AccessFu = {
|
||||
this.chromeWin.addEventListener('resize', this, true);
|
||||
this.chromeWin.addEventListener('scroll', this, true);
|
||||
this.chromeWin.addEventListener('TabOpen', this, true);
|
||||
this.chromeWin.addEventListener('focus', this, true);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -96,6 +97,7 @@ var AccessFu = {
|
||||
this.chromeWin.removeEventListener('resize', this, true);
|
||||
this.chromeWin.removeEventListener('scroll', this, true);
|
||||
this.chromeWin.removeEventListener('TabOpen', this, true);
|
||||
this.chromeWin.removeEventListener('focus', this, true);
|
||||
},
|
||||
|
||||
_processPreferences: function _processPreferences(aPref) {
|
||||
@ -130,6 +132,19 @@ var AccessFu = {
|
||||
|
||||
handleEvent: function handleEvent(aEvent) {
|
||||
switch (aEvent.type) {
|
||||
case 'focus':
|
||||
{
|
||||
if (aEvent.target instanceof Ci.nsIDOMWindow) {
|
||||
let docAcc = getAccessible(aEvent.target.document);
|
||||
let docContext = new PresenterContext(docAcc, null);
|
||||
let cursorable = docAcc.QueryInterface(Ci.nsIAccessibleCursorable);
|
||||
let vcContext = new PresenterContext(
|
||||
(cursorable) ? cursorable.virtualCursor.position : null, null);
|
||||
this.presenters.forEach(
|
||||
function(p) { p.tabSelected(docContext, vcContext); });
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'TabOpen':
|
||||
{
|
||||
let browser = aEvent.target.linkedBrowser || aEvent.target;
|
||||
@ -202,7 +217,8 @@ var AccessFu = {
|
||||
let position = pivot.position;
|
||||
let doc = aEvent.DOMNode;
|
||||
|
||||
if (doc instanceof Ci.nsIDOMDocument && position.DOMNode) {
|
||||
if (position && position.DOMNode &&
|
||||
doc instanceof Ci.nsIDOMDocument) {
|
||||
// Set the caret to the start of the pivot position, and move
|
||||
// the focus in the same manner as browse with caret mode.
|
||||
// This blurs the focus on the previous pivot position (if it
|
||||
@ -307,20 +323,6 @@ var AccessFu = {
|
||||
);
|
||||
break;
|
||||
}
|
||||
case Ci.nsIAccessibleEvent.EVENT_FOCUS:
|
||||
{
|
||||
if (this._isBrowserDoc(aEvent.accessible)) {
|
||||
// The document recieved focus, call tabSelected to present current tab.
|
||||
let docContext = new PresenterContext(aEvent.accessible, null);
|
||||
let cursorable = aEvent.accessible.
|
||||
QueryInterface(Ci.nsIAccessibleCursorable);
|
||||
let vcContext = new PresenterContext(
|
||||
(cursorable) ? cursorable.virtualCursor.position : null, null);
|
||||
this.presenters.forEach(
|
||||
function(p) { p.tabSelected(docContext, vcContext); });
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Ci.nsIAccessibleEvent.EVENT_TEXT_INSERTED:
|
||||
case Ci.nsIAccessibleEvent.EVENT_TEXT_REMOVED:
|
||||
{
|
||||
|
@ -234,6 +234,9 @@ AndroidPresenter.prototype = {
|
||||
ANDROID_WINDOW_STATE_CHANGED: 0x20,
|
||||
|
||||
pivotChanged: function AndroidPresenter_pivotChanged(aContext) {
|
||||
if (!aContext.accessible)
|
||||
return;
|
||||
|
||||
let output = [];
|
||||
for (let i in aContext.newAncestry)
|
||||
output.push.apply(
|
||||
@ -337,7 +340,8 @@ DummyAndroidPresenter.prototype = {
|
||||
*/
|
||||
function PresenterContext(aAccessible, aOldAccessible) {
|
||||
this._accessible = aAccessible;
|
||||
this._oldAccessible = aOldAccessible;
|
||||
this._oldAccessible =
|
||||
this._isDefunct(aOldAccessible) ? null : aOldAccessible;
|
||||
}
|
||||
|
||||
PresenterContext.prototype = {
|
||||
@ -387,5 +391,15 @@ PresenterContext.prototype = {
|
||||
}
|
||||
|
||||
return this._newAncestry;
|
||||
},
|
||||
|
||||
_isDefunct: function _isDefunct(aAccessible) {
|
||||
try {
|
||||
let extstate = {};
|
||||
aAccessible.getState({}, extstate);
|
||||
return !!(aAccessible.value & Ci.nsIAccessibleStates.EXT_STATE_DEFUNCT);
|
||||
} catch (x) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -109,7 +109,12 @@ var VirtualCursorController = {
|
||||
if (last) {
|
||||
virtualCursor.moveLast(this.SimpleTraversalRule);
|
||||
} else {
|
||||
virtualCursor.moveNext(this.SimpleTraversalRule);
|
||||
try {
|
||||
virtualCursor.moveNext(this.SimpleTraversalRule);
|
||||
} catch (x) {
|
||||
virtualCursor.position =
|
||||
gAccRetrieval.getAccessibleFor(document.activeElement);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -118,7 +123,12 @@ var VirtualCursorController = {
|
||||
if (first) {
|
||||
virtualCursor.moveFirst(this.SimpleTraversalRule);
|
||||
} else {
|
||||
virtualCursor.movePrevious(this.SimpleTraversalRule);
|
||||
try {
|
||||
virtualCursor.movePrevious(this.SimpleTraversalRule);
|
||||
} catch (x) {
|
||||
virtualCursor.position =
|
||||
gAccRetrieval.getAccessibleFor(document.activeElement);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -32,7 +32,7 @@ CPPSRCS = \
|
||||
nsWinUtils.cpp \
|
||||
ia2AccessibleAction.cpp \
|
||||
ia2AccessibleComponent.cpp \
|
||||
CAccessibleImage.cpp \
|
||||
ia2AccessibleImage.cpp \
|
||||
CAccessibleText.cpp \
|
||||
CAccessibleEditableText.cpp \
|
||||
CAccessibleHyperlink.cpp \
|
||||
|
@ -5,32 +5,30 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "CAccessibleImage.h"
|
||||
#include "ia2AccessibleImage.h"
|
||||
|
||||
#include "AccessibleImage_i.c"
|
||||
|
||||
#include "nsHTMLImageAccessibleWrap.h"
|
||||
#include "nsHTMLImageAccessible.h"
|
||||
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIAccessibleImage.h"
|
||||
#include "nsIAccessibleTypes.h"
|
||||
#include "nsAccessNodeWrap.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// IUnknown
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleImage::QueryInterface(REFIID iid, void** ppv)
|
||||
ia2AccessibleImage::QueryInterface(REFIID iid, void** ppv)
|
||||
{
|
||||
*ppv = NULL;
|
||||
|
||||
if (IID_IAccessibleImage == iid) {
|
||||
nsCOMPtr<nsIAccessibleImage> imageAcc(do_QueryObject(this));
|
||||
if (!imageAcc)
|
||||
return E_FAIL;
|
||||
|
||||
*ppv = static_cast<IAccessibleImage*>(this);
|
||||
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
|
||||
(static_cast<IUnknown*>(*ppv))->AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@ -40,14 +38,15 @@ CAccessibleImage::QueryInterface(REFIID iid, void** ppv)
|
||||
// IAccessibleImage
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleImage::get_description(BSTR *aDescription)
|
||||
ia2AccessibleImage::get_description(BSTR* aDescription)
|
||||
{
|
||||
__try {
|
||||
*aDescription = NULL;
|
||||
|
||||
nsCOMPtr<nsIAccessible> acc(do_QueryObject(this));
|
||||
if (!acc)
|
||||
return E_FAIL;
|
||||
nsHTMLImageAccessibleWrap* acc =
|
||||
static_cast<nsHTMLImageAccessibleWrap*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAutoString description;
|
||||
nsresult rv = acc->GetName(description);
|
||||
@ -65,23 +64,24 @@ __try {
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleImage::get_imagePosition(enum IA2CoordinateType aCoordType,
|
||||
long *aX,
|
||||
long *aY)
|
||||
ia2AccessibleImage::get_imagePosition(enum IA2CoordinateType aCoordType,
|
||||
long* aX,
|
||||
long* aY)
|
||||
{
|
||||
__try {
|
||||
*aX = 0;
|
||||
*aY = 0;
|
||||
|
||||
nsHTMLImageAccessibleWrap* imageAcc =
|
||||
static_cast<nsHTMLImageAccessibleWrap*>(this);
|
||||
if (imageAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
|
||||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
|
||||
|
||||
nsCOMPtr<nsIAccessibleImage> imageAcc(do_QueryObject(this));
|
||||
if (!imageAcc)
|
||||
return E_FAIL;
|
||||
|
||||
PRInt32 x = 0, y = 0;
|
||||
|
||||
nsresult rv = imageAcc->GetImagePosition(geckoCoordType, &x, &y);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
@ -96,17 +96,18 @@ __try {
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CAccessibleImage::get_imageSize(long *aHeight, long *aWidth)
|
||||
ia2AccessibleImage::get_imageSize(long* aHeight, long* aWidth)
|
||||
{
|
||||
__try {
|
||||
*aHeight = 0;
|
||||
*aWidth = 0;
|
||||
|
||||
nsCOMPtr<nsIAccessibleImage> imageAcc(do_QueryObject(this));
|
||||
if (!imageAcc)
|
||||
return E_FAIL;
|
||||
nsHTMLImageAccessibleWrap* imageAcc =
|
||||
static_cast<nsHTMLImageAccessibleWrap*>(this);
|
||||
if (imageAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
PRInt32 x = 0, y = 0, width = 0, height = 0;
|
||||
PRInt32 width = 0, height = 0;
|
||||
nsresult rv = imageAcc->GetImageSize(&width, &height);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
@ -8,11 +8,9 @@
|
||||
#ifndef _ACCESSIBLE_IMAGE_H
|
||||
#define _ACCESSIBLE_IMAGE_H
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
#include "AccessibleImage.h"
|
||||
|
||||
class CAccessibleImage: public IAccessibleImage
|
||||
class ia2AccessibleImage : public IAccessibleImage
|
||||
{
|
||||
public:
|
||||
|
||||
@ -31,10 +29,6 @@ public:
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_imageSize(
|
||||
/* [out] */ long *height,
|
||||
/* [retval][out] */ long *width);
|
||||
|
||||
// nsISupports
|
||||
NS_IMETHOD QueryInterface(const nsIID& uuid, void** result) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -12,5 +12,5 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLImageAccessibleWrap,
|
||||
|
||||
IMPL_IUNKNOWN_INHERITED1(nsHTMLImageAccessibleWrap,
|
||||
nsAccessibleWrap,
|
||||
CAccessibleImage);
|
||||
ia2AccessibleImage);
|
||||
|
||||
|
@ -9,10 +9,10 @@
|
||||
#define _NSHTMLIMAGEACCESSIBLEWRAP_H
|
||||
|
||||
#include "nsHTMLImageAccessible.h"
|
||||
#include "CAccessibleImage.h"
|
||||
#include "ia2AccessibleImage.h"
|
||||
|
||||
class nsHTMLImageAccessibleWrap : public nsHTMLImageAccessible,
|
||||
public CAccessibleImage
|
||||
public ia2AccessibleImage
|
||||
{
|
||||
public:
|
||||
nsHTMLImageAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) :
|
||||
|
@ -47,6 +47,24 @@ xpcAccessibleTable::GetRowCount(PRInt32* aRowCount)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
xpcAccessibleTable::GetCellAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
|
||||
nsIAccessible** aCell)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCell);
|
||||
*aCell = nsnull;
|
||||
|
||||
if (!mTable)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (aRowIndex < 0 || aRowIndex >= mTable->RowCount() ||
|
||||
aColumnIndex < 0 || aColumnIndex >= mTable->ColCount())
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
NS_IF_ADDREF(*aCell = mTable->CellAt(aRowIndex, aColumnIndex));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
xpcAccessibleTable::GetCellIndexAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
|
||||
PRInt32* aCellIndex)
|
||||
|
@ -26,6 +26,8 @@ public:
|
||||
nsresult GetSummary(nsAString& aSummary);
|
||||
nsresult GetColumnCount(PRInt32* aColumnCount);
|
||||
nsresult GetRowCount(PRInt32* aRowCount);
|
||||
nsresult GetCellAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
|
||||
nsIAccessible** aCell);
|
||||
nsresult GetCellIndexAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
|
||||
PRInt32* aCellIndex);
|
||||
nsresult UnselectColumn(PRInt32 aColIdx);
|
||||
@ -45,7 +47,8 @@ protected:
|
||||
{ return xpcAccessibleTable::GetColumnCount(aColumnCount); } \
|
||||
NS_SCRIPTABLE NS_IMETHOD GetRowCount(PRInt32* aRowCount) \
|
||||
{ return xpcAccessibleTable::GetRowCount(aRowCount); } \
|
||||
NS_SCRIPTABLE NS_IMETHOD GetCellAt(PRInt32 rowIndex, PRInt32 columnIndex, nsIAccessible * *_retval NS_OUTPARAM); \
|
||||
NS_SCRIPTABLE NS_IMETHOD GetCellAt(PRInt32 rowIndex, PRInt32 columnIndex, nsIAccessible** _retval NS_OUTPARAM) \
|
||||
{ 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); \
|
||||
|
@ -244,32 +244,26 @@ nsXULListboxAccessible::RowCount()
|
||||
return itemCount;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULListboxAccessible::GetCellAt(PRInt32 aRow, PRInt32 aColumn,
|
||||
nsIAccessible **aAccessibleCell)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessibleCell);
|
||||
*aAccessibleCell = nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_OK;
|
||||
|
||||
nsAccessible*
|
||||
nsXULListboxAccessible::CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex)
|
||||
{
|
||||
nsCOMPtr<nsIDOMXULSelectControlElement> control =
|
||||
do_QueryInterface(mContent);
|
||||
NS_ENSURE_TRUE(control, nsnull);
|
||||
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> item;
|
||||
control->GetItemAtIndex(aRow, getter_AddRefs(item));
|
||||
NS_ENSURE_TRUE(item, NS_ERROR_INVALID_ARG);
|
||||
control->GetItemAtIndex(aRowIndex, getter_AddRefs(item));
|
||||
if (!item)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIContent> itemContent(do_QueryInterface(item));
|
||||
NS_ENSURE_TRUE(mDoc, NS_ERROR_FAILURE);
|
||||
nsAccessible *row = mDoc->GetAccessible(itemContent);
|
||||
NS_ENSURE_STATE(row);
|
||||
if (!itemContent)
|
||||
return nsnull;
|
||||
|
||||
nsresult rv = row->GetChildAt(aColumn, aAccessibleCell);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_INVALID_ARG);
|
||||
nsAccessible* row = mDoc->GetAccessible(itemContent);
|
||||
NS_ENSURE_TRUE(row, nsnull);
|
||||
|
||||
return NS_OK;
|
||||
return row->GetChildAt(aColumnIndex);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -72,6 +72,7 @@ public:
|
||||
// TableAccessible
|
||||
virtual PRUint32 ColCount();
|
||||
virtual PRUint32 RowCount();
|
||||
virtual nsAccessible* CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex);
|
||||
virtual void UnselectRow(PRUint32 aRowIdx);
|
||||
|
||||
// nsAccessNode
|
||||
|
@ -298,29 +298,23 @@ nsXULTreeGridAccessible::GetSelectedRowIndices(PRUint32 *arowCount,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeGridAccessible::GetCellAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
|
||||
nsIAccessible **aCell)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCell);
|
||||
*aCell = nsnull;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAccessible *rowAccessible = GetTreeItemAccessible(aRowIndex);
|
||||
if (!rowAccessible)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
nsAccessible*
|
||||
nsXULTreeGridAccessible::CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex)
|
||||
{
|
||||
nsAccessible* row = GetTreeItemAccessible(aRowIndex);
|
||||
if (!row)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsITreeColumn> column =
|
||||
nsCoreUtils::GetSensibleColumnAt(mTree, aColumnIndex);
|
||||
nsCoreUtils::GetSensibleColumnAt(mTree, aColumnIndex);
|
||||
if (!column)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
return nsnull;
|
||||
|
||||
nsRefPtr<nsXULTreeItemAccessibleBase> rowAcc = do_QueryObject(rowAccessible);
|
||||
nsRefPtr<nsXULTreeItemAccessibleBase> rowAcc = do_QueryObject(row);
|
||||
if (!rowAcc)
|
||||
return nsnull;
|
||||
|
||||
NS_IF_ADDREF(*aCell = rowAcc->GetCellAccessible(column));
|
||||
return NS_OK;
|
||||
return rowAcc->GetCellAccessible(column);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -30,6 +30,7 @@ public:
|
||||
// TableAccessible
|
||||
virtual PRUint32 ColCount();
|
||||
virtual PRUint32 RowCount();
|
||||
virtual nsAccessible* CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex);
|
||||
virtual void UnselectRow(PRUint32 aRowIdx);
|
||||
|
||||
// nsAccessNode
|
||||
|
@ -164,6 +164,7 @@
|
||||
@BINPATH@/components/dom_contacts.xpt
|
||||
@BINPATH@/components/dom_core.xpt
|
||||
@BINPATH@/components/dom_css.xpt
|
||||
@BINPATH@/components/dom_devicestorage.xpt
|
||||
@BINPATH@/components/dom_events.xpt
|
||||
@BINPATH@/components/dom_geolocation.xpt
|
||||
@BINPATH@/components/dom_network.xpt
|
||||
|
@ -102,7 +102,7 @@ var gTestSteps = [
|
||||
ensure_opentabs_match_db(nextStep);
|
||||
});
|
||||
}, true);
|
||||
tab.linkedBrowser.loadURI('about:robots');
|
||||
tab.linkedBrowser.loadURI("about:mozilla");
|
||||
},
|
||||
function() {
|
||||
info("Running step 9 - enter private browsing mode, without keeping session");
|
||||
|
@ -15,7 +15,7 @@ function test() {
|
||||
is(gBrowser.visibleTabs.length, 2, "2 tabs should be open");
|
||||
is(Disabled(), true, "Bookmark All Tabs should be disabled since there are two tabs with the same address");
|
||||
|
||||
let testTab2 = gBrowser.addTab("about:robots");
|
||||
let testTab2 = gBrowser.addTab("about:mozilla");
|
||||
is(gBrowser.visibleTabs.length, 3, "3 tabs should be open");
|
||||
// Wait for tab load, the code checks for currentURI.
|
||||
testTab2.linkedBrowser.addEventListener("load", function () {
|
||||
|
@ -4,6 +4,6 @@
|
||||
</head>
|
||||
<frameset cols="*,*">
|
||||
<frame name="left" src="frameLeft.html">
|
||||
<frame name="right" src="about:robots">
|
||||
<frame name="right" src="about:mozilla">
|
||||
</frameset>
|
||||
</html>
|
||||
|
@ -20,30 +20,30 @@ function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
let aboutBrowser = gBrowser.getBrowserForTab(tabAbout);
|
||||
aboutBrowser.addEventListener("load", function () {
|
||||
aboutBrowser.removeEventListener("load", arguments.callee, true);
|
||||
let tabRobots = gBrowser.addTab();
|
||||
gBrowser.selectedTab = tabRobots;
|
||||
aboutBrowser.addEventListener("load", function onAboutBrowserLoad() {
|
||||
aboutBrowser.removeEventListener("load", onAboutBrowserLoad, true);
|
||||
let tabMozilla = gBrowser.addTab();
|
||||
gBrowser.selectedTab = tabMozilla;
|
||||
|
||||
let robotsBrowser = gBrowser.getBrowserForTab(tabRobots);
|
||||
robotsBrowser.addEventListener("load", function () {
|
||||
robotsBrowser.removeEventListener("load", arguments.callee, true);
|
||||
let robotsZoom = ZoomManager.zoom;
|
||||
let mozillaBrowser = gBrowser.getBrowserForTab(tabMozilla);
|
||||
mozillaBrowser.addEventListener("load", function onMozillaBrowserLoad() {
|
||||
mozillaBrowser.removeEventListener("load", onMozillaBrowserLoad, true);
|
||||
let mozillaZoom = ZoomManager.zoom;
|
||||
|
||||
// change the zoom on the robots page
|
||||
// change the zoom on the mozilla page
|
||||
FullZoom.enlarge();
|
||||
// make sure the zoom level has been changed
|
||||
isnot(ZoomManager.zoom, robotsZoom, "Zoom level can be changed");
|
||||
robotsZoom = ZoomManager.zoom;
|
||||
isnot(ZoomManager.zoom, mozillaZoom, "Zoom level can be changed");
|
||||
mozillaZoom = ZoomManager.zoom;
|
||||
|
||||
// switch to about: tab
|
||||
gBrowser.selectedTab = tabAbout;
|
||||
|
||||
// switch back to robots tab
|
||||
gBrowser.selectedTab = tabRobots;
|
||||
// switch back to mozilla tab
|
||||
gBrowser.selectedTab = tabMozilla;
|
||||
|
||||
// make sure the zoom level has not changed
|
||||
is(ZoomManager.zoom, robotsZoom,
|
||||
is(ZoomManager.zoom, mozillaZoom,
|
||||
"Entering private browsing should not reset the zoom on a tab");
|
||||
|
||||
// leave private browsing mode
|
||||
@ -52,11 +52,11 @@ function test() {
|
||||
// cleanup
|
||||
gPrefService.clearUserPref("browser.privatebrowsing.keep_current_session");
|
||||
FullZoom.reset();
|
||||
gBrowser.removeTab(tabRobots);
|
||||
gBrowser.removeTab(tabMozilla);
|
||||
gBrowser.removeTab(tabAbout);
|
||||
finish();
|
||||
}, true);
|
||||
robotsBrowser.contentWindow.location = "about:robots";
|
||||
mozillaBrowser.contentWindow.location = "about:mozilla";
|
||||
}, true);
|
||||
aboutBrowser.contentWindow.location = "about:";
|
||||
}
|
||||
|
@ -24,10 +24,10 @@ function onTabViewWindowLoaded() {
|
||||
contentWindow = document.getElementById("tab-view").contentWindow;
|
||||
|
||||
originalTab = gBrowser.selectedTab;
|
||||
newTabs = [gBrowser.addTab("about:robots"), gBrowser.addTab("about:mozilla"), gBrowser.addTab("about:license")];
|
||||
newTabs = [gBrowser.addTab("about:rights"), gBrowser.addTab("about:mozilla"), gBrowser.addTab("about:license")];
|
||||
|
||||
is(originalTab._tPos, 0, "Original tab is in position 0");
|
||||
is(newTabs[0]._tPos, 1, "Robots is in position 1");
|
||||
is(newTabs[0]._tPos, 1, "Rights is in position 1");
|
||||
is(newTabs[1]._tPos, 2, "Mozilla is in position 2");
|
||||
is(newTabs[2]._tPos, 3, "License is in position 3");
|
||||
|
||||
@ -51,7 +51,7 @@ function onTabViewWindowHidden() {
|
||||
|
||||
is(newTabs[2]._tPos, 0, "License is in position 0");
|
||||
is(originalTab._tPos, 1, "Original tab is in position 1");
|
||||
is(newTabs[0]._tPos, 2, "Robots is in position 2");
|
||||
is(newTabs[0]._tPos, 2, "Rights is in position 2");
|
||||
is(newTabs[1]._tPos, 3, "Mozilla is in position 3");
|
||||
|
||||
gBrowser.removeTab(newTabs[0]);
|
||||
|
@ -40,7 +40,7 @@ function test3() {
|
||||
whenTabViewIsHidden(function() {
|
||||
is(gBrowser.tabs.length, 2, "There are two tabs after cmd/ctrl + t is pressed");
|
||||
|
||||
gBrowser.tabs[0].linkedBrowser.loadURI("about:robots");
|
||||
gBrowser.tabs[0].linkedBrowser.loadURI("about:mozilla");
|
||||
gBrowser.tabs[1].linkedBrowser.loadURI("http://example.com/");
|
||||
|
||||
afterAllTabsLoaded(function () {
|
||||
|
@ -29,7 +29,7 @@ function onTabViewWindowLoaded(win) {
|
||||
let datatext = win.gBrowser.loadOneTab("data:text/plain,bug610242", bg);
|
||||
let datahtml = win.gBrowser.loadOneTab("data:text/html,<blink>don't blink!</blink>", bg);
|
||||
let mozilla = win.gBrowser.loadOneTab("about:mozilla", bg);
|
||||
let robots = win.gBrowser.loadOneTab("about:robots", bg);
|
||||
let synclog = win.gBrowser.loadOneTab("about:sync-log", bg);
|
||||
let html = win.gBrowser.loadOneTab("http://example.com", bg);
|
||||
let png = win.gBrowser.loadOneTab("http://mochi.test:8888/browser/browser/base/content/test/moz.png", bg);
|
||||
let svg = win.gBrowser.loadOneTab("http://mochi.test:8888/browser/browser/base/content/test/title_test.svg", bg);
|
||||
@ -79,7 +79,7 @@ function onTabViewWindowLoaded(win) {
|
||||
check(datatext, "datatext", false);
|
||||
check(datahtml, "datahtml", false);
|
||||
check(mozilla, "about:mozilla", false);
|
||||
check(robots, "about:robots", true);
|
||||
check(synclog, "about:sync-log", true);
|
||||
check(html, "html", true);
|
||||
check(png, "png", false);
|
||||
check(svg, "svg", true);
|
||||
|
@ -79,9 +79,9 @@ function createBrowserState() {
|
||||
"2nd-group-id": {bounds: bounds, title: "new group 2", id: "2nd-group-id"}
|
||||
};
|
||||
|
||||
let tab1Data = {bounds: bounds, url: "about:robots", groupID: "2nd-group-id"};
|
||||
let tab1Data = {bounds: bounds, url: "about:rights", groupID: "2nd-group-id"};
|
||||
let tab1 = {
|
||||
entries: [{url: "about:robots"}],
|
||||
entries: [{url: "about:rights"}],
|
||||
extData: {"tabview-tab": JSON.stringify(tab1Data)}
|
||||
};
|
||||
|
||||
|
@ -52,7 +52,7 @@ function onTabViewLoadedAndShown() {
|
||||
contentWindow.gPrefBranch.setBoolPref("animate_zoom", false);
|
||||
|
||||
// Create a second tab
|
||||
gBrowser.addTab("about:robots");
|
||||
gBrowser.addTab("about:mozilla");
|
||||
is(gBrowser.tabs.length, 2, "we now have 2 tabs");
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
|
@ -170,6 +170,7 @@
|
||||
@BINPATH@/components/dom_contacts.xpt
|
||||
@BINPATH@/components/dom_core.xpt
|
||||
@BINPATH@/components/dom_css.xpt
|
||||
@BINPATH@/components/dom_devicestorage.xpt
|
||||
@BINPATH@/components/dom_events.xpt
|
||||
@BINPATH@/components/dom_geolocation.xpt
|
||||
@BINPATH@/components/dom_network.xpt
|
||||
|
@ -1179,6 +1179,7 @@ xpicleanup@BIN_SUFFIX@
|
||||
components/dom_css.xpt
|
||||
components/dom_events.xpt
|
||||
components/dom_geolocation.xpt
|
||||
components/dom_devicestorage.xpt
|
||||
components/dom_html.xpt
|
||||
components/dom_json.xpt
|
||||
components/dom_loadsave.xpt
|
||||
|
@ -575,8 +575,6 @@ MacNativeApp.prototype = {
|
||||
<string>' + escapeXML(this.appName) + '</string>\n\
|
||||
<key>CFBundlePackageType</key>\n\
|
||||
<string>APPL</string>\n\
|
||||
<key>CFBundleSignature</key>\n\
|
||||
<string>MOZB</string>\n\
|
||||
<key>CFBundleVersion</key>\n\
|
||||
<string>0</string>\n\
|
||||
<key>FirefoxBinary</key>\n\
|
||||
|
@ -14,8 +14,7 @@ public interface Driver {
|
||||
*
|
||||
* @param activity The activity the element belongs to
|
||||
* @param name The name of the element
|
||||
* @return The first matching element on the current context
|
||||
* @throws RoboCopException If no matching elements are found
|
||||
* @return The first matching element on the current context, or null if not found.
|
||||
*/
|
||||
Element findElement(Activity activity, String name);
|
||||
|
||||
|
@ -11,13 +11,16 @@ package @ANDROID_PACKAGE_NAME@;
|
||||
*/
|
||||
public interface Element {
|
||||
|
||||
/** Click on the element */
|
||||
void click();
|
||||
/** Click on the element's view. Returns true on success. */
|
||||
boolean click();
|
||||
|
||||
/** Returns true if the element is currently displayed */
|
||||
boolean isDisplayed();
|
||||
|
||||
/** Returns the text currently displayed on the element */
|
||||
/**
|
||||
* Returns the text currently displayed on the element, or null
|
||||
* if the text cannot be retrieved.
|
||||
*/
|
||||
String getText();
|
||||
|
||||
/** Returns the view ID */
|
||||
|
@ -169,14 +169,21 @@ public class FennecNativeDriver implements Driver {
|
||||
return mGeckoWidth;
|
||||
}
|
||||
|
||||
/** Find the named element in the list of known Fennec views.
|
||||
* @return An Element representing the view, or null if the view is not found.
|
||||
*/
|
||||
public Element findElement(Activity activity, String name) {
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException("Can not findElements when passed a null");
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR,
|
||||
"Can not findElements when passed a null");
|
||||
return null;
|
||||
}
|
||||
if (mLocators.containsKey(name)) {
|
||||
return new FennecNativeElement(Integer.decode((String)mLocators.get(name)), activity, mSolo);
|
||||
}
|
||||
throw new RoboCopException("Element does not exist in the list");
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR,
|
||||
"findElement: Element '"+name+"' does not exist in the list");
|
||||
return null;
|
||||
}
|
||||
|
||||
public void startFrameRecording() {
|
||||
|
@ -34,19 +34,25 @@ public class FennecNativeElement implements Element {
|
||||
return mId;
|
||||
}
|
||||
|
||||
public void click() {
|
||||
private boolean mClickSuccess;
|
||||
|
||||
public boolean click() {
|
||||
final SynchronousQueue syncQueue = new SynchronousQueue();
|
||||
mClickSuccess = false;
|
||||
mActivity.runOnUiThread(
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
View view = (View)mActivity.findViewById(mId);
|
||||
if(view != null) {
|
||||
if (!view.performClick()) {
|
||||
if (view != null) {
|
||||
if (view.performClick()) {
|
||||
mClickSuccess = true;
|
||||
} else {
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.WARN,
|
||||
"Robocop called click on an element with no listener");
|
||||
}
|
||||
} else {
|
||||
throw new RoboCopException("click: unable to find view "+mId);
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR,
|
||||
"click: unable to find view "+mId);
|
||||
}
|
||||
syncQueue.offer(new Object());
|
||||
}
|
||||
@ -56,12 +62,14 @@ public class FennecNativeElement implements Element {
|
||||
} catch (InterruptedException e) {
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR, e);
|
||||
}
|
||||
return mClickSuccess;
|
||||
}
|
||||
|
||||
private Object mText;
|
||||
|
||||
public String getText() {
|
||||
final SynchronousQueue syncQueue = new SynchronousQueue();
|
||||
mText = null;
|
||||
mActivity.runOnUiThread(
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
@ -83,9 +91,11 @@ public class FennecNativeElement implements Element {
|
||||
} else if (v instanceof TextView) {
|
||||
mText = ((TextView)v).getText();
|
||||
} else if (v == null) {
|
||||
throw new RoboCopException("getText: unable to find view "+mId);
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR,
|
||||
"getText: unable to find view "+mId);
|
||||
} else {
|
||||
throw new RoboCopException("getText: unhandled type for view "+mId);
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR,
|
||||
"getText: unhandled type for view "+mId);
|
||||
}
|
||||
syncQueue.offer(new Object());
|
||||
} // end of run() method definition
|
||||
@ -98,7 +108,9 @@ public class FennecNativeElement implements Element {
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR, e);
|
||||
}
|
||||
if (mText == null) {
|
||||
throw new RoboCopException("getText: Text is null for view "+mId);
|
||||
FennecNativeDriver.log(FennecNativeDriver.LogLevel.WARN,
|
||||
"getText: Text is null for view "+mId);
|
||||
return null;
|
||||
}
|
||||
return mText.toString();
|
||||
}
|
||||
|
@ -148,10 +148,12 @@ endif
|
||||
|
||||
FORCE:
|
||||
|
||||
ifndef COMPILER_DEPEND
|
||||
ifdef MKDEPEND_DIR
|
||||
clean clobber realclean clobber_all::
|
||||
cd $(MKDEPEND_DIR); $(MAKE) $@
|
||||
endif
|
||||
endif
|
||||
|
||||
PYUNITS := \
|
||||
unit-Expression.py \
|
||||
|
@ -524,6 +524,8 @@ MOZ_ENABLE_D2D_SURFACE = @MOZ_ENABLE_D2D_SURFACE@
|
||||
MOZ_ENABLE_D3D9_LAYER = @MOZ_ENABLE_D3D9_LAYER@
|
||||
MOZ_ENABLE_D3D10_LAYER = @MOZ_ENABLE_D3D10_LAYER@
|
||||
MOZ_METRO = @MOZ_METRO@
|
||||
CRTDLLVERSION = @CRTDLLVERSION@
|
||||
CRTEXPDLLVERSION = @CRTEXPDLLVERSION@
|
||||
|
||||
MOZ_GTK2_CFLAGS = @MOZ_GTK2_CFLAGS@
|
||||
MOZ_GTK2_LIBS = @MOZ_GTK2_LIBS@
|
||||
|
75
configure.in
75
configure.in
@ -166,7 +166,7 @@ MOZ_ARG_WITH_STRING(android-ndk,
|
||||
|
||||
MOZ_ARG_WITH_STRING(android-toolchain,
|
||||
[ --with-android-toolchain=DIR
|
||||
location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
|
||||
location of the android toolchain],
|
||||
android_toolchain=$withval)
|
||||
|
||||
|
||||
@ -183,15 +183,9 @@ MOZ_ARG_WITH_STRING(android-sdk,
|
||||
|
||||
MOZ_ARG_WITH_STRING(android-platform,
|
||||
[ --with-android-platform=DIR
|
||||
location of platform dir, default NDK/build/platforms/android-5/arch-arm],
|
||||
location of platform dir],
|
||||
android_platform=$withval)
|
||||
|
||||
MOZ_ARG_ENABLE_BOOL(android-libstdcxx,
|
||||
[ --enable-android-libstdcxx
|
||||
use GNU libstdc++ instead of STLPort for NDK >= 5],
|
||||
MOZ_ANDROID_LIBSTDCXX=1,
|
||||
MOZ_ANDROID_LIBSTDCXX= )
|
||||
|
||||
case "$target" in
|
||||
arm-linux*-android*|*-linuxandroid*)
|
||||
android_tool_prefix="arm-linux-androideabi"
|
||||
@ -199,8 +193,8 @@ arm-linux*-android*|*-linuxandroid*)
|
||||
i?86-*android*)
|
||||
android_tool_prefix="i686-android-linux"
|
||||
;;
|
||||
arm-android-eabi)
|
||||
android_tool_prefix="arm-eabi"
|
||||
mipsel-*android*)
|
||||
android_tool_prefix="mipsel-linux-android"
|
||||
;;
|
||||
*)
|
||||
android_tool_prefix="$target_os"
|
||||
@ -317,20 +311,18 @@ case "$target" in
|
||||
|
||||
kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
|
||||
|
||||
android_toolchain="$android_ndk"/build/prebuilt/$kernel_name-x86/arm-eabi-4.4.0
|
||||
|
||||
# With newer NDK, the toolchain path has changed.
|
||||
if ! test -d "$android_toolchain" ; then
|
||||
case "$target_cpu" in
|
||||
arm)
|
||||
target_name=arm-linux-androideabi-4.4.3
|
||||
;;
|
||||
i?86)
|
||||
target_name=x86-4.4.3
|
||||
;;
|
||||
esac
|
||||
android_toolchain="$android_ndk"/toolchains/$target_name/prebuilt/$kernel_name-x86
|
||||
fi
|
||||
case "$target_cpu" in
|
||||
arm)
|
||||
target_name=arm-linux-androideabi-4.4.3
|
||||
;;
|
||||
i?86)
|
||||
target_name=x86-4.4.3
|
||||
;;
|
||||
mipsel)
|
||||
target_name=mipsel-linux-android-4.4.3
|
||||
;;
|
||||
esac
|
||||
android_toolchain="$android_ndk"/toolchains/$target_name/prebuilt/$kernel_name-x86
|
||||
|
||||
if test -d "$android_toolchain" ; then
|
||||
AC_MSG_RESULT([$android_toolchain])
|
||||
@ -342,12 +334,19 @@ case "$target" in
|
||||
if test -z "$android_platform" ; then
|
||||
AC_MSG_CHECKING([for android platform directory])
|
||||
|
||||
android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
|
||||
case "$target_cpu" in
|
||||
arm)
|
||||
target_name=arm
|
||||
;;
|
||||
i?86)
|
||||
target_name=x86
|
||||
;;
|
||||
mipsel)
|
||||
target_name=mips
|
||||
;;
|
||||
esac
|
||||
|
||||
# With newer NDK, the platform path has changed.
|
||||
if ! test -d "$android_platform" ; then
|
||||
android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_cpu"
|
||||
fi
|
||||
android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_name"
|
||||
|
||||
if test -d "$android_platform" ; then
|
||||
AC_MSG_RESULT([$android_platform])
|
||||
@ -619,12 +618,18 @@ if test -n "$MOZ_METRO"; then
|
||||
WINSDK_TARGETVER=602
|
||||
# Allow a higher api set
|
||||
WINVER=602
|
||||
# toolkit/library/makefile.in needs these, see nsDllMain.
|
||||
CRTDLLVERSION=110
|
||||
CRTEXPDLLVERSION=1-1-0
|
||||
else
|
||||
# Target the Windows 7 SDK by default
|
||||
WINSDK_TARGETVER=601
|
||||
WINVER=502
|
||||
fi
|
||||
|
||||
AC_SUBST(CRTDLLVERSION)
|
||||
AC_SUBST(CRTEXPDLLVERSION)
|
||||
|
||||
if test -n "$MOZ_METRO"; then
|
||||
case "$target" in
|
||||
*-mingw*)
|
||||
@ -1597,18 +1602,14 @@ if test "$OS_TARGET" = "Android"; then
|
||||
x86-*)
|
||||
ANDROID_CPU_ARCH=x86
|
||||
;;
|
||||
mips-*) # When target_cpu is mipsel, CPU_ARCH is mips
|
||||
ANDROID_CPU_ARCH=mips
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test "$OS_TARGET" = "Android" -a -z "$gonkdir"; then
|
||||
if test -n "$MOZ_ANDROID_LIBSTDCXX" ; then
|
||||
if test ! -e "$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/libstdc++.a" ; then
|
||||
AC_MSG_ERROR([Cannot find path to libstdc++ (NDK version >= 5?)])
|
||||
fi
|
||||
STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/gnu-libstdc++/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/include -D_GLIBCXX_PERMIT_BACKWARD_HASH"
|
||||
STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH"
|
||||
STLPORT_LIBS="-lstdc++"
|
||||
elif test -e "$android_ndk/sources/cxx-stl/stlport/src/iostream.cpp" ; then
|
||||
if test -e "$android_ndk/sources/cxx-stl/stlport/src/iostream.cpp" ; then
|
||||
if test -e "$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a"; then
|
||||
STLPORT_LDFLAGS="-L$_objdir/build/stlport -L$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/"
|
||||
elif test -e "$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a"; then
|
||||
|
@ -132,7 +132,7 @@ public:
|
||||
|
||||
// Create as a blob
|
||||
nsDOMFileFile(nsIFile *aFile, const nsAString& aContentType,
|
||||
nsISupports *aCacheToken = nsnull)
|
||||
nsISupports *aCacheToken)
|
||||
: nsDOMFileBase(aContentType, UINT64_MAX),
|
||||
mFile(aFile), mWholeFile(true), mStoredFile(false),
|
||||
mCacheToken(aCacheToken)
|
||||
@ -140,6 +140,17 @@ public:
|
||||
NS_ASSERTION(mFile, "must have file");
|
||||
}
|
||||
|
||||
// Create as a file with custom name
|
||||
nsDOMFileFile(nsIFile *aFile, const nsAString& aName)
|
||||
: nsDOMFileBase(EmptyString(), EmptyString(), UINT64_MAX),
|
||||
mFile(aFile), mWholeFile(true), mStoredFile(false)
|
||||
{
|
||||
NS_ASSERTION(mFile, "must have file");
|
||||
// Lazily get the content type and size
|
||||
mContentType.SetIsVoid(true);
|
||||
mName.Assign(aName);
|
||||
}
|
||||
|
||||
// Create as a stored file
|
||||
nsDOMFileFile(const nsAString& aName, const nsAString& aContentType,
|
||||
PRUint64 aLength, nsIFile* aFile,
|
||||
|
@ -104,6 +104,18 @@ public:
|
||||
protected:
|
||||
virtual ~Link();
|
||||
|
||||
/**
|
||||
* Return true if the link has associated URI.
|
||||
*/
|
||||
bool HasURI() const
|
||||
{
|
||||
if (mCachedURI)
|
||||
return true;
|
||||
|
||||
nsCOMPtr<nsIURI> uri(GetURI());
|
||||
return !!uri;
|
||||
}
|
||||
|
||||
bool HasCachedURI() const { return !!mCachedURI; }
|
||||
|
||||
private:
|
||||
|
@ -27,13 +27,7 @@ nsDOMAttributeMap::nsDOMAttributeMap(Element* aContent)
|
||||
{
|
||||
// We don't add a reference to our content. If it goes away,
|
||||
// we'll be told to drop our reference
|
||||
}
|
||||
|
||||
bool
|
||||
nsDOMAttributeMap::Init()
|
||||
{
|
||||
mAttributeCache.Init();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,11 +96,6 @@ public:
|
||||
nsDOMAttributeMap(Element *aContent);
|
||||
virtual ~nsDOMAttributeMap();
|
||||
|
||||
/**
|
||||
* Initialize the map. Must be called before the map is used.
|
||||
*/
|
||||
bool Init();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
|
||||
// nsIDOMNamedNodeMap interface
|
||||
|
@ -2615,10 +2615,6 @@ nsGenericElement::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
|
||||
|
||||
if (!slots->mAttributeMap) {
|
||||
slots->mAttributeMap = new nsDOMAttributeMap(this);
|
||||
if (!slots->mAttributeMap->Init()) {
|
||||
slots->mAttributeMap = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
NS_ADDREF(*aAttributes = slots->mAttributeMap);
|
||||
|
@ -1527,7 +1527,6 @@ GK_ATOM(matrixrow_, "matrixrow")
|
||||
GK_ATOM(maxsize_, "maxsize")
|
||||
GK_ATOM(mean_, "mean")
|
||||
GK_ATOM(median_, "median")
|
||||
GK_ATOM(mediummathspace_, "mediummathspace")
|
||||
GK_ATOM(menclose_, "menclose")
|
||||
GK_ATOM(merror_, "merror")
|
||||
GK_ATOM(mfenced_, "mfenced")
|
||||
@ -1571,13 +1570,6 @@ GK_ATOM(mtr_, "mtr")
|
||||
GK_ATOM(munder_, "munder")
|
||||
GK_ATOM(munderover_, "munderover")
|
||||
GK_ATOM(naturalnumbers_, "naturalnumbers")
|
||||
GK_ATOM(negativemediummathspace_, "negativemediummathspace")
|
||||
GK_ATOM(negativethickmathspace_, "negativethickmathspace")
|
||||
GK_ATOM(negativethinmathspace_, "negativethinmathspace")
|
||||
GK_ATOM(negativeverythickmathspace_, "negativeverythickmathspace")
|
||||
GK_ATOM(negativeverythinmathspace_, "negativeverythinmathspace")
|
||||
GK_ATOM(negativeveryverythickmathspace_, "negativeveryverythickmathspace")
|
||||
GK_ATOM(negativeveryverythinmathspace_, "negativeveryverythinmathspace")
|
||||
GK_ATOM(neq_, "neq")
|
||||
GK_ATOM(notanumber_, "notanumber")
|
||||
GK_ATOM(notation_, "notation")
|
||||
@ -1639,8 +1631,6 @@ GK_ATOM(symmetric_, "symmetric")
|
||||
GK_ATOM(tanh_, "tanh")
|
||||
GK_ATOM(tan_, "tan")
|
||||
GK_ATOM(tendsto_, "tendsto")
|
||||
GK_ATOM(thickmathspace_, "thickmathspace")
|
||||
GK_ATOM(thinmathspace_, "thinmathspace")
|
||||
GK_ATOM(times_, "times")
|
||||
GK_ATOM(transpose_, "transpose")
|
||||
GK_ATOM(union_, "union")
|
||||
@ -1648,10 +1638,6 @@ GK_ATOM(uplimit_, "uplimit")
|
||||
GK_ATOM(variance_, "variance")
|
||||
GK_ATOM(vectorproduct_, "vectorproduct")
|
||||
GK_ATOM(vector_, "vector")
|
||||
GK_ATOM(verythickmathspace_, "verythickmathspace")
|
||||
GK_ATOM(verythinmathspace_, "verythinmathspace")
|
||||
GK_ATOM(veryverythickmathspace_, "veryverythickmathspace")
|
||||
GK_ATOM(veryverythinmathspace_, "veryverythinmathspace")
|
||||
GK_ATOM(voffset_, "voffset")
|
||||
GK_ATOM(xref_, "xref")
|
||||
GK_ATOM(math, "math") // the only one without an underscore
|
||||
|
@ -896,19 +896,11 @@ nsIAtom** const kAttributesMathML[] = {
|
||||
&nsGkAtoms::mathsize_, // mathsize
|
||||
&nsGkAtoms::mathvariant_, // mathvariant
|
||||
&nsGkAtoms::maxsize_, // maxsize
|
||||
&nsGkAtoms::mediummathspace_, // mediummathspace
|
||||
&nsGkAtoms::minlabelspacing_, // minlabelspacing
|
||||
&nsGkAtoms::minsize_, // minsize
|
||||
&nsGkAtoms::movablelimits_, // movablelimits
|
||||
&nsGkAtoms::msgroup_, // msgroup
|
||||
&nsGkAtoms::name, // name
|
||||
&nsGkAtoms::negativemediummathspace_, // negativemediummathspace
|
||||
&nsGkAtoms::negativethickmathspace_, // negativethickmathspace
|
||||
&nsGkAtoms::negativethinmathspace_, // negativethinmathspace
|
||||
&nsGkAtoms::negativeverythickmathspace_, // negativeverythickmathspace
|
||||
&nsGkAtoms::negativeverythinmathspace_, // negativeverythinmathspace
|
||||
&nsGkAtoms::negativeveryverythickmathspace_, // negativeveryverythickmathspace
|
||||
&nsGkAtoms::negativeveryverythinmathspace_, // negativeveryverythinmathspace
|
||||
&nsGkAtoms::newline, // newline
|
||||
&nsGkAtoms::notation_, // notation
|
||||
&nsGkAtoms::numalign_, // numalign
|
||||
@ -941,13 +933,7 @@ nsIAtom** const kAttributesMathML[] = {
|
||||
&nsGkAtoms::subscriptshift_, // subscriptshift
|
||||
&nsGkAtoms::superscriptshift_, // superscriptshift
|
||||
&nsGkAtoms::symmetric_, // symmetric
|
||||
&nsGkAtoms::thickmathspace_, // thickmathspace
|
||||
&nsGkAtoms::thinmathspace_, // thinmathspace
|
||||
&nsGkAtoms::type, // type
|
||||
&nsGkAtoms::verythickmathspace_, // verythickmathspace
|
||||
&nsGkAtoms::verythinmathspace_, // verythinmathspace
|
||||
&nsGkAtoms::veryverythickmathspace_, // veryverythickmathspace
|
||||
&nsGkAtoms::veryverythinmathspace_, // veryverythinmathspace
|
||||
&nsGkAtoms::voffset_, // voffset
|
||||
&nsGkAtoms::width, // width
|
||||
&nsGkAtoms::xref_, // xref
|
||||
|
@ -177,9 +177,9 @@ public:
|
||||
return GetOwner();
|
||||
}
|
||||
|
||||
// The WebIDL parser converts constructors into methods called _Constructor.
|
||||
// The WebIDL constructor.
|
||||
static already_AddRefed<nsXMLHttpRequest>
|
||||
_Constructor(nsISupports* aGlobal, ErrorResult& aRv)
|
||||
Constructor(nsISupports* aGlobal, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal);
|
||||
nsCOMPtr<nsIScriptObjectPrincipal> principal = do_QueryInterface(aGlobal);
|
||||
|
@ -287,8 +287,7 @@ nsHTMLAnchorElement::IsHTMLFocusable(bool aWithMouse,
|
||||
|
||||
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::tabindex)) {
|
||||
// check whether we're actually a link
|
||||
nsCOMPtr<nsIURI> absURI;
|
||||
if (!IsLink(getter_AddRefs(absURI))) {
|
||||
if (!Link::HasURI()) {
|
||||
// Not tabbable or focusable without href (bug 17605), unless
|
||||
// forced to be via presence of nonnegative tabindex attribute
|
||||
if (aTabIndex) {
|
||||
|
@ -1857,6 +1857,10 @@ void nsBuiltinDecoderStateMachine::DecodeSeek()
|
||||
PRInt64 mediaTime = GetMediaTime();
|
||||
if (mediaTime != seekTime) {
|
||||
currentTimeChanged = true;
|
||||
// Stop playback now to ensure that while we're outside the monitor
|
||||
// dispatching SeekingStarted, playback doesn't advance and mess with
|
||||
// mCurrentFrameTime that we've setting to seekTime here.
|
||||
StopPlayback();
|
||||
UpdatePlaybackPositionInternal(seekTime);
|
||||
}
|
||||
|
||||
@ -1874,7 +1878,6 @@ void nsBuiltinDecoderStateMachine::DecodeSeek()
|
||||
// The seek target is different than the current playback position,
|
||||
// we'll need to seek the playback position, so shutdown our decode
|
||||
// and audio threads.
|
||||
StopPlayback();
|
||||
StopAudioThread();
|
||||
ResetPlayback();
|
||||
nsresult res;
|
||||
|
@ -818,7 +818,7 @@ bool nsOpusState::DecodeHeader(ogg_packet* aPacket)
|
||||
}
|
||||
|
||||
// Otherwise, parse as the id header.
|
||||
if (aPacket->bytes < 19 || memcmp(aPacket->packet, "OpusHead\0", 9)) {
|
||||
if (aPacket->bytes < 19 || memcmp(aPacket->packet, "OpusHead", 8)) {
|
||||
LOG(PR_LOG_DEBUG, ("Invalid Opus file: unrecognized header"));
|
||||
mActive = false;
|
||||
return true;
|
||||
@ -826,6 +826,14 @@ bool nsOpusState::DecodeHeader(ogg_packet* aPacket)
|
||||
|
||||
mRate = 48000; // The Opus decoder runs at 48 kHz regardless.
|
||||
|
||||
int version = aPacket->packet[8];
|
||||
// Accept file format versions 0.x.
|
||||
if ((version & 0xf0) != 0) {
|
||||
LOG(PR_LOG_DEBUG, ("Rejecting unknown Opus file version %d", version));
|
||||
mActive = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
mChannels= aPacket->packet[9];
|
||||
mPreSkip = LEUint16(aPacket->packet + 10);
|
||||
mNominalRate = LEUint32(aPacket->packet + 12);
|
||||
@ -860,7 +868,7 @@ PRInt64 nsOpusState::Time(PRInt64 granulepos)
|
||||
bool nsOpusState::IsHeader(ogg_packet* aPacket)
|
||||
{
|
||||
return aPacket->bytes >= 16 &&
|
||||
(!memcmp(aPacket->packet, "OpusHead\0", 9) ||
|
||||
(!memcmp(aPacket->packet, "OpusHead", 8) ||
|
||||
!memcmp(aPacket->packet, "OpusTags", 8));
|
||||
}
|
||||
|
||||
|
@ -1312,7 +1312,13 @@ nsSMILTimedElement::ClearSpecs(TimeValueSpecList& aSpecs,
|
||||
InstanceTimeList& aInstances,
|
||||
RemovalTestFunction aRemove)
|
||||
{
|
||||
AutoIntervalUpdateBatcher(*this);
|
||||
|
||||
for (PRUint32 i = 0; i < aSpecs.Length(); ++i) {
|
||||
aSpecs[i]->Unlink();
|
||||
}
|
||||
aSpecs.Clear();
|
||||
|
||||
RemoveByFunction removeByFunction(aRemove);
|
||||
RemoveInstanceTimes(aInstances, removeByFunction);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class nsXBLDocGlobalObject : public nsIScriptGlobalObject,
|
||||
public nsIScriptObjectPrincipal
|
||||
{
|
||||
public:
|
||||
nsXBLDocGlobalObject(nsIScriptGlobalObjectOwner *aGlobalObjectOwner);
|
||||
nsXBLDocGlobalObject(nsXBLDocumentInfo *aGlobalObjectOwner);
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
@ -82,7 +82,7 @@ protected:
|
||||
nsCOMPtr<nsIScriptContext> mScriptContext;
|
||||
JSObject *mJSObject;
|
||||
|
||||
nsIScriptGlobalObjectOwner* mGlobalObjectOwner; // weak reference
|
||||
nsXBLDocumentInfo* mGlobalObjectOwner; // weak reference
|
||||
static JSClass gSharedGlobalClass;
|
||||
};
|
||||
|
||||
@ -181,7 +181,7 @@ JSClass nsXBLDocGlobalObject::gSharedGlobalClass = {
|
||||
// nsXBLDocGlobalObject
|
||||
//
|
||||
|
||||
nsXBLDocGlobalObject::nsXBLDocGlobalObject(nsIScriptGlobalObjectOwner *aGlobalObjectOwner)
|
||||
nsXBLDocGlobalObject::nsXBLDocGlobalObject(nsXBLDocumentInfo *aGlobalObjectOwner)
|
||||
: mJSObject(nsnull),
|
||||
mGlobalObjectOwner(aGlobalObjectOwner) // weak reference
|
||||
{
|
||||
@ -281,6 +281,11 @@ nsXBLDocGlobalObject::EnsureScriptEnvironment()
|
||||
false, &mJSObject, &compartment);
|
||||
NS_ENSURE_SUCCESS(rv, NS_OK);
|
||||
|
||||
// Set the location information for the new global, so that tools like
|
||||
// about:memory may use that information
|
||||
nsIURI *ownerURI = mGlobalObjectOwner->DocumentURI();
|
||||
xpc::SetLocationForGlobal(mJSObject, ownerURI);
|
||||
|
||||
::JS_SetGlobalObject(cx, mJSObject);
|
||||
|
||||
// Add an owning reference from JS back to us. This'll be
|
||||
|
@ -701,6 +701,11 @@ nsXULPDGlobalObject::EnsureScriptEnvironment()
|
||||
mContext = ctxNew;
|
||||
mJSObject = global;
|
||||
|
||||
// Set the location information for the new global, so that tools like
|
||||
// about:memory may use that information
|
||||
nsIURI *ownerURI = mGlobalObjectOwner->GetURI();
|
||||
xpc::SetLocationForGlobal(mJSObject, ownerURI);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ DIRS = \
|
||||
interfaces/base \
|
||||
interfaces/canvas \
|
||||
interfaces/core \
|
||||
interfaces/devicestorage \
|
||||
interfaces/html \
|
||||
interfaces/events \
|
||||
interfaces/contacts \
|
||||
@ -48,6 +49,7 @@ DIRS += \
|
||||
bindings \
|
||||
battery \
|
||||
contacts \
|
||||
devicestorage \
|
||||
power \
|
||||
settings \
|
||||
sms \
|
||||
|
@ -61,7 +61,7 @@ BrowserElementChild.prototype = {
|
||||
|
||||
if (!!appManifestURL) {
|
||||
windowUtils.setIsApp(true);
|
||||
windowUtils.setApp(mozApp);
|
||||
windowUtils.setApp(appManifestURL);
|
||||
} else {
|
||||
windowUtils.setIsApp(false);
|
||||
}
|
||||
|
@ -20,11 +20,6 @@ namespace dom {
|
||||
class DOMRequest : public nsDOMEventTargetHelper,
|
||||
public nsIDOMDOMRequest
|
||||
{
|
||||
bool mDone;
|
||||
jsval mResult;
|
||||
nsCOMPtr<nsIDOMDOMError> mError;
|
||||
bool mRooted;
|
||||
|
||||
NS_DECL_EVENT_HANDLER(success)
|
||||
NS_DECL_EVENT_HANDLER(error)
|
||||
|
||||
@ -46,6 +41,11 @@ public:
|
||||
UnrootResultVal();
|
||||
}
|
||||
|
||||
bool mDone;
|
||||
jsval mResult;
|
||||
nsCOMPtr<nsIDOMDOMError> mError;
|
||||
bool mRooted;
|
||||
|
||||
private:
|
||||
void FireEvent(const nsAString& aType);
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "nsMimeTypeArray.h"
|
||||
#include "nsDesktopNotification.h"
|
||||
#include "nsGeolocation.h"
|
||||
#include "nsDeviceStorage.h"
|
||||
#include "nsIHttpProtocolHandler.h"
|
||||
#include "nsICachingChannel.h"
|
||||
#include "nsIDocShell.h"
|
||||
@ -89,6 +90,7 @@ NS_INTERFACE_MAP_BEGIN(Navigator)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMNavigator)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigator)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMClientInformation)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorDeviceStorage)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorGeolocation)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMozNavigatorBattery)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorDesktopNotification)
|
||||
@ -839,6 +841,26 @@ Navigator::MozIsLocallyAvailable(const nsAString &aURI,
|
||||
return httpChannel->GetRequestSucceeded(aIsAvailable);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// Navigator::nsIDOMNavigatorDeviceStorage
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP Navigator::GetDeviceStorage(const nsAString &aType, nsIVariant** _retval)
|
||||
{
|
||||
if (!Preferences::GetBool("device.storage.enabled", false)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mWindow));
|
||||
|
||||
if (!win || !win->GetOuterWindow() || !win->GetDocShell()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsDOMDeviceStorage::CreateDeviceStoragesFor(win, aType, _retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// Navigator::nsIDOMNavigatorGeolocation
|
||||
//*****************************************************************************
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "nsIDOMNavigator.h"
|
||||
#include "nsIDOMNavigatorGeolocation.h"
|
||||
#include "nsIDOMNavigatorDeviceStorage.h"
|
||||
#include "nsIDOMNavigatorDesktopNotification.h"
|
||||
#include "nsIDOMClientInformation.h"
|
||||
#include "nsIDOMNavigatorBattery.h"
|
||||
@ -60,6 +61,7 @@ class PowerManager;
|
||||
|
||||
class Navigator : public nsIDOMNavigator
|
||||
, public nsIDOMClientInformation
|
||||
, public nsIDOMNavigatorDeviceStorage
|
||||
, public nsIDOMNavigatorGeolocation
|
||||
, public nsIDOMNavigatorDesktopNotification
|
||||
, public nsIDOMMozNavigatorBattery
|
||||
@ -79,6 +81,7 @@ public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOMNAVIGATOR
|
||||
NS_DECL_NSIDOMCLIENTINFORMATION
|
||||
NS_DECL_NSIDOMNAVIGATORDEVICESTORAGE
|
||||
NS_DECL_NSIDOMNAVIGATORGEOLOCATION
|
||||
NS_DECL_NSIDOMNAVIGATORDESKTOPNOTIFICATION
|
||||
NS_DECL_NSIDOMMOZNAVIGATORBATTERY
|
||||
|
@ -187,7 +187,7 @@ let DOMApplicationRegistry = {
|
||||
|
||||
let dir = FileUtils.getDir(DIRECTORY_NAME, ["webapps", id], true, true);
|
||||
let manFile = dir.clone();
|
||||
manFile.append("manifest.json");
|
||||
manFile.append("manifest.webapp");
|
||||
this._writeFile(manFile, JSON.stringify(app.manifest));
|
||||
this.webapps[id] = appObject;
|
||||
|
||||
@ -229,7 +229,13 @@ let DOMApplicationRegistry = {
|
||||
|
||||
let index = aIndex || 0;
|
||||
let id = aData[index].id;
|
||||
let file = FileUtils.getFile(DIRECTORY_NAME, ["webapps", id, "manifest.json"], true);
|
||||
|
||||
// the manifest file used to be named manifest.json, so fallback on this.
|
||||
let file = FileUtils.getFile(DIRECTORY_NAME, ["webapps", id, "manifest.webapp"], true);
|
||||
if (!file.exists()) {
|
||||
file = FileUtils.getFile(DIRECTORY_NAME, ["webapps", id, "manifest.json"], true);
|
||||
}
|
||||
|
||||
this._loadJSONAsync(file, (function(aJSON) {
|
||||
aData[index].manifest = aJSON;
|
||||
if (index == aData.length - 1)
|
||||
|
@ -414,6 +414,10 @@
|
||||
// Storage includes
|
||||
#include "nsDOMStorage.h"
|
||||
|
||||
// Device Storage
|
||||
#include "nsIDOMDeviceStorage.h"
|
||||
#include "nsIDOMDeviceStorageCursor.h"
|
||||
|
||||
// Drag and drop
|
||||
#include "nsIDOMDataTransfer.h"
|
||||
|
||||
@ -434,6 +438,7 @@
|
||||
|
||||
#include "nsIDOMDesktopNotification.h"
|
||||
#include "nsIDOMNavigatorDesktopNotification.h"
|
||||
#include "nsIDOMNavigatorDeviceStorage.h"
|
||||
#include "nsIDOMNavigatorGeolocation.h"
|
||||
#include "Navigator.h"
|
||||
|
||||
@ -1394,6 +1399,12 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
NS_DEFINE_CLASSINFO_DATA(MessageEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(DeviceStorage, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(DeviceStorageCursor, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(GeoGeolocation, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
@ -2431,6 +2442,7 @@ nsDOMClassInfo::Init()
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(Navigator, nsIDOMNavigator)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigator)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorDeviceStorage)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorGeolocation)
|
||||
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMNavigatorDesktopNotification,
|
||||
Navigator::HasDesktopNotificationSupport())
|
||||
@ -4034,6 +4046,16 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(DeviceStorage, nsIDOMDeviceStorage)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDeviceStorage)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(DeviceStorageCursor, nsIDOMDeviceStorageCursor)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDeviceStorageCursor)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMRequest)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(GeoGeolocation, nsIDOMGeoGeolocation)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMGeoGeolocation)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
@ -387,6 +387,9 @@ DOMCI_CLASS(DataContainerEvent)
|
||||
// HTML5
|
||||
DOMCI_CLASS(MessageEvent)
|
||||
|
||||
DOMCI_CLASS(DeviceStorage)
|
||||
DOMCI_CLASS(DeviceStorageCursor)
|
||||
|
||||
// Geolocation
|
||||
DOMCI_CLASS(GeoGeolocation)
|
||||
DOMCI_CLASS(GeoPosition)
|
||||
|
@ -62,6 +62,16 @@ public:
|
||||
*/
|
||||
nsIContent* GetFocusedContent() { return mFocusedContent; }
|
||||
|
||||
/**
|
||||
* Return a focused window. Version of nsIFocusManager::GetFocusedWindow.
|
||||
*/
|
||||
nsPIDOMWindow* GetFocusedWindow() const { return mFocusedWindow; }
|
||||
|
||||
/**
|
||||
* Return an active window. Version of nsIFocusManager::GetActiveWindow.
|
||||
*/
|
||||
nsPIDOMWindow* GetActiveWindow() const { return mActiveWindow; }
|
||||
|
||||
/**
|
||||
* Called when content has been removed.
|
||||
*/
|
||||
|
@ -1822,7 +1822,9 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
// Every script context we are initialized with must create a
|
||||
// new global.
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> &holder = mInnerWindowHolder;
|
||||
rv = mContext->CreateNativeGlobalForInner(sgo, isChrome,
|
||||
rv = mContext->CreateNativeGlobalForInner(sgo,
|
||||
aDocument->GetDocumentURI(),
|
||||
isChrome,
|
||||
aDocument->NodePrincipal(),
|
||||
&newInnerWindow->mJSObject,
|
||||
getter_AddRefs(holder));
|
||||
|
@ -913,7 +913,6 @@ protected:
|
||||
|
||||
// These member variables are used on both inner and the outer windows.
|
||||
nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
|
||||
nsCOMPtr<nsIDocument> mDoc; // For fast access to principals
|
||||
JSObject* mJSObject;
|
||||
|
||||
typedef nsCOMArray<nsIDOMStorageEvent> nsDOMStorageEventArray;
|
||||
|
@ -25,6 +25,7 @@ class nsIObjectOutputStream;
|
||||
template<class> class nsScriptObjectHolder;
|
||||
class nsIScriptObjectPrincipal;
|
||||
class nsIDOMWindow;
|
||||
class nsIURI;
|
||||
|
||||
typedef void (*nsScriptTerminationFunc)(nsISupports* aRef);
|
||||
|
||||
@ -44,8 +45,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContextPrincipal,
|
||||
NS_ISCRIPTCONTEXTPRINCIPAL_IID)
|
||||
|
||||
#define NS_ISCRIPTCONTEXT_IID \
|
||||
{ 0xf1c8c13e, 0xc23b, 0x434e, \
|
||||
{ 0xa4, 0x77, 0xe0, 0x2f, 0xc3, 0x73, 0xf8, 0x71 } }
|
||||
{ 0xec47ccd4, 0x5f6a, 0x40d6, \
|
||||
{ 0xbc, 0x2f, 0x5a, 0x1e, 0xd3, 0xe4, 0xb4, 0xff } }
|
||||
|
||||
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
|
||||
know what language we have is a little silly... */
|
||||
@ -265,6 +266,7 @@ public:
|
||||
*/
|
||||
virtual nsresult CreateNativeGlobalForInner(
|
||||
nsIScriptGlobalObject *aNewInner,
|
||||
nsIURI *aURI,
|
||||
bool aIsChrome,
|
||||
nsIPrincipal *aPrincipal,
|
||||
JSObject** aNativeGlobal,
|
||||
|
@ -2069,6 +2069,7 @@ nsJSContext::GetNativeGlobal()
|
||||
nsresult
|
||||
nsJSContext::CreateNativeGlobalForInner(
|
||||
nsIScriptGlobalObject *aNewInner,
|
||||
nsIURI *aURI,
|
||||
bool aIsChrome,
|
||||
nsIPrincipal *aPrincipal,
|
||||
JSObject** aNativeGlobal, nsISupports **aHolder)
|
||||
@ -2092,6 +2093,12 @@ nsJSContext::CreateNativeGlobalForInner(
|
||||
}
|
||||
jsholder->GetJSObject(aNativeGlobal);
|
||||
jsholder.forget(aHolder);
|
||||
|
||||
// Set the location information for the new global, so that tools like
|
||||
// about:memory may use that information
|
||||
MOZ_ASSERT(aNativeGlobal && *aNativeGlobal);
|
||||
xpc::SetLocationForGlobal(*aNativeGlobal, aURI);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -3045,9 +3052,9 @@ nsJSContext::CycleCollectNow(nsICycleCollectorListener *aListener,
|
||||
sFirstCollectionTime = now;
|
||||
}
|
||||
|
||||
nsString gcmsg;
|
||||
nsCString gcMsg;
|
||||
if (ccResults.mForcedGC) {
|
||||
gcmsg.AssignLiteral(", forced a GC");
|
||||
gcMsg.AssignLiteral(", forced a GC");
|
||||
}
|
||||
|
||||
NS_NAMED_MULTILINE_LITERAL_STRING(kFmt,
|
||||
@ -3061,7 +3068,7 @@ nsJSContext::CycleCollectNow(nsICycleCollectorListener *aListener,
|
||||
(now - start) / PR_USEC_PER_MSEC, suspected,
|
||||
ccResults.mVisitedRefCounted, ccResults.mVisitedGCed,
|
||||
ccResults.mFreedRefCounted, ccResults.mFreedGCed,
|
||||
sCCollectedWaitingForGC, gcmsg.get(),
|
||||
sCCollectedWaitingForGC, gcMsg.get(),
|
||||
sForgetSkippableBeforeCC,
|
||||
sMinForgetSkippableTime / PR_USEC_PER_MSEC,
|
||||
sMaxForgetSkippableTime / PR_USEC_PER_MSEC,
|
||||
|
@ -109,6 +109,7 @@ public:
|
||||
virtual JSObject* GetNativeGlobal();
|
||||
virtual nsresult CreateNativeGlobalForInner(
|
||||
nsIScriptGlobalObject *aGlobal,
|
||||
nsIURI *aURI,
|
||||
bool aIsChrome,
|
||||
nsIPrincipal *aPrincipal,
|
||||
JSObject** aNativeGlobal,
|
||||
|
@ -48,8 +48,8 @@ class nsIArray;
|
||||
class nsPIWindowRoot;
|
||||
|
||||
#define NS_PIDOMWINDOW_IID \
|
||||
{ 0x7a6238d4, 0x7cbc, 0x43b2, \
|
||||
{ 0x86, 0x68, 0x92, 0xeb, 0x9e, 0xb0, 0x49, 0xaf } }
|
||||
{ 0xf0bafbe6, 0xe45c, 0x490e, \
|
||||
{ 0xa2, 0x1c, 0xfe, 0x14, 0x2f, 0xb6, 0x34, 0xba } }
|
||||
|
||||
class nsPIDOMWindow : public nsIDOMWindowInternal
|
||||
{
|
||||
@ -164,6 +164,10 @@ public:
|
||||
{
|
||||
return mDocument;
|
||||
}
|
||||
nsIDocument* GetExtantDoc() const
|
||||
{
|
||||
return mDoc;
|
||||
}
|
||||
|
||||
// Internal getter/setter for the frame element, this version of the
|
||||
// getter crosses chrome boundaries whereas the public scriptable
|
||||
@ -596,6 +600,7 @@ protected:
|
||||
// sure you keep them in sync!
|
||||
nsCOMPtr<nsIDOMEventTarget> mChromeEventHandler; // strong
|
||||
nsCOMPtr<nsIDOMDocument> mDocument; // strong
|
||||
nsCOMPtr<nsIDocument> mDoc; // strong, for fast access
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> mParentTarget; // strong
|
||||
|
||||
|
@ -669,6 +669,58 @@ protected:
|
||||
#endif
|
||||
};
|
||||
|
||||
enum StringificationBehavior {
|
||||
eStringify,
|
||||
eEmpty,
|
||||
eNull
|
||||
};
|
||||
|
||||
static inline bool
|
||||
ConvertJSValueToString(JSContext* cx, const JS::Value& v, JS::Value* pval,
|
||||
StringificationBehavior nullBehavior,
|
||||
StringificationBehavior undefinedBehavior,
|
||||
nsDependentString& result)
|
||||
{
|
||||
JSString *s;
|
||||
if (v.isString()) {
|
||||
s = v.toString();
|
||||
} else {
|
||||
StringificationBehavior behavior;
|
||||
if (v.isNull()) {
|
||||
behavior = nullBehavior;
|
||||
} else if (v.isUndefined()) {
|
||||
behavior = undefinedBehavior;
|
||||
} else {
|
||||
behavior = eStringify;
|
||||
}
|
||||
|
||||
// If pval is null, that means the argument was optional and
|
||||
// not passed; turn those into void strings if they're
|
||||
// supposed to be stringified.
|
||||
if (behavior != eStringify || !pval) {
|
||||
// Here behavior == eStringify implies !pval, so both eNull and
|
||||
// eStringify should end up with void strings.
|
||||
result.SetIsVoid(behavior != eEmpty);
|
||||
return true;
|
||||
}
|
||||
|
||||
s = JS_ValueToString(cx, v);
|
||||
if (!s) {
|
||||
return false;
|
||||
}
|
||||
pval->setString(s); // Root the new string.
|
||||
}
|
||||
|
||||
size_t len;
|
||||
const jschar *chars = JS_GetStringCharsZAndLength(cx, s, &len);
|
||||
if (!chars) {
|
||||
return false;
|
||||
}
|
||||
|
||||
result.Rebind(chars, len);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -11,11 +11,11 @@ from WebIDL import *
|
||||
|
||||
AUTOGENERATED_WARNING_COMMENT = \
|
||||
"/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n"
|
||||
ADDPROPERTY_HOOK_NAME = '_AddProperty'
|
||||
FINALIZE_HOOK_NAME = '_Finalize'
|
||||
TRACE_HOOK_NAME = '_Trace'
|
||||
CONSTRUCT_HOOK_NAME = '_Construct'
|
||||
HASINSTANCE_HOOK_NAME = '_HasInstance'
|
||||
ADDPROPERTY_HOOK_NAME = '_addProperty'
|
||||
FINALIZE_HOOK_NAME = '_finalize'
|
||||
TRACE_HOOK_NAME = '_trace'
|
||||
CONSTRUCT_HOOK_NAME = '_constructor'
|
||||
HASINSTANCE_HOOK_NAME = '_hasInstance'
|
||||
|
||||
def replaceFileIfChanged(filename, newContents):
|
||||
"""
|
||||
@ -288,10 +288,9 @@ class CGNamespace(CGWrapper):
|
||||
Static helper method to build multiple wrapped namespaces.
|
||||
"""
|
||||
if not namespaces:
|
||||
return child
|
||||
return CGNamespace(namespaces[0], CGNamespace.build(namespaces[1:],
|
||||
child),
|
||||
declareOnly=declareOnly)
|
||||
return CGWrapper(child, declareOnly=declareOnly)
|
||||
inner = CGNamespace.build(namespaces[1:], child, declareOnly=declareOnly)
|
||||
return CGNamespace(namespaces[0], inner, declareOnly=declareOnly)
|
||||
|
||||
class CGIncludeGuard(CGWrapper):
|
||||
"""
|
||||
@ -510,7 +509,7 @@ class CGClassFinalizeHook(CGAbstractClassHook):
|
||||
release = """
|
||||
XPCJSRuntime *rt = nsXPConnect::GetRuntimeInstance();
|
||||
if (rt) {
|
||||
rt->DeferredRelease(NativeToSupports(self));
|
||||
rt->DeferredRelease(reinterpret_cast<nsISupports*>(self));
|
||||
} else {
|
||||
NS_RELEASE(self);
|
||||
}"""
|
||||
@ -554,9 +553,8 @@ class CGClassConstructHook(CGAbstractStaticMethod):
|
||||
preamble = """
|
||||
JSObject* obj = JS_GetGlobalForObject(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
|
||||
"""
|
||||
preArgs = ""
|
||||
if self.descriptor.workers:
|
||||
preArgs = "cx, obj, "
|
||||
preArgs = ["cx", "obj"]
|
||||
else:
|
||||
preamble += """
|
||||
nsISupports* global;
|
||||
@ -570,13 +568,12 @@ class CGClassConstructHook(CGAbstractStaticMethod):
|
||||
}
|
||||
}
|
||||
"""
|
||||
preArgs = "global, "
|
||||
preArgs = ["global"]
|
||||
|
||||
name = "_" + self._ctor.identifier.name
|
||||
nativeName = "_" + MakeNativeName(self._ctor.identifier.name)
|
||||
nativeName = self.descriptor.binaryNames.get(name, nativeName)
|
||||
name = MakeNativeName(self._ctor.identifier.name)
|
||||
nativeName = self.descriptor.binaryNames.get(name, name)
|
||||
callGenerator = CGMethodCall(preArgs, nativeName, True,
|
||||
self.descriptor, self._ctor, {})
|
||||
self.descriptor, self._ctor)
|
||||
return preamble + callGenerator.define();
|
||||
|
||||
class CGClassHasInstanceHook(CGAbstractStaticMethod):
|
||||
@ -1016,24 +1013,6 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
|
||||
*aEnabled = true;
|
||||
return !!%s(aCx, global, aReceiver);""" % (getter))
|
||||
|
||||
class CGNativeToSupportsMethod(CGAbstractStaticMethod):
|
||||
"""
|
||||
A method to cast our native to an nsISupports. We do it by casting up the
|
||||
interface chain in hopes of getting to something that singly-inherits from
|
||||
nsISupports.
|
||||
"""
|
||||
def __init__(self, descriptor):
|
||||
args = [Argument(descriptor.nativeType + '*', 'aNative')]
|
||||
CGAbstractStaticMethod.__init__(self, descriptor, 'NativeToSupports', 'nsISupports*', args)
|
||||
|
||||
def definition_body(self):
|
||||
cur = CGGeneric("aNative")
|
||||
for proto in reversed(self.descriptor.prototypeChain[:-1]):
|
||||
d = self.descriptor.getDescriptor(proto)
|
||||
cast = "static_cast<%s*>(\n" % d.nativeType;
|
||||
cur = CGWrapper(CGIndenter(cur), pre=cast, post=")")
|
||||
return CGIndenter(CGWrapper(cur, pre="return ", post=";")).define();
|
||||
|
||||
class CGWrapMethod(CGAbstractMethod):
|
||||
def __init__(self, descriptor):
|
||||
# XXX can we wrap if we don't have an interface prototype object?
|
||||
@ -1217,10 +1196,18 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
||||
before the generated code is entered.
|
||||
"""
|
||||
|
||||
# A helper function for dealing with failures due to the JS value being the
|
||||
# wrong type of value
|
||||
def onFailure(failureCode, isWorker):
|
||||
return CGWrapper(CGGeneric(
|
||||
failureCode or
|
||||
"return Throw<%s>(cx, NS_ERROR_XPC_BAD_CONVERT_JS);"
|
||||
% toStringBool(isWorker)), post="\n")
|
||||
|
||||
# A helper function for wrapping up the template body for
|
||||
# possibly-nullable objecty stuff
|
||||
def wrapObjectTemplate(templateBody, isDefinitelyObject, type,
|
||||
codeToSetNull, isWorker):
|
||||
codeToSetNull, isWorker, failureCode=None):
|
||||
if not isDefinitelyObject:
|
||||
# Handle the non-object cases by wrapping up the whole
|
||||
# thing in an if cascade.
|
||||
@ -1232,9 +1219,9 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
||||
"} else if (${val}.isNullOrUndefined()) {\n"
|
||||
" %s;\n" % codeToSetNull)
|
||||
templateBody += (
|
||||
"} else {\n"
|
||||
" return Throw<%s>(cx, NS_ERROR_XPC_BAD_CONVERT_JS);\n"
|
||||
"}" % toStringBool(not isWorker))
|
||||
"} else {\n" +
|
||||
CGIndenter(onFailure(failureCode, isWorker)).define() +
|
||||
"}")
|
||||
return templateBody
|
||||
|
||||
if type.isArray():
|
||||
@ -1388,12 +1375,8 @@ ${declName}.SwapElements(arr);
|
||||
"jsval tmpVal = ${val};\n" +
|
||||
typePtr + " tmp;\n"
|
||||
"if (NS_FAILED(xpc_qsUnwrapArg<" + typeName + ">(cx, ${val}, &tmp, getter_AddRefs(${holderName}), &tmpVal))) {\n")
|
||||
if failureCode is not None:
|
||||
templateBody += " " + failureCode + "\n"
|
||||
else:
|
||||
templateBody += (
|
||||
" return Throw<%s>(cx, NS_ERROR_XPC_BAD_CONVERT_JS);\n"
|
||||
% toStringBool(not descriptor.workers))
|
||||
templateBody += CGIndenter(onFailure(failureCode,
|
||||
descriptor.workers)).define()
|
||||
templateBody += ("}\n"
|
||||
"MOZ_ASSERT(tmp);\n")
|
||||
|
||||
@ -1434,9 +1417,9 @@ ${declName}.SwapElements(arr);
|
||||
"}")
|
||||
|
||||
template += (
|
||||
# XXXbz We don't know whether we're on workers, so play it safe
|
||||
" else {\n"
|
||||
" return Throw<false>(cx, NS_ERROR_XPC_BAD_CONVERT_JS);\n"
|
||||
" else {\n" +
|
||||
CGIndenter(onFailure(failureCode,
|
||||
descriptorProvider.workers)).define() +
|
||||
"}")
|
||||
|
||||
return (template, CGGeneric(declType), None)
|
||||
@ -1457,12 +1440,11 @@ ${declName}.SwapElements(arr);
|
||||
undefinedBehavior = "eStringify"
|
||||
|
||||
return (
|
||||
"const xpc_qsDOMString ${declName}(cx, ${val}, ${valPtr},\n"
|
||||
" xpc_qsDOMString::%s,\n"
|
||||
" xpc_qsDOMString::%s);\n"
|
||||
"if (!${declName}.IsValid()) {\n"
|
||||
"if (!ConvertJSValueToString(cx, ${val}, ${valPtr}, %s, %s, ${holderName})) {\n"
|
||||
" return false;\n"
|
||||
"}" % (nullBehavior, undefinedBehavior), None, None)
|
||||
"}\n"
|
||||
"${declName} = &${holderName};" % (nullBehavior, undefinedBehavior),
|
||||
CGGeneric("NonNull<const nsAString>"), CGGeneric("nsDependentString"))
|
||||
|
||||
if type.isEnum():
|
||||
if type.nullable():
|
||||
@ -1497,6 +1479,19 @@ ${declName}.SwapElements(arr);
|
||||
raise TypeError("Can't handle sequences of 'any'")
|
||||
return ("${declName} = ${val};", CGGeneric("JS::Value"), None)
|
||||
|
||||
if type.isObject():
|
||||
if isSequenceMember:
|
||||
raise TypeError("Can't handle sequences of 'object'")
|
||||
template = wrapObjectTemplate("${declName} = &${val}.toObject();",
|
||||
isDefinitelyObject, type,
|
||||
"${declName} = NULL",
|
||||
descriptorProvider.workers, failureCode)
|
||||
if type.nullable():
|
||||
declType = CGGeneric("JSObject*")
|
||||
else:
|
||||
declType = CGGeneric("NonNull<JSObject>")
|
||||
return (template, declType, None)
|
||||
|
||||
if not type.isPrimitive():
|
||||
raise TypeError("Need conversion for argument type '%s'" % type)
|
||||
|
||||
@ -1755,6 +1750,15 @@ if (!%(resultStr)s) {
|
||||
# to wrap here.
|
||||
return setValue(result, True)
|
||||
|
||||
if type.isObject():
|
||||
# See comments in WrapNewBindingObject explaining why we need
|
||||
# to wrap here.
|
||||
if type.nullable():
|
||||
toValue = "JS::ObjectOrNullValue(%s)"
|
||||
else:
|
||||
toValue = "JS::ObjectValue(*%s)"
|
||||
return setValue(toValue % result, True)
|
||||
|
||||
if not type.isPrimitive():
|
||||
raise TypeError("Need to learn to wrap %s" % type)
|
||||
|
||||
@ -1812,63 +1816,80 @@ def wrapForType(type, descriptorProvider, templateValues):
|
||||
defaultValues = {'obj': 'obj'}
|
||||
return string.Template(wrap).substitute(defaultValues, **templateValues)
|
||||
|
||||
# Returns a tuple consisting of a CGThing containing the type of the return
|
||||
# value and a boolean signalling whether we need to pass a JSContext as the
|
||||
# first argument of the call.
|
||||
def getRetvalDeclarationForType(returnType, descriptorProvider,
|
||||
resultAlreadyAddRefed):
|
||||
if returnType is None or returnType.isVoid():
|
||||
# Nothing to declare
|
||||
result = None
|
||||
elif returnType.isPrimitive() and returnType.tag() in builtinNames:
|
||||
return None, False
|
||||
if returnType.isPrimitive() and returnType.tag() in builtinNames:
|
||||
result = CGGeneric(builtinNames[returnType.tag()])
|
||||
if returnType.nullable():
|
||||
result = CGWrapper(result, pre="Nullable<", post=">")
|
||||
elif returnType.isString():
|
||||
result = CGGeneric("nsString")
|
||||
elif returnType.isEnum():
|
||||
return result, False
|
||||
if returnType.isString():
|
||||
return CGGeneric("nsString"), False
|
||||
if returnType.isEnum():
|
||||
if returnType.nullable():
|
||||
raise TypeError("We don't support nullable enum return values")
|
||||
result = CGGeneric(returnType.inner.identifier.name)
|
||||
elif returnType.isInterface() and not returnType.isArrayBuffer():
|
||||
return CGGeneric(returnType.inner.identifier.name), False
|
||||
if returnType.isInterface() and not returnType.isArrayBuffer():
|
||||
result = CGGeneric(descriptorProvider.getDescriptor(
|
||||
returnType.unroll().inner.identifier.name).nativeType)
|
||||
if resultAlreadyAddRefed:
|
||||
result = CGWrapper(result, pre="nsRefPtr<", post=">")
|
||||
else:
|
||||
result = CGWrapper(result, post="*")
|
||||
elif returnType.isCallback():
|
||||
return result, False
|
||||
if returnType.isCallback():
|
||||
# XXXbz we're going to assume that callback types are always
|
||||
# nullable for now.
|
||||
result = CGGeneric("JSObject*")
|
||||
elif returnType.tag() is IDLType.Tags.any:
|
||||
result = CGGeneric("JS::Value")
|
||||
elif returnType.isSequence():
|
||||
return CGGeneric("JSObject*"), False
|
||||
if returnType.tag() is IDLType.Tags.any:
|
||||
return CGGeneric("JS::Value"), False
|
||||
if returnType.isObject():
|
||||
return CGGeneric("JSObject*"), True
|
||||
if returnType.isSequence():
|
||||
nullable = returnType.nullable()
|
||||
if nullable:
|
||||
returnType = returnType.inner
|
||||
# Assume no need to addref for now
|
||||
result = CGWrapper(getRetvalDeclarationForType(returnType.inner,
|
||||
descriptorProvider,
|
||||
False),
|
||||
pre="nsTArray< ", post=" >")
|
||||
(result, needsCx) = getRetvalDeclarationForType(returnType.inner,
|
||||
descriptorProvider,
|
||||
False)
|
||||
result = CGWrapper(result, pre="nsTArray< ", post=" >")
|
||||
if nullable:
|
||||
result = CGWrapper(result, pre="Nullable< ", post=" >")
|
||||
else:
|
||||
raise TypeError("Don't know how to declare return value for %s" %
|
||||
returnType)
|
||||
return result
|
||||
return result, needsCx
|
||||
raise TypeError("Don't know how to declare return value for %s" %
|
||||
returnType)
|
||||
|
||||
|
||||
|
||||
def isResultAlreadyAddRefed(descriptor, extendedAttributes):
|
||||
# Default to already_AddRefed on the main thread, raw pointer in workers
|
||||
return not descriptor.workers and not 'resultNotAddRefed' in extendedAttributes
|
||||
|
||||
class CGCallGenerator(CGThing):
|
||||
"""
|
||||
A class to generate an actual call to a C++ object. Assumes that the C++
|
||||
object is stored in a variable named "self".
|
||||
"""
|
||||
def __init__(self, errorReport, argCount, argsPre, returnType,
|
||||
resultAlreadyAddRefed, descriptorProvider, nativeMethodName, static):
|
||||
def __init__(self, errorReport, arguments, argsPre, returnType,
|
||||
extendedAttributes, descriptorProvider, nativeMethodName, static):
|
||||
CGThing.__init__(self)
|
||||
|
||||
isFallible = errorReport is not None
|
||||
|
||||
args = CGList([CGGeneric("arg" + str(i)) for i in range(argCount)], ", ")
|
||||
args = CGList([CGGeneric(arg) for arg in argsPre], ", ")
|
||||
for (i, a) in enumerate(arguments):
|
||||
arg = "arg" + str(i)
|
||||
# This is a workaround for a bug in Apple's clang.
|
||||
if a.type.isObject() and not a.type.nullable():
|
||||
arg = "(JSObject&)" + arg
|
||||
args.append(CGGeneric(arg))
|
||||
resultOutParam = (returnType is not None and
|
||||
(returnType.isString() or returnType.isSequence()))
|
||||
# Return values that go in outparams go here
|
||||
@ -1877,8 +1898,18 @@ class CGCallGenerator(CGThing):
|
||||
if isFallible:
|
||||
args.append(CGGeneric("rv"))
|
||||
|
||||
result = getRetvalDeclarationForType(returnType, descriptorProvider,
|
||||
resultAlreadyAddRefed)
|
||||
resultAlreadyAddRefed = isResultAlreadyAddRefed(descriptorProvider,
|
||||
extendedAttributes)
|
||||
(result, needsCx) = getRetvalDeclarationForType(returnType,
|
||||
descriptorProvider,
|
||||
resultAlreadyAddRefed)
|
||||
|
||||
if not needsCx:
|
||||
needsCx = reduce(lambda b, a: b or a.type.isObject(), arguments,
|
||||
False)
|
||||
|
||||
if not "cx" in argsPre and (needsCx or 'implicitJSContext' in extendedAttributes):
|
||||
args.prepend(CGGeneric("cx"))
|
||||
|
||||
# Build up our actual call
|
||||
self.cgRoot = CGList([], "\n")
|
||||
@ -1889,7 +1920,7 @@ class CGCallGenerator(CGThing):
|
||||
returnType.unroll().inner.identifier.name).nativeType))
|
||||
else:
|
||||
call = CGWrapper(call, pre="self->")
|
||||
call = CGList([call, CGWrapper(args, pre="(" + argsPre, post=");")])
|
||||
call = CGList([call, CGWrapper(args, pre="(", post=");")])
|
||||
if result is not None:
|
||||
result = CGWrapper(result, post=" result;")
|
||||
self.cgRoot.prepend(result)
|
||||
@ -1932,16 +1963,17 @@ class CGPerSignatureCall(CGThing):
|
||||
# there.
|
||||
|
||||
def __init__(self, returnType, argsPre, arguments, nativeMethodName, static,
|
||||
descriptor, idlNode, extendedAttributes, argConversionStartsAt=0):
|
||||
descriptor, idlNode, argConversionStartsAt=0,
|
||||
getter=False, setter=False):
|
||||
CGThing.__init__(self)
|
||||
self.returnType = returnType
|
||||
self.descriptor = descriptor
|
||||
self.idlNode = idlNode
|
||||
self.extendedAttributes = extendedAttributes
|
||||
# Default to already_AddRefed on the main thread, raw pointer in workers
|
||||
self.resultAlreadyAddRefed = not descriptor.workers and not 'resultNotAddRefed' in self.extendedAttributes
|
||||
self.argsPre = "cx, " if 'implicitJSContext' in self.extendedAttributes else ""
|
||||
self.argsPre += argsPre
|
||||
self.extendedAttributes = descriptor.getExtendedAttributes(idlNode,
|
||||
getter=getter,
|
||||
setter=setter)
|
||||
self.argsPre = argsPre
|
||||
self.arguments = arguments
|
||||
self.argCount = len(arguments)
|
||||
if self.argCount > argConversionStartsAt:
|
||||
# Insert our argv in there
|
||||
@ -1954,8 +1986,8 @@ class CGPerSignatureCall(CGThing):
|
||||
|
||||
cgThings.append(CGCallGenerator(
|
||||
self.getErrorReport() if self.isFallible() else None,
|
||||
self.argCount, self.argsPre, returnType,
|
||||
self.resultAlreadyAddRefed, descriptor, nativeMethodName,
|
||||
self.arguments, self.argsPre, returnType,
|
||||
self.extendedAttributes, descriptor, nativeMethodName,
|
||||
static))
|
||||
self.cgRoot = CGList(cgThings, "\n")
|
||||
|
||||
@ -2034,8 +2066,7 @@ class CGMethodCall(CGThing):
|
||||
A class to generate selection of a method signature from a set of
|
||||
signatures and generation of a call to that signature.
|
||||
"""
|
||||
def __init__(self, argsPre, nativeMethodName, static, descriptor, method,
|
||||
extendedAttributes):
|
||||
def __init__(self, argsPre, nativeMethodName, static, descriptor, method):
|
||||
CGThing.__init__(self)
|
||||
|
||||
def requiredArgCount(signature):
|
||||
@ -2073,8 +2104,7 @@ class CGMethodCall(CGThing):
|
||||
def getPerSignatureCall(signature, argConversionStartsAt=0):
|
||||
return CGPerSignatureCall(signature[0], argsPre, signature[1],
|
||||
nativeMethodName, static, descriptor,
|
||||
method, extendedAttributes,
|
||||
argConversionStartsAt)
|
||||
method, argConversionStartsAt)
|
||||
|
||||
|
||||
signatures = method.signatures()
|
||||
@ -2302,10 +2332,11 @@ class CGGetterSetterCall(CGPerSignatureCall):
|
||||
particular IDL getter or setter.
|
||||
"""
|
||||
def __init__(self, returnType, arguments, nativeMethodName, descriptor,
|
||||
attr, extendedAttributes):
|
||||
CGPerSignatureCall.__init__(self, returnType, "", arguments,
|
||||
attr, getter=False, setter=False):
|
||||
assert bool(getter) != bool(setter)
|
||||
CGPerSignatureCall.__init__(self, returnType, [], arguments,
|
||||
nativeMethodName, False, descriptor, attr,
|
||||
extendedAttributes)
|
||||
getter=getter, setter=setter)
|
||||
def getArgv(self):
|
||||
if generateNativeAccessors:
|
||||
return CGPerSignatureCall.getArgv(self)
|
||||
@ -2316,10 +2347,9 @@ class CGGetterCall(CGGetterSetterCall):
|
||||
A class to generate a native object getter call for a particular IDL
|
||||
getter.
|
||||
"""
|
||||
def __init__(self, returnType, nativeMethodName, descriptor, attr,
|
||||
extendedAttributes):
|
||||
def __init__(self, returnType, nativeMethodName, descriptor, attr):
|
||||
CGGetterSetterCall.__init__(self, returnType, [], nativeMethodName,
|
||||
descriptor, attr, extendedAttributes)
|
||||
descriptor, attr, getter=True)
|
||||
def getArgc(self):
|
||||
if generateNativeAccessors:
|
||||
return CGGetterSetterCall.getArgc()
|
||||
@ -2340,11 +2370,10 @@ class CGSetterCall(CGGetterSetterCall):
|
||||
A class to generate a native object setter call for a particular IDL
|
||||
setter.
|
||||
"""
|
||||
def __init__(self, argType, nativeMethodName, descriptor, attr,
|
||||
extendedAttributes):
|
||||
def __init__(self, argType, nativeMethodName, descriptor, attr):
|
||||
CGGetterSetterCall.__init__(self, None, [FakeArgument(argType)],
|
||||
nativeMethodName, descriptor, attr,
|
||||
extendedAttributes)
|
||||
setter=True)
|
||||
def wrap_return_value(self):
|
||||
if generateNativeAccessors:
|
||||
return CGGetterSetterCall.wrap_return_value(self)
|
||||
@ -2373,8 +2402,7 @@ class CGAbstractBindingMethod(CGAbstractStaticMethod):
|
||||
function to do the rest of the work. This function should return a
|
||||
CGThing which is already properly indented.
|
||||
"""
|
||||
def __init__(self, descriptor, name, args, extendedAttributes):
|
||||
self.extendedAttributes = extendedAttributes
|
||||
def __init__(self, descriptor, name, args):
|
||||
CGAbstractStaticMethod.__init__(self, descriptor, name, "JSBool", args)
|
||||
|
||||
def definition_body(self):
|
||||
@ -2408,14 +2436,12 @@ class CGNativeMethod(CGAbstractBindingMethod):
|
||||
baseName = method.identifier.name
|
||||
args = [Argument('JSContext*', 'cx'), Argument('unsigned', 'argc'),
|
||||
Argument('JS::Value*', 'vp')]
|
||||
CGAbstractBindingMethod.__init__(self, descriptor, baseName, args,
|
||||
descriptor.getExtendedAttributes(method))
|
||||
CGAbstractBindingMethod.__init__(self, descriptor, baseName, args)
|
||||
def generate_code(self):
|
||||
name = self.method.identifier.name
|
||||
nativeName = self.descriptor.binaryNames.get(name, MakeNativeName(name))
|
||||
return CGMethodCall("", nativeName, self.method.isStatic(),
|
||||
self.descriptor, self.method,
|
||||
self.extendedAttributes)
|
||||
return CGMethodCall([], nativeName, self.method.isStatic(),
|
||||
self.descriptor, self.method)
|
||||
|
||||
class CGNativeGetter(CGAbstractBindingMethod):
|
||||
"""
|
||||
@ -2430,8 +2456,7 @@ class CGNativeGetter(CGAbstractBindingMethod):
|
||||
else:
|
||||
args = [Argument('JSContext*', 'cx'), Argument('JSHandleObject', 'obj'),
|
||||
Argument('JSHandleId', 'id'), Argument('JS::Value*', 'vp')]
|
||||
CGAbstractBindingMethod.__init__(self, descriptor, name, args,
|
||||
descriptor.getExtendedAttributes(self.attr, getter=True))
|
||||
CGAbstractBindingMethod.__init__(self, descriptor, name, args)
|
||||
|
||||
def getThis(self):
|
||||
if generateNativeAccessors:
|
||||
@ -2443,7 +2468,7 @@ class CGNativeGetter(CGAbstractBindingMethod):
|
||||
|
||||
nativeMethodName = "Get" + MakeNativeName(self.attr.identifier.name)
|
||||
return CGIndenter(CGGetterCall(self.attr.type, nativeMethodName, self.descriptor,
|
||||
self.attr, self.extendedAttributes))
|
||||
self.attr))
|
||||
|
||||
class CGNativeSetter(CGAbstractBindingMethod):
|
||||
"""
|
||||
@ -2460,8 +2485,7 @@ class CGNativeSetter(CGAbstractBindingMethod):
|
||||
args = [Argument('JSContext*', 'cx'), Argument('JSHandleObject', 'obj'),
|
||||
Argument('JSHandleId', 'id'), Argument('JSBool', 'strict'),
|
||||
Argument('JS::Value*', 'vp')]
|
||||
CGAbstractBindingMethod.__init__(self, descriptor, name, args,
|
||||
descriptor.getExtendedAttributes(self.attr, setter=True))
|
||||
CGAbstractBindingMethod.__init__(self, descriptor, name, args)
|
||||
|
||||
def getThis(self):
|
||||
if generateNativeAccessors:
|
||||
@ -2472,7 +2496,7 @@ class CGNativeSetter(CGAbstractBindingMethod):
|
||||
def generate_code(self):
|
||||
nativeMethodName = "Set" + MakeNativeName(self.attr.identifier.name)
|
||||
return CGIndenter(CGSetterCall(self.attr.type, nativeMethodName, self.descriptor,
|
||||
self.attr, self.extendedAttributes))
|
||||
self.attr))
|
||||
|
||||
def getEnumValueName(value):
|
||||
# Some enum values can be empty strings. Others might have weird
|
||||
@ -2946,8 +2970,6 @@ class CGDescriptor(CGThing):
|
||||
|
||||
# Always have a finalize hook, regardless of whether the class wants a
|
||||
# custom hook.
|
||||
if descriptor.nativeIsISupports:
|
||||
cgThings.append(CGNativeToSupportsMethod(descriptor))
|
||||
cgThings.append(CGClassFinalizeHook(descriptor))
|
||||
|
||||
# Only generate a trace hook if the class wants a custom hook.
|
||||
|
40
dom/devicestorage/Makefile.in
Normal file
40
dom/devicestorage/Makefile.in
Normal file
@ -0,0 +1,40 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = dom
|
||||
LIBRARY_NAME = domdevicestorage_s
|
||||
XPIDL_MODULE = dom_devicestorage
|
||||
LIBXUL_LIBRARY = 1
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/dom/dom-config.mk
|
||||
|
||||
CPPSRCS = \
|
||||
nsDeviceStorage.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
nsDeviceStorage.h \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(topsrcdir)/dom/base \
|
||||
-I$(topsrcdir)/dom/ipc \
|
||||
-I$(topsrcdir)/content/base/src \
|
||||
-I$(topsrcdir)/content/events/src \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -D_IMPL_NS_LAYOUT
|
||||
|
1186
dom/devicestorage/nsDeviceStorage.cpp
Normal file
1186
dom/devicestorage/nsDeviceStorage.cpp
Normal file
File diff suppressed because it is too large
Load Diff
58
dom/devicestorage/nsDeviceStorage.h
Normal file
58
dom/devicestorage/nsDeviceStorage.h
Normal file
@ -0,0 +1,58 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsDeviceStorage_h
|
||||
#define nsDeviceStorage_h
|
||||
|
||||
class nsPIDOMWindow;
|
||||
|
||||
#include "nsIClassInfo.h"
|
||||
#include "nsIDOMDeviceStorage.h"
|
||||
#include "nsIDOMDeviceStorageCursor.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsString.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
|
||||
class nsDOMDeviceStorage : public nsIDOMDeviceStorage
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOMDEVICESTORAGE
|
||||
|
||||
nsDOMDeviceStorage();
|
||||
|
||||
nsresult Init(nsPIDOMWindow* aWindow, const nsAString &aType, const PRInt32 aIndex);
|
||||
|
||||
PRInt32 SetRootFileForType(const nsAString& aType, const PRInt32 aIndex);
|
||||
|
||||
static void CreateDeviceStoragesFor(nsPIDOMWindow* aWin, const nsAString &aType, nsIVariant** _retval);
|
||||
|
||||
private:
|
||||
~nsDOMDeviceStorage();
|
||||
|
||||
|
||||
nsresult GetInternal(const JS::Value & aName, JSContext* aCx, nsIDOMDOMRequest * *_retval NS_OUTPARAM, bool aEditable);
|
||||
nsresult EnumerateInternal(const nsAString & aName, nsIDOMDeviceStorageCursor * *_retval NS_OUTPARAM, bool aEditable);
|
||||
|
||||
PRInt32 mStorageType;
|
||||
nsCOMPtr<nsIFile> mFile;
|
||||
|
||||
nsWeakPtr mOwner;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
|
||||
// nsIDOMDeviceStorage.type
|
||||
enum {
|
||||
DEVICE_STORAGE_TYPE_DEFAULT = 0,
|
||||
DEVICE_STORAGE_TYPE_SHARED,
|
||||
DEVICE_STORAGE_TYPE_EXTERNAL,
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
26
dom/interfaces/devicestorage/Makefile.in
Normal file
26
dom/interfaces/devicestorage/Makefile.in
Normal file
@ -0,0 +1,26 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = dom
|
||||
LIBRARY_NAME = domdevicestorage_s
|
||||
XPIDL_MODULE = dom_devicestorage
|
||||
LIBXUL_LIBRARY = 1
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/dom/dom-config.mk
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIDOMDeviceStorage.idl \
|
||||
nsIDOMDeviceStorageCursor.idl \
|
||||
nsIDOMNavigatorDeviceStorage.idl
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
35
dom/interfaces/devicestorage/nsIDOMDeviceStorage.idl
Normal file
35
dom/interfaces/devicestorage/nsIDOMDeviceStorage.idl
Normal file
@ -0,0 +1,35 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "domstubs.idl"
|
||||
interface nsIDOMBlob;
|
||||
interface nsIDOMDOMRequest;
|
||||
interface nsIDOMDeviceStorageCursor;
|
||||
|
||||
[scriptable, uuid(05C0D0C8-D698-4CCD-899C-7198A33BD7EC)]
|
||||
interface nsIDOMDeviceStorage : nsISupports
|
||||
{
|
||||
/*
|
||||
* Hint as to what kind of storage this object is.
|
||||
* May be "external", "shared", or "default".
|
||||
*/
|
||||
readonly attribute DOMString type;
|
||||
|
||||
nsIDOMDOMRequest add(in nsIDOMBlob aBlob);
|
||||
nsIDOMDOMRequest addNamed(in nsIDOMBlob aBlob, in DOMString aName);
|
||||
|
||||
[implicit_jscontext]
|
||||
nsIDOMDOMRequest get(in jsval aName);
|
||||
|
||||
[implicit_jscontext]
|
||||
nsIDOMDOMRequest getEditable(in jsval aName);
|
||||
|
||||
[implicit_jscontext]
|
||||
nsIDOMDOMRequest delete(in jsval aName);
|
||||
|
||||
nsIDOMDeviceStorageCursor enumerate([optional] in DOMString directory);
|
||||
|
||||
nsIDOMDeviceStorageCursor enumerateEditable([optional] in DOMString directory);
|
||||
};
|
||||
|
11
dom/interfaces/devicestorage/nsIDOMDeviceStorageCursor.idl
Normal file
11
dom/interfaces/devicestorage/nsIDOMDeviceStorageCursor.idl
Normal file
@ -0,0 +1,11 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "domstubs.idl"
|
||||
|
||||
[scriptable, uuid(995DFF99-ED70-4780-AC9A-4B58CD491186)]
|
||||
interface nsIDOMDeviceStorageCursor : nsISupports
|
||||
{
|
||||
void continue();
|
||||
};
|
@ -0,0 +1,17 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "domstubs.idl"
|
||||
interface nsIVariant;
|
||||
|
||||
/**
|
||||
* Property that extends the navigator object.
|
||||
*/
|
||||
[scriptable, uuid(A4B2831D-6065-472F-8A6D-2C9085C74C15)]
|
||||
interface nsIDOMNavigatorDeviceStorage : nsISupports
|
||||
{
|
||||
// returns an array of nsIDOMDeviceStorage
|
||||
nsIVariant getDeviceStorage(in DOMString type);
|
||||
};
|
||||
|
@ -80,6 +80,10 @@ LOCAL_INCLUDES += \
|
||||
|
||||
DEFINES += -DBIN_SUFFIX='"$(BIN_SUFFIX)"'
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),$(findstring $(MOZ_WIDGET_TOOLKIT),android gtk2 gonk qt))
|
||||
DEFINES += -DMOZ_ENABLE_FREETYPE
|
||||
endif
|
||||
|
||||
ifdef MOZ_PERMISSIONS
|
||||
DEFINES += -DMOZ_PERMISSIONS
|
||||
endif
|
||||
|
@ -910,7 +910,8 @@ TabChild::InitWidget(const nsIntSize& size)
|
||||
NS_ABORT_IF_FALSE(0 == remoteFrame->ManagedPLayersChild().Length(),
|
||||
"shouldn't have a shadow manager yet");
|
||||
LayerManager::LayersBackend be;
|
||||
PLayersChild* shadowManager = remoteFrame->SendPLayersConstructor(&be);
|
||||
PRInt32 maxTextureSize;
|
||||
PLayersChild* shadowManager = remoteFrame->SendPLayersConstructor(&be, &maxTextureSize);
|
||||
if (!shadowManager) {
|
||||
NS_WARNING("failed to construct LayersChild");
|
||||
// This results in |remoteFrame| being deleted.
|
||||
@ -923,6 +924,7 @@ TabChild::InitWidget(const nsIntSize& size)
|
||||
NS_ABORT_IF_FALSE(lf && lf->HasShadowManager(),
|
||||
"PuppetWidget should have shadow manager");
|
||||
lf->SetParentBackendType(be);
|
||||
lf->SetMaxTextureSize(maxTextureSize);
|
||||
|
||||
mRemoteFrame = remoteFrame;
|
||||
return true;
|
||||
|
@ -3416,7 +3416,6 @@ void* nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState)
|
||||
if (!mWidget || !mPluginWindow || !mInstance || !mObjectFrame)
|
||||
return nsnull;
|
||||
|
||||
NPDrawingModel drawingModel = GetDrawingModel();
|
||||
NPEventModel eventModel = GetEventModel();
|
||||
|
||||
nsCOMPtr<nsIPluginWidget> pluginWidget = do_QueryInterface(mWidget);
|
||||
@ -3458,6 +3457,7 @@ void* nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState)
|
||||
|
||||
#ifndef NP_NO_QUICKDRAW
|
||||
// set the port coordinates
|
||||
NPDrawingModel drawingModel = GetDrawingModel();
|
||||
if (drawingModel == NPDrawingModelQuickDraw) {
|
||||
mPluginWindow->x = -static_cast<NP_Port*>(pluginPort)->portx;
|
||||
mPluginWindow->y = -static_cast<NP_Port*>(pluginPort)->porty;
|
||||
|
@ -15,6 +15,12 @@
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
const isOSXLion = navigator.userAgent.indexOf("Mac OS X 10.7") != -1;
|
||||
if (isOSXLion) {
|
||||
todo(false, "Can't test plugin crash notification on OS X 10.7, see bug 705047");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
var success = false;
|
||||
|
||||
var observerFired = false;
|
||||
|
@ -15,6 +15,12 @@
|
||||
<![CDATA[
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
const isOSXLion = navigator.userAgent.indexOf("Mac OS X 10.7") != -1;
|
||||
if (isOSXLion) {
|
||||
todo(false, "Can't test plugin crash notification on OS X 10.7, see bug 705047");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
var success = false;
|
||||
|
||||
var observerFired = false;
|
||||
|
@ -18,6 +18,12 @@
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.ignoreAllUncaughtExceptions();
|
||||
|
||||
const isOSXLion = navigator.userAgent.indexOf("Mac OS X 10.7") != -1;
|
||||
if (isOSXLion) {
|
||||
todo(false, "Can't test plugin crash notification on OS X 10.7, see bug 705047");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
Components.utils.import("resource://gre/modules/NetUtil.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
|
@ -6,6 +6,12 @@
|
||||
<script class="testbody" type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
const isOSXLion = navigator.userAgent.indexOf("Mac OS X 10.7") != -1;
|
||||
if (isOSXLion) {
|
||||
todo(false, "Can't test plugin crash notification on OS X 10.7, see bug 705047");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
window.frameLoaded = function frameLoaded_toCrash() {
|
||||
if (!SimpleTest.testPluginIsOOP()) {
|
||||
ok(true, "Skipping this test when test plugin is not OOP.");
|
||||
|
@ -6,6 +6,12 @@
|
||||
<script class="testbody" type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
const isOSXLion = navigator.userAgent.indexOf("Mac OS X 10.7") != -1;
|
||||
if (isOSXLion) {
|
||||
todo(false, "Can't test plugin crash notification on OS X 10.7, see bug 705047");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
window.frameLoaded = function frameLoaded_toCrash() {
|
||||
if (!SimpleTest.testPluginIsOOP()) {
|
||||
ok(true, "Skipping this test when test plugin is not OOP.");
|
||||
|
@ -117,8 +117,10 @@ SettingsLock.prototype = {
|
||||
},
|
||||
|
||||
get: function get(aName) {
|
||||
if (!this._open)
|
||||
if (!this._open) {
|
||||
dump("Settings lock not open!\n");
|
||||
throw Components.results.NS_ERROR_ABORT;
|
||||
}
|
||||
|
||||
if (this._settingsManager.hasReadPrivileges || this._settingsManager.hasReadWritePrivileges) {
|
||||
let req = Services.DOMRequest.createRequest(this._settingsManager._window);
|
||||
@ -132,8 +134,10 @@ SettingsLock.prototype = {
|
||||
},
|
||||
|
||||
set: function set(aSettings) {
|
||||
if (!this._open)
|
||||
if (!this._open) {
|
||||
dump("Settings lock not open!\n");
|
||||
throw Components.results.NS_ERROR_ABORT;
|
||||
}
|
||||
|
||||
if (this._settingsManager.hasReadWritePrivileges) {
|
||||
let req = Services.DOMRequest.createRequest(this._settingsManager._window);
|
||||
@ -148,8 +152,10 @@ SettingsLock.prototype = {
|
||||
},
|
||||
|
||||
clear: function clear() {
|
||||
if (!this._open)
|
||||
if (!this._open) {
|
||||
dump("Settings lock not open!\n");
|
||||
throw Components.results.NS_ERROR_ABORT;
|
||||
}
|
||||
|
||||
if (this._settingsManager.hasReadWritePrivileges) {
|
||||
let req = Services.DOMRequest.createRequest(this._settingsManager._window);
|
||||
|
@ -476,6 +476,22 @@ var steps = [
|
||||
};
|
||||
req.onerror = onFailure;
|
||||
},
|
||||
function () {
|
||||
ok(true, "Test set after lock closed");
|
||||
var lockx = mozSettings.getLock();
|
||||
var cb = function() {
|
||||
var reqx = null;
|
||||
try {
|
||||
reqx = lockx.set(wifiNetworks0);
|
||||
ok(false, "should have thrown");
|
||||
} catch (ex) {
|
||||
ok(reqx == null, "request is still null");
|
||||
ok(true, "Caught Exception");
|
||||
next();
|
||||
}
|
||||
}
|
||||
SimpleTest.executeSoon(cb);
|
||||
},
|
||||
function() {
|
||||
ok(true, "Clear DB");
|
||||
var lock = mozSettings.getLock();
|
||||
|
@ -18,6 +18,7 @@ DIRS += \
|
||||
ajax \
|
||||
bugs \
|
||||
chrome \
|
||||
devicestorage \
|
||||
general \
|
||||
whatwg \
|
||||
geolocation \
|
||||
|
27
dom/tests/mochitest/devicestorage/Makefile.in
Normal file
27
dom/tests/mochitest/devicestorage/Makefile.in
Normal file
@ -0,0 +1,27 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = dom/tests/mochitest/devicestorage
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TEST_FILES = \
|
||||
test_sanity.html \
|
||||
test_basic.html \
|
||||
test_enumerate.html \
|
||||
test_enumerateMultipleContinue.html \
|
||||
test_overwrite.html \
|
||||
test_dotdot.html \
|
||||
devicestorage_common.js \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
48
dom/tests/mochitest/devicestorage/devicestorage_common.js
Normal file
48
dom/tests/mochitest/devicestorage/devicestorage_common.js
Normal file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
var oldVal = false;
|
||||
|
||||
function devicestorage_setup() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
try {
|
||||
oldVal = SpecialPowers.getBoolPref("device.storage.enabled");
|
||||
} catch(e) {}
|
||||
SpecialPowers.setBoolPref("device.storage.enabled", true);
|
||||
SpecialPowers.setBoolPref("device.storage.testing", true);
|
||||
SpecialPowers.setBoolPref("device.storage.prompt.testing", true);
|
||||
}
|
||||
|
||||
function devicestorage_cleanup() {
|
||||
SpecialPowers.setBoolPref("device.storage.enabled", oldVal);
|
||||
SpecialPowers.setBoolPref("device.storage.testing", false);
|
||||
SpecialPowers.setBoolPref("device.storage.prompt.testing", false);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function getRandomBuffer() {
|
||||
var size = 1024;
|
||||
var buffer = new ArrayBuffer(size);
|
||||
var view = new Uint8Array(buffer);
|
||||
for (var i = 0; i < size; i++) {
|
||||
view[i] = parseInt(Math.random() * 255);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
function createRandomBlob() {
|
||||
return blob = new Blob([getRandomBuffer()], {type: 'binary/random'});
|
||||
}
|
||||
|
||||
function randomFilename(l) {
|
||||
var set = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";
|
||||
var result = "";
|
||||
for (var i=0; i<l; i++) {
|
||||
var r = Math.floor(set.length * Math.random());
|
||||
result += set.substring(r, r + 1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
102
dom/tests/mochitest/devicestorage/test_basic.html
Normal file
102
dom/tests/mochitest/devicestorage/test_basic.html
Normal file
@ -0,0 +1,102 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html> <!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=717103
|
||||
-->
|
||||
<head>
|
||||
<title>Test for the device storage API </title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="devicestorage_common.js"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=717103">Mozilla Bug 717103</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
devicestorage_setup();
|
||||
|
||||
var gFileName = "devicestorage/hi";
|
||||
|
||||
function getAfterDeleteSuccess(e) {
|
||||
ok(false, "file was deleted not successfully");
|
||||
devicestorage_cleanup();
|
||||
}
|
||||
|
||||
function getAfterDeleteError(e) {
|
||||
ok(true, "file was deleted successfully");
|
||||
devicestorage_cleanup();
|
||||
}
|
||||
|
||||
function deleteSuccess(e) {
|
||||
|
||||
ok(e.target.result == gFileName, "File name should match");
|
||||
|
||||
var storage = navigator.getDeviceStorage("profile");
|
||||
request = storage[0].get(e.target.result);
|
||||
request.onsuccess = getAfterDeleteSuccess;
|
||||
request.onerror = getAfterDeleteError;
|
||||
|
||||
}
|
||||
|
||||
function deleteError(e) {
|
||||
ok(false, "deleteError was called : " + e.target.error.name);
|
||||
devicestorage_cleanup();
|
||||
}
|
||||
|
||||
function getSuccess(e) {
|
||||
var storage = navigator.getDeviceStorage("profile");
|
||||
ok(navigator.getDeviceStorage, "Should have getDeviceStorage");
|
||||
|
||||
ok(e.target.result.name == gFileName, "File name should match");
|
||||
|
||||
request = storage[0].delete(e.target.result.name)
|
||||
request.onsuccess = deleteSuccess;
|
||||
request.onerror = deleteError;
|
||||
}
|
||||
|
||||
function getError(e) {
|
||||
ok(false, "getError was called : " + e.target.error.name);
|
||||
SpecialPowers.setBoolPref("device.storage.enabled", oldVal);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function addSuccess(e) {
|
||||
|
||||
ok(e.target.result == gFileName, "File name should match");
|
||||
|
||||
var storage = navigator.getDeviceStorage("profile");
|
||||
request = storage[0].get(gFileName);
|
||||
request.onsuccess = getSuccess;
|
||||
request.onerror = getError;
|
||||
|
||||
ok(true, "addSuccess was called");
|
||||
}
|
||||
|
||||
function addError(e) {
|
||||
ok(false, "addError was called : " + e.target.error.name);
|
||||
devicestorage_cleanup();
|
||||
}
|
||||
|
||||
var storage = navigator.getDeviceStorage("profile");
|
||||
ok(navigator.getDeviceStorage, "Should have getDeviceStorage");
|
||||
|
||||
request = storage[0].addNamed(createRandomBlob(), "devicestorage/hi");
|
||||
ok(request, "Should have a non-null request");
|
||||
|
||||
request.onsuccess = addSuccess;
|
||||
request.onerror = addError;
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
71
dom/tests/mochitest/devicestorage/test_dotdot.html
Normal file
71
dom/tests/mochitest/devicestorage/test_dotdot.html
Normal file
@ -0,0 +1,71 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html> <!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=717103
|
||||
-->
|
||||
<head>
|
||||
<title>Test for the device storage API </title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="devicestorage_common.js"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=717103">Mozilla Bug 717103</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
devicestorage_setup();
|
||||
|
||||
function profileStorage() {
|
||||
return navigator.getDeviceStorage("profile")[0];
|
||||
}
|
||||
|
||||
var tests = [
|
||||
function () { return profileStorage().addNamed(createRandomBlob(), gFileName); },
|
||||
function () { return profileStorage().delete(gFileName); },
|
||||
function () { return profileStorage().get(gFileName); },
|
||||
function () { var r = profileStorage().enumerate("../"); return r; }
|
||||
];
|
||||
|
||||
var gFileName = "../owned";
|
||||
|
||||
function fail(e) {
|
||||
ok(false, "addSuccess was called");
|
||||
dump(request);
|
||||
devicestorage_cleanup();
|
||||
}
|
||||
|
||||
function next(e) {
|
||||
|
||||
if (e != undefined)
|
||||
ok(true, "addError was called");
|
||||
|
||||
var f = tests.pop();
|
||||
|
||||
if (f == undefined) {
|
||||
devicestorage_cleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
request = f();
|
||||
request.onsuccess = fail;
|
||||
request.onerror = next;
|
||||
}
|
||||
|
||||
next();
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
101
dom/tests/mochitest/devicestorage/test_enumerate.html
Normal file
101
dom/tests/mochitest/devicestorage/test_enumerate.html
Normal file
@ -0,0 +1,101 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html> <!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=717103
|
||||
-->
|
||||
<head>
|
||||
<title>Test for the device storage API </title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="devicestorage_common.js"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=717103">Mozilla Bug 717103</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
// Array Remove - By John Resig (MIT Licensed)
|
||||
Array.prototype.remove = function(from, to) {
|
||||
var rest = this.slice((to || from) + 1 || this.length);
|
||||
this.length = from < 0 ? this.length + from : from;
|
||||
return this.push.apply(this, rest);
|
||||
};
|
||||
|
||||
devicestorage_setup();
|
||||
|
||||
function enumerateSuccess(e) {
|
||||
|
||||
if (e.target.result == null) {
|
||||
ok(files.length == 0, "when the enumeration is done, we shouldn't have any files in this array")
|
||||
dump("We still have length = " + files.length);
|
||||
devicestorage_cleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
dump("asdfasdf"+ e.target.result + "\n");
|
||||
dump("asdfasdf"+ e.target.result.name + "\n");
|
||||
|
||||
var filename = e.target.result.name;
|
||||
|
||||
var index = files.indexOf(filename);
|
||||
files.remove(index);
|
||||
|
||||
ok(index > -1, "filename should be in the enumeration : " + e.target.result.name);
|
||||
|
||||
// clean up
|
||||
var cleanup = storage[0].delete(prefix + "/" + filename);
|
||||
cleanup.onsuccess = function(e) {} // todo - can i remove this?
|
||||
|
||||
e.target.continue();
|
||||
}
|
||||
|
||||
function handleError(e) {
|
||||
ok(false, "handleError was called : " + e.target.error.name);
|
||||
devicestorage_cleanup();
|
||||
}
|
||||
|
||||
function addSuccess(e) {
|
||||
addedSoFar = addedSoFar + 1;
|
||||
if (addedSoFar == files.length) {
|
||||
|
||||
var cursor = storage[0].enumerate(prefix);
|
||||
cursor.onsuccess = enumerateSuccess;
|
||||
cursor.onerror = handleError;
|
||||
}
|
||||
}
|
||||
|
||||
function addError(e) {
|
||||
ok(false, "addError was called : " + e.target.error.name);
|
||||
devicestorage_cleanup();
|
||||
}
|
||||
|
||||
var storage = navigator.getDeviceStorage("profile");
|
||||
ok(navigator.getDeviceStorage, "Should have getDeviceStorage");
|
||||
var prefix = "devicestorage/" + randomFilename(12)
|
||||
|
||||
var files = [ "a", "b", "c", "d/a", "d/b", "d/c", "d/d", "The/quick/brown/fox/jumps/over/the/lazy/dog"]
|
||||
var addedSoFar = 0;
|
||||
|
||||
|
||||
for (var i=0; i<files.length; i++) {
|
||||
|
||||
request = storage[0].addNamed(createRandomBlob(), prefix + '/' + files[i]);
|
||||
|
||||
ok(request, "Should have a non-null request");
|
||||
request.onsuccess = addSuccess;
|
||||
request.onerror = addError;
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -0,0 +1,50 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html> <!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=717103
|
||||
-->
|
||||
<head>
|
||||
<title>Test for the device storage API </title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="devicestorage_common.js"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=717103">Mozilla Bug 717103</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
devicestorage_setup();
|
||||
|
||||
function enumerateSuccess(e) {
|
||||
}
|
||||
|
||||
function enumerateFailure(e) {
|
||||
}
|
||||
|
||||
var cursor = navigator.getDeviceStorage("profile")[0].enumerate();
|
||||
cursor.onsuccess = enumerateSuccess;
|
||||
cursor.onerror = enumerateFailure;
|
||||
|
||||
try {
|
||||
cursor.continue();
|
||||
}
|
||||
catch (e) {
|
||||
ok(true, "Calling continue before enumerateSuccess fires should throw");
|
||||
devicestorage_cleanup();
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user