Commit graph

2137 commits

Author SHA1 Message Date
David P
4be02b2419 Bug 1893119: Part 3 - Add widget to nsContentUtils::GetDragSession a=diannaS
Updates each client of the nsContentUtils method to get the right drag session -- the one for the widget that is currently the source or target of the drag session.
The change to nsDOMWindowUtils::DispatchDOMEventViaPresShellForTesting() supports the change to WidgetDragEvent::InitDropEffectForTests() and enabled a
large number of test fixes in the next patch.

Original Revision: https://phabricator.services.mozilla.com/D211067

Differential Revision: https://phabricator.services.mozilla.com/D221156
2024-09-06 14:44:11 +00:00
Tim Huang
11228bb995 Bug 1903559 - Fix the isPBM check in nsContentUtils::ShouldResistFingerprinting_dangerous(). a=dmeehan
Original Revision: https://phabricator.services.mozilla.com/D214356

Differential Revision: https://phabricator.services.mozilla.com/D215022
2024-06-26 22:31:35 +00:00
Adam Vandolder
a0cbf8098c Bug 1902333 - Fix crash when serializing empty shadow tree. r=smaug,dom-core,peterv a=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D213628
2024-06-18 14:55:20 +00:00
Nika Layzell
855d5761c0 Bug 196078 - Part 2: Support displaying arbitrary text/* MIME types as plain text, r=smaug,necko-reviewers,valentin
This patch refactors how we check for text formats when deciding how to handle
resources, such that more text MIME types will be rendered in-browser, rather
than downloaded.

This change requires us to move more away from using the Gecko-Content-Viewers
category in the category manager for this decision, as we need to handle an
unlimited number of MIME types behind the scenes.

Support for Gecko-Content-Viewers was left in for both the in-tree use for
application/http-index-format and dynamically determining whether image/avif
and image/jxl are supported, as well as for the message/rfc822 type used by
Thunderbird.

Differential Revision: https://phabricator.services.mozilla.com/D212078
2024-06-05 00:05:58 +00:00
Nika Layzell
9306cb7c3e Bug 1718673 - Allow loading text/event-stream in-browser as plain-text, r=smaug,necko-reviewers,kershaw
This patch also updates some documentation which was telling folks supporting new content types to update dead code.

Differential Revision: https://phabricator.services.mozilla.com/D211797
2024-06-05 00:05:57 +00:00
Iulian Moraru
97d3e8a086 Backed out changeset 2a4ee9f86e5a (bug 1862199) for causing bc failures on browser_misused_characters_in_strings.js. CLOSED TREE 2024-06-04 12:10:12 +03:00
Vincent Hilla
ac888af96f Bug 1862199 - Report invalid pattern attribute together with the regex flag. r=dom-core,peterv,iain
Differential Revision: https://phabricator.services.mozilla.com/D208367
2024-06-04 06:47:30 +00:00
Gregory Pappas
bfa774e268 Bug 1898445 - Add new pref for presence of overflow/underflow events in extension documents r=extension-reviewers,emilio,willdurand
Differential Revision: https://phabricator.services.mozilla.com/D211324
2024-06-03 20:22:12 +00:00
Norisz Fay
f31e183290 Backed out 3 changesets (bug 1718673, bug 196078) for causing wpt failures on report-frame-ancestors-with-x-frame-options.sub.html CLOSED TREE
Backed out changeset 6a54aa5039e7 (bug 196078)
Backed out changeset 0582d2fa1401 (bug 196078)
Backed out changeset d8d9a0fe366b (bug 1718673)
2024-06-01 03:33:07 +03:00
Nika Layzell
58ee355a1b Bug 196078 - Part 2: Support displaying arbitrary text/* MIME types as plain text, r=smaug,necko-reviewers,valentin
This patch refactors how we check for text formats when deciding how to handle
resources, such that more text MIME types will be rendered in-browser, rather
than downloaded.

This change requires us to move more away from using the Gecko-Content-Viewers
category in the category manager for this decision, as we need to handle an
unlimited number of MIME types behind the scenes.

Support for Gecko-Content-Viewers was left in for both the in-tree use for
application/http-index-format and dynamically determining whether image/avif
and image/jxl are supported, as well as for the message/rfc822 type used by
Thunderbird.

Differential Revision: https://phabricator.services.mozilla.com/D212078
2024-05-31 17:30:23 +00:00
Nika Layzell
2ae6781b16 Bug 1718673 - Allow loading text/event-stream in-browser as plain-text, r=smaug,necko-reviewers,kershaw
This patch also updates some documentation which was telling folks supporting new content types to update dead code.

Differential Revision: https://phabricator.services.mozilla.com/D211797
2024-05-31 17:30:22 +00:00
Timothy Nikkel
4410f432fc Bug 1899684. Use NS_UsePrivateBrowsing in nsContentUtils::GetImgLoaderForChannel. r=necko-reviewers,kershaw
NS_UsePrivateBrowsing seems to be the more modern, correct, and widespread way to do this.

Differential Revision: https://phabricator.services.mozilla.com/D212086
2024-05-30 11:03:33 +00:00
Ting-Yu Lin
f13f5fc5d4 Bug 1896516 Part 1 - Rename PresShell::GetRootScrollFrame(), and make it return ScrollContainerFrame. r=layout-reviewers,emilio
In theory, changing the return type from `nsIFrame*` to `ScrollContainerFrame*`
exposes `ScrollContainerFrame` to the callers who might not needed, but almost
all of the callers in cpp files are already exposed to `nsIScrollableFrame`, as
demonstrated in this patch via replacing the #include from
"nsIScrollableFrame.h" to "ScrollContainerFrame.h", so this is OK.

Some callers can be simplified since we no longer need `do_QueryFrame` to
`nsIScrollableFrame`.

Differential Revision: https://phabricator.services.mozilla.com/D211488
2024-05-30 06:32:17 +00:00
Sebastian Hengst
ccb101be8f Backed out 15 changesets (bug 1896516) for causing scrolling crashes on macOS. a=backout
Backed out changeset fd6904338812 (bug 1896516)
Backed out changeset 2977ff81a23e (bug 1896516)
Backed out changeset c8a6b0e526d6 (bug 1896516)
Backed out changeset 3c06f22da72b (bug 1896516)
Backed out changeset f63b0c4335fe (bug 1896516)
Backed out changeset 6f7ab8adfa6e (bug 1896516)
Backed out changeset 997c9249dbed (bug 1896516)
Backed out changeset c964fccd5180 (bug 1896516)
Backed out changeset 7b481b747b7a (bug 1896516)
Backed out changeset 42e1bbe0ecb6 (bug 1896516)
Backed out changeset 717dac08b607 (bug 1896516)
Backed out changeset 2f0817331dbe (bug 1896516)
Backed out changeset b765169a7a8f (bug 1896516)
Backed out changeset a2d37b98273c (bug 1896516)
Backed out changeset ea9ecb543e66 (bug 1896516)
2024-05-29 11:22:52 +02:00
Ting-Yu Lin
8dc0807324 Bug 1896516 Part 1 - Rename PresShell::GetRootScrollFrame(), and make it return ScrollContainerFrame. r=layout-reviewers,emilio
In theory, changing the return type from `nsIFrame*` to `ScrollContainerFrame*`
exposes `ScrollContainerFrame` to the callers who might not needed, but almost
all of the callers in cpp files are already exposed to `nsIScrollableFrame`, as
demonstrated in this patch via replacing the #include from
"nsIScrollableFrame.h" to "ScrollContainerFrame.h", so this is OK.

Some callers can be simplified since we no longer need `do_QueryFrame` to
`nsIScrollableFrame`.

Differential Revision: https://phabricator.services.mozilla.com/D211488
2024-05-28 04:46:16 +00:00
CanadaHonk
7a80d19009 Bug 1834703 - Return null origin of "blob:" URL containing disallowed inner schemes r=smaug,valentin
Return null origin of a blob URL containing an inner URL which is not of
some schemes (https, http, file per spec) to comply with new spec changes.
Allowed schemes also include moz-extension for our own purposes.

Examples:
- "blob:blob:https://example.org/" - inner blob URL
- "blob:ws://example.org/" - inner non-http(s) URL

Spec PR: https://github.com/whatwg/url/pull/771
WPT tests: https://github.com/web-platform-tests/wpt/pull/40133

16 WPT subtests newly pass 🎉

Differential Revision: https://phabricator.services.mozilla.com/D179400
2024-05-24 15:21:47 +00:00
Sean Feng
d7d68e0c6e Bug 1897248 - Make GetCommonFlattenedTreeAncestorForSelection stop crashing when two contents are equal r=jjaschke
Differential Revision: https://phabricator.services.mozilla.com/D211036
2024-05-21 15:29:18 +00:00
keithamus
12abaca03f Bug 1888774 - make InvokeAction an enum, "auto" now implicit r=dom-core,sefeng
Only "custom" invoke actions (those with a dash) or well-defined built-in
actions can be defined. Auto action is now implicit from empty/null atom.

Differential Revision: https://phabricator.services.mozilla.com/D206182
2024-05-15 21:38:06 +00:00
Adam Vandolder
b40c30b136 Bug 1890428 - Add serialization support for Declarative Shadow DOM. r=webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D206955
2024-05-15 16:40:21 +00:00
Tamas Szentpeteri
065fdfb46e Backed out 2 changesets (bug 1890428) for causing wpt failures on idlharness.https.html. CLOSED TREE
Backed out changeset 1954ce9669b8 (bug 1890428)
Backed out changeset 3e45e3d15eed (bug 1890428)
2024-05-15 11:19:46 +03:00
Adam Vandolder
bc77f97e3d Bug 1890428 - Add serialization support for Declarative Shadow DOM. r=webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D206955
2024-05-15 03:01:19 +00:00
Cristian Tuns
d52242a24f Backed out 2 changesets (bug 1890428) for causing failures in idlharness.window.html?exclude=Node CLOSED TREE
Backed out changeset f9cf0740eef2 (bug 1890428)
Backed out changeset 37e2a10a9022 (bug 1890428)
2024-05-14 19:42:37 -04:00
Adam Vandolder
133a24fad6 Bug 1890428 - Add serialization support for Declarative Shadow DOM. r=webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D206955
2024-05-14 16:43:28 +00:00
Emilio Cobos Álvarez
d55796be17 Bug 1892257 - Move nsStringBuffer to mfbt. r=nika,xpcom-reviewers,glandium
Inline Create() and Realloc() so that we don't get negative leaks, since
were that code end up in mozglue, it wouldn't have access to the logging
machinery.

Differential Revision: https://phabricator.services.mozilla.com/D209663
2024-05-14 14:24:26 +00:00
Emilio Cobos Álvarez
8aaf44fea9 Bug 1893683 - Remove ns{A,C}String and other xpcom dependencies from nsStringBuffer. r=smaug,media-playback-reviewers,karlt
* nsStringBuffer::FromString -> nsTSubString::GetStringBuffer
 * nsStringBuffer::ToString -> nsTSubString::Assign(nsStringBuffer*, len)
 * Move refcounting inline but refcount-logging and other XPCOM-related
   things out-of-line.

Differential Revision: https://phabricator.services.mozilla.com/D208771
2024-05-09 08:34:35 +00:00
Edgar Chen
2bcc67692b Bug 1781280 - Reuse IPCImage for IPCDataTransferImageContainer; r=nika
Differential Revision: https://phabricator.services.mozilla.com/D208074
2024-04-22 19:09:47 +00:00
Edgar Chen
77d9d637a6 Bug 1867636 - Rename nsITransferable::requestingPrincipal; r=nika
Differential Revision: https://phabricator.services.mozilla.com/D207272
2024-04-18 10:06:07 +00:00
Sean Feng
92ef542dba Bug 1881097 - Ensure nsContentUtils::IsPointInSelection works for point in selection that crosses the boundary r=smaug
Ths patch introduces a new class called `CrossShadowBoundaryRange` to
make cross shadow boundary range related stuff can be isolated into a
single class.

It also tweaks a few functions along the call stack, the goal here
is to make sure nsContentUtils::IsPointInSelection can detect points
in ShadowDOM selection.

There's an additional change to `SelectionUtils.sys.mjs` to make sure
the correct context menu items are displayed when the current selection
crosses the boundary.

Differential Revision: https://phabricator.services.mozilla.com/D204080
2024-04-15 13:09:08 +00:00
Masayuki Nakano
5bda5ff700 Bug 1890918 - Make ContentComparator::LessThan() check whether the content nodes are different before calling nsContentUtils::CompareTreePosition r=emilio
It seems that it's okay to remove `NS_WARN_IF` in
`nsContentUtils::CompareTreePosition`, but in theory, the comparator should
check it first to save the cost of calling the method.  Although it may be
optimized by the compiler.

Differential Revision: https://phabricator.services.mozilla.com/D207242
2024-04-11 23:53:08 +00:00
Jonathan Kew
b935b6c99e Bug 1888941 - Ensure any potential emergency-wrap positions are marked in nsTransformedTextRun instances. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D206363
2024-04-04 17:44:27 +00:00
Sean Feng
6f6ff6430a Bug 1887963 - Fix a bug where the commonAncestor could be null when range boundaries are not in flat tree. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D205905
2024-04-03 20:15:40 +00:00
Adam Vandolder
ea21e923de Bug 1876885 - Implement modified behaviour for doubly-attached declarative shadow roots. r=dom-core,peterv
Differential Revision: https://phabricator.services.mozilla.com/D200026
2024-03-18 15:36:56 +00:00
Jan-Niklas Jaeschke
aaf5f671f0 Bug 1881695: Implemented a new Cache to store the index of a node in a parent. r=smaug
This new cache implementation keeps the last N node/index combos in a stack-allocated array, which will be queried before calling nsINode::ComputeIndexOf().

Differential Revision: https://phabricator.services.mozilla.com/D203900
2024-03-11 19:02:11 +00:00
Natalia Csoregi
c2e4efaac4 Backed out changeset 37af5c6d011a (bug 1881695) for causing Bug 1884602 and Bug 1884601. CLOSED TREE 2024-03-11 10:47:07 +02:00
Jan-Niklas Jaeschke
aa9f0ab239 Bug 1881695: Implemented a new Cache to store the index of a node in a parent. r=smaug
This new cache implementation keeps the last N node/index combos in a stack-allocated array, which will be queried before calling nsINode::ComputeIndexOf().

Differential Revision: https://phabricator.services.mozilla.com/D203900
2024-03-09 11:13:55 +00:00
Cristina Horotan
b7aa7557e1 Backed out changeset e72815765675 (bug 1881695) for causing Hazard failure at nsContentUtils.h 2024-03-07 23:47:13 +02:00
Jan-Niklas Jaeschke
41b0de8fcd Bug 1881695: Implemented a new Cache to store the index of a node in a parent. r=smaug
This new cache implementation keeps the last N node/index combos in a stack-allocated array, which will be queried before calling nsINode::ComputeIndexOf().

Differential Revision: https://phabricator.services.mozilla.com/D203900
2024-03-07 16:57:16 +00:00
Narcis Beleuzu
314ea3bd7d Backed out changeset cc11e54ef4b1 (bug 1881695) for bustages on nsContentUtils.h 2024-03-07 18:01:44 +02:00
Jan-Niklas Jaeschke
861a450bea Bug 1881695: Implemented a new Cache to store the index of a node in a parent. r=smaug
This new cache implementation keeps the last N node/index combos in a stack-allocated array, which will be queried before calling nsINode::ComputeIndexOf().

Differential Revision: https://phabricator.services.mozilla.com/D203900
2024-03-07 15:14:06 +00:00
Adam Vandolder
6d14b717be Bug 1880188 - Add shadowrootclonable attribute support. r=webidl,emilio
Differential Revision: https://phabricator.services.mozilla.com/D202357
2024-02-28 19:00:34 +00:00
Frédéric Wang
b005b82248 Bug 1872657 - Add fetchpriority support for <link rel=preload as=image>. r=valentin,smaug,manuel
This patch adds fetchpriority support for `<link rel=preload as=image>`
and equivalent HTTP Link header. The fetchpriority value is passed from
where the link is parsed down to `NewImageChannel` where the priority
is initially set. Currently, the default equals PRIORITY_LOW, but is
decreased a bit if LOAD_BACKGROUND flag is set (this is always the case
for link preload images, see `imgLoader::LoadImage`). Later, the
priority can be increased again depending on the category (see
`imgRequest::BoostPriority`).

In order to minimize the changes, the new calculation is to keep the
initial setting to PRIORITY_LOW, adjust it using a new
`network.fetchpriority.adjustments.*` preference depending on the
fetchpriority attributes, and then preserve further adjustments for
LOAD_BACKGROUND and `BoostPriority`.

For the default value `fetchpriority=auto`, there is no adjustment
i.e. we continue to start with PRIORITY_LOW. `fetchpriority=low/high`
are respectively mapped to PRIORITY_LOW/PRIORITY_HIGH which is simple
and consistent with the "Image" cases from Google's web.dev article
https://web.dev/articles/fetch-priority. These values could of course
be revised in the future after more experiments.

This change is covered by the following tests below. The expectations
is modified to match what is described above (i.e. map to PRIORITY_LOW
or PRIORITY_HIGH with adjustment due to LOAD_BACKGROUND):
- `link-initial-preload-image.h2.html`
- `link-dynamic-preload-image.h2.html`
- `kPipeHeaderPreloadImageLinks`

Based on a patch by Mirko Brodesser (mbrodesser@igalia.com)

Differential Revision: https://phabricator.services.mozilla.com/D197493
2024-02-27 06:33:48 +00:00
Stanca Serban
b54de79827 Backed out changeset 621c8480cd35 (bug 1872657) for causing FetchPriority related bp-nu bustages in IconLoader.cpp. CLOSED TREE 2024-02-26 18:15:18 +02:00
Frédéric Wang
c7734232ca Bug 1872657 - Add fetchpriority support for <link rel=preload as=image>. r=valentin,smaug,manuel
This patch adds fetchpriority support for `<link rel=preload as=image>`
and equivalent HTTP Link header. The fetchpriority value is passed from
where the link is parsed down to `NewImageChannel` where the priority
is initially set. Currently, the default equals PRIORITY_LOW, but is
decreased a bit if LOAD_BACKGROUND flag is set (this is always the case
for link preload images, see `imgLoader::LoadImage`). Later, the
priority can be increased again depending on the category (see
`imgRequest::BoostPriority`).

In order to minimize the changes, the new calculation is to keep the
initial setting to PRIORITY_LOW, adjust it using a new
`network.fetchpriority.adjustments.*` preference depending on the
fetchpriority attributes, and then preserve further adjustments for
LOAD_BACKGROUND and `BoostPriority`.

For the default value `fetchpriority=auto`, there is no adjustment
i.e. we continue to start with PRIORITY_LOW. `fetchpriority=low/high`
are respectively mapped to PRIORITY_LOW/PRIORITY_HIGH which is simple
and consistent with the "Image" cases from Google's web.dev article
https://web.dev/articles/fetch-priority. These values could of course
be revised in the future after more experiments.

This change is covered by the following tests below. The expectations
is modified to match what is described above (i.e. map to PRIORITY_LOW
or PRIORITY_HIGH with adjustment due to LOAD_BACKGROUND):
- `link-initial-preload-image.h2.html`
- `link-dynamic-preload-image.h2.html`
- `kPipeHeaderPreloadImageLinks`

Based on a patch by Mirko Brodesser (mbrodesser@igalia.com)

Differential Revision: https://phabricator.services.mozilla.com/D197493
2024-02-26 15:03:58 +00:00
Andrew McCreight
e6a51816d0 Bug 1880692, part 2 - Use an estimate for encoded characters. r=smaug
This makes the calculation simpler and faster, at a hopefully small
cost in space. Idea by peterv.

This reduced the time to run a microbenchmark locally by around 12%.

Differential Revision: https://phabricator.services.mozilla.com/D202281
2024-02-22 16:57:14 +00:00
Andrew McCreight
4e87a420eb Bug 1880692, part 1 - Make StringBuilder::Unit::mLength specific to literals. r=smaug
That is the only case that uses it. This might save a bit of space
and avoids some useless stores. Idea by peterv.

Differential Revision: https://phabricator.services.mozilla.com/D202344
2024-02-22 16:57:13 +00:00
Adam Vandolder
7b38e4ca70 Bug 1879921 - Fix failure caused by re-entry of SetHTMLUnsafe. r=peterv,dom-core
Differential Revision: https://phabricator.services.mozilla.com/D202251
2024-02-21 16:11:04 +00:00
Emilio Cobos Álvarez
a4d842c063 Bug 1879579 - Clean up CompareTreePosition and related code. r=smaug
Make TreeOrderedArray support what the form controls stuff needs, and
use it instead of custom nsContentUtils stuff.

Differential Revision: https://phabricator.services.mozilla.com/D201261
2024-02-12 20:01:36 +00:00
Noemi Erli
f92d721721 Backed out changeset 1acc95286189 (bug 1879579) for causing mass failures CLOSED TREE 2024-02-12 17:25:21 +02:00
Emilio Cobos Álvarez
068080982b Bug 1879579 - Clean up CompareTreePosition and related code. r=smaug
Make TreeOrderedArray support what the form controls stuff needs, and
use it instead of custom nsContentUtils stuff.

Differential Revision: https://phabricator.services.mozilla.com/D201261
2024-02-12 00:01:23 +00:00
Adam Vandolder
7e00ff4dcb Bug 1877025 - Make declarative shadow roots of custom elements available to element internals. r=peterv,dom-core
Differential Revision: https://phabricator.services.mozilla.com/D200177
2024-02-06 18:38:40 +00:00