Commit Graph

45 Commits

Author SHA1 Message Date
Rob Wu
77a949f94f Bug 1392067 - Disconnect open extension ports when the message manager goes away
- Previously, if a port is disconnected by the other end, then memory
  would be leaked to `ProxyMessenger.ports` in ExtensionParent.jsm.
  To fix this, the port descriptor is now saved separately, keyed by
  port ID instead of message manager.

- Previously, when a message manager was disconnected (e.g. window
  closed/tab crashed), the port is disconnected only if the port was
  created from that page.
  This patch adds bookkeeping to keep track of the message managers at
  both the sender and receiver's side, so that the port is always
  disconnected when the other side goes away.

- The new test browser_ext_port_disconnect_on_crash.js checks whether
  the ports are disconnected as expected. Previously, the subtest
  connect_from_tab_to_bg_and_crash_tab failed because of the previous
  point.

- Although not as deterministic as the crash test, the new
  browser_ext_port_disconnect_on_window_close.js reproduces the original
  test failure and serves as a regression test for the bug.

- Previously, the data structure in ProxyMessenger.ports contained
  the original `sender` and `recipient`. For the purpose of sending
  port disconnection messages, these are not necessary and therefore
  they have been removed.

- Fix incorrect JSDoc (type of portId is number, not string)

MozReview-Commit-ID: BoaKRVAUKuq
2018-04-25 22:31:03 +02: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
c8ea1d4273 Bug 1421459: Update to ESLint 4 "indent" rule. r=aswan
MozReview-Commit-ID: LxLDWlsIlSk
2017-11-28 14:13:59 -08:00
Tomislav Jovanovic
f187bd307d Bug 1386427 - Part 3: Add storage and pkcs11 NativeManifest types r=kmag
MozReview-Commit-ID: 62MoqNLTxic
2017-09-16 05:30:13 +02:00
Tomislav Jovanovic
b1230d96e1 Bug 1386427 - Part 2: Extract HostManifestManager to NativeManifests.jsm r=kmag
MozReview-Commit-ID: GrVBZbkTfrB
2017-09-15 20:14:56 +02:00
Tomislav Jovanovic
46151ccd77 Bug 1386427 - Part 1: Add XRE*NativeManifests locations to dirsvc r=kmag
MozReview-Commit-ID: DoJIP6QZ5AX
2017-09-12 18:58:23 +02: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
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
Rob Wu
aaffe11f0c Bug 1307852 - Pass ID of calling add-on to native messaging app r=aswan
This allows native messaging binaries to identify the add-on that
invoked the native messaging app, in case more than one add-on is
allowed to launch the native messaging app.

MozReview-Commit-ID: GgjwfJDbBkW
2017-06-01 19:08:02 +02:00
Florian Quèze
ff53eb9a63 Bug 1353542 - massive script-generated patch converting Task.async and Task.spawn calls, and generators clearly identifiable as tasks, rs=Mossop. 2017-05-12 14:42:39 +02:00
Alexandre Poirot
208511b0d3 Bug 1356231 - Use toolkit EventEmitter.jsm instead of devtools module. r=mossop
MozReview-Commit-ID: 49JI7NtLwKK
2017-04-27 17:58:09 +02:00
Wes Kocher
e40b3bdc43 Merge mozilla-central to autoland a=merge 2016-11-11 14:10:32 -08:00
Kris Maglione
d25b4ecf0f Bug 1316396: Part 1 - Reorganize parent, child, common, and test code into more appropriate modules. r=aswan
MozReview-Commit-ID: 5WMt69GoN3K
2016-11-10 12:35:22 -08:00
Andrew Swan
df2e69b512 Bug 1313980 Avoid listening on browser-specific MM with connectNative() r=kmag
MozReview-Commit-ID: Al57DUrys63
2016-11-10 15:17:51 -08:00
Rob Wu
f4fd56d7fb Bug 1299411 - Error messages for native messaging r=aswan
- Combine the errors for a non-existing app and lacking permissions to
  avoid information leakage.
- Do not treat normal application exit as an error.
- Create errors in the right context.
- Add tests that check the error messages.

MozReview-Commit-ID: HxBpeCSyyGN
2016-09-24 13:45:02 +02: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
c4d7275a7f Bug 1299411 - s/on/once/ in NativeApp's sendMessage r=aswan
This communicates more clearly that we expect only one message/event.

MozReview-Commit-ID: 8jDYBVwqQtz
2016-09-24 13:22:31 +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
Kris Maglione
1b64819992 Bug 1298810: Pass Port object to listeners on native messaging ports. r=rpl
MozReview-Commit-ID: 1saUOB1jyE1
2016-08-29 13:12:16 -07:00
Kris Maglione
0d5c67223e Bug 1290598: Migrate native messaging tests to xpcshell. r=aswan
MozReview-Commit-ID: 4Uz73l8qGVE
2016-08-02 17:39:51 -07:00
Carsten "Tomcat" Book
5ed1cbf908 Backed out changeset 486639a0f3ca (bug 1290598) 2016-08-03 15:12:31 +02:00
Kris Maglione
1cb6f41c7d Bug 1290598: Migrate native messaging tests to xpcshell. r=aswan
MozReview-Commit-ID: 4Uz73l8qGVE
2016-08-02 17:39:51 -07:00
Kris Maglione
aa6026c47b Bug 1288912: Add tests for native messaging round trip time. r=aswan
MozReview-Commit-ID: 6gOpZhvAZUE
2016-07-28 20:54:40 -07:00
Andrew Swan
cae3e514b7 Bug 1282680 Always use 64-bit registry for native messaging r=kmag
MozReview-Commit-ID: 99JSqHP17v8
2016-07-18 13:34:19 -07:00
Andrew Swan
81e2def6d6 Bug 1283010 Fix windows registry paths for native messaging r=kmag
MozReview-Commit-ID: GdaDycckptp
2016-06-29 21:47:06 -07:00
Andrew Swan
2a78a4af63 Bug 1272522 Handle stderr of native app r=kmag
MozReview-Commit-ID: 5qGw83uTYTu
2016-07-06 14:57:56 -07:00
Phil Ringnalda
3e9262b64c Backed out changeset 6a8acb16142d (bug 1283010) for Windows failures in test_native_messaging.js 2016-07-06 19:18:31 -07:00
Andrew Swan
2e311181ab Bug 1283010 Fix windows registry paths for native messaging r=kmag
MozReview-Commit-ID: GdaDycckptp
2016-06-29 21:47:06 -07:00
Andrew Swan
80d33178c2 Bug 1281995 Support relative paths in host manifest on windows r=kmag
MozReview-Commit-ID: DaqYdPGQC3A
2016-06-27 14:52:57 -07:00
Carsten "Tomcat" Book
8ee875fb74 Backed out changeset d4379d1513fd (bug 1272522) for failures in test_ext_alarms.html 2016-07-04 06:25:51 +02:00
Andrew Swan
0c8c998600 Bug 1272522 Handle stderr of native app r=kmag
MozReview-Commit-ID: 5qGw83uTYTu
2016-06-17 07:27:07 -07:00
Andrew Swan
0c9f16fc6a Bug 1270360 Implement runtime.sendNativeMessage() r=kmag
MozReview-Commit-ID: 93FaGaYto5w
2016-06-08 14:52:35 -07:00
Andrew Swan
53da660d2e Bug 1274708 Use Context.jsonStringify() in connectNative r=kmag
MozReview-Commit-ID: J7q49nLg4F3
2016-06-16 10:10:54 -07:00
Andrew Swan
586761bbfc Bug 1270359 Implement connectNative on windows r=kmag
MozReview-Commit-ID: IHJuGt2Us8e
2016-06-09 15:10:54 -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
Andrew Swan
308f5c30d2 Bug 1270356 Part 2: Implement parsing and validation of native host manifests r=kmag
MozReview-Commit-ID: 3aXlBAgV4ti
2016-05-17 15:17:52 -07:00