Skip to content

Check inherited interfaces exist - #10240

Merged
lukebjerring merged 2 commits into
web-platform-tests:masterfrom
lukebjerring:idlharness-base-interfaces
Mar 29, 2018
Merged

lukebjerring merged 2 commits into
web-platform-tests:masterfrom
lukebjerring:idlharness-base-interfaces

Conversation

@lukebjerring

@lukebjerring lukebjerring commented Mar 29, 2018 •

Copy link
Copy Markdown
Contributor

Ensures that B exists if you add_[untested_]idl('interface A : B {};')
See https://www.w3.org/TR/WebIDL-1/#idl-interfaces for definition of interface inheritance.

Fixes #10214

Note:
Side-stepping the Cannot read property 'has_extended_attribute' of undefined message at its source would involve non-null checks in several places (e.g. l1318, l1524, ...).
This change is consistent with the other early existence checks, and is a fail-fast (before testing each member), which is likely to change the number of executed tests for any IDL tests which have undefined inherits.


This change is Reviewable

@lukebjerring

Copy link
Copy Markdown
Contributor Author

#9853 is an example of test output which, before this change, wasn't obvious which missing interface caused the problem.

@ghost

ghost commented Mar 29, 2018 •

Copy link
Copy Markdown

Build PASSED

Started: 2018-03-29 17:57:53
Finished: 2018-03-29 18:04:33

View more information about this build on:

@foolip foolip left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More tests for idlharness.js, yay! LGTM % nit.

Comment thread resources/idlharness.js Outdated
this["includes"] = {};

// Assert B defined for A : B
for (var member of Array.from(Object.values(this.members)).filter(m => m.base)) {

@foolip foolip Mar 29, 2018 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object.values already returns a vanilla Array, so the Array.from ought not be needed.

Comment thread resources/idlharness.js
}
if (e.message !== error) {
throw new IdlHarnessError(`${idlArrayFunc} threw ${e}, not the expected IdlHarnessError`);
throw new IdlHarnessError(`${idlArrayFunc} threw "${e}", not the expected IdlHarnessError "${error}"`);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you mention this drive-by fixing in the commit message when merging? Changes themselves look good!

@lukebjerring
lukebjerring merged commit 3adbaa2 into web-platform-tests:master Mar 29, 2018
@lukebjerring
lukebjerring deleted the idlharness-base-interfaces branch March 29, 2018 18:35
@lukebjerring
lukebjerring restored the idlharness-base-interfaces branch March 30, 2018 22:03
@foolip

foolip commented Mar 30, 2018

Copy link
Copy Markdown
Member

lukebjerring added a commit to lukebjerring/wpt that referenced this pull request Mar 30, 2018
@foolip

foolip commented Mar 30, 2018

Copy link
Copy Markdown
Member

Since reverting this won't break anything and a fix would require review, I'll go ahead and revert. This would be the "Breakage in browser repos like Chromium which import wpt" case in #9953.

foolip added a commit that referenced this pull request Mar 30, 2018
foolip pushed a commit that referenced this pull request Mar 30, 2018
@inexorabletash

Copy link
Copy Markdown
Contributor

+1 to revert.

FWIW, I did some testing with a local fix:

         if (!(lhs in this.members)) throw new IdlHarnessError(`${lhs} inherits ${rhs}, but ${lhs} is undefined.`);
-        if (!(this.members[lhs] instanceof IdlInterface)) throw new IdlHarnessError(`${lhs} inherits ${rhs}, but ${lhs} is not an interface.`);
         if (!(rhs in this.members)) throw new IdlHarnessError(`${lhs} inherits ${rhs}, but ${rhs} is undefined.`);
-        if (!(this.members[rhs] instanceof IdlInterface)) throw new IdlHarnessError(`${lhs} inherits ${rhs}, but ${rhs} is not an interface.`);
+        let lhs_is_interface = this.members[lhs] instanceof IdlInterface;
+        let rhs_is_interface = this.members[rhs] instanceof IdlInterface;
+        if (rhs_is_interface != lhs_is_interface) {
+            if (!lhs_is_interface) throw new IdlHarnessError(`${lhs} inherits ${rhs}, but ${lhs} is not an interface.`);
+            if (!rhs_is_interface) throw new IdlHarnessError(`${lhs} inherits ${rhs}, but ${rhs} is not an interface.`);
+        }

... and there are a handful of interface tests that do have LHS with an undefined RHS (e.g. object "GamepadEventInit inherits EventInit, but EventInit is undefined.") so when a corrected version relands we will still see some real failures. (Which is a good thing!)

@foolip

foolip commented Mar 30, 2018

Copy link
Copy Markdown
Member

Landing this change in Chromium and exporting might be easier, tells us right away which tests will be affected.

@lukebjerring

Copy link
Copy Markdown
Contributor Author

I'll take the local fix and go via Chromium.

P.S. didn't know github supported diffs. Cool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants