-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Methods that take a WebIDL sequence
argument are missing
#1038
Comments
I just noticed this when looking at the SubtleCrypto api, which has the same problem:
are all missing, and all have |
Er sorry for taking awhile to get back to this! I believe this is handled here where we don't handle it right now. I suspect that we probably want to return either an This'll need some work to figure out what the best interface is, an implementation, and then a PR! |
Relevant webidl spec: https://heycam.github.io/webidl/#es-sequence It seems like the best thing to do for now is require a js_sys::Array, and then maybe expand to supporting iterators later. |
I've added a patch to use |
Update: I've re-read the spec and it seems ambiguous. It says:
but then says some other things about iterators. Does this mean "values of type |
Rather than guessing, we should test and see what the browsers actually do. |
I've experimented with DocumentOrShadowRoot elementsFromPoint in the console window (Firefox):
EDIT Chrome is the same
EDIT 2 In argument position it's the same again (from the
|
@derekdreery it may be worthwhile testing a few sequences in argument position too, I think it makes sense that coming out they're an array, but going in it may be anything iterable |
@alexcrichton that's what I thought too, they might accept stuff that's iterable. I'll do some tests. |
Here's a test case showing that for at least indexedDB, iterables are supported in argument position: const keys = ['first', 'second'];
var iterable = {
[Symbol.iterator]() {
let idx = 0;
return {
next: function() {
if (idx >= keys.length) {
return { done: true };
}
idx += 1;
return {value: keys[idx-1], done: false};
}
};
}
}
var request = indexedDB.open("test2", 1);
request.onupgradeneeded = function(evt) {
var db = request.result;
var store = db.createObjectStore("test", {keyPath: iterable});
console.log(store.keyPath);
}
request.onerror = function(evt) {
console.warn("Error");
console.warn(evt);
}
request.onsuccess = function(event) {
console.log("js Success");
} How should we handle this in web-sys? Should we emit different types depending on whether the sequence is in argument position, or return position? |
Ok thanks for the investigation! In that case I think we'd ideally use |
Fixed in #1152! |
Some methods seem to be missing from the
WebGl2RenderingContext
:invalidateFramebuffer
invalidateSubFramebuffer
drawBuffers
transformFeedbackVaryings
getUniformIndices
getActiveUniforms
What they all seem to have in common is that they all take a WebIDL
sequence
as an argument. I've not checked other APIs, so I'm not sure whether or not this affects other APIs besides the WebGl2 API.The text was updated successfully, but these errors were encountered: