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

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

ferjm opened this issue Jan 15, 2018 · 3 comments

Comments

@ferjm
Copy link
Member

@ferjm 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

@SimonSapin SimonSapin commented Jan 15, 2018

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
Member Author

@ferjm ferjm commented Jan 16, 2018

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

bors-servo added 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 added 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

@saschanaz saschanaz commented Oct 16, 2019

Can't reproduce this:

new MutationObserver(() => {}).observe(document.body, { attributeFilter: "abc" });
// TypeError: Value is not an object, as expected.
@jdm jdm closed this May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.