Commit c53a40f4 authored by Yi Xu's avatar Yi Xu Committed by Commit Bot

Update size.attributes.parse.trailingjunk

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/+/2142746Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Commit-Queue: Yi Xu <yiyix@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757945}
parent 007b626e
This is a testharness.js-based test.
FAIL Parsing of non-negative integers Failed to set the 'width' property on 'OffscreenCanvas': Value is not of type 'unsigned long'.
Harness: the test ran to completion.
......@@ -20,10 +20,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();
});
......
......@@ -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();
});
......
......@@ -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"]
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment