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
  • Loading branch information
yiyix authored and chromium-wpt-export-bot committed Apr 9, 2020
1 parent a6b1cb6 commit 60492b3
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 60492b3

Please sign in to comment.