mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Merge from mozilla-central.
This commit is contained in:
commit
04a683031c
@ -686,7 +686,8 @@ getRoleCB(AtkObject *aAtkObj)
|
||||
if (aAtkObj->role != ATK_ROLE_INVALID)
|
||||
return aAtkObj->role;
|
||||
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role) \
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, \
|
||||
msaaRole, ia2Role, nameRule) \
|
||||
case roles::geckoRole: \
|
||||
aAtkObj->role = atkRole; \
|
||||
break;
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "ARIAStateMap.h"
|
||||
|
||||
#include "nsARIAMap.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "mozilla/dom/Element.h"
|
||||
@ -221,11 +222,23 @@ aria::MapToState(EStateRule aRule, dom::Element* aElement, PRUint64* aState)
|
||||
|
||||
case eARIAOrientation:
|
||||
{
|
||||
static const EnumTypeData data(
|
||||
nsGkAtoms::aria_orientation, states::HORIZONTAL,
|
||||
&nsGkAtoms::vertical, states::VERTICAL);
|
||||
if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_orientation,
|
||||
NS_LITERAL_STRING("horizontal"), eCaseMatters)) {
|
||||
*aState &= ~states::VERTICAL;
|
||||
*aState |= states::HORIZONTAL;
|
||||
} else if (aElement->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_orientation,
|
||||
NS_LITERAL_STRING("vertical"),
|
||||
eCaseMatters)) {
|
||||
*aState &= ~states::HORIZONTAL;
|
||||
*aState |= states::VERTICAL;
|
||||
} else {
|
||||
NS_ASSERTION(!(*aState & (states::HORIZONTAL | states::VERTICAL)),
|
||||
"orientation state on role with default aria-orientation!");
|
||||
*aState |= GetRoleMap(aElement)->Is(nsGkAtoms::scrollbar) ?
|
||||
states::VERTICAL : states::HORIZONTAL;
|
||||
}
|
||||
|
||||
MapEnumType(aElement, aState, data);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,9 @@
|
||||
#endif
|
||||
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
// Defines the number of selection add/remove events in the queue when they
|
||||
@ -174,6 +176,8 @@ NotificationController::IsUpdatePending()
|
||||
void
|
||||
NotificationController::WillRefresh(mozilla::TimeStamp aTime)
|
||||
{
|
||||
Telemetry::AutoTimer<Telemetry::A11Y_UPDATE_TIME> updateTimer();
|
||||
|
||||
// If the document accessible that notification collector was created for is
|
||||
// now shut down, don't process notifications anymore.
|
||||
NS_ASSERTION(mDocument,
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role) \
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, nameRule) \
|
||||
MOZ_STATIC_ASSERT(roles::geckoRole == nsIAccessibleRole::ROLE_ ## geckoRole, "internal and xpcom roles differ!");
|
||||
#include "RoleMap.h"
|
||||
#undef ROLE
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -42,6 +42,10 @@
|
||||
#include "Logging.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#include "nsExceptionHandler.h"
|
||||
#endif
|
||||
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMHTMLObjectElement.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
@ -649,7 +653,8 @@ nsAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode,
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::GetStringRole(PRUint32 aRole, nsAString& aString)
|
||||
{
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role) \
|
||||
#define ROLE(geckoRole, stringRole, atkRole, \
|
||||
macRole, msaaRole, ia2Role, nameRule) \
|
||||
case roles::geckoRole: \
|
||||
CopyUTF8toUTF16(stringRole, aString); \
|
||||
return NS_OK;
|
||||
@ -1223,6 +1228,12 @@ nsAccessibilityService::Init()
|
||||
// Initialize accessibility.
|
||||
nsAccessNodeWrap::InitAccessibility();
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
CrashReporter::
|
||||
AnnotateCrashReport(NS_LITERAL_CSTRING("Accessibility"),
|
||||
NS_LITERAL_CSTRING("Active"));
|
||||
#endif
|
||||
|
||||
gIsShutdown = false;
|
||||
return true;
|
||||
}
|
||||
|
@ -203,8 +203,7 @@ nsCoreUtils::GetDOMNodeFromDOMPoint(nsINode *aNode, PRUint32 aOffset)
|
||||
{
|
||||
if (aNode && aNode->IsElement()) {
|
||||
PRUint32 childCount = aNode->GetChildCount();
|
||||
NS_ASSERTION(aOffset >= 0 && aOffset <= childCount,
|
||||
"Wrong offset of the DOM point!");
|
||||
NS_ASSERTION(aOffset <= childCount, "Wrong offset of the DOM point!");
|
||||
|
||||
// The offset can be after last child of container node that means DOM point
|
||||
// is placed immediately after the last child. In this case use the DOM node
|
||||
|
@ -34,9 +34,7 @@ nsTextEquivUtils::GetNameFromSubtree(Accessible* aAccessible,
|
||||
return NS_OK;
|
||||
|
||||
gInitiatorAcc = aAccessible;
|
||||
|
||||
PRUint32 nameRule = gRoleToNameRulesMap[aAccessible->Role()];
|
||||
if (nameRule == eFromSubtree) {
|
||||
if (GetRoleRule(aAccessible->Role()) == eFromSubtree) {
|
||||
//XXX: is it necessary to care the accessible is not a document?
|
||||
if (aAccessible->IsContent()) {
|
||||
nsAutoString name;
|
||||
@ -216,7 +214,7 @@ nsTextEquivUtils::AppendFromAccessible(Accessible* aAccessible,
|
||||
// into subtree if accessible allows "text equivalent from subtree rule" or
|
||||
// it's not root and not control.
|
||||
if (isEmptyTextEquiv) {
|
||||
PRUint32 nameRule = gRoleToNameRulesMap[aAccessible->Role()];
|
||||
PRUint32 nameRule = GetRoleRule(aAccessible->Role());
|
||||
if (nameRule & eFromSubtreeIfRec) {
|
||||
rv = AppendFromAccessibleChildren(aAccessible, aString);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -239,8 +237,7 @@ nsresult
|
||||
nsTextEquivUtils::AppendFromValue(Accessible* aAccessible,
|
||||
nsAString *aString)
|
||||
{
|
||||
PRUint32 nameRule = gRoleToNameRulesMap[aAccessible->Role()];
|
||||
if (nameRule != eFromValue)
|
||||
if (GetRoleRule(aAccessible->Role()) != eFromValue)
|
||||
return NS_OK_NO_NAME_CLAUSE_HANDLED;
|
||||
|
||||
// Implementation of step f. of text equivalent computation. If the given
|
||||
@ -366,138 +363,20 @@ nsTextEquivUtils::IsWhitespace(PRUnichar aChar)
|
||||
aChar == '\r' || aChar == '\t' || aChar == 0xa0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Name rules to role map.
|
||||
|
||||
PRUint32 nsTextEquivUtils::gRoleToNameRulesMap[] =
|
||||
PRUint32
|
||||
nsTextEquivUtils::GetRoleRule(role aRole)
|
||||
{
|
||||
eFromSubtreeIfRec, // ROLE_NOTHING
|
||||
eNoRule, // ROLE_TITLEBAR
|
||||
eNoRule, // ROLE_MENUBAR
|
||||
eNoRule, // ROLE_SCROLLBAR
|
||||
eNoRule, // ROLE_GRIP
|
||||
eNoRule, // ROLE_SOUND
|
||||
eNoRule, // ROLE_CURSOR
|
||||
eNoRule, // ROLE_CARET
|
||||
eNoRule, // ROLE_ALERT
|
||||
eNoRule, // ROLE_WINDOW
|
||||
eNoRule, // ROLE_INTERNAL_FRAME
|
||||
eNoRule, // ROLE_MENUPOPUP
|
||||
eFromSubtree, // ROLE_MENUITEM
|
||||
eFromSubtree, // ROLE_TOOLTIP
|
||||
eNoRule, // ROLE_APPLICATION
|
||||
eNoRule, // ROLE_DOCUMENT
|
||||
eNoRule, // ROLE_PANE
|
||||
eNoRule, // ROLE_CHART
|
||||
eNoRule, // ROLE_DIALOG
|
||||
eNoRule, // ROLE_BORDER
|
||||
eNoRule, // ROLE_GROUPING
|
||||
eNoRule, // ROLE_SEPARATOR
|
||||
eNoRule, // ROLE_TOOLBAR
|
||||
eNoRule, // ROLE_STATUSBAR
|
||||
eNoRule, // ROLE_TABLE
|
||||
eFromSubtree, // ROLE_COLUMNHEADER
|
||||
eFromSubtree, // ROLE_ROWHEADER
|
||||
eFromSubtree, // ROLE_COLUMN
|
||||
eFromSubtree, // ROLE_ROW
|
||||
eFromSubtreeIfRec, // ROLE_CELL
|
||||
eFromSubtree, // ROLE_LINK
|
||||
eFromSubtree, // ROLE_HELPBALLOON
|
||||
eNoRule, // ROLE_CHARACTER
|
||||
eFromSubtreeIfRec, // ROLE_LIST
|
||||
eFromSubtree, // ROLE_LISTITEM
|
||||
eNoRule, // ROLE_OUTLINE
|
||||
eFromSubtree, // ROLE_OUTLINEITEM
|
||||
eFromSubtree, // ROLE_PAGETAB
|
||||
eNoRule, // ROLE_PROPERTYPAGE
|
||||
eNoRule, // ROLE_INDICATOR
|
||||
eNoRule, // ROLE_GRAPHIC
|
||||
eNoRule, // ROLE_STATICTEXT
|
||||
eNoRule, // ROLE_TEXT_LEAF
|
||||
eFromSubtree, // ROLE_PUSHBUTTON
|
||||
eFromSubtree, // ROLE_CHECKBUTTON
|
||||
eFromSubtree, // ROLE_RADIOBUTTON
|
||||
eFromValue, // ROLE_COMBOBOX
|
||||
eNoRule, // ROLE_DROPLIST
|
||||
eFromValue, // ROLE_PROGRESSBAR
|
||||
eNoRule, // ROLE_DIAL
|
||||
eNoRule, // ROLE_HOTKEYFIELD
|
||||
eNoRule, // ROLE_SLIDER
|
||||
eNoRule, // ROLE_SPINBUTTON
|
||||
eNoRule, // ROLE_DIAGRAM
|
||||
eNoRule, // ROLE_ANIMATION
|
||||
eNoRule, // ROLE_EQUATION
|
||||
eFromSubtree, // ROLE_BUTTONDROPDOWN
|
||||
eFromSubtree, // ROLE_BUTTONMENU
|
||||
eFromSubtree, // ROLE_BUTTONDROPDOWNGRID
|
||||
eNoRule, // ROLE_WHITESPACE
|
||||
eNoRule, // ROLE_PAGETABLIST
|
||||
eNoRule, // ROLE_CLOCK
|
||||
eNoRule, // ROLE_SPLITBUTTON
|
||||
eNoRule, // ROLE_IPADDRESS
|
||||
eNoRule, // ROLE_ACCEL_LABEL
|
||||
eNoRule, // ROLE_ARROW
|
||||
eNoRule, // ROLE_CANVAS
|
||||
eFromSubtree, // ROLE_CHECK_MENU_ITEM
|
||||
eNoRule, // ROLE_COLOR_CHOOSER
|
||||
eNoRule, // ROLE_DATE_EDITOR
|
||||
eNoRule, // ROLE_DESKTOP_ICON
|
||||
eNoRule, // ROLE_DESKTOP_FRAME
|
||||
eNoRule, // ROLE_DIRECTORY_PANE
|
||||
eNoRule, // ROLE_FILE_CHOOSER
|
||||
eNoRule, // ROLE_FONT_CHOOSER
|
||||
eNoRule, // ROLE_CHROME_WINDOW
|
||||
eNoRule, // ROLE_GLASS_PANE
|
||||
eFromSubtreeIfRec, // ROLE_HTML_CONTAINER
|
||||
eNoRule, // ROLE_ICON
|
||||
eFromSubtree, // ROLE_LABEL
|
||||
eNoRule, // ROLE_LAYERED_PANE
|
||||
eNoRule, // ROLE_OPTION_PANE
|
||||
eNoRule, // ROLE_PASSWORD_TEXT
|
||||
eNoRule, // ROLE_POPUP_MENU
|
||||
eFromSubtree, // ROLE_RADIO_MENU_ITEM
|
||||
eNoRule, // ROLE_ROOT_PANE
|
||||
eNoRule, // ROLE_SCROLL_PANE
|
||||
eNoRule, // ROLE_SPLIT_PANE
|
||||
eFromSubtree, // ROLE_TABLE_COLUMN_HEADER
|
||||
eFromSubtree, // ROLE_TABLE_ROW_HEADER
|
||||
eFromSubtree, // ROLE_TEAR_OFF_MENU_ITEM
|
||||
eNoRule, // ROLE_TERMINAL
|
||||
eFromSubtreeIfRec, // ROLE_TEXT_CONTAINER
|
||||
eFromSubtree, // ROLE_TOGGLE_BUTTON
|
||||
eNoRule, // ROLE_TREE_TABLE
|
||||
eNoRule, // ROLE_VIEWPORT
|
||||
eNoRule, // ROLE_HEADER
|
||||
eNoRule, // ROLE_FOOTER
|
||||
eFromSubtreeIfRec, // ROLE_PARAGRAPH
|
||||
eNoRule, // ROLE_RULER
|
||||
eNoRule, // ROLE_AUTOCOMPLETE
|
||||
eNoRule, // ROLE_EDITBAR
|
||||
eFromValue, // ROLE_ENTRY
|
||||
eFromSubtreeIfRec, // ROLE_CAPTION
|
||||
eNoRule, // ROLE_DOCUMENT_FRAME
|
||||
eFromSubtreeIfRec, // ROLE_HEADING
|
||||
eNoRule, // ROLE_PAGE
|
||||
eFromSubtreeIfRec, // ROLE_SECTION
|
||||
eNoRule, // ROLE_REDUNDANT_OBJECT
|
||||
eNoRule, // ROLE_FORM
|
||||
eNoRule, // ROLE_IME
|
||||
eNoRule, // ROLE_APP_ROOT
|
||||
eFromSubtree, // ROLE_PARENT_MENUITEM
|
||||
eNoRule, // ROLE_CALENDAR
|
||||
eNoRule, // ROLE_COMBOBOX_LIST
|
||||
eFromSubtree, // ROLE_COMBOBOX_OPTION
|
||||
eNoRule, // ROLE_IMAGE_MAP
|
||||
eFromSubtree, // ROLE_OPTION
|
||||
eFromSubtree, // ROLE_RICH_OPTION
|
||||
eNoRule, // ROLE_LISTBOX
|
||||
eNoRule, // ROLE_FLAT_EQUATION
|
||||
eFromSubtree, // ROLE_GRID_CELL
|
||||
eNoRule, // ROLE_EMBEDDED_OBJECT
|
||||
eFromSubtree, // ROLE_NOTE
|
||||
eNoRule, // ROLE_FIGURE
|
||||
eFromSubtree, // ROLE_CHECK_RICH_OPTION
|
||||
eFromSubtreeIfRec, // ROLE_DEFINITION_LIST
|
||||
eFromSubtree, // ROLE_TERM
|
||||
eFromSubtree // ROLE_DEFINITION
|
||||
};
|
||||
#define ROLE(geckoRole, stringRole, atkRole, \
|
||||
macRole, msaaRole, ia2Role, nameRule) \
|
||||
case roles::geckoRole: \
|
||||
return nameRule;
|
||||
|
||||
switch (aRole) {
|
||||
#include "RoleMap.h"
|
||||
default:
|
||||
MOZ_NOT_REACHED("Unknown role.");
|
||||
}
|
||||
|
||||
#undef ROLE
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define _nsTextEquivUtils_H_
|
||||
|
||||
#include "Accessible.h"
|
||||
#include "Role.h"
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "nsIStringBundle.h"
|
||||
@ -140,9 +141,9 @@ private:
|
||||
static bool IsWhitespace(PRUnichar aChar);
|
||||
|
||||
/**
|
||||
* Map array from roles to name rules (constants of ETextEquivRule).
|
||||
* Returns the rule (constant of ETextEquivRule) for a given role.
|
||||
*/
|
||||
static PRUint32 gRoleToNameRulesMap[];
|
||||
static PRUint32 GetRoleRule(mozilla::a11y::roles::Role aRole);
|
||||
|
||||
/**
|
||||
* The accessible for which we are computing a text equivalent. It is useful
|
||||
|
@ -265,7 +265,7 @@ ARIAGridAccessible::SelectedCells(nsTArray<Accessible*>* aCells)
|
||||
void
|
||||
ARIAGridAccessible::SelectedCellIndices(nsTArray<PRUint32>* aCells)
|
||||
{
|
||||
PRUint32 rowCount = RowCount(), colCount = ColCount();
|
||||
PRUint32 colCount = ColCount();
|
||||
|
||||
AccIterator rowIter(this, filters::GetRow);
|
||||
Accessible* row = nsnull;
|
||||
|
@ -680,10 +680,20 @@ Accessible::NativeState()
|
||||
state |= states::FLOATING;
|
||||
|
||||
// Check if a XUL element has the popup attribute (an attached popup menu).
|
||||
if (mContent->IsXUL())
|
||||
if (mContent->IsXUL()) {
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::popup))
|
||||
state |= states::HASPOPUP;
|
||||
|
||||
const nsStyleXUL *xulStyle = frame->GetStyleXUL();
|
||||
if (xulStyle && frame->IsBoxFrame()) {
|
||||
// In XUL all boxes are either vertical or horizontal
|
||||
if (xulStyle->mBoxOrient == NS_STYLE_BOX_ORIENT_VERTICAL)
|
||||
state |= states::VERTICAL;
|
||||
else
|
||||
state |= states::HORIZONTAL;
|
||||
}
|
||||
}
|
||||
|
||||
// Bypass the link states specialization for non links.
|
||||
if (!mRoleMapEntry || mRoleMapEntry->roleRule == kUseNativeRole ||
|
||||
mRoleMapEntry->role == roles::LINK)
|
||||
@ -1510,17 +1520,6 @@ Accessible::State()
|
||||
state |= states::OPAQUE1;
|
||||
}
|
||||
|
||||
const nsStyleXUL *xulStyle = frame->GetStyleXUL();
|
||||
if (xulStyle) {
|
||||
// In XUL all boxes are either vertical or horizontal
|
||||
if (xulStyle->mBoxOrient == NS_STYLE_BOX_ORIENT_VERTICAL) {
|
||||
state |= states::VERTICAL;
|
||||
}
|
||||
else {
|
||||
state |= states::HORIZONTAL;
|
||||
}
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
@ -1808,8 +1808,6 @@ HyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum,
|
||||
if (rangeCount < static_cast<PRUint32>(aSelectionNum))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
// Caret is a collapsed selection
|
||||
bool isOnlyCaret = (aStartOffset == aEndOffset);
|
||||
nsRefPtr<nsRange> range;
|
||||
if (aSelectionNum == rangeCount)
|
||||
range = new nsRange();
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "nsArrayUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -766,10 +767,11 @@ HTMLTableAccessible::ColExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx)
|
||||
bool isSelected;
|
||||
PRInt32 columnExtent = 0;
|
||||
|
||||
tableLayout->
|
||||
DebugOnly<nsresult> rv = tableLayout->
|
||||
GetCellDataAt(aRowIdx, aColIdx, *getter_AddRefs(domElement),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, columnExtent, isSelected);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Could not get cell data");
|
||||
|
||||
return columnExtent;
|
||||
}
|
||||
@ -786,10 +788,11 @@ HTMLTableAccessible::RowExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx)
|
||||
bool isSelected;
|
||||
PRInt32 rowExtent = 0;
|
||||
|
||||
tableLayout->
|
||||
DebugOnly<nsresult> rv = tableLayout->
|
||||
GetCellDataAt(aRowIdx, aColIdx, *getter_AddRefs(domElement),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
rowExtent, actualColSpan, isSelected);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Could not get cell data");
|
||||
|
||||
return rowExtent;
|
||||
}
|
||||
|
@ -63,8 +63,10 @@ var AccessFu = {
|
||||
this.addPresenter(new VisualPresenter());
|
||||
|
||||
// Implicitly add the Android presenter on Android.
|
||||
if (Utils.OS == 'Android')
|
||||
if (Utils.MozBuildApp == 'mobile/android')
|
||||
this.addPresenter(new AndroidPresenter());
|
||||
else if (Utils.MozBuildApp == 'b2g')
|
||||
this.addPresenter(new SpeechPresenter());
|
||||
|
||||
VirtualCursorController.attach(this.chromeWin);
|
||||
|
||||
@ -355,7 +357,8 @@ var AccessFu = {
|
||||
}
|
||||
case Ci.nsIAccessibleEvent.EVENT_SCROLLING_START:
|
||||
{
|
||||
VirtualCursorController.moveCursorToObject(aEvent.accessible);
|
||||
VirtualCursorController.moveCursorToObject(
|
||||
Utils.getVirtualCursor(aEvent.accessibleDocument), aEvent.accessible);
|
||||
break;
|
||||
}
|
||||
case Ci.nsIAccessibleEvent.EVENT_FOCUS:
|
||||
@ -364,7 +367,8 @@ var AccessFu = {
|
||||
let doc = aEvent.accessibleDocument;
|
||||
if (acc.role != Ci.nsIAccessibleRole.ROLE_DOCUMENT &&
|
||||
doc.role != Ci.nsIAccessibleRole.ROLE_CHROME_WINDOW)
|
||||
VirtualCursorController.moveCursorToObject(acc);
|
||||
VirtualCursorController.moveCursorToObject(
|
||||
Utils.getVirtualCursor(doc), acc);
|
||||
|
||||
let [,extState] = Utils.getStates(acc);
|
||||
let editableState = extState &
|
||||
|
@ -15,6 +15,7 @@ Cu.import('resource://gre/modules/accessibility/UtteranceGenerator.jsm');
|
||||
var EXPORTED_SYMBOLS = ['VisualPresenter',
|
||||
'AndroidPresenter',
|
||||
'DummyAndroidPresenter',
|
||||
'SpeechPresenter',
|
||||
'PresenterContext'];
|
||||
|
||||
/**
|
||||
@ -396,6 +397,41 @@ DummyAndroidPresenter.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A speech presenter for direct TTS output
|
||||
*/
|
||||
|
||||
function SpeechPresenter() {}
|
||||
|
||||
SpeechPresenter.prototype = {
|
||||
__proto__: Presenter.prototype,
|
||||
|
||||
|
||||
pivotChanged: function SpeechPresenter_pivotChanged(aContext, aReason) {
|
||||
if (!aContext.accessible)
|
||||
return;
|
||||
|
||||
let output = [];
|
||||
|
||||
aContext.newAncestry.forEach(
|
||||
function(acc) {
|
||||
output.push.apply(output, UtteranceGenerator.genForObject(acc));
|
||||
}
|
||||
);
|
||||
|
||||
output.push.apply(output,
|
||||
UtteranceGenerator.genForObject(aContext.accessible));
|
||||
|
||||
aContext.subtreePreorder.forEach(
|
||||
function(acc) {
|
||||
output.push.apply(output, UtteranceGenerator.genForObject(acc));
|
||||
}
|
||||
);
|
||||
|
||||
Logger.info('SPEAK', '"' + output.join(' ') + '"');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PresenterContext: An object that generates and caches context information
|
||||
* for a given accessible and its relationship with another accessible.
|
||||
|
@ -16,6 +16,19 @@ var gAccRetrieval = Cc['@mozilla.org/accessibleRetrieval;1'].
|
||||
getService(Ci.nsIAccessibleRetrieval);
|
||||
|
||||
var Utils = {
|
||||
_buildAppMap: {
|
||||
'{3c2e2abc-06d4-11e1-ac3b-374f68613e61}': 'b2g',
|
||||
'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}': 'browser',
|
||||
'{aa3c5121-dab2-40e2-81ca-7ea25febc110}': 'mobile/android',
|
||||
'{a23983c0-fd0e-11dc-95ff-0800200c9a66}': 'mobile/xul'
|
||||
},
|
||||
|
||||
get MozBuildApp() {
|
||||
if (!this._buildApp)
|
||||
this._buildApp = this._buildAppMap[Services.appinfo.ID];
|
||||
return this._buildApp;
|
||||
},
|
||||
|
||||
get OS() {
|
||||
if (!this._OS)
|
||||
this._OS = Services.appinfo.OS;
|
||||
@ -40,21 +53,27 @@ var Utils = {
|
||||
},
|
||||
|
||||
getBrowserApp: function getBrowserApp(aWindow) {
|
||||
switch (this.OS) {
|
||||
case 'Android':
|
||||
switch (this.MozBuildApp) {
|
||||
case 'mobile/android':
|
||||
return aWindow.BrowserApp;
|
||||
default:
|
||||
case 'browser':
|
||||
return aWindow.gBrowser;
|
||||
case 'b2g':
|
||||
return aWindow.shell;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
getCurrentContentDoc: function getCurrentContentDoc(aWindow) {
|
||||
if (this.MozBuildApp == "b2g")
|
||||
return this.getBrowserApp(aWindow).contentBrowser.contentDocument;
|
||||
return this.getBrowserApp(aWindow).selectedBrowser.contentDocument;
|
||||
},
|
||||
|
||||
getViewport: function getViewport(aWindow) {
|
||||
switch (this.OS) {
|
||||
case 'Android':
|
||||
switch (this.MozBuildApp) {
|
||||
case 'mobile/android':
|
||||
return aWindow.BrowserApp.selectedTab.getViewport();
|
||||
default:
|
||||
return null;
|
||||
@ -69,6 +88,21 @@ var Utils = {
|
||||
let extState = {};
|
||||
aAccessible.getState(state, extState);
|
||||
return [state.value, extState.value];
|
||||
},
|
||||
|
||||
getVirtualCursor: function getVirtualCursor(aDocument) {
|
||||
let doc = (aDocument instanceof Ci.nsIAccessible) ? aDocument :
|
||||
gAccRetrieval.getAccessibleFor(aDocument);
|
||||
|
||||
while (doc) {
|
||||
try {
|
||||
return doc.QueryInterface(Ci.nsIAccessibleCursorable).virtualCursor;
|
||||
} catch (x) {
|
||||
doc = doc.parentDocument;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
@ -131,5 +165,32 @@ var Logger = {
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
},
|
||||
|
||||
statesToString: function statesToString(aAccessible) {
|
||||
let [state, extState] = Utils.getStates(aAccessible);
|
||||
let stringArray = [];
|
||||
let stateStrings = gAccRetrieval.getStringStates(state, extState);
|
||||
for (var i=0; i < stateStrings.length; i++)
|
||||
stringArray.push(stateStrings.item(i));
|
||||
return stringArray.join(' ');
|
||||
},
|
||||
|
||||
dumpTree: function dumpTree(aLogLevel, aRootAccessible) {
|
||||
if (aLogLevel < this.logLevel)
|
||||
return;
|
||||
|
||||
this._dumpTreeInternal(aLogLevel, aRootAccessible, 0);
|
||||
},
|
||||
|
||||
_dumpTreeInternal: function _dumpTreeInternal(aLogLevel, aAccessible, aIndent) {
|
||||
let indentStr = '';
|
||||
for (var i=0; i < aIndent; i++)
|
||||
indentStr += ' ';
|
||||
this.log(aLogLevel, indentStr,
|
||||
this.accessibleToString(aAccessible),
|
||||
'(' + this.statesToString(aAccessible) + ')');
|
||||
for (var i=0; i < aAccessible.childCount; i++)
|
||||
this._dumpTreeInternal(aLogLevel, aAccessible.getChildAt(i), aIndent + 1);
|
||||
}
|
||||
};
|
||||
|
@ -17,17 +17,55 @@ Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
var gAccRetrieval = Cc['@mozilla.org/accessibleRetrieval;1'].
|
||||
getService(Ci.nsIAccessibleRetrieval);
|
||||
|
||||
var TraversalRules = {
|
||||
Simple: {
|
||||
getMatchRoles: function SimpleTraversalRule_getmatchRoles(aRules) {
|
||||
function BaseTraversalRule(aRoles, aMatchFunc) {
|
||||
this._matchRoles = aRoles;
|
||||
this._matchFunc = aMatchFunc;
|
||||
}
|
||||
|
||||
BaseTraversalRule.prototype = {
|
||||
getMatchRoles: function BaseTraversalRule_getmatchRoles(aRules) {
|
||||
aRules.value = this._matchRoles;
|
||||
return aRules.value.length;
|
||||
},
|
||||
|
||||
preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
|
||||
Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
|
||||
Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
|
||||
|
||||
match: function SimpleTraversalRule_match(aAccessible) {
|
||||
match: function BaseTraversalRule_match(aAccessible)
|
||||
{
|
||||
if (this._matchFunc)
|
||||
return this._matchFunc(aAccessible);
|
||||
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule])
|
||||
};
|
||||
|
||||
var TraversalRules = {
|
||||
Simple: new BaseTraversalRule(
|
||||
[Ci.nsIAccessibleRole.ROLE_MENUITEM,
|
||||
Ci.nsIAccessibleRole.ROLE_LINK,
|
||||
Ci.nsIAccessibleRole.ROLE_PAGETAB,
|
||||
Ci.nsIAccessibleRole.ROLE_GRAPHIC,
|
||||
// XXX: Find a better solution for ROLE_STATICTEXT.
|
||||
// It allows to filter list bullets but at the same time it
|
||||
// filters CSS generated content too as an unwanted side effect.
|
||||
// Ci.nsIAccessibleRole.ROLE_STATICTEXT,
|
||||
Ci.nsIAccessibleRole.ROLE_TEXT_LEAF,
|
||||
Ci.nsIAccessibleRole.ROLE_PUSHBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_CHECKBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_RADIOBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_COMBOBOX,
|
||||
Ci.nsIAccessibleRole.ROLE_PROGRESSBAR,
|
||||
Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWN,
|
||||
Ci.nsIAccessibleRole.ROLE_BUTTONMENU,
|
||||
Ci.nsIAccessibleRole.ROLE_CHECK_MENU_ITEM,
|
||||
Ci.nsIAccessibleRole.ROLE_PASSWORD_TEXT,
|
||||
Ci.nsIAccessibleRole.ROLE_RADIO_MENU_ITEM,
|
||||
Ci.nsIAccessibleRole.ROLE_TOGGLE_BUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_ENTRY],
|
||||
function Simple_match(aAccessible) {
|
||||
switch (aAccessible.role) {
|
||||
case Ci.nsIAccessibleRole.ROLE_COMBOBOX:
|
||||
// We don't want to ignore the subtree because this is often
|
||||
@ -55,46 +93,12 @@ var TraversalRules = {
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH |
|
||||
Ci.nsIAccessibleTraversalRule.FILTER_IGNORE_SUBTREE;
|
||||
}
|
||||
},
|
||||
}
|
||||
),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule]),
|
||||
|
||||
_matchRoles: [
|
||||
Ci.nsIAccessibleRole.ROLE_MENUITEM,
|
||||
Ci.nsIAccessibleRole.ROLE_LINK,
|
||||
Ci.nsIAccessibleRole.ROLE_PAGETAB,
|
||||
Ci.nsIAccessibleRole.ROLE_GRAPHIC,
|
||||
// XXX: Find a better solution for ROLE_STATICTEXT.
|
||||
// It allows to filter list bullets but at the same time it
|
||||
// filters CSS generated content too as an unwanted side effect.
|
||||
// Ci.nsIAccessibleRole.ROLE_STATICTEXT,
|
||||
Ci.nsIAccessibleRole.ROLE_TEXT_LEAF,
|
||||
Ci.nsIAccessibleRole.ROLE_PUSHBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_CHECKBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_RADIOBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_COMBOBOX,
|
||||
Ci.nsIAccessibleRole.ROLE_PROGRESSBAR,
|
||||
Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWN,
|
||||
Ci.nsIAccessibleRole.ROLE_BUTTONMENU,
|
||||
Ci.nsIAccessibleRole.ROLE_CHECK_MENU_ITEM,
|
||||
Ci.nsIAccessibleRole.ROLE_PASSWORD_TEXT,
|
||||
Ci.nsIAccessibleRole.ROLE_RADIO_MENU_ITEM,
|
||||
Ci.nsIAccessibleRole.ROLE_TOGGLE_BUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_ENTRY
|
||||
]
|
||||
},
|
||||
|
||||
Anchor: {
|
||||
getMatchRoles: function AnchorTraversalRule_getMatchRoles(aRules)
|
||||
{
|
||||
aRules.value = [Ci.nsIAccessibleRole.ROLE_LINK];
|
||||
return aRules.value.length;
|
||||
},
|
||||
|
||||
preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
|
||||
Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
|
||||
|
||||
match: function AnchorTraversalRule_match(aAccessible)
|
||||
Anchor: new BaseTraversalRule(
|
||||
[Ci.nsIAccessibleRole.ROLE_LINK],
|
||||
function Anchor_match(aAccessible)
|
||||
{
|
||||
// We want to ignore links, only focus named anchors.
|
||||
let state = {};
|
||||
@ -105,177 +109,53 @@ var TraversalRules = {
|
||||
} else {
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule])
|
||||
},
|
||||
Button: new BaseTraversalRule(
|
||||
[Ci.nsIAccessibleRole.ROLE_PUSHBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_SPINBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_TOGGLE_BUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWN,
|
||||
Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWNGRID]),
|
||||
|
||||
Button: {
|
||||
getMatchRoles: function ButtonTraversalRule_getMatchRoles(aRules)
|
||||
{
|
||||
aRules.value = this._matchRoles;
|
||||
return aRules.value.length;
|
||||
},
|
||||
Combobox: new BaseTraversalRule(
|
||||
[Ci.nsIAccessibleRole.ROLE_COMBOBOX,
|
||||
Ci.nsIAccessibleRole.ROLE_LISTBOX]),
|
||||
|
||||
preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
|
||||
Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
|
||||
Entry: new BaseTraversalRule(
|
||||
[Ci.nsIAccessibleRole.ROLE_ENTRY,
|
||||
Ci.nsIAccessibleRole.ROLE_PASSWORD_TEXT]),
|
||||
|
||||
match: function ButtonTraversalRule_match(aAccessible)
|
||||
{
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
},
|
||||
FormElement: new BaseTraversalRule(
|
||||
[Ci.nsIAccessibleRole.ROLE_PUSHBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_SPINBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_TOGGLE_BUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWN,
|
||||
Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWNGRID,
|
||||
Ci.nsIAccessibleRole.ROLE_COMBOBOX,
|
||||
Ci.nsIAccessibleRole.ROLE_LISTBOX,
|
||||
Ci.nsIAccessibleRole.ROLE_ENTRY,
|
||||
Ci.nsIAccessibleRole.ROLE_PASSWORD_TEXT,
|
||||
Ci.nsIAccessibleRole.ROLE_PAGETAB,
|
||||
Ci.nsIAccessibleRole.ROLE_RADIOBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_RADIO_MENU_ITEM,
|
||||
Ci.nsIAccessibleRole.ROLE_SLIDER,
|
||||
Ci.nsIAccessibleRole.ROLE_CHECKBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_CHECK_MENU_ITEM]),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule]),
|
||||
Graphic: new BaseTraversalRule(
|
||||
[Ci.nsIAccessibleRole.ROLE_GRAPHIC]),
|
||||
|
||||
_matchRoles: [
|
||||
Ci.nsIAccessibleRole.ROLE_PUSHBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_SPINBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_TOGGLE_BUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWN,
|
||||
Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWNGRID
|
||||
]
|
||||
},
|
||||
Heading: new BaseTraversalRule(
|
||||
[Ci.nsIAccessibleRole.ROLE_HEADING]),
|
||||
|
||||
Combobox: {
|
||||
getMatchRoles: function ComboboxTraversalRule_getMatchRoles(aRules)
|
||||
{
|
||||
aRules.value = [Ci.nsIAccessibleRole.ROLE_COMBOBOX,
|
||||
Ci.nsIAccessibleRole.ROLE_LISTBOX];
|
||||
return aRules.value.length;
|
||||
},
|
||||
ListItem: new BaseTraversalRule(
|
||||
[Ci.nsIAccessibleRole.ROLE_LISTITEM,
|
||||
Ci.nsIAccessibleRole.ROLE_TERM]),
|
||||
|
||||
preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
|
||||
Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
|
||||
|
||||
match: function ComboboxTraversalRule_match(aAccessible)
|
||||
{
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule])
|
||||
},
|
||||
|
||||
Entry: {
|
||||
getMatchRoles: function EntryTraversalRule_getMatchRoles(aRules)
|
||||
{
|
||||
aRules.value = [Ci.nsIAccessibleRole.ROLE_ENTRY,
|
||||
Ci.nsIAccessibleRole.ROLE_PASSWORD_TEXT];
|
||||
return aRules.value.length;
|
||||
},
|
||||
|
||||
preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
|
||||
Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
|
||||
|
||||
match: function EntryTraversalRule_match(aAccessible)
|
||||
{
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule])
|
||||
},
|
||||
|
||||
FormElement: {
|
||||
getMatchRoles: function FormElementTraversalRule_getMatchRoles(aRules)
|
||||
{
|
||||
aRules.value = this._matchRoles;
|
||||
return aRules.value.length;
|
||||
},
|
||||
|
||||
preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
|
||||
Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
|
||||
|
||||
match: function FormElementTraversalRule_match(aAccessible)
|
||||
{
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule]),
|
||||
|
||||
_matchRoles: [
|
||||
Ci.nsIAccessibleRole.ROLE_PUSHBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_SPINBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_TOGGLE_BUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWN,
|
||||
Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWNGRID,
|
||||
Ci.nsIAccessibleRole.ROLE_COMBOBOX,
|
||||
Ci.nsIAccessibleRole.ROLE_LISTBOX,
|
||||
Ci.nsIAccessibleRole.ROLE_ENTRY,
|
||||
Ci.nsIAccessibleRole.ROLE_PASSWORD_TEXT,
|
||||
Ci.nsIAccessibleRole.ROLE_PAGETAB,
|
||||
Ci.nsIAccessibleRole.ROLE_RADIOBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_RADIO_MENU_ITEM,
|
||||
Ci.nsIAccessibleRole.ROLE_SLIDER,
|
||||
Ci.nsIAccessibleRole.ROLE_CHECKBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_CHECK_MENU_ITEM
|
||||
]
|
||||
},
|
||||
|
||||
Graphic: {
|
||||
getMatchRoles: function GraphicTraversalRule_getMatchRoles(aRules)
|
||||
{
|
||||
aRules.value = [Ci.nsIAccessibleRole.ROLE_GRAPHIC];
|
||||
return aRules.value.length;
|
||||
},
|
||||
|
||||
preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
|
||||
Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
|
||||
|
||||
match: function GraphicTraversalRule_match(aAccessible)
|
||||
{
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule])
|
||||
},
|
||||
|
||||
Heading: {
|
||||
getMatchRoles: function HeadingTraversalRule_getMatchRoles(aRules)
|
||||
{
|
||||
aRules.value = [Ci.nsIAccessibleRole.ROLE_HEADING];
|
||||
return aRules.value.length;
|
||||
},
|
||||
|
||||
preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
|
||||
Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
|
||||
|
||||
match: function HeadingTraversalRule_match(aAccessible)
|
||||
{
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule])
|
||||
},
|
||||
|
||||
ListItem: {
|
||||
getMatchRoles: function ListItemTraversalRule_getMatchRoles(aRules)
|
||||
{
|
||||
aRules.value = [Ci.nsIAccessibleRole.ROLE_LISTITEM,
|
||||
Ci.nsIAccessibleRole.ROLE_TERM];
|
||||
return aRules.value.length;
|
||||
},
|
||||
|
||||
preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
|
||||
Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
|
||||
|
||||
match: function ListItemTraversalRule_match(aAccessible)
|
||||
{
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule])
|
||||
},
|
||||
|
||||
Link: {
|
||||
getMatchRoles: function LinkTraversalRule_getMatchRoles(aRules)
|
||||
{
|
||||
aRules.value = [Ci.nsIAccessibleRole.ROLE_LINK];
|
||||
return aRules.value.length;
|
||||
},
|
||||
|
||||
preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
|
||||
Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
|
||||
|
||||
match: function LinkTraversalRule_match(aAccessible)
|
||||
Link: new BaseTraversalRule(
|
||||
[Ci.nsIAccessibleRole.ROLE_LINK],
|
||||
function Link_match(aAccessible)
|
||||
{
|
||||
// We want to ignore anchors, only focus real links.
|
||||
let state = {};
|
||||
@ -286,121 +166,28 @@ var TraversalRules = {
|
||||
} else {
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_IGNORE;
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule])
|
||||
},
|
||||
List: new BaseTraversalRule(
|
||||
[Ci.nsIAccessibleRole.ROLE_LIST,
|
||||
Ci.nsIAccessibleRole.ROLE_DEFINITION_LIST]),
|
||||
|
||||
List: {
|
||||
getMatchRoles: function ListTraversalRule_getMatchRoles(aRules)
|
||||
{
|
||||
aRules.value = [Ci.nsIAccessibleRole.ROLE_LIST,
|
||||
Ci.nsIAccessibleRole.ROLE_DEFINITION_LIST];
|
||||
return aRules.value.length;
|
||||
},
|
||||
PageTab: new BaseTraversalRule(
|
||||
[Ci.nsIAccessibleRole.ROLE_PAGETAB]),
|
||||
|
||||
preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
|
||||
Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
|
||||
RadioButton: new BaseTraversalRule(
|
||||
[Ci.nsIAccessibleRole.ROLE_RADIOBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_RADIO_MENU_ITEM]),
|
||||
|
||||
match: function ListTraversalRule_match(aAccessible)
|
||||
{
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
},
|
||||
Separator: new BaseTraversalRule(
|
||||
[Ci.nsIAccessibleRole.ROLE_SEPARATOR]),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule])
|
||||
},
|
||||
Table: new BaseTraversalRule(
|
||||
[Ci.nsIAccessibleRole.ROLE_TABLE]),
|
||||
|
||||
PageTab: {
|
||||
getMatchRoles: function PageTabTraversalRule_getMatchRoles(aRules)
|
||||
{
|
||||
aRules.value = [Ci.nsIAccessibleRole.ROLE_PAGETAB];
|
||||
return aRules.value.length;
|
||||
},
|
||||
|
||||
preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
|
||||
Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
|
||||
|
||||
match: function PageTabTraversalRule_match(aAccessible)
|
||||
{
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule])
|
||||
},
|
||||
|
||||
RadioButton: {
|
||||
getMatchRoles: function RadioButtonTraversalRule_getMatchRoles(aRules)
|
||||
{
|
||||
aRules.value = [Ci.nsIAccessibleRole.ROLE_RADIOBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_RADIO_MENU_ITEM];
|
||||
return aRules.value.length;
|
||||
},
|
||||
|
||||
preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
|
||||
Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
|
||||
|
||||
match: function RadioButtonTraversalRule_match(aAccessible)
|
||||
{
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule])
|
||||
},
|
||||
|
||||
Separator: {
|
||||
getMatchRoles: function SeparatorTraversalRule_getMatchRoles(aRules)
|
||||
{
|
||||
aRules.value = [Ci.nsIAccessibleRole.ROLE_SEPARATOR];
|
||||
return aRules.value.length;
|
||||
},
|
||||
|
||||
preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
|
||||
Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
|
||||
|
||||
match: function SeparatorTraversalRule_match(aAccessible)
|
||||
{
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule])
|
||||
},
|
||||
|
||||
Table: {
|
||||
getMatchRoles: function TableTraversalRule_getMatchRoles(aRules)
|
||||
{
|
||||
aRules.value = [Ci.nsIAccessibleRole.ROLE_TABLE];
|
||||
return aRules.value.length;
|
||||
},
|
||||
|
||||
preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
|
||||
Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
|
||||
|
||||
match: function TableTraversalRule_match(aAccessible)
|
||||
{
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule])
|
||||
},
|
||||
|
||||
Checkbox: {
|
||||
getMatchRoles: function CheckboxTraversalRule_getMatchRoles(aRules)
|
||||
{
|
||||
aRules.value = [Ci.nsIAccessibleRole.ROLE_CHECKBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_CHECK_MENU_ITEM];
|
||||
return aRules.value.length;
|
||||
},
|
||||
|
||||
preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
|
||||
Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
|
||||
|
||||
match: function CheckboxTraversalRule_match(aAccessible)
|
||||
{
|
||||
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule])
|
||||
}
|
||||
Checkbox: new BaseTraversalRule(
|
||||
[Ci.nsIAccessibleRole.ROLE_CHECKBUTTON,
|
||||
Ci.nsIAccessibleRole.ROLE_CHECK_MENU_ITEM])
|
||||
};
|
||||
|
||||
var VirtualCursorController = {
|
||||
@ -547,12 +334,12 @@ var VirtualCursorController = {
|
||||
},
|
||||
|
||||
moveToPoint: function moveToPoint(aDocument, aX, aY) {
|
||||
this.getVirtualCursor(aDocument).moveToPoint(TraversalRules.Simple,
|
||||
aX, aY, true);
|
||||
Utils.getVirtualCursor(aDocument).moveToPoint(TraversalRules.Simple,
|
||||
aX, aY, true);
|
||||
},
|
||||
|
||||
moveForward: function moveForward(aDocument, aLast, aRule) {
|
||||
let virtualCursor = this.getVirtualCursor(aDocument);
|
||||
let virtualCursor = Utils.getVirtualCursor(aDocument);
|
||||
if (aLast) {
|
||||
virtualCursor.moveLast(TraversalRules.Simple);
|
||||
} else {
|
||||
@ -560,13 +347,14 @@ var VirtualCursorController = {
|
||||
virtualCursor.moveNext(aRule || TraversalRules.Simple);
|
||||
} catch (x) {
|
||||
this.moveCursorToObject(
|
||||
gAccRetrieval.getAccessibleFor(aDocument.activeElement), aRule);
|
||||
virtualCursor,
|
||||
gAccRetrieval.getAccessibleFor(aDocument.activeElement), aRule);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
moveBackward: function moveBackward(aDocument, aFirst, aRule) {
|
||||
let virtualCursor = this.getVirtualCursor(aDocument);
|
||||
let virtualCursor = Utils.getVirtualCursor(aDocument);
|
||||
if (aFirst) {
|
||||
virtualCursor.moveFirst(TraversalRules.Simple);
|
||||
} else {
|
||||
@ -574,13 +362,14 @@ var VirtualCursorController = {
|
||||
virtualCursor.movePrevious(aRule || TraversalRules.Simple);
|
||||
} catch (x) {
|
||||
this.moveCursorToObject(
|
||||
gAccRetrieval.getAccessibleFor(aDocument.activeElement), aRule);
|
||||
virtualCursor,
|
||||
gAccRetrieval.getAccessibleFor(aDocument.activeElement), aRule);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
activateCurrent: function activateCurrent(document) {
|
||||
let virtualCursor = this.getVirtualCursor(document);
|
||||
let virtualCursor = Utils.getVirtualCursor(document);
|
||||
let acc = virtualCursor.position;
|
||||
|
||||
if (acc.actionCount > 0) {
|
||||
@ -607,24 +396,9 @@ var VirtualCursorController = {
|
||||
}
|
||||
},
|
||||
|
||||
getVirtualCursor: function getVirtualCursor(document) {
|
||||
return gAccRetrieval.getAccessibleFor(document).
|
||||
QueryInterface(Ci.nsIAccessibleCursorable).virtualCursor;
|
||||
},
|
||||
|
||||
moveCursorToObject: function moveCursorToObject(aAccessible, aRule) {
|
||||
let doc = aAccessible.document;
|
||||
while (doc) {
|
||||
let vc = null;
|
||||
try {
|
||||
vc = doc.QueryInterface(Ci.nsIAccessibleCursorable).virtualCursor;
|
||||
} catch (x) {
|
||||
doc = doc.parentDocument;
|
||||
continue;
|
||||
}
|
||||
vc.moveNext(aRule || TraversalRules.Simple, aAccessible, true);
|
||||
break;
|
||||
}
|
||||
moveCursorToObject: function moveCursorToObject(aVirtualCursor,
|
||||
aAccessible, aRule) {
|
||||
aVirtualCursor.moveNext(aRule || TraversalRules.Simple, aAccessible, true);
|
||||
},
|
||||
|
||||
keyMap: {
|
||||
|
@ -417,7 +417,7 @@ GetClosestInterestingAccessible(id anObject)
|
||||
"Does not support nsIAccessibleText when it should");
|
||||
#endif
|
||||
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role) \
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, nameRule) \
|
||||
case roles::geckoRole: \
|
||||
return macRole;
|
||||
|
||||
|
@ -370,7 +370,8 @@ __try {
|
||||
a11y::role geckoRole = xpAccessible->Role();
|
||||
PRUint32 msaaRole = 0;
|
||||
|
||||
#define ROLE(_geckoRole, stringRole, atkRole, macRole, _msaaRole, ia2Role) \
|
||||
#define ROLE(_geckoRole, stringRole, atkRole, macRole, \
|
||||
_msaaRole, ia2Role, nameRule) \
|
||||
case roles::_geckoRole: \
|
||||
msaaRole = _msaaRole; \
|
||||
break;
|
||||
@ -1135,7 +1136,8 @@ __try {
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
#define ROLE(_geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role) \
|
||||
#define ROLE(_geckoRole, stringRole, atkRole, macRole, \
|
||||
msaaRole, ia2Role, nameRule) \
|
||||
case roles::_geckoRole: \
|
||||
*aRole = ia2Role; \
|
||||
break;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "uiaRawElmProvider.h"
|
||||
|
||||
#include "AccessibleWrap.h"
|
||||
#include "nsIPersistentProperties2.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
@ -181,11 +182,25 @@ uiaRawElmProvider::GetPropertyValue(PROPERTYID aPropertyId,
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
//ARIA Role / shortcut
|
||||
case UIA_AriaRolePropertyId: {
|
||||
nsAutoString xmlRoles;
|
||||
|
||||
nsCOMPtr<nsIPersistentProperties> attributes;
|
||||
mAcc->GetAttributes(getter_AddRefs(attributes));
|
||||
attributes->GetStringProperty(NS_LITERAL_CSTRING("xml-roles"), xmlRoles);
|
||||
|
||||
if(!xmlRoles.IsEmpty()) {
|
||||
aPropertyValue->vt = VT_BSTR;
|
||||
aPropertyValue->bstrVal = ::SysAllocString(xmlRoles.get());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// UI Automation will attempt to get the property from the host
|
||||
//window provider.
|
||||
aPropertyValue->vt = VT_EMPTY;
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
@ -19,7 +20,7 @@ class Relation;
|
||||
/**
|
||||
* Class represents an accessible relation.
|
||||
*/
|
||||
class nsAccessibleRelation : public nsIAccessibleRelation
|
||||
class nsAccessibleRelation MOZ_FINAL : public nsIAccessibleRelation
|
||||
{
|
||||
public:
|
||||
nsAccessibleRelation(PRUint32 aType, Relation* aRel);
|
||||
|
@ -75,7 +75,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
|
||||
"Mozilla Foundation", true, 17, 18);
|
||||
is(normalHyperlinkAcc.getURI(0).spec, "http://www.mozilla.org/",
|
||||
"URI wrong for normalHyperlinkElement!");
|
||||
testStates(normalHyperlinkAcc, STATE_LINKED, EXT_STATE_HORIZONTAL);
|
||||
testStates(normalHyperlinkAcc, STATE_LINKED, 0);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ARIA hyperlink
|
||||
@ -83,7 +83,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
|
||||
[nsIAccessibleHyperLink]);
|
||||
testThis("AriaHyperlink", ariaHyperlinkAcc, ROLE_LINK, 1,
|
||||
"Mozilla Foundation Home", true, 30, 31);
|
||||
testStates(ariaHyperlinkAcc, STATE_LINKED, EXT_STATE_HORIZONTAL);
|
||||
testStates(ariaHyperlinkAcc, STATE_LINKED, 0);
|
||||
testAction("AriaHyperlink", ariaHyperlinkAcc, "click");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -91,7 +91,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
|
||||
var invalidAriaHyperlinkAcc = getAccessible("InvalidAriaHyperlink",
|
||||
[nsIAccessibleHyperLink]);
|
||||
is(invalidAriaHyperlinkAcc.valid, false, "Should not be valid!");
|
||||
testStates(invalidAriaHyperlinkAcc, STATE_LINKED, EXT_STATE_HORIZONTAL);
|
||||
testStates(invalidAriaHyperlinkAcc, STATE_LINKED, 0);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// image map and its link children
|
||||
@ -104,9 +104,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
|
||||
"http://www.bbc.co.uk/radio4/atoz/index.shtml#b", "URI wrong!");
|
||||
is(imageMapHyperlinkAcc.getURI(1).spec,
|
||||
"http://www.bbc.co.uk/radio4/atoz/index.shtml#a", "URI wrong!");
|
||||
testStates(imageMapHyperlinkAcc,
|
||||
(0),
|
||||
(EXT_STATE_HORIZONTAL));
|
||||
testStates(imageMapHyperlinkAcc, 0, 0);
|
||||
|
||||
var area1 = getAccessible(imageMapHyperlinkAcc.firstChild,
|
||||
[nsIAccessibleHyperLink]);
|
||||
@ -127,9 +125,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
|
||||
var EmptyHLAcc = getAccessible("emptyLink",
|
||||
[nsIAccessibleHyperLink]);
|
||||
testThis("emptyLink", EmptyHLAcc, ROLE_LINK, 1, null, true, 93, 94);
|
||||
testStates(EmptyHLAcc,
|
||||
(STATE_FOCUSABLE | STATE_LINKED),
|
||||
(EXT_STATE_HORIZONTAL));
|
||||
testStates(EmptyHLAcc, (STATE_FOCUSABLE | STATE_LINKED), 0);
|
||||
testAction("emptyLink", EmptyHLAcc, "jump");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -140,7 +136,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
|
||||
"Heise Online", true, 119, 120);
|
||||
is(hyperlinkWithSpanAcc.getURI(0).spec, "http://www.heise.de/",
|
||||
"URI wrong for hyperlinkElementWithSpan!");
|
||||
testStates(hyperlinkWithSpanAcc, STATE_LINKED, EXT_STATE_HORIZONTAL);
|
||||
testStates(hyperlinkWithSpanAcc, STATE_LINKED, 0);
|
||||
testAction("LinkWithSpan", hyperlinkWithSpanAcc, "jump");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -149,9 +145,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
|
||||
[nsIAccessibleHyperLink]);
|
||||
testThis("namedAnchor", namedAnchorAcc, ROLE_LINK, 1,
|
||||
"This should never be of state_linked", true, 196, 197);
|
||||
testStates(namedAnchorAcc,
|
||||
(STATE_SELECTABLE),
|
||||
(EXT_STATE_HORIZONTAL), (STATE_FOCUSABLE | STATE_LINKED));
|
||||
testStates(namedAnchorAcc, STATE_SELECTABLE,
|
||||
0, (STATE_FOCUSABLE | STATE_LINKED));
|
||||
testAction("namedAnchor", namedAnchorAcc, "");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -160,9 +155,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
|
||||
[nsIAccessibleHyperLink]);
|
||||
testThis("noLink", noLinkAcc, ROLE_LINK, 1,
|
||||
"This should never be of state_linked", true, 254, 255);
|
||||
testStates(noLinkAcc,
|
||||
0,
|
||||
(EXT_STATE_HORIZONTAL), (STATE_FOCUSABLE | STATE_LINKED));
|
||||
testStates(noLinkAcc, 0, 0, (STATE_FOCUSABLE | STATE_LINKED));
|
||||
testAction("noLink", noLinkAcc, "");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -171,9 +164,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
|
||||
[nsIAccessibleHyperLink]);
|
||||
testThis("linkWithClick", linkWithClickAcc, ROLE_LINK, 1,
|
||||
"This should have state_linked", true, 292, 293);
|
||||
testStates(linkWithClickAcc,
|
||||
(STATE_LINKED),
|
||||
(EXT_STATE_HORIZONTAL));
|
||||
testStates(linkWithClickAcc, STATE_LINKED, 0);
|
||||
testAction("linkWithClick", linkWithClickAcc, "click");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -185,9 +176,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
|
||||
var id = "linkWithTitleNoNameFromSubtree";
|
||||
var linkAcc = getAccessible(id, [nsIAccessibleHyperLink]);
|
||||
testThis(id, linkAcc, ROLE_LINK, 1, "Link with title", true, 344, 345);
|
||||
testStates(linkAcc,
|
||||
(STATE_LINKED),
|
||||
(EXT_STATE_HORIZONTAL));
|
||||
testStates(linkAcc, STATE_LINKED, 0);
|
||||
testAction(id, linkAcc, "jump");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -197,9 +186,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
|
||||
linkAcc = getAccessible(id, [nsIAccessibleHyperLink]);
|
||||
testThis(id, linkAcc, ROLE_LINK, 1, "the name from subtree", true, 393,
|
||||
394);
|
||||
testStates(linkAcc,
|
||||
(STATE_LINKED),
|
||||
(EXT_STATE_HORIZONTAL));
|
||||
testStates(linkAcc, STATE_LINKED, 0);
|
||||
testAction(id, linkAcc, "jump");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -208,9 +195,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
|
||||
linkAcc = getAccessible(id, [nsIAccessibleHyperLink]);
|
||||
testThis(id, linkAcc, ROLE_LINK, 1, "The title for link", true, 447,
|
||||
448);
|
||||
testStates(linkAcc,
|
||||
(STATE_LINKED),
|
||||
(EXT_STATE_HORIZONTAL));
|
||||
testStates(linkAcc, STATE_LINKED, 0);
|
||||
testAction(id, linkAcc, "jump");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -219,9 +204,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
|
||||
linkAcc = getAccessible(id, [nsIAccessibleHyperLink]);
|
||||
testThis(id, linkAcc, ROLE_LINK, 1, "Link with label and nested image:",
|
||||
true, 450, 451);
|
||||
testStates(linkAcc,
|
||||
(STATE_LINKED),
|
||||
(EXT_STATE_HORIZONTAL));
|
||||
testStates(linkAcc, STATE_LINKED, 0);
|
||||
testAction(id, linkAcc, "jump");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -45,7 +45,7 @@
|
||||
testThis("linkedLabel", linkedLabelAcc, ROLE_LINK, 1,
|
||||
"Mozilla Foundation home", "http://www.mozilla.org/", 1, 2,
|
||||
true);
|
||||
testStates(linkedLabelAcc, STATE_LINKED, EXT_STATE_HORIZONTAL);
|
||||
testStates(linkedLabelAcc, STATE_LINKED, 0);
|
||||
|
||||
var labelWithValueAcc = getAccessible("linkLabelWithValue",
|
||||
[nsIAccessibleHyperLink]);
|
||||
|
@ -153,15 +153,15 @@
|
||||
testStates("aria_navigation_anchor", STATE_SELECTABLE);
|
||||
|
||||
// aria-orientation (applied to scrollbar, separator, slider)
|
||||
testStates("aria_scrollbar", 0, EXT_STATE_HORIZONTAL);
|
||||
testStates("aria_hscrollbar", 0, EXT_STATE_HORIZONTAL);
|
||||
testStates("aria_vscrollbar", 0, EXT_STATE_VERTICAL);
|
||||
testStates("aria_separator", 0, EXT_STATE_HORIZONTAL);
|
||||
testStates("aria_hseparator", 0, EXT_STATE_HORIZONTAL);
|
||||
testStates("aria_vseparator", 0, EXT_STATE_VERTICAL);
|
||||
testStates("aria_slider", 0, EXT_STATE_HORIZONTAL);
|
||||
testStates("aria_hslider", 0, EXT_STATE_HORIZONTAL);
|
||||
testStates("aria_vslider", 0, EXT_STATE_VERTICAL);
|
||||
testStates("aria_scrollbar", 0, EXT_STATE_VERTICAL, 0, EXT_STATE_HORIZONTAL);
|
||||
testStates("aria_hscrollbar", 0, EXT_STATE_HORIZONTAL, 0, EXT_STATE_VERTICAL);
|
||||
testStates("aria_vscrollbar", 0, EXT_STATE_VERTICAL, 0, EXT_STATE_HORIZONTAL);
|
||||
testStates("aria_separator", 0, EXT_STATE_HORIZONTAL, 0, EXT_STATE_VERTICAL);
|
||||
testStates("aria_hseparator", 0, EXT_STATE_HORIZONTAL, 0, EXT_STATE_VERTICAL);
|
||||
testStates("aria_vseparator", 0, EXT_STATE_VERTICAL, 0, EXT_STATE_HORIZONTAL);
|
||||
testStates("aria_slider", 0, EXT_STATE_HORIZONTAL, 0, EXT_STATE_VERTICAL);
|
||||
testStates("aria_hslider", 0, EXT_STATE_HORIZONTAL, 0, EXT_STATE_VERTICAL);
|
||||
testStates("aria_vslider", 0, EXT_STATE_VERTICAL, 0, EXT_STATE_HORIZONTAL);
|
||||
|
||||
// indeterminate ARIA progressbars (no aria-valuenow or aria-valuetext attribute)
|
||||
// should expose mixed state
|
||||
@ -225,6 +225,11 @@
|
||||
title="ARIA undetermined progressmeters should expose mixed state">
|
||||
Mozilla Bug 740851
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=762876
|
||||
title="fix default horizontal / vertical state of role=scrollbar and ensure only one of horizontal / vertical states is exposed">
|
||||
Mozilla Bug 762876
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
|
@ -45,7 +45,6 @@ pref("network.http.proxy.pipelining", true);
|
||||
pref("network.http.pipelining.maxrequests" , 6);
|
||||
pref("network.http.keep-alive.timeout", 600);
|
||||
pref("network.http.max-connections", 6);
|
||||
pref("network.http.max-connections-per-server", 4);
|
||||
pref("network.http.max-persistent-connections-per-server", 4);
|
||||
pref("network.http.max-persistent-connections-per-proxy", 4);
|
||||
|
||||
|
@ -74,14 +74,16 @@ SettingsListener.observe('language.current', 'en-US', function(value) {
|
||||
let strPrefs = ['ril.data.apn', 'ril.data.user', 'ril.data.passwd',
|
||||
'ril.data.mmsc', 'ril.data.mmsproxy'];
|
||||
strPrefs.forEach(function(key) {
|
||||
SettingsListener.observe(key, false, function(value) {
|
||||
SettingsListener.observe(key, "", function(value) {
|
||||
Services.prefs.setCharPref(key, value);
|
||||
});
|
||||
});
|
||||
|
||||
['ril.data.mmsport'].forEach(function(key) {
|
||||
SettingsListener.observe(key, false, function(value) {
|
||||
Services.prefs.setIntPref(key, value);
|
||||
SettingsListener.observe(key, null, function(value) {
|
||||
if (value != null) {
|
||||
Services.prefs.setIntPref(key, value);
|
||||
}
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
@ -15,6 +15,7 @@ Cu.import('resource://gre/modules/ContactService.jsm');
|
||||
Cu.import('resource://gre/modules/SettingsChangeNotifier.jsm');
|
||||
Cu.import('resource://gre/modules/Webapps.jsm');
|
||||
Cu.import('resource://gre/modules/AlarmService.jsm');
|
||||
Cu.import('resource://gre/modules/ActivitiesService.jsm');
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(Services, 'env',
|
||||
'@mozilla.org/process/environment;1',
|
||||
@ -245,8 +246,8 @@ var shell = {
|
||||
if (!manifest)
|
||||
return;
|
||||
|
||||
let documentURI = contentWindow.document.documentURIObject;
|
||||
if (!Services.perms.testPermission(documentURI, 'offline-app')) {
|
||||
let principal = contentWindow.document.nodePrincipal;
|
||||
if (Services.perms.testPermissionFromPrincipal(principal, 'offline-app') == Ci.nsIPermissionManager.UNKNOWN_ACTION) {
|
||||
if (Services.prefs.getBoolPref('browser.offline-apps.notify')) {
|
||||
// FIXME Bug 710729 - Add a UI for offline cache notifications
|
||||
return;
|
||||
@ -254,8 +255,8 @@ var shell = {
|
||||
return;
|
||||
}
|
||||
|
||||
Services.perms.add(documentURI, 'offline-app',
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
Services.perms.addFromPrincipal(principal, 'offline-app',
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
|
||||
let manifestURI = Services.io.newURI(manifest, null, documentURI);
|
||||
let updateService = Cc['@mozilla.org/offlinecacheupdate-service;1']
|
||||
@ -306,15 +307,16 @@ nsBrowserAccess.prototype = {
|
||||
};
|
||||
|
||||
// Listen for system messages and relay them to Gaia.
|
||||
Services.obs.addObserver(function(aSubject, aTopic, aData) {
|
||||
let msg = JSON.parse(aData);
|
||||
Services.obs.addObserver(function onSystemMessage(subject, topic, data) {
|
||||
let msg = JSON.parse(data);
|
||||
let origin = Services.io.newURI(msg.manifest, null, null).prePath;
|
||||
shell.sendEvent(shell.contentBrowser.contentWindow,
|
||||
"mozChromeEvent", { type: "open-app",
|
||||
url: msg.uri,
|
||||
origin: origin,
|
||||
manifest: msg.manifest } );
|
||||
}, "system-messages-open-app", false);
|
||||
shell.sendEvent(shell.contentBrowser.contentWindow, 'mozChromeEvent', {
|
||||
type: 'open-app',
|
||||
url: msg.uri,
|
||||
origin: origin,
|
||||
manifest: msg.manifest
|
||||
});
|
||||
}, 'system-messages-open-app', false);
|
||||
|
||||
(function Repl() {
|
||||
if (!Services.prefs.getBoolPref('b2g.remote-js.enabled')) {
|
||||
|
72
b2g/components/ActivitiesGlue.js
Normal file
72
b2g/components/ActivitiesGlue.js
Normal file
@ -0,0 +1,72 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict"
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function ActivitiesDialog() {
|
||||
this._id = 0;
|
||||
|
||||
this.activities = [];
|
||||
}
|
||||
|
||||
ActivitiesDialog.prototype = {
|
||||
run: function ap_run() {
|
||||
let id = "activity-choice" + this._id++;
|
||||
let activity = this.activities.shift();
|
||||
|
||||
let choices = [];
|
||||
activity.list.forEach(function(item) {
|
||||
choices.push({ title: item.title, icon: item.icon });
|
||||
});
|
||||
|
||||
|
||||
// Keep up the frond-end of an activity choice. The messages contains
|
||||
// a list of {names, icons} for applications able to handle this particular
|
||||
// activity. The front-end should display a UI to pick one.
|
||||
let browser = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let content = browser.getContentWindow();
|
||||
let event = content.document.createEvent("CustomEvent");
|
||||
event.initCustomEvent("mozChromeEvent", true, true, {
|
||||
type: "activity-choice",
|
||||
id: id,
|
||||
name: activity.name,
|
||||
choices: choices
|
||||
});
|
||||
|
||||
// Listen the resulting choice from the front-end. If there is no choice,
|
||||
// let's return -1, which means the user has cancelled the dialog.
|
||||
content.addEventListener("mozContentEvent", function act_getChoice(evt) {
|
||||
if (evt.detail.id != id)
|
||||
return;
|
||||
|
||||
content.removeEventListener("mozContentEvent", act_getChoice);
|
||||
activity.callback.handleEvent(evt.detail.value ? evt.detail.value : -1);
|
||||
});
|
||||
|
||||
content.dispatchEvent(event);
|
||||
},
|
||||
|
||||
chooseActivity: function ap_chooseActivity(aName, aActivities, aCallback) {
|
||||
this.activities.push({
|
||||
name: aName,
|
||||
list: aActivities,
|
||||
callback: aCallback
|
||||
});
|
||||
Services.tm.currentThread.dispatch(this, Ci.nsIEventTarget.DISPATCH_NORMAL);
|
||||
},
|
||||
|
||||
classID: Components.ID("{70a83123-7467-4389-a309-3e81c74ad002}"),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIActivityUIGlue, Ci.nsIRunnable])
|
||||
}
|
||||
|
||||
const NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivitiesDialog]);
|
||||
|
@ -30,6 +30,10 @@ component {9181eb7c-6f87-11e1-90b1-4f59d80dd2e5} DirectoryProvider.js
|
||||
contract @mozilla.org/browser/directory-provider;1 {9181eb7c-6f87-11e1-90b1-4f59d80dd2e5}
|
||||
category xpcom-directory-providers browser-directory-provider @mozilla.org/browser/directory-provider;1
|
||||
|
||||
# ActivitiesGlue.js
|
||||
component {70a83123-7467-4389-a309-3e81c74ad002} ActivitiesGlue.js
|
||||
contract @mozilla.org/dom/activities/ui-glue;1 {70a83123-7467-4389-a309-3e81c74ad002}
|
||||
|
||||
# ProcessGlobal.js
|
||||
component {1a94c87a-5ece-4d11-91e1-d29c29f21b28} ProcessGlobal.js
|
||||
contract @mozilla.org/b2g-process-global;1 {1a94c87a-5ece-4d11-91e1-d29c29f21b28}
|
||||
|
@ -59,7 +59,7 @@ CameraContent.prototype = {
|
||||
let principal = aWindow.document.nodePrincipal;
|
||||
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
|
||||
|
||||
let perm = principal == secMan.getSystemPrincipal() ? Ci.nsIPermissionManager.ALLOW_ACTION : Services.perms.testExactPermission(principal.URI, "content-camera");
|
||||
let perm = Services.perms.testExactPermissionFromPrincipal(principal, "content-camera");
|
||||
|
||||
//only pages with perm set and chrome pages can use the camera in content
|
||||
this.hasPrivileges = perm == Ci.nsIPermissionManager.ALLOW_ACTION;
|
||||
|
@ -24,6 +24,7 @@ EXTRA_PP_COMPONENTS = \
|
||||
DirectoryProvider.js \
|
||||
MozKeyboard.js \
|
||||
ProcessGlobal.js \
|
||||
ActivitiesGlue.js \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_UPDATER
|
||||
|
@ -153,6 +153,7 @@
|
||||
@BINPATH@/components/directory.xpt
|
||||
@BINPATH@/components/docshell.xpt
|
||||
@BINPATH@/components/dom.xpt
|
||||
@BINPATH@/components/dom_activities.xpt
|
||||
@BINPATH@/components/dom_apps.xpt
|
||||
@BINPATH@/components/dom_base.xpt
|
||||
#ifdef MOZ_B2G_RIL
|
||||
@ -476,6 +477,12 @@
|
||||
@BINPATH@/components/SystemMessageManager.js
|
||||
@BINPATH@/components/SystemMessageManager.manifest
|
||||
|
||||
@BINPATH@/components/Activities.manifest
|
||||
@BINPATH@/components/ActivityOptions.js
|
||||
@BINPATH@/components/ActivityProxy.js
|
||||
@BINPATH@/components/ActivityRequestHandler.js
|
||||
@BINPATH@/components/ActivityWrapper.js
|
||||
|
||||
@BINPATH@/components/AppProtocolHandler.js
|
||||
@BINPATH@/components/AppProtocolHandler.manifest
|
||||
|
||||
@ -675,4 +682,5 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
|
||||
#endif
|
||||
@BINPATH@/components/MozKeyboard.js
|
||||
@BINPATH@/components/DirectoryProvider.js
|
||||
@BINPATH@/components/ActivitiesGlue.js
|
||||
@BINPATH@/components/ProcessGlobal.js
|
||||
|
@ -142,68 +142,19 @@
|
||||
<menu id="appmenu_webDeveloper"
|
||||
label="&appMenuWebDeveloper.label;">
|
||||
<menupopup id="appmenu_webDeveloper_popup">
|
||||
<menuitem id="appmenu_devToolbar"
|
||||
type="checkbox"
|
||||
autocheck="false"
|
||||
hidden="true"
|
||||
label="&devToolbarMenu.label;"
|
||||
command="Tools:DevToolbar"
|
||||
key="key_devToolbar"/>
|
||||
<menuitem id="appmenu_webConsole"
|
||||
label="&webConsoleCmd.label;"
|
||||
type="checkbox"
|
||||
command="Tools:WebConsole"
|
||||
key="key_webConsole"/>
|
||||
<menuitem id="appmenu_pageInspect"
|
||||
hidden="true"
|
||||
label="&inspectMenu.label;"
|
||||
type="checkbox"
|
||||
command="Tools:Inspect"
|
||||
key="key_inspect"/>
|
||||
<menuitem id="appmenu_responsiveUI"
|
||||
hidden="true"
|
||||
label="&responsiveDesignTool.label;"
|
||||
type="checkbox"
|
||||
command="Tools:ResponsiveUI"
|
||||
key="key_responsiveUI"/>
|
||||
<menuitem id="appmenu_debugger"
|
||||
hidden="true"
|
||||
type="checkbox"
|
||||
label="&debuggerMenu.label2;"
|
||||
key="key_debugger"
|
||||
command="Tools:Debugger"/>
|
||||
<menuitem id="appmenu_remoteDebugger"
|
||||
hidden="true"
|
||||
label="&remoteDebuggerMenu.label;"
|
||||
command="Tools:RemoteDebugger"/>
|
||||
<menuitem id="appmenu_chromeDebugger"
|
||||
hidden="true"
|
||||
label="&chromeDebuggerMenu.label;"
|
||||
command="Tools:ChromeDebugger"/>
|
||||
<menuitem id="appmenu_scratchpad"
|
||||
hidden="true"
|
||||
label="&scratchpad.label;"
|
||||
key="key_scratchpad"
|
||||
command="Tools:Scratchpad"/>
|
||||
<menuitem id="appmenu_styleeditor"
|
||||
hidden="true"
|
||||
type="checkbox"
|
||||
label="&styleeditor.label;"
|
||||
key="key_styleeditor"
|
||||
command="Tools:StyleEditor"/>
|
||||
<menuitem id="appmenu_pageSource"
|
||||
label="&viewPageSourceCmd.label;"
|
||||
command="View:PageSource"
|
||||
key="key_viewSource"/>
|
||||
<menuitem id="appmenu_errorConsole"
|
||||
hidden="true"
|
||||
label="&errorConsoleCmd.label;"
|
||||
key="key_errorConsole"
|
||||
oncommand="toJavaScriptConsole();"/>
|
||||
<menuitem id="appmenu_devToolbar" observes="devtoolsMenuBroadcaster_DevToolbar"/>
|
||||
<menuitem id="appmenu_webConsole" observes="devtoolsMenuBroadcaster_WebConsole"/>
|
||||
<menuitem id="appmenu_pageinspect" observes="devtoolsMenuBroadcaster_Inspect"/>
|
||||
<menuitem id="appmenu_responsiveUI" observes="devtoolsMenuBroadcaster_ResponsiveUI"/>
|
||||
<menuitem id="appmenu_debugger" observes="devtoolsMenuBroadcaster_Debugger"/>
|
||||
<menuitem id="appmenu_remoteDebugger" observes="devtoolsMenuBroadcaster_RemoteDebugger"/>
|
||||
<menuitem id="appmenu_chromeDebugger" observes="devtoolsMenuBroadcaster_ChromeDebugger"/>
|
||||
<menuitem id="appmenu_scratchpad" observes="devtoolsMenuBroadcaster_Scratchpad"/>
|
||||
<menuitem id="appmenu_styleeditor" observes="devtoolsMenuBroadcaster_StyleEditor"/>
|
||||
<menuitem id="appmenu_pageSource" observes="devtoolsMenuBroadcaster_PageSource"/>
|
||||
<menuitem id="appmenu_errorConsole" observes="devtoolsMenuBroadcaster_ErrorConsole"/>
|
||||
<menuseparator id="appmenu_devToolsEndSeparator"/>
|
||||
<menuitem id="appmenu_getMoreDevtools"
|
||||
label="&getMoreDevtoolsCmd.label;"
|
||||
oncommand="openUILinkIn('https://addons.mozilla.org/firefox/collections/mozilla/webdeveloper/', 'tab');"/>
|
||||
<menuitem id="appmenu_getMoreDevtools" observes="devtoolsMenuBroadcaster_GetMoreTools"/>
|
||||
<menuseparator/>
|
||||
#define ID_PREFIX appmenu_developer_
|
||||
#define OMIT_ACCESSKEYS
|
||||
|
@ -514,77 +514,19 @@
|
||||
label="&webDeveloperMenu.label;"
|
||||
accesskey="&webDeveloperMenu.accesskey;">
|
||||
<menupopup id="menuWebDeveloperPopup">
|
||||
<menuitem id="menu_devToolbar"
|
||||
type="checkbox"
|
||||
autocheck="false"
|
||||
hidden="true"
|
||||
label="&devToolbarMenu.label;"
|
||||
accesskey="&devToolbarMenu.accesskey;"
|
||||
key="key_devToolbar"
|
||||
command="Tools:DevToolbar"/>
|
||||
<menuitem id="webConsole"
|
||||
type="checkbox"
|
||||
label="&webConsoleCmd.label;"
|
||||
accesskey="&webConsoleCmd.accesskey;"
|
||||
key="key_webConsole"
|
||||
command="Tools:WebConsole"/>
|
||||
<menuitem id="menu_pageinspect"
|
||||
type="checkbox"
|
||||
hidden="true"
|
||||
label="&inspectMenu.label;"
|
||||
accesskey="&inspectMenu.accesskey;"
|
||||
key="key_inspect"
|
||||
command="Tools:Inspect"/>
|
||||
<menuitem id="menu_responsiveUI"
|
||||
type="checkbox"
|
||||
hidden="true"
|
||||
label="&responsiveDesignTool.label;"
|
||||
accesskey="&responsiveDesignTool.accesskey;"
|
||||
key="key_responsiveUI"
|
||||
command="Tools:ResponsiveUI"/>
|
||||
<menuitem id="menu_debugger"
|
||||
hidden="true"
|
||||
type="checkbox"
|
||||
label="&debuggerMenu.label2;"
|
||||
key="key_debugger"
|
||||
command="Tools:Debugger"/>
|
||||
<menuitem id="menu_remoteDebugger"
|
||||
hidden="true"
|
||||
label="&remoteDebuggerMenu.label;"
|
||||
command="Tools:RemoteDebugger"/>
|
||||
<menuitem id="menu_chromeDebugger"
|
||||
hidden="true"
|
||||
label="&chromeDebuggerMenu.label;"
|
||||
command="Tools:ChromeDebugger"/>
|
||||
<menuitem id="menu_scratchpad"
|
||||
hidden="true"
|
||||
label="&scratchpad.label;"
|
||||
accesskey="&scratchpad.accesskey;"
|
||||
key="key_scratchpad"
|
||||
command="Tools:Scratchpad"/>
|
||||
<menuitem id="menu_styleeditor"
|
||||
type="checkbox"
|
||||
hidden="true"
|
||||
label="&styleeditor.label;"
|
||||
accesskey="&styleeditor.accesskey;"
|
||||
key="key_styleeditor"
|
||||
command="Tools:StyleEditor"/>
|
||||
<menuitem id="menu_pageSource"
|
||||
accesskey="&pageSourceCmd.accesskey;"
|
||||
label="&pageSourceCmd.label;"
|
||||
key="key_viewSource"
|
||||
command="View:PageSource"/>
|
||||
<menuitem id="javascriptConsole"
|
||||
hidden="true"
|
||||
label="&errorConsoleCmd.label;"
|
||||
accesskey="&errorConsoleCmd.accesskey;"
|
||||
key="key_errorConsole"
|
||||
oncommand="toJavaScriptConsole();"/>
|
||||
<menuitem id="menu_devToolbar" observes="devtoolsMenuBroadcaster_DevToolbar" accesskey="&devToolbarMenu.accesskey;"/>
|
||||
<menuitem id="webConsole" observes="devtoolsMenuBroadcaster_WebConsole" accesskey="&webConsoleCmd.accesskey;"/>
|
||||
<menuitem id="menu_pageinspect" observes="devtoolsMenuBroadcaster_Inspect" accesskey="&inspectMenu.accesskey;"/>
|
||||
<menuitem id="menu_responsiveUI" observes="devtoolsMenuBroadcaster_ResponsiveUI" accesskey="&responsiveDesignTool.accesskey;"/>
|
||||
<menuitem id="menu_debugger" observes="devtoolsMenuBroadcaster_Debugger"/>
|
||||
<menuitem id="menu_remoteDebugger" observes="devtoolsMenuBroadcaster_RemoteDebugger"/>
|
||||
<menuitem id="menu_chromeDebugger" observes="devtoolsMenuBroadcaster_ChromeDebugger"/>
|
||||
<menuitem id="menu_scratchpad" observes="devtoolsMenuBroadcaster_Scratchpad" accesskey="&scratchpad.accesskey;"/>
|
||||
<menuitem id="menu_styleeditor" observes="devtoolsMenuBroadcaster_StyleEditor" accesskey="&styleeditor.accesskey;"/>
|
||||
<menuitem id="menu_pageSource" observes="devtoolsMenuBroadcaster_PageSource" accesskey="&pageSourceCmd.accesskey;"/>
|
||||
<menuitem id="javascriptConsole" observes="devtoolsMenuBroadcaster_ErrorConsole" accesskey="&errorConsoleCmd.accesskey;"/>
|
||||
<menuseparator id="devToolsEndSeparator"/>
|
||||
<menuitem id="getMoreDevtools"
|
||||
label="&getMoreDevtoolsCmd.label;"
|
||||
accesskey="&getMoreDevtoolsCmd.accesskey;"
|
||||
oncommand="openUILinkIn('https://addons.mozilla.org/firefox/collections/mozilla/webdeveloper/', 'tab');"/>
|
||||
<menuitem id="getMoreDevtools" observes="devtoolsMenuBroadcaster_GetMoreTools" accesskey="&getMoreDevtoolsCmd.accesskey;"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuitem id="menu_pageInfo"
|
||||
|
@ -88,16 +88,16 @@
|
||||
|
||||
<command id="Tools:Search" oncommand="BrowserSearch.webSearch();"/>
|
||||
<command id="Tools:Downloads" oncommand="BrowserDownloadsUI();"/>
|
||||
<command id="Tools:DevToolbar" oncommand="DeveloperToolbar.toggle();" disabled="true"/>
|
||||
<command id="Tools:DevToolbar" oncommand="DeveloperToolbar.toggle();"/>
|
||||
<command id="Tools:DevToolbarFocus" oncommand="DeveloperToolbar.focus();" disabled="true"/>
|
||||
<command id="Tools:WebConsole" oncommand="HUDConsoleUI.toggleHUD();"/>
|
||||
<command id="Tools:Inspect" oncommand="InspectorUI.toggleInspectorUI();" disabled="true"/>
|
||||
<command id="Tools:Debugger" oncommand="DebuggerUI.toggleDebugger();" disabled="true"/>
|
||||
<command id="Tools:RemoteDebugger" oncommand="DebuggerUI.toggleRemoteDebugger();" disabled="true"/>
|
||||
<command id="Tools:ChromeDebugger" oncommand="DebuggerUI.toggleChromeDebugger();" disabled="true"/>
|
||||
<command id="Tools:Scratchpad" oncommand="Scratchpad.openScratchpad();" disabled="true"/>
|
||||
<command id="Tools:StyleEditor" oncommand="StyleEditor.toggle();" disabled="true"/>
|
||||
<command id="Tools:ResponsiveUI" oncommand="ResponsiveUI.toggle();" disabled="true"/>
|
||||
<command id="Tools:Inspect" oncommand="InspectorUI.toggleInspectorUI();"/>
|
||||
<command id="Tools:Debugger" oncommand="DebuggerUI.toggleDebugger();"/>
|
||||
<command id="Tools:RemoteDebugger" oncommand="DebuggerUI.toggleRemoteDebugger();"/>
|
||||
<command id="Tools:ChromeDebugger" oncommand="DebuggerUI.toggleChromeDebugger();"/>
|
||||
<command id="Tools:Scratchpad" oncommand="Scratchpad.openScratchpad();"/>
|
||||
<command id="Tools:StyleEditor" oncommand="StyleEditor.toggle();"/>
|
||||
<command id="Tools:ResponsiveUI" oncommand="ResponsiveUI.toggle();"/>
|
||||
<command id="Tools:Addons" oncommand="BrowserOpenAddonsMgr();"/>
|
||||
<command id="Tools:Sanitize"
|
||||
oncommand="Cc['@mozilla.org/browser/browserglue;1'].getService(Ci.nsIBrowserGlue).sanitize(window);"/>
|
||||
@ -183,6 +183,68 @@
|
||||
#endif
|
||||
<broadcaster id="workOfflineMenuitemState"/>
|
||||
<broadcaster id="socialSidebarBroadcaster" hidden="true"/>
|
||||
|
||||
<!-- DevTools broadcasters -->
|
||||
<broadcaster id="devtoolsMenuBroadcaster_DevToolbar"
|
||||
label="&devToolbarMenu.label;"
|
||||
type="checkbox" autocheck="false"
|
||||
command="Tools:DevToolbar"
|
||||
key="key_devToolbar"
|
||||
disabled="true" hidden="true"/>
|
||||
<broadcaster id="devtoolsMenuBroadcaster_WebConsole"
|
||||
label="&webConsoleCmd.label;"
|
||||
type="checkbox" autocheck="false"
|
||||
key="key_webConsole"
|
||||
command="Tools:WebConsole"/>
|
||||
<broadcaster id="devtoolsMenuBroadcaster_Inspect"
|
||||
label="&inspectMenu.label;"
|
||||
type="checkbox" autocheck="false"
|
||||
command="Tools:Inspect"
|
||||
key="key_inspect"
|
||||
disabled="true" hidden="true"/>
|
||||
<broadcaster id="devtoolsMenuBroadcaster_Debugger"
|
||||
label="&debuggerMenu.label2;"
|
||||
type="checkbox" autocheck="false"
|
||||
command="Tools:Debugger"
|
||||
key="key_debugger"
|
||||
disabled="true" hidden="true"/>
|
||||
<broadcaster id="devtoolsMenuBroadcaster_RemoteDebugger"
|
||||
label="&remoteDebuggerMenu.label;"
|
||||
command="Tools:RemoteDebugger"
|
||||
disabled="true" hidden="true"/>
|
||||
<broadcaster id="devtoolsMenuBroadcaster_ChromeDebugger"
|
||||
label="&chromeDebuggerMenu.label;"
|
||||
command="Tools:ChromeDebugger"
|
||||
disabled="true" hidden="true"/>
|
||||
<broadcaster id="devtoolsMenuBroadcaster_Scratchpad"
|
||||
label="&scratchpad.label;"
|
||||
command="Tools:Scratchpad"
|
||||
key="key_scratchpad"
|
||||
disabled="true" hidden="true"/>
|
||||
<broadcaster id="devtoolsMenuBroadcaster_StyleEditor"
|
||||
label="&styleeditor.label;"
|
||||
type="checkbox" autocheck="false"
|
||||
command="Tools:StyleEditor"
|
||||
key="key_styleeditor"
|
||||
disabled="true" hidden="true"/>
|
||||
<broadcaster id="devtoolsMenuBroadcaster_ResponsiveUI"
|
||||
label="&responsiveDesignTool.label;"
|
||||
type="checkbox" autocheck="false"
|
||||
command="Tools:ResponsiveUI"
|
||||
key="key_responsiveUI"
|
||||
disabled="true" hidden="true"/>
|
||||
<broadcaster id="devtoolsMenuBroadcaster_PageSource"
|
||||
label="&pageSourceCmd.label;"
|
||||
key="key_viewSource"
|
||||
command="View:PageSource"/>
|
||||
<broadcaster id="devtoolsMenuBroadcaster_ErrorConsole"
|
||||
hidden="true"
|
||||
label="&errorConsoleCmd.label;"
|
||||
key="key_errorConsole"
|
||||
oncommand="toJavaScriptConsole();"/>
|
||||
<broadcaster id="devtoolsMenuBroadcaster_GetMoreTools"
|
||||
label="&getMoreDevtoolsCmd.label;"
|
||||
oncommand="openUILinkIn('https://addons.mozilla.org/firefox/collections/mozilla/webdeveloper/', 'tab');"/>
|
||||
</broadcasterset>
|
||||
|
||||
<keyset id="mainKeyset">
|
||||
|
@ -578,6 +578,12 @@ html|*#gcli-output-frame,
|
||||
-moz-box-pack: center;
|
||||
}
|
||||
|
||||
/* We don't show the Style Editor button in the developer toolbar for now.
|
||||
See bug 771203 */
|
||||
#developer-toolbar-styleeditor {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Responsive Mode */
|
||||
|
||||
vbox[anonid=browserContainer][responsivemode] {
|
||||
|
@ -1402,12 +1402,10 @@ var gBrowserInit = {
|
||||
// Enable developer toolbar?
|
||||
let devToolbarEnabled = gPrefService.getBoolPref("devtools.toolbar.enabled");
|
||||
if (devToolbarEnabled) {
|
||||
document.getElementById("menu_devToolbar").hidden = false;
|
||||
document.getElementById("Tools:DevToolbar").removeAttribute("disabled");
|
||||
let broadcaster = document.getElementById("devtoolsMenuBroadcaster_DevToolbar");
|
||||
broadcaster.removeAttribute("disabled");
|
||||
broadcaster.removeAttribute("hidden");
|
||||
document.getElementById("Tools:DevToolbarFocus").removeAttribute("disabled");
|
||||
#ifdef MENUBAR_CAN_AUTOHIDE
|
||||
document.getElementById("appmenu_devToolbar").hidden = false;
|
||||
#endif
|
||||
|
||||
// Show the toolbar if it was previously visible
|
||||
if (gPrefService.getBoolPref("devtools.toolbar.visible")) {
|
||||
@ -1418,33 +1416,25 @@ var gBrowserInit = {
|
||||
// Enable Inspector?
|
||||
let enabled = gPrefService.getBoolPref("devtools.inspector.enabled");
|
||||
if (enabled) {
|
||||
document.getElementById("menu_pageinspect").hidden = false;
|
||||
document.getElementById("Tools:Inspect").removeAttribute("disabled");
|
||||
#ifdef MENUBAR_CAN_AUTOHIDE
|
||||
document.getElementById("appmenu_pageInspect").hidden = false;
|
||||
#endif
|
||||
document.getElementById("developer-toolbar-inspector").hidden = false;
|
||||
let broadcaster = document.getElementById("devtoolsMenuBroadcaster_Inspect");
|
||||
broadcaster.removeAttribute("disabled");
|
||||
broadcaster.removeAttribute("hidden");
|
||||
}
|
||||
|
||||
// Enable Debugger?
|
||||
let enabled = gPrefService.getBoolPref("devtools.debugger.enabled");
|
||||
if (enabled) {
|
||||
document.getElementById("menu_debugger").hidden = false;
|
||||
document.getElementById("Tools:Debugger").removeAttribute("disabled");
|
||||
#ifdef MENUBAR_CAN_AUTOHIDE
|
||||
document.getElementById("appmenu_debugger").hidden = false;
|
||||
#endif
|
||||
document.getElementById("developer-toolbar-debugger").hidden = false;
|
||||
let broadcaster = document.getElementById("devtoolsMenuBroadcaster_Debugger");
|
||||
broadcaster.removeAttribute("disabled");
|
||||
broadcaster.removeAttribute("hidden");
|
||||
}
|
||||
|
||||
// Enable Remote Debugger?
|
||||
let enabled = gPrefService.getBoolPref("devtools.debugger.remote-enabled");
|
||||
if (enabled) {
|
||||
document.getElementById("menu_remoteDebugger").hidden = false;
|
||||
document.getElementById("Tools:RemoteDebugger").removeAttribute("disabled");
|
||||
#ifdef MENUBAR_CAN_AUTOHIDE
|
||||
document.getElementById("appmenu_remoteDebugger").hidden = false;
|
||||
#endif
|
||||
let broadcaster = document.getElementById("devtoolsMenuBroadcaster_RemoteDebugger");
|
||||
broadcaster.removeAttribute("disabled");
|
||||
broadcaster.removeAttribute("hidden");
|
||||
}
|
||||
|
||||
// Enable Chrome Debugger?
|
||||
@ -1452,45 +1442,34 @@ var gBrowserInit = {
|
||||
gPrefService.getBoolPref("devtools.debugger.chrome-enabled") &&
|
||||
gPrefService.getBoolPref("devtools.debugger.remote-enabled");
|
||||
if (enabled) {
|
||||
document.getElementById("menu_chromeDebugger").hidden = false;
|
||||
document.getElementById("Tools:ChromeDebugger").removeAttribute("disabled");
|
||||
#ifdef MENUBAR_CAN_AUTOHIDE
|
||||
document.getElementById("appmenu_chromeDebugger").hidden = false;
|
||||
#endif
|
||||
let broadcaster = document.getElementById("devtoolsMenuBroadcaster_ChromeDebugger");
|
||||
broadcaster.removeAttribute("disabled");
|
||||
broadcaster.removeAttribute("hidden");
|
||||
}
|
||||
|
||||
// Enable Error Console?
|
||||
// XXX Temporarily always-enabled, see bug 601201
|
||||
let consoleEnabled = true || gPrefService.getBoolPref("devtools.errorconsole.enabled");
|
||||
if (consoleEnabled) {
|
||||
document.getElementById("javascriptConsole").hidden = false;
|
||||
document.getElementById("key_errorConsole").removeAttribute("disabled");
|
||||
#ifdef MENUBAR_CAN_AUTOHIDE
|
||||
document.getElementById("appmenu_errorConsole").hidden = false;
|
||||
#endif
|
||||
let broadcaster = document.getElementById("devtoolsMenuBroadcaster_ErrorConsole");
|
||||
broadcaster.removeAttribute("disabled");
|
||||
broadcaster.removeAttribute("hidden");
|
||||
}
|
||||
|
||||
// Enable Scratchpad in the UI, if the preference allows this.
|
||||
let scratchpadEnabled = gPrefService.getBoolPref(Scratchpad.prefEnabledName);
|
||||
if (scratchpadEnabled) {
|
||||
document.getElementById("menu_scratchpad").hidden = false;
|
||||
document.getElementById("Tools:Scratchpad").removeAttribute("disabled");
|
||||
#ifdef MENUBAR_CAN_AUTOHIDE
|
||||
document.getElementById("appmenu_scratchpad").hidden = false;
|
||||
#endif
|
||||
let broadcaster = document.getElementById("devtoolsMenuBroadcaster_Scratchpad");
|
||||
broadcaster.removeAttribute("disabled");
|
||||
broadcaster.removeAttribute("hidden");
|
||||
}
|
||||
|
||||
// Enable Style Editor?
|
||||
let styleEditorEnabled = gPrefService.getBoolPref(StyleEditor.prefEnabledName);
|
||||
if (styleEditorEnabled) {
|
||||
document.getElementById("menu_styleeditor").hidden = false;
|
||||
document.getElementById("Tools:StyleEditor").removeAttribute("disabled");
|
||||
#ifdef MENUBAR_CAN_AUTOHIDE
|
||||
document.getElementById("appmenu_styleeditor").hidden = false;
|
||||
#endif
|
||||
// We don't show the Style Editor button in the developer toolbar for now.
|
||||
// See bug 771203
|
||||
// document.getElementById("developer-toolbar-styleeditor").hidden = false;
|
||||
let broadcaster = document.getElementById("devtoolsMenuBroadcaster_StyleEditor");
|
||||
broadcaster.removeAttribute("disabled");
|
||||
broadcaster.removeAttribute("hidden");
|
||||
}
|
||||
|
||||
#ifdef MENUBAR_CAN_AUTOHIDE
|
||||
@ -1505,11 +1484,9 @@ var gBrowserInit = {
|
||||
// Enable Responsive UI?
|
||||
let responsiveUIEnabled = gPrefService.getBoolPref("devtools.responsiveUI.enabled");
|
||||
if (responsiveUIEnabled) {
|
||||
document.getElementById("menu_responsiveUI").hidden = false;
|
||||
document.getElementById("Tools:ResponsiveUI").removeAttribute("disabled");
|
||||
#ifdef MENUBAR_CAN_AUTOHIDE
|
||||
document.getElementById("appmenu_responsiveUI").hidden = false;
|
||||
#endif
|
||||
let broadcaster = document.getElementById("devtoolsMenuBroadcaster_ResponsiveUI");
|
||||
broadcaster.removeAttribute("disabled");
|
||||
broadcaster.removeAttribute("hidden");
|
||||
}
|
||||
|
||||
let appMenuButton = document.getElementById("appmenu-button");
|
||||
@ -4885,10 +4862,17 @@ function toggleSidebar(commandID, forceOpen) {
|
||||
|
||||
if (sidebarBroadcaster.getAttribute("checked") == "true") {
|
||||
if (!forceOpen) {
|
||||
// Replace the document currently displayed in the sidebar with about:blank
|
||||
// so that we can free memory by unloading the page. We need to explicitly
|
||||
// create a new content viewer because the old one doesn't get destroyed
|
||||
// until about:blank has loaded (which does not happen as long as the
|
||||
// element is hidden).
|
||||
sidebar.setAttribute("src", "about:blank");
|
||||
sidebar.docShell.createAboutBlankContentViewer(null);
|
||||
|
||||
sidebarBroadcaster.removeAttribute("checked");
|
||||
sidebarBox.setAttribute("sidebarcommand", "");
|
||||
sidebarTitle.value = "";
|
||||
sidebar.setAttribute("src", "about:blank");
|
||||
sidebarBox.hidden = true;
|
||||
sidebarSplitter.hidden = true;
|
||||
content.focus();
|
||||
|
@ -1155,24 +1155,35 @@
|
||||
<textbox class="gclitoolbar-input-node" rows="1"/>
|
||||
</stack>
|
||||
<toolbarbutton id="developer-toolbar-webconsole"
|
||||
label="&webConsoleButton.label;"
|
||||
class="developer-toolbar-button"
|
||||
command="Tools:WebConsole"/>
|
||||
observes="devtoolsMenuBroadcaster_WebConsole"/>
|
||||
<toolbarbutton id="developer-toolbar-inspector"
|
||||
label="&inspectorButton.label;"
|
||||
class="developer-toolbar-button"
|
||||
hidden="true"
|
||||
command="Tools:Inspect"/>
|
||||
observes="devtoolsMenuBroadcaster_Inspect"/>
|
||||
<toolbarbutton id="developer-toolbar-styleeditor"
|
||||
label="&styleeditor.label;"
|
||||
class="developer-toolbar-button"
|
||||
hidden="true"
|
||||
command="Tools:StyleEditor"/>
|
||||
observes="devtoolsMenuBroadcaster_StyleEditor"/>
|
||||
<toolbarbutton id="developer-toolbar-debugger"
|
||||
label="&debuggerMenu.label2;"
|
||||
class="developer-toolbar-button"
|
||||
hidden="true"
|
||||
command="Tools:Debugger"/>
|
||||
observes="devtoolsMenuBroadcaster_Debugger"/>
|
||||
<toolbarbutton id="developer-toolbar-other-tools"
|
||||
type="menu"
|
||||
class="developer-toolbar-button"
|
||||
label="&devToolbarOtherToolsButton.label;">
|
||||
<menupopup position="before_end">
|
||||
<menuitem observes="devtoolsMenuBroadcaster_DevToolbar"/>
|
||||
<menuitem observes="devtoolsMenuBroadcaster_ResponsiveUI"/>
|
||||
<menuitem observes="devtoolsMenuBroadcaster_RemoteDebugger"/>
|
||||
<menuitem observes="devtoolsMenuBroadcaster_ChromeDebugger"/>
|
||||
<menuitem observes="devtoolsMenuBroadcaster_Scratchpad"/>
|
||||
<menuitem observes="devtoolsMenuBroadcaster_StyleEditor"/>
|
||||
<menuitem observes="devtoolsMenuBroadcaster_PageSource"/>
|
||||
<menuitem observes="devtoolsMenuBroadcaster_ErrorConsole"/>
|
||||
<menuseparator/>
|
||||
<menuitem observes="devtoolsMenuBroadcaster_GetMoreTools"/>
|
||||
</menupopup>
|
||||
</toolbarbutton>
|
||||
|
||||
#ifndef XP_MACOSX
|
||||
<toolbarbutton id="developer-toolbar-closebutton"
|
||||
class="devtools-closebutton"
|
||||
|
@ -164,7 +164,7 @@ function getStorage()
|
||||
let aboutHomeURI = Services.io.newURI("moz-safe-about:home", null, null);
|
||||
let principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"].
|
||||
getService(Components.interfaces.nsIScriptSecurityManager).
|
||||
getCodebasePrincipal(Services.io.newURI("about:home", null, null));
|
||||
getNoAppCodebasePrincipal(Services.io.newURI("about:home", null, null));
|
||||
let dsm = Components.classes["@mozilla.org/dom/storagemanager;1"].
|
||||
getService(Components.interfaces.nsIDOMStorageManager);
|
||||
return dsm.getLocalStorageForPrincipal(principal, "");
|
||||
|
@ -1,7 +1,7 @@
|
||||
function test() {
|
||||
var exampleUri = makeURI("http://example.com/");
|
||||
var secman = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
|
||||
var principal = secman.getCodebasePrincipal(exampleUri);
|
||||
var principal = secman.getSimpleCodebasePrincipal(exampleUri);
|
||||
|
||||
function testIsFeed(aTitle, aHref, aType, aKnown) {
|
||||
var link = { title: aTitle, href: aHref, type: aType };
|
||||
|
@ -1,5 +1,6 @@
|
||||
var rootDir = getRootDirectory(gTestPath);
|
||||
const gTestRoot = rootDir;
|
||||
const gHttpTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
|
||||
|
||||
var gTestBrowser = null;
|
||||
var gNextTest = null;
|
||||
@ -356,7 +357,7 @@ function test11d() {
|
||||
"There should be a PluginClickToPlay event for each plugin that was " +
|
||||
"blocked due to the plugins.click_to_play pref");
|
||||
|
||||
prepareTest(test12a, gTestRoot + "plugin_clickToPlayAllow.html");
|
||||
prepareTest(test12a, gHttpTestRoot + "plugin_clickToPlayAllow.html");
|
||||
}
|
||||
|
||||
// Tests that the "Allow Always" permission works for click-to-play plugins (part 1/3)
|
||||
@ -381,7 +382,7 @@ function test12b() {
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(objLoadingContent.activated, "Test 12b, Plugin should be activated");
|
||||
|
||||
prepareTest(test12c, gTestRoot + "plugin_clickToPlayAllow.html");
|
||||
prepareTest(test12c, gHttpTestRoot + "plugin_clickToPlayAllow.html");
|
||||
}
|
||||
|
||||
// Tests that the "Always" permission works for click-to-play plugins (part 3/3)
|
||||
|
@ -446,7 +446,7 @@ var gAllTests = [
|
||||
|
||||
var sm = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
var principal = sm.getCodebasePrincipal(URI);
|
||||
var principal = sm.getNoAppCodebasePrincipal(URI);
|
||||
|
||||
// Give www.example.com privileges to store offline data
|
||||
var pm = Cc["@mozilla.org/permissionmanager;1"]
|
||||
|
@ -14,7 +14,7 @@ Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
let {NewTabUtils, Sanitizer} = tmp;
|
||||
|
||||
let uri = Services.io.newURI("about:newtab", null, null);
|
||||
let principal = Services.scriptSecurityManager.getCodebasePrincipal(uri);
|
||||
let principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
|
||||
|
||||
let sm = Services.domStorageManager;
|
||||
let storage = sm.getLocalStorageForPrincipal(principal, "");
|
||||
|
@ -1119,7 +1119,7 @@ FeedWriter.prototype = {
|
||||
|
||||
var secman = Cc["@mozilla.org/scriptsecuritymanager;1"].
|
||||
getService(Ci.nsIScriptSecurityManager);
|
||||
this._feedPrincipal = secman.getCodebasePrincipal(this._feedURI);
|
||||
this._feedPrincipal = secman.getSimpleCodebasePrincipal(this._feedURI);
|
||||
|
||||
LOG("Subscribe Preview: feed uri = " + this._window.location.href);
|
||||
|
||||
|
@ -841,7 +841,7 @@ let AboutHomeUtils = {
|
||||
let aboutHomeURI = Services.io.newURI("moz-safe-about:home", null, null);
|
||||
let principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"].
|
||||
getService(Components.interfaces.nsIScriptSecurityManager).
|
||||
getCodebasePrincipal(aboutHomeURI);
|
||||
getNoAppCodebasePrincipal(aboutHomeURI);
|
||||
let dsm = Components.classes["@mozilla.org/dom/storagemanager;1"].
|
||||
getService(Components.interfaces.nsIDOMStorageManager);
|
||||
return dsm.getLocalStorageForPrincipal(principal, "");
|
||||
|
@ -543,7 +543,7 @@ function test_storage_cleared()
|
||||
{
|
||||
let principal = Cc["@mozilla.org/scriptsecuritymanager;1"].
|
||||
getService(Ci.nsIScriptSecurityManager).
|
||||
getCodebasePrincipal(aURI);
|
||||
getNoAppCodebasePrincipal(aURI);
|
||||
let dsm = Cc["@mozilla.org/dom/storagemanager;1"].
|
||||
getService(Ci.nsIDOMStorageManager);
|
||||
return dsm.getLocalStorageForPrincipal(principal, "");
|
||||
|
@ -52,20 +52,20 @@ let DomStorage = {
|
||||
let shistory = aDocShell.sessionHistory;
|
||||
|
||||
for (let i = 0; i < shistory.count; i++) {
|
||||
let uri = History.getUriForEntry(shistory, i);
|
||||
let principal = History.getPrincipalForEntry(shistory, i, aDocShell);
|
||||
if (!principal)
|
||||
continue;
|
||||
|
||||
if (uri) {
|
||||
// Check if we're allowed to store sessionStorage data.
|
||||
let isHTTPS = uri.schemeIs("https");
|
||||
if (aFullData || SessionStore.checkPrivacyLevel(isHTTPS, isPinned)) {
|
||||
let host = History.getHostForURI(uri);
|
||||
// Check if we're allowed to store sessionStorage data.
|
||||
let isHTTPS = principal.URI && principal.URI.schemeIs("https");
|
||||
if (aFullData || SessionStore.checkPrivacyLevel(isHTTPS, isPinned)) {
|
||||
let origin = principal.extendedOrigin;
|
||||
|
||||
// Don't read a host twice.
|
||||
if (!(host in data)) {
|
||||
let hostData = this._readEntry(uri, aDocShell);
|
||||
if (Object.keys(hostData).length) {
|
||||
data[host] = hostData;
|
||||
}
|
||||
// Don't read a host twice.
|
||||
if (!(origin in data)) {
|
||||
let originData = this._readEntry(principal, aDocShell);
|
||||
if (Object.keys(originData).length) {
|
||||
data[origin] = originData;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -84,7 +84,8 @@ let DomStorage = {
|
||||
write: function DomStorage_write(aDocShell, aStorageData) {
|
||||
for (let [host, data] in Iterator(aStorageData)) {
|
||||
let uri = Services.io.newURI(host, null, null);
|
||||
let storage = aDocShell.getSessionStorageForURI(uri, "");
|
||||
let principal = Services.scriptSecurityManager.getDocShellCodebasePrincipal(uri, aDocShell);
|
||||
let storage = aDocShell.getSessionStorageForPrincipal(principal, "", true);
|
||||
|
||||
for (let [key, value] in Iterator(data)) {
|
||||
try {
|
||||
@ -104,19 +105,17 @@ let DomStorage = {
|
||||
* @param aDocShell
|
||||
* A tab's docshell (containing the sessionStorage)
|
||||
*/
|
||||
_readEntry: function DomStorage_readEntry(aURI, aDocShell) {
|
||||
_readEntry: function DomStorage_readEntry(aPrincipal, aDocShell) {
|
||||
let hostData = {};
|
||||
let storage;
|
||||
|
||||
try {
|
||||
let principal = Services.scriptSecurityManager.getCodebasePrincipal(aURI);
|
||||
|
||||
// Using getSessionStorageForPrincipal instead of
|
||||
// getSessionStorageForURI just to be able to pass aCreate = false,
|
||||
// that avoids creation of the sessionStorage object for the page
|
||||
// earlier than the page really requires it. It was causing problems
|
||||
// while accessing a storage when a page later changed its domain.
|
||||
storage = aDocShell.getSessionStorageForPrincipal(principal, "", false);
|
||||
storage = aDocShell.getSessionStorageForPrincipal(aPrincipal, "", false);
|
||||
} catch (e) {
|
||||
// sessionStorage might throw if it's turned off, see bug 458954
|
||||
}
|
||||
@ -143,30 +142,17 @@ let History = {
|
||||
* That tab's session history
|
||||
* @param aIndex
|
||||
* The history entry's index
|
||||
* @param aDocShell
|
||||
* That tab's docshell
|
||||
*/
|
||||
getUriForEntry: function History_getUriForEntry(aHistory, aIndex) {
|
||||
getPrincipalForEntry: function History_getPrincipalForEntry(aHistory,
|
||||
aIndex,
|
||||
aDocShell) {
|
||||
try {
|
||||
return aHistory.getEntryAtIndex(aIndex, false).URI;
|
||||
return Services.scriptSecurityManager.getDocShellCodebasePrincipal(
|
||||
aHistory.getEntryAtIndex(aIndex, false).URI, aDocShell);
|
||||
} catch (e) {
|
||||
// This might throw for some reason.
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the host of a given URI.
|
||||
* @param aURI
|
||||
* The URI for which to return the host
|
||||
*/
|
||||
getHostForURI: function History_getHostForURI(aURI) {
|
||||
let host = aURI.spec;
|
||||
|
||||
try {
|
||||
if (aURI.host)
|
||||
host = aURI.prePath;
|
||||
} catch (e) {
|
||||
// This throws for host-less URIs (such as about: or jar:).
|
||||
}
|
||||
|
||||
return host;
|
||||
}
|
||||
};
|
||||
|
@ -388,7 +388,7 @@ Rule.prototype = {
|
||||
eltText += "#" + this.inherited.id;
|
||||
}
|
||||
this._inheritedSource =
|
||||
CssLogic._strings.formatStringFromName("rule.inheritedSource", [eltText], 1);
|
||||
CssLogic._strings.formatStringFromName("rule.inheritedFrom", [eltText], 1);
|
||||
}
|
||||
return this._inheritedSource;
|
||||
},
|
||||
|
@ -57,15 +57,15 @@ let inputValues = [
|
||||
[false, "true", "true"],
|
||||
|
||||
// 11
|
||||
[false, "document.getElementById", "function getElementById() {[native code]}",
|
||||
[false, "document.getElementById", "function getElementById() {\n [native code]\n}",
|
||||
"function getElementById() {\n [native code]\n}",
|
||||
"function getElementById() {\n [native code]\n}",
|
||||
"function getElementById() {[native code]}",
|
||||
"document.wrappedJSObject.getElementById"],
|
||||
|
||||
// 12
|
||||
[false, "(function() { return 42; })", "function () {return 42;}",
|
||||
"function () {\n return 42;\n}",
|
||||
"(function () {return 42;})"],
|
||||
[false, "(function() { return 42; })", "function () { return 42; }",
|
||||
"function () { return 42; }",
|
||||
"(function () { return 42; })"],
|
||||
|
||||
// 13
|
||||
[false, "new Date(" + dateNow + ")", (new Date(dateNow)).toString()],
|
||||
|
@ -241,6 +241,7 @@ These should match what Safari and other Apple applications use on OS X Lion. --
|
||||
<!ENTITY devToolbarMenu.accesskey "v">
|
||||
<!ENTITY devToolbar.keycode "VK_F2">
|
||||
<!ENTITY devToolbar.keytext "F2">
|
||||
<!ENTITY devToolbarOtherToolsButton.label "More Tools">
|
||||
|
||||
<!ENTITY webConsoleButton.label "Web Console">
|
||||
<!ENTITY inspectorButton.label "Inspector">
|
||||
|
@ -30,11 +30,11 @@ rule.status.UNMATCHED=Unmatched
|
||||
rule.sourceInline=inline
|
||||
rule.sourceElement=element
|
||||
|
||||
# LOCALIZATION NOTE (rule.inheritedSource): Shown for CSS rules
|
||||
# that were inherited from a parent node. Will be passed a node
|
||||
# identifier and a source location.
|
||||
# LOCALIZATION NOTE (rule.inheritedFrom): Shown for CSS rules
|
||||
# that were inherited from a parent node. Will be passed a node
|
||||
# identifier of the parent node.
|
||||
# e.g "Inherited from body#bodyID"
|
||||
rule.inheritedSource=Inherited from %S
|
||||
rule.inheritedFrom=Inherited from %S
|
||||
|
||||
# LOCALIZATION NOTE (style.highlighter.button): These strings are used inside
|
||||
# sidebar of the Highlighter for the style inspector button.
|
||||
|
@ -18,7 +18,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gPrincipal", function () {
|
||||
let uri = Services.io.newURI("about:newtab", null, null);
|
||||
return Services.scriptSecurityManager.getCodebasePrincipal(uri);
|
||||
return Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
|
||||
});
|
||||
|
||||
// The preference that tells whether this feature is enabled.
|
||||
|
@ -2565,6 +2565,7 @@ stack[anonid=browserStack][responsivemode] {
|
||||
list-style-image: url("chrome://browser/skin/devtools/tools-icons-small.png");
|
||||
}
|
||||
|
||||
.developer-toolbar-button[open=true],
|
||||
.developer-toolbar-button:active:hover,
|
||||
.developer-toolbar-button[checked=true] {
|
||||
border-color: hsla(210,8%,5%,.6);
|
||||
@ -2594,6 +2595,14 @@ stack[anonid=browserStack][responsivemode] {
|
||||
-moz-image-region: rect(48px, 16px, 64px, 0);
|
||||
}
|
||||
|
||||
#developer-toolbar-other-tools {
|
||||
-moz-image-region: rect(64px, 16px, 80px, 0);
|
||||
}
|
||||
|
||||
#developer-toolbar-other-tools > .toolbarbutton-menu-dropmarker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Error counter */
|
||||
|
||||
#developer-toolbar-webconsole[error-count]:before {
|
||||
|
@ -3319,6 +3319,7 @@ stack[anonid=browserStack][responsivemode] {
|
||||
list-style-image: url("chrome://browser/skin/devtools/tools-icons-small.png");
|
||||
}
|
||||
|
||||
.developer-toolbar-button[open=true],
|
||||
.developer-toolbar-button:active:hover,
|
||||
.developer-toolbar-button[checked=true] {
|
||||
border-color: hsla(210,8%,5%,.6);
|
||||
@ -3348,6 +3349,14 @@ stack[anonid=browserStack][responsivemode] {
|
||||
-moz-image-region: rect(48px, 16px, 64px, 0);
|
||||
}
|
||||
|
||||
#developer-toolbar-other-tools {
|
||||
-moz-image-region: rect(64px, 16px, 80px, 0);
|
||||
}
|
||||
|
||||
#developer-toolbar-other-tools > .toolbarbutton-menu-dropmarker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Error counter */
|
||||
|
||||
#developer-toolbar-webconsole[error-count]:before {
|
||||
|
@ -3246,6 +3246,7 @@ stack[anonid=browserStack][responsivemode] {
|
||||
list-style-image: url("chrome://browser/skin/devtools/tools-icons-small.png");
|
||||
}
|
||||
|
||||
.developer-toolbar-button[open=true],
|
||||
.developer-toolbar-button:active:hover,
|
||||
.developer-toolbar-button[checked=true] {
|
||||
border-color: hsla(210,8%,5%,.6);
|
||||
@ -3275,6 +3276,14 @@ stack[anonid=browserStack][responsivemode] {
|
||||
-moz-image-region: rect(48px, 16px, 64px, 0);
|
||||
}
|
||||
|
||||
#developer-toolbar-other-tools {
|
||||
-moz-image-region: rect(64px, 16px, 80px, 0);
|
||||
}
|
||||
|
||||
#developer-toolbar-other-tools > .toolbarbutton-menu-dropmarker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Error counter */
|
||||
|
||||
#developer-toolbar-webconsole[error-count]:before {
|
||||
|
@ -426,7 +426,7 @@ class ShutdownLeakLogger(object):
|
||||
DOM windows (that are still around after test suite shutdown, despite running
|
||||
the GC) to the tests that created them and prints leak statistics.
|
||||
"""
|
||||
MAX_LEAK_COUNT = 5
|
||||
MAX_LEAK_COUNT = 3
|
||||
|
||||
def __init__(self, logger):
|
||||
self.logger = logger
|
||||
|
@ -9,3 +9,4 @@ elif [ -d "$topsrcdir/../clang" ]; then
|
||||
fi
|
||||
|
||||
ac_add_options --enable-stdcxx-compat
|
||||
ac_add_options --with-ccache
|
||||
|
@ -786,9 +786,12 @@ class DeviceManagerADB(DeviceManager):
|
||||
|
||||
def verifyRoot(self):
|
||||
# a test to see if we have root privs
|
||||
files = self.listFiles("/data/data")
|
||||
if (len(files) == 0):
|
||||
print "NOT running as root"
|
||||
p = self.runCmd(["shell", "id"])
|
||||
response = p.stdout.readline()
|
||||
response = response.rstrip()
|
||||
response = response.split(' ')
|
||||
if (response[0].find('uid=0') < 0 or response[1].find('gid=0') < 0):
|
||||
print "NOT running as root ", response[0].find('uid=0')
|
||||
raise DMError("not running as root")
|
||||
|
||||
self.haveRoot = True
|
||||
|
@ -116,7 +116,7 @@ class SubstitutionRef(Function):
|
||||
|
||||
def __repr__(self):
|
||||
return "SubstitutionRef<%s>(%r:%r=%r)" % (
|
||||
self.loc, self.vname, self.substfrom, selfsubstto,)
|
||||
self.loc, self.vname, self.substfrom, self.substto,)
|
||||
|
||||
class SubstFunction(Function):
|
||||
name = 'subst'
|
||||
|
@ -151,7 +151,7 @@ interface nsIScriptSecurityManager : nsIXPCSecurityManager
|
||||
* This principals should not be used for any data/permission check, it will
|
||||
* have appId = UNKNOWN_APP_ID.
|
||||
*/
|
||||
nsIPrincipal getCodebasePrincipal(in nsIURI aURI);
|
||||
nsIPrincipal getSimpleCodebasePrincipal(in nsIURI aURI);
|
||||
|
||||
/**
|
||||
* Returns a principal that has the given information.
|
||||
|
@ -436,8 +436,9 @@ private:
|
||||
SecurityLevel* result);
|
||||
|
||||
nsresult
|
||||
GetCodebasePrincipalInternal(nsIURI* aURI, PRUint32 aAppId, bool aInMozBrowser,
|
||||
nsIPrincipal** result);
|
||||
GetCodebasePrincipalInternal(nsIURI* aURI, PRUint32 aAppId,
|
||||
bool aInMozBrowser,
|
||||
nsIPrincipal** result);
|
||||
|
||||
nsresult
|
||||
CreateCodebasePrincipal(nsIURI* aURI, PRUint32 aAppId, bool aInMozBrowser,
|
||||
|
@ -1990,11 +1990,12 @@ nsScriptSecurityManager::CreateCodebasePrincipal(nsIURI* aURI, PRUint32 aAppId,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptSecurityManager::GetCodebasePrincipal(nsIURI* aURI,
|
||||
nsScriptSecurityManager::GetSimpleCodebasePrincipal(nsIURI* aURI,
|
||||
nsIPrincipal** aPrincipal)
|
||||
{
|
||||
return GetCodebasePrincipalInternal(aURI, nsIScriptSecurityManager::UNKNOWN_APP_ID,
|
||||
false, aPrincipal);
|
||||
return GetCodebasePrincipalInternal(aURI,
|
||||
nsIScriptSecurityManager::UNKNOWN_APP_ID,
|
||||
false, aPrincipal);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -2002,7 +2003,7 @@ nsScriptSecurityManager::GetNoAppCodebasePrincipal(nsIURI* aURI,
|
||||
nsIPrincipal** aPrincipal)
|
||||
{
|
||||
return GetCodebasePrincipalInternal(aURI, nsIScriptSecurityManager::NO_APP_ID,
|
||||
false, aPrincipal);
|
||||
false, aPrincipal);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -2035,9 +2036,9 @@ nsScriptSecurityManager::GetDocShellCodebasePrincipal(nsIURI* aURI,
|
||||
|
||||
nsresult
|
||||
nsScriptSecurityManager::GetCodebasePrincipalInternal(nsIURI *aURI,
|
||||
PRUint32 aAppId,
|
||||
bool aInMozBrowser,
|
||||
nsIPrincipal **result)
|
||||
PRUint32 aAppId,
|
||||
bool aInMozBrowser,
|
||||
nsIPrincipal **result)
|
||||
{
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
@ -3639,11 +3640,11 @@ GetExtendedOrigin(nsIURI* aURI, PRUint32 aAppId, bool aInMozBrowser,
|
||||
return;
|
||||
}
|
||||
|
||||
// aExtendedOrigin = origin + "@" + aAppId + { 't', 'f' }
|
||||
aExtendedOrigin.Assign(origin + NS_LITERAL_CSTRING("@"));
|
||||
// aExtendedOrigin = appId + "+" + origin + "+" + { 't', 'f' }
|
||||
aExtendedOrigin.Truncate();
|
||||
aExtendedOrigin.AppendInt(aAppId);
|
||||
aExtendedOrigin.Append(aInMozBrowser ? NS_LITERAL_CSTRING("t")
|
||||
: NS_LITERAL_CSTRING("f"));
|
||||
aExtendedOrigin.Append(NS_LITERAL_CSTRING("+") + origin + NS_LITERAL_CSTRING("+"));
|
||||
aExtendedOrigin.Append(aInMozBrowser ? 't' : 'f');
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -18,9 +18,11 @@ MOCHITEST_FILES = test_bug423375.html \
|
||||
test_disallowInheritPrincipal.html \
|
||||
$(NULL)
|
||||
|
||||
# Temporarily disabled for orange
|
||||
# MOCHITEST_CHROME_FILES = test_principal_extendedorigin_appid_appstatus.html \
|
||||
# $(NULL)
|
||||
# extendedOrigin test doesn't work on Windows, see bug 776296.
|
||||
ifneq ($(OS_ARCH),WINNT)
|
||||
MOCHITEST_CHROME_FILES = test_principal_extendedorigin_appid_appstatus.html \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
test_bug292789.html : % : %.in
|
||||
$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
|
||||
|
@ -16,7 +16,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=758258
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
<script type="application/javascript;version=1.7">
|
||||
|
||||
/** Test for Bug 758258 **/
|
||||
|
||||
@ -105,7 +105,6 @@ var gData = [
|
||||
browser: true,
|
||||
test: [ "eo-as-last" ],
|
||||
},
|
||||
/*
|
||||
// {
|
||||
// app: "http://example.org/manifest.webapp",
|
||||
// src: "data:text/html,foobar",
|
||||
@ -116,14 +115,13 @@ var gData = [
|
||||
// src: "data:text/html,foobar2",
|
||||
// test: [ "todo-src" ],
|
||||
// },
|
||||
*/
|
||||
{
|
||||
src: "file:///",
|
||||
isapp: false,
|
||||
test: [ "eo-unique" ],
|
||||
},
|
||||
{
|
||||
src: "file:///tmp",
|
||||
src: "file:///tmp/",
|
||||
isapp: false,
|
||||
test: [ "eo-unique" ],
|
||||
},
|
||||
@ -135,10 +133,127 @@ var gData = [
|
||||
},
|
||||
{
|
||||
app: "http://example.org/manifest.webapp",
|
||||
src: "file:///tmp",
|
||||
src: "file:///tmp/",
|
||||
isapp: true,
|
||||
test: [ "eo-unique" ],
|
||||
},
|
||||
// iframe inside an app is part of the app.
|
||||
{
|
||||
app: "http://example.org/manifest.webapp",
|
||||
src: "http://example.org/",
|
||||
isapp: true,
|
||||
child: {
|
||||
src: "http://example.org/chrome/",
|
||||
isapp: true
|
||||
},
|
||||
test: [ "child-has-same-eo" ],
|
||||
},
|
||||
// app A inside app B aren't the same app.
|
||||
{
|
||||
app: "http://example.org/manifest.webapp",
|
||||
src: "http://example.org/",
|
||||
isapp: true,
|
||||
child: {
|
||||
app: "https://example.com/manifest.webapp",
|
||||
src: "https://example.com/chrome/",
|
||||
isapp: true
|
||||
},
|
||||
test: [ "child-has-different-eo", "child-has-same-appstatus", "child-has-different-appid" ],
|
||||
},
|
||||
// app A inside app A are the same app.
|
||||
{
|
||||
app: "http://example.org/manifest.webapp",
|
||||
src: "http://example.org/",
|
||||
isapp: true,
|
||||
child: {
|
||||
app: "http://example.org/manifest.webapp",
|
||||
src: "http://example.org/chrome/",
|
||||
isapp: true
|
||||
},
|
||||
test: [ "child-has-same-eo" ],
|
||||
},
|
||||
// app inside a regular iframe is an app.
|
||||
{
|
||||
src: "http://example.org/",
|
||||
isapp: false,
|
||||
child: {
|
||||
app: "http://example.org/manifest.webapp",
|
||||
src: "http://example.org/chrome/",
|
||||
isapp: true
|
||||
},
|
||||
test: [ "child-has-different-eo", "child-has-different-appstatus", "child-has-different-appid" ],
|
||||
},
|
||||
// browser inside app is a browser, has appid but isn't installed.
|
||||
{
|
||||
src: "http://example.org/",
|
||||
app: "http://example.org/manifest.webapp",
|
||||
isapp: true,
|
||||
child: {
|
||||
src: "http://example.org/chrome/",
|
||||
isapp: false,
|
||||
browser: true,
|
||||
},
|
||||
test: [ "child-has-different-eo", "child-has-different-appstatus", "child-has-same-appid" ],
|
||||
},
|
||||
// app inside a browser is an app.
|
||||
{
|
||||
src: "http://example.org/",
|
||||
isapp: false,
|
||||
browser: true,
|
||||
child: {
|
||||
app: "http://example.org/manifest.webapp",
|
||||
src: "http://example.org/chrome/",
|
||||
isapp: true,
|
||||
},
|
||||
test: [ "child-has-different-eo", "child-has-different-appstatus", "child-has-different-appid" ],
|
||||
},
|
||||
// browser inside a browser are two browsers
|
||||
{
|
||||
src: "http://example.org/",
|
||||
isapp: false,
|
||||
browser: true,
|
||||
child: {
|
||||
src: "http://example.org/chrome/",
|
||||
isapp: false,
|
||||
browser: true,
|
||||
},
|
||||
test: [ "child-has-same-eo" ],
|
||||
},
|
||||
// browser inside a browser are two browsers
|
||||
{
|
||||
src: "http://example.org/",
|
||||
isapp: false,
|
||||
browser: true,
|
||||
child: {
|
||||
src: "https://example.com/chrome/",
|
||||
isapp: false,
|
||||
browser: true,
|
||||
},
|
||||
test: [ "child-has-different-eo", "child-has-same-appstatus", "child-has-same-appid" ],
|
||||
},
|
||||
// iframe containing a browser
|
||||
{
|
||||
src: "http://example.org/",
|
||||
isapp: false,
|
||||
browser: false,
|
||||
child: {
|
||||
src: "http://example.org/chrome/",
|
||||
isapp: false,
|
||||
browser: true,
|
||||
},
|
||||
test: [ "child-has-different-eo", "child-has-same-appstatus", "child-has-same-appid" ],
|
||||
},
|
||||
// browser containing an iframe is part of the browser
|
||||
{
|
||||
src: "http://example.org/",
|
||||
isapp: false,
|
||||
browser: true,
|
||||
child: {
|
||||
src: "http://example.org/chrome/",
|
||||
isapp: false,
|
||||
},
|
||||
test: [ "child-has-same-eo" ],
|
||||
},
|
||||
];
|
||||
|
||||
// The list of all data ids generated by this test.
|
||||
@ -148,16 +263,21 @@ var content = document.getElementById('content');
|
||||
var checkedCount = 0;
|
||||
var checksTodo = gData.length;
|
||||
|
||||
function checkPrincipalForIFrame(aFrame, data) {
|
||||
function checkIFrame(aFrame, data) {
|
||||
var principal = aFrame.contentDocument.nodePrincipal;
|
||||
|
||||
if (!data.test) {
|
||||
data.test = [];
|
||||
}
|
||||
|
||||
// Temporarily disable that check.
|
||||
// is(principal.URI.spec, data.src,
|
||||
// 'the correct URL should have been loaded');
|
||||
if (navigator.platform.indexOf("Mac") != -1) {
|
||||
is(principal.URI.spec,
|
||||
data.src.replace('file:///tmp/', 'file:///private/tmp/'),
|
||||
'the correct URL should have been loaded');
|
||||
} else {
|
||||
is(principal.URI.spec, data.src,
|
||||
'the correct URL should have been loaded');
|
||||
}
|
||||
|
||||
if (data.isapp) {
|
||||
is(principal.appStatus, Ci.nsIPrincipal.APP_STATUS_INSTALLED,
|
||||
@ -190,11 +310,56 @@ function checkPrincipalForIFrame(aFrame, data) {
|
||||
"extendedOrigin should be the same as the last inserted one");
|
||||
}
|
||||
|
||||
if (data.child) {
|
||||
let childPrincipal = aFrame.contentWindow.frames[0].document.nodePrincipal;
|
||||
|
||||
if (data.child.isapp) {
|
||||
is(childPrincipal.appStatus, Ci.nsIPrincipal.APP_STATUS_INSTALLED,
|
||||
"child should be an installed app");
|
||||
}
|
||||
|
||||
if (data.test.indexOf("child-has-same-eo") != -1) {
|
||||
is(childPrincipal.extendedOrigin, principal.extendedOrigin,
|
||||
"child should have the same extendedOrigin as parent");
|
||||
is(childPrincipal.appStatus, principal.appStatus,
|
||||
"child should have the same appStatus if it has the same extendedOrigin");
|
||||
is(childPrincipal.appId, principal.appId,
|
||||
"child should have the same appId if it has the same extendedOrigin");
|
||||
}
|
||||
|
||||
if (data.test.indexOf("child-has-different-eo") != -1) {
|
||||
isnot(childPrincipal.extendedOrigin, principal.extendedOrigin,
|
||||
"child should not have the same extendedOrigin as parent");
|
||||
}
|
||||
|
||||
if (data.test.indexOf("child-has-same-appstatus") != -1) {
|
||||
is(childPrincipal.appStatus, principal.appStatus,
|
||||
"childPrincipal and parent principal should have the same appStatus");
|
||||
}
|
||||
|
||||
if (data.test.indexOf("child-has-different-appstatus") != -1) {
|
||||
isnot(childPrincipal.appStatus, principal.appStatus,
|
||||
"childPrincipal and parent principal should not have the same appStatus");
|
||||
}
|
||||
|
||||
if (data.test.indexOf("child-has-same-appid") != -1) {
|
||||
is(childPrincipal.appId, principal.appId,
|
||||
"childPrincipal and parent principal should have the same appId");
|
||||
}
|
||||
|
||||
if (data.test.indexOf("child-has-different-appid") != -1) {
|
||||
isnot(childPrincipal.appId, principal.appId,
|
||||
"childPrincipal and parent principal should have different appId");
|
||||
}
|
||||
}
|
||||
|
||||
eoList.push(principal.extendedOrigin);
|
||||
|
||||
checkedCount++;
|
||||
if (checkedCount == checksTodo) {
|
||||
SimpleTest.finish();
|
||||
} else {
|
||||
gTestRunner.next();
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,35 +370,60 @@ is('extendedOrigin' in document.nodePrincipal, true,
|
||||
is('appId' in document.nodePrincipal, true,
|
||||
'appId should be present in nsIPrincipal');
|
||||
|
||||
SpecialPowers.pushPrefEnv({'set': [["dom.mozBrowserFramesEnabled", true]]}, function() {
|
||||
function runTest() {
|
||||
// We want to use a generator. Those only work in a one level stack so we
|
||||
// can't use .forEach() here.
|
||||
for (var i=0; i<gData.length; ++i) {
|
||||
let data = gData[i];
|
||||
|
||||
// For some unknown reasons, this test this to always timeout on Windows.
|
||||
if (navigator.platform.indexOf("Win") != -1) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.check = function() {
|
||||
checkIFrame(this, data);
|
||||
};
|
||||
iframe.addChild = function() {
|
||||
var childFrame = document.createElement('iframe');
|
||||
|
||||
if (data.child.app) {
|
||||
childFrame.setAttribute('mozapp', data.child.app)
|
||||
childFrame.setAttribute('mozbrowser', '');
|
||||
} else if (data.child.browser) {
|
||||
childFrame.setAttribute('mozbrowser', '');
|
||||
}
|
||||
|
||||
childFrame.src = data.child.src;
|
||||
|
||||
this.removeEventListener('load', this.addChild.bind(this));
|
||||
childFrame.addEventListener('load', this.check.bind(this));
|
||||
|
||||
this.contentDocument.body.appendChild(childFrame);
|
||||
};
|
||||
|
||||
if (data.app) {
|
||||
iframe.setAttribute('mozapp', data.app);
|
||||
iframe.setAttribute('mozbrowser', '');
|
||||
} else if (data.browser) {
|
||||
iframe.setAttribute('mozbrowser', '');
|
||||
}
|
||||
|
||||
iframe.src = data.src;
|
||||
|
||||
if (data.child) {
|
||||
iframe.addEventListener('load', iframe.addChild.bind(iframe));
|
||||
} else {
|
||||
iframe.addEventListener('load', iframe.check.bind(iframe));
|
||||
}
|
||||
|
||||
content.appendChild(iframe);
|
||||
|
||||
yield;
|
||||
}
|
||||
}
|
||||
|
||||
gData.forEach(function(data) {
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.checkPrincipal = function() {
|
||||
checkPrincipalForIFrame(this, data);
|
||||
};
|
||||
var gTestRunner = runTest();
|
||||
|
||||
if (data.app) {
|
||||
iframe.setAttribute('mozapp', data.app);
|
||||
iframe.setAttribute('mozbrowser', '');
|
||||
} else if (data.browser) {
|
||||
iframe.setAttribute('mozbrowser', '');
|
||||
}
|
||||
|
||||
iframe.src = data.src;
|
||||
|
||||
iframe.addEventListener('load', iframe.checkPrincipal.bind(iframe));
|
||||
|
||||
content.appendChild(iframe);
|
||||
});
|
||||
|
||||
});
|
||||
SpecialPowers.pushPrefEnv({'set': [["dom.mozBrowserFramesEnabled", true],
|
||||
["dom.mozBrowserFramesWhitelist", "http://example.org"]]},
|
||||
function() { gTestRunner.next(); });
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
@ -32,7 +32,7 @@ static fp_except_t oldmask = fpsetmask(~allmask);
|
||||
#include "nsAString.h"
|
||||
#include "nsIStatefulFrame.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsIXPCScriptable.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsTArray.h"
|
||||
|
@ -48,4 +48,3 @@ DEPRECATED_OPERATION(DOMExceptionCode)
|
||||
DEPRECATED_OPERATION(NoExposedProps)
|
||||
DEPRECATED_OPERATION(MutationEvent)
|
||||
DEPRECATED_OPERATION(MozSlice)
|
||||
DEPRECATED_OPERATION(Onuploadprogress)
|
||||
|
@ -395,22 +395,8 @@ interface nsIXHRSendable : nsISupports {
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
[deprecated, scriptable, uuid(423fdd3d-41c9-4149-8fe5-b14a1d3912a0)]
|
||||
[deprecated, scriptable, uuid(8ae70a39-edf1-40b4-a992-472d23421c25)]
|
||||
interface nsIJSXMLHttpRequest : nsISupports {
|
||||
/**
|
||||
* Meant to be a script-only mechanism for setting an upload progress event
|
||||
* listener.
|
||||
* This attribute should not be used from native code!!
|
||||
* This event listener may be called multiple times during the upload..
|
||||
*
|
||||
* After the initial response, all event listeners will be cleared.
|
||||
* // XXXbz what does that mean, exactly?
|
||||
*
|
||||
* This event listener must be set BEFORE calling open().
|
||||
*
|
||||
* Mozilla only.
|
||||
*/
|
||||
attribute nsIDOMEventListener onuploadprogress;
|
||||
};
|
||||
|
||||
%{ C++
|
||||
|
@ -86,7 +86,7 @@ ContentAreaDropListener.prototype =
|
||||
|
||||
// Use file:/// as the default uri so that drops of file URIs are always allowed
|
||||
let principal = sourceNode ? sourceNode.nodePrincipal
|
||||
: secMan.getCodebasePrincipal(ioService.newURI("file:///", null, null));
|
||||
: secMan.getSimpleCodebasePrincipal(ioService.newURI("file:///", null, null));
|
||||
|
||||
secMan.checkLoadURIStrWithPrincipal(principal, uriString, flags);
|
||||
|
||||
|
@ -265,7 +265,8 @@ nsDOMParser::Init(nsIPrincipal* principal, nsIURI* documentURI,
|
||||
nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
|
||||
NS_ENSURE_TRUE(secMan, NS_ERROR_NOT_AVAILABLE);
|
||||
rv =
|
||||
secMan->GetCodebasePrincipal(mDocumentURI, getter_AddRefs(mPrincipal));
|
||||
secMan->GetSimpleCodebasePrincipal(mDocumentURI,
|
||||
getter_AddRefs(mPrincipal));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mOriginalPrincipal = mPrincipal;
|
||||
} else {
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -1597,7 +1597,7 @@ nsFrameLoader::MaybeCreateDocShell()
|
||||
EnsureMessageManager();
|
||||
|
||||
if (OwnerIsBrowserFrame()) {
|
||||
mDocShell->SetIsBrowser();
|
||||
mDocShell->SetIsBrowserElement();
|
||||
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (os) {
|
||||
@ -1971,6 +1971,31 @@ nsFrameLoader::TryRemoteBrowser()
|
||||
return false;
|
||||
}
|
||||
|
||||
PRUint32 appId = 0;
|
||||
bool isBrowserElement = false;
|
||||
|
||||
if (OwnerIsBrowserFrame()) {
|
||||
isBrowserElement = true;
|
||||
|
||||
if (mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozapp)) {
|
||||
nsAutoString manifest;
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::mozapp, manifest);
|
||||
|
||||
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
if (!appsService) {
|
||||
NS_ERROR("Apps Service is not available!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
appsService->GetAppLocalIdByManifestURL(manifest, &appId);
|
||||
|
||||
// If the frame is actually an app, we should not mark it as a browser.
|
||||
if (appId != nsIScriptSecurityManager::NO_APP_ID) {
|
||||
isBrowserElement = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If our owner has no app manifest URL, then this is equivalent to
|
||||
// ContentParent::GetNewOrUsed().
|
||||
nsAutoString appManifest;
|
||||
@ -1978,8 +2003,7 @@ nsFrameLoader::TryRemoteBrowser()
|
||||
ContentParent* parent = ContentParent::GetForApp(appManifest);
|
||||
|
||||
NS_ASSERTION(parent->IsAlive(), "Process parent should be alive; something is very wrong!");
|
||||
mRemoteBrowser = parent->CreateTab(chromeFlags,
|
||||
/* aIsBrowserFrame = */ OwnerIsBrowserFrame());
|
||||
mRemoteBrowser = parent->CreateTab(chromeFlags, isBrowserElement, appId);
|
||||
if (mRemoteBrowser) {
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mOwnerContent);
|
||||
mRemoteBrowser->SetOwnerElement(element);
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "nsFrameLoader.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsIMozBrowserFrame.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
|
||||
bool SendSyncMessageToParent(void* aCallbackData,
|
||||
const nsAString& aMessage,
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
|
@ -496,19 +496,29 @@ nsresult nsObjectLoadingContent::IsPluginEnabledForType(const nsCString& aMIMETy
|
||||
rv = topWindow->GetDocument(getter_AddRefs(topDocument));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDocument> topDoc = do_QueryInterface(topDocument);
|
||||
nsIURI* topUri = topDoc->GetDocumentURI();
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager = do_GetService(NS_PERMISSIONMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
PRUint32 permission;
|
||||
rv = permissionManager->TestPermission(topUri, "plugins", &permission);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
bool allowPerm = false;
|
||||
// For now we always say that the system principal uses click-to-play since
|
||||
// that maintains current behavior and we have tests that expect this.
|
||||
// What we really should do is disable plugins entirely in pages that use
|
||||
// the system principal, i.e. in chrome pages. That way the click-to-play
|
||||
// code here wouldn't matter at all. Bug 775301 is tracking this.
|
||||
if (!nsContentUtils::IsSystemPrincipal(topDoc->NodePrincipal())) {
|
||||
PRUint32 permission;
|
||||
rv = permissionManager->TestPermissionFromPrincipal(topDoc->NodePrincipal(),
|
||||
"plugins",
|
||||
&permission);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
allowPerm = permission == nsIPermissionManager::ALLOW_ACTION;
|
||||
}
|
||||
|
||||
PRUint32 state;
|
||||
rv = pluginHost->GetBlocklistStateForType(aMIMEType.get(), &state);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (permission == nsIPermissionManager::ALLOW_ACTION &&
|
||||
if (allowPerm &&
|
||||
state != nsIBlocklistService::STATE_VULNERABLE_UPDATE_AVAILABLE &&
|
||||
state != nsIBlocklistService::STATE_VULNERABLE_NO_UPDATE) {
|
||||
mCTPPlayable = true;
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "nsIDOMNodeFilter.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsINode.h"
|
||||
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
/*
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "GeneratedEvents.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -90,7 +90,6 @@ using namespace mozilla::dom;
|
||||
#define TIMEOUT_STR "timeout"
|
||||
#define LOADSTART_STR "loadstart"
|
||||
#define PROGRESS_STR "progress"
|
||||
#define UPLOADPROGRESS_STR "uploadprogress"
|
||||
#define READYSTATE_STR "readystatechange"
|
||||
#define LOADEND_STR "loadend"
|
||||
|
||||
@ -619,7 +618,6 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsXMLHttpRequest)
|
||||
NS_UNMARK_LISTENER_WRAPPER(LoadStart)
|
||||
NS_UNMARK_LISTENER_WRAPPER(Progress)
|
||||
NS_UNMARK_LISTENER_WRAPPER(Loadend)
|
||||
NS_UNMARK_LISTENER_WRAPPER(UploadProgress)
|
||||
NS_UNMARK_LISTENER_WRAPPER(Readystatechange)
|
||||
}
|
||||
if (!isBlack && tmp->PreservingWrapper()) {
|
||||
@ -645,7 +643,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXMLHttpRequest,
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mResponseXML)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mCORSPreflightChannel)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnUploadProgressListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnReadystatechangeListener)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mXMLParserStreamListener)
|
||||
@ -667,7 +664,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXMLHttpRequest,
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mResponseXML)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCORSPreflightChannel)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnUploadProgressListener)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnReadystatechangeListener)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mXMLParserStreamListener)
|
||||
@ -708,7 +704,6 @@ void
|
||||
nsXMLHttpRequest::DisconnectFromOwner()
|
||||
{
|
||||
nsXHREventTarget::DisconnectFromOwner();
|
||||
NS_DISCONNECT_EVENT_HANDLER(UploadProgress)
|
||||
NS_DISCONNECT_EVENT_HANDLER(Readystatechange)
|
||||
Abort();
|
||||
}
|
||||
@ -730,23 +725,6 @@ nsXMLHttpRequest::SetOnreadystatechange(nsIDOMEventListener * aOnreadystatechang
|
||||
aOnreadystatechange);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::GetOnuploadprogress(nsIDOMEventListener * *aOnuploadprogress)
|
||||
{
|
||||
return
|
||||
nsXHREventTarget::GetInnerEventListener(mOnUploadProgressListener,
|
||||
aOnuploadprogress);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::SetOnuploadprogress(nsIDOMEventListener * aOnuploadprogress)
|
||||
{
|
||||
return
|
||||
nsXHREventTarget::RemoveAddEventListener(NS_LITERAL_STRING(UPLOADPROGRESS_STR),
|
||||
mOnUploadProgressListener,
|
||||
aOnuploadprogress);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIChannel channel; */
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::GetChannel(nsIChannel **aChannel)
|
||||
@ -1655,8 +1633,7 @@ nsXMLHttpRequest::DispatchProgressEvent(nsDOMEventTargetHelper* aTarget,
|
||||
NS_ASSERTION(!aType.IsEmpty(), "missing event type");
|
||||
|
||||
if (NS_FAILED(CheckInnerWindowCorrectness()) ||
|
||||
(!AllowUploadProgress() &&
|
||||
(aTarget == mUpload || aType.EqualsLiteral(UPLOADPROGRESS_STR)))) {
|
||||
(!AllowUploadProgress() && aTarget == mUpload)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1752,7 +1729,6 @@ nsXMLHttpRequest::CheckChannelForCrossSiteRequest(nsIChannel* aChannel)
|
||||
nsCAutoString method;
|
||||
httpChannel->GetRequestMethod(method);
|
||||
if (!mCORSUnsafeHeaders.IsEmpty() ||
|
||||
HasListenersFor(NS_LITERAL_STRING(UPLOADPROGRESS_STR)) ||
|
||||
(mUpload && mUpload->HasListeners()) ||
|
||||
(!method.LowerCaseEqualsLiteral("get") &&
|
||||
!method.LowerCaseEqualsLiteral("post") &&
|
||||
@ -2820,7 +2796,6 @@ nsXMLHttpRequest::Send(nsIVariant* aVariant, const Nullable<RequestBody>& aBody)
|
||||
// a progress event handler we must load with nsIRequest::LOAD_NORMAL or
|
||||
// necko won't generate any progress notifications.
|
||||
if (HasListenersFor(NS_LITERAL_STRING(PROGRESS_STR)) ||
|
||||
HasListenersFor(NS_LITERAL_STRING(UPLOADPROGRESS_STR)) ||
|
||||
(mUpload && mUpload->HasListenersFor(NS_LITERAL_STRING(PROGRESS_STR)))) {
|
||||
nsLoadFlags loadFlags;
|
||||
mChannel->GetLoadFlags(&loadFlags);
|
||||
@ -3179,9 +3154,7 @@ nsXMLHttpRequest::Send(nsIVariant* aVariant, const Nullable<RequestBody>& aBody)
|
||||
// can run script that would try to restart this request, and that could end
|
||||
// up doing our AsyncOpen on a null channel if the reentered AsyncOpen fails.
|
||||
ChangeState(XML_HTTP_REQUEST_SENT);
|
||||
if ((!mUploadComplete &&
|
||||
HasListenersFor(NS_LITERAL_STRING(UPLOADPROGRESS_STR))) ||
|
||||
(mUpload && mUpload->HasListenersFor(NS_LITERAL_STRING(PROGRESS_STR)))) {
|
||||
if (mUpload && mUpload->HasListenersFor(NS_LITERAL_STRING(PROGRESS_STR))) {
|
||||
StartProgressEventTimer();
|
||||
}
|
||||
DispatchProgressEvent(this, NS_LITERAL_STRING(LOADSTART_STR), false,
|
||||
@ -3722,10 +3695,6 @@ nsXMLHttpRequest::MaybeDispatchProgressEvents(bool aFinalProgress)
|
||||
mUploadProgressMax = mUploadProgress;
|
||||
mUploadLengthComputable = true;
|
||||
}
|
||||
DispatchProgressEvent(this, NS_LITERAL_STRING(UPLOADPROGRESS_STR),
|
||||
true, mUploadLengthComputable, mUploadTransferred,
|
||||
mUploadTotal, mUploadProgress,
|
||||
mUploadProgressMax);
|
||||
if (mUpload && !mUploadComplete) {
|
||||
DispatchProgressEvent(mUpload, NS_LITERAL_STRING(PROGRESS_STR),
|
||||
true, mUploadLengthComputable, mUploadTransferred,
|
||||
|
@ -217,10 +217,6 @@ public:
|
||||
// nsIXMLHttpRequest
|
||||
NS_DECL_NSIXMLHTTPREQUEST
|
||||
|
||||
// nsIJSXMLHttpRequest
|
||||
NS_IMETHOD GetOnuploadprogress(nsIDOMEventListener** aOnuploadprogress);
|
||||
NS_IMETHOD SetOnuploadprogress(nsIDOMEventListener* aOnuploadprogress);
|
||||
|
||||
NS_FORWARD_NSIXMLHTTPREQUESTEVENTTARGET(nsXHREventTarget::)
|
||||
|
||||
// nsIStreamListener
|
||||
@ -253,24 +249,6 @@ public:
|
||||
|
||||
// event handler
|
||||
IMPL_EVENT_HANDLER(readystatechange, Readystatechange)
|
||||
JSObject* GetOnuploadprogress(JSContext* /* unused */)
|
||||
{
|
||||
nsIDocument* doc = GetOwner() ? GetOwner()->GetExtantDoc() : NULL;
|
||||
if (doc) {
|
||||
doc->WarnOnceAbout(nsIDocument::eOnuploadprogress);
|
||||
}
|
||||
return GetListenerAsJSObject(mOnUploadProgressListener);
|
||||
}
|
||||
void SetOnuploadprogress(JSContext* aCx, JSObject* aCallback,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsIDocument* doc = GetOwner() ? GetOwner()->GetExtantDoc() : NULL;
|
||||
if (doc) {
|
||||
doc->WarnOnceAbout(nsIDocument::eOnuploadprogress);
|
||||
}
|
||||
aRv = SetJSObjectListener(aCx, NS_LITERAL_STRING("uploadprogress"),
|
||||
mOnUploadProgressListener, aCallback);
|
||||
}
|
||||
|
||||
// states
|
||||
uint16_t GetReadyState();
|
||||
@ -577,7 +555,6 @@ protected:
|
||||
nsCOMPtr<nsIChannel> mCORSPreflightChannel;
|
||||
nsTArray<nsCString> mCORSUnsafeHeaders;
|
||||
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnUploadProgressListener;
|
||||
nsRefPtr<nsDOMEventListenerWrapper> mOnReadystatechangeListener;
|
||||
|
||||
nsCOMPtr<nsIStreamListener> mXMLParserStreamListener;
|
||||
|
@ -37,16 +37,9 @@ window.addEventListener("message", function(e) {
|
||||
res.progressEvents++;
|
||||
}, false);
|
||||
if (req.uploadProgress) {
|
||||
if (req.uploadProgress == "uploadProgress") {
|
||||
xhr.addEventListener("uploadProgress", function(e) {
|
||||
res.progressEvents++;
|
||||
}, false);
|
||||
}
|
||||
else {
|
||||
xhr.upload.addEventListener(req.uploadProgress, function(e) {
|
||||
res.progressEvents++;
|
||||
}, false);
|
||||
}
|
||||
xhr.upload.addEventListener(req.uploadProgress, function(e) {
|
||||
res.progressEvents++;
|
||||
}, false);
|
||||
}
|
||||
xhr.onerror = function(e) {
|
||||
res.didFail = true;
|
||||
|
@ -26,16 +26,9 @@ window.addEventListener("message", function(e) {\n\
|
||||
res.progressEvents++;\n\
|
||||
}, false);\n\
|
||||
if (req.uploadProgress) {\n\
|
||||
if (req.uploadProgress == "uploadProgress") {\n\
|
||||
xhr.addEventListener("uploadProgress", function(e) {\n\
|
||||
res.progressEvents++;\n\
|
||||
}, false);\n\
|
||||
}\n\
|
||||
else {\n\
|
||||
xhr.upload.addEventListener(req.uploadProgress, function(e) {\n\
|
||||
res.progressEvents++;\n\
|
||||
}, false);\n\
|
||||
}\n\
|
||||
xhr.upload.addEventListener(req.uploadProgress, function(e) {\n\
|
||||
res.progressEvents++;\n\
|
||||
}, false);\n\
|
||||
}\n\
|
||||
xhr.onerror = function(e) {\n\
|
||||
res.didFail = true;\n\
|
||||
|
@ -449,25 +449,12 @@ function runTest() {
|
||||
},
|
||||
|
||||
// Progress events
|
||||
{ pass: 1,
|
||||
method: "POST",
|
||||
body: "hi there",
|
||||
headers: { "Content-Type": "text/plain" },
|
||||
uploadProgress: "uploadprogress",
|
||||
},
|
||||
{ pass: 1,
|
||||
method: "POST",
|
||||
body: "hi there",
|
||||
headers: { "Content-Type": "text/plain" },
|
||||
uploadProgress: "progress",
|
||||
},
|
||||
{ pass: 0,
|
||||
method: "POST",
|
||||
body: "hi there",
|
||||
headers: { "Content-Type": "text/plain" },
|
||||
uploadProgress: "uploadprogress",
|
||||
noAllowPreflight: 1,
|
||||
},
|
||||
{ pass: 0,
|
||||
method: "POST",
|
||||
body: "hi there",
|
||||
|
@ -27,12 +27,12 @@ function uploadprogress()
|
||||
}
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onuploadprogress = uploadprogress;
|
||||
xhr.upload.onprogress = uploadprogress;
|
||||
var event = document.createEvent("ProgressEvent");
|
||||
event.initProgressEvent("uploadprogress", false, false, false, false, 0);
|
||||
xhr.dispatchEvent(event);
|
||||
event.initProgressEvent("progress", false, false, false, false, 0);
|
||||
xhr.upload.dispatchEvent(event);
|
||||
ok(called,
|
||||
"XMLHttpRequest.onuploadprogress sets uploadprogress event listener");
|
||||
"XMLHttpRequest.upload.onprogress sets upload progress event listener");
|
||||
|
||||
|
||||
</script>
|
||||
|
@ -105,7 +105,7 @@ function test(trusted, type, removeAddedListener, removeSetListener, allowUntrus
|
||||
}
|
||||
|
||||
var events =
|
||||
["load", "error", "progress", "uploadprogress", "readystatechange", "foo"];
|
||||
["load", "error", "progress", "readystatechange", "foo"];
|
||||
|
||||
do {
|
||||
var e = events.shift();
|
||||
|
@ -104,10 +104,6 @@ function start(obj) {
|
||||
function (evt) {
|
||||
logEvent(evt);
|
||||
}
|
||||
xhr.onuploadprogress =
|
||||
function (evt) {
|
||||
logEvent(evt);
|
||||
}
|
||||
|
||||
if ("upload" in xhr) {
|
||||
xhr.upload.onloadstart =
|
||||
@ -277,7 +273,6 @@ var tests =
|
||||
{ method: "POST", withUpload: small, testAbort: false, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: UPLOAD, type: "load", optional: false},
|
||||
{target: UPLOAD, type: "loadend", optional: false},
|
||||
@ -294,7 +289,6 @@ var tests =
|
||||
{ method: "POST", withUpload: small, testAbort: false, testRedirectError: true, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false},
|
||||
@ -303,7 +297,6 @@ var tests =
|
||||
{ method: "POST", withUpload: small, testAbort: false, testRedirectError: false, testNetworkError: true,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false},
|
||||
@ -313,7 +306,6 @@ var tests =
|
||||
{ method: "POST", withUpload: mid, testAbort: false, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: UPLOAD, type: "load", optional: false},
|
||||
{target: UPLOAD, type: "loadend", optional: false},
|
||||
@ -330,7 +322,6 @@ var tests =
|
||||
{ method: "POST", withUpload: mid, testAbort: false, testRedirectError: true, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false},
|
||||
@ -339,7 +330,6 @@ var tests =
|
||||
{ method: "POST", withUpload: mid, testAbort: false, testRedirectError: false, testNetworkError: true,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false},
|
||||
@ -349,7 +339,6 @@ var tests =
|
||||
{ method: "POST", withUpload: large, testAbort: false, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: UPLOAD, type: "load", optional: false},
|
||||
{target: UPLOAD, type: "loadend", optional: false},
|
||||
@ -366,7 +355,6 @@ var tests =
|
||||
{ method: "POST", withUpload: large, testAbort: false, testRedirectError: true, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false},
|
||||
@ -375,7 +363,6 @@ var tests =
|
||||
{ method: "POST", withUpload: large, testAbort: false, testRedirectError: false, testNetworkError: true,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
{target: UPLOAD, type: "loadstart", optional: false},
|
||||
{target: XHR, type: "uploadprogress", optional: true},
|
||||
{target: UPLOAD, type: "progress", optional: true},
|
||||
{target: XHR, type: "error", optional: false},
|
||||
{target: XHR, type: "loadend", optional: false},
|
||||
|
@ -36,13 +36,10 @@ CPPSRCS = \
|
||||
nsDOMDragEvent.cpp \
|
||||
nsDOMMutationEvent.cpp \
|
||||
nsDOMPopupBlockedEvent.cpp \
|
||||
nsDOMDeviceProximityEvent.cpp \
|
||||
nsDOMUserProximityEvent.cpp \
|
||||
nsDOMDeviceLightEvent.cpp \
|
||||
nsDOMDeviceOrientationEvent.cpp \
|
||||
nsDOMDeviceMotionEvent.cpp \
|
||||
nsDOMBeforeUnloadEvent.cpp \
|
||||
nsDOMPageTransitionEvent.cpp \
|
||||
nsDOMXULCommandEvent.cpp \
|
||||
nsDOMCommandEvent.cpp \
|
||||
nsDOMMessageEvent.cpp \
|
||||
@ -65,13 +62,9 @@ CPPSRCS = \
|
||||
nsDOMScrollAreaEvent.cpp \
|
||||
nsDOMTransitionEvent.cpp \
|
||||
nsDOMAnimationEvent.cpp \
|
||||
nsDOMPopStateEvent.cpp \
|
||||
nsDOMHashChangeEvent.cpp \
|
||||
nsDOMCloseEvent.cpp \
|
||||
nsDOMSettingsEvent.cpp \
|
||||
nsDOMContactChangeEvent.cpp \
|
||||
nsDOMTouchEvent.cpp \
|
||||
nsDOMCustomEvent.cpp \
|
||||
nsDOMCompositionEvent.cpp \
|
||||
nsDOMApplicationEvent.cpp \
|
||||
$(NULL)
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "nsDOMApplicationEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "DictionaryHelpers.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
|
||||
DOMCI_DATA(MozApplicationEvent, nsDOMMozApplicationEvent)
|
||||
|
||||
|
@ -1,81 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsDOMCloseEvent.h"
|
||||
#include "DictionaryHelpers.h"
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMCloseEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMCloseEvent, nsDOMEvent)
|
||||
|
||||
DOMCI_DATA(CloseEvent, nsDOMCloseEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMCloseEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCloseEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CloseEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMCloseEvent::GetWasClean(bool *aWasClean)
|
||||
{
|
||||
*aWasClean = mWasClean;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMCloseEvent::GetCode(PRUint16 *aCode)
|
||||
{
|
||||
*aCode = mReasonCode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMCloseEvent::GetReason(nsAString & aReason)
|
||||
{
|
||||
aReason = mReason;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMCloseEvent::InitCloseEvent(const nsAString& aType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
bool aWasClean,
|
||||
PRUint16 aReasonCode,
|
||||
const nsAString &aReason)
|
||||
{
|
||||
nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mWasClean = aWasClean;
|
||||
mReasonCode = aReasonCode;
|
||||
mReason = aReason;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMCloseEvent::InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, jsval* aVal)
|
||||
{
|
||||
mozilla::dom::CloseEventInit d;
|
||||
nsresult rv = d.Init(aCx, aVal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return InitCloseEvent(aType, d.bubbles, d.cancelable, d.wasClean, d.code,
|
||||
d.reason);
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewDOMCloseEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsEvent* aEvent)
|
||||
{
|
||||
nsDOMCloseEvent* it = new nsDOMCloseEvent(aPresContext, aEvent);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsDOMCloseEvent_h__
|
||||
#define nsDOMCloseEvent_h__
|
||||
|
||||
#include "nsIDOMCloseEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
|
||||
/**
|
||||
* Implements the CloseEvent event, used for notifying that a WebSocket
|
||||
* connection has been closed.
|
||||
*
|
||||
* See http://dev.w3.org/html5/websockets/#closeevent for further details.
|
||||
*/
|
||||
class nsDOMCloseEvent : public nsDOMEvent,
|
||||
public nsIDOMCloseEvent
|
||||
{
|
||||
public:
|
||||
nsDOMCloseEvent(nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
: nsDOMEvent(aPresContext, aEvent),
|
||||
mWasClean(false),
|
||||
mReasonCode(1005) {}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
|
||||
NS_DECL_NSIDOMCLOSEEVENT
|
||||
|
||||
virtual nsresult InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, jsval* aVal);
|
||||
private:
|
||||
bool mWasClean;
|
||||
PRUint16 mReasonCode;
|
||||
nsString mReason;
|
||||
};
|
||||
|
||||
#endif // nsDOMCloseEvent_h__
|
@ -6,6 +6,7 @@
|
||||
#include "nsDOMContactChangeEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "DictionaryHelpers.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
|
||||
DOMCI_DATA(MozContactChangeEvent, nsDOMMozContactChangeEvent)
|
||||
|
||||
|
@ -1,67 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsDOMCustomEvent.h"
|
||||
#include "DictionaryHelpers.h"
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMCustomEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMCustomEvent, nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDetail)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMCustomEvent, nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDetail)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
DOMCI_DATA(CustomEvent, nsDOMCustomEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMCustomEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCustomEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CustomEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMCustomEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMCustomEvent, nsDOMEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMCustomEvent::GetDetail(nsIVariant** aDetail)
|
||||
{
|
||||
NS_IF_ADDREF(*aDetail = mDetail);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMCustomEvent::InitCustomEvent(const nsAString& aType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
nsIVariant* aDetail)
|
||||
{
|
||||
nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mDetail = aDetail;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMCustomEvent::InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, jsval* aVal)
|
||||
{
|
||||
mozilla::dom::CustomEventInit d;
|
||||
nsresult rv = d.Init(aCx, aVal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return InitCustomEvent(aType, d.bubbles, d.cancelable, d.detail);
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewDOMCustomEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsEvent* aEvent)
|
||||
{
|
||||
nsDOMCustomEvent* e = new nsDOMCustomEvent(aPresContext, aEvent);
|
||||
return CallQueryInterface(e, aInstancePtrResult);
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsDOMCustomEvent_h__
|
||||
#define nsDOMCustomEvent_h__
|
||||
|
||||
#include "nsIDOMCustomEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
class nsDOMCustomEvent : public nsDOMEvent,
|
||||
public nsIDOMCustomEvent
|
||||
{
|
||||
public:
|
||||
nsDOMCustomEvent(nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
: nsDOMEvent(aPresContext, aEvent)
|
||||
{
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMCustomEvent, nsDOMEvent)
|
||||
|
||||
NS_DECL_NSIDOMCUSTOMEVENT
|
||||
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
|
||||
virtual nsresult InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, jsval* aVal);
|
||||
private:
|
||||
nsCOMPtr<nsIVariant> mDetail;
|
||||
};
|
||||
|
||||
#endif // nsDOMCustomEvent_h__
|
@ -1,81 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsDOMDeviceProximityEvent.h"
|
||||
#include "DictionaryHelpers.h"
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMDeviceProximityEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMDeviceProximityEvent, nsDOMEvent)
|
||||
|
||||
DOMCI_DATA(DeviceProximityEvent, nsDOMDeviceProximityEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMDeviceProximityEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMDeviceProximityEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DeviceProximityEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDeviceProximityEvent::InitDeviceProximityEvent(const nsAString & aEventTypeArg,
|
||||
bool aCanBubbleArg,
|
||||
bool aCancelableArg,
|
||||
double aValue,
|
||||
double aMin,
|
||||
double aMax)
|
||||
{
|
||||
nsresult rv = nsDOMEvent::InitEvent(aEventTypeArg, aCanBubbleArg, aCancelableArg);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mValue = aValue;
|
||||
mMin = aMin;
|
||||
mMax = aMax;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDeviceProximityEvent::GetValue(double *aValue)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aValue);
|
||||
|
||||
*aValue = mValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDeviceProximityEvent::GetMin(double *aMin)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aMin);
|
||||
|
||||
*aMin = mMin;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDeviceProximityEvent::GetMax(double *aMax)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aMax);
|
||||
|
||||
*aMax = mMax;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMDeviceProximityEvent::InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, jsval* aVal)
|
||||
{
|
||||
mozilla::dom::DeviceProximityEventInit d;
|
||||
nsresult rv = d.Init(aCx, aVal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return InitDeviceProximityEvent(aType, d.bubbles, d.cancelable, d.value, d.min, d.max);
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewDOMDeviceProximityEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsEvent *aEvent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
|
||||
nsDOMDeviceProximityEvent* it = new nsDOMDeviceProximityEvent(aPresContext, aEvent);
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsDOMDeviceProximityEvent_h__
|
||||
#define nsDOMDeviceProximityEvent_h__
|
||||
|
||||
#include "nsIDOMDeviceProximityEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
|
||||
class nsDOMDeviceProximityEvent
|
||||
: public nsDOMEvent
|
||||
, public nsIDOMDeviceProximityEvent
|
||||
{
|
||||
public:
|
||||
|
||||
nsDOMDeviceProximityEvent(nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
: nsDOMEvent(aPresContext, aEvent),
|
||||
mValue(-1),
|
||||
mMin(0),
|
||||
mMax(0) {}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// Forward to nsDOMEvent
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
|
||||
// nsIDOMDeviceProximityEvent Interface
|
||||
NS_DECL_NSIDOMDEVICEPROXIMITYEVENT
|
||||
|
||||
virtual nsresult InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx,
|
||||
jsval* aVal);
|
||||
protected:
|
||||
double mValue, mMin, mMax;
|
||||
};
|
||||
|
||||
#endif
|
@ -9,6 +9,7 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMDataTransfer.h"
|
||||
#include "nsIDragService.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
|
||||
nsDOMDragEvent::nsDOMDragEvent(nsPresContext* aPresContext,
|
||||
nsInputEvent* aEvent)
|
||||
|
@ -25,12 +25,12 @@
|
||||
#include "nsIURI.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsDOMPopStateEvent.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "DictionaryHelpers.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -1,71 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsDOMHashChangeEvent.h"
|
||||
#include "DictionaryHelpers.h"
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMHashChangeEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMHashChangeEvent, nsDOMEvent)
|
||||
|
||||
DOMCI_DATA(HashChangeEvent, nsDOMHashChangeEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMHashChangeEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMHashChangeEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(HashChangeEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
nsDOMHashChangeEvent::~nsDOMHashChangeEvent()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMHashChangeEvent::GetOldURL(nsAString &aURL)
|
||||
{
|
||||
aURL.Assign(mOldURL);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMHashChangeEvent::GetNewURL(nsAString &aURL)
|
||||
{
|
||||
aURL.Assign(mNewURL);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMHashChangeEvent::InitHashChangeEvent(const nsAString &aTypeArg,
|
||||
bool aCanBubbleArg,
|
||||
bool aCancelableArg,
|
||||
const nsAString &aOldURL,
|
||||
const nsAString &aNewURL)
|
||||
{
|
||||
nsresult rv = nsDOMEvent::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mOldURL.Assign(aOldURL);
|
||||
mNewURL.Assign(aNewURL);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMHashChangeEvent::InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, jsval* aVal)
|
||||
{
|
||||
mozilla::dom::HashChangeEventInit d;
|
||||
nsresult rv = d.Init(aCx, aVal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return InitHashChangeEvent(aType, d.bubbles, d.cancelable, d.oldURL, d.newURL);
|
||||
}
|
||||
|
||||
nsresult NS_NewDOMHashChangeEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsEvent* aEvent)
|
||||
{
|
||||
nsDOMHashChangeEvent* event =
|
||||
new nsDOMHashChangeEvent(aPresContext, aEvent);
|
||||
|
||||
return CallQueryInterface(event, aInstancePtrResult);
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsDOMHashChangeEvent_h__
|
||||
#define nsDOMHashChangeEvent_h__
|
||||
|
||||
class nsEvent;
|
||||
|
||||
#include "nsIDOMHashChangeEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
class nsDOMHashChangeEvent : public nsDOMEvent,
|
||||
public nsIDOMHashChangeEvent
|
||||
{
|
||||
public:
|
||||
nsDOMHashChangeEvent(nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
: nsDOMEvent(aPresContext, aEvent)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~nsDOMHashChangeEvent();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMHASHCHANGEEVENT
|
||||
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
|
||||
virtual nsresult InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, jsval* aVal);
|
||||
protected:
|
||||
nsString mOldURL;
|
||||
nsString mNewURL;
|
||||
};
|
||||
|
||||
#endif // nsDOMHashChangeEvent_h__
|
@ -6,6 +6,7 @@
|
||||
#include "nsDOMMessageEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMMessageEvent)
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "nsIContent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "DictionaryHelpers.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "nsClientRect.h"
|
||||
#include "nsPaintRequest.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
|
||||
nsDOMNotifyPaintEvent::nsDOMNotifyPaintEvent(nsPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user