This is the most important situation. If selection is collapsed to a edge of a
link, the other browsers does not insert new content into the link. So, from
the point of view of web developers, this cause should work exactly same as
the other browsers.
Note that the new failures in `editing/run/inserttext.html` are passed only
on Gecko. So, the test should be updated after fixing this bug.
Differential Revision: https://phabricator.services.mozilla.com/D101004
When caret is not moved but selection change command is fired, it means that
the caret is already set to start or end of editing host. In this case, we
should stop keeping link style for new inserting content because otherwise,
user cannot exit from the first or last link with arrow keys.
Differential Revision: https://phabricator.services.mozilla.com/D101003
Although different from the other browsers' behavior, our traditional behavior
might be better than them because the behavior on the other browser does not
allow users to insert new content at start nor end of a link.
However, we can relax more about keeping traditional behavior for web-compat.
Perhaps, only when caret is moved from the other side of first or last character
in the link and moves caret to the edge of the link with arrow key, we should
allow users to modify the link text.
Otherwise, e.g., `Home` and `End` key press should make it stop keeping the
link style. This helps advanced users who are familiar with keyboard navigatin
in editor.
Note that this patch also changes the condition which checks
`aReason & nsISelectionListener::KEYPRESS_REASON` to check also
`nsISelectionListener::COLLAPSETO_START_REASON` and
`nsISelectionListener::COLLAPSETO_END_REASON` because all of them are
set by `nsFrameSelection::MoveCaret` exclusively.
https://searchfox.org/mozilla-central/rev/a0ccd492719b1ad2106f6456549be62a76f45acb/layout/generic/nsFrameSelection.cpp#738,741,745
Therefore, they should be treated as same as a key press.
Note that they are also set by `Selection::CollapseToStart` and
`Selection::CollapseToEnd` too. But a following patch will add a new
reason to notify selection listeners of caused by JS. So, the problem
will be fixed by the following patch.
Differential Revision: https://phabricator.services.mozilla.com/D101002
When mouse button is clicked outside a link element but caret is positioned
start or end of the link, our traditional behavior keeps inserting new content
into the link. But this is different from the other browsers, and it does
not make sense to treat such selection change is intended to keep typing in
the link element.
Therefore, this patch makes `TypeInState::OnSelectionChange()` handle
selection change reason is `mousedown` and `mouseup` cases. However,
it cannot know whether the event was fired in the parent link element or
not. Therefore, this patch makes `HTMLEditorEventListener` notifies
`TypeInState` of mouse events via `HTMLEditor`.
Differential Revision: https://phabricator.services.mozilla.com/D101001
In AudioData, we use `mOriginalTime` to store the original start time before trimming, which should keep sync to `mTime` if data hasn't been trimmed before. Otherwise, if they are not equal, it would cause a problem when handling trimming.
For example.
If audio data's time is X, original time is X-1 and duration is T. When MDSM performs seeking, it would use (X + T) as trimming window's end time. However, in `AudioData::SetTrimWindow()`, original time + duration (X - 1 + T) would be less than the trimming end time, which causes an error.
Differential Revision: https://phabricator.services.mozilla.com/D100825
Specifically, instead of using custom loops
- use range-based for in QuotaManager::CreateDirectoryLock,
QuotaManager::CollectOriginsForEviction,
QuotaManager::CollectPendingOriginsForListing,
QuotaManager::CheckTemporaryStorageLimits
- use range-based for in QuotaManager::RemoveQuota
and clear the hashtable after the loop rather than removing individual entries
- extract a new overload GroupInfo::LockedRemoveOriginInfo that's called from
within the two existing overloads, and use std::find_if resp. range-based for
in those overloads
- use std::any_of in GetInactiveOriginInfos
- use std::is_sorted in GetInactiveOriginInfos
- use std::accumulate in QuotaManager::CheckTemporaryStorageLimits
- use std::transform in QuotaRequestChild::HandleResponse
Differential Revision: https://phabricator.services.mozilla.com/D99790
Changing the tracks-captured state will trigger another run of
UpdateOutputTrackSources, so continuing the current one is futile. The next run
will properly re-evaluate all input state to this function.
Differential Revision: https://phabricator.services.mozilla.com/D100004
SetSelectionRange may kill the frame (in the test-case, AccessibleCaret
flushes layout).
No crashtest as there doesn't seem to be one available.
Differential Revision: https://phabricator.services.mozilla.com/D101253
`AdjustForStartTime()` is only used for decoded data type in order to adjust their start time to zero, such as `VideoData` and `AudioData`.
However, some other types inherited from `MediaData` don't need that function. Eg. `MediaRawData`, so it's not necessary to put it on the `MediaData`, we should move that function to `VideoData` and `AudioData` separately.
Differential Revision: https://phabricator.services.mozilla.com/D100846
I flagged this as sketchy before (though it was trying to preserve
existing behavior).
However now that that state propagates to the parent process and races
with the state that the parent process reads, it started causing
correctness issues.
Just remove this line, it shouldn't be needed. I'm not sure how to write
a test for this, unfortunately :(
Differential Revision: https://phabricator.services.mozilla.com/D100971
We use nsINode::Adopt to store the arenas to a hashtable to keep them
alive, however this method is not guaranteed to be called, so it
may cause arenas to be disposed before all nodes are destroyed.
Differential Revision: https://phabricator.services.mozilla.com/D101042
Dispatching the `MediaDataEncoder::Encode()` invocation is not really
necessary because the callback is desinated to run in task queue anyway.
Also make `Shutdown()` wait for completion to make sure resource is
released before next allocation.
Differential Revision: https://phabricator.services.mozilla.com/D97027
This function converts between enums and strings over and over. It is
sufficient to call CSP_StringToCSPDirective only once.
Differential Revision: https://phabricator.services.mozilla.com/D100183
The only effect of this parameter is suppressing the violation reports and it
is redundant because aSendViolationReports is present.
Differential Revision: https://phabricator.services.mozilla.com/D100180
The WMFDecoderModule now uses a crash guard around the loading of the VP9/VP8 MFT. We don't want to always assume that we have a VPx decoder in the GPU process in particular, as it will only be true if a HW decoder is available.
Differential Revision: https://phabricator.services.mozilla.com/D100309
Not the most elegant, but reworking the PDMFactory to be fully re-initialized would be a significant change, as only the WMFDecoderModule requires it we take some shortcuts.
Differential Revision: https://phabricator.services.mozilla.com/D100308
gfxVars::CanUseHardwareVideoDecoding is often set after the first use of the PDMFactory; in this case this would disable HW VP9 decoding for the entire session of the browser.
This value will always end up being true on macOS, so ignore its value in the static Init method.
Differential Revision: https://phabricator.services.mozilla.com/D100307
Upon starting the RDD and GPU process; we check their decoding capabilities and send it to the parent process. It will then broadcast this information to all content children so that RemodeDecoderModule::Supports can return if a codec is supported or not.
Differential Revision: https://phabricator.services.mozilla.com/D100306
When calling PDM::SupportsMimeType not enough information is provided for the PDM to categorically state that a codec isn't supported.
Only creating the decoder successfully matters and the PDMFactory only uses the value returned by Support as a hint to further query the PDM.
Without this change WMFDecoderModule::SupportsMimeType in the GPU process would always return false as it doesn't know yet the KnownCompositor.
Differential Revision: https://phabricator.services.mozilla.com/D100305
We can launch the RDD process early now that it is a fully asynchronous process and doesn't block anything.
This will allow to retrieve the decoding capabilities of the RDD process right away.
Calling this method will actually be handled in bug 1684991 once blockers are sorted (tests and sandbox)
Differential Revision: https://phabricator.services.mozilla.com/D100304
DONTBUILD because this is a comment-only change and hence doesn't affect
behavior at all.
I ran across this typo in nsPageFrame.cpp, and figured I might as well grep for
it and fix it more comprehensively. And while I'm at it, I also fixed some
neighboring instances of a duplicated word around a linebreak, in
nsXMLContentSerializer.h.
Differential Revision: https://phabricator.services.mozilla.com/D100852
Windows start blocking media by default (see the
media.block-autoplay-until-in-foreground pref).
If the document becomes visible from GetScriptHandlingObject(), we
hand-rolled our own UpdateVisibilityState and didn't call
MaybeActiveMediaComponents (which unblocks media playback).
It couldn't call it there before since given content docshells used
start as active, but now that they don't we can do that and fix the bug.
Differential Revision: https://phabricator.services.mozilla.com/D41438
This function converts between enums and strings over and over. It is
sufficient to call CSP_StringToCSPDirective only once.
Depends on D100182
Differential Revision: https://phabricator.services.mozilla.com/D100183
The only effect of this parameter is suppressing the violation reports and it
is redundant because aSendViolationReports is present.
Depends on D100179
Differential Revision: https://phabricator.services.mozilla.com/D100180
Specifically, do not attempt and fail removal of the usage file in
CreateStorageConnection if the usage file did not exist.
Differential Revision: https://phabricator.services.mozilla.com/D100675
When enabling our MediaTrack implementation (which we don't plan to by default,
NB) and disabling all audio tracks and unselecting all video tracks while having
an active captureStream leads to having no output tracks in DecodedStream.
In this case, DecodedStream doesn't know which graph to use for creating the
intermediary tracks it feeds data to. We don't want to resort to the default
graph either, since two graphs on different clocks could then race each other.
With this patch we plumb down a SharedDummyTrack from the media element where
the captureStream was triggered, through MediaDecoder, to DecodedStream. The
SharedDummyTrack guarantees to keep the graph alive, and holds the graph used
for the output tracks.
Differential Revision: https://phabricator.services.mozilla.com/D99822
Based on evidence from crash reports in Bug 1682589, there may be a bug where
IPDL intermittently calls `ActorDestroy()` twice on GamepadEventChannelParent,
leading to a crash.
This attempts to catch this behavior in Nightly (assuming that I'm correct and
it does exist). If not, I will have to find some other explanation for the
crash behavior from that bug.
Differential Revision: https://phabricator.services.mozilla.com/D100714
These are never empty, and storing 4 elements inline seems worth it
given we also heap-allocate the array itself.
Depends on D100592
Differential Revision: https://phabricator.services.mozilla.com/D100593
Shifted the zero-check after width and height are clamped to int32_t. Fixes the use case where width and height are floats > 0 but < 1. These values are clamped to 0, but no error is thrown, as opposed to the desired behavior. Deleted corresponding test ini file, since it is now expected to PASS.
Now also fixes a test that started failing and checked something against the spec, (credit to @emilio)
Differential Revision: https://phabricator.services.mozilla.com/D100597
Otherwise we stop moving focus because, when we find the scrollable
area, we determine that we need to focus the fieldset, but then the
focus manager early-returns in `nsFocusManager::SetFocusInner`.
Depends on D100423
Differential Revision: https://phabricator.services.mozilla.com/D100424
We always compute the tabindex value, so just return it to the caller
all the time. This allows us to use early-returns which makes the code a
bit easier to follow.
This patch shouldn't change behavior.
Differential Revision: https://phabricator.services.mozilla.com/D100423
The WMFDecoderModule now uses a crash guard around the loading of the VP9/VP8 MFT. We don't want to always assume that we have a VPx decoder in the GPU process in particular, as it will only be true if a HW decoder is available.
Differential Revision: https://phabricator.services.mozilla.com/D100309
Not the most elegant, but reworking the PDMFactory to be fully re-initialized would be a significant change, as only the WMFDecoderModule requires it we take some shortcuts.
Differential Revision: https://phabricator.services.mozilla.com/D100308
gfxVars::CanUseHardwareVideoDecoding is often set after the first use of the PDMFactory; in this case this would disable HW VP9 decoding for the entire session of the browser.
This value will always end up being true on macOS, so ignore its value in the static Init method.
Differential Revision: https://phabricator.services.mozilla.com/D100307
Upon starting the RDD and GPU process; we check their decoding capabilities and send it to the parent process. It will then broadcast this information to all content children so that RemodeDecoderModule::Supports can return if a codec is supported or not.
Differential Revision: https://phabricator.services.mozilla.com/D100306
When calling PDM::SupportsMimeType not enough information is provided for the PDM to categorically state that a codec isn't supported.
Only creating the decoder successfully matters and the PDMFactory only uses the value returned by Support as a hint to further query the PDM.
Without this change WMFDecoderModule::SupportsMimeType in the GPU process would always return false as it doesn't know yet the KnownCompositor.
Differential Revision: https://phabricator.services.mozilla.com/D100305
We can launch the RDD process early now that it is a fully asynchronous process and doesn't block anything.
This will allow to retrieve the decoding capabilities of the RDD process right away.
Ideally, we should have been able to start the RDD process at the same time as the GPU process; however setting up the RDD sandbox is dependent of having mozilla::SandboxBroker::GeckoDependentInitialize() called first ; and it is called in the most awkward of places; so finding a place suitable for all platforms gets affected.
For now we will ensure it's been started around the time the first content process is started.
Differential Revision: https://phabricator.services.mozilla.com/D100304
Shifted the zero-check after width and height are clamped to int32_t. Fixes the
use case where width and height are floats > 0 but < 1. These values are clamped
to 0, but no error is thrown, as opposed to the desired behavior. Deleted
corresponding test ini file, since it is now expected to PASS.
Differential Revision: https://phabricator.services.mozilla.com/D100597
Added an option to use ConicGradient API as a preference and removed the
corresponding expected FAILing test, over @ntim's implementation.
Differential Revision: https://phabricator.services.mozilla.com/D100554
This fixes a bunch of regressions:
- a wrong calculation in `GetIdleDeadlineHint()`, leading to pageload
regressions.
- in certain situations we'd use `StartupRefreshDriverTimer` instead
of `VsyncRefreshDriverTimer` when initializing timers early
- unnecessary use of `BrowserChild` on backends that don't opt for
per-browser-child vsync - i.e. all but Wayland.
This is partly done by reverting to pre-1645528 behaviour, although
with some code simplifications.
FTR: I also played with some more radical changes, but given the
complexity of the code involved I found the regression potential too
big. Thus this is the most conservative solution I could come up with.
Differential Revision: https://phabricator.services.mozilla.com/D100471
My guess is that if Observe() gets called too early, we can receive the
message before updating the vsync source the first time, which would
trigger this crash.
With this patch, we handle it nicely and UpdateVsyncSource will
re-observe as needed.
It's not 100% clear to me if this is actually the issue (and thus
whether this patch is the right solution), since I haven't been able to
repro locally, though. There might be a more subtle race.
Differential Revision: https://phabricator.services.mozilla.com/D100501
This fixes a bunch of regressions:
- a wrong calculation in `GetIdleDeadlineHint()`, leading to pageload
regressions.
- in certain situations we'd use `StartupRefreshDriverTimer` instead
of `VsyncRefreshDriverTimer` when initializing timers early
- unnecessary use of `BrowserChild` on backends that don't opt for
per-browser-child vsync - i.e. all but Wayland.
This is partly done by reverting to pre-1645528 behaviour, although
with some code simplifications.
FTR: I also played with some more radical changes, but given the
complexity of the code involved I found the regression potential too
big. Thus this is the most conservative solution I could come up with.
Differential Revision: https://phabricator.services.mozilla.com/D100471
If multiple audible tabs play at the same time, we call it as `Audio Competition`.
When the audio competition happens, there are several possibilities
(1) ignore that and keep multiple tabs playing at the same time
(2) user manually handles that by pausing or muting audible playing tabs, remaining only an audible playing tab
(3) user enables audio focus management, so gecko would pause them and only allow one audible tab playing at a time
By collecting these situations, we can know the details of how user would react for the audio compeition.
In addition, we also collect the situation where no audio competition happens, in order to know whether the audio competition is common to users.
Differential Revision: https://phabricator.services.mozilla.com/D100292
Previous behavior was to allow requests if the user has ever interacted with
the window. This patch changes from sticky activation to transient
activation.
WindowContext is used rather than Document for the
HasValidTransientUserGestureActivation() test because user activation is a
property of the Window/global.
The error reported when WindowContext is null is the same as that for missing
transient activation, which is keeping the existing behavior.
https://searchfox.org/mozilla-central/rev/66547980e8e8ca583473c74f207cae5bac1ed541/dom/base/Document.cpp#15806
i.e. a missing WindowContext is still treated as missing transient activation.
Differential Revision: https://phabricator.services.mozilla.com/D98275
DelayedDeleteRunnable would schedule itself twice and use input priority
for the second time because it only wants to run after everything
that could possibly touch this tab. This was needed because we were
strict with IPC messages. However, this is no longer needed because
IPC messages with destroyed actors will be discarded nowadays, so
we don't have to use input priority anymore.
Another reason for making this change is that input events could be
suspended when the runnable is about to run, so we need to either
use a different priority or resume input events.
Differential Revision: https://phabricator.services.mozilla.com/D100345
When we shutdown `MediaSourceDecoder`, it would trigger a shutdown for `MDSM` and a detaching for media source.
In the previous one, that would eventually shutdown `MediaFormatReader` via tasks going through different threads (main->MDSM->MFR's supervisor).
In the latter one, it would eventually detach the `TrackBufferManager` from the `MediaSourceTrackDemuxer`. (main->Demuxer's supervisor)
As these two tasks running in different threads, and the latter usually get finished before the former one, which would result in `MediaSourceTrackDemuxer` no longer being able to get a sample.
When that happens, the reader hasn't been shutdown yet, so it's still holding track demuxers and keeps requesting data from them. Then demuxers would return error because their corresponding track managers have been detached.
The reader would report the demuxing error to the console, but that's acutally not a fatal error, because in this situation the reader is going to be shutdown soon. Therefore, return `NS_ERROR_DOM_MEDIA_CANCELED` to allow MFR to treat this error differently.
Differential Revision: https://phabricator.services.mozilla.com/D100153
Call `waitUntilDisplayedPlaybackChanged()` first to ensure that we won't miss the event. In addition, add more logs in order to help diagnosing issue if timeout happens again.
Differential Revision: https://phabricator.services.mozilla.com/D100277
Resetting focus would also clear selection on editable element, so get
current selected text before moving focus to findbar to make
prefill-with-selection work if the content is loaded in chrome process.
Differential Revision: https://phabricator.services.mozilla.com/D89557
As now the lowest version SDK we use for developing would be 10.12, so we don't need to this wrapper anymore and can import `MediaPlayer` directly.
Differential Revision: https://phabricator.services.mozilla.com/D97223
At the very least per our coding style star should be near the pointer
type, not the variable name, but while we're at it let's also make
IsGeometryChangedViaCSS a bit more efficient, and use references.
Differential Revision: https://phabricator.services.mozilla.com/D100244
RemoteDecoderManagerChild has a number of functions that may be called
asynchronously. Many such functions assert that they can get the manager thread
and that they are on that thread. However, if we've already shutdown, the thread
they fetch will be null. Since we can enter shutdown while async executions of
these functions are pending, we may fail our asserts.
To avoid this, we instead check if the manager thread is null in these
functions, if so, we assume we're in shutdown and bail. If the thread is not
null, we continue as before and assert we are running on the thread as expected.
Differential Revision: https://phabricator.services.mozilla.com/D99824
The issue here is caused (a bit surprisingly) by the counter-reset
declaration.
The underlying issue is that counter-reset causes us to rebuild the
frame tree for the whole `<body>`, in order to rebuild the counter tree.
That makes the geometry frame not get its updated style (because the
frame goes away), and the next frame getting constructed getting a null
aOldComputedStyle (as expected, as it's a new frame).
We can't rely on the cached path not to change while there's no frame,
so clear it out when there's no old style.
The test is a simpler version of the test-case, where instead of
`counter-reset`, I use `display: none` to trigger the bogus codepath.
Differential Revision: https://phabricator.services.mozilla.com/D100237
Currently, they are never focusable when its type is "plugin".
So, making stop them returning `IMEEnabled::Plugin` won't change
anything, but it guarantees that nobody will see `IMEEnabled::Plugin`
at runtime. This is a preparation for the following patches.
Differential Revision: https://phabricator.services.mozilla.com/D100101
Before deleting `IMEState::Enabled::PLUGIN`, let's make it an enum class
for making the change safer. Almost all of this change is done by
"replace" of VSCode.
Differential Revision: https://phabricator.services.mozilla.com/D100100
This patch add a way to track remote target for mouse capturing. The tracking
remote target will be reset when capturing content is changed or
ReleaseCapturingContent() is called.
In order to make `mouseup` would also be dispatched to correct remote target, we
do ReleaseCapturingContent in EventSetateManager::PostHandleEvent, instead of
in nsIFrame::HandleRelease.
Differential Revision: https://phabricator.services.mozilla.com/D98592
the goal of this PR is to provide the necessary
infrastructure to handle errors on the GPU process side and send them
back to the client side, triggering the uncaptured error events.
Differential Revision: https://phabricator.services.mozilla.com/D98542
### Process Reuse
Prior to this patch, the logic was unintentionally specifying that
existing processes shouldn't be reused, which could lead to growing
the size of a process pool that we did not actually desire to grow.
We now pass the flag to request reuse of a process, which helps
compensate for the process selection decision process happening on
PBackground in a manner which inherently does not have as full an
understanding of what processes are in the act of being created on
the main thread.
See the comments in the code for more informationm.
### Permission Transmission
Prior to this patch, permissions would be transmitted when either:
1. The choice was made to use an existing process.
2. A new process was launched to be the home for a worker.
This seems like it covers all the bases but the actual mechanism by
which a remote worker would be launched for a new process is when its
RemoteWorkerServiceParent actor is registered. The above would be
sufficient if the only way for processes to come into existence was at
the request of the RemoteWorkerService, but obviously this is not the
case. When that happened, it would be possible for a remote worker to
be placed in a new process that was not the process we were
transmitting permissions for.
The changes in this patch normalize permission transmission so that
they are transmitted at the same time we attempt to spawn the worker
via the selected RemoteWorkerServiceParent. This code path is used for
both an existing process and when a new process is spawned so there's
no longer any gap.
Differential Revision: https://phabricator.services.mozilla.com/D99753
Show save dialogue
***
Automaticly show Panel On Block
***
Keep Open/Save Dialogue with open panel
***
Keep User choise in downloadsView
***
Add Unblock option to Unblock panel
***
lint
***
add test
Differential Revision: https://phabricator.services.mozilla.com/D96448
Bug 1583109 introduced new function templates StringJoin and StringJoinAppend.
These are now used to replace several custom loops across the codebase that
implement string-joining algorithms to simplify the code.
Differential Revision: https://phabricator.services.mozilla.com/D98750
This lifts a bunch of string conversions higher up the stack, but allows
us to make the servo code use utf-8 unconditionally, and seemed faster
in my benchmarking (see comment 0).
It should also make a bunch of attribute setters faster too (like
setting .cssText), now that we use UTF8String for them (we couldn't
because we couldn't specify different string types for the getter and
setters).
Differential Revision: https://phabricator.services.mozilla.com/D99590
This patch add a way to track remote target for mouse capturing. The tracking
remote target will be reset when capturing content is changed or
ReleaseCapturingContent() is called.
In order to make `mouseup` would also be dispatched to correct remote target, we
do ReleaseCapturingContent in EventSetateManager::PostHandleEvent, instead of
in nsIFrame::HandleRelease.
Differential Revision: https://phabricator.services.mozilla.com/D98592
Note that we can probably use mLastRefreshDriverTime directly in
DocumentTimeline::GetCurrentTimeStamp(), i.e. we don't need to use the refresh
driver there, but I'd preserve the current behavior.
Differential Revision: https://phabricator.services.mozilla.com/D97823
Show save dialogue
***
Automaticly show Panel On Block
***
Keep Open/Save Dialogue with open panel
***
Keep User choise in downloadsView
***
Add Unblock option to Unblock panel
***
lint
***
add test
Differential Revision: https://phabricator.services.mozilla.com/D96448