w3c / webdriver

Remote control interface that enables introspection and control of user agents.
https://w3c.github.io/webdriver/
Other
679 stars 194 forks source link

Node cache #1705

Closed jgraham closed 1 year ago

jgraham commented 1 year ago

Generalise Element and ShadowRoot storage

For WebDriver BiDi we want to be able to return any Node object, and to support all reachable Nodes, not just those in the same browsing context. Therefore the approach of having per-Window Element and ShadowRoot caches won't work. Instead implement the following:

This doesn't introduce any normative changes into WebDriver, it just refactors the infrastructure to make it reusable in the BiDi context.


Preview | Diff

jgraham commented 1 year ago

Note that the cache as implemented here will allow access to elements that aren't actually accessible:

annevk@annevk:matrix.org jgraham: that would be all the browsing contexts belonging to a single agent cluster that belongs to a browsing context groups, > though that gives you "can potentially access" (as some of those might only be same origin-domain once you use document.domain) jgraham: https://docs.google.com/presentation/d/1hi4gH7pJPHsg_hnIj77XN_ce54HIaNUnBLenVwohFVo/edit#slide=id.g5641ecbac9_0_0 and slide 13 give an overview (related slides have approximate definitions)

So we could do a post-hoc check on the Documents sharing the same agent cluster (and origin?), but maybe in that case we should just claim that the cache is global? I'm not sure. CC @foolip

jgraham commented 1 year ago

OK, well I'm going to merge this because it's an improvement. We can always change the details of what owns the cache later.