Commit Graph

250 Commits

Author SHA1 Message Date
Victor Porof
5d695e0b7f Bug 1561435 - Format toolkit/components/, a=automatic-formatting
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D36052
2019-07-05 11:14:05 +02:00
Kris Maglione
856fa07b17 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
2019-01-17 10:18:31 -08:00
Mark Striemer
04c2dcb929 Bug 1303384 - Part 2: Move some extension shortcut utils to ShortcutUtils r=aswan
Differential Revision: https://phabricator.services.mozilla.com/D4506
2019-01-11 22:32:39 +00:00
Luca Greco
2f770d260e 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
2018-09-07 16:27:44 +00:00
Luca Greco
444c28eb82 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
2018-09-05 20:16:35 +00:00
Boris Zbarsky
1b419c917c 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
16e969ea82 No bug - fix merge conflict mistake r=Aryx on a CLOSED TREE 2018-06-30 13:57:50 +03:00
Andreea Pavel
fe013701c6 Merge mozilla-central to mozilla-inbound. a=merge on a CLOSED TREE 2018-06-30 13:10:01 +03:00
Kris Maglione
bb663b9c15 Bug 1471102: Move more code out of ExtensionUtils.jsm. r=aswan
MozReview-Commit-ID: Fqlv5BRuuW8
2018-06-25 19:30:21 -07:00
Adam Plaice
8302e669de 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
2018-06-02 00:56:44 +02:00
Kris Maglione
188b8c3938 Bug 1464743: Restore extension child shutdown timeout. r=aswan
MozReview-Commit-ID: 8O6CgKsOwom
2018-06-06 12:43:26 -07:00
Mark Striemer
fe7abfc02e Bug 1397809 - Part 1: Convert New Tab doorhanger to a generic class r=aswan,Gijs
MozReview-Commit-ID: 40RwrXjtsJJ
2017-12-19 13:56:04 -06:00
Boris Zbarsky
0f52bda7da 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
e9dca3c017 Bug 1451058: Follow-up: Fix some errors that show up during tests. r=me
MozReview-Commit-ID: K410z6VdHov
2018-04-06 16:34:15 -07:00
Kris Maglione
4c402a31f9 Bug 1451215: Run codespell on code. r=aswan
MozReview-Commit-ID: HIilZTKcQUY
2018-04-03 22:22:07 -07:00
Kris Maglione
f373de248e Bug 1420485: Follow-up: Remove unnecessary single-use stringToCryptoHash function. r=me
MozReview-Commit-ID: H1tPnsN0v2J
2018-03-11 22:25:56 -07:00
Florian Quèze
f1a55f73f8 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
e59f740ee6 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
272cee1e65 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
2018-02-06 09:36:57 -08:00
Luca Greco
2d6facde38 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
2017-11-24 19:17:33 +01:00
Kris Maglione
0bb74efdf1 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
2018-01-29 15:20:18 -08:00
Cosmin Sabou
f09d6d985d 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
fd67f090b2 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
2018-01-29 15:20:18 -08:00
Brindusan Cristian
483ba301cb 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
683a97d172 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
2018-01-29 15:20:18 -08:00
Kris Maglione
c8ea1d4273 Bug 1421459: Update to ESLint 4 "indent" rule. r=aswan
MozReview-Commit-ID: LxLDWlsIlSk
2017-11-28 14:13:59 -08:00
Kris Maglione
5620aa14ff Remove unused imports. r=trivial (no bug)
MozReview-Commit-ID: EEVSPkAgORY
2017-11-09 16:39:57 -08:00
Mark Banner
45b0812566 Bug 1412893 - Change instances of using getService to Services.jsm where possible in toolkit/components - Part 1. r=mossop
MozReview-Commit-ID: BBnacIvRJBR
2017-10-30 16:29:58 +00:00
Kris Maglione
20c0bee14c 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
2017-09-25 15:00:17 -07:00
Kris Maglione
89ccbf3bf9 Bug 1379148: Part 3 - Inject scripts synchronously if they're already available. r=mixedpuppy
MozReview-Commit-ID: J6vheuxsqJR
2017-09-20 17:00:44 -07:00
Kris Maglione
88c51fe789 Bug 1398630: Follow-up: Fix typo. r=me
MozReview-Commit-ID: 7Wv2WPWRC4L
2017-09-11 16:09:58 -07:00
Kris Maglione
19017b8170 Bug 1398630: Part 7 - Random cleanup. r=zombie
MozReview-Commit-ID: LibtXDKXrnA
2017-09-10 15:37:08 -07:00
Kris Maglione
bb1850dc22 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
2017-09-10 15:39:49 -07:00
Kris Maglione
877f3c7535 Bug 1398630: Part 1 - Remove/cleanup some old ExtensionUtils helpers. r=zombie
MozReview-Commit-ID: FeLUjH7pkiB
2017-09-10 15:39:28 -07:00
Kris Maglione
db3feb1eb4 Bug 1397448: Part 6 - Cache messageManager for MessageManagerProxy. r=mixedpuppy
MozReview-Commit-ID: 7eqSgBkrj4f
2017-09-08 21:36:00 -07:00
Kris Maglione
0f0ab00a58 Bug 1397448: Part 5 - Make uniqueProcessID a lexically scoped string. r=zombie
MozReview-Commit-ID: Fxob3RUPQtd
2017-09-08 17:12:43 -07:00
Kris Maglione
be161e68b4 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
2017-08-19 13:32:58 -07:00
Kris Maglione
d3d0a0694d Bug 1391158: Optimize checkLoadURL for the common case of extension URLs. r=mixedpuppy
MozReview-Commit-ID: KGFFcHxQSvZ
2017-08-16 23:03:15 -07:00
Kris Maglione
2a4bb89f82 Bug 1389856: Optimize EventEmitter.emit for the common case. r=zombie
MozReview-Commit-ID: 3dbgZfG7l8T
2017-08-13 12:07:01 -07:00
Kris Maglione
56d9c98838 Bug 1389381: Part 3 - Loop over the entire set iterator when truncating a LimitedSet. r=aswan
MozReview-Commit-ID: 3imHF9IRI2N
2017-08-11 14:46:44 -07:00
Kris Maglione
6fd7447dea 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
2017-08-12 11:08:35 -07:00
Kris Maglione
04604d9ff9 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
2017-08-07 17:42:13 -07:00
Kris Maglione
c4d42444e0 Remove unused lazy imports. r=trivial (no bug)
MozReview-Commit-ID: rqUFJw7Wsb
2017-08-02 21:09:38 -07:00
Kris Maglione
a0b352e6de 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
2017-07-10 22:51:28 -07:00
Andrew Swan
3358f38632 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
2017-06-15 12:48:40 -07:00
Sebastian Hengst
c48d1b793d Backed out changeset dfb376de5c23 (bug 1369577) 2017-06-30 00:59:59 +02:00
Andrew Swan
e77019e2bd 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
2017-06-15 12:48:40 -07:00
Kris Maglione
db3ec327d2 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
2017-05-26 15:44:41 -07:00
Kris Maglione
972b1073af Bug 1368152: Part 4 - Remove ExtensionManagement.jsm. r=aswan
MozReview-Commit-ID: Apbi1QYeb2x
2017-06-03 17:18:18 -07:00
Matthew Wein
95bd4ed601 Bug 1330369 - Part 1 - Share the extension stylesheets between sidebar, popups, and options r=mixedpuppy
MozReview-Commit-ID: EquM6hSQ8pH
2017-05-19 15:48:44 -04:00