mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 18:08:58 +00:00
Bug 1639399 - expose uniqueID property on the xpcAccessible. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D76072
This commit is contained in:
parent
a49b6359dd
commit
5b6445cb0e
@ -74,6 +74,13 @@ interface nsIAccessible : nsISupports
|
||||
*/
|
||||
readonly attribute long indexInParent;
|
||||
|
||||
/**
|
||||
* The unique identifier of the accessible. ID is only guaranteed to be unique
|
||||
* per document (Windows IDs are unique even across documents, but that is
|
||||
* Windows specific and not exposed to core).
|
||||
*/
|
||||
readonly attribute long long uniqueID;
|
||||
|
||||
/**
|
||||
* The DOM node this nsIAccessible is associated with.
|
||||
*/
|
||||
|
@ -21,6 +21,7 @@ skip-if = (os == "linux" && bits == 64) || (debug && os == "mac") || (debug && o
|
||||
[browser_caching_relations.js]
|
||||
[browser_caching_states.js]
|
||||
[browser_caching_value.js]
|
||||
[browser_caching_uniqueid.js]
|
||||
|
||||
# Events tests
|
||||
[browser_events_announcement.js]
|
||||
|
30
accessible/tests/browser/e10s/browser_caching_uniqueid.js
Normal file
30
accessible/tests/browser/e10s/browser_caching_uniqueid.js
Normal file
@ -0,0 +1,30 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Test UniqueID property.
|
||||
*/
|
||||
addAccessibleTask(
|
||||
'<div id="div"></div>',
|
||||
async function(browser, accDoc) {
|
||||
const div = findAccessibleChildByID(accDoc, "div");
|
||||
const accUniqueID = await invokeContentTask(browser, [], () => {
|
||||
const accService = Cc["@mozilla.org/accessibilityService;1"].getService(
|
||||
Ci.nsIAccessibilityService
|
||||
);
|
||||
|
||||
return accService.getAccessibleFor(content.document.getElementById("div"))
|
||||
.uniqueID;
|
||||
});
|
||||
|
||||
is(
|
||||
accUniqueID,
|
||||
div.uniqueID,
|
||||
"Both proxy and the accessible return correct unique ID."
|
||||
);
|
||||
},
|
||||
{ iframe: true, remoteIframe: true }
|
||||
);
|
@ -161,6 +161,21 @@ xpcAccessible::GetIndexInParent(int32_t* aIndexInParent) {
|
||||
return *aIndexInParent != -1 ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessible::GetUniqueID(int64_t* aUniqueID) {
|
||||
NS_ENSURE_ARG_POINTER(aUniqueID);
|
||||
|
||||
if (IntlGeneric().IsNull()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (IntlGeneric().IsAccessible()) {
|
||||
*aUniqueID = reinterpret_cast<uintptr_t>(Intl()->UniqueID());
|
||||
} else if (IntlGeneric().IsProxy()) {
|
||||
*aUniqueID = IntlGeneric().AsProxy()->ID();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessible::GetDOMNode(nsINode** aDOMNode) {
|
||||
NS_ENSURE_ARG_POINTER(aDOMNode);
|
||||
|
@ -34,6 +34,7 @@ class xpcAccessible : public nsIAccessible {
|
||||
NS_IMETHOD GetChildren(nsIArray** aChildren) final;
|
||||
NS_IMETHOD GetIndexInParent(int32_t* aIndexInParent) final;
|
||||
|
||||
NS_IMETHOD GetUniqueID(int64_t* aUniqueID) final;
|
||||
NS_IMETHOD GetDOMNode(nsINode** aDOMNode) final;
|
||||
NS_IMETHOD GetId(nsAString& aID) final;
|
||||
NS_IMETHOD GetDocument(nsIAccessibleDocument** aDocument) final;
|
||||
|
Loading…
Reference in New Issue
Block a user