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

Cleanup global object usage to make sense with Documents #254

Merged
merged 8 commits into from
Nov 30, 2017

Conversation

andypaicu
Copy link
Collaborator

@andypaicu andypaicu commented Oct 16, 2017

Documents are not global objects.

Also fixed small random typos here and there.

#208


Preview | Diff

@andypaicu andypaicu requested a review from mikewest October 16, 2017 11:07
index.src.html Outdated
@@ -388,9 +388,13 @@ <h3 id="framework-infrastructure">Infrastructure</h3>

<h3 id="framework-policy">Policies</h3>

A <dfn export lt="csp global object">CSP global object</dfn> is a {{Document}}, {{WorkerGlobalScope}}
Copy link
Member

Choose a reason for hiding this comment

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

Did you consider asking @annevk whether we could add an accessor to Window that would return the Window's Document's CSP list? Or just move the CSP list to Window, because I don't actually remember why it made sense to put it on the document and not the document's global?

If @annevk isn't happy about doing that in HTML, we could certainly define a clever term here along the lines of:

To obtain |object|'s CSP list:

  1. If |object| is a Document, return |object|'s {{Document/CSP list}}.
  2. If |object| is a Window, return |object|'s {{Window/associated Document}}'s {{Document/CSP list}}.
  3. If |object| is a WorkerGlobalScope, return |object|'s {{WorkerGlobalScope/CSP list}}.
  4. If |object| is a WorkletGlobalScope, return |object|'s {{WorkletGlobalScope/CSP list}}.
  5. Return null.

I think I'd prefer to do that instead of inventing a new wrapper concept for CSP.

Copy link
Member

Choose a reason for hiding this comment

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

I suspect it's not associated with Window because of about:blank? I agree that it would be nicer not to introduce a new wrapper concept with global object in its name that's not actually always a global object.

Copy link
Collaborator Author

@andypaicu andypaicu Oct 16, 2017

Choose a reason for hiding this comment

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

Ok, would it be better to follow @mikewest 's suggestion above and add an accessor to the Window object that basically returns the associated document CSP list? That would let us use actual global objects throughout the spec.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, though it seems that's fine to do locally as @mikewest illustrated.

@andypaicu
Copy link
Collaborator Author

I have found time to revisit this. @mikewest @annevk wdyt?

Copy link
Member

@mikewest mikewest left a comment

Choose a reason for hiding this comment

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

LGTM. I don't think this actually changes any behavior, and should be covered by existing tests.

@andypaicu andypaicu merged commit 80bf6a4 into w3c:master Nov 30, 2017
@andypaicu andypaicu deleted the global-context branch November 30, 2017 10:49
april added a commit to april/webappsec-csp that referenced this pull request Jan 17, 2018
* 'master' of https://github.com/w3c/webappsec-csp: (209 commits)
  Fix a few typos (w3c#280)
  Introduce 'prefetch-src'. (w3c#283)
  Clarify navigation behavior for 'script-src'.
  Incorrect indentation of the navigation check algorithm.
  IDL amendments and small misc issues. (w3c#271)
  Regenerate HTMLs.
  Origin link.
  NoncedElement link.
  link up inline css issue (w3c#228)
  Replaced 'alias' with 'copy' for less ambiguity (w3c#273)
  Cleanup `global object` usage to make sense with `Documents` (w3c#254)
  Elements with duplicated attributes are not nonceable.
  s/not-example.com/example.org/
  Linked testing policy and fixed a few links (w3c#263)
  Rebuild HTML.
  Fix linking errors to 'script-like' and 'applet'.
  Adds WorkletGlobalScope as a concept to CSP. (w3c#205)
  Slight correction of host matching description (w3c#251)
  Fixed ambigous grammar (w3c#250)
  Replace Request.type based logic with Request.destination (w3c#231)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants