Skip to content

[css-syntax-3][css-values-3][css-cascade-4][css-fonts-4] Formalize fetching and resource timing reporting #6715

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

Merged
merged 14 commits into from
Nov 3, 2021
Merged
Prev Previous commit
Next Next commit
Nits
  • Loading branch information
noamr committed Oct 11, 2021
commit 34002f2c23a8a08200c35a8abd2df151954aa4c7
21 changes: 11 additions & 10 deletions css-cascade-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,16 @@ Processing Stylesheet Imports</h3>
1. Let |parentStylesheet| be |rule|'s <a spec=cssom for=CSSRule>parent CSS style sheet</a>.
[[CSSOM]]

1. If |rule| has a <<supports-condition>>,
2. If |rule| has a <<supports-condition>>,
and that condition is not true,
return.

1. Let |parsedUrl| be the result of the [=URL parser=] steps with |relativeUrl| and
|parentStylesheet|'s <a spec=cssom>location</a>. If the algorithm returns an error,
3. Let |parsedUrl| be the result of the [=URL parser=] steps with |rule|'s URL and
|parentStylesheet|'s <a spec=cssom>location</a>.
If the algorithm returns an error,
return. [[CSSOM]]

1. [=Fetch a style resource=] from |parsedUrl|,
4. [=Fetch a style resource=] from |parsedUrl|,
with stylesheet |parentStylesheet|,
destination "style",
CORS mode "no-cors",
Expand All @@ -285,24 +286,24 @@ Processing Stylesheet Imports</h3>
1. If |response| is a [=network error=] or its [=response/status=] is not an
[=ok status=], return.

1. If |parentStylesheet| is in [=quirks mode=]
2. If |parentStylesheet| is in [=quirks mode=]
and |response| is [=CORS-same-origin=],
let |content type| be <code>"text/css"</code>.
Otherwise, let |content type| be the Content Type metadata of |response|.

1. If |content type| is not <code>"text/css"</code>,
3. If |content type| is not <code>"text/css"</code>,
return.

1. Let |importedStylesheet| be the result of [=Parse a stylesheet|parsing=] |response|'s
4. Let |importedStylesheet| be the result of [=Parse a stylesheet|parsing=] |response|'s
[=response/body=]'s [=body/stream=] given |parsedUrl|.

1. Set |importedStylesheet|'s <a spec=cssom>origin-clean flag</a> to
5. Set |importedStylesheet|'s <a spec=cssom>origin-clean flag</a> to
|parentStylesheet|'s <a spec=cssom>origin-clean flag</a>.

1. If |response| is not [=CORS-same-origin=], unset |importedStylesheet|'s
6. If |response| is not [=CORS-same-origin=], unset |importedStylesheet|'s
<a spec=cssom>origin-clean flag</a>.

1. Set |rule|'s {{CSSImportRule/styleSheet}} to |importedStylesheet|.
7. Set |rule|'s {{CSSImportRule/styleSheet}} to |importedStylesheet|.
</div>

<h3 id='content-type'>
Expand Down
22 changes: 11 additions & 11 deletions css-values-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1001,36 +1001,36 @@ URL processing model</h4>

1. Let |environmentSettings| be |sheet|'s [=relevant settings object=].

1. Let |global| be |environmentSettings|'s [=environment settings object/global object=].
2. Let |global| be |environmentSettings|'s [=environment settings object/global object=].

1. Let |documentBase| be |environmentSettings|'s [=API base URL=].
3. Let |documentBase| be |environmentSettings|'s [=API base URL=].

1. Let |base| be |sheet|'s <a spec=cssom>stylesheet base URL</a>. [[CSSOM]]
4. Let |base| be |sheet|'s <a spec=cssom>stylesheet base URL</a>. [[CSSOM]]

1. Let |referrer| be |documentBase|.
5. Let |referrer| be |documentBase|.

1. Let |handleResourceFetchDone| be to do nothing.
6. Let |handleResourceFetchDone| be to do nothing.

1. If |base| is null, set |base| to |documentBase|.
7. If |base| is null, set |base| to |documentBase|.

1. Let |parsedUrl| be the result of the [=URL parser=] steps with |url| and |base|.
8. Let |parsedUrl| be the result of the [=URL parser=] steps with |url| and |base|.
If the algorithm returns an error, return.

1. If |corsMode| is "cors", set |referrer| to |sheet|'s
9. If |corsMode| is "cors", set |referrer| to |sheet|'s
<a spec=cssom>location</a>. [[CSSOM]]

1. Let |req| be a new [=/request=] whose [=request/url=] is |parsedUrl|, whose
10. Let |req| be a new [=/request=] whose [=request/url=] is |parsedUrl|, whose
[=request/destination=] is |destination|, [=request/mode=] is |mode|, [=request/origin=]
is |environmentSettings|'s [=environment settings object/origin=],
[=request/credentials mode=] is "same-origin", [=request/use-url-credentials flag=] is
set, and whose [=request/header list=] is a [=/header list=] containing a [=header=]
with its [=header/name=] set to "referrer" and its [=header/value=] set to |referrer|.
Copy link
Member

Choose a reason for hiding this comment

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

This is somewhat wrong. You want to set the referrer field on the request. That will set the Referer (note, one r less) header. But good that it sets it explicitly though as CSS cannot take it from the global.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, fixed.


1. If |sheet|'s <a spec=cssom>origin-clean flag</a> is set, set |handleResourceFetchDone|
11. If |sheet|'s <a spec=cssom>origin-clean flag</a> is set, set |handleResourceFetchDone|
given [=/response=] |res| to [=finalize and report timing=] with |res|, |global|, and
<code>"css"</code>. [[CSSOM]]

1. [=/Fetch=] |req|, with |processResponseDone| set to |handleResourceFetchDone|,
12. [=/Fetch=] |req|, with |processResponseDone| set to |handleResourceFetchDone|,
|taskDestination| set to |global|, and |processResponse| set to |processResponse|.
</div>

Expand Down