New issue
Advanced search Search tips

Issue 707632 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 708306
issue 709061



Sign in to add a comment

IDL: sequence<float> conversion should throw TypeError when there are non-finite values

Project Member Reported by bashi@chromium.org, Apr 3 2017

Issue description

We manually check for finite values in some places (e.g. IIRFilterNode) but it should be done by the binding layer as the spec says[1].

[1] https://heycam.github.io/webidl/#es-float
 

Comment 1 by rtoy@chromium.org, Apr 4 2017

Blocking: 708306
Project Member

Comment 2 by bugdroid1@chromium.org, Apr 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0f01bbd2bd685d4987f04347e6403c3e2d13e0c9

commit 0f01bbd2bd685d4987f04347e6403c3e2d13e0c9
Author: bashi <bashi@chromium.org>
Date: Thu Apr 06 03:43:52 2017

bindings: Explicitly pass ValueType to toImplArray

This makes toImplArray use correct NativeValueTraits<T>.

BUG= 707632 

Review-Url: https://codereview.chromium.org/2791133002
Cr-Commit-Position: refs/heads/master@{#462346}

[modify] https://crrev.com/0f01bbd2bd685d4987f04347e6403c3e2d13e0c9/third_party/WebKit/LayoutTests/intersection-observer/observer-exceptions.html
[modify] https://crrev.com/0f01bbd2bd685d4987f04347e6403c3e2d13e0c9/third_party/WebKit/LayoutTests/webaudio/IIRFilter/iirfilter-basic.html
[modify] https://crrev.com/0f01bbd2bd685d4987f04347e6403c3e2d13e0c9/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
[modify] https://crrev.com/0f01bbd2bd685d4987f04347e6403c3e2d13e0c9/third_party/WebKit/Source/bindings/scripts/v8_types.py
[modify] https://crrev.com/0f01bbd2bd685d4987f04347e6403c3e2d13e0c9/third_party/WebKit/Source/bindings/tests/results/core/LongSequenceOrEvent.cpp
[modify] https://crrev.com/0f01bbd2bd685d4987f04347e6403c3e2d13e0c9/third_party/WebKit/Source/bindings/tests/results/core/NodeOrLongSequenceOrEventOrXMLHttpRequestOrStringOrStringByteStringOrNodeListRecord.cpp
[modify] https://crrev.com/0f01bbd2bd685d4987f04347e6403c3e2d13e0c9/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
[modify] https://crrev.com/0f01bbd2bd685d4987f04347e6403c3e2d13e0c9/third_party/WebKit/Source/bindings/tests/results/core/V8TestTypedefs.cpp

Comment 3 by bashi@chromium.org, Apr 6 2017

Status: Fixed (was: Assigned)

Comment 4 by rtoy@chromium.org, Apr 6 2017

This works great and removes quite a few checks in WebAudio.

However, is it possible to have more informative error messages?  The old WebAudio code used to print out the index where the first non-finite float occurred and also the value (NaN or +/- Infinity).  The value is kind of useful because Infinity means I probably messed up very near the error. NaN means I've probably propagated lots of other invalid operations to get to this point.

Comment 5 by rtoy@chromium.org, Apr 6 2017

Blocking: 709061

Comment 6 by bashi@chromium.org, Apr 6 2017

Cc: haraken@chromium.org yukishiino@chromium.org
Hmm, it's a bit difficult with the current implementation. In toImplArray() we are using TraitsType::nativeValue() and we propagate the exception raised by nativeValue() if exists. If we want to include the index, we create another exception but we loose the original exception. We don't have a way to create a wrapped exception.

+haraken@ and yukishiino@ for their inputs.
This seems a common demand that someone (in multiple layers) sometimes wants to add more info into an existing exception.  I'd like to know solutions, too.  :)

Random ideas off the top of my head,
a) An exception object is an object.  You can technically add arbitrary properties to represent more information.
b) What other browsers (especially Firefox) are doing?
c) We could set the index in an ExceptionState in a loop, and the ExceptionState automatically adds the index into the message when it's thrown.

FYI,
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
There are vendor-specific extensions.

Sign in to add a comment