-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Cross-origin window.focus() vs window.postMessage() #3506
Comments
So I just tested Chrome with this testcase. Parent:
and child (from that link):
I see Oh, and if I reverse the order of the (As a side note, @mystor figured out that this is an issue, not me. I just filed the Gecko bug.) |
Ah, go @mystor \o/ |
Ah, yes, I think this is because we don't start the timer in the cross-process case. I wonder if we could post a task in that case similar to the same-process case, as suggested in https://bugzilla.mozilla.org/show_bug.cgi?id=1440754? LocalDOMWindow starts a timer: RemoteDOMWindow just forwards the event to the browser process for dispatch to the right process: @zetafunction, what do you think? |
@bzbarsky @csreis @cdumez what would be a robust setup here that we can agree on and eventually specify? One thought I had is that we queue all cross-agent actions within a task, message a copy of the queue and empty the queue end-of-task, and then dequeue the queue and run the actions on the other side. (If you message each action independently it seems the |
Presumably entering "spin the event loop" (possibly in cases where the HTML spec currently has "pause") would also flush out the queue? My main worry there is the requirement for unbounded growth of the queue. Maybe it's not an issue in practice, though. |
I suppose. I'm still somewhat hopeful we can remove "spin the event loop" as Chrome does not seem to have it (or at least for the various modal dialogs they appear to sometimes return early, rather than spin, and the other places where we permit spinning are hard to create tests for). |
This might be a use case for delegating some permission temporarily on the postMessage. That was some of the TAG feedback received on #4364 The the focusing can be delegated to doing it inside the postMessage handler of the receiving frame. |
You mean it queues a task? Does that depend on the caller? |
Sorry, yeah, it's expected that with process isolation of sites |
In https://bugzilla.mozilla.org/show_bug.cgi?id=1440754 @bzbarsky presented an interesting case:
Under normal conditions you can expect the window to be focused before it gets a message. How is this ensured when they are actually in different processes?
As pointed out by @wanderview, similar scenarios can be constructed with
MessageChannel
.Somewhat related: #3497.
cc @jgraham @mystor @smaug---- @csreis @Rnia @zetafunction
The text was updated successfully, but these errors were encountered: