domenic / get-originals

A web platform API that allows access to the "original" versions of the global built-in objects' properties and methods
28 stars 1 forks source link

getOriginalConstructor vs getOriginalProperty examples may not make sense #3

Closed bzbarsky closed 5 years ago

bzbarsky commented 6 years ago

It's really not clear to me how we decided what things are returned by getOriginalConstructor vs getOriginalProperty.

In terms of implementation, JSON is in more or less the same bucket as Array at least in SpiderMonkey. And Reflect is in the same bucket too.

Just like CSS is more or less in the same bucket as Node and `Image'.

Per the current definition in the spec, it would return 'Array' and 'Node', but not the other ones, right?

domenic commented 6 years ago

Per the current definition in the spec, it would return 'Array' and 'Node', but not the other ones, right?

Right. Note that none of these are returned by getOriginalProperty().

If you think it's not a big deal to open up getOriginalConstructor() [presumably renamed] to the "namespaces", we could. But it's not clear exactly how you'd use those. Would getOriginalProperty() work on the returned namespace objects? I was assuming an "unwrap the JS wrapper" strategy for getOriginalProperty(), in which case it would not. At which point having these namespace objects is fairly pointless.

bzbarsky commented 6 years ago

Would getOriginalProperty() work on the returned namespace objects?

In Gecko it presumably would. This is how current privileged script touching web pages works, for example. There's a membrane in there, but in the end that's what happens.

I was assuming an "unwrap the JS wrapper" strategy for getOriginalProperty()

I'm not sure what you mean...

domenic commented 6 years ago

I'm not sure what you mean...

Rephrased in terms of https://github.com/domenic/get-originals/issues/10#issuecomment-393586192, I was assuming a "prototype based" strategy for getOriginalProperty(). But maybe that's not necessary.