domenic at domenicdenicola.com (2013-11-12T18:52:18.205Z)
On Nov 1, 2013, at 7:23 PM, Andrea Giammarchi <andrea.giammarchi at gmail.com> wrote:
> also, your reviver would receive objects from the realm I am checking with that code ... so your reviver will receive object from the **expected** realm ... just to clarify, for future readers.
>
I don’t understand what you’re saying here
if your reviver is in realm A, and says
```js
function reviver(foo) {
…
if (foo instance of Array) alert(“Array!”)
...
}
```
And realm B says
```js
JSON.parse(…, realm A.reviver)
```
You will never get to the alert.
As far as use cases, i recall multiple websites using invisible iframes as “modules” where multiple realms would use a shared group of functions from a single realm
On Nov 1, 2013, at 7:23 PM, Andrea Giammarchi <andrea.giammarchi at gmail.com> wrote: > also, your reviver would receive objects from the realm I am checking with that code ... so your reviver will receive object from the **expected** realm ... just to clarify, for future readers. > I don’t understand what you’re saying here if your reviver is in realm A, and says function reviver(foo) { … if (foo instance of Array) alert(“Array!”) ... } And realm B says JSON.parse(…, realm A.reviver) You will never get to the alert. As far as use cases, i recall multiple websites using invisible iframes as “modules” where multiple realms would use a shared group of functions from a single realm —Oliver > Still all ears listening to that case I've never, honestly, considered! > > Thanks > > > On Thu, Oct 31, 2013 at 11:07 PM, Andrea Giammarchi <andrea.giammarchi at gmail.com> wrote: > Sure, so Allen asked me a real case to show, and I've done it. Now you please show me a real case when you pass a revival function to `JSON.parse` that is from another realm, explaining why, as I've done for mine, thanks. > > Best Regards > > > On Thu, Oct 31, 2013 at 7:41 PM, Oliver Hunt <oliver at apple.com> wrote: > > On Nov 1, 2013, at 2:46 PM, Andrea Giammarchi <andrea.giammarchi at gmail.com> wrote: > > > Allen, in which place on current known universe, when you parse a JSON.string, your reviver function receives objects from another realm, exactly? > Please try to keep the discourse polite. > > That said this is fairly trivial > > <realm a> > function reviver(…) { … } > </> > > <realm b> > JSON.parse(… <realm a>.reviver …) > </> > > now the realm of the objects created by the JSON object differ from the realm that the reviver function is working in. > > —Oliver > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131101/a09a9e5e/attachment-0001.html>