We have several tests which assume that the CSS associated with a content
script will have loaded by the time the script executes. There is nothing
guaranteeing this, though, and they currently mostly pass due to a combination
of luck and successful pre-loading.
This patch fixes the injection logic to always wait for a script's CSS entries
to finish loading before executing its JS, so behavior at least consistently
matches expectations.
Differential Revision: https://phabricator.services.mozilla.com/D47493
--HG--
extra : moz-landing-system : lando
Replaced instances of callers in both C++ and JS files to query the state from the principal directly.
Differential Revision: https://phabricator.services.mozilla.com/D22532
--HG--
extra : moz-landing-system : lando
***
Bug 1514594: Part 3a - Change ChromeUtils.import to return an exports object; not pollute global. r=mccr8
This changes the behavior of ChromeUtils.import() to return an exports object,
rather than a module global, in all cases except when `null` is passed as a
second argument, and changes the default behavior not to pollute the global
scope with the module's exports. Thus, the following code written for the old
model:
ChromeUtils.import("resource://gre/modules/Services.jsm");
is approximately the same as the following, in the new model:
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
Since the two behaviors are mutually incompatible, this patch will land with a
scripted rewrite to update all existing callers to use the new model rather
than the old.
***
Bug 1514594: Part 3b - Mass rewrite all JS code to use the new ChromeUtils.import API. rs=Gijs
This was done using the followng script:
https://bitbucket.org/kmaglione/m-c-rewrites/src/tip/processors/cu-import-exports.jsm
***
Bug 1514594: Part 3c - Update ESLint plugin for ChromeUtils.import API changes. r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D16747
***
Bug 1514594: Part 3d - Remove/fix hundreds of duplicate imports from sync tests. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D16748
***
Bug 1514594: Part 3e - Remove no-op ChromeUtils.import() calls. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D16749
***
Bug 1514594: Part 3f.1 - Cleanup various test corner cases after mass rewrite. r=Gijs
***
Bug 1514594: Part 3f.2 - Cleanup various non-test corner cases after mass rewrite. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D16750
--HG--
extra : rebase_source : 359574ee3064c90f33bf36c2ebe3159a24cc8895
extra : histedit_source : b93c8f42808b1599f9122d7842d2c0b3e656a594%2C64a3a4e3359dc889e2ab2b49461bab9e27fc10a7
This patch fixes the typo in the requiresCleanup getter and adds an additional step
in the automated tests to verify that the scripts created by browser.tabs.removeCSS
are not being added to the content scripts that requires cleanup.
Differential Revision: https://phabricator.services.mozilla.com/D17345
--HG--
extra : moz-landing-system : lando
This simplifies things all around, and gets rid of one more unnecessary
component registration.
--HG--
rename : toolkit/components/extensions/extension-process-script.js => toolkit/components/extensions/ExtensionProcessScript.jsm
extra : rebase_source : 7ceb6ada0730f8241bbd5ddbd889a320da22b1b1
This also adds new test coverage for the previously untested features:
- "file" in "js" param to userScripts.register works.
- "allFrames" set to true in userScripts.register works.
- scriptMetadata accepts primitive values, and in particular falsey
values in particular (= bug 1491397 ).
- scriptMetadata is the same object in all API script calls.
Differential Revision: https://phabricator.services.mozilla.com/D8582
--HG--
extra : moz-landing-system : lando
This patch introduces the userScripts API namespace and the userScripts.register API method,
which allows an extension to register some javascript code to run on the matched webpages
into an isolated sandbox (whereas all the content scripts from the same extension run in
a per-window sandbox shared by all the extension content scripts).
Differential Revision: https://phabricator.services.mozilla.com/D4353
--HG--
extra : moz-landing-system : lando
This patch introduces the userScripts API namespace and the userScripts.register API method,
which allows an extension to register some javascript code to run on the matched webpages
into an isolated sandbox (whereas all the content scripts from the same extension run in
a per-window sandbox shared by all the extension content scripts).
Differential Revision: https://phabricator.services.mozilla.com/D4353
--HG--
extra : moz-landing-system : lando
This patch moves the ExtensionTelemetry helpers (added into ExtensionUtils.jsm by Bug 1483002)
into a new ExtensionTelemetry.jsm and makes the ExtensionTelemetry a lazy getter on every one
of the JSM and API modules that are going to use it, so that we don't have to load these helpers
until they are actually used and we can reduce their impact on the base content memory usage.
Differential Revision: https://phabricator.services.mozilla.com/D5266
--HG--
extra : moz-landing-system : lando
This patch contains a set of changes needed to add WEBEXT telemetry probes keyed by addon id.
The telemetry probes keyed by addon id has been added as separate telemetry histograms
named after the related generic WEBEXT probe with the additional "_BY_ADDONID" suffix.
A set of small helper methods have been defined in a new ExtensionTelemetry object, exported
by the ExtensionUtils.jsm.
Differential Revision: https://phabricator.services.mozilla.com/D4437
--HG--
extra : moz-landing-system : lando
Variable `principal` is only used when `this.isExtensionPage` is false.
So move this inside the branch where this condition is satisfied, and
remove the `else if (this.isExtensionPage) { ... }` block.
(This is a follow-up to bug 1214658, where the check was introduced that
obsoleted the principal variable when `this.isExtensionPage` due to the
use of `contentWindow` instead of `principal`).
(`principal = contentPrincipal` was already unused at its introduction
in bug 1317697)
MozReview-Commit-ID: F7VX9vAH8MM
--HG--
extra : rebase_source : f2cbb1305d2ec98b471c0b43084e7b2c57ad05cd
`contentScripts` in extension-process-script.js lazily instantiates
`ExtensionContent.Script` using the key as "matcher".
This "matcher" is usually a `WebExtensionContentScript`, except in
case of "Extension:Execute". Then the object is a
`WebExtensionContentScript`, extended with some expando properties.
MozReview-Commit-ID: 3hMAy9Ff1lr
--HG--
extra : rebase_source : fba3ee4672541ddbdb0bb6d51044f989c606e3cb