Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Issue 2342393002: Enable TypeError for dictionary members of non-nullable interface type (Closed)

Created:
4 years, 3 months ago by foolip
Modified:
4 years, 3 months ago
Reviewers:
haraken, Jens Widell, bashi
CC:
chromium-reviews, tzik, eae+blinkwatch, eric.carlson_apple.com, Srirama, rwlbuis, jsbell+serviceworker_chromium.org, awdf+watch_chromium.org, toyoshim+midi_chromium.org, blink-reviews-dom_chromium.org, dglazkov+blink, blink-reviews-bindings_chromium.org, blink-reviews, mcasas+watch+mediastream_chromium.org, Peter Beverloo, sof, nhiroki, feature-media-reviews_chromium.org, tommyw+watchlist_chromium.org, mcasas+watch+mediarecorder_chromium.org, michaeln, shimazu+serviceworker_chromium.org, emircan+watch+mediarecorder_chromium.org, mlamouri+watch-blink_chromium.org, serviceworker-reviews, falken, kinuko+serviceworker, horo+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Enable TypeError for dictionary members of non-nullable interface type In dictionary_v8.cpp, the extra null check was wrong or redudant depending on nullabilty: * If the member isn't nullable, then passing null should throw TypeError. * If the member is nullable, then a null check is already emitted earlier, and so that part of the condition is always true. The affected dictionaries were identified by looking at the resulting changes in the generated bindings. Any affected member was made nullable so that this change in itself is not observable, but the right behavior is achieved if those changes are individually reverted. A few cases that were not given TODOs: * MessageEventInit, because the existing TODO is appropriate. * MediaStreamEventInit, because it has no spec and MediaStreamEvent's corresponding attribute is already nullable. * SpeechRecognitionEventInit, because it has no spec. SpeechRecognitionEvent's attributes were made nullable because they can now in fact be null. A number of spec issues were discovered, linked with the TODOs. BUG=647693 Committed: https://crrev.com/7f8965f2d8ef4ac323cc4654769e853174267f6f Cr-Commit-Position: refs/heads/master@{#419344}

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+63 lines, -33 lines) Patch
M third_party/WebKit/Source/bindings/templates/dictionary_v8.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionary.cpp View 7 chunks +7 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/core/dom/TouchInit.idl View 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/events/MessageEventInit.idl View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/encryptedmedia/MediaKeyMessageEventInit.idl View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/gamepad/GamepadEvent.idl View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/gamepad/GamepadEventInit.idl View 1 chunk +5 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/mediarecorder/BlobEventInit.idl View 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/mediastream/MediaStreamEventInit.idl View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/notifications/NotificationEventInit.idl View 1 chunk +3 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/presentation/PresentationConnectionAvailableEventInit.idl View 1 chunk +3 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/sensor/SensorReadingEventInit.idl View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/FetchEventInit.idl View 1 chunk +3 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/ForeignFetchEventInit.idl View 1 chunk +3 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/serviceworkers/ForeignFetchResponse.idl View 1 chunk +3 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/speech/SpeechRecognitionEvent.idl View 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/modules/speech/SpeechRecognitionEventInit.idl View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/vr/VRDisplayEventInit.idl View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/webmidi/MIDIConnectionEventInit.idl View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/webmidi/MIDIMessageEventInit.idl View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/webusb/USBConnectionEventInit.idl View 1 chunk +4 lines, -1 line 0 comments Download

Dependent Patchsets:

Messages

Total messages: 18 (7 generated)
foolip
PTAL
4 years, 3 months ago (2016-09-16 16:31:38 UTC) #4
haraken
LGTM on my side
4 years, 3 months ago (2016-09-16 23:59:26 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2342393002/1
4 years, 3 months ago (2016-09-17 00:18:19 UTC) #9
commit-bot: I haz the power
Committed patchset #1 (id:1)
4 years, 3 months ago (2016-09-17 00:25:03 UTC) #10
commit-bot: I haz the power
Patchset 1 (id:??) landed as https://crrev.com/7f8965f2d8ef4ac323cc4654769e853174267f6f Cr-Commit-Position: refs/heads/master@{#419344}
4 years, 3 months ago (2016-09-17 00:29:28 UTC) #12
hta - Chromium
Impressive fix!
4 years, 3 months ago (2016-09-19 18:19:09 UTC) #13
foolip
On 2016/09/19 18:19:09, hta - Chromium wrote: > Impressive fix! Thanks, nothing now block MediaStreamTrackEvent ...
4 years, 3 months ago (2016-09-19 18:49:01 UTC) #14
bashi
On 2016/09/19 18:49:01, foolip wrote: > On 2016/09/19 18:19:09, hta - Chromium wrote: > > ...
4 years, 3 months ago (2016-09-19 23:48:30 UTC) #15
foolip
On 2016/09/19 23:48:30, bashi1 (slow til Sep 26) wrote: > On 2016/09/19 18:49:01, foolip wrote: ...
4 years, 3 months ago (2016-09-20 08:59:29 UTC) #16
bashi
On 2016/09/20 08:59:29, foolip wrote: > On 2016/09/19 23:48:30, bashi1 (slow til Sep 26) wrote: ...
4 years, 3 months ago (2016-09-20 09:57:35 UTC) #17
foolip
4 years, 3 months ago (2016-09-20 10:28:04 UTC) #18
Message was sent while issue was closed.
On 2016/09/20 09:57:35, bashi1 (slow til Sep 26) wrote:
> On 2016/09/20 08:59:29, foolip wrote:
> > On 2016/09/19 23:48:30, bashi1 (slow til Sep 26) wrote:
> > > On 2016/09/19 18:49:01, foolip wrote:
> > > > On 2016/09/19 18:19:09, hta - Chromium wrote:
> > > > > Impressive fix!
> > > > 
> > > > Thanks, nothing now block MediaStreamTrackEvent :)
> > > 
> > > Thanks for working on this! However, is this really a correct fix?
According
> > to
> > > http://heycam.github.io/webidl/#es-dictionary, we should convert null ->
> > > undefined and only throw a type error when the member is required. Am I
> > missing
> > > something?
> > 
> > I think you're misreading the spec in the same way that I did in
> > https://crbug.com/647234. The V in
> http://heycam.github.io/webidl/#es-dictionary
> > is actually the value being converted as a dictionary, not the value for the
> > members being iterated. Implementing it like this would save the "Missing
> > required member(s):" strings from the binary, but it would perhaps make the
> code
> > a tiny bit slower due to repeated null test. It'd save this confusion though
> :)
> 
> Actually I was misreading. Thanks for the clarification!

I'm glad I wasn't the only one, I wasted about half a day on that
misunderstanding :)

Powered by Google App Engine
This is Rietveld 408576698