Skip to content

Commit

Permalink
Don't test namespaces in idlharness if not exposed
Browse files Browse the repository at this point in the history
Instead, if a namespace is not exposed, test that there is no global
property of that name, similar to what we do with interfaces.
  • Loading branch information
ptomato authored and Ms2ger committed Nov 26, 2024
1 parent 524e1e0 commit 4998019
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
13 changes: 12 additions & 1 deletion resources/idlharness.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ IdlArray.prototype.test = function()

Object.getOwnPropertyNames(this.members).forEach(function(memberName) {
var member = this.members[memberName];
if (!(member instanceof IdlInterface)) {
if (!(member instanceof IdlInterface || member instanceof IdlNamespace)) {
return;
}

Expand Down Expand Up @@ -3451,6 +3451,17 @@ IdlNamespace.prototype.test_self = function ()

IdlNamespace.prototype.test = function ()
{
// If the namespace object is not exposed, only test that. Members can't be
// tested either
if (!this.exposed) {
if (!this.untested) {
subsetTestByKey(this.name, test, function() {
assert_false(this.name in self, this.name + " namespace should not exist");
}.bind(this), this.name + " namespace: existence and properties of namespace object");
}
return;
}

if (!this.untested) {
this.test_self();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@
namespace baz {
DOMString LongStory(any hero, DOMString... details);
DOMString ShortStory(DOMString... details);
};`);
};
[Exposed=Worker]
namespace Absent {
undefined Lies();
};
`);
idlArray.test();
</script>
<script type="text/json" id="expected">
Expand Down Expand Up @@ -233,6 +238,12 @@
"status_string": "PASS",
"properties": {},
"message": null
},
{
"name": "Absent namespace: existence and properties of namespace object",
"status_string": "PASS",
"properties": {},
"message": null
}
],
"type": "complete"
Expand Down

0 comments on commit 4998019

Please sign in to comment.