Commit ae13ec53 authored by Luke Bjerring's avatar Luke Bjerring Committed by Commit Bot

[idlharness.js] Improve error msg for invalid objects.

Note that this is not a functional change; it just helps authors of idlharness tests identify what's gone wrong if they have incorrect add_objects params.
testharness.js drops the stack for thrown errors and prints a (useless) new stack.

Change-Id: I6dd90c461f0ab58e57978a28e3e5e9eb366a4827
Reviewed-on: https://chromium-review.googlesource.com/1104311
Commit-Queue: Philip Jägenstedt <foolip@chromium.org>
Reviewed-by: default avatarPhilip Jägenstedt <foolip@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568803}
parent 5cc85545
...@@ -821,8 +821,15 @@ IdlArray.prototype.test = function() ...@@ -821,8 +821,15 @@ IdlArray.prototype.test = function()
this.members[name].test(); this.members[name].test();
if (name in this.objects) if (name in this.objects)
{ {
this.objects[name].forEach(function(str) const objects = this.objects[name];
if (!objects || !Array.isArray(objects)) {
throw new IdlHarnessError(`Invalid or empty objects for member ${name}`);
}
objects.forEach(function(str)
{ {
if (!this.members[name] || !(this.members[name] instanceof IdlInterface)) {
throw new IdlHarnessError(`Invalid object member name ${name}`);
}
this.members[name].test_object(str); this.members[name].test_object(str);
}.bind(this)); }.bind(this));
} }
......
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