GoogleChromeLabs / confluence

Service and API for Web API Confluence: Metrics for web platform health
https://web-confluence.appspot.com
BSD 3-Clause "New" or "Revised" License
92 stars 36 forks source link

API discovery excludes anything not in Object.getOwnPropertyNames() #229

Open mdittmer opened 6 years ago

mdittmer commented 6 years ago

Umbrella bug for the following issue (example drawn from Safari 9 data):

Object.getOwnPropertyNames(window).filter(function(name) { return name === 'indexedDB'; }).length
// 0
window.hasOwnProperty('indexedDB')
// true

More generally: current API discovery strategy misses any API that appears when accessed directly, but appears nowhere in Object.getOwnPropertyNames() along the object's prototype chain.

mdittmer commented 6 years ago

This issue was mentioned in #204, and #201 is a special case of this issue.

gsnedders commented 6 years ago

We almost certainly want to consider Object.getOwnPropertySymbols too in browsers that support it.

Anything omitted from that or getOwnPropertyNames violates an ES spec invariant, right? Is there any way to workaround in general the Safari 9.1 issue, for example? (I don't think so, given it seems to be an issue with the bindings?)

mdittmer commented 6 years ago

I would agree that we should be checking Object.getOwnPropertySymbols. AFAICT the only way to partially work around the bindings issue is to inject external information and attempt to access properties directly; e.g., trying webkitFoo for all foos on CSSStyleDeclaration.prototype, or poke around for known interface members after consulting something like imported Web IDL parse trees.