When tapping accessiblecaret and moving/releasing it, the follow error occurs.
```
GeckoViewContent[C]: handleEvent: mozcaretstatechanged
Web Content: [JavaScript Error: "TypeError: can't access property "sendRequest", this.eventDispatcher is undefined" {file: "resource:///actors/GeckoViewContentChild.jsm" line: 291}]
Web Content: handleEvent@resource:///actors/GeckoViewContentChild.jsm:291:11
```
I think that we miss super.actorCreated() call in actorCreate(). This might be
regression by bug 1661480.
Differential Revision: https://phabricator.services.mozilla.com/D124639
Hiro found this race condition.
The problem is in this code:
```
338: this.eventDispatcher
339: .sendRequestForResult(message)
340: .then(sessionId => {
341: return this.waitAndSetupWindow(sessionId, aOpenWindowInfo, aName);
342: })
```
At line 339 we ask the Java front-end to create a session and return back the
id of the session just created.
We then, at line 341, wait until the `geckoview-window-created` event fires
which signals that the session has been opened. We then _synchronously_ set
some attributes on the window object that allows us to connect the Java session
to the JavaScript window object.
Synchronicity is important as right after the `geckoview-window-created` event
fires all actors expect the embedderElement to be set on the window.
This, however, races with the code that creates the session:
```
540: } else if ("GeckoView:OnNewSession".equals(event)) {
541: final String uri = message.getString("uri");
542: final GeckoResult<GeckoSession> result = delegate.onNewSession(GeckoSession.this, uri);
...
547:
548: callback.resolveTo(result.map(session -> {
...
562: session.open(GeckoSession.this.mWindow.runtime);
563: return session.getId();
564: }));
```
As you can see, at line 562 we open the session, which asynchronously builds
the Gecko window and eventually fires the `geckoview-window-create` event. In
most cases, the message with the sessionId, sent at line 563, reaches the
JavaScript layer before the window has been opened, but sometimes it doesn't.
When the window opens before the JavaScript layer receives the sessionId back,
the promise at line 341 will never complete, causing intermittent failures in
our testing harness (and causing missing windows in consumer devices).
To fix this problem we modify the timing of creating the GeckoSession id.
The GeckoSession id only makes sense when the session is associated to a
GeckoRuntime instance, as the id is only used by Gecko. We can thus generate
the id whenever the Session is opened.
For sessions that are opened by the embedder directly, we can generate the id
randomly like usual. However, when the session is opened as a result of a
onNewSession (or onNewTab) call, we will set the id of the session using the id
given by the JavaScript layer.
This will enable the JavaScript layer to wait for the `geckoview-window-create`
before the Java layer has opportunity to respond, fixing the race condition.
Co-Authored-By: Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
Differential Revision: https://phabricator.services.mozilla.com/D124502
Actually `inputConnection_sendKeyEvent` test is rarely failed such as bug
1676245. Because we have no way to wait for correct selection data.
`TextInputDelegate.updateSelection` isn't called when view isn't attached to
window like geckoview-junit case.
So I would like to comment out this check now.
Depends on D124435
Differential Revision: https://phabricator.services.mozilla.com/D124436
The code in this patch is not needed anymore because now we can handle multiple
in-app runtimes after Bug 1696460.
This reverts commit d49a34c51bc537caffcd559cda07be994105cebb.
Differential Revision: https://phabricator.services.mozilla.com/D123980
This commit allows Android to use the login storage for HTTP auth by migrating
some common toolkit code to promptUsernameAndPassword and promptPassword which
use the login storage.
Differential Revision: https://phabricator.services.mozilla.com/D122508
Historically, only session delegates have been allowed in GeckoSessionTestRule
utilities like delegateUntilTestEnd or delegateDuringNextWait.
There's no reason it has to be that way though, and allowing runtime delegates
to use the same utilities removes a lot of boilerplate code that we don't need.
Differential Revision: https://phabricator.services.mozilla.com/D122507
Almost all delegates have getters except for these two. These are also helpful
when implementing delegateUntilTestEnd for runtime delegates.
Differential Revision: https://phabricator.services.mozilla.com/D122505
This change adds a new API that allows Gecko to dismiss a prompt automatically.
This will be used to dismiss prompts when they shouldn't be displayed anymore,
e.g. when using basic auth, we hide the prompt if the server rejects the login
information, as we know that the login info is not correct, so there's no point
in saving it.
We will also dismiss prompts automatically when they become stale, e.g. if a
permission prompt is raised and then the user navigates away.
To be able to dismiss a prompt we need to keep track of existing prompt
instances for a Session. We assign each prompt a unique, randomly generated,
UUID that is used to match the javascript prompt instance with the java
counterpart.
The prompts are stored in PromptHolder. Because the PromptController is owned
by the GeckoSession, whenever the session is GC'd we will also release the
prompts associated to it (if any).
Differential Revision: https://phabricator.services.mozilla.com/D122504
The code in this patch is not needed anymore because now we can handle multiple
in-app runtimes after Bug 1696460.
This reverts commit d49a34c51bc537caffcd559cda07be994105cebb.
Differential Revision: https://phabricator.services.mozilla.com/D123980
This commit allows Android to use the login storage for HTTP auth by migrating
some common toolkit code to promptUsernameAndPassword and promptPassword which
use the login storage.
Differential Revision: https://phabricator.services.mozilla.com/D122508
Historically, only session delegates have been allowed in GeckoSessionTestRule
utilities like delegateUntilTestEnd or delegateDuringNextWait.
There's no reason it has to be that way though, and allowing runtime delegates
to use the same utilities removes a lot of boilerplate code that we don't need.
Differential Revision: https://phabricator.services.mozilla.com/D122507
Almost all delegates have getters except for these two. These are also helpful
when implementing delegateUntilTestEnd for runtime delegates.
Differential Revision: https://phabricator.services.mozilla.com/D122505
This change adds a new API that allows Gecko to dismiss a prompt automatically.
This will be used to dismiss prompts when they shouldn't be displayed anymore,
e.g. when using basic auth, we hide the prompt if the server rejects the login
information, as we know that the login info is not correct, so there's no point
in saving it.
We will also dismiss prompts automatically when they become stale, e.g. if a
permission prompt is raised and then the user navigates away.
To be able to dismiss a prompt we need to keep track of existing prompt
instances for a Session. We assign each prompt a unique, randomly generated,
UUID that is used to match the javascript prompt instance with the java
counterpart.
The prompts are stored in PromptHolder. Because the PromptController is owned
by the GeckoSession, whenever the session is GC'd we will also release the
prompts associated to it (if any).
Differential Revision: https://phabricator.services.mozilla.com/D122504
Depending on glean creates a circular dependency as glean depends on
glean-native which is substituted with GeckoView in omni builds.
Since Gradle 6 capabilities are passed on to consumers using the Gradle Module
Metadata, so now we can just define a glean capability in GeckoView and Fenix
will consume glean-native from GeckoView instead of adding a duplicated
libglean blob (there is code in the glean plugin to make sure this happens).
See also: https://docs.gradle.org/current/userguide/component_capabilities.html
Co-authored-by: Jan-Erik Rediger <janerik@fnordig.de>
Differential Revision: https://phabricator.services.mozilla.com/D123572
There's a lot of code that we don't need anymore in our publication path (I'm
assuming it was needed when it was written but then gradle/the android plugin
caught up).
This has the nice side effect of producing better metadata (e.g. our
implementation dependencies end up in the |runtime| dependency group instead of
the default one where they were before, which means the app doesn't inherit our
private dependencies).
Co-authored-by: Jan-Erik Rediger <janerik@fnordig.de>
Differential Revision: https://phabricator.services.mozilla.com/D123571
This is the last version that doesn't require Java 11, we will upgrade to
Gradle 7 once all components are ready (namely, apilint).
Co-authored-by: Jan-Erik Rediger <janerik@fnordig.de>
Differential Revision: https://phabricator.services.mozilla.com/D123569
Looks like 6G is not enough for an ASAN build when updating the gradle version.
I tried 8G and 16G on try but that's not enough either.
This also:
* Moves the asan job to `b-linux-large` as the `b-linux` builder does not have
enough memory to run this build.
* Stops running a full build during lints, which is not necessary (and
sometimes uses more memory than the build runner has, failing the lint).
Differential Revision: https://phabricator.services.mozilla.com/D123970
Although we set all selected text to intent that is text processing, it may
cause `RemoteException` since binder cannot handle large data.
So we should truncate the text if it is more than 100K. This value is same as
Blink's limitation (https://crbug.com/1077599).
Differential Revision: https://phabricator.services.mozilla.com/D123410
Depending on glean creates a circular dependency as glean depends on
glean-native which is substituted with GeckoView in omni builds.
Since Gradle 6 capabilities are passed on to consumers using the Gradle Module
Metadata, so now we can just define a glean capability in GeckoView and Fenix
will consume glean-native from GeckoView instead of adding a duplicated
libglean blob (there is code in the glean plugin to make sure this happens).
See also: https://docs.gradle.org/current/userguide/component_capabilities.html
Co-authored-by: Jan-Erik Rediger <janerik@fnordig.de>
Differential Revision: https://phabricator.services.mozilla.com/D123572
There's a lot of code that we don't need anymore in our publication path (I'm
assuming it was needed when it was written but then gradle/the android plugin
caught up).
This has the nice side effect of producing better metadata (e.g. our
implementation dependencies end up in the |runtime| dependency group instead of
the default one where they were before, which means the app doesn't inherit our
private dependencies).
Co-authored-by: Jan-Erik Rediger <janerik@fnordig.de>
Differential Revision: https://phabricator.services.mozilla.com/D123571
This is the last version that doesn't require Java 11, we will upgrade to
Gradle 7 once all components are ready (namely, apilint).
Co-authored-by: Jan-Erik Rediger <janerik@fnordig.de>
Differential Revision: https://phabricator.services.mozilla.com/D123569
Looks like 6G is not enough for an ASAN build when updating the gradle version.
I tried 8G on try but that's not enough either.
Differential Revision: https://phabricator.services.mozilla.com/D123970
When focus isn't changed and inputmode in focused element is changed to none,
we should dismiss software keyboard.
Also, this has same issue for changing from none to text to show software
keyboard.
When changing inputmode, icNotifyIMEContext is called then we should control
software keyboard open/close state too.
Differential Revision: https://phabricator.services.mozilla.com/D122491
Depending on glean creates a circular dependency as glean depends on
glean-native which is substituted with GeckoView in omni builds.
Since Gradle 6 capabilities are passed on to consumers using the Gradle Module
Metadata, so now we can just define a glean capability in GeckoView and Fenix
will consume glean-native from GeckoView instead of adding a duplicated
libglean blob (there is code in the glean plugin to make sure this happens).
See also: https://docs.gradle.org/current/userguide/component_capabilities.html
Co-authored-by: Jan-Erik Rediger <janerik@fnordig.de>
Differential Revision: https://phabricator.services.mozilla.com/D123572
There's a lot of code that we don't need anymore in our publication path (I'm
assuming it was needed when it was written but then gradle/the android plugin
caught up).
This has the nice side effect of producing better metadata (e.g. our
implementation dependencies end up in the |runtime| dependency group instead of
the default one where they were before, which means the app doesn't inherit our
private dependencies).
Co-authored-by: Jan-Erik Rediger <janerik@fnordig.de>
Differential Revision: https://phabricator.services.mozilla.com/D123571
This is the last version that doesn't require Java 11, we will upgrade to
Gradle 7 once all components are ready (namely, apilint).
Co-authored-by: Jan-Erik Rediger <janerik@fnordig.de>
Differential Revision: https://phabricator.services.mozilla.com/D123569
The purpose of this is to remove as many docstrings from CommandProvider
classes to make the step of moving commands out of classes simpler.
Where possible, the docstring has been moved to or merged with the function.
Differential Revision: https://phabricator.services.mozilla.com/D123288
This commit allows Android to use the login storage for HTTP auth by migrating
some common toolkit code to promptUsernameAndPassword and promptPassword which
use the login storage.
Differential Revision: https://phabricator.services.mozilla.com/D122508
Historically, only session delegates have been allowed in GeckoSessionTestRule
utilities like delegateUntilTestEnd or delegateDuringNextWait.
There's no reason it has to be that way though, and allowing runtime delegates
to use the same utilities removes a lot of boilerplate code that we don't need.
Differential Revision: https://phabricator.services.mozilla.com/D122507
Almost all delegates have getters except for these two. These are also helpful
when implementing delegateUntilTestEnd for runtime delegates.
Differential Revision: https://phabricator.services.mozilla.com/D122505
This change adds a new API that allows Gecko to dismiss a prompt automatically.
This will be used to dismiss prompts when they shouldn't be displayed anymore,
e.g. when using basic auth, we hide the prompt if the server rejects the login
information, as we know that the login info is not correct, so there's no point
in saving it.
We will also dismiss prompts automatically when they become stale, e.g. if a
permission prompt is raised and then the user navigates away.
To be able to dismiss a prompt we need to keep track of existing prompt
instances for a Session. We assign each prompt a unique, randomly generated,
UUID that is used to match the javascript prompt instance with the java
counterpart.
The prompts are stored in PromptHolder. Because the PromptController is owned
by the GeckoSession, whenever the session is GC'd we will also release the
prompts associated to it (if any).
Differential Revision: https://phabricator.services.mozilla.com/D122504
It's an unnecessary difference with our other clang builds. It looks
like it was cargo-culted from some external script. It makes the
android-cross clang different in the way it finds e.g. compiler
runtimes, some of which are in lib/, and others in lib64/, and only the
latter are actually found.
Differential Revision: https://phabricator.services.mozilla.com/D123017
Glean introduced a new type of dependencies (for us), "api". Since we build our
pom file manually we need to look at api dependencies too now.
Differential Revision: https://phabricator.services.mozilla.com/D122869
AFAICT, all roads lead though [`nsAppStartup::Quit`](https://searchfox.org/mozilla-central/rev/0fec57c05d3996cc00c55a66f20dd5793a9bfb5d/toolkit/components/startup/nsAppStartup.cpp#448),
which is responsible for firing the `"quit-application"` observer notification
and then posting the `nsAppExitEvent` that causes the `nsAppShell` to break out
of its event loop and proceed with shutdown.
If we trigger a native crash in the observer, we should be able to capture a
symbolicated stack of whatever called `Quit`. We might as well force-crash
anyway, since AC is going to throw an exception regardless...
Before we crash, we annotate the current `GeckoThread` state to enable us to
find out whether we were fully initialized at the time of the shutdown.
Differential Revision: https://phabricator.services.mozilla.com/D122256
AFAICT, all roads lead though [`nsAppStartup::Quit`](https://searchfox.org/mozilla-central/rev/0fec57c05d3996cc00c55a66f20dd5793a9bfb5d/toolkit/components/startup/nsAppStartup.cpp#448),
which is responsible for firing the `"quit-application"` observer notification
and then posting the `nsAppExitEvent` that causes the `nsAppShell` to break out
of its event loop and proceed with shutdown.
If we trigger a native crash in the observer, we should be able to capture a
symbolicated stack of whatever called `Quit`. We might as well force-crash
anyway, since AC is going to throw an exception regardless...
Before we crash, we annotate the current `GeckoThread` state to enable us to
find out whether we were fully initialized at the time of the shutdown.
Differential Revision: https://phabricator.services.mozilla.com/D122256
The problem here is that the release artifactId was using single quotes instead
of double. I rewrote this code a little bit to avoid this sort of problem next
time by not having a release-build-only conditional branch.
Differential Revision: https://phabricator.services.mozilla.com/D122496
This function will be used in the next commit to make sure there's no remaining
paint requests before proceeding each test cases. This code was mostly copied
and pasted from the commit when we introduced flushApzRepaints in bug 1660357.
This `promiseAllPaintsDone` is a simplified version of promiseAllPaintsDone in
paint_listener.js. Though the paint_listener version is supposed to be loaded
and supposed to add an event listener for MozAfterPaint events in the first
place, whereas this version is supposed to keep adding an event listener for a
MozAfterPaint event until there's no pending paint request when it gets called,
it's a compromise but it should work as expected in most cases.
Differential Revision: https://phabricator.services.mozilla.com/D122310
And make sure the caret ends up being visible, rather than _not_
visible.
This should be implementable on windows as well. It seems macOS doesn't
have a timeout thing.
Differential Revision: https://phabricator.services.mozilla.com/D122132
This is a large refactoring of the DocumentChannel process switch codepath,
with the end goal of being better able to support future process switch
requirements such as dynamic isolation on android, as well as the immediate
requirement of null principal handling.
The major changes include:
1. The logic is in C++ and has less failure cases, meaning it should be harder
for us to error out unexpectedly and not process switch.
2. Process selection decisions are more explicit, and tend to rely less on
state such as the current remoteType when possible. This makes reasoning
about where a specific load will complete easier.
3. Additional checks are made after a "WebContent" behavior is selected to
ensure that if an existing document in the same BCG is found, the load will
finish in the required content process. This should make dynamic checks such
as Android's logged-in site isolation easier to implement.
4. ProcessIsolation logging is split out from DocumentChannel so that it's
easier to log just the information related to process selection when
debugging.
5. Null result principal precursors are considered when performing process
selection.
Other uses of E10SUtils for process selection have not yet been migrated to the
new design as they have slightly different requirements. This will be done in
follow-up bugs.
Differential Revision: https://phabricator.services.mozilla.com/D120673
In GeckoView we need to depend on the same Glean version as the included
Glean Rust crate has.
We _could_ let Gradle read that from Cargo.lock directly,
but that complicates the build.
Instead we manually update both versions to the same
and have Gradle ensure we don't forget that.
Differential Revision: https://phabricator.services.mozilla.com/D116602
This also upgrades to Kotlin 1.3.50, which is required to due Glean
requirements. Fenix is already on 1.4, so that's no problem.
We also turn the geckoview_example into a multiDex application.
Otherwise we run into the 64k dex symbols size limit.
Differential Revision: https://phabricator.services.mozilla.com/D116601
This is a large refactoring of the DocumentChannel process switch codepath,
with the end goal of being better able to support future process switch
requirements such as dynamic isolation on android, as well as the immediate
requirement of null principal handling.
The major changes include:
1. The logic is in C++ and has less failure cases, meaning it should be harder
for us to error out unexpectedly and not process switch.
2. Process selection decisions are more explicit, and tend to rely less on
state such as the current remoteType when possible. This makes reasoning
about where a specific load will complete easier.
3. Additional checks are made after a "WebContent" behavior is selected to
ensure that if an existing document in the same BCG is found, the load will
finish in the required content process. This should make dynamic checks such
as Android's logged-in site isolation easier to implement.
4. ProcessIsolation logging is split out from DocumentChannel so that it's
easier to log just the information related to process selection when
debugging.
5. Null result principal precursors are considered when performing process
selection.
Other uses of E10SUtils for process selection have not yet been migrated to the
new design as they have slightly different requirements. This will be done in
follow-up bugs.
Differential Revision: https://phabricator.services.mozilla.com/D120673