Skip to content

Commit

Permalink
Merge pull request #629 from Floorp-Projects/upstream-esr115-20231218…
Browse files Browse the repository at this point in the history
…024531

Pull upstream
  • Loading branch information
surapunoyousei authored Dec 18, 2023
2 parents 9ed942d + 9b81564 commit 2198097
Show file tree
Hide file tree
Showing 269 changed files with 7,823 additions and 5,131 deletions.
1 change: 1 addition & 0 deletions .hgtags
Original file line number Diff line number Diff line change
Expand Up @@ -4391,3 +4391,4 @@ bf2f656d025836975b7bf6aeb16901a037a01923 FIREFOX_115_2_0esr_RELEASE
7e770707fe156fc2e62c5f624235e4b2dadc1e7b FIREFOX_115_4_0esr_RELEASE
8a02a7c43f1eddfd18926f0266d188b4f359c0aa FIREFOX_115_5_0esr_BUILD1
8a02a7c43f1eddfd18926f0266d188b4f359c0aa FIREFOX_115_5_0esr_RELEASE
aa9f02961b2bbb92e17fea5d6b8fd14c097baf72 FIREFOX_115_6_0esr_BUILD1
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 22 additions & 10 deletions accessible/base/AccGroupInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ class CompoundWidgetSiblingRule : public PivotRule {
};

AccGroupInfo::AccGroupInfo(const Accessible* aItem, role aRole)
: mPosInSet(0), mSetSize(0), mParent(nullptr), mItem(aItem), mRole(aRole) {
: mPosInSet(0), mSetSize(0), mParentId(0), mItem(aItem), mRole(aRole) {
MOZ_COUNT_CTOR(AccGroupInfo);
Update();
}

void AccGroupInfo::Update() {
mParent = nullptr;
mParentId = 0;

Accessible* parent = mItem->GetNonGenericParent();
if (!parent) {
Expand Down Expand Up @@ -89,7 +89,7 @@ void AccGroupInfo::Update() {
// (group will be continued).
const int32_t siblingLevel = GetARIAOrDefaultLevel(candidateSibling);
if (siblingLevel < level) {
mParent = candidateSibling;
mParentId = candidateSibling->ID();
break;
}

Expand All @@ -102,7 +102,7 @@ void AccGroupInfo::Update() {
// build group information for this item based on found one.
if (siblingGroupInfo) {
mPosInSet += siblingGroupInfo->mPosInSet;
mParent = siblingGroupInfo->mParent;
mParentId = siblingGroupInfo->mParentId;
mSetSize = siblingGroupInfo->mSetSize;
return;
}
Expand Down Expand Up @@ -142,21 +142,21 @@ void AccGroupInfo::Update() {
// If the next item in the group has calculated group information then
// build group information for this item based on found one.
if (siblingGroupInfo) {
mParent = siblingGroupInfo->mParent;
mParentId = siblingGroupInfo->mParentId;
mSetSize = siblingGroupInfo->mSetSize;
return;
}

mSetSize++;
}

if (mParent) {
if (mParentId) {
return;
}

roles::Role parentRole = parent->Role();
if (ShouldReportRelations(mRole, parentRole)) {
mParent = parent;
mParentId = parent->ID();
}

// ARIA tree and list can be arranged by using ARIA groups to organize levels.
Expand All @@ -177,7 +177,7 @@ void AccGroupInfo::Update() {
CompoundWidgetSiblingRule parentSiblingRule{mRole};
Accessible* parentPrevSibling = pivot.Prev(parent, widgetSiblingRule);
if (parentPrevSibling && parentPrevSibling->Role() == mRole) {
mParent = parentPrevSibling;
mParentId = parentPrevSibling->ID();
return;
}
}
Expand All @@ -188,7 +188,7 @@ void AccGroupInfo::Update() {
if (mRole == roles::LISTITEM || mRole == roles::OUTLINEITEM) {
Accessible* grandParent = parent->GetNonGenericParent();
if (grandParent && grandParent->Role() == mRole) {
mParent = grandParent;
mParentId = grandParent->ID();
}
}
}
Expand Down Expand Up @@ -347,7 +347,7 @@ Accessible* AccGroupInfo::NextItemTo(Accessible* aItem) {
}

size_t AccGroupInfo::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) {
// We don't count mParent or mItem since they (should be) counted
// We don't count mParentId or mItem since they (should be) counted
// as part of the document.
return aMallocSizeOf(this);
}
Expand All @@ -371,6 +371,18 @@ int32_t AccGroupInfo::GetARIAOrDefaultLevel(const Accessible* aAccessible) {
return aAccessible->GetLevel(true);
}

Accessible* AccGroupInfo::ConceptualParent() const {
if (!mParentId) {
// The conceptual parent can never be the document, so id 0 means none.
return nullptr;
}
if (Accessible* doc =
nsAccUtils::DocumentFor(const_cast<Accessible*>(mItem))) {
return nsAccUtils::GetAccessibleByID(doc, mParentId);
}
return nullptr;
}

static role BaseRole(role aRole) {
if (aRole == roles::CHECK_MENU_ITEM || aRole == roles::PARENT_MENUITEM ||
aRole == roles::RADIO_MENU_ITEM) {
Expand Down
4 changes: 2 additions & 2 deletions accessible/base/AccGroupInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AccGroupInfo {
* Return a direct or logical parent of the accessible that this group info is
* created for.
*/
Accessible* ConceptualParent() const { return mParent; }
Accessible* ConceptualParent() const;

/**
* Update group information.
Expand Down Expand Up @@ -90,7 +90,7 @@ class AccGroupInfo {

uint32_t mPosInSet;
uint32_t mSetSize;
Accessible* mParent;
uint64_t mParentId;
const Accessible* mItem;
a11y::role mRole;
};
Expand Down
4 changes: 4 additions & 0 deletions accessible/base/CacheConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ static constexpr RelationData kRelationTypeAtoms[] = {
RelationType::DESCRIPTION_FOR},
{nsGkAtoms::aria_flowto, nullptr, RelationType::FLOWS_TO,
RelationType::FLOWS_FROM},
{nsGkAtoms::aria_details, nullptr, RelationType::DETAILS,
RelationType::DETAILS_FOR},
{nsGkAtoms::aria_errormessage, nullptr, RelationType::ERRORMSG,
RelationType::ERRORMSG_FOR},
};

// The count of numbers needed to serialize an nsRect. This is used when
Expand Down
5 changes: 5 additions & 0 deletions accessible/base/CachedTableAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ CachedTableCellAccessible* CachedTableCellAccessible::GetFrom(
if (auto cellIdx = cachedTable->mAccToCellIdx.Lookup(aAcc)) {
return &cachedTable->mCells[*cellIdx];
}
// We found a table, but it doesn't know about this cell. This can happen
// if a cell is outside of a row due to authoring error. We must not search
// ancestor tables, since this cell's data is not valid there and vice
// versa.
break;
}
return nullptr;
}
Expand Down
7 changes: 7 additions & 0 deletions accessible/base/HTMLMarkupMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,13 @@ MARKUPMAP(
// A <tr> within a row isn't valid.
return nullptr;
}
const nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aElement);
if (roleMapEntry && roleMapEntry->role != roles::NOTHING &&
roleMapEntry->role != roles::ROW) {
// There is a valid ARIA role which isn't "row". Don't treat this as an
// HTML table row.
return nullptr;
}
// Check if this <tr> is within a table. We check the grandparent because
// it might be inside a rowgroup. We don't specifically check for an HTML
// table because there are cases where there is a <tr> inside a
Expand Down
7 changes: 6 additions & 1 deletion accessible/base/nsAccUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,17 @@ LayoutDeviceIntPoint nsAccUtils::GetScreenCoordsForParent(

LayoutDeviceIntPoint nsAccUtils::GetScreenCoordsForWindow(
Accessible* aAccessible) {
LayoutDeviceIntPoint coords(0, 0);
a11y::LocalAccessible* localAcc = aAccessible->AsLocal();
if (!localAcc) {
localAcc = aAccessible->AsRemote()->OuterDocOfRemoteBrowser();
if (!localAcc) {
// This could be null if the tab is closing but the document is still
// being shut down.
return coords;
}
}

LayoutDeviceIntPoint coords(0, 0);
nsCOMPtr<nsIDocShellTreeItem> treeItem(
nsCoreUtils::GetDocShellFor(localAcc->GetNode()));
if (!treeItem) return coords;
Expand Down
4 changes: 3 additions & 1 deletion accessible/generic/LocalAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,9 @@ void LocalAccessible::DOMAttributeChanged(int32_t aNameSpaceID,
}

if (aAttribute == nsGkAtoms::aria_controls ||
aAttribute == nsGkAtoms::aria_flowto) {
aAttribute == nsGkAtoms::aria_flowto ||
aAttribute == nsGkAtoms::aria_details ||
aAttribute == nsGkAtoms::aria_errormessage) {
mDoc->QueueCacheUpdate(this, CacheDomain::Relations);
}

Expand Down
24 changes: 10 additions & 14 deletions accessible/html/HTMLImageMapAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,21 +174,17 @@ nsRect HTMLAreaAccessible::RelativeBounds(nsIFrame** aBoundingFrame) const {
nsRect HTMLAreaAccessible::ParentRelativeBounds() {
nsIFrame* boundingFrame = nullptr;
nsRect relativeBoundsRect = RelativeBounds(&boundingFrame);

nsIFrame* parentBoundingFrame = nullptr;
if (mParent) {
parentBoundingFrame = mParent->GetFrame();
}

if (!parentBoundingFrame) {
// if we can't get the bounding frame, use the pres shell root for the
// bounding frame RelativeBounds returned
parentBoundingFrame =
nsLayoutUtils::GetContainingBlockForClientRect(boundingFrame);
if (MOZ_UNLIKELY(!boundingFrame)) {
// Area is not attached to an image map?
return nsRect();
}

nsLayoutUtils::TransformRect(boundingFrame, parentBoundingFrame,
relativeBoundsRect);

// The relative bounds returned above are relative to this area's
// image map, which is technically already "parent relative".
// Because area elements are `display:none` to layout, they can't
// have transforms or other styling applied directly, and so we
// don't apply any additional transforms here. Any transform
// at the image map layer will be taken care of when computing bounds
// in the parent process.
return relativeBoundsRect;
}
2 changes: 2 additions & 0 deletions accessible/tests/browser/e10s/browser_caching_relations.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const attrRelationsSpec = [
["aria-describedby", RELATION_DESCRIBED_BY, RELATION_DESCRIPTION_FOR],
["aria-controls", RELATION_CONTROLLER_FOR, RELATION_CONTROLLED_BY],
["aria-flowto", RELATION_FLOWS_TO, RELATION_FLOWS_FROM],
["aria-details", RELATION_DETAILS, RELATION_DETAILS_FOR],
["aria-errormessage", RELATION_ERRORMSG, RELATION_ERRORMSG_FOR],
];

/**
Expand Down
26 changes: 26 additions & 0 deletions accessible/tests/browser/e10s/browser_caching_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,3 +504,29 @@ addAccessibleTask(
},
{ chrome: true, topLevel: true }
);

/**
* Verify that we don't crash for authoring error like <tr role="grid">.
*/
addAccessibleTask(
`
<table id="table">
<tr><th>a</th></tr>
<tr role="grid"><td id="b">b</td></tr>
</table>
`,
async function (browser, docAcc) {
const table = findAccessibleChildByID(docAcc, "table", [
nsIAccessibleTable,
]);
is(table.rowCount, 1, "table rowCount correct");
is(table.columnCount, 1, "table columnCount correct");
const b = findAccessibleChildByID(docAcc, "b");
let queryOk = false;
try {
b.QueryInterface(nsIAccessibleTableCell);
queryOk = true;
} catch (e) {}
ok(!queryOk, "No nsIAccessibleTableCell on invalid cell b");
}
);
4 changes: 4 additions & 0 deletions browser/actors/PromptParent.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ export class PromptParent extends JSWindowActorParent {

switch (message.name) {
case "Prompt:Open":
if (!this.windowContext.isCurrentGlobal) {
return undefined;
}

if (
(args.modalType === Ci.nsIPrompt.MODAL_TYPE_CONTENT &&
!lazy.contentPromptSubDialog) ||
Expand Down
7 changes: 0 additions & 7 deletions browser/base/content/browser-fullScreenAndPointerLock.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// This file is loaded into the browser window scope.
/* eslint-env mozilla/browser-window */

const FS_PERM_PROMPT_TIME_SHOWN_OFFSET_MS = 2000;

var PointerlockFsWarning = {
_element: null,
_origin: null,
Expand Down Expand Up @@ -468,11 +466,6 @@ var FullScreen = {
this._permissionNotificationIDs
).filter(n => !n.dismissed).length
) {
if (PopupNotifications.panel.firstChild) {
PopupNotifications.panel.firstChild.notification.timeShown +=
FS_PERM_PROMPT_TIME_SHOWN_OFFSET_MS;
}

this.exitDomFullScreen();
this._logWarningPermissionPromptFS("fullScreenCanceled");
}
Expand Down
2 changes: 2 additions & 0 deletions browser/components/enterprisepolicies/Policies.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1727,6 +1727,8 @@ export var Policies = {
const allowedSecurityPrefs = [
"security.block_fileuri_script_with_wrong_mime",
"security.default_personal_cert",
"security.disable_button.openCertManager",
"security.disable_button.openDeviceManager",
"security.insecure_connection_text.enabled",
"security.insecure_connection_text.pbmode.enabled",
"security.mixed_content.block_active_content",
Expand Down
5 changes: 0 additions & 5 deletions browser/components/extensions/parent/ext-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1057,11 +1057,6 @@ class Window extends WindowBase {
if (window.windowState !== window.STATE_NORMAL) {
window.restore();
}
if (window.windowState !== window.STATE_NORMAL) {
// And on OS-X, where normal vs. maximized is basically a heuristic,
// we need to cheat.
window.sizeToContent();
}
break;

case window.STATE_FULLSCREEN:
Expand Down
Loading

0 comments on commit 2198097

Please sign in to comment.