[X]HTML <base> Tag with Relative Value (e.g. '../..') Fails to Correctly Resolve

RESOLVED DUPLICATE of bug 515401

Status

()

RESOLVED DUPLICATE of bug 515401
9 years ago
7 years ago

People

(Reporter: gerickson, Unassigned)

Tracking

Trunk
mozilla2.0
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

9 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6

In the process of developing pages for our site, we routinely use the <base href="<value>"> tag to ensure that little but that tag needs to change as we reorganize the site. However, to flexibly accommodate whether we are "live" at http://www.nuovations.com/ or running locally in development either at a 'file:///...' or 'http://localhost/~user/www.nuovations.com/', we use relative values for base such as:

about.html:	<base href="." />
careers.html:	<base href="." />
company.html:	<base href="." />
contact.html:	<base href="." />
index.html:	<base href="." />
investors.html:	<base href="." />
management.html:	<base href="." />
news/index.html:	<base href="../" />
products/index.html:	<base href=".." />
services/index.html:	<base href="../" />

While this works well in Safari regardless of URL, this completely fails in Firefox resulting in a basic page rendered with broken links and no styling.

Reproducible: Always

Steps to Reproduce:
1. Create a set of very simple web pages, images and a style sheet such as the attached archive.
2. Position the archive such that your web server can resolve the pages through both the file and http scheme.
3. Adjust the base href tag values of the works/file.html and works/http.html files as appropriate for (2).
4. Access base/index.html via either file:/// or http://.
Actual Results:  
The file/link fails/relative.html does not render in red text with a red color swatch image.

Expected Results:  
The file fails/relative.html should have rendered in red text with a red color swatch image.

It's unclear whether Safari is doing something outside the intended specification of the value attribute of the base tag, it ends up being very valuable. It'd be fantastic if Mozilla handled this relative path use of <base href="<value>" /> in the same way.
(Reporter)

Comment 1

9 years ago
Created attachment 433172 [details]
This test case demonstrates how the base tag fails in Firefox when href contains a relative value.
http://www.w3.org/TR/html401/struct/links.html#h-12.4

This attribute specifies an absolute URI that acts as the base URI for resolving relative URIs

Looks like Safari is wrong.
(In reply to comment #2)
> http://www.w3.org/TR/html401/struct/links.html#h-12.4

HTML4 is obsolete. The current implementation reference for <base href> is
http://www.whatwg.org/specs/web-apps/current-work/#document-base-url
On the other hand, it's not clear to me that the HTML5 stuff on this is final.  

Generally, we've been marking bug reports about this issue as duplicates of bug 56280.  If we want a bug on implementing the HTML5 behavior, we need to either morph this bug or file a new one on that (and mark this one duplicate of bug 56280).
Not parser. sicking may have fixed this recently.
Component: HTML: Parser → DOM: Core & HTML
QA Contact: parser → general
This was fixed much before my patch. Dunno when we started supporting relative urls, but they should have worked fine for a while.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → WORKSFORME
Hum, I wonder if this bug was never about relative <base href>s. I didn't notice before that this bug was filed as recently as it was. We've supported relative <base href>s since much before march 2010.

You might be running in to the local file security policy. I.e. we don't support accessing (and possibly even linking to) resources that are in directories higher up than the current document. This is to prevent a file saved from the internet from accessing password files and other sensitive information on your computer.

Do things work if you put the files on a web sever rather than reading from local files?
(Reporter)

Comment 8

8 years ago
No, per the original description, the test cases fail regardless of whether using the 'file' scheme or 'http' scheme.
> We've supported relative <base href>s since much before march 2010.

The bug is filed on Firefox 3.6 (gecko 1.9.2), which branched in November 2009.  Gecko 1.9.2 doesn't support relative <base href>.  See 
https://hg.mozilla.org/releases/mozilla-1.9.2/file/c846b94321ee/content/html/document/src/nsHTMLContentSink.cpp#l2848 and note the null base URI passed to the newURI call.

In fact, that's the behavior we had till bug 515401 was fixed; that happend around April 23, 2010.  So I dunno where comment 6 is coming from.... ;)
Hum, ok then. I guess I fixed this bug in bug 515401 then :)
Resolution: WORKSFORME → FIXED

Updated

8 years ago
Duplicate of this bug: 56280

Updated

8 years ago
Keywords: dev-doc-needed
Removing doc-needed; the <base> element had not previously had documentation but does now, and it seems to be correct in this regard.
Keywords: dev-doc-needed

Updated

7 years ago
Duplicate of this bug: 202472

Updated

7 years ago
Duplicate of this bug: 241471

Updated

7 years ago
Duplicate of this bug: 249881

Updated

7 years ago
Target Milestone: --- → mozilla2.0
Resolution: FIXED → DUPLICATE
Version: unspecified → Trunk
Duplicate of bug: 515401
You need to log in before you can comment on or make changes to this bug.