an empty file reference like background-image: url() causes second page request




12 years ago
7 years ago


(Reporter: matthias.redl, Unassigned)



Firefox Tracking Flags

(Not tracked)



(1 attachment)



12 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20060426 Firefox/
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20060426 Firefox/

If an HTML Tag has e.g. an inline style definition like with url(), but the the URL is missing, Firefox requests the URL of the page instead.

so if the URL of a webpage is e.g.
and the page contains an HTML part like:
E.g. <div style="background-image: url()">abc...</div>

It will request an image as background image!!!!!!

Although this might conform with some standard, it's hell, if the page url contains get vars which e.g. modify a database, and all requests are made twice.

My solution would be that FF does not request the document a second time but instead uses the requested code it already has im memory.

Reproducible: Always

Steps to Reproduce:
1. create a an HTML Code with some inline style, eg. <div style="background-image: url()"></div>
2. request the document from your server and tail -f the server log. FF will request the document twice

Actual Results:  
FF will request the page twice, thefor causing unexpected behaviour with scripts

Expected Results:  
should only load once

Comment 1

12 years ago
Created attachment 223196 [details]
Testcase as suggested

Comment 2

12 years ago
In CSS url() expects an URI, see

Relevant here is RFC 3986

Begin of Quote >> [...]
4.4.  Same-Document Reference

   When a URI reference refers to a URI that is, aside from its fragment
   component (if any), identical to the base URI (Section 5.1), that
   reference is called a "same-document" reference.  The most frequent
   examples of same-document references are relative references that are
   empty or include only the number sign ("#") separator followed by a
   fragment identifier.

   When a same-document reference is dereferenced for a retrieval
   action, the target of that reference is defined to be within the same
   entity (representation, document, or message) as the reference;
   therefore, a dereference should not result in a new retrieval action.
[...] << End of Quote

Notice the latter paragraph which I understand as: "No new retrieval if referenced in same document." That would actually mean a wrong implementation in Fx.

The testcase does produce two requests of itself for Firefox ID:2006042618 on WinXP monitored by "Live HTTP headers".
Ever confirmed: true
Keywords: helpwanted
Cigno is right, this is per-spec.

*** This bug has been marked as a duplicate of 106912 ***
Last Resolved: 12 years ago
Resolution: --- → DUPLICATE

Comment 4

12 years ago
Gavin - I actually argued that it is a rightful bug as the empty self reference should not result in a second download (2nd paragraph of quoted RFC). To my understanding, the quote proves bug 106912 invalid, however the current one valid. Please comment.
Resolution: DUPLICATE → ---

Comment 5

12 years ago
Overview for future reference:

Indeed this is a duplicate, in particular so if one widens the issue to all empty src="", href="" and url() statements.

To allow for a quicker solution (and in case they refer to different sections of the code), here all related bugs in categories:

HTML / href="" :
bug 106912, bug 116221, bug 136740, bug 201378, bug 265799, bug 323069

HTML / src="" :
bug 225554, bug 272203, bug 278939

HTML / (both) :
bug 323168

CSS  / url() :
bug 263980, bug 310951, bug 321090, (bug 36944) (*)

It might furthermore have caused the EXPIRED (testing necessary) Thunderbird bug 268431.

Bug 94849 describes the initial implementation of an empty reference as a reference to self. Note that there the old RFC 2396
is referenced. Yet already there, a new retrieval of the document is specified as unwanted.

Begin Quote >>
4.2. Same-document References

   A URI reference that does not contain a URI is a reference to the
   current document.  In other words, an empty URI reference within a
   document is interpreted as a reference to the start of that document,
   and a reference containing only a fragment identifier is a reference
   to the identified fragment of that document.  Traversal of such a
   reference should not result in an additional retrieval action.
   However, if the URI reference occurs in a context that is always
   intended to result in a new request, as in the case of HTML's FORM
   element, then an empty URI reference represents the base URI of the
   current document and should be replaced by that URI when transformed
   into a request.
<< End Quote

Hence, the original implementation was not fully standards compliant even then. An earlier heated argument about standards compliance vs. backwards compatibility starting from bug 78206, comment 4 might inspire today's discussion / decision.

(Side note: This issue is probably unrelated to bug 209375 which was a WORKSFORME [wrongly marked as FIXED] regarding forms and its subsequent dupes.)

(Side note: bug 80544 and bug 81008 probably cover some HTTP protocol related issue, however, I wouldn't be able to say w/o looking at the patches whether it's related to our issue or not.)

(*) (Side note: bug 36944 actually described an initially wrong implementation, where background-image:url() resulted in an empty page.)

Hope this helps the discussion.
The quote hinges on the definition of "retrieval action" which is not really well defined anywhere, for what it's worth.  I believe this bug is invalid, since there's no sane way to consider a url() in a stylesheet to be a same-document reference to the stylesheet.
I guess we're using bug 106912 as the dumping ground....

*** This bug has been marked as a duplicate of 106912 ***
Last Resolved: 12 years ago12 years ago
Resolution: --- → DUPLICATE
Duplicate of this bug: 529249


7 years ago
Duplicate of this bug: 673934
You need to log in before you can comment on or make changes to this bug.