Commit Graph

66 Commits

Author SHA1 Message Date
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
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
Mark Banner
9916415caf Bug 1371292 - Clean up more ESLint global definitions in configuration files in toolkit/ and browser/. r=mossop
MozReview-Commit-ID: 5KC23kzaCFN
2017-06-08 10:59:12 +01: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
Tushar Saini (:shatur)
055086e501 Bug 1354590 - Add 'temporary' flag to runtime.onInstalled details. r=aswan,zombie
MozReview-Commit-ID: IbQno1ZL7KV
2017-05-14 10:54:11 +05:30
Kris Maglione
5ce24cde06 Bug 1356826: Wait for startup to finish before shutting down. r=me
MozReview-Commit-ID: LksftmZHI8H
2017-05-10 20:26:01 -07:00
Iris Hsiao
0d81aa4e25 Backed out 15 changesets (bug 1358846, bug 1356826) for talos error. a=backout
Backed out changeset 96ea13bb00c5 (bug 1358846)
Backed out changeset b533d7f9b9c2 (bug 1358846)
Backed out changeset 7dcb80a051a3 (bug 1358846)
Backed out changeset 26825f1e33dd (bug 1358846)
Backed out changeset 98b57ff82a54 (bug 1358846)
Backed out changeset b9088593e34f (bug 1358846)
Backed out changeset cb2518673c56 (bug 1358846)
Backed out changeset 889c487a5d41 (bug 1358846)
Backed out changeset 459b36092b7a (bug 1356826)
Backed out changeset c861e23ec8ef (bug 1356826)
Backed out changeset d47998fa24cd (bug 1356826)
Backed out changeset b02e89c67132 (bug 1356826)
Backed out changeset c46fed6e4f6a (bug 1356826)
Backed out changeset 237268e3d9d2 (bug 1356826)
Backed out changeset 527435fc20db (bug 1356826)
2017-05-12 17:45:21 +08:00
Kris Maglione
6af5fca6ce Bug 1356826: Wait for startup to finish before shutting down. r=me
MozReview-Commit-ID: LksftmZHI8H
2017-05-10 20:26:01 -07:00
Kris Maglione
071cc27d73 Bug 1356816: Don't load Extension.jsm on startup just to set the browserUpdated flag. r=rhelmer
MozReview-Commit-ID: C0mtHeZ2cJ
2017-04-15 10:13:39 -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
884009911d Bug 1350522: Part 2 - Convert toolkit APIs to lazy loading. r=aswan
MozReview-Commit-ID: 8TbTIM4WX2d
2017-03-31 19:36:00 -07:00
Tomislav Jovanovic
07708471f8 Bug 1313648 - Add previousVersion to onInstalled details r=aswan
MozReview-Commit-ID: Cmw7zp8CV7e
2017-03-13 05:55:52 +01:00
Andrew Swan
1ac8741081 Bug 1203330 Part 1 Fix SingletonEventManager r=kmag
This patch adds the ability to run SingletonEventManager handlers in
different modes: sync, async, raw (no exception handling, arg cloning,
or asynchrony), or asyncWithoutClone. When you call the handler,
you're required to specify which variant you want.

Existing uses of SingletonEventManager are all converted to async calls.
Note that some of them were previously synchronous, but it didn't appear
to be necessary.

Also added a callOnClose for SingletonEventManager when the last listener
is removed.

MozReview-Commit-ID: ATHO97dWf3X
2017-01-26 20:00:33 -08:00
Phil Ringnalda
5781d2a09e Backed out 3 changesets (bug 1203330) for failures in test_delay_update_webextension.js
CLOSED TREE

Backed out changeset 2d42350d209a (bug 1203330)
Backed out changeset 3a12c51c3eca (bug 1203330)
Backed out changeset 31fac390e15d (bug 1203330)
2017-01-26 19:13:11 -08:00
Andrew Swan
8e5ca9edb5 Bug 1203330 Part 1 Fix SingletonEventManager r=kmag
This patch adds the ability to run SingletonEventManager handlers in
different modes: sync, async, raw (no exception handling, arg cloning,
or asynchrony), or asyncWithoutClone. When you call the handler,
you're required to specify which variant you want.

Existing uses of SingletonEventManager are all converted to async calls.
Note that some of them were previously synchronous, but it didn't appear
to be necessary.

Also added a callOnClose for SingletonEventManager when the last listener
is removed.

MozReview-Commit-ID: ATHO97dWf3X
2017-01-26 13:43:12 -08:00
Matthew Wein
c68d7f947f Bug 1247435 - Add support for runtime.onStartup r=kmag
MozReview-Commit-ID: F4leEN59vQe
2016-10-19 18:42:27 +01:00
Matthew Wein
65938122a3 Bug 1252871 - Add support for runtime.onInstalled r=aswan
MozReview-Commit-ID: 3wDtv0g0BpO
2016-10-19 10:38:29 +01:00
Wes Kocher
d88274da9b Backed out 3 changesets (bug 1252871) for test_ext_all_apis.html bustage a=backout CLOSED TREE
Backed out changeset b3a08a040c8a (bug 1252871)
Backed out changeset c2a511511a72 (bug 1252871)
Backed out changeset 9c2c3780aa4c (bug 1252871)
2016-10-28 14:24:13 -07:00
Rob Wu
21eaf53406 Bug 1299411 - Move native messaging to child process r=kmag
Move `runtime.connectNative` and `runtime.sendNativeMessage` to
`addon_child`. Note: This does not change the behavior for launching the
native app, it is still launched from the main process.

Now ExtensionUtils's Port is also used for native messaging ports. Now
the behavior of `runtime.connect` and `runtime.connectNative` are
identical from the extension's perspective.
In particular:
- `disconnect()` does not throw when called again (bug 1287229).
- `onDisconnect` is called with error messages (tests will be added in
  the next commit).

MozReview-Commit-ID: AyU9amiLeoL
2016-09-24 13:25:56 +02:00
Rob Wu
47ea3eae17 Bug 1299411 - Remove extension param from NativeApp r=aswan
The extension is always available as `context.extension`, so do not
unnecessarily pass the extension as a separate parameter.

MozReview-Commit-ID: 9OaestUAGVk
2016-09-24 13:18:48 +02:00
Rob Wu
11e38e39b6 Bug 1299411 - separate serialization from sending r=aswan
Serialization of the message should happen in the same process as the
extension context, whereas sending the message should be in the same
process as the owner of the native messaging host.
With webext-oop, the former is an addon process and the latter the
main process. Therefore it is necessary to separate the two roles.

MozReview-Commit-ID: 8BJZmn2QjLJ
2016-09-24 13:03:20 +02:00
Matthew Wein
6a04843fa4 Bug 1252871 - Add support for runtime.onInstalled r=aswan
MozReview-Commit-ID: 3wDtv0g0BpO
2016-10-19 10:38:29 +01:00
Tomislav Jovanovic
24e5cad3b1 bug 1268399 - add runtime.getBrowserInfo() method with AppInfo data r=kmag
MozReview-Commit-ID: GvwFG0CyfR7
2016-09-04 21:22:18 +02:00
Rob Wu
0167c8c6a2 Bug 1287010, 1286712 - Use schema-generated runtime API, split ext-runtime.js r=billm
- Use schema-generated runtime API for content scripts instead of
  untyped API.
- Move logic that cannot be run in the main process to a new file.

Together with the previous patch that migrated the i18n API, this
concludes the fix for bug 1286712.

MozReview-Commit-ID: A3yG0x1kjwx
2016-08-18 18:15:37 -07:00
Rob Wu
812e170fe8 Bug 1287010 - Make environment of Context explicit. r=billm
- Add `envType` to BaseContext.
 - Pass an explicit envType to all `registerSchemaAPI` invocations.
 - The factories passed to `registerSchemaAPI` will be split up later, so
   that content scripts (`content_child`) and addon pages can share
   common implementations.
 - The factories that implement the addon API will also be split up,
   to separate code running in the main process (`addon_parent`) from
   code running in a child process (`addon_child`).
 - Remove the use of a hardcoded list of `namespaces` from ProxyContext.
   Now `envType` is used to specify whether an API should be activated.

MozReview-Commit-ID: Jiff8HIwG92
2016-08-16 15:51:50 -07:00
Rob Wu
47e975c1fb Bug 1286712 - Validate runtime.sendMessage parameters r=billm
The main motive for this patch is to remove the use of the GlobalManager
global (which was used to see if an extension ID is valid, which was
specifically added in order to create thebrowser_ext_lastError.js test).
To preserve test coverage I implemented a full validation of the
runtime.sendMessage method.

Now the error for a non-existent extension is identical in both the
content script and background pages. Note that this also fixes a
minor privacy leak: Previously extensions could see whether another
extension is installed by sending a message to the specified extension
and using the different responses to see whether another extension is
installed.

MozReview-Commit-ID: 82R97Ei25Xr
2016-08-16 21:36:42 -07:00
Rob Wu
98a49ff299 Bug 1295082 - BaseContext.extensionId -> BaseContext.extension.id r=kmag
MozReview-Commit-ID: 2tFVUwjyJQu
2016-08-16 14:29:52 -07:00
Rob Wu
6efdd88867 Bug 1295082 - Put Extension in BaseContext r=kmag
ExtensionContext in Extension.jsm has |extension| as an instance member,
so use it instead of passing |extension| to registerSchemaAPI's
callback.

And to make sure that this pattern also works in content processes, move
the |extension| member to BaseContext.

MozReview-Commit-ID: BgsGGCPQxJR
2016-08-15 01:04:58 -07:00
Sebastian Hengst
c7a498ffbd Backed out changeset 0ce1cc39aa3d (bug 1295082) for timing out in test_ext_schemas_api_injection.js. r=backout 2016-08-18 16:47:09 +02:00
Sebastian Hengst
ff21875b1a Backed out changeset dc7b09331202 (bug 1295082) 2016-08-18 16:46:30 +02:00
Rob Wu
7c6379abff Bug 1295082 - BaseContext.extensionId -> BaseContext.extension.id r=kmag
MozReview-Commit-ID: 2tFVUwjyJQu
2016-08-16 14:29:52 -07:00
Rob Wu
6189daa99f Bug 1295082 - Put Extension in BaseContext r=kmag
ExtensionContext in Extension.jsm has |extension| as an instance member,
so use it instead of passing |extension| to registerSchemaAPI's
callback.

And to make sure that this pattern also works in content processes, move
the |extension| member to BaseContext.

MozReview-Commit-ID: BgsGGCPQxJR
2016-08-15 01:04:58 -07:00
Robert Helmer
c52c0f4a2c Bug 1279012 - implement onUpdateAvailable and runtime.reload() for WebExtensions r=aswan
MozReview-Commit-ID: KywrVkcRhzp
2016-08-02 09:37:01 -07:00
Andrew Swan
0c9f16fc6a Bug 1270360 Implement runtime.sendNativeMessage() r=kmag
MozReview-Commit-ID: 93FaGaYto5w
2016-06-08 14:52:35 -07:00
Kris Maglione
843973aa31 Bug 1279392: [webext] Move API permission definitions to the schemas. r=aswan
MozReview-Commit-ID: 8m7wJrAbFwS
2016-06-09 17:44:47 -07:00
Sebastian Hengst
d97f588f03 Backed out changeset a00cf073f5c0 (bug 1279392) for failing mochitest test_ext_contentscript_create_iframe.html at least on Linux x64 opt. r=backout 2016-06-14 13:37:52 +02:00
Kris Maglione
b2a33e3bf1 Bug 1279392: [webext] Move API permission definitions to the schemas. r=aswan
MozReview-Commit-ID: 8m7wJrAbFwS
2016-06-09 17:44:47 -07:00
Andrew Swan
a99551f0b8 Bug 1270357 Implement runtime.connectNative() r=kmag
MozReview-Commit-ID: Fo4BxEo3xus
2016-06-08 20:23:40 -07:00
Phil Ringnalda
dd10a380ba Back out 3 changesets (bug 1270357) for test_chrome_ext_native_messaging.html timeouts
CLOSED TREE

Backed out changeset 2e602689376d (bug 1270357)
Backed out changeset e1979d928c7c (bug 1270357)
Backed out changeset e0f9b54febc8 (bug 1270357)
2016-06-08 20:35:32 -07:00
Andrew Swan
d4568e8df5 Bug 1270357 Implement runtime.connectNative() r=kmag
MozReview-Commit-ID: Fo4BxEo3xus
2016-06-08 13:51:01 -07:00
Kris Maglione
c19b091a55 Bug 1250784: Part 3 - [webext] Add suport for runtime.openOptionsPage. r=Mossop
MozReview-Commit-ID: 9izx4uX0Szd
2016-03-09 17:10:29 -08:00
Matthew Wein
babfa923f9 Bug 1246031 - Utility for obtaining platform information. r=kmag 2016-02-17 15:14:28 -05:00
Kris Maglione
666cee3637 Bug 1248855 - [webext] Add "object-curly-spacing" ESLint rule and auto-fix errors. r=billm
MozReview-Commit-ID: BAZ2rRl7eSM
2016-02-16 20:10:00 -08:00
Andrew Swan
e58d313f2b Bug 1156826 - Implement browser.runtime.setUninstallURL(). r=kmag 2016-02-08 16:00:25 -08:00
Kris Maglione
dccecde671 Bug 1234020: Part 2d - [webext] Return promises from the runtime API. r=rpl 2016-02-01 18:08:18 -08:00
Kris Maglione
cb2bf096f9 Bug 1190680: Part 2 - [webext] Add initial support for lastError callbacks. r=billm 2016-01-29 18:38:08 -08:00
Bill McCloskey
1cf7392459 Bug 1208257 - [webext] runtime.json (r=kmag) 2015-12-23 08:57:13 -08:00
Kris Maglione
956fe582d0 Bug 1229874: Part 3 - Enable ESLint in WebExtension code. r=billm
The base .eslintrc is essentially a merge of the root Toolkit .eslintrc and
the devtools .eslintrc, with some minor changes to match our prevalent style.

For the most enforces the coding styles that we've been using most
consistently. There are a couple of significant differences, though:

 * The rule for opening brace alignment can only be applied globally, and
   doesn't make exceptions for top-level functions. I chose to turn it on, and
   change the brace style of existing top-level functions that violated it,
   since the rule seemed worth using, and that's the direction most Toolkit JS
   code has been headed anyway.

 * The rule for switch/case statements requires an added indentation level for
   case statements. Most of our switch statements did not use an extra level
   of indentation, and I initially wrote the rule to enforce that style, until
   I came across case statements that used blocks, and required the extra
   indentation level for sanity.
2015-12-02 16:58:53 -08:00