From cd0f0ca1e535a4f5fe4967eb697d3f32ed992070 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Wed, 12 Jun 2024 15:01:28 +0200 Subject: [PATCH] Remove StringContext attribute (#498) Swap to using a union type and updating the algorithms directly. --- spec/index.bs | 44 -------------------------------------------- 1 file changed, 44 deletions(-) diff --git a/spec/index.bs b/spec/index.bs index e6d4e8f..8ebc5f5 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -1128,18 +1128,9 @@ Issue: The [=event handler content attribute=] concept used below is ambiguous. # Integrations # {#integrations}
-typedef [StringContext=TrustedHTML] DOMString HTMLString;
-typedef [StringContext=TrustedScript] DOMString ScriptString;
-typedef [StringContext=TrustedScriptURL] USVString ScriptURLString;
 typedef (TrustedHTML or TrustedScript or TrustedScriptURL) TrustedType;
 
-## Integration with WebIDL ## {#webidl-integration} - -

[StringContext]

- -Issue: See [https://github.com/whatwg/webidl/pull/1392](https://github.com/whatwg/webidl/pull/1392). - ## Integration with HTML ## {#integration-with-html} {{Window}} and {{Worker}} objects have a trusted type policy factory, @@ -1278,41 +1269,6 @@ abstract operation. User agents must use the following implementation: 1. If |argument| is a {{TrustedScript}} object, return the value of its associated [=TrustedScript/data=]. 1. Return ~unknown~. -### Validate the string in context ### {#html-validate-the-string-in-context} - -This specification defines the validate the string in context algorithm in [[html#integration-with-idl]]. - -When validate the string in context is invoked, with |platformObject|, |value|, |stringContext|, and |identifier| run these steps: - - 1. If |platformObject|'s [=relevant global object=] has a [=Window/trusted type policy factory=]: - - 1. Set |sink| to the result of [=concatenating=] the list « |platformObject|'s identifier, |identifier| » with `" "` as |separator|. -
- For example, the following annotation and JavaScript code: -
-        typedef [StringContext=TrustedHTML] DOMString HTMLString;
-        [ Exposed=Window, HTMLConstructor] interface HTMLIFrameElement : HTMLElement {
-            attribute HTMLString srcdoc;
-        };
-        
-
-        document.createElement('iframe').srcdoc = foo;
-        document.createElement('iframe').setAttribute('SRCdoc', foo);
-        
- causes the |sink| value to be `"HTMLIFrameElement srcdoc"`. -
- 1. Set |value| to the result of running the [$Get Trusted Type compliant string$] algorithm, passing the following arguments: - * |value| as |input|, - * |stringContext| as |expectedType|, - * |sink| as |sink|, - * `'script'` as |sinkGroup|, - * |platformObject|'s [=relevant global object=] as |global|. - - Issue: Remove hardcoding 'script' when new sink groups are specified. - - 1. If an exception was thrown, rethrow exception and abort further steps. - 1. Return |value|. - ## Integration with DOM ## {#integration-with-dom} Note: See [https://github.com/whatwg/dom/pull/1258](https://github.com/whatwg/dom/pull/1258) and [https://github.com/whatwg/dom/pull/1268](https://github.com/whatwg/dom/pull/1268) which upstream this integration.