Commit Graph

110 Commits

Author SHA1 Message Date
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
Kris Maglione
0847e8227e Bug 1464548: Part 3 - Update callers to use defineLazyGlobalGetters. r=mccr8
MozReview-Commit-ID: 9APGewiDDYB
2018-05-25 17:02:29 -07:00
Andrew Swan
207ad9dc56 Bug 1467136 Ensure extension messaging cannot miss the startup event r=kmag
When a background page has a messaging listener but the background page
is started in response to something other than an extension message, we
were missing the background "startup" event.  Fix that by setting up the
listener earlier.

MozReview-Commit-ID: Cr58EyCoY6W
2018-06-06 13:58:43 -07:00
Andrew Swan
84ecc06250 Bug 1369841 Make browser.runtime.onMessage and onConnect persistent r=zombie
MozReview-Commit-ID: 4LdBeEERtsD
2018-05-29 17:40:53 -07:00
Andreea Pavel
6eb96b6639 Backed out changeset 5cd398cc6a4b (bug 1369841) for failing browser chrome at browser/components/extensions/test/browser/browser_ext_legacy_extension_context_contentscript.js on a CLOSED TREE 2018-06-03 00:48:16 +03:00
Andrew Swan
6eb7210624 Bug 1369841 Make browser.runtime.onMessage and onConnect persistent r=zombie
MozReview-Commit-ID: 4LdBeEERtsD
2018-05-29 17:40:53 -07:00
Andrew Swan
b1feeb96c8 Bug 1447551 Part 1: Fix some issues with persistent EventManagers r=kmag
- Un-lazify the startup promises in ext-toolkit.js since the
  manifest background property is handled asynchronously, so it
  races with startup and can miss the relevant events if it
  loses the race.
- Ensure that persistent events don't cause breakage when the
  background-delayed-startup preference is set to false.
- Add a wakeup() method to the fire object provided to primed
  listeners.  This method returns a Promise that resolves when
  the extension background page has started.  Events that need to
  do some work in the context of the extension can wait on the
  result of wakeup(), then continue processing after the background
  page is started, using fire.[a?]sync as normal.

MozReview-Commit-ID: HiYOguVdEQK
2018-04-20 16:09:13 -07:00
Kris Maglione
b3990a2d91 Bug 1456686: Part 1 - Fix unused and shadowed explicit imports. r=standard8
These issues were previously ignored due to the nature of our global import
rules. They need to be fixed before that rule can be updated.

MozReview-Commit-ID: DCChktTc5TW
2018-04-24 20:18:09 -07:00
Gurzau Raul
5bab245fc3 Backed out 2 changesets (bug 1447551) for failing on xpcshell/test_ext_webRequest_startup.js
Backed out changeset cbae9dd05293 (bug 1447551)
Backed out changeset 50a1ddd35664 (bug 1447551)
2018-04-25 12:49:05 +03:00
Andrew Swan
b50f743c88 Bug 1447551 Part 1: Fix some issues with persistent EventManagers r=kmag
- Un-lazify the startup promises in ext-toolkit.js since the
  manifest background property is handled asynchronously, so it
  races with startup and can miss the relevant events if it
  loses the race.
- Ensure that persistent events don't cause breakage when the
  background-delayed-startup preference is set to false.
- Add a wakeup() method to the fire object provided to primed
  listeners.  This method returns a Promise that resolves when
  the extension background page has started.  Events that need to
  do some work in the context of the extension can wait on the
  result of wakeup(), then continue processing after the background
  page is started, using fire.[a?]sync as normal.

MozReview-Commit-ID: HiYOguVdEQK
2018-04-20 16:09:13 -07:00
Kris Maglione
d380a39518 Bug 1452307: Remove support for old-style experiment API extensions. r=aswan
MozReview-Commit-ID: 5y48pMRQ5XW
2018-04-06 18:14:59 -07:00
Andrew Swan
71b430f70e Bug 1450388 Part 3: Implement persistent option for EventManager r=kmag
MozReview-Commit-ID: BtccacvzhE8
2018-03-30 16:38:42 -07:00
Andrew Swan
dfdaca71bf Bug 1450388 Part 1 Refactor EventManager r=kmag
As we add more behaviors to EventManager, the signature of the constructor
is going to get really clumsy.  Head that off by converting it to take a
general parameters object.

This introduces a compatibility problem for existing webextension experiments,
put in a backward-compatibility shim for now.

MozReview-Commit-ID: 72QDfiwRm5j
2018-03-14 14:52:44 -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
a68a7b5ca9 Bug 1441333: Part 5 - Use proper async caller location in normalizeError. r=zombie
Currently, when we create an error object at the end of an aysnc operation, we
only get a useful caller location if async stacks are enabled.

This patch changes our behavior to use the saved caller location we've already
stored when creating an Error object based on a plain string message.

MozReview-Commit-ID: DDO0lAUHYRO
2018-03-01 16:39:08 -08:00
Kris Maglione
50e5efde7d Bug 1441333: Part 4 - Add caller location to async API errors. r=zombie
When we report errors generated by async API operations, they are currently
not tied to any relevant extension source location. Instead, the locations in
the error reports point to the location in the framework code which reported
the error, which makes things extremely difficult to diagnose.

This change saves the extension caller location at the beginning of async API
operations, and adds it to the error reports genearted by that operation. This
should give extension developers a useful starting point for debugging them.

MozReview-Commit-ID: AkknkKEosFt
2018-02-26 15:25:03 -08:00
Andrew Swan
1ca7c0ba65 Bug 1434076 Correct calls to getAPI() on wrong api manager r=kmag
MozReview-Commit-ID: ADrV9x8gXhc
2018-02-22 12:20:34 -08: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
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
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
1046270983 Backed out 3 changesets (bug 1431533) for Android mochitest bustage. CLOSED TREE
MozReview-Commit-ID: 5ubE9EMQpZ9
2018-01-24 22:04:59 -08:00
Kris Maglione
50ace7f99d Bug 1431533: Part 5a - Auto-rewrite code to use ChromeUtils import methods. r=florian
MozReview-Commit-ID: 8V1ZT53ReiP
2018-01-24 15:48:47 -08:00
Kris Maglione
a62086a27e Bug 1431533: Part 3 - Define ChromeUtils on chrome-privileged Sandboxes that need it. r=mixedpuppy
This is necessary before we enable the ESLint rule to require using
ChromeUtils for module imports rather than older methods.

MozReview-Commit-ID: mKqByUS0o2
2018-01-18 14:52:39 -08:00
Kris Maglione
661ea33e42 Bug 1323845: Part 6a - Support WebExtension-style experiment API provider extensions. r=aswan
MozReview-Commit-ID: E1IBFyzEwqU
2018-01-09 17:20:55 -08:00
Kris Maglione
3ad29270e5 Bug 1323845: Part 5a - Allow extensions to bundle experiment API modules. r=aswan
MozReview-Commit-ID: 5suo2MqM51V
2018-01-09 16:28:36 -08:00
Kris Maglione
85e66cb2a3 Bug 1323845: Part 3 - Auto-create intermediate API namespace objects when necessary. r=aswan
MozReview-Commit-ID: HA8WpynPOqp
2018-01-09 16:02:38 -08:00
Kris Maglione
a96e1007ac Bug 1323845: Part 2c - Lazy init API global only when APIs are first loaded. r=aswan
MozReview-Commit-ID: B1bbiM0j5gT
2018-01-09 16:07:45 -08:00
Kris Maglione
2898ad39b0 Bug 1323845: Part 2b - Support separate schema roots for each API manager. r=aswan
MozReview-Commit-ID: 61LhYiIKVTH
2017-12-16 14:51:10 -06:00
Kris Maglione
2d3a2b7f99 Bug 1323845: Part 2a - Support separate API managers for each extension. r=aswan
MozReview-Commit-ID: 5gGsMm1ahd
2017-12-16 15:33:23 -06:00
Kris Maglione
2e65b7ecf0 Bug 1323845: Part 0 - Cleanup some code formatting. r=aswan
MozReview-Commit-ID: 9awFVoN0REF
2017-12-12 17:53:04 -05:00
Andrew Swan
9ae021cd5e Bug 1423425 Make some extensions comments jsdoc-compatible r=kmag
MozReview-Commit-ID: 3mUKR9IuEKA
2017-12-05 18:53:15 -08:00
Cosmin Sabou
e0a5c2495c Backed out 3 changesets (bug 1423425) for frequent browser chrome failures r=backout on a CLOSED TREE
Backed out changeset c3ac950b0b8a (bug 1423425)
Backed out changeset d64fd69a4b88 (bug 1423425)
Backed out changeset 04017639642a (bug 1423425)
2017-12-16 02:45:41 +02:00
Andrew Swan
80b2221edc Bug 1423425 Make some extensions comments jsdoc-compatible r=kmag
MozReview-Commit-ID: 3mUKR9IuEKA
2017-12-05 18:53:15 -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
tushararora
fa5e677c46 Bug 1334782 - tabs.query should pattern match the title r=zombie
MozReview-Commit-ID: 5WaKLaOP7Nc
2017-11-16 16:17:45 +05:30
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
4b334cc818 Bug 1398974: Follow-up: Disconnect StreamFilters when closing extension context. r=me
If we don't do this explicitly, the channel is automatically disconnected when
it's GCed. However, if we start shutdown while a stream is being processed,
the stream may not be GCed before we shut down the parent process's message
loop. In that case, we get a shutdown crash because the StreamFilterParent's
data channel is still open when we shut down its message loop.

Explicitly disconnecting the StreamFilter when the context is closed prevents
this, since app shutdown is automatically blocked on extension shutdown, and
extension shutdown explicitly closes all extant contexts.

MozReview-Commit-ID: 5JPrSUooq1j
2017-09-12 18:55:24 -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
94a32e9a33 Bug 1398630: Part 4 - Use getWinUtils everywhere we use DOMWindowUtils. r=zombie
MozReview-Commit-ID: FroMQF9Tiz1
2017-09-10 15:33:54 -07:00
Kris Maglione
1b68bb4924 Bug 1398630: Part 3 - Use document.docShell rather than longer/slower XPC paths. r=zombie
MozReview-Commit-ID: 5oD0Uvv1pvx
2017-09-11 14:53:20 -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
Andrew McCreight
cb4467a845 Bug 1186409 - Fix code that tries to get the global by using |this|. r=kmag
MozReview-Commit-ID: C5ixngtvzWU
2017-05-25 14:12:12 -07:00
Kris Maglione
3c6bbd9ea4 Bug 1396856: Part 1 - Remove spread call fallback overhead in event dispatch. r=zombie
MozReview-Commit-ID: 3c5p9OvRqHI
2017-09-05 11:20:43 -07:00
Kris Maglione
27e68ac62f Bug 1393621: Part 1 - Don't load ext-contextualIdentities at startup without permissions. r=zombie
MozReview-Commit-ID: AiIYAXSRrii
2017-08-31 15:09:41 -07:00
Bob Silverberg
16cd8b1c16 Bug 1374552 - Fix i18n.getUILanguage so it does not replace dashes with underscores, r=mixedpuppy
When we implemented this API we converted dashes in the language code to underscores because that is what Chrome did.
Chrome no longer does this, so we need to remove the code that does the replacing.

MozReview-Commit-ID: DuOQ218zXby
2017-08-11 09:45:35 -04:00
Wes Kocher
9a9581c0d5 Merge m-c to inbound, a=merge
MozReview-Commit-ID: EgYue63nSkv
2017-08-18 16:29:11 -07:00