Commit Graph

116 Commits

Author SHA1 Message Date
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
a77a8caadd Bug 1444758: Part 14 - Migrate test_ext_unload_frame to xpcshell. r=aswan
MozReview-Commit-ID: 4lwqDQ8rI1K
2018-03-11 16:21:23 -07:00
Kris Maglione
5a8cc558b1 Bug 1441333: Part 6 - Use caller location in error reports for StrongPromise errors. r=zombie
We currently report a useful location in error reports when extensions fail to
resolve a promise or call a response callback, but in some slightly
less-than-ideal ways. We currently generate a complete stack and parse its
string value (which is expensive), and then report the caller location as part
of the message, rather than as the error's location and stack.

This patch changes that behavior to store a single SavedStack frame, and to
properly report that as the location of the error.

MozReview-Commit-ID: Jmtf4C1O6pW
2018-03-01 16:41:21 -08: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
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
Luca Greco
de04e8d2fa Bug 1435100 - Ensure preloaded css and script caches are cleared when a WebExtension is shutting down. r=mixedpuppy
MozReview-Commit-ID: IHK7hBYVLMj
2018-02-21 12:53:56 +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
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
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
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
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
5a9116a4e2 Bug 1402944: Part 8 - Avoid X-ray overhead when cloning event handler responses. r=mixedpuppy
MozReview-Commit-ID: 4CHP80WymuA
2017-09-23 13:30:52 -07:00
Luca Greco
386576fa84 Bug 1383310 - Extensions Devtools panels should not receive messages or ports from content scripts. r=zombie
MozReview-Commit-ID: B5Hq11Tb3Y0
2017-09-14 16:43:45 +02: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
Tomislav Jovanovic
65d4e259bb Bug 1396686 - Provide info which onMessage listener's response handle went out of scope r=kmag
MozReview-Commit-ID: Bu71gP8Ey3
2017-09-05 03:00:07 +02:00
Tomislav Jovanovic
e99655c389 Bug 1389968 - Reject sendMessage() promise when response handle gets GCd r=kmag
MozReview-Commit-ID: C2g3VSWYKuz
2017-08-23 00:16:48 +02:00
Kris Maglione
34a3763590 Bug 1391353: Try to avoid keeping message data alive while waiting for responses. r=zombie
MozReview-Commit-ID: 5JAUBWufpsf
2017-08-17 11:41:55 -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
cca7be0e2c Bug 1391153: Get rid of Sandbox clone for cross-process API calls. r=mixedpuppy
MozReview-Commit-ID: A9g6s5jqd78
2017-08-16 22:16:31 -07:00
Kris Maglione
632e052bb1 Bug 1389861: Remove needless overhead from same-process policy initialization. r=zombie
MozReview-Commit-ID: 3E7hnNnk46D
2017-08-12 17:21:27 -07:00
Kris Maglione
0fb6b2e73c Bug 1388215: Part 3 - Use JIT-friendly defineLazy*Getters methods when defining many lazy imports. r=florian
MozReview-Commit-ID: APoFwUhDFdj
2017-08-09 13:03:36 -07:00
Andrew Swan
702d75aac5 Bug 1350151 Part 1: Add requireUserInput property for functions in webextension schemas r=kmag
MozReview-Commit-ID: BrMAwbwEu8b
2017-07-25 22:45:47 -07:00
Kris Maglione
ee30da7682 Bug 1370752: Part 3 - Use structured clone rather than JSON to sanitize storage values. r=aswan
This gives us performance wins in sevaral areas:

- Creating a structured clone blob of storage data directly from the source
  compartment allows us to avoid X-ray and JSON serialization overhead when
  storing new values.

- Storing the intermediate StructuredCloneBlob, rather than JSON values,
  in-memory saves us additional JSON and structured clone overhead when
  passing the values to listeners and API callers, and saves us a fair amount
  of memory to boot.

- Serializing storage values before sending them over a message manager allows
  us to deserialize them directly into an extension scope on the other side,
  saving us a lot of additional structured clone overhead and intermediate
  garbage generation.

- Using JSONFile.jsm for storage lets us consolidate multiple storage file
  write operations, rather than performing a separate JSON serialization for
  each individual storage write.

- Additionally, this paves the way for us to transition to IndexedDB as a
  storage backend, with full support for arbitrary structured-clone-compatible
  data structures.

MozReview-Commit-ID: JiRE7EFMYxn
2017-07-10 18:24:11 -07:00
Wes Kocher
a0b015fa22 Backed out 2 changesets (bug 1370752) for failures in test_ext_storage.js a=backout
Backed out changeset 42d3c1599af5 (bug 1370752)
Backed out changeset 9c4bf59ab966 (bug 1370752)

MozReview-Commit-ID: 4M6DsJvJ6RI
2017-07-10 14:34:56 -07:00
Kris Maglione
5c0bb13dcc Bug 1370752: Part 3 - Use structured clone rather than JSON to sanitize storage values. r=aswan
This gives us performance wins in sevaral areas:

- Creating a structured clone blob of storage data directly from the source
  compartment allows us to avoid X-ray and JSON serialization overhead when
  storing new values.

- Storing the intermediate StructuredCloneBlob, rather than JSON values,
  in-memory saves us additional JSON and structured clone overhead when
  passing the values to listeners and API callers, and saves us a fair amount
  of memory to boot.

- Serializing storage values before sending them over a message manager allows
  us to deserialize them directly into an extension scope on the other side,
  saving us a lot of additional structured clone overhead and intermediate
  garbage generation.

- Using JSONFile.jsm for storage lets us consolidate multiple storage file
  write operations, rather than performing a separate JSON serialization for
  each individual storage write.

- Additionally, this paves the way for us to transition to IndexedDB as a
  storage backend, with full support for arbitrary structured-clone-compatible
  data structures.

MozReview-Commit-ID: JiRE7EFMYxn
2017-06-29 14:11:05 -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
Andrew Swan
3d501bbfd5 Bug 1369577 Part 1 Rename SingletonEventManager to EventManager r=kmag
MozReview-Commit-ID: 7nsYWdSTJCG
2017-06-09 13:49:07 -07:00
Sebastian Hengst
8642712c2a Backed out changeset 26fd6d0a1254 (bug 1369577) for failing xpcshell's test_ext_simple.js and test_ext_startup_cache.js on Android. r=backout 2017-06-30 01:01:13 +02: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
Andrew Swan
c140bd9d12 Bug 1369577 Part 1 Rename SingletonEventManager to EventManager r=kmag
MozReview-Commit-ID: 7nsYWdSTJCG
2017-06-09 13:49:07 -07:00
Kris Maglione
8ff587711f Bug 1356546: Part 4 - Use StructuredCloneHolder as transport for proxied method return values. r=aswan
MozReview-Commit-ID: LZ3XkamgkeF
2017-06-04 20:39:28 -07:00
Kris Maglione
b546affc93 Bug 1356546: Part 3 - Use StructuredCloneHolder as transport for proxied message listeners. r=aswan
MozReview-Commit-ID: 2YeNuGkmY3k
2017-05-06 21:21:37 -07:00
Kris Maglione
3aab3e2667 Bug 1356546: Part 2 - Use StructuredCloneHolder as transport for MessageManager messages. r=aswan
MozReview-Commit-ID: 3z1uAAbsgTj
2017-06-04 20:46:38 -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
e5aca6859e Bug 1322235: Part 6 - Replace AddonPolicyService with a stub implementation in ExtensionPolicyService. r=mixedpuppy,zombie
This replaces the JS policy service stubs with a pure C++ version which
directly makes policy decisions based on active WebExtensionPolicy objects.

This is the first step in a larger refactoring, which will remove the
ExtensionManagement module entirely, and replace the current add-on policy
service with direct, non-virtual access to native WebExtensionPolicy objects.

It will also be followed by related changes to migrate the content script and
extension page matching to native code, based on the existing MatchPattern and
WebExtensionPolicy bindings.

MozReview-Commit-ID: 2MpbmXZGiPZ
2017-06-03 17:12:14 -07:00
Kris Maglione
4f623b6890 Bug 1322235: Part 3 - Use MatchPatternSet for whiteListedHosts and webRequest. r=aswan,zombie
This is the second step to migrating the policy service to pure native code,
with similar impacts and reasoning to the previous patch.

MozReview-Commit-ID: L5XdPzWNZXM
2017-06-03 22:11:20 -07:00
Kris Maglione
40575e9449 Bug 1322235: Part 2 - Use MatchGlob for webAccessibleResources. r=aswan
This is the first step toward migrating the web-accessible URL policy to
purely native code. It should have a noticeable performance improvement on its
own, but the main improvement comes from being able to pass the pattern
objects to the pure C++ policy service.

MozReview-Commit-ID: DHoGLVr8yJ9
2017-05-23 22:04:22 -07:00
Kris Maglione
da08b6926c Bug 1317697: Remove things from ExtensionUtils that don't belong there. r=mixedpuppy
MozReview-Commit-ID: CTX0TckLqoV
2017-04-07 13:39:06 -07:00
Kris Maglione
e69c789ec0 Bug 1317697: Split extension page child and content script child code as much as possible. r=mixedpuppy
MozReview-Commit-ID: 4lKFqoJHVFb
2017-04-14 16:57:34 -07:00
Kris Maglione
bdb8ae3dfd Bug 1317697: Split ExtensionContent.jsm into a stub process script. r=mixedpuppy
MozReview-Commit-ID: 4vn0ERZiBQd
2017-04-14 17:00:51 -07:00
Luca Greco
870ddaa688 Bug 1354471 - Fix regression in DevToolsContextChild related to the lazy API loading. r=aswan
MozReview-Commit-ID: Kdltgx0JdUi
2017-04-07 05:20:14 +02:00
Kris Maglione
9e1d79362b Bug 1350522: Part 5 - Remove registerSchemaAPI(). r=aswan
MozReview-Commit-ID: 5yK2wUms86G
2017-03-25 13:59:14 -07:00