Граф коммитов

11 Коммитов

Автор SHA1 Сообщение Дата
Agi Sferro 3a3968887a Bug 1570115 - Add do_QueryActor to query JS-implemented interfaces. r=kmag
This allows querying an actor for interfaces implemented in JS.

Differential Revision: https://phabricator.services.mozilla.com/D44050

--HG--
extra : moz-landing-system : lando
2019-09-20 18:01:07 +00:00
John Dai da2a2940ad Bug 1580907 - Remove transferables attribute for SendAsyncMessage and SendQuery in JSWindowActor; r=nika
Differential Revision: https://phabricator.services.mozilla.com/D45809

--HG--
extra : moz-landing-system : lando
2019-09-13 16:51:23 +00:00
Kris Maglione 7467b1470b Bug 1561705: Part 1 - Add JSWindowActor.actorCreated callback. r=jdai
The JSWindowActor constructor is called before the actor is fully initialized,
which means it can't do things like send messages or access its content
window. This patch adds a new callback which can do those things immediately
after the actor is created.

Differential Revision: https://phabricator.services.mozilla.com/D42178

--HG--
extra : rebase_source : ba17cacb00d8fc74f84c5d34f64addcc3e6d3f8b
extra : source : ac3da20c687971c412d1164f08b17e0cccc5fbd5
2019-08-14 16:13:13 -07:00
Olli Pettay c7ee50989c Bug 1565930, try to make Promise less error prone to compartment mismatches, r=bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D38762

--HG--
extra : moz-landing-system : lando
2019-07-29 14:43:54 +00:00
Kris Maglione e1913dc244 Bug 1541557: Part 2 - Stop sending uninitialized StructuredCloneData objects. r=nika
There are a couple of places where JSWindowActor currently sends uninitialized
StructuredCloneData objects in places where it wants the message data to be
undefined. The problem with this is that it causes an error when trying to
read the data, which leads to odd behavior like `sendQuery` promises never
being settled if the message handler throws, or `sendAsyncMessage` and
`sendQuery` failing to decode the message if the caller doesn't pass a second
argument.

The errors reported for these problems also have no context, which means it's
very hard for a developer to figure out the source of the problem. And, to
make matters worse, the errors look the same as structured clone encoding
errors, so there isn't even the clue that the error is happening on decode.

This patch updates the offending code to always explicitly initialize the
structured clone data with `undefined` when that's what it wants, and adds
assertions to make it more obvious where the decode errors are actually
happening.

Differential Revision: https://phabricator.services.mozilla.com/D35052

--HG--
extra : rebase_source : dd4720d63cd0722a554524e65d16e31b702adbf3
extra : source : 158a4000c44b9b17a7935340db79431d544fb556
2019-06-13 15:01:05 -07:00
Kris Maglione ae31355192 Bug 1541557: Part 1 - Use correct globals for JSWindowActors not in the shared JSM global. r=nika
The current JSWindowActor code assumes that all actors will be created in the
shared JSM global. This has a few problems:

1) For actors in other scopes, it enters the wrong compartment before decoding
messages, which leads to a compartment checker error when trying to call
message handlers. That could be fixed by just wrapping the result for the
caller, but that would lead to other problems. Aside from the efficiency
concerns of having to deal with cross-compartment wrappers, SpecialPowers in
particular would not be able to pass the resulting objects to unprivileged
scopes, since only SpecialPowers compartments have permissive CCWs enabled.

2) It also leads to the prototype objects for the actor instances being
created in the shared JSM scope, even when the actors themselves are defined
in other compartments. Again, aside from CCW efficiency issues, this prevents
the SpecialPowers instances from being accessed by the unprivileged scopes
that they're exposed to, since the prototype objects live in privileged scopes
which don't have permissive CCWs enabled.

This patch changes child actors to always create their objects in the global
of their constructors.

The parent objects are still created in the shared JSM global, but they now
wrap values for the appropriate compartment before trying to call message
handlers.

Differential Revision: https://phabricator.services.mozilla.com/D35051

--HG--
extra : rebase_source : 436ce516080812680d1433bf3ecbd12f91d88165
extra : source : 61fa2745733f3631488a3ecccc144823683b7b6d
2019-06-12 16:06:40 -07:00
John Dai 2c0a4d5a88 Bug 1557448 - Add this value for invocation callback; r=nika
Differential Revision: https://phabricator.services.mozilla.com/D34219

--HG--
extra : moz-landing-system : lando
2019-06-10 17:53:22 +00:00
John Dai 916234b917 Bug 1538979 - Part 2: Add WillDestroy and DidDestroy lifecycle methods on JSWindowActor; r=nika
Differential Revision: https://phabricator.services.mozilla.com/D30196

--HG--
extra : moz-landing-system : lando
2019-05-10 15:01:40 +00:00
Csoregi Natalia ca5858897f Backed out 3 changesets (bug 1538979) for bustage on JSWindowActor.cpp. CLOSED TREE
Backed out changeset a098226e4211 (bug 1538979)
Backed out changeset 8e065761738c (bug 1538979)
Backed out changeset 9df2b856b655 (bug 1538979)
2019-05-10 12:44:22 +03:00
John Dai c22ef89c64 Bug 1538979 - Part 2: Add WillDestroy and DidDestroy lifecycle methods on JSWindowActor; r=nika
Differential Revision: https://phabricator.services.mozilla.com/D30196

--HG--
extra : moz-landing-system : lando
2019-05-10 09:19:30 +00:00
Nika Layzell 6114a5f7ab Bug 1544936 - Part 1: Add a sendQuery method to send an async message with a response to JSWindowActor, r=mconley,jdai
This adds a single new method, which acts like sendAsyncMessage, but
also returns a promise. This promise is fulfilled when the promise
returned from the receiveMessage callback is resolved.

```
partial interface JSWindowActor {
  [Throws]
  Promise<any> sendQuery(DOMString messageName,
                         optional any obj,
                         optional any transfers);
}
```

Differential Revision: https://phabricator.services.mozilla.com/D27809

--HG--
extra : moz-landing-system : lando
2019-04-18 19:37:15 +00:00