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

Issue 141523002: Add null-correctness checking to [StrictTypeChecking] methods (Closed)

Created:
6 years, 11 months ago by Nils Barth (inactive)
Modified:
6 years, 11 months ago
CC:
blink-reviews, krit, kojih, arv+blink, jsbell+bindings_chromium.org, pdr, sof, rwlbuis, tommyw+watchlist_chromium.org, abarth-chromium, aandrey+blink_chromium.org, marja+watch_chromium.org, dglazkov+blink, Rik, f(malita), adamk+blink_chromium.org, Stephen Chennney, Nate Chapin, watchdog-blink-watchlist_google.com, Inactive
Visibility:
Public.

Description

Add null-correctness checking to [StrictTypeChecking] methods As part of the SVG bindings rewrite, we'd like [StrictTypeChecking] on a method to verify null-correctness (i.e., throw an error if null is passed to a non-nullable parameter), so that we don't need to have this code in Blink. This changes the CG to add this check, replacing isUndefinedOrNull(...) with ...->isUndefined() for non-nullable parameters. This is a conservative change: only SVG generated bindings are changed (per Kouhei): *no* changes to non-SVG generated bindings. This is done by explicitly marking existing interface type parameters of [StrictTypeChecking] methods as nullable, matching the actual behavior. (SVG test expectations are updated, since there are some tests for null values currently, which are now caught by bindings, not Blink.) Outside of SVG, there are only 4 IDL files that have [StrictTypeChecking] on methods: * RTCPeerConnection * OESVertexArrayObject * WebGLDebugShaders * WebGLRenderingContext The first 3 only have 1-3 methods with [StrictTypeChecking]. The last one, WebGLRenderingContext, uses [StrictTypeChecking] on all its methods, and further, 4 methods have parameters marked as nullable: bufferData, bufferSubData, texImage2D, texSubImage2D, but this currently does nothing. 8 SVG IDLs files have [StrictTypeChecking] on methods; these will be handled by Kouhei during the rewrite, and per Kouhei, it's ok for them to add null checks. I'll followup with developers of the individual interfaces to ask them to verify null-correctness. Also: * There are also 2 interface type attributes with [StrictTypeChecking], but changing these to nullable would require Blink changes, so I'll do those in a separate CL. * Add support for nullable interface type attributes to Python CG (just a .release()) BUG=249598 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=165306

Patch Set 1 #

Total comments: 15

Patch Set 2 : Unmodify SVG idls #

Patch Set 3 : Unmodify SVG idls #

Patch Set 4 : Update SVG test expectations #

Patch Set 5 : Last test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+165 lines, -101 lines) Patch
M LayoutTests/svg/custom/polyline-points-crash-expected.txt View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M LayoutTests/svg/dom/SVGLengthList-basics-expected.txt View 1 2 3 4 chunks +4 lines, -4 lines 0 comments Download
M LayoutTests/svg/dom/SVGNumberList-basics-expected.txt View 1 2 3 4 chunks +4 lines, -4 lines 0 comments Download
M LayoutTests/svg/dom/SVGPointList-basics-expected.txt View 1 2 3 2 chunks +3 lines, -3 lines 0 comments Download
M LayoutTests/svg/dom/SVGTransformList-basics-expected.txt View 1 2 3 4 chunks +4 lines, -4 lines 0 comments Download
M LayoutTests/svg/dom/SVGTransformList-expected.txt View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M LayoutTests/svg/dom/svglist-exception-on-out-bounds-error-expected.txt View 1 2 3 4 1 chunk +12 lines, -12 lines 0 comments Download
M Source/bindings/scripts/code_generator_v8.pm View 1 chunk +2 lines, -1 line 0 comments Download
M Source/bindings/scripts/unstable/v8_attributes.py View 1 chunk +5 lines, -1 line 0 comments Download
M Source/bindings/templates/methods.cpp View 1 chunk +1 line, -1 line 0 comments Download
M Source/bindings/tests/idls/TestObjectPython.idl View 2 chunks +2 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestObjectPython.cpp View 5 chunks +58 lines, -1 line 0 comments Download
M Source/bindings/tests/results/V8TestSVG.cpp View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/canvas/OESVertexArrayObject.idl View 1 chunk +3 lines, -3 lines 0 comments Download
M Source/core/html/canvas/WebGLDebugShaders.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/canvas/WebGLRenderingContext.idl View 6 chunks +61 lines, -61 lines 0 comments Download
M Source/modules/mediastream/RTCPeerConnection.idl View 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 14 (0 generated)
Nils Barth (inactive)
Here's the null-correctness for methods CL. This is actually [StrictTypeChecking] on the *method*, not on ...
6 years, 11 months ago (2014-01-17 03:44:43 UTC) #1
haraken
Thanks for working on this complicated problem. Nullability is completely broken in both the spec ...
6 years, 11 months ago (2014-01-17 03:56:06 UTC) #2
kouhei (in TOK)
Thanks for doing this! Please remove ? from all SVG idls. https://codereview.chromium.org/141523002/diff/1/Source/core/svg/SVGLengthList.idl File Source/core/svg/SVGLengthList.idl (right): ...
6 years, 11 months ago (2014-01-17 04:28:44 UTC) #3
Nils Barth (inactive)
On 2014/01/17 03:56:06, haraken wrote: > Thanks for working on this complicated problem. > > ...
6 years, 11 months ago (2014-01-17 04:58:54 UTC) #4
Nils Barth (inactive)
On 2014/01/17 04:28:44, kouhei wrote: > Thanks for doing this! n/p > Please remove ? ...
6 years, 11 months ago (2014-01-17 04:59:39 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/nbarth@chromium.org/141523002/140001
6 years, 11 months ago (2014-01-17 05:05:34 UTC) #6
commit-bot: I haz the power
Retried try job too often on linux_blink_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_blink_rel&number=17891
6 years, 11 months ago (2014-01-17 05:35:19 UTC) #7
kouhei (in TOK)
On 2014/01/17 05:35:19, I haz the power (commit-bot) wrote: > Retried try job too often ...
6 years, 11 months ago (2014-01-17 05:37:10 UTC) #8
kouhei (in TOK)
According to test failure messages, I think you can just rebaseline the testexps.
6 years, 11 months ago (2014-01-17 06:46:09 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/nbarth@chromium.org/141523002/260001
6 years, 11 months ago (2014-01-17 07:12:21 UTC) #10
Nils Barth (inactive)
On 2014/01/17 06:46:09, kouhei wrote: > According to test failure messages, I think you can ...
6 years, 11 months ago (2014-01-17 07:12:32 UTC) #11
commit-bot: I haz the power
Retried try job too often on linux_blink_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_blink_rel&number=17932
6 years, 11 months ago (2014-01-17 08:35:05 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/nbarth@chromium.org/141523002/380001
6 years, 11 months ago (2014-01-17 10:13:12 UTC) #13
commit-bot: I haz the power
6 years, 11 months ago (2014-01-17 11:59:06 UTC) #14
Message was sent while issue was closed.
Change committed as 165306

Powered by Google App Engine
This is Rietveld 408576698