Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define WebIDL Global to host WebDriver targeted APIs #1534

Closed
dontcallmedom opened this issue Jun 17, 2020 · 6 comments
Closed

Define WebIDL Global to host WebDriver targeted APIs #1534

dontcallmedom opened this issue Jun 17, 2020 · 6 comments

Comments

@dontcallmedom
Copy link
Member

A number of specs have emerged to expose e.g. fake hardware as IDL interfaces to help with testing, e.g.:

Right now, these specs define their interfaces using WebIDL, but without qualifying the interfaces on the global on which they're exposed.

Since these interfaces are typically not exposed in a regular browsing context, I wonder if WebDriver should define a dedicated global on which these interfaces could be exposed (e.g. with [Exposed=WebDriverGlobal] or [Exposed=TestGlobal].)

@foolip
Copy link
Member

foolip commented Jun 17, 2020

I think that Web IDL is not an ideal fit for this, but that we're lacking a good spec formalism that could be used instead. Shameless plug for #1510 and w3c/webdriver-bidi#21.

Web IDL converts between ECMAScript values and "IDL values", which are the implementation-internal types. For WebDriver, the conversion is rather between a JSON serialization and some internal types.

The difference sounds trivial/pedantic, but when there isn't actually a JS engine involved at all, none of the bindings-generating code that implementations have for Web IDL would be involved. And while one can squint and make it work for simple dictionaries of strings and numbers, I think it'll stop working when we sort out w3c/webdriver-bidi#16, and have a way to serialize values other than the subset of JS that can be represented as JSON.

Note that https://webbluetoothcg.github.io/web-bluetooth/tests.html is different, that's not defining a WebDriver API, but rather a test-only API which would be exposed in JavaScript like regular web APIs, just only in testing setups. There I think something like [TestOnly, Exposed=Window] could make sense.

@foolip
Copy link
Member

foolip commented Jun 17, 2020

Frequent Web IDL contributors @Ms2ger @domenic @TimothyGu @annevk @yasskin may have opinions about this.

@domenic
Copy link

domenic commented Jun 17, 2020

WebUSB seems similar to WebBluetooth, in that https://wicg.github.io/webusb/test/#idl-index exposes a test attribute on the USB interface (which should presumably be [TestOnly]), which allows you to get access to a bunch of other interfaces that should probably be [TestOnly, Exposed=Window].

Actually, the same for WebXR.

I think none of the specs listed in the OP have much to do with WebDriver.

@dontcallmedom
Copy link
Member Author

huh, sorry, I guess I was confused :)

So should I bring this over to the WebIDL repo then?

@domenic
Copy link

domenic commented Jun 17, 2020

Yeah, that's probably the right place for it, although we'll want a combination of Web IDL domain experts and test-only API domain experts.

@dontcallmedom
Copy link
Member Author

Raised whatwg/webidl#896 so closing this here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants