Commit Graph

1827 Commits

Author SHA1 Message Date
Rob Wu
16bd388a6d Bug 1792094 - Improve accuracy of error reporting by sendNativeMessage r=rpl
Differential Revision: https://phabricator.services.mozilla.com/D157985
2022-09-23 05:18:38 +00:00
Rob Wu
de8af1e9bc Bug 1791788 - Add test coverage for nativeMessaging manifest parsing r=rpl
This patch refactors the existing nativeMessaging tests, by introducing
a shared helper to test bad nativeMessaging hosts. It also introduces a
hook to the test helper to allow the test to easily manipulate the
generated native messaging manifest to intentionally trigger the error
conditions. These are used to add test coverage for scenarios that were
previously not covered.

test_forward_slashes_in_path_works is the regression test for the linked
bug.

Differential Revision: https://phabricator.services.mozilla.com/D157984
2022-09-23 05:18:38 +00:00
Joel Maher
1325c90046 Bug 1790868 - clean up 32 bit annotations for tests that don't run on 32 bit, and general cleanup. r=aryx
Differential Revision: https://phabricator.services.mozilla.com/D157352
2022-09-16 12:40:13 +00:00
Luca Greco
ce33eddfc1 Bug 1787940 - Remove redundant toolkit.telemetry.testing.overrideProductsCheck being set in single test files. r=willdurand
Differential Revision: https://phabricator.services.mozilla.com/D156980
2022-09-13 17:21:29 +00:00
Luca Greco
e775d9654d Bug 1787940 - Add new telemetry for event page running time and idle timeout results. r=willdurand
Differential Revision: https://phabricator.services.mozilla.com/D156490
2022-09-13 17:21:29 +00:00
Rob Wu
e4229303f7 Bug 1789751 - Remove localhost from MV3 CSP r=mixedpuppy
Differential Revision: https://phabricator.services.mozilla.com/D156758
2022-09-10 23:49:49 +00:00
Rob Wu
9288673133 Bug 1766881 - Drop object-src requirement from extension CSP r=mixedpuppy
object-src used to be required because it controls plugins, and we did
not want to load unsafe sources as plugins. With NPAPI plugin support
having been dropped a long time ago, this reason no longer exist.
The requirement for "secure" object-src CSP directive meant that
extensions had to specify a boilerplate object-src if they wanted to
modify script-src.

This patch removes the object-src requirement from extension CSP,
which simplifies the usage and learning curve of CSP usage in
extensions.

With this change, extensions can now load "unsafe" (remote) content
via `<embed>` and `<object>` tags. This relaxation does not reduce
the security because this was already possible with `<iframe>` tags.

Differential Revision: https://phabricator.services.mozilla.com/D156747
2022-09-10 23:49:48 +00:00
Dão Gottwald
ee0738747b Bug 1788822 - Simplify color-scheme content override pref to only be [dark, light, auto]. r=emilio,fluent-reviewers,extension-reviewers,robwu,flod
Differential Revision: https://phabricator.services.mozilla.com/D156710
2022-09-08 17:55:07 +00:00
Mark Banner
73631b4520 Bug 1789254 - Migrate enterprisepolicies consumers to use ESM imports directly. r=mkaply,necko-reviewers,application-update-reviewers,nalexander
Differential Revision: https://phabricator.services.mozilla.com/D156464
2022-09-08 14:40:07 +00:00
Norisz Fay
6008f8d423 Backed out 3 changesets (bug 1789254) for causing bc failures on browser_xpcom_graph_wait.js CLOSED TREE
Backed out changeset bea1e1ba4a14 (bug 1789254)
Backed out changeset 4086aaa5f3d0 (bug 1789254)
Backed out changeset 131cac1d1146 (bug 1789254)
2022-09-08 17:14:00 +03:00
Mark Banner
e8c3c1e5b4 Bug 1789254 - Migrate enterprisepolicies consumers to use ESM imports directly. r=mkaply,necko-reviewers,application-update-reviewers,nalexander
Differential Revision: https://phabricator.services.mozilla.com/D156464
2022-09-08 12:43:32 +00:00
Shane Caraveo
ef50590a13 Bug 1786564 allow access to static theme resources in extensions r=rpl,necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D156618
2022-09-07 20:16:19 +00:00
Luca Greco
f4663869d1 Bug 1788108 - Enable event pages support for manifest_version 2 extensions. r=mixedpuppy
Differential Revision: https://phabricator.services.mozilla.com/D156171
2022-09-02 19:58:25 +00:00
Mark Hammond
2a80a5d8d4 Bug 1787688 (part 2) - rename envelope fields and promisify the xpcom bridged engine wrapper. r=skhamis
Differential Revision: https://phabricator.services.mozilla.com/D155816
2022-09-02 00:32:54 +00:00
Luca Greco
6e277be9e6 Bug 1787145 - Clear dynamically registered content scripts persisted across sessions on addon updates. r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D155592
2022-09-01 11:36:53 +00:00
Luca Greco
b599a27210 Bug 1785294 - Allow pending async API event listeners calls to reset event page idle timeout only once. r=mixedpuppy
Depends on D153525

Differential Revision: https://phabricator.services.mozilla.com/D155071
2022-08-30 19:25:01 +00:00
Luca Greco
143dcd66ef Bug 1785294 - Reset idle on API event listeners with a pending queryRunListener promise. r=mixedpuppy
Differential Revision: https://phabricator.services.mozilla.com/D153525
2022-08-30 19:25:01 +00:00
Cosmin Sabou
d22f5627d5 Backed out 2 changesets (bug 1785294) for causing xpcshell failures on est_ext_eventpage_settings.js. CLOSED TREE
Backed out changeset fea7efce878b (bug 1785294)
Backed out changeset 4b7c6808489d (bug 1785294)
2022-08-29 23:57:11 +03:00
Luca Greco
1d162d0136 Bug 1785294 - Allow pending async API event listeners calls to reset event page idle timeout only once. r=mixedpuppy
Depends on D153525

Differential Revision: https://phabricator.services.mozilla.com/D155071
2022-08-29 20:12:17 +00:00
Luca Greco
23ede65579 Bug 1785294 - Reset idle on API event listeners with a pending queryRunListener promise. r=mixedpuppy
Differential Revision: https://phabricator.services.mozilla.com/D153525
2022-08-29 20:12:17 +00:00
Luca Greco
516504112b Bug 1785821 - Only allow manifest_version 3 extensions to merge CSP in the short run. r=mixedpuppy
This patch includes:

- changes to WebRequest.jsm to always default to only merge the CSP headers returned by MV3 extensions

- changes to the test_ext_webRequest_mergecsp.js xpcshell test to cover the behavior expected
  with MV3 extensions and combinations of both MV2 and MV3 extensions changing CSP headers
  for the same intercepted web request.

For MV3 extensions we would prefer a more explicit and predictable way for the
extensions to be allowed to replace the CSP header, instead of keeping the same
unpredictable and implicit one that we currently support for MV2 extensions.

Differential Revision: https://phabricator.services.mozilla.com/D154983
2022-08-25 19:13:50 +00:00
Kagami Sascha Rosylight
a37cf7833d Bug 1695435 - Part 2: Add more words to the chrome script heuristic in use-isInstance r=preferences-reviewers,Gijs,webdriver-reviewers,whimboo,sgalich
Differential Revision: https://phabricator.services.mozilla.com/D110932
2022-08-24 22:47:42 +00:00
Luca Greco
845fdf65ba Bug 1785898 - Cache into StartupCache a boolean flag to determine if there is any persisted content script. r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D155256
2022-08-24 11:50:51 +00:00
John Bieling
a6dab7ec72 Bug 1764698 - Move LanguageDetector.jsm and related files to toolkit. r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D151606
2022-08-23 05:59:55 +00:00
Rob Wu
7a7b4b2ab0 Bug 1745762 - Add registration of DNR session rules r=rpl
This patch offers the Rule type and updateSessionRules and
getSessionRules to register rules. The actual evaluation of rules and
most of the associated validation is not part of this patch.

Differential Revision: https://phabricator.services.mozilla.com/D154801
2022-08-22 20:44:26 +00:00
Rob Wu
1e8d95f588 Bug 1783828 - Re-enable test_ext_permission_warnings.js in condprof r=rpl
Differential Revision: https://phabricator.services.mozilla.com/D154807
2022-08-16 23:50:30 +00:00
Mark Banner
19a1cb499e Bug 1784699 - Turn off the ESLint browser environment for xpcshell-tests for better represetation of the globals actually available. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D154606
2022-08-15 16:50:33 +00:00
Andrew McCreight
50a54ee067 Bug 1763197 - Disable test_ext_userScripts_register.js without Fission. r=rpl
This test seems to fail frequently on Linux without Fission, and on Android,
when the parent controlled navigation pref is enabled, so disable the test
there. We don't really support non-Fission builds anyways, and apparently
containers aren't supported on Android.

Differential Revision: https://phabricator.services.mozilla.com/D154288
2022-08-10 19:38:16 +00:00
Rob Wu
d4057ffeac Bug 1780747 - Restrict DNR permissions to MV3 for now r=rpl
Restrict the DNR permissions to MV3 to allow the add-ons linter to
easily flag the use of the not-yet-supported DNR permission, until
we do actually enable the feature.

Since the full DNR namespace is gated on this permission, this
effectively means that in order to use the API, not only the
extensions.dnr.enabled pref needs to be set, but also the
extensions.manifestV3.enabled pref + using manifest_version: 3..

Differential Revision: https://phabricator.services.mozilla.com/D153458
2022-08-09 12:16:34 +00:00
Rob Wu
265598bc62 Bug 1780747 - Register DNR schema and permissions r=rpl,geckoview-reviewers,owlish,flod
This patch adds the minimum necessary to register the
declarativeNetRequest API and its permissions, behind prefs.

Tests have been added/updated to verify that the permissions and API
access are enforced correctly (effectiveness of preferences, API
visibility, permission warnings).

Before landing this, we need to register the permission warning in
Android-Components too, as mentioned in the bug (i.e. bug 1671453).

Differential Revision: https://phabricator.services.mozilla.com/D152503
2022-08-09 12:16:34 +00:00
Cristian Tuns
fbb11ed710 Backed out 2 changesets (bug 1780747) for causing xpcshell failures on test_ext_permission_warnings.js CLOSED TREE
Backed out changeset be950e847c33 (bug 1780747)
Backed out changeset b07c7315a02a (bug 1780747)
2022-08-08 19:04:56 -04:00
Rob Wu
2a00a3d9ee Bug 1780747 - Restrict DNR permissions to MV3 for now r=rpl
Restrict the DNR permissions to MV3 to allow the add-ons linter to
easily flag the use of the not-yet-supported DNR permission, until
we do actually enable the feature.

Since the full DNR namespace is gated on this permission, this
effectively means that in order to use the API, not only the
extensions.dnr.enabled pref needs to be set, but also the
extensions.manifestV3.enabled pref + using manifest_version: 3..

Differential Revision: https://phabricator.services.mozilla.com/D153458
2022-08-08 22:11:08 +00:00
Rob Wu
ae8baf4117 Bug 1780747 - Register DNR schema and permissions r=rpl,geckoview-reviewers,owlish,flod
This patch adds the minimum necessary to register the
declarativeNetRequest API and its permissions, behind prefs.

Tests have been added/updated to verify that the permissions and API
access are enforced correctly (effectiveness of preferences, API
visibility, permission warnings).

Before landing this, we need to register the permission warning in
Android-Components too, as mentioned in the bug (i.e. bug 1671453).

Differential Revision: https://phabricator.services.mozilla.com/D152503
2022-08-08 22:11:08 +00:00
Shane Caraveo
7b13a7a057 Bug 1783442 Fix cases where case sensitivy matters in WebExtensionPolicy r=zombie
Differential Revision: https://phabricator.services.mozilla.com/D153867
2022-08-08 15:39:37 +00:00
Shane Caraveo
bcdf31e048 Bug 1773115 fix extension global matching for web accessible resources r=rpl
Differential Revision: https://phabricator.services.mozilla.com/D153865
2022-08-08 15:39:36 +00:00
Shane Caraveo
ed6a1bcba8 Bug 1783078 require web_accessible_resources for any extension loads from a content script r=robwu,ckerschb
Enforce requiring web accessible resources in MV3 and use a pref to turn on later for MV2.

Differential Revision: https://phabricator.services.mozilla.com/D153677
2022-08-05 04:36:30 +00:00
Andrew McCreight
379860c322 Bug 1780488 - Fix the race in test_ext_userScripts_register.js. r=rpl
This adds a content script that sends a test message that runs
after the user scripts to ensure that the user scripts have
finished running. Otherwise, we can end up checking the value
of textContent before the script runs. This happens frequently
with both Fission enabled and with parent-controlled navigation.
This has to be done in a content script because sendMessage is
not available in a user script.

Based on the test name and the comments that added this test,
it should have been testing userScripts.register instead of
contentScripts.register, so I fixed that.

I also fixed a few references in text to contentScript.register
that should be contentScripts.register.

Differential Revision: https://phabricator.services.mozilla.com/D153293
2022-08-04 22:12:28 +00:00
William Durand
db8cec58d0 Bug 1751436 - Add support for persistAcrossSessions in scripting.RegisteredContentScript. r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D147671
2022-08-04 09:09:07 +00:00
William Durand
ab339f1579 Bug 1769241 - Skip test when fission is enabled, and run it sequentially. r=rpl
See also: Bug 1762638

Differential Revision: https://phabricator.services.mozilla.com/D153646
2022-08-03 20:11:46 +00:00
Shane Caraveo
cf6598bc39 Bug 1773115 ensure extension access to its own web accessible resources r=rpl
Differential Revision: https://phabricator.services.mozilla.com/D150498
2022-08-02 17:08:59 +00:00
Shane Caraveo
4e3ceb6b90 Bug 1711168 support extension matching in webAccessibleResources r=zombie,smaug,rpl
Differential Revision: https://phabricator.services.mozilla.com/D115114
2022-08-02 17:08:58 +00:00
William Durand
aaf5c93693 Bug 1748315 - Part 3 - Generate WebIDL bindings for the scripting namespace. r=rpl,webidl,smaug
This patch adds WebIDL bindings for the `scripting` namespace.
Note that `scripting.executeScript()` is excluded for now.

Differential Revision: https://phabricator.services.mozilla.com/D141463
2022-08-02 14:22:39 +00:00
William Durand
6257b64162 Bug 1748315 - Part 2 - Pass context.childManager to Schemas.checkParameters(). r=rpl
This is required to load and validate JSON schemas that use formatters like `relativeUrl`.

Depends on D141750

Differential Revision: https://phabricator.services.mozilla.com/D141751
2022-08-01 15:02:21 +00:00
William Durand
6315ae37ac Bug 1748315 - Part 1 - Propagate json schema validation errors to the extension. r=rpl
Depends on #D141749

Differential Revision: https://phabricator.services.mozilla.com/D141750
2022-08-01 06:31:55 +00:00
Joel Maher
0b37b77f65 Bug 1781782 - Run frequent xpcshell parallel failing tests sequential by default. r=ahal,necko-reviewers,extension-reviewers,application-update-reviewers,bytesized,rpl,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D153081
2022-07-30 01:33:28 +00:00
Butkovits Atila
b01ed36979 Backed out 3 changesets (bug 1711168, bug 1773115) for causing failures at test_ext_web_accessible_resources.html. CLOSED TREE
Backed out changeset 703c909eb009 (bug 1773115)
Backed out changeset 902385a7ce60 (bug 1711168)
Backed out changeset 3d061ce03de7 (bug 1711168)
2022-07-27 00:13:26 +03:00
Shane Caraveo
ac5fcd6217 Bug 1773115 ensure extension access to its own web accessible resources r=rpl
Differential Revision: https://phabricator.services.mozilla.com/D150498
2022-07-26 19:39:15 +00:00
Shane Caraveo
addcb41d12 Bug 1711168 support extension matching in webAccessibleResources r=zombie,smaug,rpl
Differential Revision: https://phabricator.services.mozilla.com/D115114
2022-07-26 19:39:14 +00:00
Tom Schuster
c50dd4c55d Bug 830716 - Show class-name of object that failed to be cloned. r=smaug
This has one small wrinkle that I might fix in the future: DOM classes that are proxies
like window show up as "Proxy".

Differential Revision: https://phabricator.services.mozilla.com/D152566
2022-07-26 08:19:40 +00:00
Luca Greco
4c77f64abe Bug 1780229 - Prevent test_ext_native_messaging.js intermittent failures. r=mixedpuppy
This patch includes the following tweaks to the new test cases as introduced from Bug 1770696:

- Added an explicit `await waitForSubprocessExit();` to the two new test cases which are starting
  a NativeApplication as part of the test case, to make sure to wait for the subprocess to have
  been fully exited, otherwise that triggers a failure on windows 10 because the files that should
  be removed when the test task is exiting would still be in use (and trying to remove them fails
  only on the windows platform)

- Reworked the NativeApp used by the testSendNativeMessage test task to don't wrongly assume the
  NativeApp handling all the messages sent to be the same one even if one is still running to
  handle a delayed message pending a reply:
  - Each sendNativeMessage call will be spawning its own NativeApp instance and so the test native
    app is now resorting to a `time.sleep(...)` call to delay replying to any message received,
    to give some time for the test case to cover the behavior expected while a native message is
    still pending a reply.
  - Added Some stderr logs to the NativeApp, to make it easier to see at which point of
    the test case the NativeApp is being started, replying to a message and terminated, along
    with including the process pid to more easily determine if the NativeApp instance is still
    the one we expect to be running and replying to the native messages received.

Differential Revision: https://phabricator.services.mozilla.com/D152292
2022-07-22 08:10:25 +00:00