Building without support for the maintenance service currently does not work because the definitions of EnvHasValue and IsSecureUpdateStatusSucceeded are ifdef'ed out despite being used. This patch fixes this by including those functions, even if compiling without support for the maintenance service.
Differential Revision: https://phabricator.services.mozilla.com/D129722
This patch adds a new command line argument --aab which allows users to install
GVE as an AAB.
This will also be used in a future patch to install the test runner as AAB.
Differential Revision: https://phabricator.services.mozilla.com/D127323
The fact that the test runner app is defined inside the geckoview test package
has always felt like a hack to me. I've mistakenly thought that
TestRunnerActivity was used in GeckoView's junit tests many times (even though
that's not the case).
From what I can see, there's no way to generate an AAB package for androidTest,
so to be able to run Gecko tests as AAB we finally need to define the
TestRunner as an ordinary package instead.
Differential Revision: https://phabricator.services.mozilla.com/D127320
This tool is used to install AAB packages to devices.
AAB is the new package format for Android Apps and will supersede APK.
Differential Revision: https://phabricator.services.mozilla.com/D127318
Before this patch, we would load mozglue using the unqualified
`System.loadLibrary("mozglue")` and then we would try to load all the other
native libraries from the path returned from `nativeLibraryDir`.
Note that since the path is unqualified, we might end up loading a library
that's not inside the APK, potentially a malicious one.
Android App Bundles (or AAB) is a new feature of Android where apps can be
split in multiple APKs (called "splits"). Each APK split contains a functinal
part of the app, e.g. a specific resolution asset folder, all the native
libraries for one CPU architecture etc.
For AAB, `nativeLibraryDir` returns an empty folder as the libraries are
stored, uncompressed, inside one of the APK splits, so GeckoView fails to load
libxul and other libraries when starting up.
The current code also doesn't work for any case where `System.loadLibrary`
fails to load mozglue (we do have code that accounts for that, but I'm not sure
how much of it is funcitonal).
To fix that, we locate the mozglue using code ported from Chromium and use that
to locate all the other native libraries.
Note this still doesn't fix the problem of loading an unqualified mozglue
library, but there's not a lot we can do about that right now (and that's not a
new problem, so we can address it in a separate patch).
Differential Revision: https://phabricator.services.mozilla.com/D122909
If the New Session command doesn't wait for the initial tab
to have finished loading, any other command send right away
could fail because the document could be replaced.
Differential Revision: https://phabricator.services.mozilla.com/D130158
Most of our JNI code either holds strong references to Java objects, i.e. the
Gecko Garbage Collector is responsible for clearning the object, or weak
references to Java code, i.e. the Java GC is responsible for clearing the
object.
Some objects, however, are special and need manual care. These objects
implement the `onWeakNonIntrusiveDetach` method, which is manually triggered by
calling `Detach`.
My understanding is that these objects need to be cleared from either the Java
side (when the GC destroys the GeckoSession) or from the C++ side, when the
window associated to a GeckoSession is closed.
This is done to avoid holding off to a window for longer than necessary, since
it's very expensive to do so.
The intermittent subject of this bug was caused by us not clearing the
Compositor object when the window closes on the Gecko side, letting the Java
side call `syncPauseCompositor` on a dead JNI object.
This is the before code of the Compositor's `onWeakNonIntrusiveDetach`:
```
void OnWeakNonIntrusiveDetach(already_AddRefed<Runnable> aDisposer) {
RefPtr<Runnable> disposer = aDisposer;
if (RefPtr<nsThread> uiThread = GetAndroidUiThread()) {
// ...
uiThread->Dispatch(NS_NewRunnableFunction(
"LayerViewSupport::OnWeakNonIntrusiveDetach",
[compositor, disposer = std::move(disposer),
results = &mCapturePixelsResults, window = mWindow]() mutable {
if (auto accWindow = window.Access()) {
// ...
compositor->OnCompositorDetached();
}
disposer->Run();
}));
}
```
As you can see from the above, the `OnCompositorDetached` method, which informs
the Java layer that the compositor should not be called anymore, was only
invoked when `window.Access()` returns successfully, i.e. when we have a
window that is alive.
Normally, a Compositor object always has a window associated to it, as there's
a strong link between the GeckoSession and the Compositor object on the Java
side.
There are, however, some edge cases (mostly during shutdown) where the Java
code holds a reference to the Compositor but not the GeckoSession. In those
cases, we would fail the following check
```
if (auto accWindow = window.Access()) {
```
And fail to call `OnCompositorDetached`.
We don't really need the window to call `OnCompositorDetached`, as explained
above, so we can just move the call outside the `if` statement to fix this
problem.
Differential Revision: https://phabricator.services.mozilla.com/D130101
Failing to close the File Descriptors causes a shutdown hang, as the main
process is not able to detect when the child process dies because we're leaking
the File Descriptors.
Differential Revision: https://phabricator.services.mozilla.com/D128938
Sometimes we try to start a process that already exists and that causes a very
confusing error (the test times out but there's no indicastion as to why).
This patch makes it so that we will first try to kill the existing zombie
process and then, if we fail to do so, throw an error.
Differential Revision: https://phabricator.services.mozilla.com/D128937
xpcshell-test runs up to 10 concurrent tests and the logs are all interleaved.
This patch adds the test name to every log statement to let developers know
what test is causing the log line to appear in the logs.
Differential Revision: https://phabricator.services.mozilla.com/D128936
This patch refactors `GeckoProcessManager`. Before this patch, we would pass
all arguments needed to start a process in every method call, together with the
previous error (if present).
This patch groups the arguments in a class `StartInfo` and keeps the failure
information separately in a list of exceptions that can be used to generate a
log in case of failure.
This patch also fixes two problems:
- We were calling `detachFd` right after connecting to a process, which is
incorrect when the binding fails, as we still need a reference to the File
Descriptor to retry the connection. After the patch, we will call detach only
at the end when we either have established a connection or we have given up.
- We were taking ownership of the File Descriptors from Gecko. This is
incorrect because Gecko owns them already and calling `close` accidentally
will crash the app. We now `dup` them instead, using
`ParcelFileDescriptor.from`. This also means that the call to `detachFd` is
now a call to `close`.
Differential Revision: https://phabricator.services.mozilla.com/D128935
This patch adds a builder for InitInfo and allows us to define its members as
final.
This is especially useful for File Descriptors which are all of the same type,
and could be easily swapped in method calls.
Differential Revision: https://phabricator.services.mozilla.com/D128933
These are only used for frameset painting and the non-e10s <select>
dropdown focus codepath. We have other more appropriate standard
colors for this.
Differential Revision: https://phabricator.services.mozilla.com/D129992
GetWindowDesktopId is a slow function and is called on the UI thread during WM_CLOSE message handing (as part of SessionStore). This was causing Windows to assume we are stalled and it abandons some messages, namely future WM_CLOSE messages sent for other windows during a "Close All Windows" operation.
In this patch, GetWorkspaceId uses a cached value for GetWindowDesktopId (if available) but also queues an update for that cache value if one isn't already in progress. Since SessionStore already regularly calls GetWorkspaceId in response to window moves, this keeps the value fresh in plases where it might change. (The SessionStore architecture is designed that way because Windows does not notify the application if the user moves the window to another virtual desktop.)
Differential Revision: https://phabricator.services.mozilla.com/D128955
This patch adds a new API onLoginFetch() which will be called when Gecko needs
access to all logins saved on the device (as opposed to just logins for a
domain).
Differential Revision: https://phabricator.services.mozilla.com/D129862
Removing the unlinking shouldn't be a problem, only possible side effect would be removing the partially downloaded file
Differential Revision: https://phabricator.services.mozilla.com/D130132