From 41ce34519337f9f4e6001a1ab22cb7469ce8614d Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Mon, 6 Nov 2023 10:15:27 +0000 Subject: [PATCH] Bug 1472876 - Make empty URL in CSS compute to empty (rather than about:invalid), as required by the spec. r=firefox-style-system-reviewers,emilio Differential Revision: https://phabricator.services.mozilla.com/D192809 --- layout/style/GeckoBindings.cpp | 7 ++++++- .../meta/css/css-values/urls/empty.html.ini | 20 ------------------- 2 files changed, 6 insertions(+), 21 deletions(-) delete mode 100644 testing/web-platform/meta/css/css-values/urls/empty.html.ini diff --git a/layout/style/GeckoBindings.cpp b/layout/style/GeckoBindings.cpp index b48fe0adb2d4..9ec29b9a2299 100644 --- a/layout/style/GeckoBindings.cpp +++ b/layout/style/GeckoBindings.cpp @@ -1192,7 +1192,12 @@ void Gecko_GetComputedImageURLSpec(const StyleComputedUrl* aURL, } } - aOut->AssignLiteral("about:invalid"); + // Empty URL computes to empty, per spec: + if (aURL->SpecifiedSerialization().IsEmpty()) { + aOut->Truncate(); + } else { + aOut->AssignLiteral("about:invalid"); + } } bool Gecko_IsSupportedImageMimeType(const uint8_t* aMimeType, diff --git a/testing/web-platform/meta/css/css-values/urls/empty.html.ini b/testing/web-platform/meta/css/css-values/urls/empty.html.ini deleted file mode 100644 index ebdc17c25b8e..000000000000 --- a/testing/web-platform/meta/css/css-values/urls/empty.html.ini +++ /dev/null @@ -1,20 +0,0 @@ -[empty.html] - [empty URL: inline-unquoted] - expected: - if (os == "mac") and not debug: [FAIL, PASS] - FAIL - - [empty URL: inline-quoted] - expected: - if (os == "mac") and not debug: [FAIL, PASS] - FAIL - - [empty URL: external-unquoted] - expected: - if (os == "mac") and not debug: [FAIL, PASS] - FAIL - - [empty URL: external-quoted] - expected: - if (os == "mac") and not debug: [FAIL, PASS] - FAIL