Skip to content

Commit

Permalink
Drop check on exposure for members
Browse files Browse the repository at this point in the history
See #347 (comment) for context

Update also improves readability of `selfCheck` and fixes check on mixins'
length.
  • Loading branch information
tidoust authored and dontcallmedom committed Apr 14, 2023
1 parent 7fd9d0b commit 40fa23c
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/lib/study-webidl.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const WebIDL2 = require("webidl2");
const getSpecs = list => [...new Set(list.map(({spec}) => spec))];
const specName = spec => spec.shortname ?? spec.url;
const dfnName = dfn => `${dfn.idl.partial ? 'partial ' : ''}${dfn.idl.type} "${dfn.idl.name}"`;
const getExtAttr = (node, name) => node.extAttrs && node.extAttrs.find((attr) => attr.name === name);

const possibleAnomalies = [
"incompatiblePartialIdlExposure",
Expand Down Expand Up @@ -345,8 +344,8 @@ async function studyWebIdl(edResults, curatedResults) {
}

function checkMembers(target, source) {
const selfCheck = !source;
source = source ?? target;
const selfCheck = source === target;
const knownDuplicates = [];
if (!target.idl.members || !source.idl.members) {
return;
Expand Down Expand Up @@ -397,13 +396,6 @@ async function studyWebIdl(edResults, curatedResults) {
break;
}

// Non-overlapping exposure sets are OK. Assume it's OK if either
// member has an [Exposed] extended attribute.
// TODO: check and compare actual Exposed values
if (getExtAttr(targetMember, 'Exposed') || getExtAttr(sourceMember, 'Exposed')) {
continue;
}

// A static operation that has the same identifier as a regular one is OK
if (isAllowedOperationWithSameIdentifier(targetMember, sourceMember)) {
continue;
Expand Down Expand Up @@ -661,7 +653,7 @@ async function studyWebIdl(edResults, curatedResults) {
Object.keys(includesStatements)
.filter(key => key.startsWith(`${name} includes `))
.map(key => dfns[includesStatements[key].idl.includes]?.filter(({idl}) => idl.type === 'interface mixin'))
.filter(mixins => !!mixins && mixins.length > 0)
.filter(mixins => mixins?.length > 0)
.flat();
// Compare members of partials, mixins and main dfn separately to be able
// to report more fine-grained anomalies
Expand Down

0 comments on commit 40fa23c

Please sign in to comment.