Commit Graph

1565 Commits

Author SHA1 Message Date
Fatih Kilic
3392ea7ae8 Bug 1972600 - Spoof network connection for HTMLMediaElement preload. a=pascalc
Original Revision: https://phabricator.services.mozilla.com/D254027

Differential Revision: https://phabricator.services.mozilla.com/D255984
2025-07-09 09:14:56 +00:00
Jeff Muizelaar
2d71a5bc1e Bug 1965023 - Convert media element markers to flows. r=alwu
Differential Revision: https://phabricator.services.mozilla.com/D248275
2025-05-22 03:10:37 +00:00
Masayuki Nakano
90cd469f14 Bug 1550462 - part 2: Make PresShell::HandleEvent dispatch preceding pointerrawupdate event r=smaug,dom-core,edgar
This patch tries to dispatch ePointerRawUpdate with
PresShell::EventHandler::DispatchPrecedingPointerEvent as same as usual
pointer events.

For using the path, this patch adds 2 internal events, eMouseRawUpdate
and eTouchRawUpdate which are never dispatched into the DOM because
PresShell::EventHandler::DispatchPrecedingPointerEvent will return false
for that and then the caller will stop handling the internal events.

There are 3 dispatchers of the internal raw update events.

One is PresShell::EnsurePrecedingPointerRawUpdate(). This dispatches the
internal event if and only if the coming event of PresShell::HandleEvent will
cause ePointerMove. The reason why PresShell::HandleEvent handles the
preceding raw-update event is, we should support ePointerRawUpdate events
for synthesized events for tests (in-process ones) and in the main process.
Additionally, if a pointerrawupdate event may destroy the target <iframe>.
In such ase, the following pointermove may need to be dispatched on its parent
window or another <iframe> window. Therefore, we need to dispatch the
internal raw update event before considering the target window (PresShell) and
handling the capturing element.

The others are BrowserChild::RecvRealMouseMoveEvent and
BrowserChild::RecvRealTouchMoveEvent. They dispatch the internal events
when they won't dispatch the received event immediately to coalesce with further
similar input.

For avoiding to dispatch the internal event for same source event, this adds
WidgetPointerHelper::convertToPointerRawUpdate member to check it in
PresShell::HandlePrecedingPointerRawUpdate.

Differential Revision: https://phabricator.services.mozilla.com/D243404
2025-05-16 09:53:52 +00:00
Keith Cirkel
9b9b7194e1 Bug 929890 - Canonicalise media preload attribute value of "" to "auto" r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D249523
2025-05-16 09:53:36 +00:00
Alexandru Marc
46de26821c Revert "Bug 1550462 - part 3: Enable pointerrawupdate event r=smaug" for causing mochitest failures @ test_pointerrawupdate_event_count.html
This reverts commit eb27445e03.

Revert "Bug 1550462 - part 2: Make `PresShell::HandleEvent` dispatch preceding `pointerrawupdate` event r=smaug,dom-core,edgar"

This reverts commit 502f22686c.

Revert "Bug 1550462 - part 1: Define `pointerawupdate` event r=smaug"

This reverts commit 2b13850454.
2025-05-16 06:32:12 +00:00
Masayuki Nakano
502f22686c Bug 1550462 - part 2: Make PresShell::HandleEvent dispatch preceding pointerrawupdate event r=smaug,dom-core,edgar
This patch tries to dispatch `ePointerRawUpdate` with
`PresShell::EventHandler::DispatchPrecedingPointerEvent` as same as usual
pointer events.

For using the path, this patch adds 2 internal events, `eMouseRawUpdate`
and `eTouchRawUpdate` which are never dispatched into the DOM because
`PresShell::EventHandler::DispatchPrecedingPointerEvent` will return `false`
for that and then the caller will stop handling the internal events.

There are 3 dispatchers of the internal raw update events.

One is `PresShell::EnsurePrecedingPointerRawUpdate()`.  This dispatches the
internal event if and only if the coming event of `PresShell::HandleEvent` will
cause `ePointerMove`.  The reason why `PresShell::HandleEvent` handles the
preceding raw-update event is, we should support `ePointerRawUpdate` events
for synthesized events for tests (in-process ones) and in the main process.
Additionally, if a `pointerrawupdate` event may destroy the target `<iframe>`.
In such ase, the following `pointermove` may need to be dispatched on its parent
window or another `<iframe>` window.  Therefore, we need to dispatch the
internal raw update event before considering the target window (`PresShell`) and
handling the capturing element.

The others are `BrowserChild::RecvRealMouseMoveEvent` and
`BrowserChild::RecvRealTouchMoveEvent`.  They dispatch the internal events
when they won't dispatch the received event immediately to coalesce with further
similar input.

For avoiding to dispatch the internal event for same source event, this adds
`WidgetPointerHelper::convertToPointerRawUpdate` member to check it in
`PresShell::HandlePrecedingPointerRawUpdate`.

Differential Revision: https://phabricator.services.mozilla.com/D243404
2025-05-15 03:22:44 +00:00
Jan-Niklas Jaeschke
b3debf824d Bug 1963845 - Use Span for EnumTable. r=emilio,smaug
This patch makes the usage of `EnumTable`s safer
by using `Span`s instead of relying on an empty
element at the end.
Also the name has been changed from `EnumTable`
to `EnumTableEntry` to be more precise.

Differential Revision: https://phabricator.services.mozilla.com/D247453
2025-05-06 08:28:23 +00:00
pstanciu
7d79502fbe Revert "Bug 1963845 - Use Span for EnumTable. r=emilio,smaug" for Build Bustages on HTMLSharedListElement.cpp
This reverts commit eebbccf7b9.
2025-05-05 13:48:07 +00:00
Jan-Niklas Jaeschke
eebbccf7b9 Bug 1963845 - Use Span for EnumTable. r=emilio,smaug
This patch makes the usage of `EnumTable`s safer
by using `Span`s instead of relying on an empty
element at the end.
Also the name has been changed from `EnumTable`
to `EnumTableEntry` to be more precise.

Differential Revision: https://phabricator.services.mozilla.com/D247453
2025-05-05 12:49:25 +00:00
Florian Quèze
9885783942 Bug 1956726 - remove leftover Telemetry.h includes in .cpp files, r=chutten,geckoview-reviewers,cookie-reviewers,win-reviewers,dom-storage-reviewers,gstoll,valentin,m_kato,janv.
Differential Revision: https://phabricator.services.mozilla.com/D244351
2025-04-08 13:03:02 +00:00
Karl Tomlinson
173420c689 Bug 1953680 Reorder media event error event and state handling to align more closely with spec r=media-playback-reviewers,padenot
The error event is no longer dispatched when "The fetching process for the
media resource was aborted by the user agent at the user's request."
https://html.spec.whatwg.org/multipage/media.html#dom-mediaerror-media_err_aborted
This path could be reached only when a channel ends with NS_BINDING_ABORTED
before HAVE_METADATA.
https://searchfox.org/mozilla-central/rev/3a3965bc78cf76f23ac0569c7f3c98b15f1dca5c/dom/media/ChannelMediaDecoder.cpp#331,333
I don't know of any UI to trigger this state.

The reordering has no observable effect as the events are still being queued
for later dispatch.

Differential Revision: https://phabricator.services.mozilla.com/D243056
2025-04-01 03:07:48 +00:00
Karl Tomlinson
aef8100ce9 Bug 1953680 Set error state synchronously on failure during resource selection synchronous steps r=media-playback-reviewers,padenot
This is consistent with other browsers and with step 3 of
https://github.com/whatwg/html/issues/11155#issuecomment-2746475620

The 'urlRecord failure' subtest now behaves consistently across browsers
so the expected behavior is updated to pass when consistent.

The following tests are expecting a synchronous error event when the
delaying-the-load-event flag is reset.  They do not pass in Blink.  They pass
in Webkit, not because the error event is synchronous, but apparently other
factors are delaying the load event until after the error event.  They usually
fail in Gecko, but are marked [FAIL, PASS] because other reasons may delay the
load event and cause intermittent PASS as reported in
https://bugzilla.mozilla.org/show_bug.cgi?id=1133483.
resource-selection-invoke-audio-constructor.html
resource-selection-invoke-set-src-not-in-document.html
resource-selection-invoke-set-src.html

Differential Revision: https://phabricator.services.mozilla.com/D242881
2025-04-01 03:05:28 +00:00
Karl Tomlinson
6c125a1562 Bug 1953680 Use simple static C strings for nsMediaEventRunner names r=media-playback-reviewers,alwu
Differential Revision: https://phabricator.services.mozilla.com/D243054
2025-04-01 00:47:11 +00:00
Karl Tomlinson
2d210a3f9c Bug 1953680 Clarify when media events are fired synchronously r=media-playback-reviewers,alwu
Gecko uses "dispatch" to mean "queue" or "fire" in different places.
Rename DispatchEvent() to FireEvent to clarify.

Add MOZ_CAN_RUN_SCRIPT to alert callers.
CanRunScriptChecker says "arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument)", even when those arguments are unused after the script is run.
https://searchfox.org/mozilla-central/rev/03f39c99dc11e3f0c51cfb61b5f84cad988326d0/build/clang-plugin/CanRunScriptChecker.cpp#365

Differential Revision: https://phabricator.services.mozilla.com/D243051
2025-03-31 21:21:54 +00:00
Karl Tomlinson
b3d328fd2d Bug 1953680 Rename DispatchAsyncEvent() methods to QueueEvent and QueueTask r=media-playback-reviewers,alwu,padenot
Gecko uses "dispatch" to mean "queue" or "fire" in different places.
This rename clarifies that the methods queue rather than fire
an event (or run a task) that has already been queued.

Differential Revision: https://phabricator.services.mozilla.com/D243050
2025-03-31 21:21:54 +00:00
Karl Tomlinson
087e14ead1 Bug 1951744 Discard no-supported-media task when the load has been aborted r=media-playback-reviewers,padenot
by a new src attribute value, for example.

Differential Revision: https://phabricator.services.mozilla.com/D241362
2025-03-13 19:58:37 +00:00
Adam Vandolder
d9478c5d2c Bug 1946547 - Consider pages which have played media as being interacted with for the back-button intervention. r=farre,dom-core,media-playback-reviewers,alwu
Differential Revision: https://phabricator.services.mozilla.com/D239470
2025-03-13 16:19:32 +00:00
Florian Quèze
9609e47f62 Bug 1879329 - script generated replacement of the GleanMetrics.h includes, r=chutten,valentin,media-playback-reviewers,cookie-reviewers,anti-tracking-reviewers,profiler-reviewers,win-reviewers,rkraesig,emz,aabh,padenot.
Differential Revision: https://phabricator.services.mozilla.com/D234744
2025-01-21 11:21:45 +00:00
Emilio Cobos Álvarez
3c1b64acfe Bug 1940412 - Add batch removal information to nsIMutationObserver::ContentWillBeRemoved, and use it in some trivial-ish places. r=dom-core,credential-management-reviewers,sefeng
The idea is to use it on the style (via PresShell->RestyleManager) to do
invalidation faster in cases like bug 1940405.

Differential Revision: https://phabricator.services.mozilla.com/D233547
2025-01-15 20:39:40 +00:00
Olli Pettay
dc01353aff Bug 1424871 - Cloned <audio> and <video> elements ignore muted attribute, r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D231134
2024-12-05 00:26:34 +00:00
Julian Descottes
9093638038 Bug 1933963 - Set nsITimedChannel initiatorType to audio or video for media requests r=padenot
Set the initiatorType at channel creation time so that all consumers (eg WebDriver BiDi) can
read the correct value when receiving notifications about the channel.

Differential Revision: https://phabricator.services.mozilla.com/D230538
2024-11-28 16:29:45 +00:00
Emilio Cobos Álvarez
539611ead9 Bug 1931301 - Notify of removals on a stable state, not mid-remove. r=smaug,masayuki,dshin
This simplifies some observers, and makes others a bit more subtle, but I think
over-all it is an improvement.

Differential Revision: https://phabricator.services.mozilla.com/D229008
2024-11-26 09:39:52 +00:00
Sandor Molnar
4edbb82211 Backed out changeset 3d4472548fb9 (bug 1931301) for causing assertion failures @ Document.cpp 2024-11-25 23:06:55 +02:00
Emilio Cobos Álvarez
0651582f86 Bug 1931301 - Notify of removals on a stable state, not mid-remove. r=smaug,masayuki,dshin
This simplifies some observers, and makes others a bit more subtle, but I think
over-all it is an improvement.

Differential Revision: https://phabricator.services.mozilla.com/D229008
2024-11-25 17:58:40 +00:00
alwu
787c8399d1 Bug 1929335 - part1 : add new probe to record all types of media element error. r=media-playback-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D228733
2024-11-14 06:18:44 +00:00
alwu
09317afb38 Bug 1928536 - part2 : revert workaround from bug 1928484. r=media-playback-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D228388
2024-11-08 07:02:28 +00:00
alwu
1a4d1f0476 Bug 1928828 : don't use ExternalEngineStateMachine if we already know the CDMProxy is not supported by WMF-based CDM. r=media-playback-reviewers,aosmond
The reason we need to switch between different state machines is that we
cannot determine the playback usage when creating the state machine.
However, if the CDMProxy is already set and is not supported by the
WMF-based CDM, we can directly use the MediaDecoderStateMachine to
avoid a later switch, which can reduce the chance of getting unnecessary
error.

Differential Revision: https://phabricator.services.mozilla.com/D227772
2024-11-05 20:56:28 +00:00
alwu
ab87830385 Bug 1928484 - add origin check to determine the HEVC support for CanPlayType() and IsTypeSupported(). r=jrmuizel,aosmond
When the pref 'media.wmf.hevc.enabled' is not equal to `1`, the HEVC is
only enabled through the media engine, which is used for EME playback
only.

Therefore, a quick workaround to prevent websites from using HEVC on
non-EME playback is to block HEVC on HTMLMediaElement::CanPlayType() and
MediaSource::IsTypeSupported().

This workaround should be removed after enaling HEVC for all playback in
the bug 1928536.

Differential Revision: https://phabricator.services.mozilla.com/D227572
2024-11-01 01:02:27 +00:00
Frédéric Wang
776e152a71 Bug 1925952 - Implement attribute waitingforkey on audio/video elements. r=smaug
IDL attribute was added in bug 1304247 but we are missing corresponding
content attribute: https://w3c.github.io/encrypted-media/#attributes-3

Differential Revision: https://phabricator.services.mozilla.com/D226298
2024-10-22 22:33:56 +00:00
alwu
737d334301 Bug 1923774 - handle the case for removing media key. r=media-playback-reviewers,chunmin
Differential Revision: https://phabricator.services.mozilla.com/D225161
2024-10-10 18:12:52 +00:00
alwu
3bc3334539 Bug 1908258 - part1 : delay audio wakelock releasing. r=padenot
Currently, our audio wakelock is precisely synchronized with audible
sound, meaning no wakelock is held when the audio is muted or silent.

On Windows, once the sleeping timer's threshold is reached, the system
appears to enter sleep mode immediately after the audio wakelock is
released. This timing issue prevents a playlist web application from
playing the next song, as the system falls asleep right after the first
song ends.

To address this, we consider delaying the release of the audio wakelock
slightly. This adjustment would allow the next song in the playlist to
start playing and prevent the system from entering sleep mode during
extended silences, which are common at the end of songs.

Differential Revision: https://phabricator.services.mozilla.com/D218356
2024-10-04 04:27:43 +00:00
Alex T
639466b6a7 Bug 1894522 - Implement default seek handlers r=alwu,media-playback-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D219016
2024-10-03 18:31:50 +00:00
Karl Tomlinson
0c5ee4bca5 Bug 1919683 change MediaDecoderOwner::AbstractMainThread() from instance to class method r=media-playback-reviewers,padenot
This no longer needs to be an instance method since
https://hg.mozilla.org/mozilla-central/rev/324cc7d374d1860a1743fa7f8a33a782e3bd4177#l50.524

Another mock MediaDecoderOwner implementation will be added for GTests and
having the single AbstractMainThread() implementation saves having to add
another.

Maintaining the method on MediaDecoderOwner retains the clarification that the
different clients are using the same event queue mechanism.

Differential Revision: https://phabricator.services.mozilla.com/D223696
2024-09-27 04:43:19 +00:00
alwu
2674ede387 Bug 1919123 - part6 : add markers to show load details. r=media-playback-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D222895
2024-09-24 19:12:26 +00:00
alwu
d615012f9a Bug 1919123 - part5 : add markers to show error details. r=media-playback-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D222894
2024-09-24 19:12:26 +00:00
alwu
c6f4c143f3 Bug 1919123 - part2 : ensure EME information is captured by markers as well. r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D222566
2024-09-24 19:12:25 +00:00
Norisz Fay
aaf0449a17 Backed out 7 changesets (bug 1919123) for causing bustage on Perfetto.h
Backed out changeset 6087d664bcd2 (bug 1919123)
Backed out changeset f001159e1cf6 (bug 1919123)
Backed out changeset 450d5838e19b (bug 1919123)
Backed out changeset d6cf9c0e1864 (bug 1919123)
Backed out changeset 2f0e85370167 (bug 1919123)
Backed out changeset 87f32f135dc4 (bug 1919123)
Backed out changeset a956f1fd39e6 (bug 1919123)
2024-09-23 22:10:30 +03:00
alwu
3b1e62cb3e Bug 1919123 - part6 : add markers to show load details. r=media-playback-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D222895
2024-09-23 18:06:50 +00:00
alwu
51b11fb321 Bug 1919123 - part5 : add markers to show error details. r=media-playback-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D222894
2024-09-23 18:06:50 +00:00
alwu
fd112ce200 Bug 1919123 - part2 : ensure EME information is captured by markers as well. r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D222566
2024-09-23 18:06:48 +00:00
Andrew Osmond
2edcc2e58c Bug 1912543 - Fix requestVideoFrameCallback with suspended/invisible videos. r=media-playback-reviewers,padenot
When a tab is backgrounded, or on some platforms, when the window is
fully covered, full decoding of a video for playback is disabled. The
video timeline still advances, but there are no valid frames for
presentation. Similarly, if an HTMLVideoElement is in the DOM tree but
marked as invisible (e.g. 'display: none;' is set), we also cease full
decoding of a video. This is the VideoDecodeMode::Suspend mode.

Chrome and Safari both continue to honour requestVideoFrameCallback when
the video element is invisible in a foreground tab. Conversely, when we
are in a backgrounded tab, Chrome suspends rVFC callbacks, while Safari
continues.

Given that we suspend requestAnimationFrame callbacks similar to Chrome
for backgrounded tabs, this patch matches our behaviour with Chrome.

The standard does not discuss the implications of visibility and
background/foreground on rVFC. We have filed an issue requesting for
clarification, and that can tracked at:

https://github.com/WICG/video-rvfc/issues/92

Differential Revision: https://phabricator.services.mozilla.com/D220274
2024-08-28 17:10:35 +00:00
Florian Quèze
39b8885527 Bug 1913624 - Remove expired telemetry histograms VIDEO_INFERRED_DECODE_SUSPEND_PERCENTAGE, VIDEO_INTER_KEYFRAME_AVERAGE_MS and VIDEO_INTER_KEYFRAME_MAX_MS, r=chutten,webidl,emilio.
Depends on D219447

Differential Revision: https://phabricator.services.mozilla.com/D219448
2024-08-20 10:26:54 +00:00
Chun-Min Chang
1b1e18f58f Bug 1865896 - Apply DefineEnum to AudioChannelService::AudibleState r=media-playback-reviewers,padenot
Note this patch changes the converted enum string from X to eX in the
logs, and free the crash caused by passing `AudibleState::eMaybeAudible`
to `ToAudibilityStr`

Depends on D213363

Differential Revision: https://phabricator.services.mozilla.com/D213364
2024-07-31 16:32:18 +00:00
Chun-Min Chang
5f58811432 Bug 1865896 - Apply DefineEnum to MediaPlaybackState r=media-playback-reviewers,padenot
Note that this patch changes the MediaPlaybackState enum string from X
to eX (e.g., started -> eStarted), but no functional change involves.

Depends on D210117

Differential Revision: https://phabricator.services.mozilla.com/D210118
2024-07-31 16:32:16 +00:00
Chun-Min Chang
a1336ad4a9 Bug 1865896 - Sort include headers in HTMLMediaElement.cpp per coding style r=media-playback-reviewers,padenot
Depends on D210114

Differential Revision: https://phabricator.services.mozilla.com/D210115
2024-07-31 16:32:14 +00:00
Kagami Sascha Rosylight
90c218ca5f Bug 1908664 - Add nsIPrincipal::GetIsInPrivateBrowsing r=media-playback-reviewers,anti-tracking-reviewers,dom-storage-reviewers,padenot,asuth,pbz
Differential Revision: https://phabricator.services.mozilla.com/D216993
2024-07-26 17:47:51 +00:00
alwu
8ab575596a Bug 1904937 - part2 : add debug logs. r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D215265
2024-07-03 15:40:14 +00:00
Emilio Cobos Álvarez
71bf77b3fe Bug 1904442 - Rename GlobalTeardownObserver::GetOwner to GetOwnerWindow. r=smaug,media-playback-reviewers,dom-storage-reviewers,aosmond,padenot,asuth
Also HasOrHasHadOwner to HasOrHasHadOwnerWindow.

Differential Revision: https://phabricator.services.mozilla.com/D214772
2024-07-01 11:49:59 +00:00
Masayuki Nakano
fb5048e05b Bug 1675847 - part 1: Rename eMouseClick and eMouseAuxClick r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D212999
2024-06-14 00:18:46 +00:00
sotaro
1f80fb5b98 Bug 1898142 - Deliver image usage type to WebRenderImageHost r=gfx-reviewers,lsalzman
Adds ImageUsageType to ImageClient and ImageContainer to identify user of Image at WebRenderImageHost.

Some ImageContainers are used only for allocating Image. Only following types calls ImageContainer::SetCurrentImages().
- ImageUsageType::Canvas
- ImageUsageType::OffscreenCanvas
- ImageUsageType::VideoFrameContainer

Differential Revision: https://phabricator.services.mozilla.com/D211147
2024-05-22 23:03:22 +00:00