New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show how to send a message while activating a portal #4

Closed
jyasskin opened this Issue May 21, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@jyasskin
Copy link
Collaborator

jyasskin commented May 21, 2018

The example has:

insetPortal.activate();
insetPortal.postMessage();

But this isn't guaranteed to work, since .activate() is a navigation that can kill off the parent page. The opposite:

insetPortal.postMessage(...);
insetPortal.activate();

is also not guaranteed to work, particularly in the case of restricted mode, where the target can't run Javascript.

I suspect we actually want .activate() to accept a message to send to the portal:

insetPortal.activate(...);
@jeremyroman

This comment has been minimized.

Copy link
Collaborator

jeremyroman commented May 23, 2018

For the former, it seems like we could resolve that by making the activation actually happen in a separate task or similar. Avoiding more cases of unloading the document while script is executing it seems desirable.

For the latter...it seems like it depends on the exact semantics we end up with for restrictions. (It's not clear to me whether changing the policy on activation is the only reasonable answer.) If so, that sounds reasonable, except that I'd probably shove it in a dictionary to leave us room for other kinds of options to activate. Something like:

dictionary PortalActivateOptions {
  optional any data;
}
@KenjiBaheux

This comment has been minimized.

Copy link
Collaborator

KenjiBaheux commented May 28, 2018

This definitely seems more robust (did a tentative PR, just a tiny change it seems)
Note: I've added both of you as collaborators.

KenjiBaheux added a commit that referenced this issue May 28, 2018

@KenjiBaheux KenjiBaheux closed this Jun 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment