Skip to content

Commit

Permalink
Update size.attributes.parse.trailingjunk
Browse files Browse the repository at this point in the history
Fix size.attributes.parse.trailingjunk to match spec:
offscreenCanvas.width = '100#!?' should shrow TypeError because 100#!?
is NaN.

Bug: 1067639
Change-Id: I5b9798cfb7d4f7ecfc77854fd1431c1df89f84a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2142746
Reviewed-by: Fernando Serboncini <fserb@chromium.org>
Commit-Queue: Yi Xu <yiyix@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757945}
  • Loading branch information
yiyix authored and chromium-wpt-export-bot committed Apr 9, 2020
1 parent ec2ef02 commit b2831bd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ <h1>size.attributes.parse.trailingjunk</h1>
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');

offscreenCanvas.width = '100#!?';
offscreenCanvas.height = '100#!?';
_assertSame(offscreenCanvas.width, 100, "offscreenCanvas.width", "100");
_assertSame(offscreenCanvas.height, 100, "offscreenCanvas.height", "100");
assert_throws_js(TypeError, function() { offscreenCanvas.width = '100#!?'; });
t.done();

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');

offscreenCanvas.width = '100#!?';
offscreenCanvas.height = '100#!?';
_assertSame(offscreenCanvas.width, 100, "offscreenCanvas.width", "100");
_assertSame(offscreenCanvas.height, 100, "offscreenCanvas.height", "100");
assert_throws_js(TypeError, function() { offscreenCanvas.width = '100#!?'; });
t.done();

});
Expand Down
5 changes: 4 additions & 1 deletion offscreen-canvas/tools/tests2d.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9791,7 +9791,7 @@
("percent", "100%", 100),
("em", "100em", 100),
("junk", "#!?", None),
("trailingjunk", "100#!?", 100),
("trailingjunk", "100#!?", "exception"),
]
def gen(name, string, exp, code):
testing = ["size.nonnegativeinteger"]
Expand All @@ -9800,6 +9800,9 @@
code += "offscreenCanvas.width = '%s';\noffscreenCanvas.height = '%s';\n" % (string, string)
code += "@assert offscreenCanvas.width === 100;\n@assert offscreenCanvas.height === 50;\n"
expected = None
elif exp == "exception":
code += "@assert throws TypeError offscreenCanvas.width = '%s';\n" % string
expected = None
else:
code += "offscreenCanvas.width = '%s';\noffscreenCanvas.height = '%s';\n" % (string, string)
code += "@assert offscreenCanvas.width === %s;\n@assert offscreenCanvas.height === %s;\n" % (exp, exp)
Expand Down

0 comments on commit b2831bd

Please sign in to comment.