gecko-dev/js/xpconnect
Nika Layzell 0f6863aece Bug 1474369 - Part 4: Add support for Sequence<T> types to xpidl and XPConnect, r=mccr8
Summary:
This patch adds support for the `Sequence<T>` type. This is largely a
straightforward type propagation patch, but there are a few notable things:

 1. We allow `[iid_is(x)] Sequence<nsQIResult>`, so Sequence can be Dependent.

 2. `Sequence<T>` is reflected into C++ as a `nsTArray<T>`, which is different
    than WebIDL's `mozilla::dom::Sequence<T>` type. This decision was made for
    general ergonomics reasons, as `nsTArray<T>` is more prevailent throughout
    the codebase, and lengths in this case cannot be controlled by content, as
    XPConnect is only exposed to Chrome JS.

 3. Owned pointers in `Sequence<T>` are not reflected as their owned
    counterparts. For example, `Sequence<nsISupports>` is reflected as
    `nsTArray<nsISupports*>` rather than `nsTArray<RefPtr<nsISupports>>`. This
    was done to avoid depending on `RefPtr<T>` and `T*` having the same
    in-memory representation, however if that is considered an acceptable
    dependency, it would be nice to support that.

 4. We also don't reflect singly-owned pointers as their owned counterparts. For
    example, `nsTArray<nsIIDPtr>` would be reflected as `nsTArray<nsIID*>`
    rather than `nsTArray<mozilla::UniquePtr<nsIID>>`. If we are willing to
    depend on `mozilla::UniquePtr<T>`'s in-memory representation, we could also
    do this, however.

 5. There are no restrictions on what types can appear inside of a `Sequence<T>`
    or what can appear inside an `[array] T`. We may want to add restrictions
    either at the xpidl level or in XPConnect.

Depends On D2109

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2110
2018-07-30 11:28:08 -04:00
..
crashtests Bug 1446668: Remove setUserData crashtests. r=smaug 2018-03-18 01:53:13 +01:00
idl Bug 1465287 Part 7 - Add IPDL and IDL for record/replay directives and fatal errors, r=mccr8. 2018-07-22 11:51:55 +00:00
loader Backed out 8 changesets (bug 1475228) for wpt failures e.g. html/semantics/scripting-1/the-script-element/execution-timing/088.html on a CLOSED TREE 2018-07-30 16:49:02 +03:00
public Bug 1453011 - Remove PostCreatePrototype. r=bz. 2018-03-22 11:31:05 +01:00
shell bug 1255485 - Remove NSDISTMODE=copy from Makefiles. r=nalexander 2017-11-22 15:30:06 -05:00
src Bug 1474369 - Part 4: Add support for Sequence<T> types to xpidl and XPConnect, r=mccr8 2018-07-30 11:28:08 -04:00
tests Bug 1471726 - Part 2: Add basic tests for jsval array codegen, r=mccr8 2018-07-30 11:27:52 -04:00
wrappers Bug 1478955 part 1 - Rename JSAutoRealm to JSAutoRealmAllowCCW. r=luke 2018-07-28 12:12:26 +02:00
moz.build