Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 106842f

Browse files
committed
Merge mozilla-inbound to mozilla-central. a=merge
2 parents aa63d53 + 5a683f0 commit 106842f

74 files changed

Lines changed: 2971 additions & 2533 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

accessible/base/XULMap.h

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5-
XULMAP(image, New_MaybeImageOrToolbarButtonAccessible)
6-
XULMAP(statusbar, New_StatusBarAccessible)
7-
XULMAP(menuseparator, New_MenuSeparator)
5+
XULMAP_TYPE(menuseparator, XULMenuSeparatorAccessible)
6+
XULMAP_TYPE(statusbar, XULStatusBarAccessible)
7+
8+
XULMAP(
9+
image,
10+
[](nsIContent* aContent, Accessible* aContext) -> Accessible* {
11+
if (aContent->IsElement() &&
12+
aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::onclick)) {
13+
return new XULToolbarButtonAccessible(aContent, aContext->Document());
14+
}
15+
16+
// Don't include nameless images in accessible tree.
17+
if (!aContent->IsElement() ||
18+
!aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext)) {
19+
return nullptr;
20+
}
21+
22+
return new ImageAccessibleWrap(aContent, aContext->Document());
23+
}
24+
)

accessible/base/nsAccessibilityService.cpp

Lines changed: 28 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -272,33 +272,6 @@ New_HTMLTableHeaderCellIfScope(nsIContent* aContent, Accessible* aContext)
272272
return nullptr;
273273
}
274274

275-
#ifdef MOZ_XUL
276-
static Accessible*
277-
New_MaybeImageOrToolbarButtonAccessible(nsIContent* aContent,
278-
Accessible* aContext)
279-
{
280-
if (aContent->IsElement() &&
281-
aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::onclick)) {
282-
return new XULToolbarButtonAccessible(aContent, aContext->Document());
283-
}
284-
285-
// Don't include nameless images in accessible tree.
286-
if (!aContent->IsElement() ||
287-
!aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext)) {
288-
return nullptr;
289-
}
290-
291-
return new ImageAccessibleWrap(aContent, aContext->Document());
292-
}
293-
static Accessible*
294-
New_MenuSeparator(nsIContent* aContent, Accessible* aContext)
295-
{ return new XULMenuSeparatorAccessible(aContent, aContext->Document()); }
296-
297-
static Accessible*
298-
New_StatusBarAccessible(nsIContent* aContent, Accessible* aContext)
299-
{ return new XULStatusBarAccessible(aContent, aContext->Document()); }
300-
#endif
301-
302275
/**
303276
* Cached value of the PREF_ACCESSIBILITY_FORCE_DISABLED preference.
304277
*/
@@ -319,26 +292,35 @@ static int32_t sPlatformDisabledState = 0;
319292
#define MARKUPMAP(atom, new_func, r, ... ) \
320293
{ &nsGkAtoms::atom, new_func, static_cast<a11y::role>(r), { __VA_ARGS__ } },
321294

322-
static const MarkupMapInfo sMarkupMapList[] = {
295+
static const HTMLMarkupMapInfo sHTMLMarkupMapList[] = {
323296
#include "MarkupMap.h"
324297
};
325298

299+
#undef MARKUPMAP
300+
326301
#ifdef MOZ_XUL
327302
#define XULMAP(atom, new_func) \
328303
{ &nsGkAtoms::atom, new_func },
329304

330-
static const XULMarkupMapInfo sXULMapList[] = {
305+
#define XULMAP_TYPE(atom, new_type) \
306+
XULMAP( \
307+
atom, \
308+
[](nsIContent* aContent, Accessible* aContext) -> Accessible* { \
309+
return new new_type(aContent, aContext->Document()); \
310+
} \
311+
)
312+
313+
static const XULMarkupMapInfo sXULMarkupMapList[] = {
331314
#include "XULMap.h"
332315
};
316+
317+
#undef XULMAP_TYPE
318+
#undef XULMAP
333319
#endif
334320

335321
#undef Attr
336322
#undef AttrFromDOM
337323
#undef AttrFromDOMIf
338-
#undef MARKUPMAP
339-
#ifdef MOZ_XUL
340-
#undef XULMAP
341-
#endif
342324

343325
////////////////////////////////////////////////////////////////////////////////
344326
// nsAccessibilityService
@@ -350,9 +332,9 @@ xpcAccessibleApplication* nsAccessibilityService::gXPCApplicationAccessible = nu
350332
uint32_t nsAccessibilityService::gConsumers = 0;
351333

352334
nsAccessibilityService::nsAccessibilityService() :
353-
DocManager(), FocusManager(), mMarkupMaps(ArrayLength(sMarkupMapList))
335+
DocManager(), FocusManager(), mHTMLMarkupMap(ArrayLength(sHTMLMarkupMapList))
354336
#ifdef MOZ_XUL
355-
, mXULMarkupMaps(ArrayLength(sXULMapList))
337+
, mXULMarkupMap(ArrayLength(sXULMarkupMapList))
356338
#endif
357339
{
358340
}
@@ -1170,8 +1152,8 @@ nsAccessibilityService::CreateAccessible(nsINode* aNode,
11701152
frame->AccessibleType() == eHTMLTableRowType ||
11711153
frame->AccessibleType() == eHTMLTableType) {
11721154
// Prefer to use markup to decide if and what kind of accessible to create,
1173-
const MarkupMapInfo* markupMap =
1174-
mMarkupMaps.Get(content->NodeInfo()->NameAtom());
1155+
const HTMLMarkupMapInfo* markupMap =
1156+
mHTMLMarkupMap.Get(content->NodeInfo()->NameAtom());
11751157
if (markupMap && markupMap->new_func)
11761158
newAcc = markupMap->new_func(content, aContext);
11771159

@@ -1234,7 +1216,7 @@ nsAccessibilityService::CreateAccessible(nsINode* aNode,
12341216
#ifdef MOZ_XUL
12351217
// Prefer to use XUL to decide if and what kind of accessible to create.
12361218
const XULMarkupMapInfo* xulMap =
1237-
mXULMarkupMaps.Get(content->NodeInfo()->NameAtom());
1219+
mXULMarkupMap.Get(content->NodeInfo()->NameAtom());
12381220
if (xulMap && xulMap->new_func) {
12391221
newAcc = xulMap->new_func(content, aContext);
12401222
}
@@ -1271,8 +1253,8 @@ nsAccessibilityService::CreateAccessible(nsINode* aNode,
12711253
}
12721254

12731255
} else if (content->IsMathMLElement()) {
1274-
const MarkupMapInfo* markupMap =
1275-
mMarkupMaps.Get(content->NodeInfo()->NameAtom());
1256+
const HTMLMarkupMapInfo* markupMap =
1257+
mHTMLMarkupMap.Get(content->NodeInfo()->NameAtom());
12761258
if (markupMap && markupMap->new_func)
12771259
newAcc = markupMap->new_func(content, aContext);
12781260

@@ -1350,12 +1332,12 @@ nsAccessibilityService::Init()
13501332

13511333
eventListenerService->AddListenerChangeListener(this);
13521334

1353-
for (uint32_t i = 0; i < ArrayLength(sMarkupMapList); i++)
1354-
mMarkupMaps.Put(*sMarkupMapList[i].tag, &sMarkupMapList[i]);
1335+
for (uint32_t i = 0; i < ArrayLength(sHTMLMarkupMapList); i++)
1336+
mHTMLMarkupMap.Put(*sHTMLMarkupMapList[i].tag, &sHTMLMarkupMapList[i]);
13551337

13561338
#ifdef MOZ_XUL
1357-
for (uint32_t i = 0; i < ArrayLength(sXULMapList); i++)
1358-
mXULMarkupMaps.Put(*sXULMapList[i].tag, &sXULMapList[i]);
1339+
for (uint32_t i = 0; i < ArrayLength(sXULMarkupMapList); i++)
1340+
mXULMarkupMap.Put(*sXULMarkupMapList[i].tag, &sXULMarkupMapList[i]);
13591341
#endif
13601342

13611343
#ifdef A11Y_LOG
@@ -1765,8 +1747,8 @@ void
17651747
nsAccessibilityService::MarkupAttributes(const nsIContent* aContent,
17661748
nsIPersistentProperties* aAttributes) const
17671749
{
1768-
const mozilla::a11y::MarkupMapInfo* markupMap =
1769-
mMarkupMaps.Get(aContent->NodeInfo()->NameAtom());
1750+
const mozilla::a11y::HTMLMarkupMapInfo* markupMap =
1751+
mHTMLMarkupMap.Get(aContent->NodeInfo()->NameAtom());
17701752
if (!markupMap)
17711753
return;
17721754

accessible/base/nsAccessibilityService.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ struct MarkupAttrInfo {
6161
nsStaticAtom** DOMAttrValue;
6262
};
6363

64-
struct MarkupMapInfo {
64+
struct HTMLMarkupMapInfo {
6565
nsStaticAtom** tag;
6666
New_Accessible* new_func;
6767
a11y::role role;
@@ -243,8 +243,8 @@ class nsAccessibilityService final : public mozilla::a11y::DocManager,
243243

244244
mozilla::a11y::role MarkupRole(const nsIContent* aContent) const
245245
{
246-
const mozilla::a11y::MarkupMapInfo* markupMap =
247-
mMarkupMaps.Get(aContent->NodeInfo()->NameAtom());
246+
const mozilla::a11y::HTMLMarkupMapInfo* markupMap =
247+
mHTMLMarkupMap.Get(aContent->NodeInfo()->NameAtom());
248248
return markupMap ? markupMap->role : mozilla::a11y::roles::NOTHING;
249249
}
250250

@@ -348,9 +348,9 @@ class nsAccessibilityService final : public mozilla::a11y::DocManager,
348348
*/
349349
static uint32_t gConsumers;
350350

351-
nsDataHashtable<nsPtrHashKey<const nsAtom>, const mozilla::a11y::MarkupMapInfo*> mMarkupMaps;
351+
nsDataHashtable<nsPtrHashKey<const nsAtom>, const mozilla::a11y::HTMLMarkupMapInfo*> mHTMLMarkupMap;
352352
#ifdef MOZ_XUL
353-
nsDataHashtable<nsPtrHashKey<const nsAtom>, const mozilla::a11y::XULMarkupMapInfo*> mXULMarkupMaps;
353+
nsDataHashtable<nsPtrHashKey<const nsAtom>, const mozilla::a11y::XULMarkupMapInfo*> mXULMarkupMap;
354354
#endif
355355

356356
friend nsAccessibilityService* GetAccService();

devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-actual-location.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function test() {
3333
"There are no breakpoints in the editor");
3434

3535
const response = yield actions.addBreakpoint({
36-
actor: gSources.selectedValue, line: 4
36+
actor: gSources.selectedValue, line: 5
3737
});
3838

3939
ok(response.actualLocation, "has an actualLocation");
@@ -42,7 +42,7 @@ function test() {
4242
is(queries.getBreakpoints(gController.getState()).length, 1,
4343
"There is only one breakpoint in the editor");
4444

45-
ok(!queries.getBreakpoint(gController.getState(), { actor: gSources.selectedValue, line: 4 }),
45+
ok(!queries.getBreakpoint(gController.getState(), { actor: gSources.selectedValue, line: 5 }),
4646
"There isn't any breakpoint added on an invalid line.");
4747
ok(queries.getBreakpoint(gController.getState(), { actor: gSources.selectedValue, line: 6 }),
4848
"There isn't any breakpoint added on an invalid line.");

devtools/server/tests/unit/test_blackboxing-01.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ const runTest = Task.async(function* (onSteppedLocation, onDebuggerStatementFram
127127
gClient);
128128
Assert.equal(packet.why.type, "breakpoint");
129129

130-
yield stepIn(gClient, gThreadClient);
131-
yield stepIn(gClient, gThreadClient);
132130
yield stepIn(gClient, gThreadClient);
133131

134132
const location = yield getCurrentLocation();

docshell/base/nsDocShell.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6411,9 +6411,17 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal, int32_t aDel
64116411
*/
64126412
loadInfo->SetReferrer(mCurrentURI);
64136413

6414-
/* Don't ever "guess" on which principal to use to avoid picking
6415-
* the current principal.
6416-
*/
6414+
// Set the triggering pricipal to aPrincipal if available, or current
6415+
// document's principal otherwise.
6416+
nsCOMPtr<nsIPrincipal> principal = aPrincipal;
6417+
if (!principal) {
6418+
nsCOMPtr<nsIDocument> doc = GetDocument();
6419+
if (!doc) {
6420+
return NS_ERROR_FAILURE;
6421+
}
6422+
principal = doc->NodePrincipal();
6423+
}
6424+
loadInfo->SetTriggeringPrincipal(principal);
64176425
loadInfo->SetPrincipalIsExplicit(true);
64186426

64196427
/* Check if this META refresh causes a redirection
@@ -6441,13 +6449,6 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal, int32_t aDel
64416449
loadInfo->SetLoadType(nsIDocShellLoadInfo::loadRefresh);
64426450
}
64436451

6444-
// If the principal is null, the refresh will have a triggeringPrincipal
6445-
// derived from the referrer URI, or will be set to the system principal
6446-
// if there is no refererrer. See LoadURI()
6447-
if (aPrincipal) {
6448-
loadInfo->SetTriggeringPrincipal(aPrincipal);
6449-
}
6450-
64516452
/*
64526453
* LoadURI(...) will cancel all refresh timers... This causes the
64536454
* Timer and its refreshData instance to be released...

docshell/base/nsIRefreshURI.idl

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ interface nsIRefreshURI : nsISupports {
1919
*
2020
* @param aUri The uri to refresh.
2121
* @param aPrincipal The triggeringPrincipal for the refresh load
22-
* May be null, in which case a principal will be built based on the
23-
* referrer URI of the previous docshell load, or will use the system
24-
* principal when there is no referrer.
22+
* May be null, in which case the principal of current document will be
23+
* applied.
2524
* @param aMillis The number of milliseconds to wait.
2625
* @param aRepeat Flag to indicate if the uri is to be
2726
* repeatedly refreshed every aMillis milliseconds.
@@ -36,9 +35,8 @@ interface nsIRefreshURI : nsISupports {
3635
*
3736
* @param aURI The URI to refresh.
3837
* @param aPrincipal The triggeringPrincipal for the refresh load
39-
* May be null, in which case a principal will be built based on the
40-
* referrer URI of the previous docshell load, or will use the system
41-
* principal when there is no referrer.
38+
* May be null, in which case the principal of current document will be
39+
* applied.
4240
* @param aMillis The number of milliseconds by which this refresh would
4341
* be delayed if it were not being forced.
4442
* @param aMetaRefresh Flag to indicate if this is a meta refresh.
@@ -68,9 +66,8 @@ interface nsIRefreshURI : nsISupports {
6866
*
6967
* @param aBaseURI base URI to resolve refresh uri with.
7068
* @param aPrincipal The triggeringPrincipal for the refresh load
71-
* May be null, in which case a principal will be built based on the
72-
* referrer URI of the previous docshell load, or will use the system
73-
* principal when there is no referrer.
69+
* May be null, in which case the principal of current document will be
70+
* applied.
7471
* @param aHeader The meta refresh header string.
7572
*/
7673
void setupRefreshURIFromHeader(in nsIURI aBaseURI,

dom/base/nsDocument.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8816,6 +8816,7 @@ nsDocument::OnPageHide(bool aPersisted,
88168816
mVisible = false;
88178817

88188818
UpdateVisibilityState();
8819+
88198820
EnumerateExternalResources(NotifyPageHide, &aPersisted);
88208821
EnumerateActivityObservers(NotifyActivityChanged, nullptr);
88218822

dom/base/test/unit/test_isequalnode.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* License, v. 2.0. If a copy of the MPL was not distributed with this
44
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
55

6+
Components.utils.importGlobalProperties(["NodeFilter"]);
7+
68
function run_test()
79
{
810
/*
@@ -373,10 +375,10 @@ function test_isEqualNode_wholeDoc()
373375
doc = ParseFile("isequalnode_data.xml");
374376
var doc2 = ParseFile("isequalnode_data.xml");
375377
var tw1 =
376-
doc.createTreeWalker(doc, 0xFFFFFFFF /* NodeFilter.SHOW_ALL */,
378+
doc.createTreeWalker(doc, NodeFilter.SHOW_ALL,
377379
null);
378380
var tw2 =
379-
doc2.createTreeWalker(doc2, 0xFFFFFFFF /* NodeFilter.SHOW_ALL */,
381+
doc2.createTreeWalker(doc2, NodeFilter.SHOW_ALL,
380382
null);
381383
do {
382384
check_eq_nodes(tw1.currentNode, tw2.currentNode);

0 commit comments

Comments
 (0)