Skip to content

Commit

Permalink
Fix idlharness.js' handling of Float(32/64)Array types
Browse files Browse the repository at this point in the history
idlharness.js does not seem to correctly handle Float32Array and
Float64Array types. When an interface uses such types, the tests will
fail with the exception thrown from idlharness.js:1221:
`throw new IdlHarnessError("Unrecognized type " + type);`

The fix is to teach idlharness.js how to handle Float(32/64)Array types,
and, while at it, to teach it to handle other typed arrays.

Bug: 1074548
Change-Id: I549f6ae1ea13590207bd4f49b94439ad2a43a13d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2172163
Reviewed-by: Joshua Bell <[email protected]>
Reviewed-by: Alexander Cooper <[email protected]>
Commit-Queue: Piotr Bialecki <[email protected]>
Cr-Commit-Position: refs/heads/master@{#764058}
  • Loading branch information
bialpio authored and chromium-wpt-export-bot committed Apr 30, 2020
1 parent 7b52c88 commit 0f39ee6
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions resources/idlharness.js
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ IdlArray.prototype.is_json_type = function(type)
case "Uint32Array":
case "Uint8ClampedArray":
case "Float32Array":
case "Float64Array":
case "ArrayBuffer":
case "DataView":
case "any":
Expand Down Expand Up @@ -1033,6 +1034,13 @@ IdlArray.prototype.assert_type_is = function(value, type)
this.assert_type_is(value, this.members[type.idlType].idlType);
return;
}

if (type.nullable && value === null)
{
// This is fine
return;
}

if (type.union) {
for (var i = 0; i < type.idlType.length; i++) {
try {
Expand Down Expand Up @@ -1066,12 +1074,6 @@ IdlArray.prototype.assert_type_is = function(value, type)
return;
}

if (type.nullable && value === null)
{
// This is fine
return;
}

if (type.array)
{
// TODO: not supported yet
Expand Down Expand Up @@ -1207,8 +1209,18 @@ IdlArray.prototype.assert_type_is = function(value, type)
assert_regexp_match(value, /^([\x00-\ud7ff\ue000-\uffff]|[\ud800-\udbff][\udc00-\udfff])*$/);
return;

case "Int8Array":
case "Int16Array":
case "Int32Array":
case "Uint8Array":
case "Uint16Array":
case "Uint32Array":
case "Uint8ClampedArray":
case "Float32Array":
case "Float64Array":
case "ArrayBuffer":
case "DataView":
assert_equals(typeof value, "DataView");
assert_true(value instanceof self[type], "wrong type: not a " + type);
return;

case "object":
Expand Down

0 comments on commit 0f39ee6

Please sign in to comment.