Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"timer initialization steps" perform EnsureCSPDoesNotBlockStringCompilation with undefined timer value #10824

Open
fred-wang opened this issue Dec 5, 2024 · 8 comments
Labels
clarification Standard could be clearer

Comments

@fred-wang
Copy link
Contributor

What is the issue with the HTML Standard?

cc @lukewarlow @koto @nicolo-ribaudo

See https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval

Step 9.6.3 reads

Perform EnsureCSPDoesNotBlockStringCompilation(realm, « », handler, handler, timer, « », handler). If this throws an exception, catch it, report it for global, and abort these steps.

but timer is not defined in previous steps.

It seems https://w3c.github.io/webappsec-csp/#can-compile-strings instead expects the value "TIMER".

(Note that function is also called from https://html.spec.whatwg.org/multipage/webappapis.html#hostensurecancompilestrings(realm,-parameterstrings,-bodystring,-codestring,-compilationtype,-parameterargs,-bodyarg), which passes the enum value from https://tc39.es/proposal-dynamic-code-brand-checks/#sec-hostensurecancompilestrings)

@lukewarlow
Copy link
Member

This was decided as the format to use when I was upstreaming changes. There's no consistency with how enum values are written at the minute.

@domenic
Copy link
Member

domenic commented Dec 6, 2024

I would indeed prefer to match ES's formatting and use "TIMER". I guess we should do all the enums at once though.

It'd be even better if we could link to the definitions of the enum values in the ES spec, but I don't know if they have proper <dfn>s.

@domenic domenic added the clarification Standard could be clearer label Dec 6, 2024
@annevk
Copy link
Member

annevk commented Dec 6, 2024

I did look at this when reviewing, but the problem is that they use <emu-const> with text-transform: uppercase. We would have to do something evuivalent so you get the same experience/semantics.

@domenic
Copy link
Member

domenic commented Dec 6, 2024

I'm not sure the semantics/experience is significantly different... the end effect that, e.g., AT or users see, is just the uppercase text. And it's not clear there's any "semantics" being conveyed by the implementation choice they've made.

@annevk
Copy link
Member

annevk commented Dec 6, 2024

Depending on what browser you copy from, you might get lowercase or uppercase text, for instance. If they change their style sheet, this could also change.

@syg @ljharb thoughts on what we should do? Perhaps ECMAScript shouldn't use text-transform for this?

@syg
Copy link
Contributor

syg commented Dec 6, 2024

I guess I'd be fine with actually typing uppercase. Looping in other 262 editors @bakkot and @michaelficarra.

@bakkot
Copy link
Contributor

bakkot commented Dec 6, 2024

I forget why we decided to use a text transform instead of just making it actually uppercase to begin with. I'm fine with changing the source if there's not a compelling reason not to.

Re: copying, we're considering having ecmarkup add some hidden text with tildes so these values would copy as ~timer~, though that's mostly for the convenience of people copying algorithm steps into comments in tests or implementations.

@michaelficarra
Copy link
Contributor

We only did it as a CSS text-transform because we were playing around with other possible presentations before we settled on that. I don't really like changing the case in the ECMA-262 document since it's entirely presentational (non-semantic) and it will make existing instances of copy/paste into comments and other places stale. For the HTML spec document, I would probably match 262, personally: all lowercase in the document and text-transform: uppercase in the CSS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer
Development

No branches or pull requests

7 participants