6182: https://github.com/mozilla-mobile/android-components/issues/3832: Add support for additional headers when loading url r=pocmo a=psymoon
6197: Import strings from android-l10n. r=jonalmeida a=mozilla-l10n-automation-bot
n/t
6270: For https://github.com/mozilla-mobile/android-components/issues/6269: Notify active sessions when all exceptions are removed. r=Amejia481 a=ValentinTimisica
I also updated the tests accordingly.
Made this change because the tracking protection icon is not updated after the
exceptions are removed.
6286: Closes https://github.com/mozilla-mobile/android-components/issues/6281: Do not automatically dismiss confirm dialogs r=Amejia481 a=csadilek
The feature to automatically dismiss can maybe be made more robust to not be affected by lifecycle changes (https://github.com/mozilla-mobile/android-components/issues/6281#issuecomment-599739212), but in either case we don't want to automatically dismiss confirmation dialogs, as these require user interaction before the next page load anyway.
Similar fix to: https://github.com/mozilla-mobile/android-components/pull/5704/
Co-authored-by: Simon Chae <chaesmn@gmail.com>
Co-authored-by: Mozilla L10n Automation Bot <release+l10n-automation-bot@mozilla.com>
Co-authored-by: ValentinTimisica <valentin.timisica@softvison.ro>
Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
There's some confusion in `GeckoEngineSession` about redirect flags.
The `VISIT_REDIRECT_SOURCE` and `VISIT_REDIRECT_SOURCE_PERMANENT` flags
that we get from GeckoView's history delegate are for the redirect
_source_, not the visit type. They indicate if the URL passed to
`onVisited` is redirecting _to_ another URL, most likely because the
server returned an HTTP 3xy status code with a `Location` header.
Rust Places decides whether to mark the URL as hidden based on
these flags.
`VISIT_REDIRECT_{PERMANENT, TEMPORARY}`, however, indicate if the
URL passed to `onVisited` is the _target_ of a redirect (in other
words, the page that's _in_ the `Location` header). These get
translated into `VisitType` flags, which Rust Places stores as the
visit transition type. These two flags don't affect whether a URL
is hidden.
Note that, in a redirect chain, the middle links are both sources and
targets. For example, in "mozilla.org" -> "www.mozilla.org" ->
"www.mozilla.org/en-US", "www.mozilla.org" is both a redirect target
(since "mozilla.org" redirected to it), and a source (it redirected
to "www.mozilla.org/en-US").
See https://github.com/mozilla-mobile/fenix/issues/3526.
This includes UI in private tabs.
Squashed commits:
[180e515e8] Connect to Session Observer and thence to AppLinksFeature.
[77922dcc0] browser-engine-system tests passing
[045717868] lint etc
[6f7b44cad] Thread another Boolean through EngineObserver -> Session onLoadRequest
[18693cad0] Start testing the feature.
[5e0a93556] Fixup tests to use shadow package manager, and catch some new bugs.
[3a5976dde] Split use cases up for menu and intercepting cases.
[f7eae96dd] Address reviewer comments re: dead code and docs
[b15ffb88c] Rename triggeredByUserInteraction to loadRequestTriggeredByUserInteraction
[edc49b573] Move session observer into member of feature
[91ed1f5ac] Add changelog entry
[098dc5067] Add boolean flag to prevent interception of links
[f92731a44] Add load request/trigger by user interaction to session.observer
[46385577d] Move opening to another use case, with test
[56da7e7c1] Change into using feature
[643c9f453] Remove duplicate copyright
[6b3f80bbc] Add testing of get and a fragment for open use cases
[669c84567] Add AppLinksRedirectConfig and supporting use cases.
There is a url redirect creation use case, a load URL use case and an interceptor.
[72896a567] AppLinksUseCases detects if a URL can be opened with another non-browser app
[939eb62fa] Initial commit of empty feature-app-links
This shifts responsibility of constructing a VisitType for any given visit on the
caller of HistoryTrackingDelegate implementation, which is normally the engine.
This is generally what we want: engine is normally best suited to determine a visit type
for a URI that's currently being opened.
Co-authored-by: Sebastian Kaspari <s.kaspari@googlemail.com>
Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
- The WebView instance is long-lived, as it's referenced in
SystemEngineSession, and we want to be able to keep engine
sessions around for the lifespan of the application.
- The WebView instance is created by the engine and using its
context (the application context).
- The EngineView, rendering engine sessions and WebViews,
is created using an activity context.
- The problem was that when the activity and EngineView were
destroyed, the WebView was not being detached and still
referenced the parent which referenced the activity context,
which would then not get gc'ed.
- We now detach the WebView when the EngineView is destroyed
and only destroy the WebView when the session is closed.
- This will allow re-using of engine sessions and their
WebViews in different activities and allow for proper
destruction.
The main change here is that EngineSessionHolder can now hold an EngineState and this state
is used when we need to create an EngineSession (which will clear the state). This has the
following advantages:
* When restoring we can just attach the EngineState and do not need to create the
EngineSession immediately. With that we do not load all the EngineSessions and everything
at once. Initially only the selected EngineSession will be created and loaded. That will
make the restore faster and use less resources when restoring a lot of sessions.
* (Not in this commit, for a follow-up) It allows us to close EngineSession instances and
just keep the EngineState around until we need the EngineSession again. That's something
we could do in low memory situations or when there are just too many sessions/tabs open
to be performant (e.g. only keep the last recently used EngineSession instances around).
This patch simplifies how the history tracking delegate is set, and removes unnecessary
complexity around the history tracking feature.
It's important to set the delegate before the first engine session instance is created.
There are multiple points in time when that might happen:
- if we have a SessionSnapshot, we'll restore early on and create bunch of engine sessions
- we'll may create a 'default' engine session via one of the multiple use cases which use
SessionManager
- we may create an engine session at any other point in time, as soon as we have an engine
instance, by manually invoking 'createSession' method.
In short, applications aren't constrained in how they create sessions, and various components
may create sessions at different points in time, depending on their lifecycles, how things
are configured to behave, etc.
If we want to guarantee that our engine sessions always have a history tracking delegate instance
set, simply setting it on the 'defaultSettings' object guarantees that in the most straightforward way.
This also makes problems around lazy initialization of HistoryTrackingFeature irrelevant, since that
feature is now gone.
This patch removes the feature-storage, since the only thing it contained was a delegate implementation.
Underlying HistoryStorage implementations might be blocking on IO (Rust Places, room),
or migth be non-blocking (in-memory). A Deferred return type for get* methods makes
it convenient to wrap both regular and `async` operations. Use of 'suspend' functions
serves the same role for write* methods.
This change makes it obvious at the engine call-site that the underlying implementation
might suspend, at which point we can wrap calls in `runBlocking` or use another coroutine builder.
This is a workaround for Firefox for Fire TV to play DRM content automatically.
Eventually we want to implement this API in a way that the app (or another component) can
handle those requests. See: https://github.com/mozilla-mobile/android-components/issues/1157
The goal is to provide our engines with ability to query for browser history
and to record visits and page metadata updates (e.g. title changes).
GeckoView's APIs are still being implemented in https://bugzilla.mozilla.org/show_bug.cgi?id=1494713,
so this works from the implementation notes. WebView's APIs are well known.
History delegate is optional. Absence of it in settings when configuring an engine as akin to
disabling history tracking.
This patch explicitly doesn't provide an implementation of a delegate.
I decided to move the mappings to the respective EngineSession instead
of having them in the Engine, since it wasn't possible to have them
easily accessible from there via the RequestInterceptor. It made more
sense to keep them hidden inside the session as a companion function for
easier testing.
On the same note, tests have also been included.
Added an interceptor the SystemEngine sample app.
Cleaned up the styling of the actual error page HTML to make them more
mobile friendly.
Background: We are going to reserve the name "strings.xml" for translatable strings. This avoids that
our L10N tools need to be able to parse and process all kinds of resources that are not strings.
If we want to load an error page, we can return it to the interceptor,
along with a custom URL to show on the screen.
Tests for the GeckoView implementation will follow up. This change
should unblock SystemEngine clients for now.
When we add the fullscreen view into the FrameLayout, we were taking the
original WebView and hiding it with View.GONE which doesn't take up any
layout space. View.INVISIBLE doesn't show the view, but continues to
use the space that it would if it did exist (drawing in the background).
For websites like YouTube and BBC.com/ideas, the video provided to us
was of a smaller size and resolution so it didn't take the fullscreen
and ended up shrinking to it's original size view size. 🤦
* Adding captureThumbnail to EngineSession
* Updating TabViewHolder to add thumbnail
* Adding thumbnail to Session
* Adding a new product flavor for systemEngine
We're only waiting until the page is fully loaded until we call
onNavigationStateChange, which causes the UI components to seem slow.
Now, we make the call when we receive a title from the SystemEngine.
This only includes the implementation for the SystemWebView that's based
off of what we currently do in Focus/Fire TV. Since this is needed for
those apps now, we can work with this implementation until GeckoView
provides us with a nicer API to do the equivalent for it. (Bug 1489669)
We also don't notify any observers since there isn't any
confirmation/information available that we can propagate to cients.
* Adding desktopMode property to Session
* Adding onDesktopModeChanged in Session
* Renaming RequestDesktopSite to RequestDesktopSiteUseCase to follow
the convention
* Implementing onDesktopModeChange in EngineObserver
Renaming:
On EngineSession.Observer
from onDesktopModeEnabled to onDesktopModeChange
from setDesktopMode to toggleDesktopMode
On Session
from onDesktopModeEnabledChanged to onDesktopModeChanged
Adds the ability to stop loading a session that would have already
started.
Some considerations were made about whether
`EngineSession.Observer#onLoaingStateChanged` should be called. In our
current `SystemEngine` and `GeckoEngine` there isn't any explicit
callback for handling a stop loading event so there wouldn't be any way
to do this.