This commit is contained in:
Ehsan Akhgari 2012-05-02 16:22:51 -04:00
Родитель e2e6367105 6c81de89ff
Коммит 8f0b9693ed
703 изменённых файлов: 31078 добавлений и 34618 удалений

Просмотреть файл

@ -40,11 +40,8 @@
/**
* Defines cross platform (Gecko) roles.
*
* @note - When adding a new role, be sure to also add it to nsRoleMap.h for
* each platform.
*/
[scriptable, uuid(f134da65-39a8-4330-843c-5bd42780b34c)]
[scriptable, uuid(50db5e86-9a45-4637-a5c3-4ff148c33270)]
interface nsIAccessibleRole : nsISupports
{
/**
@ -811,11 +808,5 @@ interface nsIAccessibleRole : nsISupports
* An HTML definition <dd>
*/
const unsigned long ROLE_DEFINITION = 128;
/**
* It's not role actually. This constant is important to help ensure
* nsRoleMap's are synchronized.
*/
const unsigned long ROLE_LAST_ENTRY = 129;
};

Просмотреть файл

@ -53,7 +53,6 @@
#include "nsString.h"
#include "nsAutoPtr.h"
#include "prprf.h"
#include "nsRoleMap.h"
#include "nsStateMap.h"
#include "Relation.h"
#include "States.h"
@ -722,24 +721,20 @@ getDescriptionCB(AtkObject *aAtkObj)
AtkRole
getRoleCB(AtkObject *aAtkObj)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap) {
return ATK_ROLE_INVALID;
}
nsAccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap)
return ATK_ROLE_INVALID;
#ifdef DEBUG_A11Y
NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap),
"Does not support nsIAccessibleText when it should");
NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap),
"Does not support nsIAccessibleText when it should");
#endif
if (aAtkObj->role == ATK_ROLE_INVALID) {
// map to the actual value
PRUint32 atkRole = atkRoleMap[accWrap->Role()];
NS_ASSERTION(atkRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY] ==
kROLE_ATK_LAST_ENTRY, "ATK role map skewed");
aAtkObj->role = static_cast<AtkRole>(atkRole);
}
if (aAtkObj->role != ATK_ROLE_INVALID)
return aAtkObj->role;
return aAtkObj->role =
static_cast<AtkRole>(nsAccessibleWrap::AtkRoleFor(accWrap->Role()));
}
AtkAttributeSet*
@ -1400,3 +1395,19 @@ nsAccessibleWrap::FireAtkShowHideEvent(AccEvent* aEvent,
return NS_OK;
}
PRUint32
nsAccessibleWrap::AtkRoleFor(role aRole)
{
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role) \
case roles::geckoRole: \
return atkRole;
switch (aRole) {
#include "RoleMap.h"
default:
MOZ_NOT_REACHED("Unknown role.");
return ATK_ROLE_UNKNOWN;
}
#undef ROLE
}

Просмотреть файл

@ -116,6 +116,11 @@ public:
return returnedString.get();
}
/**
* Function mapping from cross platform roles to ATK roles.
*/
static PRUint32 AtkRoleFor(mozilla::a11y::role aRole);
protected:
virtual nsresult FirePlatformEvent(AccEvent* aEvent);

Просмотреть файл

@ -42,7 +42,6 @@
#include "nsHyperTextAccessible.h"
#include "nsMai.h"
#include "nsRoleMap.h"
#include "nsIPersistentProperties2.h"
@ -52,7 +51,7 @@ static void
ConvertTexttoAsterisks(nsAccessibleWrap* accWrap, nsAString& aString)
{
// convert each char to "*" when it's "password text"
PRUint32 atkRole = atkRoleMap[accWrap->NativeRole()];
PRUint32 atkRole = nsAccessibleWrap::AtkRoleFor(accWrap->NativeRole());
if (atkRole == ATK_ROLE_PASSWORD_TEXT) {
for (PRUint32 i = 0; i < aString.Length(); i++)
aString.Replace(i, 1, NS_LITERAL_STRING("*"));
@ -161,7 +160,7 @@ getCharacterAtOffsetCB(AtkText *aText, gint aOffset)
accText->GetCharacterAtOffset(aOffset, &uniChar);
// convert char to "*" when it's "password text"
PRUint32 atkRole = atkRoleMap[accWrap->NativeRole()];
PRUint32 atkRole = nsAccessibleWrap::AtkRoleFor(accWrap->NativeRole());
if (atkRole == ATK_ROLE_PASSWORD_TEXT)
uniChar = '*';

Просмотреть файл

@ -1,179 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is IBM Corporation
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Gao, Ming (gaoming@cn.ibm.com)
* Aaron Leventhal (aleventh@us.ibm.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include <atk/atk.h>
#include "nsAccessibleWrap.h"
const PRUint32 kROLE_ATK_LAST_ENTRY = 0xffffffff;
// Map array from cross platform roles to ATK roles
static const PRUint32 atkRoleMap[] = {
// Cross Platform Roles #
ATK_ROLE_UNKNOWN, // roles::NOTHING 0
ATK_ROLE_UNKNOWN, // roles::TITLEBAR 1
ATK_ROLE_MENU_BAR, // roles::MENUBAR 2
ATK_ROLE_SCROLL_BAR, // roles::SCROLLBAR 3
ATK_ROLE_UNKNOWN, // roles::GRIP 4
ATK_ROLE_UNKNOWN, // roles::SOUND 5
ATK_ROLE_UNKNOWN, // roles::CURSOR 6
ATK_ROLE_UNKNOWN, // roles::CARET 7
ATK_ROLE_ALERT, // roles::ALERT 8
ATK_ROLE_WINDOW, // roles::WINDOW 9
ATK_ROLE_INTERNAL_FRAME, // roles::INTERNAL_FRAME 10
ATK_ROLE_MENU, // roles::MENUPOPUP 11
ATK_ROLE_MENU_ITEM, // roles::MENUITEM 12
ATK_ROLE_TOOL_TIP, // roles::TOOLTIP 13
ATK_ROLE_EMBEDDED, // roles::APPLICATION 14
ATK_ROLE_DOCUMENT_FRAME, // roles::DOCUMENT 15
ATK_ROLE_PANEL, // roles::PANE 16
ATK_ROLE_CHART, // roles::CHART 17
ATK_ROLE_DIALOG, // roles::DIALOG 18
ATK_ROLE_UNKNOWN, // roles::BORDER 19
ATK_ROLE_PANEL, // roles::GROUPING 20
ATK_ROLE_SEPARATOR, // roles::SEPARATOR 21
ATK_ROLE_TOOL_BAR, // roles::TOOLBAR 22
ATK_ROLE_STATUSBAR, // roles::STATUSBAR 23
ATK_ROLE_TABLE, // roles::TABLE 24
ATK_ROLE_COLUMN_HEADER, // roles::COLUMNHEADER 25
ATK_ROLE_ROW_HEADER, // roles::ROWHEADER 26
ATK_ROLE_UNKNOWN, // roles::COLUMN 27
ATK_ROLE_LIST_ITEM, // roles::ROW 28
ATK_ROLE_TABLE_CELL, // roles::CELL 29
ATK_ROLE_LINK, // roles::LINK 30
ATK_ROLE_UNKNOWN, // roles::HELPBALLOON 31
ATK_ROLE_IMAGE, // roles::CHARACTER 32
ATK_ROLE_LIST, // roles::LIST 33
ATK_ROLE_LIST_ITEM, // roles::LISTITEM 34
ATK_ROLE_TREE, // roles::OUTLINE 35
ATK_ROLE_LIST_ITEM, // roles::OUTLINEITEM 36
ATK_ROLE_PAGE_TAB, // roles::PAGETAB 37
ATK_ROLE_SCROLL_PANE, // roles::PROPERTYPAGE 38
ATK_ROLE_UNKNOWN, // roles::INDICATOR 39
ATK_ROLE_IMAGE, // roles::GRAPHIC 40
ATK_ROLE_UNKNOWN, // roles::STATICTEXT 41
ATK_ROLE_UNKNOWN, // roles::TEXT_LEAF 42
ATK_ROLE_PUSH_BUTTON, // roles::PUSHBUTTON 43
ATK_ROLE_CHECK_BOX, // roles::CHECKBUTTON 44
ATK_ROLE_RADIO_BUTTON, // roles::RADIOBUTTON 45
ATK_ROLE_COMBO_BOX, // roles::COMBOBOX 46
ATK_ROLE_COMBO_BOX, // roles::DROPLIST 47
ATK_ROLE_PROGRESS_BAR, // roles::PROGRESSBAR 48
ATK_ROLE_DIAL, // roles::DIAL 49
ATK_ROLE_UNKNOWN, // roles::HOTKEYFIELD 50
ATK_ROLE_SLIDER, // roles::SLIDER 51
ATK_ROLE_SPIN_BUTTON, // roles::SPINBUTTON 52
ATK_ROLE_IMAGE, // roles::DIAGRAM 53
ATK_ROLE_ANIMATION, // roles::ANIMATION 54
ATK_ROLE_UNKNOWN, // roles::EQUATION 55
ATK_ROLE_PUSH_BUTTON, // roles::BUTTONDROPDOWN 56
ATK_ROLE_PUSH_BUTTON, // roles::BUTTONMENU 57
ATK_ROLE_UNKNOWN, // roles::BUTTONDROPDOWNGRID 58
ATK_ROLE_UNKNOWN, // roles::WHITESPACE 59
ATK_ROLE_PAGE_TAB_LIST, // roles::PAGETABLIST 60
ATK_ROLE_UNKNOWN, // roles::CLOCK 61
ATK_ROLE_PUSH_BUTTON, // roles::SPLITBUTTON 62
ATK_ROLE_UNKNOWN, // roles::IPADDRESS 63
ATK_ROLE_ACCEL_LABEL, // roles::ACCEL_LABEL 64
ATK_ROLE_ARROW, // roles::ARROW 65
ATK_ROLE_CANVAS, // roles::CANVAS 66
ATK_ROLE_CHECK_MENU_ITEM, // roles::CHECK_MENU_ITEM 67
ATK_ROLE_COLOR_CHOOSER, // roles::COLOR_CHOOSER 68
ATK_ROLE_DATE_EDITOR, // roles::DATE_EDITOR 69
ATK_ROLE_DESKTOP_ICON, // roles::DESKTOP_ICON 70
ATK_ROLE_DESKTOP_FRAME, // roles::DESKTOP_FRAME 71
ATK_ROLE_DIRECTORY_PANE, // roles::DIRECTORY_PANE 72
ATK_ROLE_FILE_CHOOSER, // roles::FILE_CHOOSER 73
ATK_ROLE_FONT_CHOOSER, // roles::FONT_CHOOSER 74
ATK_ROLE_FRAME, // roles::CHROME_WINDOW 75
ATK_ROLE_GLASS_PANE, // roles::GLASS_PANE 76
ATK_ROLE_HTML_CONTAINER, // roles::HTML_CONTAINER 77
ATK_ROLE_ICON, // roles::ICON 78
ATK_ROLE_LABEL, // roles::LABEL 79
ATK_ROLE_LAYERED_PANE, // roles::LAYERED_PANE 80
ATK_ROLE_OPTION_PANE, // roles::OPTION_PANE 81
ATK_ROLE_PASSWORD_TEXT, // roles::PASSWORD_TEXT 82
ATK_ROLE_POPUP_MENU, // roles::POPUP_MENU 83
ATK_ROLE_RADIO_MENU_ITEM, // roles::RADIO_MENU_ITEM 84
ATK_ROLE_ROOT_PANE, // roles::ROOT_PANE 85
ATK_ROLE_SCROLL_PANE, // roles::SCROLL_PANE 86
ATK_ROLE_SPLIT_PANE, // roles::SPLIT_PANE 87
ATK_ROLE_TABLE_COLUMN_HEADER, // roles::TABLE_COLUMN_HEADER 88
ATK_ROLE_TABLE_ROW_HEADER, // roles::TABLE_ROW_HEADER 89
ATK_ROLE_TEAR_OFF_MENU_ITEM, // roles::TEAR_OFF_MENU_ITEM 90
ATK_ROLE_TERMINAL, // roles::TERMINAL 91
ATK_ROLE_TEXT, // roles::TEXT_CONTAINER 92
ATK_ROLE_TOGGLE_BUTTON, // roles::TOGGLE_BUTTON 93
ATK_ROLE_TREE_TABLE, // roles::TREE_TABLE 94
ATK_ROLE_VIEWPORT, // roles::VIEWPORT 95
ATK_ROLE_HEADER, // roles::HEADER 96
ATK_ROLE_FOOTER, // roles::FOOTER 97
ATK_ROLE_PARAGRAPH, // roles::PARAGRAPH 98
ATK_ROLE_RULER, // roles::RULER 99
ATK_ROLE_AUTOCOMPLETE, // roles::AUTOCOMPLETE 100
ATK_ROLE_EDITBAR, // roles::EDITBAR 101
ATK_ROLE_ENTRY, // roles::ENTRY 102
ATK_ROLE_CAPTION, // roles::CAPTION 103
ATK_ROLE_DOCUMENT_FRAME, // roles::DOCUMENT_FRAME 104
ATK_ROLE_HEADING, // roles::HEADING 105
ATK_ROLE_PAGE, // roles::PAGE 106
ATK_ROLE_SECTION, // roles::SECTION 107
ATK_ROLE_REDUNDANT_OBJECT, // roles::REDUNDANT_OBJECT 108
ATK_ROLE_FORM, // roles::FORM 109
ATK_ROLE_INPUT_METHOD_WINDOW, // roles::IME 110
ATK_ROLE_APPLICATION, // roles::APP_ROOT 111
ATK_ROLE_MENU, // roles::PARENT_MENUITEM 112
ATK_ROLE_CALENDAR, // roles::CALENDAR 113
ATK_ROLE_MENU, // roles::COMBOBOX_LIST 114
ATK_ROLE_MENU_ITEM, // roles::COMBOBOX_OPTION 115
ATK_ROLE_IMAGE, // roles::IMAGE_MAP 116
ATK_ROLE_LIST_ITEM, // roles::OPTION 117
ATK_ROLE_LIST_ITEM, // roles::RICH_OPTION 118
ATK_ROLE_LIST, // roles::LISTBOX 119
ATK_ROLE_UNKNOWN, // roles::FLAT_EQUATION 120
ATK_ROLE_TABLE_CELL, // roles::GRID_CELL 121
ATK_ROLE_PANEL, // roles::EMBEDDED_OBJECT 122
ATK_ROLE_SECTION, // roles::NOTE 123
ATK_ROLE_PANEL, // roles::FIGURE 124
ATK_ROLE_CHECK_BOX, // roles::CHECK_RICH_OPTION 125
ATK_ROLE_LIST, // roles::DEFINITION_LIST 126
ATK_ROLE_LIST_ITEM, // roles::TERM 127
ATK_ROLE_PARAGRAPH, // roles::DEFINITION 128
kROLE_ATK_LAST_ENTRY // roles::LAST_ENTRY
};

Просмотреть файл

@ -41,13 +41,16 @@
#define _role_h_
/**
* Note: Make sure to update the localized role names when changing the list.
* @note Make sure to update the localized role names when changing the list.
* @note When adding a new role, be sure to also add it to base/RoleMap.h and
* update nsIAccessibleRole.
*/
namespace mozilla {
namespace a11y {
namespace roles {
enum Role {
enum Role {
/**
* Used when accessible hans't strong defined role.
*/
@ -812,15 +815,12 @@ namespace roles {
* Represent a definition in a definition list (dd in HTML)
*/
DEFINITION = 128,
};
/**
* It's not role actually. This constant is important to help ensure
* nsRoleMap's are synchronized.
*/
LAST_ENTRY = 129
};
} // namespace role
typedef enum mozilla::a11y::roles::Role role;
} // namespace a11y
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,920 @@
/* 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/. */
/**
* Usage: declare the macro ROLE()with the following arguments:
* ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role)
*/
ROLE(NOTHING,
"nothing",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
USE_ROLE_STRING,
IA2_ROLE_UNKNOWN)
ROLE(TITLEBAR,
"titlebar",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole, //Irrelevant on OS X; windows are always native.
ROLE_SYSTEM_TITLEBAR,
ROLE_SYSTEM_TITLEBAR)
ROLE(MENUBAR,
"menubar",
ATK_ROLE_MENU_BAR,
NSAccessibilityMenuBarRole, //Irrelevant on OS X; the menubar will always be native and on the top of the screen.
ROLE_SYSTEM_MENUBAR,
ROLE_SYSTEM_MENUBAR)
ROLE(SCROLLBAR,
"scrollbar",
ATK_ROLE_SCROLL_BAR,
NSAccessibilityScrollBarRole, //We might need to make this its own mozAccessible, to support the children objects (valueindicator, down/up buttons).
ROLE_SYSTEM_SCROLLBAR,
ROLE_SYSTEM_SCROLLBAR)
ROLE(GRIP,
"grip",
ATK_ROLE_UNKNOWN,
NSAccessibilitySplitterRole,
ROLE_SYSTEM_GRIP,
ROLE_SYSTEM_GRIP)
ROLE(SOUND,
"sound",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole, //Unused on OS X.
ROLE_SYSTEM_SOUND,
ROLE_SYSTEM_SOUND)
ROLE(CURSOR,
"cursor",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole, //Unused on OS X.
ROLE_SYSTEM_CURSOR,
ROLE_SYSTEM_CURSOR)
ROLE(CARET,
"caret",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole, //Unused on OS X.
ROLE_SYSTEM_CARET,
ROLE_SYSTEM_CARET)
ROLE(ALERT,
"alert",
ATK_ROLE_ALERT,
NSAccessibilityWindowRole,
ROLE_SYSTEM_ALERT,
ROLE_SYSTEM_ALERT)
ROLE(WINDOW,
"window",
ATK_ROLE_WINDOW,
NSAccessibilityWindowRole, //Irrelevant on OS X; all window a11y is handled by the system.
ROLE_SYSTEM_WINDOW,
ROLE_SYSTEM_WINDOW)
ROLE(INTERNAL_FRAME,
"internal frame",
ATK_ROLE_INTERNAL_FRAME,
NSAccessibilityScrollAreaRole,
USE_ROLE_STRING,
IA2_ROLE_INTERNAL_FRAME)
ROLE(MENUPOPUP,
"menupopup",
ATK_ROLE_MENU,
NSAccessibilityMenuRole, //The parent of menuitems.
ROLE_SYSTEM_MENUPOPUP,
ROLE_SYSTEM_MENUPOPUP)
ROLE(MENUITEM,
"menuitem",
ATK_ROLE_MENU_ITEM,
NSAccessibilityMenuItemRole,
ROLE_SYSTEM_MENUITEM,
ROLE_SYSTEM_MENUITEM)
ROLE(TOOLTIP,
"tooltip",
ATK_ROLE_TOOL_TIP,
@"AXHelpTag", //10.4+ only, so we re-define the constant.
ROLE_SYSTEM_TOOLTIP,
ROLE_SYSTEM_TOOLTIP)
ROLE(APPLICATION,
"application",
ATK_ROLE_EMBEDDED,
NSAccessibilityGroupRole, //Unused on OS X. the system will take care of this.
ROLE_SYSTEM_APPLICATION,
ROLE_SYSTEM_APPLICATION)
ROLE(DOCUMENT,
"document",
ATK_ROLE_DOCUMENT_FRAME,
@"AXWebArea",
ROLE_SYSTEM_DOCUMENT,
ROLE_SYSTEM_DOCUMENT)
/**
* msaa comment:
* We used to map to ROLE_SYSTEM_PANE, but JAWS would
* not read the accessible name for the contaning pane.
* However, JAWS will read the accessible name for a groupbox.
* By mapping a PANE to a GROUPING, we get no undesirable effects,
* but fortunately JAWS will then read the group's label,
* when an inner control gets focused.
*/
ROLE(PANE,
"pane",
ATK_ROLE_PANEL,
NSAccessibilityGroupRole,
ROLE_SYSTEM_GROUPING,
ROLE_SYSTEM_GROUPING)
ROLE(CHART,
"chart",
ATK_ROLE_CHART,
NSAccessibilityUnknownRole,
ROLE_SYSTEM_CHART,
ROLE_SYSTEM_CHART)
ROLE(DIALOG,
"dialog",
ATK_ROLE_DIALOG,
NSAccessibilityWindowRole, //There's a dialog subrole.
ROLE_SYSTEM_DIALOG,
ROLE_SYSTEM_DIALOG)
ROLE(BORDER,
"border",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole, //Unused on OS X.
ROLE_SYSTEM_BORDER,
ROLE_SYSTEM_BORDER)
ROLE(GROUPING,
"grouping",
ATK_ROLE_PANEL,
NSAccessibilityGroupRole,
ROLE_SYSTEM_GROUPING,
ROLE_SYSTEM_GROUPING)
ROLE(SEPARATOR,
"separator",
ATK_ROLE_SEPARATOR,
NSAccessibilityUnknownRole,
ROLE_SYSTEM_SEPARATOR,
ROLE_SYSTEM_SEPARATOR)
ROLE(TOOLBAR,
"toolbar",
ATK_ROLE_TOOL_BAR,
NSAccessibilityToolbarRole,
ROLE_SYSTEM_TOOLBAR,
ROLE_SYSTEM_TOOLBAR)
ROLE(STATUSBAR,
"statusbar",
ATK_ROLE_STATUSBAR,
NSAccessibilityUnknownRole, //Doesn't exist on OS X (a status bar is its parts; a progressbar, a label, etc.)
ROLE_SYSTEM_STATUSBAR,
ROLE_SYSTEM_STATUSBAR)
ROLE(TABLE,
"table",
ATK_ROLE_TABLE,
NSAccessibilityGroupRole,
ROLE_SYSTEM_TABLE,
ROLE_SYSTEM_TABLE)
ROLE(COLUMNHEADER,
"columnheader",
ATK_ROLE_COLUMN_HEADER,
NSAccessibilityGroupRole,
ROLE_SYSTEM_COLUMNHEADER,
ROLE_SYSTEM_COLUMNHEADER)
ROLE(ROWHEADER,
"rowheader",
ATK_ROLE_ROW_HEADER,
NSAccessibilityGroupRole,
ROLE_SYSTEM_ROWHEADER,
ROLE_SYSTEM_ROWHEADER)
ROLE(COLUMN,
"column",
ATK_ROLE_UNKNOWN,
NSAccessibilityColumnRole,
ROLE_SYSTEM_COLUMN,
ROLE_SYSTEM_COLUMN)
ROLE(ROW,
"row",
ATK_ROLE_LIST_ITEM,
NSAccessibilityRowRole,
ROLE_SYSTEM_ROW,
ROLE_SYSTEM_ROW)
ROLE(CELL,
"cell",
ATK_ROLE_TABLE_CELL,
NSAccessibilityGroupRole,
ROLE_SYSTEM_CELL,
ROLE_SYSTEM_CELL)
ROLE(LINK,
"link",
ATK_ROLE_LINK,
@"AXLink", //10.4+ the attr first define in SDK 10.4, so we define it here too. ROLE_LINK
ROLE_SYSTEM_LINK,
ROLE_SYSTEM_LINK)
ROLE(HELPBALLOON,
"helpballoon",
ATK_ROLE_UNKNOWN,
@"AXHelpTag",
ROLE_SYSTEM_HELPBALLOON,
ROLE_SYSTEM_HELPBALLOON)
ROLE(CHARACTER,
"character",
ATK_ROLE_IMAGE,
NSAccessibilityUnknownRole, //Unused on OS X.
ROLE_SYSTEM_CHARACTER,
ROLE_SYSTEM_CHARACTER)
ROLE(LIST,
"list",
ATK_ROLE_LIST,
NSAccessibilityListRole,
ROLE_SYSTEM_LIST,
ROLE_SYSTEM_LIST)
ROLE(LISTITEM,
"listitem",
ATK_ROLE_LIST_ITEM,
NSAccessibilityGroupRole,
ROLE_SYSTEM_LISTITEM,
ROLE_SYSTEM_LISTITEM)
ROLE(OUTLINE,
"outline",
ATK_ROLE_TREE,
NSAccessibilityOutlineRole,
ROLE_SYSTEM_OUTLINE,
ROLE_SYSTEM_OUTLINE)
ROLE(OUTLINEITEM,
"outlineitem",
ATK_ROLE_LIST_ITEM,
NSAccessibilityRowRole, //XXX: use OutlineRow as subrole.
ROLE_SYSTEM_OUTLINEITEM,
ROLE_SYSTEM_OUTLINEITEM)
ROLE(PAGETAB,
"pagetab",
ATK_ROLE_PAGE_TAB,
NSAccessibilityRadioButtonRole,
ROLE_SYSTEM_PAGETAB,
ROLE_SYSTEM_PAGETAB)
ROLE(PROPERTYPAGE,
"propertypage",
ATK_ROLE_SCROLL_PANE,
NSAccessibilityGroupRole,
ROLE_SYSTEM_PROPERTYPAGE,
ROLE_SYSTEM_PROPERTYPAGE)
ROLE(INDICATOR,
"indicator",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
ROLE_SYSTEM_INDICATOR,
ROLE_SYSTEM_INDICATOR)
ROLE(GRAPHIC,
"graphic",
ATK_ROLE_IMAGE,
NSAccessibilityImageRole,
ROLE_SYSTEM_GRAPHIC,
ROLE_SYSTEM_GRAPHIC)
ROLE(STATICTEXT,
"statictext",
ATK_ROLE_UNKNOWN,
NSAccessibilityStaticTextRole,
ROLE_SYSTEM_STATICTEXT,
ROLE_SYSTEM_STATICTEXT)
ROLE(TEXT_LEAF,
"text leaf",
ATK_ROLE_UNKNOWN,
NSAccessibilityStaticTextRole,
ROLE_SYSTEM_TEXT,
ROLE_SYSTEM_TEXT)
ROLE(PUSHBUTTON,
"pushbutton",
ATK_ROLE_PUSH_BUTTON,
NSAccessibilityButtonRole,
ROLE_SYSTEM_PUSHBUTTON,
ROLE_SYSTEM_PUSHBUTTON)
ROLE(CHECKBUTTON,
"checkbutton",
ATK_ROLE_CHECK_BOX,
NSAccessibilityCheckBoxRole,
ROLE_SYSTEM_CHECKBUTTON,
ROLE_SYSTEM_CHECKBUTTON)
ROLE(RADIOBUTTON,
"radiobutton",
ATK_ROLE_RADIO_BUTTON,
NSAccessibilityRadioButtonRole,
ROLE_SYSTEM_RADIOBUTTON,
ROLE_SYSTEM_RADIOBUTTON)
ROLE(COMBOBOX,
"combobox",
ATK_ROLE_COMBO_BOX,
NSAccessibilityPopUpButtonRole,
ROLE_SYSTEM_COMBOBOX,
ROLE_SYSTEM_COMBOBOX)
ROLE(DROPLIST,
"droplist",
ATK_ROLE_COMBO_BOX,
NSAccessibilityPopUpButtonRole,
ROLE_SYSTEM_DROPLIST,
ROLE_SYSTEM_DROPLIST)
ROLE(PROGRESSBAR,
"progressbar",
ATK_ROLE_PROGRESS_BAR,
NSAccessibilityProgressIndicatorRole,
ROLE_SYSTEM_PROGRESSBAR,
ROLE_SYSTEM_PROGRESSBAR)
ROLE(DIAL,
"dial",
ATK_ROLE_DIAL,
NSAccessibilityUnknownRole,
ROLE_SYSTEM_DIAL,
ROLE_SYSTEM_DIAL)
ROLE(HOTKEYFIELD,
"hotkeyfield",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
ROLE_SYSTEM_HOTKEYFIELD,
ROLE_SYSTEM_HOTKEYFIELD)
ROLE(SLIDER,
"slider",
ATK_ROLE_SLIDER,
NSAccessibilitySliderRole,
ROLE_SYSTEM_SLIDER,
ROLE_SYSTEM_SLIDER)
ROLE(SPINBUTTON,
"spinbutton",
ATK_ROLE_SPIN_BUTTON,
NSAccessibilityIncrementorRole, //Subroles: Increment/Decrement.
ROLE_SYSTEM_SPINBUTTON,
ROLE_SYSTEM_SPINBUTTON)
ROLE(DIAGRAM,
"diagram",
ATK_ROLE_IMAGE,
NSAccessibilityUnknownRole,
ROLE_SYSTEM_DIAGRAM,
ROLE_SYSTEM_DIAGRAM)
ROLE(ANIMATION,
"animation",
ATK_ROLE_ANIMATION,
NSAccessibilityUnknownRole,
ROLE_SYSTEM_ANIMATION,
ROLE_SYSTEM_ANIMATION)
ROLE(EQUATION,
"equation",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
ROLE_SYSTEM_EQUATION,
ROLE_SYSTEM_EQUATION)
ROLE(BUTTONDROPDOWN,
"buttondropdown",
ATK_ROLE_PUSH_BUTTON,
NSAccessibilityPopUpButtonRole,
ROLE_SYSTEM_BUTTONDROPDOWN,
ROLE_SYSTEM_BUTTONDROPDOWN)
ROLE(BUTTONMENU,
"buttonmenu",
ATK_ROLE_PUSH_BUTTON,
NSAccessibilityMenuButtonRole,
ROLE_SYSTEM_BUTTONMENU,
ROLE_SYSTEM_BUTTONMENU)
ROLE(BUTTONDROPDOWNGRID,
"buttondropdowngrid",
ATK_ROLE_UNKNOWN,
NSAccessibilityGroupRole,
ROLE_SYSTEM_BUTTONDROPDOWNGRID,
ROLE_SYSTEM_BUTTONDROPDOWNGRID)
ROLE(WHITESPACE,
"whitespace",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
ROLE_SYSTEM_WHITESPACE,
ROLE_SYSTEM_WHITESPACE)
ROLE(PAGETABLIST,
"pagetablist",
ATK_ROLE_PAGE_TAB_LIST,
NSAccessibilityTabGroupRole,
ROLE_SYSTEM_PAGETABLIST,
ROLE_SYSTEM_PAGETABLIST)
ROLE(CLOCK,
"clock",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole, //Unused on OS X
ROLE_SYSTEM_CLOCK,
ROLE_SYSTEM_CLOCK)
ROLE(SPLITBUTTON,
"splitbutton",
ATK_ROLE_PUSH_BUTTON,
NSAccessibilityButtonRole,
ROLE_SYSTEM_SPLITBUTTON,
ROLE_SYSTEM_SPLITBUTTON)
ROLE(IPADDRESS,
"ipaddress",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
ROLE_SYSTEM_IPADDRESS,
ROLE_SYSTEM_IPADDRESS)
ROLE(ACCEL_LABEL,
"accel label",
ATK_ROLE_ACCEL_LABEL,
NSAccessibilityStaticTextRole,
ROLE_SYSTEM_STATICTEXT,
ROLE_SYSTEM_STATICTEXT)
ROLE(ARROW,
"arrow",
ATK_ROLE_ARROW,
NSAccessibilityUnknownRole,
ROLE_SYSTEM_INDICATOR,
ROLE_SYSTEM_INDICATOR)
ROLE(CANVAS,
"canvas",
ATK_ROLE_CANVAS,
NSAccessibilityImageRole,
USE_ROLE_STRING,
IA2_ROLE_CANVAS)
ROLE(CHECK_MENU_ITEM,
"check menu item",
ATK_ROLE_CHECK_MENU_ITEM,
NSAccessibilityMenuItemRole,
ROLE_SYSTEM_MENUITEM,
IA2_ROLE_CHECK_MENU_ITEM)
ROLE(COLOR_CHOOSER,
"color chooser",
ATK_ROLE_COLOR_CHOOSER,
NSAccessibilityColorWellRole,
ROLE_SYSTEM_DIALOG,
IA2_ROLE_COLOR_CHOOSER)
ROLE(DATE_EDITOR,
"date editor",
ATK_ROLE_DATE_EDITOR,
NSAccessibilityUnknownRole,
USE_ROLE_STRING,
IA2_ROLE_DATE_EDITOR)
ROLE(DESKTOP_ICON,
"desktop icon",
ATK_ROLE_DESKTOP_ICON,
NSAccessibilityImageRole,
USE_ROLE_STRING,
IA2_ROLE_DESKTOP_ICON)
ROLE(DESKTOP_FRAME,
"desktop frame",
ATK_ROLE_DESKTOP_FRAME,
NSAccessibilityUnknownRole,
USE_ROLE_STRING,
IA2_ROLE_DESKTOP_PANE)
ROLE(DIRECTORY_PANE,
"directory pane",
ATK_ROLE_DIRECTORY_PANE,
NSAccessibilityBrowserRole,
USE_ROLE_STRING,
IA2_ROLE_DIRECTORY_PANE)
ROLE(FILE_CHOOSER,
"file chooser",
ATK_ROLE_FILE_CHOOSER,
NSAccessibilityUnknownRole, //Unused on OS X
USE_ROLE_STRING,
IA2_ROLE_FILE_CHOOSER)
ROLE(FONT_CHOOSER,
"font chooser",
ATK_ROLE_FONT_CHOOSER,
NSAccessibilityUnknownRole,
USE_ROLE_STRING,
IA2_ROLE_FONT_CHOOSER)
ROLE(CHROME_WINDOW,
"chrome window",
ATK_ROLE_FRAME,
NSAccessibilityUnknownRole, //Unused on OS X
ROLE_SYSTEM_APPLICATION,
IA2_ROLE_FRAME)
ROLE(GLASS_PANE,
"glass pane",
ATK_ROLE_GLASS_PANE,
NSAccessibilityGroupRole,
USE_ROLE_STRING,
IA2_ROLE_GLASS_PANE)
ROLE(HTML_CONTAINER,
"html container",
ATK_ROLE_HTML_CONTAINER,
NSAccessibilityUnknownRole,
USE_ROLE_STRING,
IA2_ROLE_UNKNOWN)
ROLE(ICON,
"icon",
ATK_ROLE_ICON,
NSAccessibilityImageRole,
ROLE_SYSTEM_PUSHBUTTON,
IA2_ROLE_ICON)
ROLE(LABEL,
"label",
ATK_ROLE_LABEL,
NSAccessibilityGroupRole,
ROLE_SYSTEM_STATICTEXT,
IA2_ROLE_LABEL)
ROLE(LAYERED_PANE,
"layered pane",
ATK_ROLE_LAYERED_PANE,
NSAccessibilityGroupRole,
USE_ROLE_STRING,
IA2_ROLE_LAYERED_PANE)
ROLE(OPTION_PANE,
"option pane",
ATK_ROLE_OPTION_PANE,
NSAccessibilityGroupRole,
USE_ROLE_STRING,
IA2_ROLE_OPTION_PANE)
ROLE(PASSWORD_TEXT,
"password text",
ATK_ROLE_PASSWORD_TEXT,
NSAccessibilityTextFieldRole,
ROLE_SYSTEM_TEXT,
ROLE_SYSTEM_TEXT)
ROLE(POPUP_MENU,
"popup menu",
ATK_ROLE_POPUP_MENU,
NSAccessibilityUnknownRole, //Unused
ROLE_SYSTEM_MENUPOPUP,
ROLE_SYSTEM_MENUPOPUP)
ROLE(RADIO_MENU_ITEM,
"radio menu item",
ATK_ROLE_RADIO_MENU_ITEM,
NSAccessibilityMenuItemRole,
ROLE_SYSTEM_MENUITEM,
IA2_ROLE_RADIO_MENU_ITEM)
ROLE(ROOT_PANE,
"root pane",
ATK_ROLE_ROOT_PANE,
NSAccessibilityGroupRole,
USE_ROLE_STRING,
IA2_ROLE_ROOT_PANE)
ROLE(SCROLL_PANE,
"scroll pane",
ATK_ROLE_SCROLL_PANE,
NSAccessibilityScrollAreaRole,
USE_ROLE_STRING,
IA2_ROLE_SCROLL_PANE)
ROLE(SPLIT_PANE,
"split pane",
ATK_ROLE_SPLIT_PANE,
NSAccessibilitySplitGroupRole,
USE_ROLE_STRING,
IA2_ROLE_SPLIT_PANE)
ROLE(TABLE_COLUMN_HEADER,
"table column header",
ATK_ROLE_TABLE_COLUMN_HEADER,
NSAccessibilityUnknownRole,
ROLE_SYSTEM_COLUMNHEADER,
ROLE_SYSTEM_COLUMNHEADER)
ROLE(TABLE_ROW_HEADER,
"table row header",
ATK_ROLE_TABLE_ROW_HEADER,
NSAccessibilityUnknownRole,
ROLE_SYSTEM_ROWHEADER,
ROLE_SYSTEM_ROWHEADER)
ROLE(TEAR_OFF_MENU_ITEM,
"tear off menu item",
ATK_ROLE_TEAR_OFF_MENU_ITEM,
NSAccessibilityMenuItemRole,
ROLE_SYSTEM_MENUITEM,
IA2_ROLE_TEAR_OFF_MENU)
ROLE(TERMINAL,
"terminal",
ATK_ROLE_TERMINAL,
NSAccessibilityUnknownRole,
USE_ROLE_STRING,
IA2_ROLE_TERMINAL)
ROLE(TEXT_CONTAINER,
"text container",
ATK_ROLE_TEXT,
NSAccessibilityGroupRole,
USE_ROLE_STRING,
IA2_ROLE_TEXT_FRAME)
ROLE(TOGGLE_BUTTON,
"toggle button",
ATK_ROLE_TOGGLE_BUTTON,
NSAccessibilityButtonRole,
ROLE_SYSTEM_PUSHBUTTON,
IA2_ROLE_TOGGLE_BUTTON)
ROLE(TREE_TABLE,
"tree table",
ATK_ROLE_TREE_TABLE,
NSAccessibilityTableRole,
ROLE_SYSTEM_OUTLINE,
ROLE_SYSTEM_OUTLINE)
ROLE(VIEWPORT,
"viewport",
ATK_ROLE_VIEWPORT,
NSAccessibilityUnknownRole,
ROLE_SYSTEM_PANE,
IA2_ROLE_VIEW_PORT)
ROLE(HEADER,
"header",
ATK_ROLE_HEADER,
NSAccessibilityGroupRole,
USE_ROLE_STRING,
IA2_ROLE_HEADER)
ROLE(FOOTER,
"footer",
ATK_ROLE_FOOTER,
NSAccessibilityGroupRole,
USE_ROLE_STRING,
IA2_ROLE_FOOTER)
ROLE(PARAGRAPH,
"paragraph",
ATK_ROLE_PARAGRAPH,
NSAccessibilityGroupRole,
USE_ROLE_STRING,
IA2_ROLE_PARAGRAPH)
ROLE(RULER,
"ruler",
ATK_ROLE_RULER,
@"AXRuler", //10.4+ only, so we re-define the constant.
USE_ROLE_STRING,
IA2_ROLE_RULER)
ROLE(AUTOCOMPLETE,
"autocomplete",
ATK_ROLE_AUTOCOMPLETE,
NSAccessibilityUnknownRole,
ROLE_SYSTEM_COMBOBOX,
ROLE_SYSTEM_COMBOBOX)
ROLE(EDITBAR,
"editbar",
ATK_ROLE_EDITBAR,
NSAccessibilityTextFieldRole,
ROLE_SYSTEM_TEXT,
IA2_ROLE_EDITBAR)
ROLE(ENTRY,
"entry",
ATK_ROLE_ENTRY,
NSAccessibilityTextFieldRole,
ROLE_SYSTEM_TEXT,
ROLE_SYSTEM_TEXT)
ROLE(CAPTION,
"caption",
ATK_ROLE_CAPTION,
NSAccessibilityStaticTextRole,
USE_ROLE_STRING,
IA2_ROLE_CAPTION)
ROLE(DOCUMENT_FRAME,
"document frame",
ATK_ROLE_DOCUMENT_FRAME,
NSAccessibilityScrollAreaRole,
USE_ROLE_STRING,
IA2_ROLE_UNKNOWN)
ROLE(HEADING,
"heading",
ATK_ROLE_HEADING,
@"AXHeading",
USE_ROLE_STRING,
IA2_ROLE_HEADING)
ROLE(PAGE,
"page",
ATK_ROLE_PAGE,
NSAccessibilityGroupRole,
USE_ROLE_STRING,
IA2_ROLE_PAGE)
ROLE(SECTION,
"section",
ATK_ROLE_SECTION,
NSAccessibilityGroupRole,
USE_ROLE_STRING,
IA2_ROLE_SECTION)
ROLE(REDUNDANT_OBJECT,
"redundant object",
ATK_ROLE_REDUNDANT_OBJECT,
NSAccessibilityUnknownRole,
USE_ROLE_STRING,
IA2_ROLE_REDUNDANT_OBJECT)
ROLE(FORM,
"form",
ATK_ROLE_FORM,
NSAccessibilityGroupRole,
USE_ROLE_STRING,
IA2_ROLE_FORM)
ROLE(IME,
"ime",
ATK_ROLE_INPUT_METHOD_WINDOW,
NSAccessibilityUnknownRole,
USE_ROLE_STRING,
IA2_ROLE_INPUT_METHOD_WINDOW)
ROLE(APP_ROOT,
"app root",
ATK_ROLE_APPLICATION,
NSAccessibilityUnknownRole, //Unused on OS X
ROLE_SYSTEM_APPLICATION,
ROLE_SYSTEM_APPLICATION)
ROLE(PARENT_MENUITEM,
"parent menuitem",
ATK_ROLE_MENU,
NSAccessibilityMenuItemRole,
ROLE_SYSTEM_MENUITEM,
ROLE_SYSTEM_MENUITEM)
ROLE(CALENDAR,
"calendar",
ATK_ROLE_CALENDAR,
NSAccessibilityGroupRole,
ROLE_SYSTEM_CLIENT,
ROLE_SYSTEM_CLIENT)
ROLE(COMBOBOX_LIST,
"combobox list",
ATK_ROLE_MENU,
NSAccessibilityMenuRole,
ROLE_SYSTEM_LIST,
ROLE_SYSTEM_LIST)
ROLE(COMBOBOX_OPTION,
"combobox option",
ATK_ROLE_MENU_ITEM,
NSAccessibilityMenuItemRole,
ROLE_SYSTEM_LISTITEM,
ROLE_SYSTEM_LISTITEM)
ROLE(IMAGE_MAP,
"image map",
ATK_ROLE_IMAGE,
NSAccessibilityImageRole,
ROLE_SYSTEM_GRAPHIC,
ROLE_SYSTEM_GRAPHIC)
ROLE(OPTION,
"listbox option",
ATK_ROLE_LIST_ITEM,
NSAccessibilityRowRole,
ROLE_SYSTEM_LISTITEM,
ROLE_SYSTEM_LISTITEM)
ROLE(RICH_OPTION,
"listbox rich option",
ATK_ROLE_LIST_ITEM,
NSAccessibilityRowRole,
ROLE_SYSTEM_LISTITEM,
ROLE_SYSTEM_LISTITEM)
ROLE(LISTBOX,
"listbox",
ATK_ROLE_LIST,
NSAccessibilityListRole,
ROLE_SYSTEM_LIST,
ROLE_SYSTEM_LIST)
ROLE(FLAT_EQUATION,
"flat equation",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
ROLE_SYSTEM_EQUATION,
ROLE_SYSTEM_EQUATION)
ROLE(GRID_CELL,
"gridcell",
ATK_ROLE_TABLE_CELL,
NSAccessibilityGroupRole,
ROLE_SYSTEM_CELL,
ROLE_SYSTEM_CELL)
ROLE(EMBEDDED_OBJECT,
"embedded object",
ATK_ROLE_PANEL,
NSAccessibilityGroupRole,
USE_ROLE_STRING,
IA2_ROLE_EMBEDDED_OBJECT)
ROLE(NOTE,
"note",
ATK_ROLE_SECTION,
NSAccessibilityGroupRole,
USE_ROLE_STRING,
IA2_ROLE_NOTE)
ROLE(FIGURE,
"figure",
ATK_ROLE_PANEL,
NSAccessibilityGroupRole,
ROLE_SYSTEM_GROUPING,
ROLE_SYSTEM_GROUPING)
ROLE(CHECK_RICH_OPTION,
"check rich option",
ATK_ROLE_CHECK_BOX,
NSAccessibilityCheckBoxRole,
ROLE_SYSTEM_CHECKBUTTON,
ROLE_SYSTEM_CHECKBUTTON)
ROLE(DEFINITION_LIST,
"definitionlist",
ATK_ROLE_LIST,
NSAccessibilityListRole,
ROLE_SYSTEM_LIST,
ROLE_SYSTEM_LIST)
ROLE(TERM,
"term",
ATK_ROLE_LIST_ITEM,
NSAccessibilityGroupRole,
ROLE_SYSTEM_LISTITEM,
ROLE_SYSTEM_LISTITEM)
ROLE(DEFINITION,
"definition",
ATK_ROLE_PARAGRAPH,
NSAccessibilityGroupRole,
USE_ROLE_STRING,
IA2_ROLE_PARAGRAPH)

Просмотреть файл

@ -706,13 +706,19 @@ nsAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode,
NS_IMETHODIMP
nsAccessibilityService::GetStringRole(PRUint32 aRole, nsAString& aString)
{
if ( aRole >= ArrayLength(kRoleNames)) {
aString.AssignLiteral("unknown");
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role) \
case roles::geckoRole: \
CopyUTF8toUTF16(stringRole, aString); \
return NS_OK;
switch (aRole) {
#include "RoleMap.h"
default:
aString.AssignLiteral("unknown");
return NS_OK;
}
CopyUTF8toUTF16(kRoleNames[aRole], aString);
return NS_OK;
#undef ROLE
}
NS_IMETHODIMP

Просмотреть файл

@ -295,142 +295,6 @@ GetAccService()
return nsAccessibilityService::gAccessibilityService;
}
/**
* Map nsIAccessibleRole constants to strings. Used by
* nsIAccessibleRetrieval::getStringRole() method.
*/
static const char kRoleNames[][20] = {
"nothing", //ROLE_NOTHING
"titlebar", //ROLE_TITLEBAR
"menubar", //ROLE_MENUBAR
"scrollbar", //ROLE_SCROLLBAR
"grip", //ROLE_GRIP
"sound", //ROLE_SOUND
"cursor", //ROLE_CURSOR
"caret", //ROLE_CARET
"alert", //ROLE_ALERT
"window", //ROLE_WINDOW
"internal frame", //ROLE_INTERNAL_FRAME
"menupopup", //ROLE_MENUPOPUP
"menuitem", //ROLE_MENUITEM
"tooltip", //ROLE_TOOLTIP
"application", //ROLE_APPLICATION
"document", //ROLE_DOCUMENT
"pane", //ROLE_PANE
"chart", //ROLE_CHART
"dialog", //ROLE_DIALOG
"border", //ROLE_BORDER
"grouping", //ROLE_GROUPING
"separator", //ROLE_SEPARATOR
"toolbar", //ROLE_TOOLBAR
"statusbar", //ROLE_STATUSBAR
"table", //ROLE_TABLE
"columnheader", //ROLE_COLUMNHEADER
"rowheader", //ROLE_ROWHEADER
"column", //ROLE_COLUMN
"row", //ROLE_ROW
"cell", //ROLE_CELL
"link", //ROLE_LINK
"helpballoon", //ROLE_HELPBALLOON
"character", //ROLE_CHARACTER
"list", //ROLE_LIST
"listitem", //ROLE_LISTITEM
"outline", //ROLE_OUTLINE
"outlineitem", //ROLE_OUTLINEITEM
"pagetab", //ROLE_PAGETAB
"propertypage", //ROLE_PROPERTYPAGE
"indicator", //ROLE_INDICATOR
"graphic", //ROLE_GRAPHIC
"statictext", //ROLE_STATICTEXT
"text leaf", //ROLE_TEXT_LEAF
"pushbutton", //ROLE_PUSHBUTTON
"checkbutton", //ROLE_CHECKBUTTON
"radiobutton", //ROLE_RADIOBUTTON
"combobox", //ROLE_COMBOBOX
"droplist", //ROLE_DROPLIST
"progressbar", //ROLE_PROGRESSBAR
"dial", //ROLE_DIAL
"hotkeyfield", //ROLE_HOTKEYFIELD
"slider", //ROLE_SLIDER
"spinbutton", //ROLE_SPINBUTTON
"diagram", //ROLE_DIAGRAM
"animation", //ROLE_ANIMATION
"equation", //ROLE_EQUATION
"buttondropdown", //ROLE_BUTTONDROPDOWN
"buttonmenu", //ROLE_BUTTONMENU
"buttondropdowngrid", //ROLE_BUTTONDROPDOWNGRID
"whitespace", //ROLE_WHITESPACE
"pagetablist", //ROLE_PAGETABLIST
"clock", //ROLE_CLOCK
"splitbutton", //ROLE_SPLITBUTTON
"ipaddress", //ROLE_IPADDRESS
"accel label", //ROLE_ACCEL_LABEL
"arrow", //ROLE_ARROW
"canvas", //ROLE_CANVAS
"check menu item", //ROLE_CHECK_MENU_ITEM
"color chooser", //ROLE_COLOR_CHOOSER
"date editor", //ROLE_DATE_EDITOR
"desktop icon", //ROLE_DESKTOP_ICON
"desktop frame", //ROLE_DESKTOP_FRAME
"directory pane", //ROLE_DIRECTORY_PANE
"file chooser", //ROLE_FILE_CHOOSER
"font chooser", //ROLE_FONT_CHOOSER
"chrome window", //ROLE_CHROME_WINDOW
"glass pane", //ROLE_GLASS_PANE
"html container", //ROLE_HTML_CONTAINER
"icon", //ROLE_ICON
"label", //ROLE_LABEL
"layered pane", //ROLE_LAYERED_PANE
"option pane", //ROLE_OPTION_PANE
"password text", //ROLE_PASSWORD_TEXT
"popup menu", //ROLE_POPUP_MENU
"radio menu item", //ROLE_RADIO_MENU_ITEM
"root pane", //ROLE_ROOT_PANE
"scroll pane", //ROLE_SCROLL_PANE
"split pane", //ROLE_SPLIT_PANE
"table column header", //ROLE_TABLE_COLUMN_HEADER
"table row header", //ROLE_TABLE_ROW_HEADER
"tear off menu item", //ROLE_TEAR_OFF_MENU_ITEM
"terminal", //ROLE_TERMINAL
"text container", //ROLE_TEXT_CONTAINER
"toggle button", //ROLE_TOGGLE_BUTTON
"tree table", //ROLE_TREE_TABLE
"viewport", //ROLE_VIEWPORT
"header", //ROLE_HEADER
"footer", //ROLE_FOOTER
"paragraph", //ROLE_PARAGRAPH
"ruler", //ROLE_RULER
"autocomplete", //ROLE_AUTOCOMPLETE
"editbar", //ROLE_EDITBAR
"entry", //ROLE_ENTRY
"caption", //ROLE_CAPTION
"document frame", //ROLE_DOCUMENT_FRAME
"heading", //ROLE_HEADING
"page", //ROLE_PAGE
"section", //ROLE_SECTION
"redundant object", //ROLE_REDUNDANT_OBJECT
"form", //ROLE_FORM
"ime", //ROLE_IME
"app root", //ROLE_APP_ROOT
"parent menuitem", //ROLE_PARENT_MENUITEM
"calendar", //ROLE_CALENDAR
"combobox list", //ROLE_COMBOBOX_LIST
"combobox option", //ROLE_COMBOBOX_OPTION
"image map", //ROLE_IMAGE_MAP
"listbox option", //ROLE_OPTION
"listbox rich option", //ROLE_RICH_OPTION
"listbox", //ROLE_LISTBOX
"flat equation", //ROLE_FLAT_EQUATION
"gridcell", //ROLE_GRID_CELL
"embedded object", //ROLE_EMBEDDED_OBJECT
"note", //ROLE_NOTE
"figure", //ROLE_FIGURE
"check rich option", //ROLE_CHECK_RICH_OPTION
"definitionlist", //ROLE_DEFINITION_LIST
"term", //ROLE_TERM
"definition" //ROLE_DEFINITION
};
/**
* Map nsIAccessibleEvents constants to strings. Used by
* nsIAccessibleRetrieval::getStringEventType() method.

Просмотреть файл

@ -237,7 +237,7 @@ AndroidPresenter.prototype.actionInvoked = function(aObject, aActionName) {
gecko: {
type: 'Accessibility:Event',
eventType: ANDROID_TYPE_VIEW_CLICKED,
text: [UtteranceGenerator.genForAction(aObject, aActionName)]
text: UtteranceGenerator.genForAction(aObject, aActionName)
}
});
};

Просмотреть файл

@ -54,7 +54,7 @@ var UtteranceGenerator = {
},
genForAction: function(aObject, aActionName) {
return gStringBundle.GetStringFromName(this.gActionMap[aActionName]);
return [gStringBundle.GetStringFromName(this.gActionMap[aActionName])];
},
verbosityRoleMap: {

Просмотреть файл

@ -80,7 +80,6 @@ EXPORTS = \
mozAccessibleProtocol.h \
mozActionElements.h \
mozTextAccessible.h \
nsRoleMap.h \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.

Просмотреть файл

@ -40,7 +40,6 @@
#import "MacUtils.h"
#import "mozView.h"
#import "nsRoleMap.h"
#include "Accessible-inl.h"
#include "nsIAccessibleRelation.h"
@ -121,10 +120,6 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
mGeckoAccessible = geckoAccessible;
mIsExpired = NO;
mRole = geckoAccessible->Role();
// Check for OS X "role skew"; the role constants in nsIAccessible.idl need to match the ones
// in nsRoleMap.h.
NS_ASSERTION([AXRoles[roles::LAST_ENTRY] isEqualToString:@"ROLE_LAST_ENTRY"], "Role skew in the role map!");
}
return self;
@ -462,7 +457,19 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(mGeckoAccessible),
"Does not support nsIAccessibleText when it should");
#endif
return (NSString*) AXRoles[mRole];
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role) \
case roles::geckoRole: \
return macRole;
switch (mRole) {
#include "RoleMap.h"
default:
NS_NOTREACHED("Unknown role.");
return NSAccessibilityUnknownRole;
}
#undef ROLE
}
- (NSString*)subrole

Просмотреть файл

@ -101,7 +101,7 @@ public: // construction, destruction
*/
void GetUnignoredChildren(nsTArray<nsAccessible*>* aChildrenArray);
nsAccessible* GetUnignoredParent() const;
protected:
virtual nsresult FirePlatformEvent(AccEvent* aEvent);

Просмотреть файл

@ -39,8 +39,6 @@
#include "nsDocAccessible.h"
#include "nsObjCExceptions.h"
#import "nsRoleMap.h"
#include "Accessible-inl.h"
#include "Role.h"

Просмотреть файл

@ -1,175 +0,0 @@
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Håkan Waara <hwaara@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#import <Cocoa/Cocoa.h>
#include "nsIAccessible.h"
static const NSString* AXRoles [] = {
NSAccessibilityUnknownRole, // roles::NOTHING 0
NSAccessibilityUnknownRole, // roles::TITLEBAR 1 Irrelevant on OS X; windows are always native.
NSAccessibilityScrollBarRole, // roles::SCROLLBAR 3 We might need to make this its own mozAccessible, to support the children objects (valueindicator, down/up buttons).
NSAccessibilityMenuBarRole, // roles::MENUBAR 2 Irrelevant on OS X; the menubar will always be native and on the top of the screen.
NSAccessibilitySplitterRole, // roles::GRIP 4
NSAccessibilityUnknownRole, // roles::SOUND 5 Unused on OS X.
NSAccessibilityUnknownRole, // roles::CURSOR 6 Unused on OS X.
NSAccessibilityUnknownRole, // roles::CARET 7 Unused on OS X.
NSAccessibilityWindowRole, // roles::ALERT 8
NSAccessibilityWindowRole, // roles::WINDOW 9 Irrelevant on OS X; all window a11y is handled by the system.
NSAccessibilityScrollAreaRole, // roles::INTERNAL_FRAME 10
NSAccessibilityMenuRole, // roles::MENUPOPUP 11 The parent of menuitems.
NSAccessibilityMenuItemRole, // roles::MENUITEM 12
@"AXHelpTag", // roles::TOOLTIP 13 10.4+ only, so we re-define the constant.
NSAccessibilityGroupRole, // roles::APPLICATION 14 Unused on OS X. the system will take care of this.
@"AXWebArea", // roles::DOCUMENT 15
NSAccessibilityGroupRole, // roles::PANE 16
NSAccessibilityUnknownRole, // roles::CHART 17
NSAccessibilityWindowRole, // roles::DIALOG 18 There's a dialog subrole.
NSAccessibilityUnknownRole, // roles::BORDER 19 Unused on OS X.
NSAccessibilityGroupRole, // roles::GROUPING 20
NSAccessibilityUnknownRole, // roles::SEPARATOR 21
NSAccessibilityToolbarRole, // roles::TOOLBAR 22
NSAccessibilityUnknownRole, // roles::STATUSBAR 23 Doesn't exist on OS X (a status bar is its parts; a progressbar, a label, etc.)
NSAccessibilityGroupRole, // roles::TABLE 24
NSAccessibilityGroupRole, // roles::COLUMNHEADER 25
NSAccessibilityGroupRole, // roles::ROWHEADER 26
NSAccessibilityColumnRole, // roles::COLUMN 27
NSAccessibilityRowRole, // roles::ROW 28
NSAccessibilityGroupRole, // roles::CELL 29
@"AXLink", // roles::LINK 30 10.4+ the attr first define in SDK 10.4, so we define it here too. ROLE_LINK
@"AXHelpTag", // roles::HELPBALLOON 31
NSAccessibilityUnknownRole, // roles::CHARACTER 32 Unused on OS X.
NSAccessibilityListRole, // roles::LIST 33
NSAccessibilityGroupRole, // roles::LISTITEM 34
NSAccessibilityOutlineRole, // roles::OUTLINE 35
NSAccessibilityRowRole, // roles::OUTLINEITEM 36 XXX: use OutlineRow as subrole.
NSAccessibilityRadioButtonRole, // roles::PAGETAB 37
NSAccessibilityGroupRole, // roles::PROPERTYPAGE 38
NSAccessibilityUnknownRole, // roles::INDICATOR 39
NSAccessibilityImageRole, // roles::GRAPHIC 40
NSAccessibilityStaticTextRole, // roles::STATICTEXT 41
NSAccessibilityStaticTextRole, // roles::TEXT_LEAF 42
NSAccessibilityButtonRole, // roles::PUSHBUTTON 43
NSAccessibilityCheckBoxRole, // roles::CHECKBUTTON 44
NSAccessibilityRadioButtonRole, // roles::RADIOBUTTON 45
NSAccessibilityPopUpButtonRole, // roles::COMBOBOX 46
NSAccessibilityPopUpButtonRole, // roles::DROPLIST 47
NSAccessibilityProgressIndicatorRole, // roles::PROGRESSBAR 48
NSAccessibilityUnknownRole, // roles::DIAL 49
NSAccessibilityUnknownRole, // roles::HOTKEYFIELD 50
NSAccessibilitySliderRole, // roles::SLIDER 51
NSAccessibilityIncrementorRole, // roles::SPINBUTTON 52 Subroles: Increment/Decrement.
NSAccessibilityUnknownRole, // roles::DIAGRAM 53
NSAccessibilityUnknownRole, // roles::ANIMATION 54
NSAccessibilityUnknownRole, // roles::EQUATION 55
NSAccessibilityPopUpButtonRole, // roles::BUTTONDROPDOWN 56
NSAccessibilityMenuButtonRole, // roles::BUTTONMENU 57
NSAccessibilityGroupRole, // roles::BUTTONDROPDOWNGRID 58
NSAccessibilityUnknownRole, // roles::WHITESPACE 59
NSAccessibilityTabGroupRole, // roles::PAGETABLIST 60
NSAccessibilityUnknownRole, // roles::CLOCK 61 Unused on OS X
NSAccessibilityButtonRole, // roles::SPLITBUTTON 62
NSAccessibilityUnknownRole, // roles::IPADDRESS 63
NSAccessibilityStaticTextRole, // roles::ACCEL_LABEL 64
NSAccessibilityUnknownRole, // roles::ARROW 65
NSAccessibilityImageRole, // roles::CANVAS 66
NSAccessibilityMenuItemRole, // roles::CHECK_MENU_ITEM 67
NSAccessibilityColorWellRole, // roles::COLOR_CHOOSER 68
NSAccessibilityUnknownRole, // roles::DATE_EDITOR 69
NSAccessibilityImageRole, // roles::DESKTOP_ICON 70
NSAccessibilityUnknownRole, // roles::DESKTOP_FRAME 71
NSAccessibilityBrowserRole, // roles::DIRECTORY_PANE 72
NSAccessibilityUnknownRole, // roles::FILE_CHOOSER 73 Unused on OS X
NSAccessibilityUnknownRole, // roles::FONT_CHOOSER 74
NSAccessibilityUnknownRole, // roles::CHROME_WINDOW 75 Unused on OS X
NSAccessibilityGroupRole, // roles::GLASS_PANE 76
NSAccessibilityUnknownRole, // roles::HTML_CONTAINER 77
NSAccessibilityImageRole, // roles::ICON 78
NSAccessibilityGroupRole, // roles::LABEL 79
NSAccessibilityGroupRole, // roles::LAYERED_PANE 80
NSAccessibilityGroupRole, // roles::OPTION_PANE 81
NSAccessibilityTextFieldRole, // roles::PASSWORD_TEXT 82
NSAccessibilityUnknownRole, // roles::POPUP_MENU 83 Unused
NSAccessibilityMenuItemRole, // roles::RADIO_MENU_ITEM 84
NSAccessibilityGroupRole, // roles::ROOT_PANE 85
NSAccessibilityScrollAreaRole, // roles::SCROLL_PANE 86
NSAccessibilitySplitGroupRole, // roles::SPLIT_PANE 87
NSAccessibilityUnknownRole, // roles::TABLE_COLUMN_HEADER 88
NSAccessibilityUnknownRole, // roles::TABLE_ROW_HEADER 89
NSAccessibilityMenuItemRole, // roles::TEAR_OFF_MENU_ITEM 90
NSAccessibilityUnknownRole, // roles::TERMINAL 91
NSAccessibilityGroupRole, // roles::TEXT_CONTAINER 92
NSAccessibilityButtonRole, // roles::TOGGLE_BUTTON 93
NSAccessibilityTableRole, // roles::TREE_TABLE 94
NSAccessibilityUnknownRole, // roles::VIEWPORT 95
NSAccessibilityGroupRole, // roles::HEADER 96
NSAccessibilityGroupRole, // roles::FOOTER 97
NSAccessibilityGroupRole, // roles::PARAGRAPH 98
@"AXRuler", // roles::RULER 99 10.4+ only, so we re-define the constant.
NSAccessibilityUnknownRole, // roles::AUTOCOMPLETE 100
NSAccessibilityTextFieldRole, // roles::EDITBAR 101
NSAccessibilityTextFieldRole, // roles::ENTRY 102
NSAccessibilityStaticTextRole, // roles::CAPTION 103
NSAccessibilityScrollAreaRole, // roles::DOCUMENT_FRAME 104
@"AXHeading", // roles::HEADING 105
NSAccessibilityGroupRole, // roles::PAGE 106
NSAccessibilityGroupRole, // roles::SECTION 107
NSAccessibilityUnknownRole, // roles::REDUNDANT_OBJECT 108
NSAccessibilityGroupRole, // roles::FORM 109
NSAccessibilityUnknownRole, // roles::IME 110
NSAccessibilityUnknownRole, // roles::APP_ROOT 111 Unused on OS X
NSAccessibilityMenuItemRole, // roles::PARENT_MENUITEM 112
NSAccessibilityGroupRole, // roles::CALENDAR 113
NSAccessibilityMenuRole, // roles::COMBOBOX_LIST 114
NSAccessibilityMenuItemRole, // roles::COMBOBOX_OPTION 115
NSAccessibilityImageRole, // roles::IMAGE_MAP 116
NSAccessibilityRowRole, // roles::OPTION 117
NSAccessibilityRowRole, // roles::RICH_OPTION 118
NSAccessibilityListRole, // roles::LISTBOX 119
NSAccessibilityUnknownRole, // roles::FLAT_EQUATION 120
NSAccessibilityGroupRole, // roles::GRID_CELL 121
NSAccessibilityGroupRole, // roles::EMBEDDED_OBJECT 122
NSAccessibilityGroupRole, // roles::NOTE 123
NSAccessibilityGroupRole, // roles::FIGURE 124
NSAccessibilityCheckBoxRole, // roles::CHECK_RICH_OPTION 125
NSAccessibilityListRole, // roles::DEFINITION_LIST 126
NSAccessibilityGroupRole, // roles::TERM 127
NSAccessibilityGroupRole, // roles::DEFINITION 128
@"ROLE_LAST_ENTRY" // roles::LAST_ENTRY Bogus role that will never be shown (just marks the end of this array)!
};

Просмотреть файл

@ -52,6 +52,7 @@
#include "nsIAccessibleRelation.h"
#include "Accessible2_i.c"
#include "AccessibleRole.h"
#include "AccessibleStates.h"
#include "nsIMutableArray.h"
@ -65,12 +66,29 @@
#include "nsTextFormatter.h"
#include "nsIView.h"
#include "nsIViewManager.h"
#include "nsRoleMap.h"
#include "nsEventMap.h"
#include "nsArrayUtils.h"
#include "OLEACC.H"
using namespace mozilla;
using namespace mozilla::a11y;
const PRUint32 USE_ROLE_STRING = 0;
#ifndef ROLE_SYSTEM_SPLITBUTTON
const PRUint32 ROLE_SYSTEM_SPLITBUTTON = 0x3e; // Not defined in all oleacc.h versions
#endif
#ifndef ROLE_SYSTEM_IPADDRESS
const PRUint32 ROLE_SYSTEM_IPADDRESS = 0x3f; // Not defined in all oleacc.h versions
#endif
#ifndef ROLE_SYSTEM_OUTLINEBUTTON
const PRUint32 ROLE_SYSTEM_OUTLINEBUTTON = 0x40; // Not defined in all oleacc.h versions
#endif
/* For documentation of the accessibility architecture,
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
*/
@ -374,15 +392,26 @@ __try {
"Does not support nsIAccessibleText when it should");
#endif
roles::Role role = xpAccessible->Role();
PRUint32 msaaRole = gWindowsRoleMap[role].msaaRole;
NS_ASSERTION(gWindowsRoleMap[roles::LAST_ENTRY].msaaRole == ROLE_WINDOWS_LAST_ENTRY,
"MSAA role map skewed");
a11y::role geckoRole = xpAccessible->Role();
PRUint32 msaaRole = 0;
#define ROLE(_geckoRole, stringRole, atkRole, macRole, _msaaRole, ia2Role) \
case roles::_geckoRole: \
msaaRole = _msaaRole; \
break;
switch (geckoRole) {
#include "RoleMap.h"
default:
MOZ_NOT_REACHED("Unknown role.");
};
#undef ROLE
// Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call the MSAA role
// a ROLE_OUTLINEITEM for consistency and compatibility.
// We need this because ARIA has a role of "row" for both grid and treegrid
if (role == roles::ROW) {
if (geckoRole == roles::ROW) {
nsAccessible* xpParent = Parent();
if (xpParent && xpParent->Role() == roles::TREE_TABLE)
msaaRole = ROLE_SYSTEM_OUTLINEITEM;
@ -1202,15 +1231,23 @@ __try {
if (IsDefunct())
return CO_E_OBJNOTCONNECTED;
NS_ASSERTION(gWindowsRoleMap[roles::LAST_ENTRY].ia2Role == ROLE_WINDOWS_LAST_ENTRY,
"MSAA role map skewed");
#define ROLE(_geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role) \
case roles::_geckoRole: \
*aRole = ia2Role; \
break;
roles::Role role = Role();
*aRole = gWindowsRoleMap[role].ia2Role;
a11y::role geckoRole = Role();
switch (geckoRole) {
#include "RoleMap.h"
default:
MOZ_NOT_REACHED("Unknown role.");
};
#undef ROLE
// Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call
// the IA2 role a ROLE_OUTLINEITEM.
if (role == roles::ROW) {
if (geckoRole == roles::ROW) {
nsAccessible* xpParent = Parent();
if (xpParent && xpParent->Role() == roles::TREE_TABLE)
*aRole = ROLE_SYSTEM_OUTLINEITEM;

Просмотреть файл

@ -1,467 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is IBM Corporation
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Gao, Ming <gaoming@cn.ibm.com>
* Aaron Leventhal <aleventh@us.ibm.com>
* Alexander Surkov <surkov.alexander@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "OLEACC.H"
#include "AccessibleRole.h"
const PRUint32 USE_ROLE_STRING = 0;
const PRUint32 ROLE_WINDOWS_LAST_ENTRY = 0xffffffff;
#ifndef ROLE_SYSTEM_SPLITBUTTON
const PRUint32 ROLE_SYSTEM_SPLITBUTTON = 0x3e; // Not defined in all oleacc.h versions
#endif
#ifndef ROLE_SYSTEM_IPADDRESS
const PRUint32 ROLE_SYSTEM_IPADDRESS = 0x3f; // Not defined in all oleacc.h versions
#endif
#ifndef ROLE_SYSTEM_OUTLINEBUTTON
const PRUint32 ROLE_SYSTEM_OUTLINEBUTTON = 0x40; // Not defined in all oleacc.h versions
#endif
struct WindowsRoleMapItem
{
PRUint32 msaaRole;
long ia2Role;
};
// Map array from cross platform roles to MSAA/IA2 roles
static const WindowsRoleMapItem gWindowsRoleMap[] = {
// roles::NOTHING
{ USE_ROLE_STRING, IA2_ROLE_UNKNOWN },
// roles::TITLEBAR
{ ROLE_SYSTEM_TITLEBAR, ROLE_SYSTEM_TITLEBAR },
// roles::MENUBAR
{ ROLE_SYSTEM_MENUBAR, ROLE_SYSTEM_MENUBAR },
// roles::SCROLLBAR
{ ROLE_SYSTEM_SCROLLBAR, ROLE_SYSTEM_SCROLLBAR },
// roles::GRIP
{ ROLE_SYSTEM_GRIP, ROLE_SYSTEM_GRIP },
// roles::SOUND
{ ROLE_SYSTEM_SOUND, ROLE_SYSTEM_SOUND },
// roles::CURSOR
{ ROLE_SYSTEM_CURSOR, ROLE_SYSTEM_CURSOR },
// roles::CARET
{ ROLE_SYSTEM_CARET, ROLE_SYSTEM_CARET },
// roles::ALERT
{ ROLE_SYSTEM_ALERT, ROLE_SYSTEM_ALERT },
// roles::WINDOW
{ ROLE_SYSTEM_WINDOW, ROLE_SYSTEM_WINDOW },
// roles::INTERNAL_FRAME
{ USE_ROLE_STRING, IA2_ROLE_INTERNAL_FRAME},
// roles::MENUPOPUP
{ ROLE_SYSTEM_MENUPOPUP, ROLE_SYSTEM_MENUPOPUP },
// roles::MENUITEM
{ ROLE_SYSTEM_MENUITEM, ROLE_SYSTEM_MENUITEM },
// roles::TOOLTIP
{ ROLE_SYSTEM_TOOLTIP, ROLE_SYSTEM_TOOLTIP },
// roles::APPLICATION
{ ROLE_SYSTEM_APPLICATION, ROLE_SYSTEM_APPLICATION },
// roles::DOCUMENT
{ ROLE_SYSTEM_DOCUMENT, ROLE_SYSTEM_DOCUMENT },
// roles::PANE
// We used to map to ROLE_SYSTEM_PANE, but JAWS would
// not read the accessible name for the contaning pane.
// However, JAWS will read the accessible name for a groupbox.
// By mapping a PANE to a GROUPING, we get no undesirable effects,
// but fortunately JAWS will then read the group's label,
// when an inner control gets focused.
{ ROLE_SYSTEM_GROUPING , ROLE_SYSTEM_GROUPING },
// roles::CHART
{ ROLE_SYSTEM_CHART, ROLE_SYSTEM_CHART },
// roles::DIALOG
{ ROLE_SYSTEM_DIALOG, ROLE_SYSTEM_DIALOG },
// roles::BORDER
{ ROLE_SYSTEM_BORDER, ROLE_SYSTEM_BORDER },
// roles::GROUPING
{ ROLE_SYSTEM_GROUPING, ROLE_SYSTEM_GROUPING },
// roles::SEPARATOR
{ ROLE_SYSTEM_SEPARATOR, ROLE_SYSTEM_SEPARATOR },
// roles::TOOLBAR
{ ROLE_SYSTEM_TOOLBAR, ROLE_SYSTEM_TOOLBAR },
// roles::STATUSBAR
{ ROLE_SYSTEM_STATUSBAR, ROLE_SYSTEM_STATUSBAR },
// roles::TABLE
{ ROLE_SYSTEM_TABLE, ROLE_SYSTEM_TABLE },
// roles::COLUMNHEADER,
{ ROLE_SYSTEM_COLUMNHEADER, ROLE_SYSTEM_COLUMNHEADER },
// roles::ROWHEADER
{ ROLE_SYSTEM_ROWHEADER, ROLE_SYSTEM_ROWHEADER },
// roles::COLUMN
{ ROLE_SYSTEM_COLUMN, ROLE_SYSTEM_COLUMN },
// roles::ROW
{ ROLE_SYSTEM_ROW, ROLE_SYSTEM_ROW },
// roles::CELL
{ ROLE_SYSTEM_CELL, ROLE_SYSTEM_CELL },
// roles::LINK
{ ROLE_SYSTEM_LINK, ROLE_SYSTEM_LINK },
// roles::HELPBALLOON
{ ROLE_SYSTEM_HELPBALLOON, ROLE_SYSTEM_HELPBALLOON },
// roles::CHARACTER
{ ROLE_SYSTEM_CHARACTER, ROLE_SYSTEM_CHARACTER },
// roles::LIST
{ ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },
// roles::LISTITEM
{ ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
// roles::OUTLINE
{ ROLE_SYSTEM_OUTLINE, ROLE_SYSTEM_OUTLINE },
// roles::OUTLINEITEM
{ ROLE_SYSTEM_OUTLINEITEM, ROLE_SYSTEM_OUTLINEITEM },
// roles::PAGETAB
{ ROLE_SYSTEM_PAGETAB, ROLE_SYSTEM_PAGETAB },
// roles::PROPERTYPAGE
{ ROLE_SYSTEM_PROPERTYPAGE, ROLE_SYSTEM_PROPERTYPAGE },
// roles::INDICATOR
{ ROLE_SYSTEM_INDICATOR, ROLE_SYSTEM_INDICATOR },
// roles::GRAPHIC
{ ROLE_SYSTEM_GRAPHIC, ROLE_SYSTEM_GRAPHIC },
// roles::STATICTEXT
{ ROLE_SYSTEM_STATICTEXT, ROLE_SYSTEM_STATICTEXT },
// roles::TEXT_LEAF
{ ROLE_SYSTEM_TEXT, ROLE_SYSTEM_TEXT },
// roles::PUSHBUTTON
{ ROLE_SYSTEM_PUSHBUTTON, ROLE_SYSTEM_PUSHBUTTON },
// roles::CHECKBUTTON
{ ROLE_SYSTEM_CHECKBUTTON, ROLE_SYSTEM_CHECKBUTTON },
// roles::RADIOBUTTON
{ ROLE_SYSTEM_RADIOBUTTON, ROLE_SYSTEM_RADIOBUTTON },
// roles::COMBOBOX
{ ROLE_SYSTEM_COMBOBOX, ROLE_SYSTEM_COMBOBOX },
// roles::DROPLIST
{ ROLE_SYSTEM_DROPLIST, ROLE_SYSTEM_DROPLIST },
// roles::PROGRESSBAR
{ ROLE_SYSTEM_PROGRESSBAR, ROLE_SYSTEM_PROGRESSBAR },
// roles::DIAL
{ ROLE_SYSTEM_DIAL, ROLE_SYSTEM_DIAL },
// roles::HOTKEYFIELD
{ ROLE_SYSTEM_HOTKEYFIELD, ROLE_SYSTEM_HOTKEYFIELD },
// roles::SLIDER
{ ROLE_SYSTEM_SLIDER, ROLE_SYSTEM_SLIDER },
// roles::SPINBUTTON
{ ROLE_SYSTEM_SPINBUTTON, ROLE_SYSTEM_SPINBUTTON },
// roles::DIAGRAM
{ ROLE_SYSTEM_DIAGRAM, ROLE_SYSTEM_DIAGRAM },
// roles::ANIMATION
{ ROLE_SYSTEM_ANIMATION, ROLE_SYSTEM_ANIMATION },
// roles::EQUATION
{ ROLE_SYSTEM_EQUATION, ROLE_SYSTEM_EQUATION },
// roles::BUTTONDROPDOWN
{ ROLE_SYSTEM_BUTTONDROPDOWN, ROLE_SYSTEM_BUTTONDROPDOWN },
// roles::BUTTONMENU
{ ROLE_SYSTEM_BUTTONMENU, ROLE_SYSTEM_BUTTONMENU },
// roles::BUTTONDROPDOWNGRID
{ ROLE_SYSTEM_BUTTONDROPDOWNGRID, ROLE_SYSTEM_BUTTONDROPDOWNGRID },
// roles::WHITESPACE
{ ROLE_SYSTEM_WHITESPACE, ROLE_SYSTEM_WHITESPACE },
// roles::PAGETABLIST
{ ROLE_SYSTEM_PAGETABLIST, ROLE_SYSTEM_PAGETABLIST },
// roles::CLOCK
{ ROLE_SYSTEM_CLOCK, ROLE_SYSTEM_CLOCK },
// roles::SPLITBUTTON
{ ROLE_SYSTEM_SPLITBUTTON, ROLE_SYSTEM_SPLITBUTTON },
// roles::IPADDRESS
{ ROLE_SYSTEM_IPADDRESS, ROLE_SYSTEM_IPADDRESS },
// Make up for Gecko roles that we don't have in MSAA or IA2. When in doubt
// map them to USE_ROLE_STRING (IA2_ROLE_UNKNOWN).
// roles::ACCEL_LABEL
{ ROLE_SYSTEM_STATICTEXT, ROLE_SYSTEM_STATICTEXT },
// roles::ARROW
{ ROLE_SYSTEM_INDICATOR, ROLE_SYSTEM_INDICATOR },
// roles::CANVAS
{ USE_ROLE_STRING, IA2_ROLE_CANVAS },
// roles::CHECK_MENU_ITEM
{ ROLE_SYSTEM_MENUITEM, IA2_ROLE_CHECK_MENU_ITEM },
// roles::COLOR_CHOOSER
{ ROLE_SYSTEM_DIALOG, IA2_ROLE_COLOR_CHOOSER },
// roles::DATE_EDITOR
{ USE_ROLE_STRING, IA2_ROLE_DATE_EDITOR },
// roles::DESKTOP_ICON
{ USE_ROLE_STRING, IA2_ROLE_DESKTOP_ICON },
// roles::DESKTOP_FRAME
{ USE_ROLE_STRING, IA2_ROLE_DESKTOP_PANE },
// roles::DIRECTORY_PANE
{ USE_ROLE_STRING, IA2_ROLE_DIRECTORY_PANE },
// roles::FILE_CHOOSER
{ USE_ROLE_STRING, IA2_ROLE_FILE_CHOOSER },
// roles::FONT_CHOOSER
{ USE_ROLE_STRING, IA2_ROLE_FONT_CHOOSER },
// roles::CHROME_WINDOW
{ ROLE_SYSTEM_APPLICATION, IA2_ROLE_FRAME },
// roles::GLASS_PANE
{ USE_ROLE_STRING, IA2_ROLE_GLASS_PANE },
// roles::HTML_CONTAINER
{ USE_ROLE_STRING, IA2_ROLE_UNKNOWN },
// roles::ICON
{ ROLE_SYSTEM_PUSHBUTTON, IA2_ROLE_ICON },
// roles::LABEL
{ ROLE_SYSTEM_STATICTEXT, IA2_ROLE_LABEL },
// roles::LAYERED_PANE
{ USE_ROLE_STRING, IA2_ROLE_LAYERED_PANE },
// roles::OPTION_PANE
{ USE_ROLE_STRING, IA2_ROLE_OPTION_PANE },
// roles::PASSWORD_TEXT
{ ROLE_SYSTEM_TEXT, ROLE_SYSTEM_TEXT },
// roles::POPUP_MENU
{ ROLE_SYSTEM_MENUPOPUP, ROLE_SYSTEM_MENUPOPUP },
// roles::RADIO_MENU_ITEM
{ ROLE_SYSTEM_MENUITEM, IA2_ROLE_RADIO_MENU_ITEM },
// roles::ROOT_PANE
{ USE_ROLE_STRING, IA2_ROLE_ROOT_PANE },
// roles::SCROLL_PANE
{ USE_ROLE_STRING, IA2_ROLE_SCROLL_PANE },
// roles::SPLIT_PANE
{ USE_ROLE_STRING, IA2_ROLE_SPLIT_PANE },
// roles::TABLE_COLUMN_HEADER
{ ROLE_SYSTEM_COLUMNHEADER, ROLE_SYSTEM_COLUMNHEADER },
// roles::TABLE_ROW_HEADER
{ ROLE_SYSTEM_ROWHEADER, ROLE_SYSTEM_ROWHEADER },
// roles::TEAR_OFF_MENU_ITEM
{ ROLE_SYSTEM_MENUITEM, IA2_ROLE_TEAR_OFF_MENU },
// roles::TERMINAL
{ USE_ROLE_STRING, IA2_ROLE_TERMINAL },
// roles::TEXT_CONTAINER
{ USE_ROLE_STRING, IA2_ROLE_TEXT_FRAME },
// roles::TOGGLE_BUTTON
{ ROLE_SYSTEM_PUSHBUTTON, IA2_ROLE_TOGGLE_BUTTON },
// roles::TREE_TABLE
{ ROLE_SYSTEM_OUTLINE, ROLE_SYSTEM_OUTLINE },
// roles::VIEWPORT
{ ROLE_SYSTEM_PANE, IA2_ROLE_VIEW_PORT },
// roles::HEADER
{ USE_ROLE_STRING, IA2_ROLE_HEADER },
// roles::FOOTER
{ USE_ROLE_STRING, IA2_ROLE_FOOTER },
// roles::PARAGRAPH
{ USE_ROLE_STRING, IA2_ROLE_PARAGRAPH },
// roles::RULER
{ USE_ROLE_STRING, IA2_ROLE_RULER },
// roles::AUTOCOMPLETE
{ ROLE_SYSTEM_COMBOBOX, ROLE_SYSTEM_COMBOBOX },
// roles::EDITBAR
{ ROLE_SYSTEM_TEXT, IA2_ROLE_EDITBAR },
// roles::ENTRY
{ ROLE_SYSTEM_TEXT, ROLE_SYSTEM_TEXT },
// roles::CAPTION
{ USE_ROLE_STRING, IA2_ROLE_CAPTION },
// roles::DOCUMENT_FRAME
{ USE_ROLE_STRING, IA2_ROLE_UNKNOWN },
// roles::HEADING
{ USE_ROLE_STRING, IA2_ROLE_HEADING },
// roles::PAGE
{ USE_ROLE_STRING, IA2_ROLE_PAGE },
// roles::SECTION
{ USE_ROLE_STRING, IA2_ROLE_SECTION },
// roles::REDUNDANT_OBJECT
{ USE_ROLE_STRING, IA2_ROLE_REDUNDANT_OBJECT },
// roles::FORM
{ USE_ROLE_STRING, IA2_ROLE_FORM },
// roles::IME
{ USE_ROLE_STRING, IA2_ROLE_INPUT_METHOD_WINDOW },
// roles::APP_ROOT
{ ROLE_SYSTEM_APPLICATION, ROLE_SYSTEM_APPLICATION },
// roles::PARENT_MENUITEM
{ ROLE_SYSTEM_MENUITEM, ROLE_SYSTEM_MENUITEM },
// roles::CALENDAR
{ ROLE_SYSTEM_CLIENT, ROLE_SYSTEM_CLIENT },
// roles::COMBOBOX_LIST
{ ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },
// roles::COMBOBOX_OPTION
{ ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
// roles::IMAGE_MAP
{ ROLE_SYSTEM_GRAPHIC, ROLE_SYSTEM_GRAPHIC },
// roles::OPTION
{ ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
// roles::RICH_OPTION
{ ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
// roles::LISTBOX
{ ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },
// roles::FLAT_EQUATION
{ ROLE_SYSTEM_EQUATION, ROLE_SYSTEM_EQUATION },
// roles::GRID_CELL
{ ROLE_SYSTEM_CELL, ROLE_SYSTEM_CELL },
// roles::EMBEDDED_OBJECT
{ USE_ROLE_STRING, IA2_ROLE_EMBEDDED_OBJECT },
// roles::NOTE
{ USE_ROLE_STRING, IA2_ROLE_NOTE },
// roles::FIGURE
{ ROLE_SYSTEM_GROUPING, ROLE_SYSTEM_GROUPING },
// roles::CHECK_RICH_OPTION
{ ROLE_SYSTEM_CHECKBUTTON, ROLE_SYSTEM_CHECKBUTTON },
// roles::DEFINITION_LIST
{ ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },
// roles::TERM
{ ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
// roles::DEFINITION
{ USE_ROLE_STRING, IA2_ROLE_PARAGRAPH },
// roles::LAST_ENTRY
{ ROLE_WINDOWS_LAST_ENTRY, ROLE_WINDOWS_LAST_ENTRY }
};

Просмотреть файл

@ -20,7 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alexander Surkov <surkov.alexander@gmail.com> (origianl author)
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),

Просмотреть файл

@ -71,10 +71,13 @@ nsXULTreeAccessible::
mFlags |= eXULTreeAccessible;
mTree = nsCoreUtils::GetTreeBoxObject(aContent);
if (mTree)
mTree->GetView(getter_AddRefs(mTreeView));
NS_ASSERTION(mTree, "Can't get mTree!\n");
NS_ASSERTION(mTree && mTreeView, "Can't get mTree or mTreeView!\n");
if (mTree) {
nsCOMPtr<nsITreeView> treeView;
mTree->GetView(getter_AddRefs(treeView));
mTreeView = treeView;
}
nsIContent* parentContent = mContent->GetParent();
if (parentContent) {
@ -95,14 +98,12 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsXULTreeAccessible)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULTreeAccessible,
nsAccessible)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTree)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTreeView)
CycleCollectorTraverseCache(tmp->mAccessibleCache, &cb);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXULTreeAccessible,
nsAccessible)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTree)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTreeView)
ClearCache(tmp->mAccessibleCache);
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
@ -145,10 +146,11 @@ nsXULTreeAccessible::NativeState()
void
nsXULTreeAccessible::Value(nsString& aValue)
{
// Return the value is the first selected child.
aValue.Truncate();
if (!mTreeView)
return;
// Return the value is the first selected child.
nsCOMPtr<nsITreeSelection> selection;
mTreeView->GetSelection(getter_AddRefs(selection));
if (!selection)
@ -739,13 +741,11 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsXULTreeItemAccessibleBase)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULTreeItemAccessibleBase,
nsAccessible)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTree)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTreeView)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXULTreeItemAccessibleBase,
nsAccessible)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTree)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTreeView)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsXULTreeItemAccessibleBase)

Просмотреть файл

@ -143,7 +143,7 @@ protected:
virtual already_AddRefed<nsAccessible> CreateTreeItemAccessible(PRInt32 aRow);
nsCOMPtr<nsITreeBoxObject> mTree;
nsCOMPtr<nsITreeView> mTreeView;
nsITreeView* mTreeView;
nsAccessibleHashtable mAccessibleCache;
};
@ -244,7 +244,7 @@ protected:
void GetCellName(nsITreeColumn* aColumn, nsAString& aName);
nsCOMPtr<nsITreeBoxObject> mTree;
nsCOMPtr<nsITreeView> mTreeView;
nsITreeView* mTreeView;
PRInt32 mRow;
};

Просмотреть файл

@ -818,14 +818,12 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsXULTreeGridCellAccessible)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULTreeGridCellAccessible,
nsLeafAccessible)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTree)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTreeView)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mColumn)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXULTreeGridCellAccessible,
nsLeafAccessible)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTree)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTreeView)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mColumn)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END

Просмотреть файл

@ -210,7 +210,7 @@ protected:
enum { eAction_Click = 0 };
nsCOMPtr<nsITreeBoxObject> mTree;
nsCOMPtr<nsITreeView> mTreeView;
nsITreeView* mTreeView;
PRInt32 mRow;
nsCOMPtr<nsITreeColumn> mColumn;

Просмотреть файл

@ -73,7 +73,7 @@
// show popup again for the next test
gQueue.push(new synthClick("popupbutton", new nofocusChecker()));
if (MAC) {
if (!MAC) {
// click menubutton of the 'menubutton' button while popup of button open.
gQueue.push(new synthClick("mbb", new focusChecker("mbb"), { where: "right" }));
// close popup, focus stays on menubutton, fire focus event

Просмотреть файл

@ -89,6 +89,11 @@ if [ "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" ]; then
add_makefiles "
build/unix/Makefile
"
if [ "$STDCXX_COMPAT" ]; then
add_makefiles "
build/unix/stdc++compat/Makefile
"
fi
if [ "$USE_ELF_HACK" ]; then
add_makefiles "
build/unix/elfhack/Makefile

Просмотреть файл

@ -138,6 +138,7 @@
@BINPATH@/components/content_canvas.xpt
@BINPATH@/components/content_htmldoc.xpt
@BINPATH@/components/content_html.xpt
@BINPATH@/components/content_media.xpt
@BINPATH@/components/content_xslt.xpt
@BINPATH@/components/content_xtf.xpt
@BINPATH@/components/cookie.xpt
@ -408,6 +409,8 @@
@BINPATH@/components/messageWakeupService.manifest
@BINPATH@/components/SettingsManager.js
@BINPATH@/components/SettingsManager.manifest
@BINPATH@/components/SettingsService.js
@BINPATH@/components/SettingsService.manifest
@BINPATH@/components/nsFilePicker.js
@BINPATH@/components/nsFilePicker.manifest
#ifdef MOZ_B2G_RIL

Просмотреть файл

@ -62,6 +62,10 @@ DEFINES += \
-DAPP_VERSION="$(MOZ_APP_VERSION)" \
-DFIREFOX_ICO=\"$(DIST)/branding/firefox.ico\" \
-DDOCUMENT_ICO=\"$(DIST)/branding/document.ico\" \
-DNEWWINDOW_ICO=\"$(DIST)/branding/newwindow.ico\" \
-DNEWTAB_ICO=\"$(DIST)/branding/newtab.ico\" \
-DPBMODE_ICO=\"$(DIST)/branding/pbmode.ico\" \
$(NULL)
ifdef LIBXUL_SDK #{

Просмотреть файл

@ -1,10 +1,14 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1333739604000">
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1335396801000">
<emItems>
<emItem blockID="i58" id="webmaster@buzzzzvideos.info">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i86" id="{45147e67-4020-47e2-8f7a-55464fb535aa}">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i41" id="{99079a25-328f-4bd4-be04-00955acaa0a7}">
<versionRange minVersion="0.1" maxVersion="4.3.1.00" severity="1">
</versionRange>
@ -81,6 +85,10 @@
<versionRange minVersion="2.0.3" maxVersion="2.0.3">
</versionRange>
</emItem>
<emItem blockID="i83" id="flash@adobee.com">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i59" id="ghostviewer@youtube2.com">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
@ -99,6 +107,10 @@
</emItem>
<emItem blockID="i7" id="{2224e955-00e9-4613-a844-ce69fccaae91}">
</emItem>
<emItem blockID="i84" id="pink@rosaplugin.info">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i67" id="youtube2@youtube2.com">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
@ -161,6 +173,10 @@
<versionRange minVersion="2.2" maxVersion="2.2">
</versionRange>
</emItem>
<emItem blockID="i82" id="{8f42fb8b-b6f6-45de-81c0-d6d39f54f971}">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i19" id="{46551EC9-40F0-4e47-8E18-8E5CF550CFB8}">
<versionRange minVersion="1.1b1" maxVersion="1.1b1">
</versionRange>
@ -196,6 +212,9 @@
<pluginItem blockID="p80">
<match name="description" exp="[^\d\._]((0(\.\d+(\.\d+([_\.]\d+)?)?)?)|(1\.(([0-5](\.\d+([_\.]\d+)?)?)|(6(\.0([_\.](0?\d|1\d|2\d|30))?)?)|(7(\.0([_\.][0-2])?)?))))([^\d\._]|$)" /> <match name="filename" exp="(npjp2\.dll)|(libnpjp2\.so)" /> <versionRange severity="1"></versionRange>
</pluginItem>
<pluginItem blockID="p85">
<match name="filename" exp="JavaPlugin2_NPAPI\.plugin" /> <versionRange minVersion="0" maxVersion="12.9.0" severity="1"></versionRange>
</pluginItem>
</pluginItems>
<gfxItems>

Просмотреть файл

@ -45,6 +45,9 @@
IDI_APPICON ICON FIREFOX_ICO
IDI_DOCUMENT ICON DOCUMENT_ICO
IDI_APPLICATION ICON FIREFOX_ICO
IDI_NEWWINDOW ICON NEWWINDOW_ICO
IDI_NEWTAB ICON NEWTAB_ICO
IDI_PBMODE ICON PBMODE_ICO
STRINGTABLE DISCARDABLE
BEGIN

Просмотреть файл

@ -92,13 +92,17 @@
<field name="tabs" readonly="true">
this.tabContainer.childNodes;
</field>
<property name="visibleTabs" readonly="true">
<getter><![CDATA[
return Array.filter(this.tabs, function(tab) {
return !tab.hidden && !tab.closing;
});
if (!this._visibleTabs)
this._visibleTabs = Array.filter(this.tabs,
function (tab) !tab.hidden && !tab.closing);
return this._visibleTabs;
]]></getter>
</property>
<field name="_visibleTabs">null</field>
<field name="mURIFixup" readonly="true">
Components.classes["@mozilla.org/docshell/urifixup;1"]
.getService(Components.interfaces.nsIURIFixup);
@ -151,9 +155,6 @@
false
#endif
</field>
<field name="_browsers">
null
</field>
<field name="_autoScrollPopup">
null
@ -1240,8 +1241,6 @@
aIsUTF8 = params.isUTF8;
}
this._browsers = null; // invalidate cache
// if we're adding tabs, we're past interrupt mode, ditch the owner
if (this.mCurrentTab.owner)
this.mCurrentTab.owner = null;
@ -1291,10 +1290,11 @@
}, 0, this.tabContainer);
}
this.tabContainer.appendChild(t);
// invalidate cache, because tabContainer is about to change
// invalidate caches
this._browsers = null;
this._visibleTabs = null;
this.tabContainer.appendChild(t);
// If this new tab is owned by another, assert that relationship
if (aOwner)
@ -1625,6 +1625,7 @@
aTab.closing = true;
this._removingTabs.push(aTab);
this._visibleTabs = null; // invalidate cache
if (newTab)
this.addTab(BROWSER_NEW_TAB_URL, {skipAnimation: true});
else
@ -2009,7 +2010,10 @@
<![CDATA[
if (aTab.hidden) {
aTab.removeAttribute("hidden");
this._visibleTabs = null; // invalidate cache
this.tabContainer.adjustTabstrip();
let event = document.createEvent("Events");
event.initEvent("TabShow", true, false);
aTab.dispatchEvent(event);
@ -2025,7 +2029,10 @@
if (!aTab.hidden && !aTab.pinned && !aTab.selected &&
!aTab.closing) {
aTab.setAttribute("hidden", "true");
this._visibleTabs = null; // invalidate cache
this.tabContainer.adjustTabstrip();
let event = document.createEvent("Events");
event.initEvent("TabHide", true, false);
aTab.dispatchEvent(event);
@ -2081,6 +2088,7 @@
]]>
</getter>
</property>
<field name="_browsers">null</field>
<!-- Moves a tab to a new browser window, unless it's already the only tab
in the current window, in which case this will do nothing. -->
@ -2126,11 +2134,14 @@
aIndex = aIndex < aTab._tPos ? aIndex: aIndex+1;
this.mCurrentTab._selected = false;
// invalidate caches
this._browsers = null;
this._visibleTabs = null;
// use .item() instead of [] because dragging to the end of the strip goes out of
// bounds: .item() returns null (so it acts like appendChild), but [] throws
this.tabContainer.insertBefore(aTab, this.tabs.item(aIndex));
// invalidate cache, because tabContainer is about to change
this._browsers = null;
for (let i = 0; i < this.tabs.length; i++) {
this.tabs[i]._tPos = i;

Просмотреть файл

@ -32,7 +32,7 @@ function runAltLeftClickTest() {
}
function runShiftLeftClickTest() {
let listener = new WindowListener("chrome://browser/content/browser.xul", function(aWindow) {
let listener = new WindowListener(getBrowserURL(), function(aWindow) {
Services.wm.removeListener(listener);
addPageShowListener(aWindow.gBrowser, function() {
info("URL should be loaded in a new window");

Просмотреть файл

@ -58,6 +58,9 @@ WINDOWS_BRANDING_FILES = \
wizHeader.bmp \
wizHeaderRTL.bmp \
wizWatermark.bmp \
newwindow.ico \
newtab.ico \
pbmode.ico \
$(NULL)
OSX_BRANDING_FILES = \

Двоичные данные
browser/branding/aurora/newtab.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Двоичные данные
browser/branding/aurora/newwindow.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Двоичные данные
browser/branding/aurora/pbmode.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Просмотреть файл

@ -58,6 +58,9 @@ WINDOWS_BRANDING_FILES = \
wizHeader.bmp \
wizHeaderRTL.bmp \
wizWatermark.bmp \
newwindow.ico \
newtab.ico \
pbmode.ico \
$(NULL)
OSX_BRANDING_FILES = \

Двоичные данные
browser/branding/nightly/newtab.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Двоичные данные
browser/branding/nightly/newwindow.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Двоичные данные
browser/branding/nightly/pbmode.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Просмотреть файл

@ -58,6 +58,9 @@ WINDOWS_BRANDING_FILES = \
wizHeader.bmp \
wizHeaderRTL.bmp \
wizWatermark.bmp \
newwindow.ico \
newtab.ico \
pbmode.ico \
$(NULL)
OSX_BRANDING_FILES = \

Просмотреть файл

@ -1,2 +1 @@
MOZ_APP_DISPLAYNAME=Firefox
MOZ_UA_BUILDID=20100101

Двоичные данные
browser/branding/official/newtab.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Двоичные данные
browser/branding/official/newwindow.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Двоичные данные
browser/branding/official/pbmode.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Просмотреть файл

@ -58,6 +58,9 @@ WINDOWS_BRANDING_FILES = \
wizHeader.bmp \
wizHeaderRTL.bmp \
wizWatermark.bmp \
newwindow.ico \
newtab.ico \
pbmode.ico \
$(NULL)
OSX_BRANDING_FILES = \

Двоичные данные
browser/branding/unofficial/newtab.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Двоичные данные
browser/branding/unofficial/newwindow.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Двоичные данные
browser/branding/unofficial/pbmode.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Просмотреть файл

@ -49,6 +49,7 @@ richlistitem[type="download"]:not([selected]) button {
.downloadCancelMenuItem,
.download-state:not(:-moz-any([state="1"], /* Finished */
[state="2"], /* Failed */
[state="3"], /* Canceled */
[state="6"], /* Blocked (parental) */
[state="8"], /* Blocked (dirty) */

Просмотреть файл

@ -56,18 +56,19 @@ const DownloadsPanel = {
//// Initialization and termination
/**
* State of the downloads panel, based on one of the kPanel constants.
* Internal state of the downloads panel, based on one of the kState
* constants. This is not the same state as the XUL panel element.
*/
_panelState: 0,
_state: 0,
/** Download data has not been loaded. */
get kPanelUninitialized() 0,
/** Download data is loading, but the user interface is invisible. */
get kPanelHidden() 1,
/** The panel is not linked to downloads data yet. */
get kStateUninitialized() 0,
/** This object is linked to data, but the panel is invisible. */
get kStateHidden() 1,
/** The panel will be shown as soon as possible. */
get kPanelShowing() 2,
/** The panel is open, though download data might still be loading. */
get kPanelShown() 3,
get kStateShowing() 2,
/** The panel is open. */
get kStateShown() 3,
/**
* Location of the panel overlay.
@ -84,12 +85,12 @@ const DownloadsPanel = {
*/
initialize: function DP_initialize(aCallback)
{
if (this._panelState != this.kPanelUninitialized) {
if (this._state != this.kStateUninitialized) {
DownloadsOverlayLoader.ensureOverlayLoaded(this.kDownloadsOverlay,
aCallback);
return;
}
this._panelState = this.kPanelHidden;
this._state = this.kStateHidden;
window.addEventListener("unload", this.onWindowUnload, false);
@ -115,7 +116,7 @@ const DownloadsPanel = {
*/
terminate: function DP_terminate()
{
if (this._panelState == this.kPanelUninitialized) {
if (this._state == this.kStateUninitialized) {
return;
}
@ -127,7 +128,7 @@ const DownloadsPanel = {
DownloadsViewController.terminate();
DownloadsCommon.data.removeView(DownloadsView);
this._panelState = this.kPanelUninitialized;
this._state = this.kStateUninitialized;
},
//////////////////////////////////////////////////////////////////////////////
@ -163,7 +164,7 @@ const DownloadsPanel = {
setTimeout(function () DownloadsPanel._openPopupIfDataReady(), 0);
}.bind(this));
this._panelState = this.kPanelShowing;
this._state = this.kStateShowing;
},
/**
@ -181,7 +182,7 @@ const DownloadsPanel = {
// Ensure that we allow the panel to be reopened. Note that, if the popup
// was open, then the onPopupHidden event handler has already updated the
// current state, otherwise we must update the state ourselves.
this._panelState = this.kPanelHidden;
this._state = this.kStateHidden;
},
/**
@ -189,8 +190,8 @@ const DownloadsPanel = {
*/
get isPanelShowing()
{
return this._panelState == this.kPanelShowing ||
this._panelState == this.kPanelShown;
return this._state == this.kStateShowing ||
this._state == this.kStateShown;
},
//////////////////////////////////////////////////////////////////////////////
@ -220,6 +221,8 @@ const DownloadsPanel = {
return;
}
this._state = this.kStateShown;
// Since at most one popup is open at any given time, we can set globally.
DownloadsCommon.indicatorData.attentionSuppressed = true;
@ -246,7 +249,7 @@ const DownloadsPanel = {
DownloadsButton.releaseAnchor();
// Allow the panel to be reopened.
this._panelState = this.kPanelHidden;
this._state = this.kStateHidden;
},
//////////////////////////////////////////////////////////////////////////////
@ -275,7 +278,7 @@ const DownloadsPanel = {
_focusPanel: function DP_focusPanel()
{
// We may be invoked while the panel is still waiting to be shown.
if (this._panelState != this.kPanelShown) {
if (this._state != this.kStateShown) {
return;
}
@ -295,12 +298,10 @@ const DownloadsPanel = {
{
// We don't want to open the popup if we already displayed it, or if we are
// still loading data.
if (this._panelState != this.kPanelShowing || DownloadsView.loading) {
if (this._state != this.kStateShowing || DownloadsView.loading) {
return;
}
this._panelState = this.kPanelShown;
// Make sure that clicking outside the popup cannot reopen it accidentally.
this.panel.popupBoxObject.setConsumeRollupEvent(Ci.nsIPopupBoxObject
.ROLLUP_CONSUME);
@ -308,6 +309,16 @@ const DownloadsPanel = {
// Ensure the anchor is visible. If that is not possible, show the panel
// anchored to the top area of the window, near the default anchor position.
DownloadsButton.getAnchor(function DP_OPIDR_callback(aAnchor) {
// At this point, if the window is minimized, opening the panel could fail
// without any notification, and there would be no way to either open or
// close the panel anymore. To prevent this, check if the window is
// minimized and in that case force the panel to the closed state.
if (window.windowState == Ci.nsIDOMChromeWindow.STATE_MINIMIZED) {
DownloadsButton.releaseAnchor();
this._state = this.kStateHidden;
return;
}
if (aAnchor) {
this.panel.openPopup(aAnchor, "bottomcenter topright", 0, 0, false,
null);

Просмотреть файл

@ -394,11 +394,6 @@ const DownloadsData = {
//////////////////////////////////////////////////////////////////////////////
//// Persistent data loading
/**
* Asynchronous database statement used to read the list of downloads.
*/
_statement: null,
/**
* Represents an executing statement, allowing its cancellation.
*/
@ -455,10 +450,19 @@ const DownloadsData = {
}
} else {
if (this._loadState != this.kLoadAll) {
// Reload the list from the database asynchronously.
this._statement = Services.downloads.DBConnection.createAsyncStatement(
"SELECT * FROM moz_downloads ORDER BY id DESC");
this._pendingStatement = this._statement.executeAsync(this);
// Load only the relevant columns from the downloads database. The
// columns are read in the init_FromDataRow method of DownloadsDataItem.
let statement = Services.downloads.DBConnection.createAsyncStatement(
"SELECT id, target, name, source, referrer, state, "
+ "startTime, endTime, currBytes, maxBytes "
+ "FROM moz_downloads "
+ "ORDER BY id DESC"
);
try {
this._pendingStatement = statement.executeAsync(this);
} finally {
statement.finalize();
}
}
}
},
@ -472,10 +476,6 @@ const DownloadsData = {
this._pendingStatement.cancel();
this._pendingStatement = null;
}
if (this._statement) {
this._statement.finalize();
this._statement = null;
}
// Close all the views on the current data. Create a copy of the array
// because some views might unregister while processing this event.

Просмотреть файл

@ -78,6 +78,11 @@ DownloadsUI.prototype = {
// Show the panel in the most recent browser window, if present.
let browserWin = gBrowserGlue.getMostRecentBrowserWindow();
if (browserWin) {
// The most recent browser window could have been minimized, in that case
// it must be restored to allow the panel to open properly.
if (browserWin.windowState == Ci.nsIDOMChromeWindow.STATE_MINIMIZED) {
browserWin.restore();
}
browserWin.focus();
browserWin.DownloadsPanel.showPanel();
return;

Просмотреть файл

@ -1366,7 +1366,7 @@ FeedWriter.prototype = {
}
var faviconURI = makeURI(readerURI.prePath + "/favicon.ico");
var self = this;
this._faviconService.setAndLoadFaviconForPage(readerURI, faviconURI, false,
this._faviconService.setAndFetchFaviconForPage(readerURI, faviconURI, false,
function (aURI, aDataLen, aData, aMimeType) {
if (aDataLen > 0) {
var dataURL = "data:" + aMimeType + ";base64," +

Просмотреть файл

@ -448,9 +448,8 @@ WebContentConverterRegistrar.prototype = {
// Now Ask the user and provide the proper callback
message = this._getFormattedString("addProtocolHandler",
[aTitle, uri.host, aProtocol]);
var fis = Cc["@mozilla.org/browser/favicon-service;1"].
getService(Ci.nsIFaviconService);
var notificationIcon = fis.getFaviconLinkForIcon(uri);
var notificationIcon = uri.prePath + "/favicon.ico";
var notificationValue = "Protocol Registration: " + aProtocol;
var addButton = {
label: this._getString("addProtocolHandlerAddButton"),

Просмотреть файл

@ -4,7 +4,11 @@ component {4cec1de4-1671-4fc3-a53e-6c539dc77a26} ChromeProfileMigrator.js
contract @mozilla.org/profile/migrator;1?app=browser&type=chrome {4cec1de4-1671-4fc3-a53e-6c539dc77a26}
component {91185366-ba97-4438-acba-48deaca63386} FirefoxProfileMigrator.js
contract @mozilla.org/profile/migrator;1?app=browser&type=firefox {91185366-ba97-4438-acba-48deaca63386}
#ifdef HAS_IE_MIGRATOR
component {3d2532e3-4932-4774-b7ba-968f5899d3a4} IEProfileMigrator.js
contract @mozilla.org/profile/migrator;1?app=browser&type=ie {3d2532e3-4932-4774-b7ba-968f5899d3a4}
#endif
#ifdef HAS_SAFARI_MIGRATOR
component {4b609ecf-60b2-4655-9df4-dc149e474da1} SafariProfileMigrator.js
contract @mozilla.org/profile/migrator;1?app=browser&type=safari {4b609ecf-60b2-4655-9df4-dc149e474da1}
#endif

Просмотреть файл

@ -60,14 +60,16 @@ CPPSRCS += nsIEHistoryEnumerator.cpp
EXTRA_PP_COMPONENTS += IEProfileMigrator.js \
SafariProfileMigrator.js \
$(NULL)
DEFINES += -DHAS_IE_MIGRATOR -DHAS_SAFARI_MIGRATOR
endif
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
EXTRA_PP_COMPONENTS += SafariProfileMigrator.js \
$(NULL)
DEFINES += -DHAS_SAFARI_MIGRATOR
endif
EXTRA_COMPONENTS = \
EXTRA_PP_COMPONENTS += \
BrowserProfileMigrators.manifest \
$(NULL)

Просмотреть файл

@ -68,6 +68,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "BookmarkHTMLUtils",
XPCOMUtils.defineLazyModuleGetter(this, "webappsUI",
"resource:///modules/webappsUI.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PageThumbs",
"resource:///modules/PageThumbs.jsm");
const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser";
const PREF_PLUGINS_UPDATEURL = "plugins.update.url";
@ -358,6 +361,8 @@ BrowserGlue.prototype = {
// Initialize webapps UI
webappsUI.init();
PageThumbs.init();
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
},
@ -379,6 +384,7 @@ BrowserGlue.prototype = {
_onProfileShutdown: function BG__onProfileShutdown() {
this._shutdownPlaces();
this._sanitizer.onShutdown();
PageThumbs.uninit();
},
// All initial windows have opened.

Просмотреть файл

@ -8,6 +8,7 @@
let bg = Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIObserver);
let gOriginalMigrationVersion;
const BROWSER_URL = getBrowserURL();
let localStore = {
get RDF() Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService),
@ -16,10 +17,10 @@ let localStore = {
get toolbar()
{
delete this.toolbar;
let toolbar = this.RDF.GetResource("chrome://browser/content/browser.xul#PersonalToolbar");
let toolbar = this.RDF.GetResource(BROWSER_URL + "#PersonalToolbar");
// Add the entry to the persisted set for this document if it's not there.
// See nsXULDocument::Persist.
let doc = this.RDF.GetResource("chrome://browser/content/browser.xul");
let doc = this.RDF.GetResource(BROWSER_URL);
let persist = this.RDF.GetResource("http://home.netscape.com/NC-rdf#persist");
if (!this.store.HasAssertion(doc, persist, toolbar, true)) {
this.store.Assert(doc, persist, toolbar, true);

Просмотреть файл

@ -133,6 +133,10 @@ PrivateBrowsingService.prototype = {
// Whether private browsing has been turned on from the command line
_lastChangedByCommandLine: false,
// Telemetry measurements
_enterTimestamps: {},
_exitTimestamps: {},
// XPCOM registration
classID: Components.ID("{c31f4883-839b-45f6-82ad-a6a9bc5ad599}"),
@ -308,6 +312,7 @@ PrivateBrowsingService.prototype = {
// restore has been completed
this._currentStatus = STATE_IDLE;
this._obs.notifyObservers(null, "private-browsing-transition-complete", "");
this._recordTransitionTime("completed");
break;
case STATE_WAITING_FOR_RESTORE:
// too soon to notify...
@ -323,6 +328,51 @@ PrivateBrowsingService.prototype = {
}
},
_recordTransitionTime: function PBS__recordTransitionTime(aPhase) {
// To record the time spent in private browsing transitions, note that we
// cannot use the TelemetryStopwatch module, because it reports its results
// immediately when the timer is stopped. In this case, we need to delay
// the actual histogram update after we are out of private browsing mode.
if (this._inPrivateBrowsing) {
this._enterTimestamps[aPhase] = Date.now();
} else {
if (this._quitting) {
// If we are quitting the browser, we don't care collecting the data,
// because we wouldn't be able to record it with telemetry.
return;
}
this._exitTimestamps[aPhase] = Date.now();
if (aPhase == "completed") {
// After we finished exiting the private browsing mode, we can finally
// record the telemetry data, for the enter and the exit processes.
this._reportTelemetry();
}
}
},
_reportTelemetry: function PBS__reportTelemetry() {
function reportTelemetryEntry(aHistogramId, aValue) {
try {
Services.telemetry.getHistogramById(aHistogramId).add(aValue);
} catch (ex) {
Cu.reportError(ex);
}
}
reportTelemetryEntry(
"PRIVATE_BROWSING_TRANSITION_ENTER_PREPARATION_MS",
this._enterTimestamps.prepared - this._enterTimestamps.started);
reportTelemetryEntry(
"PRIVATE_BROWSING_TRANSITION_ENTER_TOTAL_MS",
this._enterTimestamps.completed - this._enterTimestamps.started);
reportTelemetryEntry(
"PRIVATE_BROWSING_TRANSITION_EXIT_PREPARATION_MS",
this._exitTimestamps.prepared - this._exitTimestamps.started);
reportTelemetryEntry(
"PRIVATE_BROWSING_TRANSITION_EXIT_TOTAL_MS",
this._exitTimestamps.completed - this._exitTimestamps.started);
},
_canEnterPrivateBrowsingMode: function PBS__canEnterPrivateBrowsingMode() {
let cancelEnter = Cc["@mozilla.org/supports-PRBool;1"].
createInstance(Ci.nsISupportsPRBool);
@ -537,6 +587,8 @@ PrivateBrowsingService.prototype = {
this._autoStarted = this._prefs.getBoolPref("browser.privatebrowsing.autostart");
this._inPrivateBrowsing = val != false;
this._recordTransitionTime("started");
let data = val ? "enter" : "exit";
let quitting = Cc["@mozilla.org/supports-PRBool;1"].
@ -551,6 +603,8 @@ PrivateBrowsingService.prototype = {
this._obs.notifyObservers(quitting, "private-browsing", data);
this._recordTransitionTime("prepared");
// load the appropriate session
this._onAfterPrivateBrowsingModeChange();
} catch (ex) {

Просмотреть файл

@ -37,7 +37,7 @@
function test() {
// We need to open a new window for this so that its docshell would get destroyed
// when clearing the PB mode flag.
let newWin = window.openDialog("chrome://browser/content/", "_blank", "chrome,all,dialog=no");
let newWin = window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no");
waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
let notificationCount = 0;

Просмотреть файл

@ -0,0 +1,42 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "gPrivateBrowsing",
PRIVATEBROWSING_CONTRACT_ID,
"nsIPrivateBrowsingService");
function waitForTransition(aEnabled, aCallback) {
Services.obs.addObserver(function PBT_transition(aSubject, aTopic, aData) {
Services.obs.removeObserver(PBT_transition, aTopic, false);
// Telemetry data is recorded just after the private browsing transition
// observers are notified, thus we must wait for this observer to return.
do_execute_soon(aCallback);
}, "private-browsing-transition-complete", false);
gPrivateBrowsing.privateBrowsingEnabled = aEnabled;
}
function checkHistogram(aId) {
// Check that we have data either in the first bucket (that doesn't
// count towards the sum) or one of the other buckets, by checking
// the sum of the values.
let snapshot = Services.telemetry.getHistogramById(aId).snapshot();
do_check_true(snapshot.sum > 0 || snapshot.counts[0] > 0);
}
function do_test() {
do_test_pending();
waitForTransition(true, function PBT_enabled() {
waitForTransition(false, function PBT_disabled() {
checkHistogram("PRIVATE_BROWSING_TRANSITION_ENTER_PREPARATION_MS");
checkHistogram("PRIVATE_BROWSING_TRANSITION_ENTER_TOTAL_MS");
checkHistogram("PRIVATE_BROWSING_TRANSITION_EXIT_PREPARATION_MS");
checkHistogram("PRIVATE_BROWSING_TRANSITION_EXIT_TOTAL_MS");
do_test_finished();
});
});
}

Просмотреть файл

@ -0,0 +1,44 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Private Browsing Tests.
*
* The Initial Developer of the Original Code is
* Ehsan Akhgari.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ehsan Akhgari <ehsan.akhgari@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Checks that telemetry data for private browsing transitions is recorded.
function run_test() {
PRIVATEBROWSING_CONTRACT_ID = "@mozilla.org/privatebrowsing;1";
load("do_test_privatebrowsing_telemetry.js");
do_test();
}

Просмотреть файл

@ -0,0 +1,44 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Private Browsing Tests.
*
* The Initial Developer of the Original Code is
* Ehsan Akhgari.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ehsan Akhgari <ehsan.akhgari@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// Checks that telemetry data for private browsing transitions is recorded.
function run_test() {
PRIVATEBROWSING_CONTRACT_ID = "@mozilla.org/privatebrowsing-wrapper;1";
load("do_test_privatebrowsing_telemetry.js");
do_test();
}

Просмотреть файл

@ -12,12 +12,14 @@ tail = tail_privatebrowsing.js
[test_privatebrowsing_autostart.js]
[test_privatebrowsing_commandline.js]
[test_privatebrowsing_exit.js]
[test_privatebrowsing_telemetry.js]
[test_privatebrowsingwrapper_autostart.js]
[test_privatebrowsingwrapper_commandline.js]
[test_privatebrowsingwrapper_exit.js]
[test_privatebrowsingwrapper_placesTitleNoUpdate.js]
[test_privatebrowsingwrapper_removeDataFromDomain.js]
[test_privatebrowsingwrapper_removeDataFromDomain_activeDownloads.js]
[test_privatebrowsingwrapper_telemetry.js]
[test_removeDataFromDomain.js]
[test_removeDataFromDomain_activeDownloads.js]
[test_transition_nooffline.js]

Просмотреть файл

@ -35,36 +35,6 @@
*
* ***** END LICENSE BLOCK ***** */
function provideWindow(aCallback, aURL, aFeatures) {
function callback() {
executeSoon(function () {
aCallback(win);
});
}
let win = openDialog(getBrowserURL(), "", aFeatures || "chrome,all,dialog=no", aURL);
whenWindowLoaded(win, function () {
if (!aURL) {
callback();
return;
}
win.gBrowser.selectedBrowser.addEventListener("load", function() {
win.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
callback();
}, true);
});
}
function whenWindowLoaded(aWin, aCallback) {
aWin.addEventListener("load", function () {
aWin.removeEventListener("load", arguments.callee, false);
executeSoon(function () {
aCallback(aWin);
});
}, false);
}
function test() {
waitForExplicitFinish();
@ -73,12 +43,15 @@ function test() {
let uniqueValue = "unik" + Date.now();
let uniqueText = "pi != " + Math.random();
// Be consistent: let the page actually display, as we are "interacting" with it.
Services.prefs.setBoolPref("general.warnOnAboutConfig", false);
// make sure that the next closed window will increase getClosedWindowCount
let max_windows_undo = gPrefService.getIntPref("browser.sessionstore.max_windows_undo");
gPrefService.setIntPref("browser.sessionstore.max_windows_undo", max_windows_undo + 1);
let max_windows_undo = Services.prefs.getIntPref("browser.sessionstore.max_windows_undo");
Services.prefs.setIntPref("browser.sessionstore.max_windows_undo", max_windows_undo + 1);
let closedWindowCount = ss.getClosedWindowCount();
provideWindow(function (newWin) {
provideWindow(function onTestURLLoaded(newWin) {
newWin.gBrowser.addTab().linkedBrowser.stop();
// mark the window with some unique data to be restored later on
@ -105,28 +78,31 @@ function test() {
// SSTabRestored will fire more than once, so we need to make sure we count them
let restoredTabs = 0;
let expectedTabs = data.tabs.length;
whenWindowLoaded(newWin2, function () {
newWin2.gBrowser.tabContainer.addEventListener("SSTabRestored", function(aEvent) {
if (++restoredTabs < expectedTabs)
return;
newWin2.gBrowser.tabContainer.removeEventListener("SSTabRestored", arguments.callee, true);
newWin2.addEventListener("SSTabRestored", function sstabrestoredListener(aEvent) {
++restoredTabs;
info("Restored tab " + restoredTabs + "/" + expectedTabs);
if (restoredTabs < expectedTabs) {
return;
}
is(newWin2.gBrowser.tabs.length, 2,
"The window correctly restored 2 tabs");
is(newWin2.gBrowser.currentURI.spec, testURL,
"The window correctly restored the URL");
newWin2.removeEventListener("SSTabRestored", sstabrestoredListener, true);
let textbox = newWin2.content.document.getElementById("textbox");
is(textbox.value, uniqueText,
"The window correctly restored the form");
is(ss.getWindowValue(newWin2, uniqueKey), uniqueValue,
"The window correctly restored the data associated with it");
is(newWin2.gBrowser.tabs.length, 2,
"The window correctly restored 2 tabs");
is(newWin2.gBrowser.currentURI.spec, testURL,
"The window correctly restored the URL");
// clean up
newWin2.close();
gPrefService.clearUserPref("browser.sessionstore.max_windows_undo");
finish();
}, true);
});
let textbox = newWin2.content.document.getElementById("textbox");
is(textbox.value, uniqueText,
"The window correctly restored the form");
is(ss.getWindowValue(newWin2, uniqueKey), uniqueValue,
"The window correctly restored the data associated with it");
// clean up
newWin2.close();
Services.prefs.clearUserPref("browser.sessionstore.max_windows_undo");
Services.prefs.clearUserPref("general.warnOnAboutConfig");
finish();
}, true);
}, testURL);
}

Просмотреть файл

@ -35,43 +35,13 @@
*
* ***** END LICENSE BLOCK ***** */
function provideWindow(aCallback, aURL, aFeatures) {
function callback() {
executeSoon(function () {
aCallback(win);
});
}
let win = openDialog(getBrowserURL(), "", aFeatures || "chrome,all,dialog=no", aURL);
whenWindowLoaded(win, function () {
if (!aURL) {
callback();
return;
}
win.gBrowser.selectedBrowser.addEventListener("load", function() {
win.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
callback();
}, true);
});
}
function whenWindowLoaded(aWin, aCallback) {
aWin.addEventListener("load", function () {
aWin.removeEventListener("load", arguments.callee, false);
executeSoon(function () {
aCallback(aWin);
});
}, false);
}
function test() {
// This test takes quite some time, and timeouts frequently, so we require
// more time to run.
// See Bug 518970.
requestLongerTimeout(2);
waitForExplicitFinish();
waitForExplicitFinish();
// helper function that does the actual testing
function openWindowRec(windowsToOpen, expectedResults, recCallback) {
@ -94,13 +64,14 @@ function test() {
executeSoon(recCallback);
return;
}
// hack to force window to be considered a popup (toolbar=no didn't work)
let winData = windowsToOpen.shift();
let settings = "chrome,dialog=no," +
(winData.isPopup ? "all=no" : "all");
let url = "http://example.com/?window=" + windowsToOpen.length;
provideWindow(function (win) {
provideWindow(function onTestURLLoaded(win) {
win.close();
openWindowRec(windowsToOpen, expectedResults, recCallback);
}, url, settings);

Просмотреть файл

@ -93,14 +93,6 @@ let TabsProgressListener = {
}
}
// ----------
function whenWindowLoaded(win, callback) {
win.addEventListener("load", function onLoad() {
win.removeEventListener("load", onLoad, false);
executeSoon(callback);
}, false);
}
// ----------
function newWindowWithState(state, callback) {
let opts = "chrome,all,dialog=no,height=800,width=800";
@ -108,10 +100,10 @@ function newWindowWithState(state, callback) {
registerCleanupFunction(function () win.close());
whenWindowLoaded(win, function () {
TabsProgressListener.init(win);
whenWindowLoaded(win, function onWindowLoaded(aWin) {
TabsProgressListener.init(aWin);
TabsProgressListener.setCallback(callback);
ss.setWindowState(win, JSON.stringify(state), true);
ss.setWindowState(aWin, JSON.stringify(state), true);
});
}

Просмотреть файл

@ -27,14 +27,6 @@ function test() {
});
}
// ----------
function whenWindowLoaded(aWindow, aCallback) {
aWindow.addEventListener("load", function onLoad() {
aWindow.removeEventListener("load", onLoad, false);
executeSoon(aCallback);
}, false);
}
// ----------
function newWindowWithState(aState, aCallback) {
let opts = "chrome,all,dialog=no,height=800,width=800";
@ -42,8 +34,8 @@ function newWindowWithState(aState, aCallback) {
registerCleanupFunction(function () win.close());
whenWindowLoaded(win, function () {
ss.setWindowState(win, JSON.stringify(aState), true);
executeSoon(function () aCallback(win));
whenWindowLoaded(win, function onWindowLoaded(aWin) {
ss.setWindowState(aWin, JSON.stringify(aState), true);
executeSoon(function () aCallback(aWin));
});
}

Просмотреть файл

@ -49,6 +49,28 @@ registerCleanupFunction(function () {
// session restore tests to be run standalone without triggering errors.
Cc["@mozilla.org/browser/clh;1"].getService(Ci.nsIBrowserHandler).defaultArgs;
function provideWindow(aCallback, aURL, aFeatures) {
function callbackSoon(aWindow) {
executeSoon(function executeCallbackSoon() {
aCallback(aWindow);
});
}
let win = openDialog(getBrowserURL(), "", aFeatures || "chrome,all,dialog=no", aURL);
whenWindowLoaded(win, function onWindowLoaded(aWin) {
if (!aURL) {
info("Loaded a blank window.");
callbackSoon(aWin);
return;
}
aWin.gBrowser.selectedBrowser.addEventListener("load", function selectedBrowserLoadListener() {
aWin.gBrowser.selectedBrowser.removeEventListener("load", selectedBrowserLoadListener, true);
callbackSoon(aWin);
}, true);
});
}
// This assumes that tests will at least have some state/entries
function waitForBrowserState(aState, aSetStateCallback) {
let windows = [window];
@ -198,6 +220,15 @@ function whenBrowserLoaded(aBrowser, aCallback) {
}, true);
}
function whenWindowLoaded(aWindow, aCallback) {
aWindow.addEventListener("load", function windowLoadListener() {
aWindow.removeEventListener("load", windowLoadListener, false);
executeSoon(function executeWhenWindowLoaded() {
aCallback(aWindow);
});
}, false);
}
var gUniqueCounter = 0;
function r() {
return Date.now() + "-" + (++gUniqueCounter);

Просмотреть файл

@ -4,7 +4,7 @@
"use strict";
let EXPORTED_SYMBOLS = ["PageThumbs", "PageThumbsCache"];
let EXPORTED_SYMBOLS = ["PageThumbs", "PageThumbsStorage", "PageThumbsCache"];
const Cu = Components.utils;
const Cc = Components.classes;
@ -12,6 +12,11 @@ const Ci = Components.interfaces;
const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
/**
* Name of the directory in the profile that contains the thumbnails.
*/
const THUMBNAIL_DIRECTORY = "thumbnails";
/**
* The default background color for page thumbnails.
*/
@ -25,11 +30,29 @@ XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
XPCOMUtils.defineLazyModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
"resource://gre/modules/FileUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
XPCOMUtils.defineLazyGetter(this, "gCryptoHash", function () {
return Cc["@mozilla.org/security/hash;1"].createInstance(Ci.nsICryptoHash);
});
XPCOMUtils.defineLazyGetter(this, "gUnicodeConverter", function () {
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
.createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = 'utf8';
return converter;
});
/**
* Singleton providing functionality for capturing web page thumbnails and for
* accessing them if already cached.
*/
let PageThumbs = {
_initialized: false,
/**
* The calculated width and height of the thumbnails.
@ -52,6 +75,20 @@ let PageThumbs = {
*/
get contentType() "image/png",
init: function PageThumbs_init() {
if (!this._initialized) {
this._initialized = true;
PlacesUtils.history.addObserver(PageThumbsHistoryObserver, false);
}
},
uninit: function PageThumbs_uninit() {
if (this._initialized) {
this._initialized = false;
PlacesUtils.history.removeObserver(PageThumbsHistoryObserver);
}
},
/**
* Gets the thumbnail image's url for a given web page's url.
* @param aUrl The web page's url that is depicted in the thumbnail.
@ -124,32 +161,14 @@ let PageThumbs = {
// Sync and therefore also redirect sources appear on the newtab
// page. We also want thumbnails for those.
if (url != originalURL)
PageThumbsCache._copy(url, originalURL);
PageThumbsStorage.copy(url, originalURL);
}
if (aCallback)
aCallback(aSuccessful);
}
// Get a writeable cache entry.
PageThumbsCache.getWriteEntry(url, function (aEntry) {
if (!aEntry) {
finish(false);
return;
}
let outputStream = aEntry.openOutputStream(0);
// Write the image data to the cache entry.
NetUtil.asyncCopy(aInputStream, outputStream, function (aResult) {
let success = Components.isSuccessCode(aResult);
if (success)
aEntry.markValid();
aEntry.close();
finish(success);
});
});
PageThumbsStorage.write(url, aInputStream, finish);
});
},
@ -197,7 +216,7 @@ let PageThumbs = {
*/
_getThumbnailSize: function PageThumbs_getThumbnailSize() {
if (!this._thumbnailWidth || !this._thumbnailHeight) {
let screenManager = Cc["@mozilla.org/gfx/screenmanager;1"]
let screenManager = Cc["@mozilla.org/gfx/screenmanager;1"]
.getService(Ci.nsIScreenManager);
let left = {}, top = {}, width = {}, height = {};
screenManager.primaryScreen.GetRect(left, top, width, height);
@ -208,6 +227,88 @@ let PageThumbs = {
}
};
let PageThumbsStorage = {
getFileForURL: function Storage_getFileForURL(aURL) {
let hash = this._calculateMD5Hash(aURL);
let parts = [THUMBNAIL_DIRECTORY, hash[0], hash[1], hash.slice(2) + ".png"];
return FileUtils.getFile("ProfD", parts);
},
write: function Storage_write(aURL, aDataStream, aCallback) {
let file = this.getFileForURL(aURL);
let fos = FileUtils.openSafeFileOutputStream(file);
NetUtil.asyncCopy(aDataStream, fos, function (aResult) {
FileUtils.closeSafeFileOutputStream(fos);
aCallback(Components.isSuccessCode(aResult));
});
},
copy: function Storage_copy(aSourceURL, aTargetURL) {
let sourceFile = this.getFileForURL(aSourceURL);
let targetFile = this.getFileForURL(aTargetURL);
try {
sourceFile.copyTo(targetFile.parent, targetFile.leafName);
} catch (e) {
/* We might not be permitted to write to the file. */
}
},
remove: function Storage_remove(aURL) {
try {
this.getFileForURL(aURL).remove(false);
} catch (e) {
/* The file might not exist or we're not permitted to remove it. */
}
},
wipe: function Storage_wipe() {
try {
FileUtils.getDir("ProfD", [THUMBNAIL_DIRECTORY]).remove(true);
} catch (e) {
/* The file might not exist or we're not permitted to remove it. */
}
},
_calculateMD5Hash: function Storage_calculateMD5Hash(aValue) {
let hash = gCryptoHash;
let value = gUnicodeConverter.convertToByteArray(aValue);
hash.init(hash.MD5);
hash.update(value, value.length);
return this._convertToHexString(hash.finish(false));
},
_convertToHexString: function Storage_convertToHexString(aData) {
let hex = "";
for (let i = 0; i < aData.length; i++)
hex += ("0" + aData.charCodeAt(i).toString(16)).slice(-2);
return hex;
},
};
let PageThumbsHistoryObserver = {
onDeleteURI: function Thumbnails_onDeleteURI(aURI, aGUID) {
PageThumbsStorage.remove(aURI.spec);
},
onClearHistory: function Thumbnails_onClearHistory() {
PageThumbsStorage.wipe();
},
onTitleChanged: function () {},
onBeginUpdateBatch: function () {},
onEndUpdateBatch: function () {},
onVisit: function () {},
onBeforeDeleteURI: function () {},
onPageChanged: function () {},
onDeleteVisits: function () {},
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavHistoryObserver])
};
/**
* A singleton handling the storage of page thumbnails.
*/
@ -222,64 +323,6 @@ let PageThumbsCache = {
this._openCacheEntry(aKey, Ci.nsICache.ACCESS_READ, aCallback);
},
/**
* Calls the given callback with a cache entry opened for writing.
* @param aKey The key identifying the desired cache entry.
* @param aCallback The callback that is called when the cache entry is ready.
*/
getWriteEntry: function Cache_getWriteEntry(aKey, aCallback) {
// Try to open the desired cache entry.
this._openCacheEntry(aKey, Ci.nsICache.ACCESS_WRITE, aCallback);
},
/**
* Copies an existing cache entry's data to a new cache entry.
* @param aSourceKey The key that contains the data to copy.
* @param aTargetKey The key that will be the copy of aSourceKey's data.
*/
_copy: function Cache_copy(aSourceKey, aTargetKey) {
let sourceEntry, targetEntry, waitingCount = 2;
function finish() {
if (sourceEntry)
sourceEntry.close();
if (targetEntry)
targetEntry.close();
}
function copyDataWhenReady() {
if (--waitingCount > 0)
return;
if (!sourceEntry || !targetEntry) {
finish();
return;
}
let inputStream = sourceEntry.openInputStream(0);
let outputStream = targetEntry.openOutputStream(0);
// Copy the image data to a new entry.
NetUtil.asyncCopy(inputStream, outputStream, function (aResult) {
if (Components.isSuccessCode(aResult))
targetEntry.markValid();
finish();
});
}
this.getReadEntry(aSourceKey, function (aSourceEntry) {
sourceEntry = aSourceEntry;
copyDataWhenReady();
});
this.getWriteEntry(aTargetKey, function (aTargetEntry) {
targetEntry = aTargetEntry;
copyDataWhenReady();
});
},
/**
* Opens the cache entry identified by the given key.
* @param aKey The key identifying the desired cache entry.

Просмотреть файл

@ -72,6 +72,14 @@ Protocol.prototype = {
* @return The newly created channel.
*/
newChannel: function Proto_newChannel(aURI) {
let {url} = parseURI(aURI);
let file = PageThumbsStorage.getFileForURL(url);
if (file.exists()) {
let fileuri = Services.io.newFileURI(file);
return Services.io.newChannelFromURI(fileuri);
}
return new Channel(aURI);
},

Просмотреть файл

@ -14,6 +14,7 @@ include $(topsrcdir)/config/rules.mk
_BROWSER_FILES = \
browser_thumbnails_capture.js \
browser_thumbnails_redirect.js \
browser_thumbnails_storage.js \
browser_thumbnails_bug726727.js \
head.js \
background_red.html \

Просмотреть файл

@ -4,9 +4,6 @@
const URL = "http://mochi.test:8888/browser/browser/components/thumbnails/" +
"test/background_red_redirect.sjs";
let cacheService = Cc["@mozilla.org/network/cache-service;1"]
.getService(Ci.nsICacheService);
/**
* These tests ensure that we save and provide thumbnails for redirecting sites.
*/
@ -19,33 +16,17 @@ function runTests() {
yield addTab(URL);
yield captureAndCheckColor(255, 0, 0, "we have a red thumbnail");
// Wait until the referrer's thumbnail's cache entry has been written.
yield whenCacheEntryExists(URL);
// Wait until the referrer's thumbnail's file has been written.
yield whenFileExists(URL);
yield checkThumbnailColor(URL, 255, 0, 0, "referrer has a red thumbnail");
}
function whenCacheEntryExists(aKey) {
function whenFileExists(aURL) {
let callback = next;
checkCacheEntryExists(aKey, function (aExists) {
if (!aExists)
callback = function () whenCacheEntryExists(aKey);
let file = PageThumbsStorage.getFileForURL(aURL);
if (!file.exists())
callback = function () whenFileExists(aURL);
executeSoon(callback);
});
}
function checkCacheEntryExists(aKey, aCallback) {
PageThumbsCache.getReadEntry(aKey, function (aEntry) {
let inputStream = aEntry && aEntry.openInputStream(0);
let exists = inputStream && inputStream.available();
if (inputStream)
inputStream.close();
if (aEntry)
aEntry.close();
aCallback(exists);
});
executeSoon(callback);
}

Просмотреть файл

@ -0,0 +1,89 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const URL = "http://mochi.test:8888/";
const URL_COPY = URL + "#copy";
XPCOMUtils.defineLazyGetter(this, "Sanitizer", function () {
let tmp = {};
Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader)
.loadSubScript("chrome://browser/content/sanitize.js", tmp);
return tmp.Sanitizer;
});
/**
* These tests ensure that the thumbnail storage is working as intended.
* Newly captured thumbnails should be saved as files and they should as well
* be removed when the user sanitizes their history.
*/
function runTests() {
clearHistory();
// create a thumbnail
yield addTab(URL);
yield whenFileExists();
gBrowser.removeTab(gBrowser.selectedTab);
// clear all browser history
yield clearHistory();
// create a thumbnail
yield addTab(URL);
yield whenFileExists();
gBrowser.removeTab(gBrowser.selectedTab);
// make sure copy() updates an existing file
PageThumbsStorage.copy(URL, URL_COPY);
let copy = PageThumbsStorage.getFileForURL(URL_COPY);
let mtime = copy.lastModifiedTime -= 60;
PageThumbsStorage.copy(URL, URL_COPY);
isnot(PageThumbsStorage.getFileForURL(URL_COPY).lastModifiedTime, mtime,
"thumbnail file was updated");
// clear last 10 mins of history
yield clearHistory(true);
ok(!copy.exists(), "copy of thumbnail has been removed");
}
function clearHistory(aUseRange) {
let s = new Sanitizer();
s.prefDomain = "privacy.cpd.";
let prefs = gPrefService.getBranch(s.prefDomain);
prefs.setBoolPref("history", true);
prefs.setBoolPref("downloads", false);
prefs.setBoolPref("cache", false);
prefs.setBoolPref("cookies", false);
prefs.setBoolPref("formdata", false);
prefs.setBoolPref("offlineApps", false);
prefs.setBoolPref("passwords", false);
prefs.setBoolPref("sessions", false);
prefs.setBoolPref("siteSettings", false);
if (aUseRange) {
let usec = Date.now() * 1000;
s.range = [usec - 10 * 60 * 1000 * 1000, usec];
}
s.sanitize();
s.range = null;
executeSoon(function () {
if (PageThumbsStorage.getFileForURL(URL).exists())
clearHistory(aFile, aUseRange);
else
next();
});
}
function whenFileExists() {
let callback = whenFileExists;
let file = PageThumbsStorage.getFileForURL(URL);
if (file.exists() && file.fileSize)
callback = next;
executeSoon(callback);
}

Просмотреть файл

@ -4,7 +4,7 @@
let tmp = {};
Cu.import("resource:///modules/PageThumbs.jsm", tmp);
let PageThumbs = tmp.PageThumbs;
let PageThumbsCache = tmp.PageThumbsCache;
let PageThumbsStorage = tmp.PageThumbsStorage;
registerCleanupFunction(function () {
while (gBrowser.tabs.length > 1)

Просмотреть файл

@ -40,15 +40,13 @@
// Tests that code completion works properly.
const TEST_URI = "chrome://browser/content/browser.xul";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");
});
function test() {
Services.prefs.setBoolPref("devtools.gcli.enable", false);
addTab(TEST_URI);
addTab(getBrowserURL());
browser.addEventListener("DOMContentLoaded", testChrome, false);
}

Просмотреть файл

@ -142,6 +142,7 @@
@BINPATH@/components/content_canvas.xpt
@BINPATH@/components/content_htmldoc.xpt
@BINPATH@/components/content_html.xpt
@BINPATH@/components/content_media.xpt
@BINPATH@/components/content_xslt.xpt
@BINPATH@/components/content_xtf.xpt
@BINPATH@/components/cookie.xpt
@ -637,6 +638,7 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
@BINPATH@/webapprt/chrome/webapprt@JAREXT@
@BINPATH@/webapprt/chrome/webapprt.manifest
@BINPATH@/webapprt/components/CommandLineHandler.js
@BINPATH@/webapprt/components/ContentPolicy.js
@BINPATH@/webapprt/components/DirectoryProvider.js
@BINPATH@/webapprt/components/components.manifest
@BINPATH@/webapprt/defaults/preferences/prefs.js

Просмотреть файл

@ -27,6 +27,9 @@ const PREF_NEWTAB_ENABLED = "browser.newtabpage.enabled";
// The maximum number of results we want to retrieve from history.
const HISTORY_RESULTS_LIMIT = 100;
// The gather telemetry topic.
const TOPIC_GATHER_TELEMETRY = "gather-telemetry";
/**
* Singleton that provides storage functionality.
*/
@ -585,6 +588,47 @@ let Links = {
Ci.nsISupportsWeakReference])
};
/**
* Singleton used to collect telemetry data.
*
*/
let Telemetry = {
/**
* Initializes object.
*/
init: function Telemetry_init() {
Services.obs.addObserver(this, TOPIC_GATHER_TELEMETRY, false);
},
/**
* Collects data.
*/
_collect: function Telemetry_collect() {
let probes = [
{ histogram: "NEWTAB_PAGE_ENABLED",
value: AllPages.enabled },
{ histogram: "NEWTAB_PAGE_PINNED_SITES_COUNT",
value: PinnedLinks.links.length },
{ histogram: "NEWTAB_PAGE_BLOCKED_SITES_COUNT",
value: Object.keys(BlockedLinks.links).length }
];
probes.forEach(function Telemetry_collect_forEach(aProbe) {
Services.telemetry.getHistogramById(aProbe.histogram)
.add(aProbe.value);
});
},
/**
* Listens for gather telemetry topic.
*/
observe: function Telemetry_observe(aSubject, aTopic, aData) {
this._collect();
}
};
Telemetry.init();
/**
* Singleton that provides the public API of this JSM.
*/

Просмотреть файл

@ -141,7 +141,7 @@ var tasksCfg = [
get title() _getString("taskbar.tasks.newTab.label"),
get description() _getString("taskbar.tasks.newTab.description"),
args: "-new-tab about:blank",
iconIndex: 0, // Fx app icon
iconIndex: 3, // New window icon
open: true,
close: true, // The jump list already has an app launch icon, but
// we don't always update the list on shutdown.
@ -153,7 +153,7 @@ var tasksCfg = [
get title() _getString("taskbar.tasks.newWindow.label"),
get description() _getString("taskbar.tasks.newWindow.description"),
args: "-browser",
iconIndex: 0, // Fx app icon
iconIndex: 2, // New tab icon
open: true,
close: true, // No point, but we don't always update the list on
// shutdown. Thus true for consistency.
@ -174,7 +174,7 @@ var tasksCfg = [
return _getString("taskbar.tasks.enterPrivacyMode.description");
},
args: "-private-toggle",
iconIndex: 0, // Fx app icon
iconIndex: 4, // Private browsing mode icon
get open() {
// Don't show when inside permanent private browsing mode
return !_privateBrowsingSvc.autoStarted;

Просмотреть файл

@ -0,0 +1,232 @@
# 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/.
import automationutils
import os
import re
import socket
import shutil
import sys
import tempfile
import time
from automation import Automation
from devicemanager import DeviceManager, NetworkTools
class B2GRemoteAutomation(Automation):
_devicemanager = None
def __init__(self, deviceManager, appName='', remoteLog=None,
marionette=None):
self._devicemanager = deviceManager
self._appName = appName
self._remoteProfile = None
self._remoteLog = remoteLog
self.marionette = marionette
# Default our product to b2g
self._product = "b2g"
Automation.__init__(self)
def setDeviceManager(self, deviceManager):
self._devicemanager = deviceManager
def setAppName(self, appName):
self._appName = appName
def setRemoteProfile(self, remoteProfile):
self._remoteProfile = remoteProfile
def setProduct(self, product):
self._product = product
def setRemoteLog(self, logfile):
self._remoteLog = logfile
# Set up what we need for the remote environment
def environment(self, env=None, xrePath=None, crashreporter=True):
# Because we are running remote, we don't want to mimic the local env
# so no copying of os.environ
if env is None:
env = {}
return env
def checkForCrashes(self, directory, symbolsPath):
# XXX: This will have to be updated after crash reporting on b2g
# is in place.
dumpDir = tempfile.mkdtemp()
self._devicemanager.getDirectory(self._remoteProfile + '/minidumps/', dumpDir)
automationutils.checkForCrashes(dumpDir, symbolsPath, self.lastTestSeen)
try:
shutil.rmtree(dumpDir)
except:
print "WARNING: unable to remove directory: %s" % (dumpDir)
def buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs):
# if remote profile is specified, use that instead
if (self._remoteProfile):
profileDir = self._remoteProfile
cmd, args = Automation.buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs)
return app, args
def getLanIp(self):
nettools = NetworkTools()
return nettools.getLanIp()
def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime,
debuggerInfo, symbolsPath, logger):
""" Wait for mochitest to finish (as evidenced by a signature string
in logcat), or for a given amount of time to elapse with no
output.
"""
timeout = timeout or 120
didTimeout = False
done = time.time() + timeout
while True:
currentlog = proc.stdout
if currentlog:
done = time.time() + timeout
print currentlog
if 'INFO SimpleTest FINISHED' in currentlog:
return 0
else:
if time.time() > done:
self.log.info("TEST-UNEXPECTED-FAIL | %s | application timed "
"out after %d seconds with no output",
self.lastTestSeen, int(timeout))
return 1
def getDeviceStatus(self, serial=None):
# Get the current status of the device. If we know the device
# serial number, we look for that, otherwise we use the (presumably
# only) device shown in 'adb devices'.
serial = serial or self._devicemanager.deviceSerial
status = 'unknown'
for line in self._devicemanager.runCmd(['devices']).stdout.readlines():
result = re.match('(.*?)\t(.*)', line)
if result:
thisSerial = result.group(1)
if not serial or thisSerial == serial:
serial = thisSerial
status = result.group(2)
return (serial, status)
def rebootDevice(self):
# find device's current status and serial number
serial, status = self.getDeviceStatus()
# reboot!
self._devicemanager.checkCmd(['reboot'])
# wait for device to come back to previous status
print 'waiting for device to come back online after reboot'
start = time.time()
rserial, rstatus = self.getDeviceStatus(serial)
while rstatus != 'device':
if time.time() - start > 120:
# device hasn't come back online in 2 minutes, something's wrong
raise Exception("Device %s (status: %s) not back online after reboot" % (serial, rstatus))
time.sleep(5)
rserial, rstatus = self.getDeviceStatus(serial)
print 'device:', serial, 'status:', rstatus
def Process(self, cmd, stdout=None, stderr=None, env=None, cwd=None):
# On a desktop or fennec run, the Process method invokes a gecko
# process in which to run mochitests. For B2G, we simply
# reboot the device (which was configured with a test profile
# already), wait for B2G to start up, and then navigate to the
# test url using Marionette. There doesn't seem to be any way
# to pass env variables into the B2G process, but this doesn't
# seem to matter.
instance = self.B2GInstance(self._devicemanager)
# reboot device so it starts up with the mochitest profile
# XXX: We could potentially use 'stop b2g' + 'start b2g' to achieve
# a similar effect; will see which is more stable while attempting
# to bring up the continuous integration.
self.rebootDevice()
# Infrequently, gecko comes up before networking does, so wait a little
# bit to give the network time to become available.
# XXX: need a more robust mechanism for this
time.sleep(20)
# Set up port forwarding again for Marionette, since any that
# existed previously got wiped out by the reboot.
self._devicemanager.checkCmd(['forward',
'tcp:%s' % self.marionette.port,
'tcp:%s' % self.marionette.port])
# start a marionette session
session = self.marionette.start_session()
if 'b2g' not in session:
raise Exception("bad session value %s returned by start_session" % session)
# start the tests by navigating to the mochitest url
self.marionette.execute_script("window.location.href='%s';" % self.testURL)
return instance
# be careful here as this inner class doesn't have access to outer class members
class B2GInstance(object):
"""Represents a B2G instance running on a device, and exposes
some process-like methods/properties that are expected by the
automation.
"""
def __init__(self, dm):
self.dm = dm
self.lastloglines = []
@property
def pid(self):
# a dummy value to make the automation happy
return 0
@property
def stdout(self):
# Return any part of logcat output that wasn't returned
# previously. This is done by fetching about the last 50
# lines of the log (logcat -t 50 generally fetches 50-58 lines),
# and comparing against the previous set to find new lines.
t = self.dm.runCmd(['logcat', '-t', '50']).stdout.read()
if t == None: return ''
t = t.strip('\n').strip()
loglines = t.split('\n')
line_index = 0
# If there are more than 50 lines, we skip the first 20; this
# is because the number of lines returned
# by logcat -t 50 varies (usually between 50 and 58).
log_index = 20 if len(loglines) > 50 else 0
for index, line in enumerate(loglines[log_index:]):
line_index = index + log_index + 1
try:
self.lastloglines.index(line)
except ValueError:
break
newoutput = '\n'.join(loglines[line_index:])
self.lastloglines = loglines
return newoutput
def wait(self, timeout = None):
# this should never happen
raise Exception("'wait' called on B2GInstance")
def kill(self):
# this should never happen
raise Exception("'kill' called on B2GInstance")

Просмотреть файл

@ -1,41 +1,6 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Test Automation Framework.
#
# The Initial Developer of the Original Code is Joel Maher.
#
# Portions created by the Initial Developer are Copyright (C) 2009
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Joel Maher <joel.maher@gmail.com> (Original Developer)
# Clint Talbert <cmtalbert@gmail.com>
# Mark Cote <mcote@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
# 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/.
import time
import hashlib

Просмотреть файл

@ -1,3 +1,7 @@
# 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/.
import subprocess
from devicemanager import DeviceManager, DMError, _pop_last_line
import re

Просмотреть файл

@ -1,41 +1,6 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Test Automation Framework.
#
# The Initial Developer of the Original Code is Joel Maher.
#
# Portions created by the Initial Developer are Copyright (C) 2009
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Joel Maher <joel.maher@gmail.com> (Original Developer)
# Clint Talbert <cmtalbert@gmail.com>
# Mark Cote <mcote@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
# 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/.
import socket
import SocketServer

Просмотреть файл

@ -1,41 +1,6 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Test Automation Framework.
#
# The Initial Developer of the Original Code is
# Mozilla foundation
#
# Portions created by the Initial Developer are Copyright (C) 2009
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Joel Maher <joel.maher@gmail.com> (Original Developer)
# William Lachance <wlachance@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
# 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/.
from devicemanagerADB import DeviceManagerADB
from devicemanagerSUT import DeviceManagerSUT

Просмотреть файл

@ -137,7 +137,7 @@ public class DoCommand {
String ffxProvider = "org.mozilla.ffxcp";
String fenProvider = "org.mozilla.fencp";
private final String prgVersion = "SUTAgentAndroid Version 1.07";
private final String prgVersion = "SUTAgentAndroid Version 1.08";
public enum Command
{

Просмотреть файл

@ -47,12 +47,18 @@ include $(DEPTH)/config/autoconf.mk
MODULE = build
ifdef STDCXX_COMPAT
DIRS += stdc++compat
endif
ifdef USE_ELF_HACK
DIRS = elfhack
DIRS += elfhack
endif
TEST_DIRS = test
SDK_BINARY = run-mozilla.sh
include $(topsrcdir)/config/rules.mk
libs:: $(srcdir)/run-mozilla.sh

Просмотреть файл

@ -54,7 +54,6 @@ VPATH += $(topsrcdir)/build
HOST_CPPSRCS = \
elf.cpp \
elfhack.cpp \
$(STDCXX_COMPAT) \
$(NULL)
OS_CXXFLAGS := $(filter-out -fno-exceptions,$(OS_CXXFLAGS)) -fexceptions

Просмотреть файл

@ -0,0 +1,28 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = build
LIBRARY_NAME = stdc++compat
HOST_LIBRARY_NAME = host_stdc++compat
FORCE_STATIC_LIB= 1
STL_FLAGS =
NO_EXPAND_LIBS = 1
NO_PROFILE_GUIDED_OPTIMIZE = 1
CPPSRCS = \
stdc++compat.cpp
$(NULL)
HOST_CPPSRCS = $(CPPSRCS)
include $(topsrcdir)/config/rules.mk
CXXFLAGS += -DMOZ_LIBSTDCXX_VERSION=$(MOZ_LIBSTDCXX_TARGET_VERSION)

Просмотреть файл

Просмотреть файл

@ -5,14 +5,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=246699
-->
<head>
<title>Test for Bug 246699</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=246699">Mozilla Bug 246699</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe id="load-frame"></iframe>
<iframe id="load-frame"></iframe>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
@ -21,9 +21,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=246699
** Test for Bug 246699
** (should produce stack information for caps errors)
**/
function isError(e)
{
return e.constructor.name === "Error" || e.constructor.name === "TypeError";
}
function hasStack(e)
{
return e.constructor.name === "Error" && /inciteCaps/.test(e.stack);
return isError(e) && /inciteCaps/.test(e.stack);
}
function inciteCaps(f)

Просмотреть файл

@ -49,6 +49,10 @@ include $(DEPTH)/config/autoconf.mk
# headers, so that we can use it to set up the wrapped system headers.
VISIBILITY_FLAGS =
# STDCXX_COMPAT is not needed here, and will actually fail because
# libstdc++-compat is not built yet.
STDCXX_COMPAT =
HOST_PROGRAM = nsinstall$(HOST_BIN_SUFFIX)
ifeq (WINNT,$(HOST_OS_ARCH))

Просмотреть файл

@ -60,7 +60,6 @@ MOZ_EXTENSION_MANAGER = @MOZ_EXTENSION_MANAGER@
MOZ_APP_UA_NAME = @MOZ_APP_UA_NAME@
MOZ_APP_VERSION = @MOZ_APP_VERSION@
MOZ_APP_MAXVERSION = @MOZ_APP_MAXVERSION@
MOZ_UA_BUILDID = @MOZ_UA_BUILDID@
MOZ_MACBUNDLE_NAME = @MOZ_MACBUNDLE_NAME@
MOZ_APP_STATIC_INI = @MOZ_APP_STATIC_INI@
@ -119,6 +118,7 @@ MOZ_ENABLE_PROFILER_SPS = @MOZ_ENABLE_PROFILER_SPS@
MOZ_JPROF = @MOZ_JPROF@
MOZ_SHARK = @MOZ_SHARK@
MOZ_CALLGRIND = @MOZ_CALLGRIND@
MOZ_VALGRIND = @MOZ_VALGRIND@
MOZ_VTUNE = @MOZ_VTUNE@
MOZ_ETW = @MOZ_ETW@
MOZ_TRACE_JSCALLS = @MOZ_TRACE_JSCALLS@

Просмотреть файл

@ -789,6 +789,9 @@ ifdef STDCXX_COMPAT
ifneq ($(OS_ARCH),Darwin)
CHECK_STDCXX = objdump -p $(1) | grep -e 'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' > /dev/null && echo "TEST-UNEXPECTED-FAIL | | We don't want these libstdc++ symbols to be used:" && objdump -T $(1) | grep -e 'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' && exit 1 || exit 0
endif
EXTRA_LIBS += $(call EXPAND_LIBNAME_PATH,stdc++compat,$(DEPTH)/build/unix/stdc++compat)
HOST_EXTRA_LIBS += $(call EXPAND_LIBNAME_PATH,host_stdc++compat,$(DEPTH)/build/unix/stdc++compat)
endif
# autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including

Просмотреть файл

@ -50,8 +50,5 @@ endif
AUTO_DEPS +=$(GENERATED_DIRS_DEPS)
# Complain loudly if deps have not loaded so getargv != $(NULL)
ifndef getargv
$(error config/makefiles/makeutil.mk has not been included)
endif
$(call requiredfunction,getargv)

Просмотреть файл

@ -5,13 +5,6 @@
# 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/.
# Usage: $(call banner,foo bar tans)
banner =\
$(info )\
$(info ***************************************************************************)\
$(info ** BANNER: $(1) $(2) $(3) $(4) $(5) $(6) $(7) $(8) $(9))\
$(info ***************************************************************************)\
## Identify function argument types
istype =$(if $(value ${1}),list,scalar)
isval =$(if $(filter-out list,$(call istype,${1})),true)
@ -35,6 +28,62 @@ argv +=)
## getarglist() would be a more accurate name but is longer to type
getargv = $(if $(call isvar,$(1)),$($(1)),$(argv))
###########################################################################
# Strip [n] leading options from an argument list. This will allow passing
# extra args to user functions that will not propogate to sub-$(call )'s
# Usage: $(call subargv,2)
subargv =$(wordlist $(1),$(words $(getargv)),$(getargv))
###########################################################################
# Intent: Display a distinct banner heading in the output stream
# Usage: $(call banner,BUILDING: foo bar tans)
# Debug:
# target-preqs = \
# $(call banner,target-preqs-BEGIN) \
# foo bar tans \
# $(call banner,target-preqs-END) \
# $(NULL)
# target: $(target-preqs)
banner =\
$(info )\
$(info ***************************************************************************)\
$(info ** $(getargv))\
$(info ***************************************************************************)\
$(NULL)
#####################################################################
# Intent: Determine if a string or pattern is contained in a list
# Usage: strcmp - $(call if_XinY,clean,$(MAKECMDGOALS))
# : pattern - $(call if_XinY,clean%,$(MAKECMDGOALS))
is_XinY =$(filter $(1),$(call subargv,3,$(getargv)))
#####################################################################
# Provide an alternate var to support testing
ifdef MAKEUTILS_UNIT_TEST
mcg_goals=TEST_MAKECMDGOALS
else
mcg_goals=MAKECMDGOALS
endif
# Intent: Conditionals for detecting common/tier target use
# Todo: are check, install, test needed ?
isTargetStem = $(sort $(foreach pat, $(1)% %$(1), $(call is_XinY,$(pat),${$(mcg_goals)})))
isTargetStemClean = $(call isTargetStem,clean)
isTargetStemExport = $(call isTargetStem,export)
isTargetStemLibs = $(call isTargetStem,libs)
isTargetStemTools = $(call isTargetStem,tools)
##################################################
# Intent: Validation functions / unit test helpers
errorifneq =$(if $(subst $(strip $(1)),$(NULL),$(strip $(2))),$(error expected [$(1)] but found [$(2)]))
# Intent: verify function declaration exists
requiredfunction =$(foreach func,$(1) $(2) $(3) $(4) $(5) $(6) $(7) $(8) $(9),$(if $(value $(func)),$(NULL),$(error required function [$(func)] is unavailable)))
## http://www.gnu.org/software/make/manual/make.html#Call-Function
## Usage: o = $(call map,origin,o map $(MAKE))
map = $(foreach val,$(2),$(call $(1),$(val)))

Просмотреть файл

@ -10,6 +10,8 @@ srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MAKEUTILS_UNIT_TEST = 1
include $(topsrcdir)/config/makefiles/makeutils.mk
##------------------_##
@ -29,9 +31,10 @@ all::
check::
@true
###########################################################################
## Logic processed at compile time so be selective about when to test
ifneq ($(NULL),$(findstring check,$(MAKECMDGOALS))) #{
## Verify istype, isval, isvar, getargv, subargv
ifneq ($(NULL),$(findstring check,$(MAKECMDGOALS))) #
ifdef VERBOSE
@ -45,11 +48,14 @@ $(info Running test: istype, getargv)
$(info ===========================================================================)
endif
## Silent errors are oh so much fun
ifndef istype
$(error makeutils.mk was not included)
ifndef requiredfunction
$(error requiredfunction is not defined)
endif
include $(topsrcdir)/config/makefiles/test/check_XinY.mk
$(call requiredfunc,istype isvar isval)
# arg_scalar = [scalar|literal]
arg_list = foo bar
arg_ref = arg_list
@ -124,4 +130,13 @@ ifdef MANUAL_TEST #{
$(error TEST FAILED: processing should not reach this point)
endif #}
endif #} check in MAKECMDGOALS
# Verify subargv expansion
##########################
subargs=foo bar tans fans
subargs_exp=tans fans
subargs_found=$(call subargv,4,$(subargs))
ifneq ($(subargs_exp),$(subargs_found))
$(error subargv(4,$(subargs)): expected [$(subargs_exp)] found [$(subargs_found)])
endif
endif #} unit_test: istype, isvar, isval, getargv, subargv

Просмотреть файл

@ -0,0 +1,47 @@
# -*- makefile -*-
#
# 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/.
# Verify dependencies are available
$(call requiredfunction,getargv subargv is_XinY errorifneq)
#############################
ifdef VERBOSE
$(warning )
$(call banner,Unit test: is_XinY)
endif
zero := 0
one := 1
# Verify 'invalid' is not matched
val := invalid
$(call errorifneq,$(zero),$(words $(call is_XinY,foo,$(val))))
$(call errorifneq,$(zero),$(words $(call is_XinY,clean,$(val))))
$(call errorifneq,$(zero),$(words $(call is_XinY,clean%,$(val))))
# verify strcmp('clean')
val := clean
$(call errorifneq,$(zero),$(words $(call is_XinY,foo,$(val))))
$(call errorifneq,$(one),$(words $(call is_XinY,clean,$(val))))
$(call errorifneq,$(one,$(words $(call is_XinY,clean%,$(val)))))
$(call errorifneq,$(one),$(words $(call is_XinY,%clean,$(val))))
# List match for 'clean'
val := blah clean distclean FcleanG clean-level-1
wanted := clean distclean clean-level-1
$(call errorifneq,$(zero),$(words $(call is_XinY_debug,foo,$(val))))
$(call errorifneq,$(one),$(words $(call is_XinY,clean,$(val))))
$(call errorifneq,$(one),$(words $(call is_XinY,distclean,$(val))))
# pattern match 'clean'
# match: clean, distclean, clean-level-1
# exclude: FcleanG
TEST_MAKECMDGOALS := $(val)
$(call errorifneq,3,$(words $(call isTargetStemClean)))
TEST_MAKECMDGOALS := invalid
$(call errorifneq,$(zero),$(words $(call isTargetStemClean)))

Просмотреть файл

@ -112,7 +112,7 @@ testxpcsrcdir = $(topsrcdir)/testing/xpcshell
# See also testsuite-targets.mk 'xpcshell-tests' target for global execution.
xpcshell-tests:
$(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
-I$(topsrcdir)/build \
-I$(topsrcdir)/build -I$(DEPTH)/_tests/mozbase/mozinfo \
$(testxpcsrcdir)/runxpcshelltests.py \
--symbols-path=$(DIST)/crashreporter-symbols \
--build-info-json=$(DEPTH)/mozinfo.json \
@ -142,7 +142,7 @@ xpcshell-tests-remote:
# attach a debugger and then start the test.
check-interactive:
$(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
-I$(topsrcdir)/build \
-I$(topsrcdir)/build -I$(DEPTH)/_tests/mozbase/mozinfo \
$(testxpcsrcdir)/runxpcshelltests.py \
--symbols-path=$(DIST)/crashreporter-symbols \
--build-info-json=$(DEPTH)/mozinfo.json \
@ -155,7 +155,7 @@ check-interactive:
# Execute a single test, specified in $(SOLO_FILE)
check-one:
$(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
-I$(topsrcdir)/build \
-I$(topsrcdir)/build -I$(DEPTH)/_tests/mozbase/mozinfo \
$(testxpcsrcdir)/runxpcshelltests.py \
--symbols-path=$(DIST)/crashreporter-symbols \
--build-info-json=$(DEPTH)/mozinfo.json \
@ -826,9 +826,6 @@ endif # NO_PROFILE_GUIDED_OPTIMIZE
##############################################
stdc++compat.$(OBJ_SUFFIX): CXXFLAGS+=-DMOZ_LIBSTDCXX_VERSION=$(MOZ_LIBSTDCXX_TARGET_VERSION)
host_stdc++compat.$(OBJ_SUFFIX): CXXFLAGS+=-DMOZ_LIBSTDCXX_VERSION=$(MOZ_LIBSTDCXX_HOST_VERSION)
checkout:
$(MAKE) -C $(topsrcdir) -f client.mk checkout

Просмотреть файл

@ -310,6 +310,7 @@ if test -n "$gonkdir" ; then
kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
android_source="$gonkdir"
ANDROID_SOURCE="$android_source"
ANDROID_NDK="${ANDROID_SOURCE}/ndk"
dnl set up compilers
AS="$gonk_toolchain_prefix"as
@ -4609,15 +4610,7 @@ MOZ_USE_NATIVE_POPUP_WINDOWS=
MOZ_ANDROID_HISTORY=
MOZ_WEBSMS_BACKEND=
MOZ_GRAPHITE=1
case "${target}" in
*darwin*)
ACCESSIBILITY=
;;
*)
ACCESSIBILITY=1
;;
esac
ACCESSIBILITY=1
case "$target_os" in
mingw*)
@ -5550,10 +5543,9 @@ AC_DEFINE(IBMBIDI)
dnl ========================================================
dnl accessibility support on by default on all platforms
dnl except OS X.
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(accessibility,
[ --disable-accessibility Disable accessibility support (off by default on OS X)],
[ --disable-accessibility Disable accessibility support],
ACCESSIBILITY=,
ACCESSIBILITY=1 )
if test "$ACCESSIBILITY"; then
@ -5835,14 +5827,10 @@ dnl = Check alsa availability on Linux if using sydneyaudio
dnl ========================================================
dnl If using sydneyaudio with Linux, ensure that the alsa library is available
if test -n "$MOZ_SYDNEYAUDIO"; then
case "$target_os" in
linux*)
PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
[echo "$MOZ_ALSA_PKG_ERRORS"
AC_MSG_ERROR([Need alsa for Ogg, Wave or WebM decoding on Linux. Disable with --disable-ogg --disable-wave --disable-webm. (On Ubuntu, you might try installing the package libasound2-dev.)])])
;;
esac
fi
dnl ========================================================
@ -7531,7 +7519,7 @@ dnl ========================================================
STDCXX_COMPAT=
MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
[ --enable-stdcxx-compat Enable compatibility with older libstdc++],
STDCXX_COMPAT=stdc++compat.cpp)
STDCXX_COMPAT=1)
AC_SUBST(STDCXX_COMPAT)
@ -8579,8 +8567,6 @@ AC_SUBST(MOZ_APP_MAXVERSION)
AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
AC_SUBST(FIREFOX_VERSION)
AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
AC_SUBST(MOZ_UA_BUILDID)
# We can't use the static application.ini data when building against
# a libxul SDK.

Просмотреть файл

@ -1372,6 +1372,23 @@ public:
*/
static bool IsSystemPrincipal(nsIPrincipal* aPrincipal);
/**
* *aResourcePrincipal is a principal describing who may access the contents
* of a resource. The resource can only be consumed by a principal that
* subsumes *aResourcePrincipal. MAKE SURE THAT NOTHING EVER ACTS WITH THE
* AUTHORITY OF *aResourcePrincipal.
* It may be null to indicate that the resource has no data from any origin
* in it yet and anything may access the resource.
* Additional data is being mixed into the resource from aExtraPrincipal
* (which may be null; if null, no data is being mixed in and this function
* will do nothing). Update *aResourcePrincipal to reflect the new data.
* If *aResourcePrincipal subsumes aExtraPrincipal, nothing needs to change,
* otherwise *aResourcePrincipal is replaced with the system principal.
* Returns true if *aResourcePrincipal changed.
*/
static bool CombineResourcePrincipals(nsCOMPtr<nsIPrincipal>* aResourcePrincipal,
nsIPrincipal* aExtraPrincipal);
/**
* Trigger a link with uri aLinkURI. If aClick is false, this triggers a
* mouseover on the link, otherwise it triggers a load after doing a

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше