Closed Bug 339112 Opened 18 years ago Closed 18 years ago

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

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 106912

People

(Reporter: matthias.redl, Unassigned)

References

Details

(Keywords: helpwanted)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3

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. http://www.abc.com/content/edit.php?delete=true
and the page contains an HTML part like:
E.g. <div style="background-image: url()">abc...</div>

It will request an image http://www.abc.com/content/edit.php?delete=true 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
Attached file Testcase as suggested
In CSS url() expects an URI, see
http://www.w3.org/TR/CSS21/syndata.html#uri

Relevant here is RFC 3986
http://www.ietf.org/rfc/rfc3986.txt

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 1.5.0.3 ID:2006042618 on WinXP monitored by "Live HTTP headers".
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: helpwanted
Cigno is right, this is per-spec.

*** This bug has been marked as a duplicate of 106912 ***
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
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.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
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
  http://www.ietf.org/rfc/rfc2396.txt
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 ***
Status: REOPENED → RESOLVED
Closed: 18 years ago18 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: