diff --git a/index.bs b/index.bs index 8119dc40..d3c6ea2b 100644 --- a/index.bs +++ b/index.bs @@ -848,7 +848,6 @@ The powerPreference opt 1. Let |global| be [=this=]'s [=relevant global object=]. 1. Let |realm| be [=this=]'s [=relevant realm=]. 1. If |global|'s [=associated Document=] is not [=allowed to use=] the [=webnn-feature|webnn=] feature, return [=a new promise=] in |realm| [=rejected=] with a "{{SecurityError}}" {{DOMException}}. - 1. Let |realm| be [=this=]'s [=relevant realm=]. 1. Let |promise| be [=a new promise=] in |realm|. 1. Run the following steps [=in parallel=]. 1. Let |context| be the result of [=creating a context=] given |realm| and |options|. If that returns failure, then [=queue an ML task=] with |global| to [=reject=] |promise| with a "{{NotSupportedError}}" {{DOMException}} and abort these steps. @@ -1282,8 +1281,7 @@ The context lost steps for {{MLContext}} |context|, are: To lose {{MLContext}} |context| with {{DOMString}} |message|: - 1. Let |realm| be |context|'s [=relevant realm=]. - 1. Let |info| be a new {{MLContextLostInfo}} in |realm|. + 1. Let |info| be a new {{MLContextLostInfo}}. 1. Set |info|.{{MLContextLostInfo/message}} to |message|. 1. [=Resolve=] |context|.{{MLContext/[[lost]]}} with |info|. 1. For each {{MLGraph}} |graph| where |graph|.{{MLGraph/[[context]]}} equals [=this=]: @@ -1823,7 +1821,6 @@ Build a composed graph up to a given output operand into a computational graph a 1. [=list/For each=] |input| of |operand|.{{MLOperand/[[operator]]}}'s [=operator/inputs=]: 1. [=queue/Enqueue=] |input| to |queue|. 1. Let |global| be [=this=]'s [=relevant global object=]. - 1. Let |realm| be [=this=]'s [=relevant realm=]. 1. Let |graph| be a new {{MLGraph}} in |realm|. 1. Set |graph|.{{MLGraph/[[context]]}} to [=this=].{{MLGraphBuilder/[[context]]}}. 1. Set |graph|.{{MLGraph/[[isDestroyed]]}} to false. diff --git a/tools/lint.mjs b/tools/lint.mjs index fbe516df..73e1845a 100755 --- a/tools/lint.mjs +++ b/tools/lint.mjs @@ -341,6 +341,9 @@ for (const match of source.matchAll(/\|(\w+)\|\.{{(\w+)\/.*?}}/g)) { }); } +// TODO: Generate this from the IDL itself. +const dictionaries = ['MLOperandDescriptor', 'MLContextLostInfo']; + // Ensure JS objects are created with explicit realm for (const match of text.matchAll(/ a new promise\b(?! in realm)/g)) { error(`Promise creation must specify realm: ${format(match)}`); @@ -348,7 +351,7 @@ for (const match of text.matchAll(/ a new promise\b(?! in realm)/g)) { for (const match of text.matchAll(/ be a new ([A-Z]\w+)\b(?! in realm)/g)) { const type = match[1]; // Dictionaries are just maps, so they don't need a realm. - if (type === 'MLOperandDescriptor') + if (dictionaries.includes(type)) continue; error(`Object creation must specify realm: ${format(match)}`); }