Closed Bug 225554 Opened 21 years ago Closed 16 years ago

page loaded twice if contains <img HEIGHT="5" WIDTH="100%" SRC=""> (empty src attribute)

Categories

(Core :: General, defect)

defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 444931

People

(Reporter: andry, Unassigned)

References

Details

(Keywords: perf)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007

Mozilla makes 2 HTTP GET requests for a dymamic page (non-cachable)
which contains <img HEIGHT="5" WIDTH="100%" SRC="">. 

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Hmm why do you need an image with src="" ? I confirm that it resolves to the URL
of the page with Mozilla 1.6a :

172.16.140.87 - - [13/Nov/2003:13:18:17 +0100] "GET /test.html HTTP/1.1" 200 43
172.16.140.87 - - [13/Nov/2003:13:18:17 +0100] "GET /test.html HTTP/1.1" 304 -

With IE6 it resolves to the root of the web server :

172.16.140.87 - - [13/Nov/2003:13:18:51 +0100] "GET /test.html HTTP/1.1" 200 43
172.16.140.87 - - [13/Nov/2003:13:18:51 +0100] "GET / HTTP/1.1" 200 715

i think it would be best if Mozilla understand the image refers to the file
already loaded. If a page contains several images referring to the same image
file - only one hit will be made. So it seemed reasonable to avoid loading twice
in my case.
However, this was of cause a bug in my HTML
Severity: normal → minor
Keywords: perf
> i think it would be best if Mozilla understand the image refers to the file
> already loaded. 

It does.  But that's not cacheable, as you said, so we have to hit the server
every time we load it.

This is invalid.
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
*** Bug 270866 has been marked as a duplicate of this bug. ***
if the image has no src then there is no image , why does the browser makes a
request and not just skips it ? 
src="" is not the same thing as "has no src".  If you want no src, don't set the
src attribute.  Setting it to "" means "this URI".
Product: Browser → Seamonkey
*** Bug 284503 has been marked as a duplicate of this bug. ***
*** Bug 287077 has been marked as a duplicate of this bug. ***
In which case would an html page be it's own image content? This behavior is on
mozilla only, IE just do nothing as expected.
*** Bug 286979 has been marked as a duplicate of this bug. ***
Summary: page loaded twice if contains <img HEIGHT="5" WIDTH="100%" SRC=""> → page loaded twice if contains <img HEIGHT="5" WIDTH="100%" SRC=""> (empty src attribute)
> In which case would an html page be it's own image content?

In any case that makes use of content negotiation, potentially.  Such pages
exist out there as demonstrations of content negotiation, and they're broken in
IE (which does not endear IE to people who want to use the technology).
(In reply to comment #11)
> > In which case would an html page be it's own image content?
> 
> In any case that makes use of content negotiation, potentially.  Such pages
> exist out there as demonstrations of content negotiation, and they're broken in
> IE (which does not endear IE to people who want to use the technology).

In that case, the logical behavoir would be the browser to fetch src="" on
document load, not on page reload / change. Ie:

Logical:
Load: 2 fetch, Change: 1 fetch
Current:
Load: 1 fetch, Change: 2 fetch
Testcase for the behavior in comment 12?
*** Bug 276287 has been marked as a duplicate of this bug. ***
Status: RESOLVED → VERIFIED
*** Bug 303624 has been marked as a duplicate of this bug. ***
*** Bug 320973 has been marked as a duplicate of this bug. ***
*** Bug 331107 has been marked as a duplicate of this bug. ***
*** Bug 349874 has been marked as a duplicate of this bug. ***
While I acknowledge that an empty URL isn't the same as no URL at all, and also that an empty URL is a relative URL, well, I still believe firefox's behavior is wrong.

* Boris mentions content negotiation; but in my case (Bug 370675), the request is issued as:

   Accept	image/png,*/*;q=0.5

How is that correct ? Shouldn't image/* be used ? If */* is acceptable, the server has no chance to handle the request correctly, does it ?

* No other browser behaves like this. Apart from demo pages, I don't think
anyone is depending on this behavior; on the other hand this mistake is a simple one to make and can cause real problems. I don't mean that standards don't matter, but probably we could get away with src="./" if we really want to reference the current URL ? Or something ?

* Worst case, couldn't this be changed in quirks mode ?

> * No other browser behaves like this. 

Actually, IE sometimes does, as I recall.  It's not consistent about it, but some sites broke when we had our old behavior (we used to ignore src="" altogether in all cases).  If someone can figure out exactly what IE does, we should consider changing what we do.

>   Accept       image/png,*/*;q=0.5

Sounds like people got overzealous about the Accept header.  Probably worth a bug.
As for quirks mode, there doesn't seem to be much serious harm here even if the site doesn't expect this, so I'm not sure it's worth the complexity and developer mind-print of a quirk.
Well, I really don't know how complex this would be to implement or in fact f my concept of what a quirk is matches the reality. I had that idea because it seems to be the way browsers deal with those parts of the standards that tend to surprise most people :p

Anyway, I do think it's potentially much more harmful than a wrongly computed font size: as somebody else pointed out in one of the duplicate bugs, users could end up buying something two times - all it takes is a site using GET instead of POST (and there's a lot of those) and an empty URL... 
Sites that are using GET instead of POST are already screwed -- there are tons of ways for a GET to be performed multiple times transparently to the user without this issue intervening (network hiccups, <meta> tags, etc, etc).
OS: Linux → All
Product: Mozilla Application Suite → Core
Hardware: PC → All
Is this fixed by bug 444931 now? 
Status: VERIFIED → RESOLVED
Closed: 21 years ago16 years ago
Resolution: INVALID → DUPLICATE
You need to log in before you can comment on or make changes to this bug.