Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default case for non-member types in assert_type_is #23754

Merged
merged 2 commits into from
May 28, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions resources/idlharness.js
Original file line number Diff line number Diff line change
Expand Up @@ -1209,29 +1209,17 @@ 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":
case "Function":
assert_true(value instanceof self[type], "wrong type: not a " + type);
return;

case "object":
assert_in_array(typeof value, ["object", "function"], "wrong type: not object or function");
return;
}

// This is a catch-all for basic types (e.g. Int8Array). If a type needs
stephenmcgruer marked this conversation as resolved.
Show resolved Hide resolved
// more elaborate checking it should go in the switch statement above.
if (!(type in this.members))
{
throw new IdlHarnessError("Unrecognized type " + type);
assert_true(value instanceof self[type], "wrong type: not a " + type);
return;
}

if (this.members[type] instanceof IdlInterface)
Expand Down