Commit Graph

56 Commits

Author SHA1 Message Date
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
Fabrice Desré
1d27924873 Bug 1220700 - Cannot enable add-ons installed from WebIDE r=ochameau 2015-11-17 11:03:44 -08:00
Bill McCloskey
731f6c5313 Bug 1223589 - [webext] Implement getPlatformInfo (r=kmag) 2015-11-12 08:19:45 -08:00
Bill McCloskey
948f074381 Bug 1223585 - [webext] Annotate ignoreEvent (r=kmag) 2015-11-12 08:19:45 -08:00
Carsten "Tomcat" Book
036e6d2fa3 Backed out 2 changesets (bug 1202902) to recking bug 1202902 to be able to reopen inbound on a CLOSED TREE
Backed out changeset 647025383676 (bug 1202902)
Backed out changeset d70c7fe532c6 (bug 1202902)
2015-10-07 14:03:21 +02:00
Carsten "Tomcat" Book
12369728f5 Backed out 1 changesets (bug 1202902) for causing merge conflicts to mozilla-central
Backed out changeset cfc1820361f5 (bug 1202902)
2015-10-07 12:13:45 +02:00
Shu-yu Guo
474f49adb7 Bug 1202902 - Scripted fix the world. 2015-10-06 14:00:31 -07:00
Luca Greco
ac0a9aedf0 Bug 1204583 - test connect params preprocess and fix raised invalid params error. r=billm 2015-09-30 14:21:00 +02:00
Luca Greco
8bcb8d86f3 Bug 1204583 - preprocess and validate optional WebExtension runtime.connect params. r=billm,gabor 2015-09-26 09:24:00 +02:00
Luca Greco
f406a65dad Bug 1204583 - Implement WebExtension runtime.connect for background and tab. r=billm,gabor 2015-09-26 09:22:00 +02:00
Shu-yu Guo
37989840cd Bug 1202902 - Mass replace toplevel 'let' with 'var' in preparation for global lexical scope. (rs=jorendorff) 2015-09-15 11:19:45 -07:00