LibWeb/CSS: Parse and use CSS URL request modifiers

This commit is contained in:
Sam Atkins 2025-05-02 17:25:56 +01:00 committed by Tim Ledbetter
commit de6df6f403
Notes: github-actions[bot] 2025-05-03 22:23:41 +00:00
10 changed files with 337 additions and 89 deletions

View file

@ -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",

View file

@ -55,10 +55,15 @@ static WebIDL::ExceptionOr<GC::Ref<Fetch::Infrastructure::Request>> 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 reqs credentials mode to "include".
if (cors_mode == CorsMode::NoCors)
request->set_credentials_mode(Fetch::Infrastructure::Request::CredentialsMode::Include);
// 6. If reqs mode is "cors", set reqs referrer to sheets location. [CSSOM]
// 6. Apply any URL request modifier steps that apply to this request.
if (auto const* css_url = url_value.get_pointer<CSS::URL>())
apply_request_modifiers_from_url_value(*css_url, request);
// 7. If reqs mode is "cors", set reqs referrer to sheets location. [CSSOM]
if (request->mode() == Fetch::Infrastructure::Request::Mode::CORS) {
auto location = sheet_or_document.visit(
[](GC::Ref<CSSStyleSheet> const& sheet) { return sheet->location().value(); },
@ -66,11 +71,11 @@ static WebIDL::ExceptionOr<GC::Ref<Fetch::Infrastructure::Request>> fetch_a_styl
request->set_referrer(move(location));
}
// 7. If sheets origin-clean flag is set, set reqs initiator type to "css". [CSSOM]
// 8. If sheets origin-clean flag is set, set reqs initiator type to "css". [CSSOM]
if (auto* sheet = sheet_or_document.get_pointer<GC::Ref<CSSStyleSheet>>(); 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<HTML::SharedResourceRequest> 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<Fetch::Infrastructure::Request> request)
{
// To apply request modifiers from URL value given a request req and a <url> url, call the URL request modifier
// steps for urls <request-url-modifier>s in sequence given req.
for (auto const& request_url_modifier : url.request_url_modifiers())
request_url_modifier.modify_request(request);
}
}

View file

@ -30,4 +30,7 @@ WebIDL::ExceptionOr<GC::Ref<Fetch::Infrastructure::FetchController>> fetch_a_sty
// https://drafts.csswg.org/css-images-4/#fetch-an-external-image-for-a-stylesheet
GC::Ptr<HTML::SharedResourceRequest> 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<Fetch::Infrastructure::Request>);
}

View file

@ -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",

View file

@ -14,6 +14,7 @@
#include <AK/Debug.h>
#include <AK/GenericLexer.h>
#include <AK/QuickSort.h>
#include <AK/TemporaryChange.h>
#include <LibWeb/CSS/FontFace.h>
#include <LibWeb/CSS/Parser/Parser.h>
@ -2697,29 +2698,105 @@ RefPtr<CSSStyleValue const> Parser::parse_easing_value(TokenStream<ComponentValu
return nullptr;
}
// https://drafts.csswg.org/css-values-4/#url-value
Optional<URL> Parser::parse_url_function(TokenStream<ComponentValue>& tokens)
{
// <url> = <url()> | <src()>
// <url()> = url( <string> <url-modifier>* ) | <url-token>
// <src()> = src( <string> <url-modifier>* )
// FIXME: Also parse src() function
auto transaction = tokens.begin_transaction();
auto const& component_value = tokens.consume_a_token();
// <url-token>
if (component_value.is(Token::Type::Url)) {
transaction.commit();
return URL { component_value.token().url().to_string() };
}
// <url()> = url( <string> <url-modifier>* )
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)) {
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 <request-url-modifier> is the only kind of <url-modifier>
// https://drafts.csswg.org/css-values-5/#request-url-modifiers
// <request-url-modifier> = <crossorigin-modifier> | <integrity-modifier> | <referrerpolicy-modifier>
Vector<RequestURLModifier> 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-modifier> = 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-modifier> = integrity(<string>)
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 {};
// <referrerpolicy-modifier> = (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 {};
}
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 { value.token().string().to_string() };
}
break;
}
return URL { url_string.token().string().to_string(), move(request_url_modifiers) };
}
return {};

View file

@ -6,11 +6,13 @@
#include <LibWeb/CSS/Serialize.h>
#include <LibWeb/CSS/URL.h>
#include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>
namespace Web::CSS {
URL::URL(String url)
URL::URL(String url, Vector<RequestURLModifier> 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<Fetch::Infrastructure::Request> 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 reqs mode to "cors".
request->set_mode(Fetch::Infrastructure::Request::Mode::CORS);
// 2. If the given value is use-credentials, set reqs credentials mode to "include".
if (m_value == CrossOriginModifierValue::UseCredentials) {
request->set_credentials_mode(Fetch::Infrastructure::Request::CredentialsMode::Include);
}
// 3. Otherwise, set reqs 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 requests integrity metadata to
// the given <string>.
request->set_integrity_metadata(m_value.get<FlyString>().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 requests 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<ReferrerPolicyModifierValue>());
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<CrossOriginModifierValue>())));
case Type::Integrity:
return MUST(String::formatted("integrity({})", serialize_a_string(m_value.get<FlyString>())));
case Type::ReferrerPolicy:
return MUST(String::formatted("referrerpolicy({})", CSS::to_string(m_value.get<ReferrerPolicyModifierValue>())));
}
VERIFY_NOT_REACHED();
}
bool RequestURLModifier::operator==(RequestURLModifier const&) const = default;
}

View file

@ -7,21 +7,51 @@
#pragma once
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibGC/Ptr.h>
#include <LibWeb/CSS/Enums.h>
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<Fetch::Infrastructure::Request>) const;
Type type() const { return m_type; }
String to_string() const;
bool operator==(RequestURLModifier const&) const;
private:
using Value = Variant<CrossOriginModifierValue, ReferrerPolicyModifierValue, FlyString>;
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<RequestURLModifier> = {});
String const& url() const { return m_url; }
Vector<RequestURLModifier> const& request_url_modifiers() const { return m_request_url_modifiers; }
String to_string() const;
bool operator==(URL const&) const;
private:
String m_url;
Vector<RequestURLModifier> m_request_url_modifiers;
};
}

View file

@ -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))'
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))'

View file

@ -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

View file

@ -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
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