Commit graph

249 commits

Author SHA1 Message Date
Kris Maglione
e930b89c34 Bug 1514594: Part 3 - Change ChromeUtils.import API.
***
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
2019-01-17 10:18:31 -08:00
Mark Striemer
50cfffaeaa Bug 1303384 - Part 2: Move some extension shortcut utils to ShortcutUtils r=aswan
Differential Revision: https://phabricator.services.mozilla.com/D4506

--HG--
extra : moz-landing-system : lando
2019-01-11 22:32:39 +00:00
Luca Greco
bc6ccc75fd Bug 1489315 - Move ExtensionTelemetry into its own JSM module. r=mixedpuppy
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
2018-09-07 16:27:44 +00:00
Luca Greco
88b7be38f8 Bug 1483002 - Added WEBEXT probes keyed by addon id. r=janerik,mixedpuppy
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
2018-09-05 20:16:35 +00:00
Boris Zbarsky
6e84b66899 Bug 1476145 part 6. Stop using getInterface(nsIDOMWindowUtils) in toolkit. r=mossop
This is not quite a mechanical change, because some places have a .top or
whatnot snuck in there, so please review carefully!
2018-07-24 19:47:42 -04:00
Andreea Pavel
c5bb0d1b10 No bug - fix merge conflict mistake r=Aryx on a CLOSED TREE
--HG--
extra : amend_source : 78dc5d2a30fb4208ca64ed8bde4db3fda63cb86b
2018-06-30 13:57:50 +03:00
Andreea Pavel
1bf7ac45bb Merge mozilla-central to mozilla-inbound. a=merge on a CLOSED TREE 2018-06-30 13:10:01 +03:00
Kris Maglione
fcedebb912 Bug 1471102: Move more code out of ExtensionUtils.jsm. r=aswan
MozReview-Commit-ID: Fqlv5BRuuW8

--HG--
extra : rebase_source : 348f037abd9cecfa080183bc365e5f005eac1bd6
extra : amend_source : 05dbfd12f553fc3f2a93374402e34d271e26d767
2018-06-25 19:30:21 -07:00
Adam Plaice
79a4e43a84 Bug 1364784 - Allow more modifier combinations for webextensions commands key; r=mixedpuppy,mstriemer
This allows keyboard shortcuts containing both "Ctrl" and "Alt" in the
manifest of webextensions (in the "commands" -> "suggested_key" key),
rather than just one of these modifiers. The equivalent combinations
on MacOS (any two of "Command", "Alt" and "MacCtrl") are also allowed.

Non-sensical combinations (such as "Ctrl+Command" or "Ctrl+Ctrl") are
forbidden.

MozReview-Commit-ID: 59tC2efLm5q

--HG--
extra : rebase_source : 5a9375116aab6b3c4abe96c4850e4ff857d93532
extra : intermediate-source : 507b35de0e93baccb54f83e8bce6cedfe9754dd9
extra : source : 115c5332fadc1d52940f8356f6273f0e9680657f
2018-06-02 00:56:44 +02:00
Kris Maglione
670fc0f25f Bug 1464743: Restore extension child shutdown timeout. r=aswan
MozReview-Commit-ID: 8O6CgKsOwom

--HG--
extra : rebase_source : d956c911188fc12451ac6fe8491b9fe87f2d6677
extra : histedit_source : 34c2fc20b42be87651124bca0ebe4d1572321100
2018-06-06 12:43:26 -07:00
Mark Striemer
ddc263525f Bug 1397809 - Part 1: Convert New Tab doorhanger to a generic class r=aswan,Gijs
MozReview-Commit-ID: 40RwrXjtsJJ

--HG--
extra : rebase_source : f688846407d32d3ec68ef96ea7432da9ed08a145
2017-12-19 13:56:04 -06:00
Boris Zbarsky
72db616bb9 Bug 1453053 part 3. Remove JS QIs to nsIMessageSender. r=qdot
MozReview-Commit-ID: 4TS38gebl7l
2018-04-12 00:06:25 -04:00
Kris Maglione
c15bbfb699 Bug 1451058: Follow-up: Fix some errors that show up during tests. r=me
MozReview-Commit-ID: K410z6VdHov

--HG--
extra : rebase_source : d768c2637f1fec2465f9e03b5e2b3e1ad25dadc5
2018-04-06 16:34:15 -07:00
Kris Maglione
202290f6bb Bug 1451215: Run codespell on code. r=aswan
MozReview-Commit-ID: HIilZTKcQUY

--HG--
extra : rebase_source : 48ba4b4ac06f6d146ce81050da6c60b6f7c3fbfc
extra : amend_source : cba3e4c100a57889851eaaffff3696d1285655ea
2018-04-03 22:22:07 -07:00
Kris Maglione
e427ba000e Bug 1420485: Follow-up: Remove unnecessary single-use stringToCryptoHash function. r=me
MozReview-Commit-ID: H1tPnsN0v2J

--HG--
extra : rebase_source : 616f0b88c1066ede9e45f6090115c4b45ca66db6
2018-03-11 22:25:56 -07:00
Florian Quèze
682b1ec3b2 Bug 1440284 - change this.EXPORTED_SYMBOLS back to var EXPORTED_SYMBOLS in JS modules, r=mccr8. 2018-02-23 20:50:01 +01:00
Boris Zbarsky
5e432144be Bug 1437921 part 2. Switch document_idle to use the documentReadyForIdle promise. r=kmag
MozReview-Commit-ID: 9cJ1cGuMzBJ
2018-02-22 16:55:40 -05:00
Andrew McCreight
5dec0e0beb Bug 1432992, part 1 - Remove definitions of Ci, Cr, Cc, and Cu. r=florian
This patch was autogenerated by my decomponents.py

It covers almost every file with the extension js, jsm, html, py,
xhtml, or xul.

It removes blank lines after removed lines, when the removed lines are
preceded by either blank lines or the start of a new block. The "start
of a new block" is defined fairly hackily: either the line starts with
//, ends with */, ends with {, <![CDATA[, """ or '''. The first two
cover comments, the third one covers JS, the fourth covers JS embedded
in XUL, and the final two cover JS embedded in Python. This also
applies if the removed line was the first line of the file.

It covers the pattern matching cases like "var {classes: Cc,
interfaces: Ci, utils: Cu, results: Cr} = Components;". It'll remove
the entire thing if they are all either Ci, Cr, Cc or Cu, or it will
remove the appropriate ones and leave the residue behind. If there's
only one behind, then it will turn it into a normal, non-pattern
matching variable definition. (For instance, "const { classes: Cc,
Constructor: CC, interfaces: Ci, utils: Cu } = Components" becomes
"const CC = Components.Constructor".)

MozReview-Commit-ID: DeSHcClQ7cG

--HG--
extra : rebase_source : d9c41878036c1ef7766ef5e91a7005025bc1d72b
2018-02-06 09:36:57 -08:00
Luca Greco
84852d9e50 Bug 1420485 - Reduce memory usage related to the tabs.insertCSS cssCode urls. r=mixedpuppy
This patch introduces a cache of blob urls which are related to the cssCode
injected by the extensions using tabs.insertCSS, which aims to reduce the
amount of memory used by the extensions to store the cssCode injected
into the tabs and their subframes in the content child process.

The generated Blob URL are associated to the extension principal,
so that it is easier to identify in the about:memory reports
which is extension that is using the cached data.

MozReview-Commit-ID: ERhR5nmVMqY

--HG--
extra : rebase_source : af8e2c3312c84bec6715158bcc8af82b76c8a8a6
2017-11-24 19:17:33 +01:00
Kris Maglione
918ed6c474 Bug 1431533: Part 5a - Auto-rewrite code to use ChromeUtils import methods. r=florian
This was done using the following script:
37e3803c7a/processors/chromeutils-import.jsm

MozReview-Commit-ID: 1Nc3XDu0wGl

--HG--
extra : source : 12fc4dee861c812fd2bd032c63ef17af61800c70
extra : intermediate-source : 34c999fa006bffe8705cf50c54708aa21a962e62
extra : histedit_source : b2be2c5e5d226e6c347312456a6ae339c1e634b0
2018-01-29 15:20:18 -08:00
Cosmin Sabou
9a65a40178 Backed out 3 changesets (bug 1431533) for Android mochitest failures on testEventDispatcher on a CLOSED TREE
Backed out changeset a1eca62826a1 (bug 1431533)
Backed out changeset 34c999fa006b (bug 1431533)
Backed out changeset e2674287e57f (bug 1431533)
2018-01-30 07:17:48 +02:00
Kris Maglione
6476f95b13 Bug 1431533: Part 5a - Auto-rewrite code to use ChromeUtils import methods. r=florian
This was done using the following script:
37e3803c7a/processors/chromeutils-import.jsm

MozReview-Commit-ID: 1Nc3XDu0wGl

--HG--
extra : source : 12fc4dee861c812fd2bd032c63ef17af61800c70
2018-01-29 15:20:18 -08:00
Brindusan Cristian
af8879d1eb Backed out 2 changesets (bug 1431533) for ESlint failures on a CLOSED TREE
Backed out changeset 6e56f4c8843e (bug 1431533)
Backed out changeset 12fc4dee861c (bug 1431533)
2018-01-30 02:32:43 +02:00
Kris Maglione
c276bb9375 Bug 1431533: Part 5a - Auto-rewrite code to use ChromeUtils import methods. r=florian
This was done using the following script:
37e3803c7a/processors/chromeutils-import.jsm

MozReview-Commit-ID: 1Nc3XDu0wGl

--HG--
extra : rebase_source : c004a023389f1f6bf3d2f3efe93c13d423b23ccd
2018-01-29 15:20:18 -08:00
Kris Maglione
4a4c4fdfd4 Bug 1421459: Update to ESLint 4 "indent" rule. r=aswan
MozReview-Commit-ID: LxLDWlsIlSk

--HG--
extra : rebase_source : 5762bdf08ff6c09c1b29f87366bddb552e4c74b2
extra : amend_source : 922a0c03722bd5a81daace7f0289ec3228191cfb
2017-11-28 14:13:59 -08:00
Kris Maglione
541e9a6989 Remove unused imports. r=trivial (no bug)
MozReview-Commit-ID: EEVSPkAgORY

--HG--
extra : rebase_source : 8a3da61bdf0f65c518e6cea3c6f5cacf42c6d24d
2017-11-09 16:39:57 -08:00
Mark Banner
cf372ccd32 Bug 1412893 - Change instances of using getService to Services.jsm where possible in toolkit/components - Part 1. r=mossop
MozReview-Commit-ID: BBnacIvRJBR

--HG--
extra : rebase_source : 10157c319a97b14c9a360a26a56725022df14ad4
2017-10-30 16:29:58 +00:00
Kris Maglione
cdb5c8abfe Bug 1402944: Part 11 - Use number rather than string value for getUniqueId(). r=mixedpuppy
This allows us to avoid a fairly expensive stringification/string allocation
when calling getUniqueId(), which is helpful. It also allows us to avoid
atomizing the ID string when storing it in a Set or Map, which is even more
helpful. And, of course, it makes comparisons faster.

MozReview-Commit-ID: 8wMc6TdhzfY

--HG--
extra : rebase_source : 389881c910124083e5db6ff5db293144c3901326
2017-09-25 15:00:17 -07:00
Kris Maglione
152d99b50d Bug 1379148: Part 3 - Inject scripts synchronously if they're already available. r=mixedpuppy
MozReview-Commit-ID: J6vheuxsqJR

--HG--
extra : rebase_source : 94f44806e5eb4e0eebc0dd465ab1c0c4ef2c14e0
2017-09-20 17:00:44 -07:00
Kris Maglione
372f1ef672 Bug 1398630: Follow-up: Fix typo. r=me
MozReview-Commit-ID: 7Wv2WPWRC4L

--HG--
extra : rebase_source : 98b4513c40d0e27041a316572859671375b33c97
2017-09-11 16:09:58 -07:00
Kris Maglione
988d03b779 Bug 1398630: Part 7 - Random cleanup. r=zombie
MozReview-Commit-ID: LibtXDKXrnA

--HG--
extra : rebase_source : 34035be1600f0e62e738a2d4df1ece10714f992f
2017-09-10 15:37:08 -07:00
Kris Maglione
6e12b1a4f1 Bug 1398630: Part 2 - Avoid unnecessary Map/Set lookups. r=zombie
We currently call has() every time we do a DefaultMap/DefaultWeakMap lookup,
which unfortunately shows up a lot in profiles. We only actually need to
check, though, if get() returns an undefined value.

Similar things in other places, where we only need to do a has() call if
another operation fails.

MozReview-Commit-ID: 9qFWsb4vlZj

--HG--
extra : rebase_source : 94c231fa007744f733faa9fdbde38a3875e10e7d
2017-09-10 15:39:49 -07:00
Kris Maglione
8f3bd8b318 Bug 1398630: Part 1 - Remove/cleanup some old ExtensionUtils helpers. r=zombie
MozReview-Commit-ID: FeLUjH7pkiB

--HG--
extra : rebase_source : 639c3ccece00aab6dd1c97eb21115e4beb82f378
2017-09-10 15:39:28 -07:00
Kris Maglione
f9e2e7cfbc Bug 1397448: Part 6 - Cache messageManager for MessageManagerProxy. r=mixedpuppy
MozReview-Commit-ID: 7eqSgBkrj4f

--HG--
extra : rebase_source : 4541d5af94af4e219b2435da9485ce5530f0fab1
2017-09-08 21:36:00 -07:00
Kris Maglione
c2a6f79739 Bug 1397448: Part 5 - Make uniqueProcessID a lexically scoped string. r=zombie
MozReview-Commit-ID: Fxob3RUPQtd

--HG--
extra : rebase_source : 5e8d200b88d9b0c1b9ea14d94e8b4372543fef63
2017-09-08 17:12:43 -07:00
Kris Maglione
821308e4d1 Bug 1391110: Part 4 - Remove unnecessary nsIFrameLoaderOwner QIs. r=smaug
The FrameLoaderOwner interface has been implemented in WebIDL for several
years now, so these QIs are simply unnecessary overhead.

MozReview-Commit-ID: LAzvfm5Qhy0

--HG--
extra : rebase_source : 2495c07df21c474f5fabc257ff4db43b0d8047e4
2017-08-19 13:32:58 -07:00
Kris Maglione
e24e9d802d Bug 1391158: Optimize checkLoadURL for the common case of extension URLs. r=mixedpuppy
MozReview-Commit-ID: KGFFcHxQSvZ

--HG--
extra : rebase_source : f4b62ad095077a65e11c6b8354ce54fa2d2ff252
2017-08-16 23:03:15 -07:00
Kris Maglione
c77a0e7c41 Bug 1389856: Optimize EventEmitter.emit for the common case. r=zombie
MozReview-Commit-ID: 3dbgZfG7l8T

--HG--
extra : rebase_source : 828ec8da7a9d714f9ebdcd850b779b05f1398725
2017-08-13 12:07:01 -07:00
Kris Maglione
8b7bd7e2b8 Bug 1389381: Part 3 - Loop over the entire set iterator when truncating a LimitedSet. r=aswan
MozReview-Commit-ID: 3imHF9IRI2N

--HG--
extra : rebase_source : 5ffbfab63ddf22304883bb68267ebb53a9ab0d52
2017-08-11 14:46:44 -07:00
Kris Maglione
9e2904259b Bug 1389381: Part 2 - Add slop to the maximum size of a LimitedSet. r=aswan
Truncating a Set can be relatively expensive, so truncating only after several
excessive entries have been added can save some cycles.

MozReview-Commit-ID: DIAXQ3ow2fa

--HG--
extra : rebase_source : 0a748ff076ba43659f6315b3e51316845200d300
2017-08-12 11:08:35 -07:00
Kris Maglione
e1d34cd3c9 Bug 1388208: Stop using FileUtils.getFile. r=zombie
This performs main thread IO to make sure that directories exist, which is not
something we should be doing on the startup path.

MozReview-Commit-ID: 2NrgRgY5ua6

--HG--
extra : rebase_source : beded8238f62ab9134748ac5a96b95b0826fa74b
2017-08-07 17:42:13 -07:00
Kris Maglione
f87ef7bd44 Remove unused lazy imports. r=trivial (no bug)
MozReview-Commit-ID: rqUFJw7Wsb

--HG--
extra : rebase_source : cdda5d87fe33bdb9dacc1846fd67f3cb4154f230
2017-08-02 21:09:38 -07:00
Kris Maglione
9319fd72c9 Bug 1364768: Part 4 - Switch to a compressed, binary flat file for startup cache. r=aswan
IndexedDB helped where we needed to decrease main thread CPU, but it also took
so long to inialize during startup (over 500ms on a fast machine) that it
delayed extension startup more than was acceptable.

Using a structured clone flat file solves the same issues that IndexedDB did,
but with much less startup overhead.

MozReview-Commit-ID: 1Of7uxKCfkg

--HG--
extra : rebase_source : f2f7f9f852d40d547d43da4804a6bb7be00fdded
2017-07-10 22:51:28 -07:00
Andrew Swan
503a78588d Bug 1369577 Part 2 Propagate isHandlingUserInput for browserAction, pageAction, and menus r=kmag
The implementations of browserAction, pageAction, and menu onClick
handlers now stash the current <browser> until we get a reply from
the extension process indicating that the handler has finished running.
We also have to take care to keep that <browser> around even if the
permissions api has to be loaded asynchronously.

MozReview-Commit-ID: BYJaiwdj40u

--HG--
extra : rebase_source : 3d9cba03d2853ef8d71b6c3e3a1fd0aba400b39c
2017-06-15 12:48:40 -07:00
Sebastian Hengst
61fb850321 Backed out changeset dfb376de5c23 (bug 1369577) 2017-06-30 00:59:59 +02:00
Andrew Swan
f512794b1a Bug 1369577 Part 2 Propagate isHandlingUserInput for browserAction, pageAction, and menus r=kmag
The implementations of browserAction, pageAction, and menu onClick
handlers now stash the current <browser> until we get a reply from
the extension process indicating that the handler has finished running.
We also have to take care to keep that <browser> around even if the
permissions api has to be loaded asynchronously.

MozReview-Commit-ID: BYJaiwdj40u

--HG--
extra : rebase_source : f0eb9522e532071a11c3424f8fffddf12300504f
2017-06-15 12:48:40 -07:00
Kris Maglione
0cd3e0a862 Bug 1368189: Move more code out of ExtensionUtils.jsm. r=mixedpuppy
Also removes some dead code.

A lot of the code in ExtensionUtils.jsm is not needed in all processes, and a
lot of the rest isn't needed until extension code runs. Most of it winds up
being loaded into all processes way earlier than necessary.

MozReview-Commit-ID: CMRjCPOjRF2

--HG--
extra : rebase_source : 37718eaf05a22b8ccb95f633cf7454bd7975cdce
2017-05-26 15:44:41 -07:00
Kris Maglione
06c9dfdd54 Bug 1368152: Part 4 - Remove ExtensionManagement.jsm. r=aswan
MozReview-Commit-ID: Apbi1QYeb2x

--HG--
extra : rebase_source : 56e223e8ee92c848bbd06d74b1e7dc6d9a01d9e1
2017-06-03 17:18:18 -07:00
Matthew Wein
1417b513dc Bug 1330369 - Part 1 - Share the extension stylesheets between sidebar, popups, and options r=mixedpuppy
MozReview-Commit-ID: EquM6hSQ8pH

--HG--
extra : rebase_source : 45de777fd1e2a387a4f42168d6d04e9f988917a5
2017-05-19 15:48:44 -04:00
Mark Banner
d1dfdb8a14 Bug 1367232 - Clean up various ESLint global definitions in toolkit/. r=mossop
MozReview-Commit-ID: Hhm4YBansg1

--HG--
extra : rebase_source : 3cb49159fa3f5dae12e4eb21f22e747850fdf184
2017-05-19 09:22:48 +01:00