Re: [heycam/webidl] Added a definition of {{StringContext}} extended attribute. (#841)

bzbarsky requested changes on this pull request.



> @@ -10496,6 +10504,40 @@ that does specify [{{SecureContext}}].
     </pre>
 </div>
 
+<h4 id="StringContext" extended-attribute lt="StringContext">[StringContext]</h4>
+
+If the [{{StringContext}}] [=extended attribute=] appears on {{DOMString}} or {{USVString}}, it
+modifies how the value is converted to the IDL type, causing additional value validation to
+adhere to the context the string is used in.
+
+The [{{StringContext}}] extended attribute must [=takes an identifier|take an identifier=]. The [=identifier=]
+must be one of "<code>html</code>", "<code>script-url</code>" and "<code>script</code>".
+
+A type annotated with the [{{StringContext}}] extended attribute must not appear in a construct
+that is not a [=regular attribute=] or a [=regular operation=]. A type annotated with the [{{StringContext}}]

OK, reading this more carefully, I don't understand what this means.  Is `void foo(sequence<[StringContext=html] DOMString>);` ok?  Why or why not?  What does "construct" even mean here?

What about a record?  A dictionary argument?  A union?  Is a dictionary a "separate construct" while a record is not, just because a dictionary has a separate IDL definition while a record or union is inferred?  Or are they both "separate constructs"?  But my impression was that you wanted to allow this new thing inside unions, which are just as "separate construct" as records.  Or is that out of date and the intent is to limit this thing to types of attributes and operation arguments?  If so, that seems like the right thing to say explicitly.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/pull/841#pullrequestreview-358746700

Received on Friday, 14 February 2020 07:15:15 UTC