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

Passing a single string as a sequence<DOMString> generates a Vec<DOMString> #19776

Closed
ferjm opened this issue Jan 15, 2018 · 3 comments
Closed
Labels
A-content/bindings The DOM bindings

Comments

@ferjm
Copy link
Contributor

ferjm commented Jan 15, 2018

With an interface like:

dictionary BarOptions {
  required sequence<DOMString> baz;
};

interface Foo {
  void bar(BarOptions options);
};

passing a single string like:

  var foo = new Foo();
  foo.bar({ baz: "string"});

generates a [DOMString("s"), DOMString("t"), DOMString("r"), DOMString("i"), DOMString("n"), DOMString("g")].

I believe this should throw a TypeError instead, like in https://github.com/w3c/web-platform-tests/blob/master/performance-timeline/po-observe.any.js#L12

@SimonSapin
Copy link
Member

https://heycam.github.io/webidl/#es-sequence defines that a WebIDL sequence<T> is created from a JS object through its @@iterator method, which for strings iterate over the code points. So this behavior looks expected?

@ferjm
Copy link
Contributor Author

ferjm commented Jan 16, 2018

I am not sure ... whatwg/webidl#266 Is DOMString a string wrapper?

bors-servo pushed a commit that referenced this issue Jan 17, 2018
Do not throw if PerformanceObserver.observe gets an empty sequence

Apply this spec change: w3c/performance-timeline#88

Some tests change from FAIL to TIMEOUT, which is expected as we still don't support the Resource or the Navigation Timing APIs. And the "entryTypes must be a sequence or throw a TypeError" fails because of #19776.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19777)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this issue Jan 18, 2018
Do not throw if PerformanceObserver.observe gets an empty sequence

Apply this spec change: w3c/performance-timeline#88

Some tests change from FAIL to TIMEOUT, which is expected as we still don't support the Resource or the Navigation Timing APIs. And the "entryTypes must be a sequence or throw a TypeError" fails because of #19776.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19777)
<!-- Reviewable:end -->
@saschanaz
Copy link
Contributor

Can't reproduce this:

new MutationObserver(() => {}).observe(document.body, { attributeFilter: "abc" });
// TypeError: Value is not an object, as expected.

@jdm jdm closed this as completed May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-content/bindings The DOM bindings
Projects
None yet
Development

No branches or pull requests

4 participants