These files were omitted from the original patch because reformatting them required some manual intervention in order to avoid breaking unit tests. Generally the `noqa` lines were already there and just needed to be moved from one line to another (due to the reformatting by `black`), but sometimes `black` saw fit to move a bunch of stuff all onto one line, requiring me to introduce new `noqa` lines.
Besides the autoformat by `black` and some manual fixups, this patch contains no other changes.
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94052
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Make some ad-hoc manual updates to `testing/marionette/client/setup.py`, `testing/marionette/harness/setup.py`, and `testing/firefox-ui/harness/setup.py`, which have hard-coded regexes that break after the reformat.
5. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
Some geckoview tests require gradient usage. Since background
images are async, these tests would wait for a contentful paint
to make sure the images are decoded before running the assertions.
This causes an issue because gradient-only backgrounds aren't
contentful anymore according to the latest spec.
We fix the tests by adding a transparent gif to the background
image list to trick the contentful detection.
Differential Revision: https://phabricator.services.mozilla.com/D88230
D89390 introduced a new mechanism which avoids tab with playing audio from being suspended when they are in background. However, it causes some unsatisfying regression such as bug 1670066 and bug 1670069.
In addition, according to what D89390 did, we change tab's docshell active state, which would also affect visibility event [1], and doing that would make tab always visible that would probably cause some bad effect. IIRC, some API like canvas would slow down its performance when it's in background in order to reduce the power consumption.
Therfore, reverting those change first and would use another way to fix the problem.
Differential Revision: https://phabricator.services.mozilla.com/D93444
These files were omitted from the original patch because reformatting them required some manual intervention in order to avoid breaking unit tests. Generally the `noqa` lines were already there and just needed to be moved from one line to another (due to the reformatting by `black`), but sometimes `black` saw fit to move a bunch of stuff all onto one line, requiring me to introduce new `noqa` lines.
Besides the autoformat by `black` and some manual fixups, this patch contains no other changes.
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94052
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
GeckoView is seemingly the last user depending on MediaManager iterating over
a all iframes of a window when queried for its capture state.
It is fine however, since GeckoViewMedia already iterates over all windows in
MediaManagerService.activeMediaCaptureWindows, which includes all subframes that
are actively captured.
This patch removes IterateWindowListeners altogether, and the last callsite is
simplified.
Differential Revision: https://phabricator.services.mozilla.com/D93079
We used to do this as part of requesting multiprocess in runtime settings, but
now that e10s is default, we need to set it here.
Differential Revision: https://phabricator.services.mozilla.com/D94207
This is a temporary workaround so that we can test Fission on GeckoView without
implementiong SessionStateAggregator, which needs to be moved to the parent
since Fission implies HistoryInParent.
Differential Revision: https://phabricator.services.mozilla.com/D93865
This also makes it so we don't set a cover automatically anymore, this avoids a
flash when an app sets a session immediately after removing the old session (AC
does this).
Additionally, this also helps with a startup flash, when it's too early for
GeckoView to know whether the app's theme is light or dark.
Differential Revision: https://phabricator.services.mozilla.com/D93815
This allows apps to modify the header filtering behavior, and introduces a safe
default (CORS safelisted).
Deprecated `loadUri` methods still maintain the old behavior so that we don't
inadvertently introduce bugs in apps.
Differential Revision: https://phabricator.services.mozilla.com/D91983
This introduces a new way of loading URIs in GeckoSession, using a builder-like
method `loader()` which deprecates the existing `loadUri`.
This change improves readability of long `loadUri` calls and allows us to add
more parameters without compromising usability.
It also fixes a bug where we were not short-circuiting the `onLoadRequest` call
in some cases.
Differential Revision: https://phabricator.services.mozilla.com/D91982
This allows apps to modify the header filtering behavior, and introduces a safe
default (CORS safelisted).
Deprecated `loadUri` methods still maintain the old behavior so that we don't
inadvertently introduce bugs in apps.
Differential Revision: https://phabricator.services.mozilla.com/D91983
This introduces a new way of loading URIs in GeckoSession, using a builder-like
method `loader()` which deprecates the existing `loadUri`.
This change improves readability of long `loadUri` calls and allows us to add
more parameters without compromising usability.
It also fixes a bug where we were not short-circuiting the `onLoadRequest` call
in some cases.
Differential Revision: https://phabricator.services.mozilla.com/D91982
This allows apps to modify the header filtering behavior, and introduces a safe
default (CORS safelisted).
Deprecated `loadUri` methods still maintain the old behavior so that we don't
inadvertently introduce bugs in apps.
Differential Revision: https://phabricator.services.mozilla.com/D91983
This introduces a new way of loading URIs in GeckoSession, using a builder-like
method `loader()` which deprecates the existing `loadUri`.
This change improves readability of long `loadUri` calls and allows us to add
more parameters without compromising usability.
It also fixes a bug where we were not short-circuiting the `onLoadRequest` call
in some cases.
Differential Revision: https://phabricator.services.mozilla.com/D91982
Since the semantics of `ContentParent::MarkAsDead` are significantly different
from `GeckoProcessManager::MarkAsDead`, let's rename the latter to better
reflect what it actually does.
Differential Revision: https://phabricator.services.mozilla.com/D92649
What flushApzRepaints does is basically same as what promiseApzRepaintsFlushed
does in apz_test_utils.js, calling nsIDOMWindowUtils.flushApzRepaints and waiting
for "apz-repaints-flushed" in the target content document.
Differential Revision: https://phabricator.services.mozilla.com/D93048
This mostly just refactors the stuff we had for Fennec.
We add a dependency on Google Play Services here, but care
is taken to ensure that things will fail gracefully if
Play Services are not present at runtime.
Differential Revision: https://phabricator.services.mozilla.com/D91446
This allows GeckoView to ask the embedding application to launch
other Activities on our behalf and collect the result. We need
this to invoke the FIDO authentication tools for WebAuthn.
Differential Revision: https://phabricator.services.mozilla.com/D91445
This mostly just refactors the stuff we had for Fennec.
We add a dependency on Google Play Services here, but care
is taken to ensure that things will fail gracefully if
Play Services are not present at runtime.
Differential Revision: https://phabricator.services.mozilla.com/D91446
This allows GeckoView to ask the embedding application to launch
other Activities on our behalf and collect the result. We need
this to invoke the FIDO authentication tools for WebAuthn.
Differential Revision: https://phabricator.services.mozilla.com/D91445
Documentation is lacking but apparently
`variant.javaCompileProvider.get().source` is always empty according to
da34aabdb6.
In that commit, `android.sourceSets.main.java.srcDirs` was the
replacement. However, I used
`variant.sourceSets.collect({ it.java.srcDirs }).flatten()` to be
consistent with an earlier usage in `build.gradle`.
Differential Revision: https://phabricator.services.mozilla.com/D91836
When collecting prefs from a RuntimeSettings we only consider children of the
instance. This change makes it so we traverse the whole tree, collecting
childrens of children, etc.
Differential Revision: https://phabricator.services.mozilla.com/D91674
Since GVE is supposed to be an exemplar for using GV the Right Way (TM), we
add an `onKill` handler that checks whether the killed session is current, and
does not restore the session if it is in the background.
When switching sessions, we add a check to see whether the session was closed,
and reopen it if so.
Differential Revision: https://phabricator.services.mozilla.com/D91465
This code is no longer needed now that `GeckoSession`'s `Parcelable` support
and its tests have been removed.
Depends on D91763
Differential Revision: https://phabricator.services.mozilla.com/D91764
Since GVE is supposed to be an exemplar for using GV the Right Way (TM), we
add an `onKill` handler that checks whether the killed session is current, and
does not restore the session if it is in the background.
When switching sessions, we add a check to see whether the session was closed,
and reopen it if so.
Differential Revision: https://phabricator.services.mozilla.com/D91465
This allows embedders to know when an extension is installed temporarily so
that they can allow it even if they would normally do it (e.g. for extensions
installed with web-ext).
Differential Revision: https://phabricator.services.mozilla.com/D91071
This allows embedders to know when an extension is installed temporarily so
that they can allow it even if they would normally do it (e.g. for extensions
installed with web-ext).
Differential Revision: https://phabricator.services.mozilla.com/D91071
`android.view.inputmethod.EditorInfo` has `inputType` feild that can control
capitalize of software keyboard. GeckoView should use it for autocapitalize
attribute support.
Differential Revision: https://phabricator.services.mozilla.com/D86678
These conversions are pretty straight forward thanks to the type system.
Basically we take a `NativeWeakPtr`, call `Access()` on it, and if the
accessor is truthy, then we call whatever methods we need to call.
Creation of new pointers is done using `NativeWeakPtrHolder::Attach()` and
detaching of strong references is done by `NativeWeakPtr::Detach()`.
Differential Revision: https://phabricator.services.mozilla.com/D87363
Given the access patterns involved on the native side, I think it is safest
to ensure that this field is access atomically by the VM.
Differential Revision: https://phabricator.services.mozilla.com/D87360
There are two things wrong with captureVisibleTab on mobile:
* ownerGlobal is not available on nativeTab, this patch uses
this.browser.ownerGlobal instead.
* ZoomManager is not available on mobile, this patch moves that code to
browser/../ext-tabs.
Differential Revision: https://phabricator.services.mozilla.com/D90009
Some geckoview tests require gradient usage. Since background
images are async, these tests would wait for a contentful paint
to make sure the images are decoded before running the assertions.
This causes an issue because gradient-only backgrounds aren't
contentful anymore according to the latest spec.
We fix the tests by adding a transparent gif to the background
image list to trick the contentful detection.
Differential Revision: https://phabricator.services.mozilla.com/D88230
There are two things wrong with captureVisibleTab on mobile:
* ownerGlobal is not available on nativeTab, this patch uses
this.browser.ownerGlobal instead.
* ZoomManager is not available on mobile, this patch moves that code to
browser/../ext-tabs.
Differential Revision: https://phabricator.services.mozilla.com/D90009
This patch tightens the coupling between the parent module and the child
actors.
Each parent module will receive messages from the corresponding child actors
whenever the parent actor does not define a message handler.
The parent actor also has the option to handle some messages and delegate the
rest by calling `super.receiveMessage`.
The idea is that every message that can be handled within the browsingContext
should be handled in the parent actor, while everything that needs context
across browsing contexts (e.g. page navigation listeners) should be handled in
the parent module.
Differential Revision: https://phabricator.services.mozilla.com/D89506
When restoring state into a new session, the actor gets recreated after
navigating away from `about:blank` so we have to query for it again to get the
right instance.
Differential Revision: https://phabricator.services.mozilla.com/D89475
For a local build on my Linux64 box, this reduces greprefs.js from 174,906
bytes to 103,221 bytes, and firefox.js from 112,100 bytes to 68,656 bytes.
Depends on D88242
Differential Revision: https://phabricator.services.mozilla.com/D88243
Without this, the asynchronous nature of compositor shutdown causes
races if the Android surface is immediately reused with another
GeckoSession instance.
Differential Revision: https://phabricator.services.mozilla.com/D89025
Given the access patterns involved on the native side, I think it is safest
to ensure that this field is access atomically by the VM.
Differential Revision: https://phabricator.services.mozilla.com/D87360
The patch converts the relevant prefs to use StaticPrefList and let's content JS in child processes to run longer if there
aren't mousedown/ups or keyevents or such. mousemove or wheel aren't considered as important events.
Differential Revision: https://phabricator.services.mozilla.com/D88668
When migrating RestoreState to actors we didn't consider that the child actor
gets recreated at every navigation, as its lifetime is tied to the inner
window.
This means that restoring state in one step is not possible, as restoring the
history will trigger a navigation from `about:blank` to the restored page.
To achieve this, we split restoring in two steps and we keep the state on the
parent actor instead of the child.
We move the restoring logic to a newly added GeckoViewContent parent actor,
which is more readibly accessible from both geckoview.js and
GeckoViewContent.jsm.
Differential Revision: https://phabricator.services.mozilla.com/D88637
Given the access patterns involved on the native side, I think it is safest
to ensure that this field is access atomically by the VM.
Differential Revision: https://phabricator.services.mozilla.com/D87360
Some geckoview tests require gradient usage. Since background
images are async, these tests would wait for a contentful paint
to make sure the images are decoded before running the assertions.
This causes an issue because gradient-only backgrounds aren't
contentful anymore according to the latest spec.
We fix the tests by adding a transparent gif to the background
image list to trick the contentful detection.
Differential Revision: https://phabricator.services.mozilla.com/D88230
This centralizes our print and preview setup in nsGlobalWindowOuter so
that we never re-clone a clone, and so that we reuse the window.open()
codepath to create the browsing context to clone into.
For window.print, for both old print dialog / silent printing and new
print preview UI, we now create a hidden browser (as in with visibility:
collapse, which takes no space but still gets a layout box).
* In the modern UI case, this browser is swapped with the actual print
preview clone, and the UI takes care of removing the browser.
* In the print dialog / silent printing case, the printing code calls
window.close() from nsDocumentViewer::OnDonePrinting().
* We don't need to care about the old print preview UI for this case
because it can't be open from window.print().
We need to fall back to an actual window when there's no
nsIBrowserDOMWindow around for WPT print tests and the like, which don't
have one. That seems fine, we could special-case this code path more if
needed but it doesn't seem worth it.
Differential Revision: https://phabricator.services.mozilla.com/D87063
Also fix WindowGlobalParent.drawSnapshot() to render the currently visible
viewport when called with a null rect, and clarify the webidl comment.
Differential Revision: https://phabricator.services.mozilla.com/D87971
Add test paintStatusReset() to ContentDelegateTest, which asserts that
onPaintStatusReset() is called after GeckoSession.setActive(false).
Add test capturePixelsSessionDeactivatedActivated() to ScreenshotTest, which
asserts that capturePixels() is successful if called when the session is
deactivated then reactivated, after waiting for the onPaintStatusReset() and
onFirstContentfulPaint() callbacks.
Differential Revision: https://phabricator.services.mozilla.com/D87463
Android-components listens to the GeckoView callback onFirstContentfulPaint to
track whether a contentful paint has occured, in order to decide when to
thumbnail a tab. Currently this gets fired once per tab.
However, when the GeckoSession is paused, we clear cached resources in the
compositor. This means that when the session is resumed, the compositor does not
have the necessary information to render the page (such as painted content
buffers, or the webrender display list). Because android-components attempts to
capture a new thumbnail immediately upon resuming, it ends up capturing a blank
thumbnail.
To fix this, add a new callback onPaintStatusReset() which is invoked when the
cached resources are cleared. Android-components can listen for this to be
informed when the contentful paint is no longer visible. It can then wait until
the subsequent contentful paint occurs before capturing the thumbnail.
Differential Revision: https://phabricator.services.mozilla.com/D87341
Do this by spinning the event loop until we've done the clone for
preview as appropriate.
This should be much less risky than finishing the previous patches
which would still be nice, but realistically landing them for 81 is not
going to happen.
This just returns without doing nothing in a couple cases, like when
there's already another modal dialog or such. That seems acceptable to
me, it's not clear what better way to do would be.
Differential Revision: https://phabricator.services.mozilla.com/D87484