The deserialize parameter is used only for getting global object, and in the JSM
context, it's the shared global. So directly passing globalThis works.
Differential Revision: https://phabricator.services.mozilla.com/D144133
This replaces all `instanceof` uses for DOM interfaces, since the operator in priviliged context works same as .isInstance().
Differential Revision: https://phabricator.services.mozilla.com/D141785
This replaces all `instanceof` uses for DOM interfaces, since the operator in priviliged context works same as .isInstance().
Differential Revision: https://phabricator.services.mozilla.com/D141785
ExtensionParent.jsm cannot be loaded without a profile, as explained at
https://bugzilla.mozilla.org/show_bug.cgi?id=1761072#c5.
But ExtensionsBackgroundScriptStatusWatcher would try to (lazily) load
the module before a profile was ready, in order to subscribe to future
changes. To avoid loading this whole ExtensionParent.jsm module, I have
replaced the event propagation mechanism with observers.
Differential Revision: https://phabricator.services.mozilla.com/D142065
During updates, isPrivileged was not set correctly, which resulted in
incorrect error messages (warnings about unsupported permissions) when a
privileged/builtin extension was updated (a variant of bug 1675858).
In the previous patch (part 3), isPrivileged was added to the
ExtensionData constructor, and also passed to BootstrapScope calls,
so we can use that here to.
The unit test here serves two purposes:
1. Primarily: test coverage for the correctness of isPrivileged in the
update scenario.
2. Test coverage for the existence and order of ExtensionAPI's onUpdate
calls. There is no unit test for this mechanism right now, only
indirect tests.
Differential Revision: https://phabricator.services.mozilla.com/D131682
`sender.frameId` should be set iff `sender.tab` is set, as documented at
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/MessageSender
The removal of the `viewType == "tab"` condition broke this in
https://hg.mozilla.org/mozilla-central/rev/2dc4f1baccc8
This patch makes the presence of `frameId` conditional on `tab`, and
fixes several tests that relied on the incorrect behavior:
- Move the runtime.onConnect test from test_ext_contentscript_in_background.js
to a new mochitest at test_ext_runtime_connect_iframe.html.
- Simplify test_ext_contentscript_in_background.js to continue to
provide test coverage for contentScripts.register + allFrames.
- Replace runtime.onConnect with runtime.getFrameId in
test_ext_contentscript_xorigin_frame.js, since sender.frameId is no
longer available in xpcshell tests (because internals to support the
tabs extension API are not available in xpcshell tests). The test
cannot be moved to a mochitest because its purpose is to provide test
coverage for process switching in a xpcshell test (bug 1580811).
Differential Revision: https://phabricator.services.mozilla.com/D135057
`sender.frameId` should be set iff `sender.tab` is set, as documented at
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/MessageSender
The removal of the `viewType == "tab"` condition broke this in
https://hg.mozilla.org/mozilla-central/rev/2dc4f1baccc8
This patch makes the presence of `frameId` conditional on `tab`, and
fixes several tests that relied on the incorrect behavior:
- Move the runtime.onConnect test from test_ext_contentscript_in_background.js
to a new mochitest at test_ext_runtime_connect_iframe.html.
- Simplify test_ext_contentscript_in_background.js to continue to
provide test coverage for contentScripts.register + allFrames.
- Replace runtime.onConnect with runtime.getFrameId in
test_ext_contentscript_xorigin_frame.js, since sender.frameId is no
longer available in xpcshell tests (because internals to support the
tabs extension API are not available in xpcshell tests). The test
cannot be moved to a mochitest because its purpose is to provide test
coverage for process switching in a xpcshell test (bug 1580811).
Differential Revision: https://phabricator.services.mozilla.com/D135057
`sender.frameId` should be set iff `sender.tab` is set, as documented at
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/MessageSender
The removal of the `viewType == "tab"` condition broke this in
https://hg.mozilla.org/mozilla-central/rev/2dc4f1baccc8
This patch makes the presence of `frameId` conditional on `tab`, and
fixes several tests that relied on the incorrect behavior:
- Move the runtime.onConnect test from test_ext_contentscript_in_background.js
to a new mochitest at test_ext_runtime_connect_iframe.html.
- Simplify test_ext_contentscript_in_background.js to continue to
provide test coverage for contentScripts.register + allFrames.
- Replace runtime.onConnect with runtime.getFrameId in
test_ext_contentscript_xorigin_frame.js, since sender.frameId is no
longer available in xpcshell tests (because internals to support the
tabs extension API are not available in xpcshell tests). The test
cannot be moved to a mochitest because its purpose is to provide test
coverage for process switching in a xpcshell test (bug 1580811).
Differential Revision: https://phabricator.services.mozilla.com/D135057
Make nativeMessaging a privileged permission on Android, to hide the
connectNative/sendNativeMessage APIs from non-builtin add-ons,
and to avoid the permission warning on regular extensions (where the API
is unavailable).
Add unit tests to get coverage on the availability and behavior of the
native messaging APIs on Android, since we did not have any yet.
And fix a small serialization issue in ExtensionParent.jsm
Differential Revision: https://phabricator.services.mozilla.com/D130529
Additional changes needed to observe the "extension-worker-loaded" topics and notify the main process when the background
service worker script has been fully loaded (similarly to how we notify the main process when
the background page has been fully loaded).
Differential Revision: https://phabricator.services.mozilla.com/D124704
Additional changes needed to observe the "extension-worker-loaded" topics and notify the main process when the background
service worker script has been fully loaded (similarly to how we notify the main process when
the background page has been fully loaded).
Differential Revision: https://phabricator.services.mozilla.com/D124704
This is currently a temporary quick approach to more quickly verify the
worker child context with a sample of API calls proxied to the main process
(currently using the alarms API, as it is pretty small and simple).
It is likely better for this patch to create a new parent context that is specifically
meant to be used for the worker proxied contexts.
Differential Revision: https://phabricator.services.mozilla.com/D86203
This is currently a temporary quick approach to more quickly verify the
worker child context with a sample of API calls proxied to the main process
(currently using the alarms API, as it is pretty small and simple).
It is likely better for this patch to create a new parent context that is specifically
meant to be used for the worker proxied contexts.
Differential Revision: https://phabricator.services.mozilla.com/D86203