Closed
Bug 1209192
Opened 9 years ago
Closed 9 years ago
URLs in injected CSS files are relative to the CSS file rather than to the page
Categories
(WebExtensions :: Untriaged, defect, P3)
WebExtensions
Untriaged
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: callahad, Unassigned)
Details
(Keywords: DevAdvocacy, Whiteboard: triaged)
In Chrome, both background-image: url(//example/image.png) and url(https://example/image.png) work.
In Firefox, only the second example, explicitly specifying https://, works.
Test in https://github.com/callahad/webextension-tests/tree/master/background_image
From looking at commits to the Reddit Enhancement Suite, Safari has a similar issue: https://github.com/honestbleeps/Reddit-Enhancement-Suite/commit/58686c405f965f471d2bbbd0eb3348aa139d0ecb
Priority: -- → P3
Comment 1•9 years ago
|
||
Documented here: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities#Relative_URLs
I'm inclined to mark this invalid. I think our behavior should be the preferred behavior.
Summary: protocol-relative URLs do not work in injected CSS, unlike in Chrome → URLs in injected CSS files are relative to the CSS file rather than to the page
Updated•9 years ago
|
Flags: blocking-webextensions-
Updated•9 years ago
|
Whiteboard: triaged
Reporter | ||
Comment 2•9 years ago
|
||
Re-reading this, I guess I'm fine with marking this as wontfix.
Restating the bug for clarity: referencing a resource as `//example.com/foo` will expand to `moz-extension://example.com/foo`, which is an invalid scheme for that URL. This happens because the injected CSS file's scheme is `moz-extension:`, rather than the more common `http:` or `https:`.
Updated•9 years ago
|
Comment 3•9 years ago
|
||
Do we have a solution for protocol-agnostic absolute paths then? The common way to reference a resource absolutely on a domain that's both http and https is //example.com/foo, which ensures that the protocol matches and avoids mixed content problems. Is there another solution for that if this is WONTFIX?
Comment 4•9 years ago
|
||
Just always load resources from HTTPS.
Updated•7 years ago
|
Product: Toolkit → WebExtensions
Comment 5•5 years ago
|
||
4 years later, not sure we need docs specifically for extensions, that's just how css url resolution works in all contexts.
Keywords: dev-doc-needed
You need to log in
before you can comment on or make changes to this bug.
Description
•