зеркало из https://github.com/mozilla/gecko-dev.git
Bug 779091 - Make Accessible::Init() infallible; r=surkov
This commit is contained in:
Родитель
7522f03eb8
Коммит
e780171a3d
|
@ -572,7 +572,7 @@ toplevel_event_watcher(GSignalInvocationHint* ihint,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
ApplicationAccessibleWrap::Init()
|
||||
{
|
||||
if (ShouldA11yBeEnabled()) {
|
||||
|
@ -615,7 +615,7 @@ ApplicationAccessibleWrap::Init()
|
|||
}
|
||||
}
|
||||
|
||||
return ApplicationAccessible::Init();
|
||||
ApplicationAccessible::Init();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
virtual ~ApplicationAccessibleWrap();
|
||||
|
||||
// nsAccessNode
|
||||
virtual bool Init();
|
||||
virtual void Init();
|
||||
|
||||
// Accessible
|
||||
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
|
||||
|
|
|
@ -388,10 +388,7 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
|
|||
mDocAccessibleCache.Put(aDocument, docAcc);
|
||||
|
||||
// Initialize the document accessible.
|
||||
if (!docAcc->Init()) {
|
||||
docAcc->Shutdown();
|
||||
return nullptr;
|
||||
}
|
||||
docAcc->Init();
|
||||
docAcc->SetRoleMapEntry(aria::GetRoleMap(aDocument));
|
||||
|
||||
// Bind the document to the tree.
|
||||
|
|
|
@ -96,12 +96,7 @@ nsAccessNode::GetApplicationAccessible()
|
|||
// Addref on create. Will Release in ShutdownXPAccessibility()
|
||||
NS_ADDREF(gApplicationAccessible);
|
||||
|
||||
nsresult rv = gApplicationAccessible->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
gApplicationAccessible->Shutdown();
|
||||
NS_RELEASE(gApplicationAccessible);
|
||||
return nullptr;
|
||||
}
|
||||
gApplicationAccessible->Init();
|
||||
}
|
||||
|
||||
return gApplicationAccessible;
|
||||
|
|
|
@ -195,10 +195,9 @@ Accessible::SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry)
|
|||
mRoleMapEntry = aRoleMapEntry;
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
Accessible::Init()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -129,7 +129,7 @@ public:
|
|||
/**
|
||||
* Initialize the accessible.
|
||||
*/
|
||||
virtual bool Init();
|
||||
virtual void Init();
|
||||
|
||||
/**
|
||||
* Get the description of this accessible.
|
||||
|
|
|
@ -268,11 +268,10 @@ ApplicationAccessible::GetPlatformVersion(nsAString& aVersion)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessNode public methods
|
||||
|
||||
bool
|
||||
void
|
||||
ApplicationAccessible::Init()
|
||||
{
|
||||
mAppInfo = do_GetService("@mozilla.org/xre/app-info;1");
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
NS_DECL_NSIACCESSIBLEAPPLICATION
|
||||
|
||||
// nsAccessNode
|
||||
virtual bool Init();
|
||||
virtual void Init();
|
||||
virtual void Shutdown();
|
||||
virtual bool IsPrimaryForNode() const;
|
||||
|
||||
|
|
|
@ -604,7 +604,7 @@ DocAccessible::GetAccessible(nsINode* aNode) const
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessNode
|
||||
|
||||
bool
|
||||
void
|
||||
DocAccessible::Init()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
|
@ -614,8 +614,6 @@ DocAccessible::Init()
|
|||
|
||||
// Initialize notification controller.
|
||||
mNotificationController = new NotificationController(this, mPresShell);
|
||||
if (!mNotificationController)
|
||||
return false;
|
||||
|
||||
// Mark the document accessible as loaded if its DOM document was loaded at
|
||||
// this point (this can happen because a11y is started late or DOM document
|
||||
|
@ -624,7 +622,6 @@ DocAccessible::Init()
|
|||
mLoadState |= eDOMLoaded;
|
||||
|
||||
AddEventListeners();
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1397,12 +1394,7 @@ DocAccessible::BindToDocument(Accessible* aAccessible,
|
|||
mAccessibleCache.Put(aAccessible->UniqueID(), aAccessible);
|
||||
|
||||
// Initialize the accessible.
|
||||
if (!aAccessible->Init()) {
|
||||
NS_ERROR("Failed to initialize an accessible!");
|
||||
|
||||
UnbindFromDocument(aAccessible);
|
||||
return false;
|
||||
}
|
||||
aAccessible->Init();
|
||||
|
||||
aAccessible->SetRoleMapEntry(aRoleMapEntry);
|
||||
if (aAccessible->IsElement())
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
NS_DECL_NSIDOCUMENTOBSERVER
|
||||
|
||||
// nsAccessNode
|
||||
virtual bool Init();
|
||||
virtual void Init();
|
||||
virtual void Shutdown();
|
||||
virtual nsIFrame* GetFrame() const;
|
||||
virtual nsINode* GetNode() const { return mDocument; }
|
||||
|
|
|
@ -1150,14 +1150,11 @@ XULTreeItemAccessible::Name(nsString& aName)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// XULTreeItemAccessible: nsAccessNode implementation
|
||||
|
||||
bool
|
||||
void
|
||||
XULTreeItemAccessible::Init()
|
||||
{
|
||||
if (!XULTreeItemAccessibleBase::Init())
|
||||
return false;
|
||||
|
||||
XULTreeItemAccessibleBase::Init();
|
||||
Name(mCachedName);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -235,7 +235,7 @@ public:
|
|||
XULTreeItemAccessibleBase)
|
||||
|
||||
// nsAccessNode
|
||||
virtual bool Init();
|
||||
virtual void Init();
|
||||
virtual void Shutdown();
|
||||
|
||||
// Accessible
|
||||
|
|
|
@ -779,11 +779,12 @@ XULTreeGridCellAccessible::IsSelected(bool* aIsSelected)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// XULTreeGridCellAccessible: nsAccessNode implementation
|
||||
|
||||
bool
|
||||
void
|
||||
XULTreeGridCellAccessible::Init()
|
||||
{
|
||||
if (!LeafAccessible::Init() || !mTreeView)
|
||||
return false;
|
||||
LeafAccessible::Init();
|
||||
|
||||
NS_ASSERTION(mTreeView, "mTreeView is null");
|
||||
|
||||
PRInt16 type;
|
||||
mColumn->GetType(&type);
|
||||
|
@ -791,8 +792,6 @@ XULTreeGridCellAccessible::Init()
|
|||
mTreeView->GetCellValue(mRow, mColumn, mCachedTextEquiv);
|
||||
else
|
||||
mTreeView->GetCellText(mRow, mColumn, mCachedTextEquiv);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -150,7 +150,7 @@ public:
|
|||
NS_DECL_OR_FORWARD_NSIACCESSIBLETABLECELL_WITH_XPCACCESSIBLETABLECELL
|
||||
|
||||
// nsAccessNode
|
||||
virtual bool Init();
|
||||
virtual void Init();
|
||||
virtual bool IsPrimaryForNode() const;
|
||||
|
||||
// Accessible
|
||||
|
|
Загрузка…
Ссылка в новой задаче