Re: Object sharing across globals

On Thu, Jul 18, 2013 at 6:30 PM, Anne van Kesteren <annevk@annevk.nl> wrote:

> In DOM we already have a problem with [[Prototype]] when a Node moves
> to a different global:
> https://www.w3.org/Bugs/Public/show_bug.cgi?id=20567 (Solutions
> welcome in the bug or separate thread.)
>
> I'm wondering what the right solution is for notifications. Say we
> have two same-origin globals that can reach other (A & B). Now each of
> these creates a Notification object (AN & BN). Now we create a new
> method that returns the notifications associated with a given origin.
>
> If we invoke this method in A, what's the expected result? AN & BN
> (object equality)? AN & BN' (new object for the one from B)? AN' & BN'
> (new objects for everyone).
>
> Now repeat this question for A & B as same-origin, but they cannot
> reach other (synchronously, anyway).
>
> The objects have a close() method to make the notification disappear
> at which point an event will fire on the objects.
>
> See http://notifications.spec.whatwg.org/ for context.

I would expect AN & BN', effectively returning results in the form of
"here are the objects you created and clones of some others that you
didn't". Because:

1) Least surprise -- an object from another window doesn't emerge as a result.
2) Consistent for both for sync and async case.

:DG<

Received on Friday, 19 July 2013 19:48:50 UTC