diff options
author | WPT Sync Bot <josh+wptsync@joshmatthews.net> | 2021-09-07 11:16:33 +0000 |
---|---|---|
committer | cybai <cyb.ai.815@gmail.com> | 2022-01-17 16:30:29 +0900 |
commit | 58e8ee674b032274959b4461fd46ceda8f709e96 (patch) | |
tree | 4953c044dba6b52224d5144747af1bc3773a7ebc /tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources | |
parent | 35e95f55a1b9e488d1c796c8fb39d764d090d660 (diff) | |
download | servo-58e8ee674b032274959b4461fd46ceda8f709e96.tar.gz servo-58e8ee674b032274959b4461fd46ceda8f709e96.zip |
Update web-platform-tests to revision b'468d01bbd84da2babf265c6af46947be68713440'
Diffstat (limited to 'tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources')
26 files changed, 150 insertions, 74 deletions
diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/atImported.css b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/atImported.css new file mode 100644 index 00000000000..8629a846d14 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/atImported.css @@ -0,0 +1,3 @@ +#test3b { + background-color: #FF0000; +}
\ No newline at end of file diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/bad-import.css b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/bad-import.css index 796446b525c..a6e1a0f395d 100644 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/bad-import.css +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/bad-import.css @@ -1 +1,4 @@ -@import "basic.css"
\ No newline at end of file +@import "atImported.css"; +#test3 { + background-color:#00FF00; +}
\ No newline at end of file diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/basic-large.css b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/basic-large.css index f5b0db5d6ed..555ab70d2ed 100644 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/basic-large.css +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/basic-large.css @@ -1,4 +1,4 @@ -#test { +#test2 { background-color:red; } diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/basic.css b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/basic.css index 3ea2ef45339..e034ed9ac7c 100644 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/basic.css +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/basic.css @@ -1,3 +1,3 @@ #test { - background-color:red; + background-color: #FF0000; }
\ No newline at end of file diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/bom-utf-16be.css b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/bom-utf-16be.css Binary files differnew file mode 100644 index 00000000000..9e17902a1d3 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/bom-utf-16be.css diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/bom-utf-16le.css b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/bom-utf-16le.css Binary files differnew file mode 100644 index 00000000000..ef90843d8ed --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/bom-utf-16le.css diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/bom-utf-8.css b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/bom-utf-8.css new file mode 100644 index 00000000000..5cf81232b7a --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/bom-utf-8.css @@ -0,0 +1 @@ +div { background-color: blue; }
\ No newline at end of file diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/credentials-iframe.sub.html b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/credentials-iframe.sub.html new file mode 100644 index 00000000000..38868dc95d0 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/credentials-iframe.sub.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<meta charset="utf-8"> + +<script type="module"> + import styleSheet from "./cross-origin.py?id=sameOriginNoneDescendant&origin=http://{{host}}:{{ports[http][0]}}" assert { type: "css" }; + window.sameOriginNoneDescendant = (styleSheet.cssRules[0].cssText.indexOf(".requestHadCookies") !== -1); +</script> +<script type="module" crossOrigin="anonymous"> + import styleSheet from "./cross-origin.py?id=sameOriginAnonymousDescendant&origin=http://{{host}}:{{ports[http][0]}}" assert { type: "css" }; + window.sameOriginAnonymousDescendant = (styleSheet.cssRules[0].cssText.indexOf(".requestHadCookies") !== -1); +</script> +<script type="module" crossOrigin="use-credentials"> + import styleSheet from "./cross-origin.py?id=sameOriginUseCredentialsDescendant&origin=http://{{host}}:{{ports[http][0]}}" assert { type: "css" }; + window.sameOriginUseCredentialsDescendant = (styleSheet.cssRules[0].cssText.indexOf(".requestHadCookies") !== -1); +</script> +<script type="module"> + import styleSheet from "http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/css-module/resources/cross-origin.py?id=crossOriginNoneDescendant&origin=http://{{host}}:{{ports[http][0]}}" assert { type: "css" }; + window.crossOriginNoneDescendant = (styleSheet.cssRules[0].cssText.indexOf(".requestHadCookies") !== -1); +</script> +<script type="module" crossOrigin="anonymous"> + import styleSheet from "http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/css-module/resources/cross-origin.py?id=crossOriginAnonymousDescendant&origin=http://{{host}}:{{ports[http][0]}}" assert { type: "css" }; + window.crossOriginAnonymousDescendant = (styleSheet.cssRules[0].cssText.indexOf(".requestHadCookies") !== -1); +</script> +<script type="module" crossOrigin="use-credentials"> + import styleSheet from "http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/css-module/resources/cross-origin.py?id=crossOriginUseCredentialsDescendant&origin=http://{{host}}:{{ports[http][0]}}" assert { type: "css" }; + window.crossOriginUseCredentialsDescendant = (styleSheet.cssRules[0].cssText.indexOf(".requestHadCookies") !== -1); +</script> + +<script type="text/javascript"> +window.addEventListener('load', event => { + window.parent.postMessage({}, '*'); +}); +</script> diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/cross-origin.py b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/cross-origin.py new file mode 100644 index 00000000000..d744fc9514d --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/cross-origin.py @@ -0,0 +1,17 @@ +def main(request, response): + + headers = [ + (b"Content-Type", b"text/css"), + (b"Access-Control-Allow-Origin", request.GET.first(b"origin")), + (b"Access-Control-Allow-Credentials", b"true") + ] + + milk = request.cookies.first(b"milk", None) + + # Send back + if milk is None: + return headers, u'.requestDidNotHaveCookies { }' + elif milk.value == b"1": + return headers, u'.requestHadCookies { }' + + return headers, u'.requestDidNotHaveCookies { }' diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/crossorigin-import-parse-error-with-cors.sub.html b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/crossorigin-import-parse-error-with-cors.sub.html new file mode 100644 index 00000000000..1774ef36756 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/crossorigin-import-parse-error-with-cors.sub.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<html> +<head> + <title>css-module-import-cross-domain-parse-error-WithCORS</title> + <script src="../../module/crossorigin-common.js"></script> +</head> +<body> + <h1>css-module-import-cross-domain-parse-error-WithCORS</h1> + <script type="module" crossorigin> + import styleSheet from "http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/css-module/resources/parse-error.css?pipe=header(Access-Control-Allow-Origin,*)" assert { type: "css" }; + // Push an event to the log indicating that the script was executed. + document._log.push(`imported CSS rules count: ${styleSheet.rules.length}`); + </script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/crossorigin-import-with-cors.sub.html b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/crossorigin-import-with-cors.sub.html new file mode 100644 index 00000000000..f02a51d5569 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/crossorigin-import-with-cors.sub.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<html> +<head> + <title>css-module-import-cross-domain-WithCORS</title> + <script src="../../module/crossorigin-common.js"></script> +</head> +<body> + <h1>css-module-import-cross-domain-WithCORS</h1> + <script type="module" crossorigin> + import styleSheet from "http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/css-module/resources/basic.css?pipe=header(Access-Control-Allow-Origin,*)" assert { type: "css" }; + // Push an event to the log indicating that the script was executed. + document._log.push(`imported CSS: ${styleSheet.rules[0].cssText}`); + </script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/crossorigin-import-without-cors.sub.html b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/crossorigin-import-without-cors.sub.html new file mode 100644 index 00000000000..6236f79bc8f --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/crossorigin-import-without-cors.sub.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<html> +<head> + <title>css-module-import-cross-domain-NoCORS</title> + <script src="../../module/crossorigin-common.js"></script> +</head> +<body> + <h1>css-module-import-cross-domain-NoCORS</h1> + <script type="module" onerror="document._log.push('error');"> + import styleSheet from "http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/css-module/resources/basic.css" assert { type: "css" }; + // Push an event to the log indicating that the script was executed. + document._log.push(`imported CSS: ${styleSheet.rules[0].cssText}`); + </script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/css-module-at-import-iframe.html b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/css-module-at-import-iframe.html deleted file mode 100644 index cce9e2163d7..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/css-module-at-import-iframe.html +++ /dev/null @@ -1,18 +0,0 @@ -<!DOCTYPE html> -<body> - <script> - window.onerror = function (errorMsg, url, lineNumber, column, errorObj) - { - document.load_error = errorObj.name; - return true; - }; - </script> - <script type="module"> - import v from "./bad-import.css" assert { type: "css" }; - document.adoptedStyleSheets = [v]; - </script> - - <div id="test"> - I am a test div. - </div> -</body>
\ No newline at end of file diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/css-module-basic-iframe.html b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/css-module-basic-iframe.html deleted file mode 100644 index e093d39898f..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/css-module-basic-iframe.html +++ /dev/null @@ -1,18 +0,0 @@ -<!DOCTYPE html> -<body> - <script> - window.onerror = function (errorMsg, url, lineNumber, column, errorObj) - { - document.load_error = errorObj.name; - return true; - }; - </script> - <script type="module"> - import v from "./basic.css" assert { type: "css" }; - document.adoptedStyleSheets = [v]; - </script> - - <div id="test"> - I am a test div. - </div> -</body>
\ No newline at end of file diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/css-module-basic-large-iframe.html b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/css-module-basic-large-iframe.html deleted file mode 100644 index 0cf11e9139f..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/css-module-basic-large-iframe.html +++ /dev/null @@ -1,18 +0,0 @@ -<!DOCTYPE html> -<body> - <script> - window.onerror = function (errorMsg, url, lineNumber, column, errorObj) - { - document.load_error = errorObj.name; - return true; - }; - </script> - <script type="module"> - import v from "./basic-large.css" assert { type: "css" }; - document.adoptedStyleSheets = [v]; - </script> - - <div id="test"> - I am a test div. - </div> -</body> diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/integrity-matches.js b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/integrity-matches.js new file mode 100644 index 00000000000..95be445311b --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/integrity-matches.js @@ -0,0 +1,2 @@ +import styleSheet from "./basic.css" assert { type: "css" }; +window.matchesLog.push(`integrity-matches,css:${styleSheet.cssRules[0].cssText}`); diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/integrity-mismatches.js b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/integrity-mismatches.js new file mode 100644 index 00000000000..af6fc24de49 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/integrity-mismatches.js @@ -0,0 +1,2 @@ +import styleSheet from "./basic.css" assert { type: "css" }; +window.matchesLog.push(`integrity-mismatches,css:${styleSheet.cssRules[0].cssText}`); diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/load-error-events.py b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/load-error-events.py new file mode 100644 index 00000000000..b61b1ca834e --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/load-error-events.py @@ -0,0 +1,14 @@ +import re + +def main(request, response): + headers = [(b"Content-Type", b"text/javascript")] + test = request.GET.first(b'test') + assert(re.match(b'^[a-zA-Z0-9_]+$', test)) + + status = 200 + if test.find(b'_load') >= 0: + content = b'import "./basic.css" assert { type: "css"}; %s.executed = true;' % test + else: + content = b'import "./not_found.css" assert { type: "css"}; %s.test.step(function() { assert_unreached("404 script should not be executed"); });' % test + + return status, headers, content diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/load-relative-url.css b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/load-relative-url.css new file mode 100644 index 00000000000..27f29876104 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/load-relative-url.css @@ -0,0 +1,5 @@ + +#target { + /* image.png doesn't exist, but that's irrelevant to the test. */ + background: url('./image.png'); +} diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/malformed-iframe.html b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/malformed-iframe.html deleted file mode 100644 index f5c64f6b59e..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/malformed-iframe.html +++ /dev/null @@ -1,11 +0,0 @@ -<!DOCTYPE html> -<body> - <script type="module"> - import v from "./malformed.css" assert { type: "css" }; - document.adoptedStyleSheets = [v]; - </script> - - <div id="test"> - I am a test div. - </div> -</body>
\ No newline at end of file diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/malformed.css b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/malformed.css index fb20336584e..28819bfdf55 100644 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/malformed.css +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/malformed.css @@ -1,3 +1,7 @@ -#test {{ - background-color:red; -}
\ No newline at end of file +#test4 } { + background-color: #FF0000; +} + +#test4b { + background-color: #00FF00; +} diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/parse-error.css b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/parse-error.css new file mode 100644 index 00000000000..2bee3ff9966 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/parse-error.css @@ -0,0 +1,2 @@ +div /* Opening bracket skipped intentionally. */ } + diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/referrer-checker.py b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/referrer-checker.py new file mode 100644 index 00000000000..c1eaed8e468 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/referrer-checker.py @@ -0,0 +1,7 @@ +def main(request, response): + referrer = request.headers.get(b"referer", b"") + response_headers = [(b"Content-Type", b"text/css"), + (b"Access-Control-Allow-Origin", b"*")] + # Put the referrer in a CSS rule that can be read by the importer through CSSOM + return (200, response_headers, + b'.referrer { content: "' + referrer + b'" }') diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/utf-8.css b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/utf-8.css new file mode 100644 index 00000000000..0a8b46656f1 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/utf-8.css @@ -0,0 +1,3 @@ +#test { + content: "śćążź"; +}
\ No newline at end of file diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/utf8.css b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/utf8.css deleted file mode 100644 index 35d16cd1c5b..00000000000 --- a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/utf8.css +++ /dev/null @@ -1,3 +0,0 @@ -#test { - content: "…"; -}
\ No newline at end of file diff --git a/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/windows-1250.css b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/windows-1250.css new file mode 100644 index 00000000000..9beac4d6180 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/windows-1250.css @@ -0,0 +1,3 @@ +#test { + content: "�湿�"; +} |