Commit Graph

2330 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
98ae306275 Bug 1976561 - Remove a noisy warning. r=dom-core,smaug a=me
It is dealt with correctly, and it is somewhat common in tests it seem
to start layout / insert anon content before the doc element is set up.

Differential Revision: https://phabricator.services.mozilla.com/D256770
2025-07-12 13:54:20 +00:00
Emilio Cobos Álvarez
abfb41e00a Bug 1967931 - Avoid blocking rendering for devtools pauses. r=smaug,devtools-reviewers,nchevobbe
This regresses browser_dbg-scroll-run-to-completion.js, but I think we
should either suppress rendering or not suppress it, not doing some
weird in-between thing. So for now given the discussion on the bug it's
probably acceptable.

Differential Revision: https://phabricator.services.mozilla.com/D250772
2025-05-24 10:14:39 +00:00
Emilio Cobos Álvarez
8ff4a65ffa Bug 1967507 - Simplify custom content container set-up. r=smaug,devtools-reviewers,nchevobbe
I haven't been able to reproduce this locally, but I see what's going
on, and I think we could do better.

This avoids the frame flush from nsCanvasFrame::CreateAnonymousContent,
and in general makes the anonymous content timing a lot more reasonable
(see the FlushPendingNotifications call that's getting removed).

The ServoStyleSet changes are needed now that there are multiple style
roots that can be unstyled like that.

It also simplifies the API as now it's not dependent on having a canvas
frame around (and thus doesn't need to flush layout).

Differential Revision: https://phabricator.services.mozilla.com/D250531
2025-05-22 13:06:12 +00:00
Emilio Cobos Álvarez
5edae9ae71 Bug 1967507 - Remove Document::GetAnonRootIfInAnonymousContentContainer. r=smaug
These bits are not needed now that AnonymousContent uses shadow DOM.

Differential Revision: https://phabricator.services.mozilla.com/D250530
2025-05-22 08:25:34 +00:00
Emilio Cobos Álvarez
fbec8c512f Bug 1966679 - Skip view transition and co in all the code paths on which the root node goes away. r=smaug,view-transitions-reviewers,boris
Document::Open() calls DisconnectNodeTree(), which doesn't go through
RemoveChildNode() where we were skipping the transition. We still need
to disconnect the anon content tree there.

Differential Revision: https://phabricator.services.mozilla.com/D250475
2025-05-21 23:59:46 +00:00
Keith Cirkel
ef6d37b772 Bug 1966908 - null mCloseWatcher when HidePopover is called r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D249770
2025-05-19 11:21:11 +00:00
Sylvestre Ledru
8ae54ea4f9 Bug 1519636 - Reformat recent changes to the Google coding style r=geckoview-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,nalexander,gstoll,tcampbell,janv,julienw
Updated with clang-format version 19.1.7 (taskcluster-DYvBxDZJRVqTi8E7pTSJAQ)

Differential Revision: https://phabricator.services.mozilla.com/D249880
2025-05-17 19:11:13 +00:00
Tom Schuster
8e276e9732 Bug 1965760 - Document.parseHTMLUnsafe should create an inert/loaded-as-data document. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D249258
2025-05-16 14:31:15 +00:00
Tom Schuster
aceb72f7f9 Bug 1966027 - Document.parseHTMLUnsafe shouldn't sanitize as safe. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D249035
2025-05-13 12:33:25 +00:00
Tom Schuster
555d134488 Bug 1966023 - Call parseHTML/Unsafe on document. r=emilio
Implements https://github.com/WICG/sanitizer-api/pull/289

Differential Revision: https://phabricator.services.mozilla.com/D249034
2025-05-13 09:47:18 +00:00
Rob Wu
a8a18a8279 Bug 1961064 - Fix order of windowUtils.addSheet r=emilio
When `addSheet` is used and `mStyleSetFilled` is true in
`Document::AddAdditionalStyleSheet`, then the stylesheets are appended
in the expected order.

When `mStyleSetFilled` is false, it is populated later via
`Document::FillStyleSet`, in `Document::FillStyleSetDocumentSheets`.
Before this patch (already since inception in bug 804120), the order was
reversed, which sometimes causes observably different results.

This patch fixes the issue by appending them in order.

Differential Revision: https://phabricator.services.mozilla.com/D248722
2025-05-13 01:50:31 +00:00
Keith Cirkel
89443199a7 Bug 1965042 - Ensure closedby=none blocks Esc key r=edgar,dom-core
This change ensures that closedby=none blocks escape when the flag is
enabled. This was noted when enabling the feature flag in the entire
`the-dialog-element` wpt __dir__ meta file, and running the test suite -
spotting a failure in `popover-closedby-simple.html`. This failure
occurs because the current behaviour for pressing escape skips over
elements that are `closedby=none`. However `closedby=none` should not
_skip_ these elements, but should instead return early - effectively
blocking the Esc key.

With this change made, as well as keeping the change in __dir__, the
dialog-popover-closedby-simple case passes, but also the
dialog-popover-closedby-complex cases pass - so they've been
rebaselined.

Differential Revision: https://phabricator.services.mozilla.com/D248291
2025-05-09 18:17:30 +00:00
Keith Cirkel
c71aafeaae Bug 1965052 - Only check top-most dialog for closedby in HandleEsc r=edgar,dom-core
We do not need to iterate over all open dialogs, as the top-most dialog
must respond _somehow_ to the escape key press, it either closes, or it
blocks the escape key-press, disallowing outer dialogs to handle the
key-press.

Differential Revision: https://phabricator.services.mozilla.com/D248309
2025-05-09 16:29:01 +00:00
Olivia Hall
3ecf7d8583 Bug 1964751 - PDF.js should be excluded from Desktop Mode r=geckoview-reviewers,calixte,calu
This patch excludes PDF.js from viewport rendering changes due to causing
a tiny PDF.js toolbar on Android.

Differential Revision: https://phabricator.services.mozilla.com/D248097
2025-05-08 20:05:54 +00:00
Emilio Cobos Álvarez
cce00add56 Bug 1965188 - Deal with popups in Document::UpdateRemoteFrameEffects rather than out of band. r=smaug
UpdateRemoteFrameEffects already deals with remote browsers in popups,
so we don't need to handle it sync from nsMenuPopupFrame and co.

But the handling is not particularly great. Right now that code is using
IntersectionObserver on the main window to determine whether it's
visible.

It's not the case currently, but there's no need for a popup to really
intersect the main window. So make the Document.cpp code deal with
popups a bit more conservatively while we're doing this.

Differential Revision: https://phabricator.services.mozilla.com/D247773
2025-05-08 09:49:32 +00:00
Keith Cirkel
4ee243696a Bug 1964029 - Close dialogs on escape after a tick r=dom-core,edgar
In D235504 this code was changed from using QueueCancelDialog to using
RequestClose, for consistency. However it seems some code _may_ depend
on the close being run after a tick, so to avoid regressions, this has
been changed to use QueueCancelDialog if the feature-flag is off,
restoring the old behaviour.

Differential Revision: https://phabricator.services.mozilla.com/D247886
2025-05-08 09:28:41 +00:00
Tom Schuster
05e533508a Bug 1959727 - Add the sanitizer option to parseHTMLUnsafe. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D247233
2025-05-08 05:55:37 +00:00
Cristian Tuns
1beaa4e22e Revert "Bug 1959727 - Add the sanitizer option to setHTMLUnsafe. r=emilio" for causing wpt failures in Document-parseHTMLUnsafe.html
This reverts commit 1faeaa00f5.

Revert "Bug 1959727 - Implement ShadowRoot.setHTML and share more code. r=emilio"

This reverts commit 3a84b03088.

Revert "Bug 1959727 - Add the sanitizer option to parseHTMLUnsafe. r=emilio" for causing wpt failures in Document-parseHTMLUnsafe.html

This reverts commit 17ced5ec89.
2025-05-08 01:11:56 +00:00
Tom Schuster
1faeaa00f5 Bug 1959727 - Add the sanitizer option to setHTMLUnsafe. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D247233
2025-05-07 22:16:55 +00:00
Emilio Cobos Álvarez
a6545b8f13 Bug 1963374 - Skip view transition when root element gets removed. r=view-transitions-reviewers,boris
Since the view transition pseudo tree is parented to it.

See https://github.com/w3c/csswg-drafts/issues/12149

Differential Revision: https://phabricator.services.mozilla.com/D247592
2025-05-05 19:33:49 +00:00
Tom Schuster
4280bc8ec7 Bug 1743042 - Document::InitCSP checks whether NodePrincipal is an ExpandedPrincipal (which is never true). r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D247582
2025-05-05 05:47:40 +00:00
Tom Schuster
ffbe21a987 Bug 1955578 - Collect clobbered HTMLDocument properties. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D242534
2025-05-02 08:28:00 +00:00
keithamus
a74f91b8cf Bug 1936940 - Implement dialog light dismiss r=webidl,emilio
Differential Revision: https://phabricator.services.mozilla.com/D235504
2025-05-01 19:05:50 +00:00
Sebastian Hengst
ac85dfe9e5 Revert "Bug 1936940 - Implement dialog light dismiss r=webidl,emilio" for failing two html/semantics/interactive-elements/the-dialog-element/ tests
This reverts commit 0c65e1c7da.
2025-05-01 13:56:58 +00:00
keithamus
0c65e1c7da Bug 1936940 - Implement dialog light dismiss r=webidl,emilio
Differential Revision: https://phabricator.services.mozilla.com/D235504
2025-05-01 03:51:09 +00:00
Tom Schuster
edaa914b45 Bug 1947732 - Provide nsIPrincipal to GetTrustedTypesCompliantString. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D246424
2025-04-30 11:09:07 +00:00
Alexandru Marc
ce0a455f47 Backed out changeset 307ff391dd02 (bug 1936940) for causing wpt failures @ dialog-closedby.html 2025-04-30 13:35:19 +03:00
Andrea Marchesini
5bb09f929e Bug 1960824 - Introduce nsICookie::SAMESITE_UNSET, r=edgul,webdriver-reviewers,extension-reviewers,cookie-reviewers,valentin,Sasha,robwu
Differential Revision: https://phabricator.services.mozilla.com/D246638
2025-04-30 08:59:18 +00:00
keithamus
129d6b84a4 Bug 1936940 - Implement dialog light dismiss r=webidl,emilio
Differential Revision: https://phabricator.services.mozilla.com/D235504
2025-04-30 08:53:12 +00:00
Butkovits Atila
2d4ec66eb0 Backed out 2 changesets (bug 1955578) for causing failures complaining about unknown test url. CLOSED TREE
Backed out changeset 4b6f1f98514e (bug 1955578)
Backed out changeset f7087a94bb69 (bug 1955578)
2025-04-29 15:46:31 +03:00
Tom Schuster
7918e3ccd4 Bug 1955578 - Collect clobbered HTMLDocument properties. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D242534
2025-04-29 11:32:36 +00:00
Emilio Cobos Álvarez
6db610f3ed Bug 1962381 - Sample SMIL animations along with CSS animations. r=longsonr,smaug
In order to do this and keep tests passing, we need to also recurse into
external resource docs during the refresh driver tick.

Otherwise, we fail dom/smil/test/test_smilExtDoc.xhtml. This used to
work because the SMIL controller registered with the refresh driver
directly, and resource docs share the refresh driver with the parent
doc. I think it makes sense to treat them more like subdocuments, and it
also matches svg-as-image better.

This fixes some known SMIL bugs, too, yay.

Differential Revision: https://phabricator.services.mozilla.com/D246588
2025-04-28 15:21:26 +00:00
Andreas Farre
38958db2c7 Bug 1962513 - Check if the target file URI can be loaded. r=jjaschke
Differential Revision: https://phabricator.services.mozilla.com/D246928
2025-04-28 13:13:24 +00:00
Alexandru Marc
05265244cb Backed out changeset d1343d311328 (bug 1962381) for causing build bustages @ Document.h CLOSED TREE 2025-04-28 15:23:11 +03:00
Emilio Cobos Álvarez
ce44ec7658 Bug 1962381 - Sample SMIL animations along with CSS animations. r=longsonr,smaug
In order to do this and keep tests passing, we need to also recurse into
external resource docs during the refresh driver tick.

Otherwise, we fail dom/smil/test/test_smilExtDoc.xhtml. This used to
work because the SMIL controller registered with the refresh driver
directly, and resource docs share the refresh driver with the parent
doc. I think it makes sense to treat them more like subdocuments, and it
also matches svg-as-image better.

This fixes some known SMIL bugs, too, yay.

Differential Revision: https://phabricator.services.mozilla.com/D246588
2025-04-28 10:17:49 +00:00
Emilio Cobos Álvarez
e94e1dd416 Bug 1960473 - Update content relevancy only once per tick. r=fredw
Otherwise we can end up with dirty frames at the end of a flush. This
doesn't fix bug 1958522 (I think we need either height: fit-content to
work, or IntersectionObserver.scrollMargin). But matches the HTML spec:

> The intent of this step is for the initial viewport proximity
> determination, which takes effect immediately, to be reflected in the
> style and layout calculation which is carried out in a previous step of
> this loop. Proximity determinations other than the initial one take
> effect at the next rendering opportunity.

Differential Revision: https://phabricator.services.mozilla.com/D245489
2025-04-21 11:08:27 +00:00
Emilio Cobos Álvarez
0195f5d257 Bug 1960602 - BlockOnload shouldn't add to the loadgroup in already complete documents. r=hsivonen,smaug
Differential Revision: https://phabricator.services.mozilla.com/D245559
2025-04-17 11:38:04 +00:00
Emilio Cobos Álvarez
4d8cd3814a Bug 1960602 - More explicitly block bfcache when a subframe is loading. r=smaug
The test now passes with http2/http3 (where it didn't use to because the
frame was not OOP in that case).

Differential Revision: https://phabricator.services.mozilla.com/D245741
2025-04-17 11:37:08 +00:00
Norisz Fay
f74c4d8e9e Backed out changeset 8305c9bfb249 (bug 1960602) for causing Android mochitest failures on test_blockBFCache.html CLOSED TREE 2025-04-17 04:28:20 +03:00
Emilio Cobos Álvarez
4a9cc7bd93 Bug 1960602 - More explicitly block bfcache when a subframe is loading. r=smaug
The test now passes with http2/http3 (where it didn't use to because the
frame was not OOP in that case).

Differential Revision: https://phabricator.services.mozilla.com/D245741
2025-04-16 19:19:17 +00:00
Emilio Cobos Álvarez
b4f7162b1e Bug 1960923 - Make MathML metric a use counter. r=fredw
That gives us consistent numbers to compare against.

Differential Revision: https://phabricator.services.mozilla.com/D245744
2025-04-16 17:25:25 +00:00
Tom Schuster
bdc45a47aa Bug 1959725 - Implement Document.parseHTML. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D245705
2025-04-16 13:52:29 +00:00
Tom Schuster
020bae66d9 Bug 1960678 - Make DocumentFlavor an enum class. r=emilio,necko-reviewers,sunil
Differential Revision: https://phabricator.services.mozilla.com/D245599
2025-04-16 07:42:49 +00:00
Andreas Farre
3c95e7d828 Bug 1948596 - Implement #can-have-its-url-rewritten. r=dom-core,edgar
This extracts common code from nsDocShell::AddState.

Differential Revision: https://phabricator.services.mozilla.com/D243069
2025-04-14 14:07:15 +00:00
Emilio Cobos Álvarez
cd5c811fe0 Bug 1959927 - Turn layout into a regular render phase. r=dshin
Run it in the right step of the rendering loop as per spec. Keep
the interruptible layout behavior by detecting whether we have any
frame with content-visibility: auto / ResizeObserver / etc around.

Also make the IntersectionObserver phase not unconditional, make it
conditional on needing layout or having scrolled.

I want to look a bit whether we can avoid flushing the whole browsing
context tree, but that is pre-existing so not touching it as part of
this work.

Differential Revision: https://phabricator.services.mozilla.com/D245214
2025-04-14 10:15:13 +00:00
Cristina Horotan
f37d6e55d5 Backed out changeset 24d97a7de216 (bug 1948596) for causing wpt failures at /the-history-interface/002.html. CLOSED TREE 2025-04-14 13:28:31 +03:00
Andreas Farre
1fb4036d4b Bug 1948596 - Implement #can-have-its-url-rewritten. r=dom-core,edgar
This extracts common code from nsDocShell::AddState.

Differential Revision: https://phabricator.services.mozilla.com/D243069
2025-04-14 09:12:44 +00:00
Cristina Horotan
1459daa033 Backed out changeset f1c03bf6c308 (bug 1948596) for causing wpt failures at the-history-interface/001.html CLOSED TREE 2025-04-11 23:15:55 +03:00
Andreas Farre
18f354fae7 Bug 1948596 - Implement #can-have-its-url-rewritten. r=dom-core,edgar
This extracts common code from nsDocShell::AddState.

Differential Revision: https://phabricator.services.mozilla.com/D243069
2025-04-11 15:59:27 +00:00
Thomas Wisniewski
e723146d01 Bug 1956165 - Add a Fenix-only JS webcompat intervention for m.youtube.com to fix picture-in-picture; r=padenot,denschub,webcompat-reviewers,webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D245108
2025-04-11 07:48:11 +00:00