diff --git a/Libraries/LibWeb/CSS/Enums.json b/Libraries/LibWeb/CSS/Enums.json index e471e2584d4..9c74fc26c3c 100644 --- a/Libraries/LibWeb/CSS/Enums.json +++ b/Libraries/LibWeb/CSS/Enums.json @@ -138,6 +138,10 @@ "upper-latin", "upper-roman" ], + "cross-origin-modifier-value": [ + "anonymous", + "use-credentials" + ], "cursor": [ "auto", "default", @@ -502,6 +506,16 @@ "top", "bottom" ], + "referrer-policy-modifier-value": [ + "no-referrer", + "no-referrer-when-downgrade", + "same-origin", + "origin", + "strict-origin", + "origin-when-cross-origin", + "strict-origin-when-cross-origin", + "unsafe-url" + ], "repeat": [ "no-repeat", "repeat", diff --git a/Libraries/LibWeb/CSS/Fetch.cpp b/Libraries/LibWeb/CSS/Fetch.cpp index e124310a3fb..88c364e3bd4 100644 --- a/Libraries/LibWeb/CSS/Fetch.cpp +++ b/Libraries/LibWeb/CSS/Fetch.cpp @@ -55,10 +55,15 @@ static WebIDL::ExceptionOr> fetch_a_styl request->set_client(&environment_settings); request->set_referrer(environment_settings.api_base_url()); - // 5. Apply any URL request modifier steps that apply to this request. - // FIXME: No specs seem to define these yet. When they do, implement them. + // 5. If corsMode is "no-cors", set req’s credentials mode to "include". + if (cors_mode == CorsMode::NoCors) + request->set_credentials_mode(Fetch::Infrastructure::Request::CredentialsMode::Include); - // 6. If req’s mode is "cors", set req’s referrer to sheet’s location. [CSSOM] + // 6. Apply any URL request modifier steps that apply to this request. + if (auto const* css_url = url_value.get_pointer()) + apply_request_modifiers_from_url_value(*css_url, request); + + // 7. If req’s mode is "cors", set req’s referrer to sheet’s location. [CSSOM] if (request->mode() == Fetch::Infrastructure::Request::Mode::CORS) { auto location = sheet_or_document.visit( [](GC::Ref const& sheet) { return sheet->location().value(); }, @@ -66,11 +71,11 @@ static WebIDL::ExceptionOr> fetch_a_styl request->set_referrer(move(location)); } - // 7. If sheet’s origin-clean flag is set, set req’s initiator type to "css". [CSSOM] + // 8. If sheet’s origin-clean flag is set, set req’s initiator type to "css". [CSSOM] if (auto* sheet = sheet_or_document.get_pointer>(); sheet && (*sheet)->is_origin_clean()) request->set_initiator_type(Fetch::Infrastructure::Request::InitiatorType::CSS); - // 8. Fetch req, with processresponseconsumebody set to processResponse. + // 9. Fetch req, with processresponseconsumebody set to processResponse. // NB: Implemented by caller. return request; } @@ -131,4 +136,13 @@ GC::Ptr fetch_an_external_image_for_a_stylesheet(St return shared_resource_request; } +// https://drafts.csswg.org/css-values-5/#apply-request-modifiers-from-url-value +void apply_request_modifiers_from_url_value(URL const& url, GC::Ref request) +{ + // To apply request modifiers from URL value given a request req and a url, call the URL request modifier + // steps for url’s s in sequence given req. + for (auto const& request_url_modifier : url.request_url_modifiers()) + request_url_modifier.modify_request(request); +} + } diff --git a/Libraries/LibWeb/CSS/Fetch.h b/Libraries/LibWeb/CSS/Fetch.h index b3d17871652..d0678d49053 100644 --- a/Libraries/LibWeb/CSS/Fetch.h +++ b/Libraries/LibWeb/CSS/Fetch.h @@ -30,4 +30,7 @@ WebIDL::ExceptionOr> fetch_a_sty // https://drafts.csswg.org/css-images-4/#fetch-an-external-image-for-a-stylesheet GC::Ptr fetch_an_external_image_for_a_stylesheet(StyleResourceURL const&, StyleSheetOrDocument); +// https://drafts.csswg.org/css-values-5/#apply-request-modifiers-from-url-value +void apply_request_modifiers_from_url_value(URL const&, GC::Ref); + } diff --git a/Libraries/LibWeb/CSS/Keywords.json b/Libraries/LibWeb/CSS/Keywords.json index 50e5f7efa34..4be4ed52c6d 100644 --- a/Libraries/LibWeb/CSS/Keywords.json +++ b/Libraries/LibWeb/CSS/Keywords.json @@ -77,6 +77,7 @@ "alpha", "alternate", "alternate-reverse", + "anonymous", "anywhere", "appworkspace", "auto", @@ -311,6 +312,8 @@ "no-historical-ligatures", "no-open-quote", "no-preference", + "no-referrer", + "no-referrer-when-downgrade", "no-repeat", "none", "nonzero", @@ -331,6 +334,8 @@ "optimizespeed", "optional", "ordinal", + "origin", + "origin-when-cross-origin", "outset", "outside", "overlay", @@ -383,6 +388,7 @@ "running", "s-resize", "safe", + "same-origin", "sans-serif", "saturation", "scale-down", @@ -430,6 +436,8 @@ "sticky", "stretch", "strict", + "strict-origin", + "strict-origin-when-cross-origin", "stroke-box", "style", "sub", @@ -474,12 +482,14 @@ "unicase", "unicode", "unsafe", + "unsafe-url", "unset", "up", "upper-alpha", "upper-latin", "upper-roman", "uppercase", + "use-credentials", "vertical-lr", "vertical-rl", "vertical-text", diff --git a/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp b/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp index 4c7542414de..075dc06ed6b 100644 --- a/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp +++ b/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -2697,29 +2698,105 @@ RefPtr Parser::parse_easing_value(TokenStream Parser::parse_url_function(TokenStream& tokens) { + // = | + // = url( * ) | + // = src( * ) + // FIXME: Also parse src() function auto transaction = tokens.begin_transaction(); auto const& component_value = tokens.consume_a_token(); + // if (component_value.is(Token::Type::Url)) { transaction.commit(); return URL { component_value.token().url().to_string() }; } + // = url( * ) if (component_value.is_function("url"sv)) { auto const& function_values = component_value.function().value; - // FIXME: Handle url-modifiers. https://www.w3.org/TR/css-values-4/#url-modifiers - for (size_t i = 0; i < function_values.size(); ++i) { - auto const& value = function_values[i]; - if (value.is(Token::Type::Whitespace)) - continue; - if (value.is(Token::Type::String)) { - transaction.commit(); - return URL { value.token().string().to_string() }; + TokenStream url_tokens { function_values }; + + url_tokens.discard_whitespace(); + auto url_string = url_tokens.consume_a_token(); + if (!url_string.is(Token::Type::String)) + return {}; + url_tokens.discard_whitespace(); + + // NB: Currently is the only kind of + // https://drafts.csswg.org/css-values-5/#request-url-modifiers + // = | | + Vector request_url_modifiers; + // AD-HOC: This isn't mentioned in the spec, but WPT expects modifiers to be unique (one per type). + // Spec issue: https://github.com/w3c/csswg-drafts/issues/12151 + while (url_tokens.has_next_token()) { + auto& modifier_token = url_tokens.consume_a_token(); + if (modifier_token.is_function("crossorigin"sv)) { + // Reject duplicates + if (request_url_modifiers.first_matching([](auto& modifier) { return modifier.type() == RequestURLModifier::Type::CrossOrigin; }).has_value()) + return {}; + // = crossorigin(anonymous | use-credentials) + TokenStream modifier_tokens { modifier_token.function().value }; + modifier_tokens.discard_whitespace(); + if (!modifier_tokens.next_token().is(Token::Type::Ident)) + return {}; + auto maybe_keyword = keyword_from_string(modifier_tokens.consume_a_token().token().ident()); + modifier_tokens.discard_whitespace(); + if (!maybe_keyword.has_value() || modifier_tokens.has_next_token()) + return {}; + if (auto value = keyword_to_cross_origin_modifier_value(*maybe_keyword); value.has_value()) { + request_url_modifiers.append(RequestURLModifier::create_cross_origin(value.release_value())); + } else { + return {}; + } + } else if (modifier_token.is_function("integrity"sv)) { + // Reject duplicates + if (request_url_modifiers.first_matching([](auto& modifier) { return modifier.type() == RequestURLModifier::Type::Integrity; }).has_value()) + return {}; + // = integrity() + TokenStream modifier_tokens { modifier_token.function().value }; + modifier_tokens.discard_whitespace(); + auto& maybe_string = modifier_tokens.consume_a_token(); + modifier_tokens.discard_whitespace(); + if (!maybe_string.is(Token::Type::String) || modifier_tokens.has_next_token()) + return {}; + request_url_modifiers.append(RequestURLModifier::create_integrity(maybe_string.token().string())); + } else if (modifier_token.is_function("referrerpolicy"sv)) { + // Reject duplicates + if (request_url_modifiers.first_matching([](auto& modifier) { return modifier.type() == RequestURLModifier::Type::ReferrerPolicy; }).has_value()) + return {}; + + // = (no-referrer | no-referrer-when-downgrade | same-origin | origin | strict-origin | origin-when-cross-origin | strict-origin-when-cross-origin | unsafe-url) + TokenStream modifier_tokens { modifier_token.function().value }; + modifier_tokens.discard_whitespace(); + if (!modifier_tokens.next_token().is(Token::Type::Ident)) + return {}; + auto maybe_keyword = keyword_from_string(modifier_tokens.consume_a_token().token().ident()); + modifier_tokens.discard_whitespace(); + if (!maybe_keyword.has_value() || modifier_tokens.has_next_token()) + return {}; + if (auto value = keyword_to_referrer_policy_modifier_value(*maybe_keyword); value.has_value()) { + request_url_modifiers.append(RequestURLModifier::create_referrer_policy(value.release_value())); + } else { + return {}; + } + } else { + dbgln_if(CSS_PARSER_DEBUG, "Unrecognized URL modifier: {}", modifier_token.to_debug_string()); + return {}; } - break; + url_tokens.discard_whitespace(); } + + // AD-HOC: This isn't mentioned in the spec, but WPT expects modifiers to be sorted alphabetically. + // Spec issue: https://github.com/w3c/csswg-drafts/issues/12151 + quick_sort(request_url_modifiers, [](RequestURLModifier const& a, RequestURLModifier const& b) { + return to_underlying(a.type()) < to_underlying(b.type()); + }); + + transaction.commit(); + return URL { url_string.token().string().to_string(), move(request_url_modifiers) }; } return {}; diff --git a/Libraries/LibWeb/CSS/URL.cpp b/Libraries/LibWeb/CSS/URL.cpp index a634b6128bc..07276c65160 100644 --- a/Libraries/LibWeb/CSS/URL.cpp +++ b/Libraries/LibWeb/CSS/URL.cpp @@ -6,11 +6,13 @@ #include #include +#include namespace Web::CSS { -URL::URL(String url) +URL::URL(String url, Vector request_url_modifiers) : m_url(move(url)) + , m_request_url_modifiers(move(request_url_modifiers)) { } @@ -21,6 +23,12 @@ String URL::to_string() const StringBuilder builder; builder.append("url("sv); serialize_a_string(builder, m_url); + + // AD-HOC: Serialize the RequestURLModifiers + // Spec issue: https://github.com/w3c/csswg-drafts/issues/12057 + for (auto const& modifier : m_request_url_modifiers) + builder.appendff(" {}", modifier.to_string()); + builder.append(')'); return builder.to_string_without_validation(); @@ -28,4 +36,99 @@ String URL::to_string() const bool URL::operator==(URL const&) const = default; +RequestURLModifier RequestURLModifier::create_cross_origin(CrossOriginModifierValue value) +{ + return RequestURLModifier { Type::CrossOrigin, value }; +} + +RequestURLModifier RequestURLModifier::create_integrity(FlyString value) +{ + return RequestURLModifier { Type::Integrity, move(value) }; +} + +RequestURLModifier RequestURLModifier::create_referrer_policy(ReferrerPolicyModifierValue value) +{ + return RequestURLModifier { Type::ReferrerPolicy, value }; +} + +RequestURLModifier::RequestURLModifier(Type type, Value value) + : m_type(type) + , m_value(move(value)) +{ +} + +void RequestURLModifier::modify_request(GC::Ref request) const +{ + switch (m_type) { + case Type::CrossOrigin: { + // https://drafts.csswg.org/css-values-5/#typedef-request-url-modifier-crossorigin-modifier + // The URL request modifier steps for this modifier given request req are: + + // 1. Set req’s mode to "cors". + request->set_mode(Fetch::Infrastructure::Request::Mode::CORS); + + // 2. If the given value is use-credentials, set req’s credentials mode to "include". + if (m_value == CrossOriginModifierValue::UseCredentials) { + request->set_credentials_mode(Fetch::Infrastructure::Request::CredentialsMode::Include); + } + // 3. Otherwise, set req’s credentials mode to "same-origin". + else { + request->set_credentials_mode(Fetch::Infrastructure::Request::CredentialsMode::SameOrigin); + } + break; + } + case Type::Integrity: { + // https://drafts.csswg.org/css-values-5/#typedef-request-url-modifier-integrity-modifier + + // The URL request modifier steps for this modifier given request req are to set request’s integrity metadata to + // the given . + request->set_integrity_metadata(m_value.get().to_string()); + break; + } + case Type::ReferrerPolicy: { + // https://drafts.csswg.org/css-values-5/#typedef-request-url-modifier-referrerpolicy-modifier + // The URL request modifier steps for this modifier given request req are to set request’s referrer policy to the + // ReferrerPolicy that matches the given value. + auto referrer_policy = [](ReferrerPolicyModifierValue value) { + switch (value) { + case ReferrerPolicyModifierValue::NoReferrer: + return ReferrerPolicy::ReferrerPolicy::NoReferrer; + case ReferrerPolicyModifierValue::NoReferrerWhenDowngrade: + return ReferrerPolicy::ReferrerPolicy::NoReferrerWhenDowngrade; + case ReferrerPolicyModifierValue::SameOrigin: + return ReferrerPolicy::ReferrerPolicy::SameOrigin; + case ReferrerPolicyModifierValue::Origin: + return ReferrerPolicy::ReferrerPolicy::Origin; + case ReferrerPolicyModifierValue::StrictOrigin: + return ReferrerPolicy::ReferrerPolicy::StrictOrigin; + case ReferrerPolicyModifierValue::OriginWhenCrossOrigin: + return ReferrerPolicy::ReferrerPolicy::OriginWhenCrossOrigin; + case ReferrerPolicyModifierValue::StrictOriginWhenCrossOrigin: + return ReferrerPolicy::ReferrerPolicy::StrictOriginWhenCrossOrigin; + case ReferrerPolicyModifierValue::UnsafeUrl: + return ReferrerPolicy::ReferrerPolicy::UnsafeURL; + } + VERIFY_NOT_REACHED(); + }(m_value.get()); + request->set_referrer_policy(referrer_policy); + break; + } + } +} + +String RequestURLModifier::to_string() const +{ + switch (m_type) { + case Type::CrossOrigin: + return MUST(String::formatted("crossorigin({})", CSS::to_string(m_value.get()))); + case Type::Integrity: + return MUST(String::formatted("integrity({})", serialize_a_string(m_value.get()))); + case Type::ReferrerPolicy: + return MUST(String::formatted("referrerpolicy({})", CSS::to_string(m_value.get()))); + } + VERIFY_NOT_REACHED(); +} + +bool RequestURLModifier::operator==(RequestURLModifier const&) const = default; + } diff --git a/Libraries/LibWeb/CSS/URL.h b/Libraries/LibWeb/CSS/URL.h index e859e61953d..cecf9458ec1 100644 --- a/Libraries/LibWeb/CSS/URL.h +++ b/Libraries/LibWeb/CSS/URL.h @@ -7,21 +7,51 @@ #pragma once #include +#include +#include +#include namespace Web::CSS { +// https://drafts.csswg.org/css-values-5/#request-url-modifiers +class RequestURLModifier { +public: + enum class Type : u8 { + CrossOrigin, + Integrity, + ReferrerPolicy, + }; + + static RequestURLModifier create_cross_origin(CrossOriginModifierValue); + static RequestURLModifier create_integrity(FlyString); + static RequestURLModifier create_referrer_policy(ReferrerPolicyModifierValue); + + ~RequestURLModifier() = default; + void modify_request(GC::Ref) const; + Type type() const { return m_type; } + String to_string() const; + bool operator==(RequestURLModifier const&) const; + +private: + using Value = Variant; + RequestURLModifier(Type, Value); + Type m_type; + Value m_value; +}; // https://drafts.csswg.org/css-values-4/#urls class URL { public: - URL(String url); + URL(String url, Vector = {}); String const& url() const { return m_url; } + Vector const& request_url_modifiers() const { return m_request_url_modifiers; } String to_string() const; bool operator==(URL const&) const; private: String m_url; + Vector m_request_url_modifiers; }; } diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-values/urls/url-request-modifiers-computed.sub.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-values/urls/url-request-modifiers-computed.sub.txt index 62d9f4a3842..d8423a8f020 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-values/urls/url-request-modifiers-computed.sub.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-values/urls/url-request-modifiers-computed.sub.txt @@ -2,28 +2,27 @@ Harness status: OK Found 23 tests -1 Pass -22 Fail +23 Pass Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png")' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" crossorigin(anonymous))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" crossorigin(use-credentials))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" integrity("sha384-foobar"))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" integrity(""))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(no-referrer))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(no-referrer-when-downgrade))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(same-origin))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(origin))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(strict-origin))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(origin-when-cross-origin))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(strict-origin-when-cross-origin))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(unsafe-url))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" crossorigin(anonymous) integrity("sha384-foobar"))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" integrity("sha384-foobar") crossorigin(anonymous))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" integrity("sha384-foobar") referrerpolicy(no-referrer))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(no-referrer) integrity("sha384-foobar"))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" crossorigin(anonymous) referrerpolicy(no-referrer))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(no-referrer) crossorigin(anonymous))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" crossorigin(anonymous) integrity("sha384-foobar") referrerpolicy(no-referrer))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" integrity("sha384-foobar") referrerpolicy(no-referrer) crossorigin(anonymous))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(no-referrer) crossorigin(anonymous) integrity("sha384-foobar"))' -Fail Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(no-referrer) integrity("sha384-foobar") crossorigin(anonymous))' \ No newline at end of file +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" crossorigin(anonymous))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" crossorigin(use-credentials))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" integrity("sha384-foobar"))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" integrity(""))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(no-referrer))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(no-referrer-when-downgrade))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(same-origin))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(origin))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(strict-origin))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(origin-when-cross-origin))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(strict-origin-when-cross-origin))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(unsafe-url))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" crossorigin(anonymous) integrity("sha384-foobar"))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" integrity("sha384-foobar") crossorigin(anonymous))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" integrity("sha384-foobar") referrerpolicy(no-referrer))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(no-referrer) integrity("sha384-foobar"))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" crossorigin(anonymous) referrerpolicy(no-referrer))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(no-referrer) crossorigin(anonymous))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" crossorigin(anonymous) integrity("sha384-foobar") referrerpolicy(no-referrer))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" integrity("sha384-foobar") referrerpolicy(no-referrer) crossorigin(anonymous))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(no-referrer) crossorigin(anonymous) integrity("sha384-foobar"))' +Pass Property background-image value 'url("http://wpt.live:80/css/support/1x1-green.png" referrerpolicy(no-referrer) integrity("sha384-foobar") crossorigin(anonymous))' \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-values/urls/url-request-modifiers-invalid.sub.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-values/urls/url-request-modifiers-invalid.sub.txt index 65744a86bfa..56cd6750bf8 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-values/urls/url-request-modifiers-invalid.sub.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-values/urls/url-request-modifiers-invalid.sub.txt @@ -2,34 +2,33 @@ Harness status: OK Found 29 tests -6 Pass -23 Fail -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin())" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(,))" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(anonymous,))" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(,anonymous))" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(anonymous foobar))" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(anonymous) cross-origin(anonymous))" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(anonymous) cross-origin(use-credentials))" should not set the property value +29 Pass +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin())" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(,))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(anonymous,))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(,anonymous))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(anonymous foobar))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(anonymous) cross-origin(anonymous))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(anonymous) cross-origin(use-credentials))" should not set the property value Pass e.style['background-image'] = "url(crossorigin(anonymous) \"http://wpt.live:80/css/support/1x1-green.png\")" should not set the property value Pass e.style['background-image'] = "\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(anonymous)" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity())" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(,))" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"sha384-foobar\",))" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(,\"sha384-foobar\"))" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"sha384-foobar\" foobar))" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(sha384-foobar))" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"sha384-foobar\") integrity(\"sha384-foobar\"))" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"sha384-foobar\") integrity(\"sha384-barbaz\"))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity())" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(,))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"sha384-foobar\",))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(,\"sha384-foobar\"))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"sha384-foobar\" foobar))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(sha384-foobar))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"sha384-foobar\") integrity(\"sha384-foobar\"))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"sha384-foobar\") integrity(\"sha384-barbaz\"))" should not set the property value Pass e.style['background-image'] = "url(integrity(\"sha384-foobar\") \"http://wpt.live:80/css/support/1x1-green.png\")" should not set the property value Pass e.style['background-image'] = "\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"sha384-foobar\")" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy())" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(,))" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer,))" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(,no-referrer))" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer foobar))" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer same-origin))" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer) referrerpolicy(no-referrer))" should not set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer) referrerpolicy(same-origin))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy())" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(,))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer,))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(,no-referrer))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer foobar))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer same-origin))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer) referrerpolicy(no-referrer))" should not set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer) referrerpolicy(same-origin))" should not set the property value Pass e.style['background-image'] = "url(referrerpolicy(no-referrer) \"http://wpt.live:80/css/support/1x1-green.png\")" should not set the property value Pass e.style['background-image'] = "\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer)" should not set the property value \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-values/urls/url-request-modifiers-serialize.sub.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-values/urls/url-request-modifiers-serialize.sub.txt index ce8f1040b47..2d08e7cbb48 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-values/urls/url-request-modifiers-serialize.sub.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-values/urls/url-request-modifiers-serialize.sub.txt @@ -2,28 +2,27 @@ Harness status: OK Found 23 tests -1 Pass -22 Fail +23 Pass Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\")" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(anonymous))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(use-credentials))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"sha384-foobar\"))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"\"))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer-when-downgrade))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(same-origin))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(origin))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(strict-origin))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(origin-when-cross-origin))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(strict-origin-when-cross-origin))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(unsafe-url))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(anonymous) integrity(\"sha384-foobar\"))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"sha384-foobar\") crossorigin(anonymous))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"sha384-foobar\") referrerpolicy(no-referrer))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer) integrity(\"sha384-foobar\"))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(anonymous) referrerpolicy(no-referrer))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer) crossorigin(anonymous))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(anonymous) integrity(\"sha384-foobar\") referrerpolicy(no-referrer))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"sha384-foobar\") referrerpolicy(no-referrer) crossorigin(anonymous))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer) crossorigin(anonymous) integrity(\"sha384-foobar\"))" should set the property value -Fail e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer) integrity(\"sha384-foobar\") crossorigin(anonymous))" should set the property value \ No newline at end of file +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(anonymous))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(use-credentials))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"sha384-foobar\"))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"\"))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer-when-downgrade))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(same-origin))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(origin))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(strict-origin))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(origin-when-cross-origin))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(strict-origin-when-cross-origin))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(unsafe-url))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(anonymous) integrity(\"sha384-foobar\"))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"sha384-foobar\") crossorigin(anonymous))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"sha384-foobar\") referrerpolicy(no-referrer))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer) integrity(\"sha384-foobar\"))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(anonymous) referrerpolicy(no-referrer))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer) crossorigin(anonymous))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" crossorigin(anonymous) integrity(\"sha384-foobar\") referrerpolicy(no-referrer))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" integrity(\"sha384-foobar\") referrerpolicy(no-referrer) crossorigin(anonymous))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer) crossorigin(anonymous) integrity(\"sha384-foobar\"))" should set the property value +Pass e.style['background-image'] = "url(\"http://wpt.live:80/css/support/1x1-green.png\" referrerpolicy(no-referrer) integrity(\"sha384-foobar\") crossorigin(anonymous))" should set the property value \ No newline at end of file