This patch introduces a new xpcshell test that covers the behavior expected by the changes
applied from D119532.
The current testing strategy is based on the same internal Gecko platform APIs that are used
internally by Firefox DevTools internal API that about:debugging is using to detect when a worker is
spawned and terminated (based on JSProcessActors and nsIWorkerDebuggerManager) and to force spawn
a registered service worker (by calling the nsIServiceWorkerRegistrationInfo.attachDebugger method).
Differential Revision: https://phabricator.services.mozilla.com/D119799
This patch does prevent a service worker previously registered by a webextension to be spawned
if the webextension isn't enabled.
Instead of marking the service worker as disabled (e.g. as part of the registration data that we
store on disk), this patch is currently adding an additional check in
ServiceWorkerPrivateImpl::SpawnIfNeeded to make it early exit with an error if:
- the worker principal has a moz-extension url
- and it does not have a WebExtensionPolicy or the WebExtensionPolicy is not active
(which would mean that the extension was being uninstalled or disabled)
Differential Revision: https://phabricator.services.mozilla.com/D119532
This patch introduces changes to parent/ext-backgroundPage.js and Extension's shutdown methods to make sure
that all service workers registered by an extension are unregistered when the extension is shutting down,
unless the application is also shutting down (in which case the registration is not unregistered because
for the already installed extenson the previously activeWorker is expected to be still active across browser
restarts).
These changes prevent also to hit the issue that D119532 was triggering when an extension was reloaded
and it does not need any of the changes to ContentPrincipal::AddonPolicy from D119531.
Differential Revision: https://phabricator.services.mozilla.com/D119903
This code path is now the same as getGMPVideoDecoder, so we can merge them into
one and remove the decrypting decoder specific case.
Differential Revision: https://phabricator.services.mozilla.com/D120649
This adds the stub API for the page data service and some basic docs. The service can be used from
xpcshell tests and the events respond with sane data. As there are no consumers currently the
in-memory cache never clears.
Differential Revision: https://phabricator.services.mozilla.com/D120498
This patch does 2 things:
- It moves the closedOverBindings out of the cachedGCThings_.
- It hides the ScriptIndex extracted from cachedGCThings_.
The cachedGCThings_ used to contain both the TaggedParserAtomIndex and the
ScriptIndex as a TaggedScriptThingIndex. These 2 indexes are referring to data
which are not the same sources. The TaggedParserAtomIndex are indexes in the
parseAtom table, while the ScriptIndex are either newly allocated or reference
to an existing Stencil which is used as input.
Thus, the closedOverBindings_ are moved away of the cachedGCThings_ to highlight
that these are not indexes into an existing Stencil, but references to the
CompilationState.
As the ScriptIndex contained in the cachedGCThings_ are not valid for the
FullParseHandler, the ScriptIndex returned value is now hidden under private
functions, and the function index is used as a replacement. This way, the
ScriptIndex reference should not leak in the FullParseHandler, thus avoiding
confusion.
Differential Revision: https://phabricator.services.mozilla.com/D120635
This patch moves data from the CompilationInput to the CompilationState such
that the lifetime of the allocation spans are matching the LifoAlloc scope
maintained by the CompilationState.
A new structure named CompilationSyntaxParseCache is added to hold gcThings,
scriptData and scriptExtra spans which are made to either be allocated or alias
previous Stencil produced by the SyntaxParseHandler.
The FullParseHandler, instead of copying each span, now reference the
CompilationSyntaxParseCache as a constant.
Differential Revision: https://phabricator.services.mozilla.com/D120634
In order to be able to parse from an existing Stencil instead of a BaseScript*,
we have to replace all references to BaseScript* data by abstract data which can
be computed from both, and without the need for allocating GC objects.
This patch is the last change to the FullParseHandler to abstract over a GC
object (BaseScript*) and a Stencil. It removes all references to the
Rooted<BaseScript*> and replaces them by a simple boolean flag which indicate
whether we are reusing data from a pre-parsed function, instead of doing a full
parse which includes resolving bindings and parsing inner functions.
This patch also include a renaming of functions named `canSkip*` into `reuse*`,
to better highlight why we are doing differently.
Differential Revision: https://phabricator.services.mozilla.com/D120233
When delazifying with a `CompileLazyFunction` call, we reused
BaseScript::gcthings to skip over information already provided by the
`SyntaxParseHandler`, such as functions and closed-over bindings.
This change adds a stencil-like scriptData and scriptExtra spans, which are
created from the JSFunctions of BaseScript::gcthings() with the intent of later
using the same API for mapping input data from a Stencil without having to
allocate GC objects for eager delazifying functions.
`CompilationState::init` is modified to call the convertion from the
BaseScript::gcthings() to the `CompilationInput::cacheScriptData_` and
`CompilationInput::cacheScriptExtra_`. The logic of the `FullParseHandler` is
updated to work with the gcthings provided by the `CompilationInput` in a
similar way.
The function `skipLazyInnerFunction` now takes its inputs from the
`ScriptStencil` and from the `ScriptStencilExtra`, thus no longer relying on
`BaseScript::gcthings()` nor on a `JSFunction*` to extract this information
from. `FunctionBox` initialization reflect these changes by taking these 2
inputs as argument as well.
Note that the `ScriptStencil` and `ScriptStencilExtra` provided by the
`CompilationInput` do not reflect the full content of each script, but the bare
minimum used by `skipLazyInnerFunction`.
Differential Revision: https://phabricator.services.mozilla.com/D120232
When delazifying with a `CompileLazyFunction` call, we reused
BaseScript::gcthings to skip over information already provided by the
`SyntaxParseHandler`, such as functions and closed-over bindings.
This change adds a stencil-like gcthings span, which is created from the
BaseScript::gcthings() with the intent of later using the same API for mapping
input data from a Stencil without having to allocate GC objects for eager
delazifying functions.
`CompilationState::init` is modified to call the convertion from the
BaseScript::gcthings() to the `CompilationInput::cachedGcThings_`. The logic of
the `FullParseHandler` is updated to work with the gcthings provided by the
`CompilationInput` in a similar way, except that atoms contained in the original
vector are internalized under `CompilationState::init` instead of being
internalized when visiting each scope under
`propagateFreeNamesAndMarkClosedOverBindings`.
Differential Revision: https://phabricator.services.mozilla.com/D120231
In upcoming patches, we are converting the BaseScript::gcThings to a fake
stencil vector of TaggedScriptThingIndex. As we transition progressively, some
kind are not yet represented and therefore not used. To avoid encoding bad
indexes, we create a new OpaqueThing type which is meant to represent all things
we do not yet care about.
Differential Revision: https://phabricator.services.mozilla.com/D120230
Allow for downstream projects such as Thunderbird to set different GUIDs for
AccessibleHandler to avoid clashes when both applications are installed.
The GUIDs themselves can be defined in confvars.sh or in branding/configure.sh
depending on the specific needs of the application. Fallback GUIDs are in
old-configure.
Differential Revision: https://phabricator.services.mozilla.com/D118124
This adds the stub API for the page data service and some basic docs. The service can be used from
xpcshell tests and the events respond with sane data. As there are no consumers currently the
in-memory cache never clears.
Differential Revision: https://phabricator.services.mozilla.com/D120498
Use the dbstat virtual table to get some more advanced statistics about the database.
This doesn't have positive or negative effects on users, but allows us to get
more detailed info when asking for logs, and to check how MR2 data distributes
in the database.
The existing maintenance tests ensure the new methods don't throw, there's no
specific test checking for the output, since that's free-form logging.
Differential Revision: https://phabricator.services.mozilla.com/D120616
There were a few issues when Fission was being enabled:
1. the sw legacy listener was throwing when trying to compute the origin of the
"current" target in _onProcessAvailable. That's because the function might be
called while the "old" target was being destroyed, in which case its `url` property
is nullified. We can't simply use `targetCommand.target` though, as we might
be notified about the new process being created before about the new frame
document. The fix is to store a `currentTargetURL` property in the sw legacy listener,
and to update it when we receive `will-navigate` events.
2. A few functions were ignoring the `targetCommand.destroyServiceWorkersOnNavigation`
flag and clearing caches when doing a target switch. This meant that we might
not be notified about sw targets being unregistered after multiple navigations.
Differential Revision: https://phabricator.services.mozilla.com/D120710