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

Adds TrustedTypePolicyFactory #3192

Merged
merged 20 commits into from
Apr 6, 2021
Merged

Conversation

rachelandrew
Copy link
Collaborator

Adds the TrustedTypePolicyFactory interface and subpages.

Spec: https://w3c.github.io/webappsec-trusted-types/dist/spec/#trusted-type-policy-factory

Reviewer: @jpmedley

Joe: the MDN helper returned some odd things for this one and didn't create one page, however the spec matches BCD in terms of which pages should exist. So I've followed that.

@rachelandrew rachelandrew requested a review from jpmedley March 16, 2021 16:08
@rachelandrew rachelandrew requested a review from a team as a code owner March 16, 2021 16:08
Copy link
Collaborator

@jpmedley jpmedley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks generally good. My feedback is a mix of nits and some questions about things I think need to be elaborated on or clarified.

rachelandrew and others added 15 commits March 17, 2021 07:30
@rachelandrew rachelandrew requested a review from jpmedley March 23, 2021 11:29
@rachelandrew
Copy link
Collaborator Author

@jpmedley I had a few comments on some of your comments but the other things are done.


<p class="summary">The <strong><code>createPolicy()</code></strong> method of the {{domxref("TrustedTypePolicyFactory")}} interface creates a {{domxref("TrustedTypePolicy")}} object that implements the rules passed as <code>policyOptions</code>.</p>

<h3 id="Default_policy">The default policy</h3>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate to throw this back at you again, but this needs to have information that aspects of the default policy are non-normative and specific to Chrome. This kind of thing is not unprecedented on MDN. If a normative approach emerges in the future, Chrome will likely be the first to implement it, giving us the chance to update this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand what you want me to do here or where this non-normative information is from that you want me to include. I've searched the spec, for all instances of defaultPolicy, and I seem to have documented this according to the spec.

I also looked at the open issues on the spec: https://github.com/w3c/webappsec-trusted-types/issues

I did note in my original comment on this that I didn't understand your non-normative comment: #3192 (comment)

What aspect are you suggesting is specific to Chrome? Given that only Chromium has implemented I can't test it to find out what other UAs are doing to try and work this out myself.

If you can let me know where you have this Chromium specific info from I'll fold it in :)

Copy link
Collaborator

@jpmedley jpmedley Apr 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://w3c.github.io/webappsec-trusted-types/dist/spec/#default-policy-hdr

  • Somewhere say that the default is currently set in Chrome by creating a policy with the name "default". If another browser implements this differently, they'll have a logical place to document it. If Chrome's current behavior is ratified, we'll be able to remove the word 'Chrome' from the description.
  • Include a disclaimer that this isn't settled in the spec and may change in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in latest commit, though I think that really the same could be said about pretty much any feature only implemented in one engine! Hence my general bemusement.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand your concern. This is a judgement call based on experience with very new APIs. We'll discuss this in our 1:1 this week. Thank you for trusting me.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2021

Preview URLs

Flaws

URL: /en-US/docs/Web/API/TrustedTypePolicyFactory
Title: TrustedTypePolicyFactory
on GitHub

No flaws! 🎉


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/isHTML
Title: TrustedTypePolicyFactory.isHTML()
on GitHub

No flaws! 🎉


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/createPolicy
Title: TrustedTypePolicyFactory.createPolicy()
on GitHub

No flaws! 🎉


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/emptyScript
Title: TrustedTypePolicyFactory.emptyScript
on GitHub

No flaws! 🎉


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/getPropertyType
Title: TrustedTypePolicyFactory.getPropertyType()
on GitHub

No flaws! 🎉


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/defaultPolicy
Title: TrustedTypePolicyFactory.defaultPolicy
on GitHub

No flaws! 🎉


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/isScriptURL
Title: TrustedTypePolicyFactory.isScriptURL()
on GitHub

No flaws! 🎉


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/getAttributeType
Title: TrustedTypePolicyFactory.getAttributeType()
on GitHub

No flaws! 🎉


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/isScript
Title: TrustedTypePolicyFactory.isScript()
on GitHub

No flaws! 🎉


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/emptyHTML
Title: TrustedTypePolicyFactory.emptyHTML
on GitHub

No flaws! 🎉

External URLs

URL: /en-US/docs/Web/API/TrustedTypePolicyFactory
Title: TrustedTypePolicyFactory
on GitHub


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/isHTML
Title: TrustedTypePolicyFactory.isHTML()
on GitHub


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/createPolicy
Title: TrustedTypePolicyFactory.createPolicy()
on GitHub


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/emptyScript
Title: TrustedTypePolicyFactory.emptyScript
on GitHub


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/getPropertyType
Title: TrustedTypePolicyFactory.getPropertyType()
on GitHub


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/defaultPolicy
Title: TrustedTypePolicyFactory.defaultPolicy
on GitHub


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/isScriptURL
Title: TrustedTypePolicyFactory.isScriptURL()
on GitHub


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/getAttributeType
Title: TrustedTypePolicyFactory.getAttributeType()
on GitHub


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/isScript
Title: TrustedTypePolicyFactory.isScript()
on GitHub


URL: /en-US/docs/Web/API/TrustedTypePolicyFactory/emptyHTML
Title: TrustedTypePolicyFactory.emptyHTML
on GitHub

@jpmedley jpmedley merged commit 0494b4a into mdn:main Apr 6, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants