Closed
Bug 125085
(base)
Opened 23 years ago
Closed 23 years ago
BASE tag HREF attribute is not set correctly when page is saved to new location
Categories
(SeaMonkey :: Composer, defect)
Tracking
(Not tracked)
VERIFIED
INVALID
mozilla0.9.9
People
(Reporter: cmanske, Assigned: cmanske)
Details
(Whiteboard: publish, FIX IN HAND, need r=,sr=)
Attachments
(2 files, 1 obsolete file)
(deleted),
text/html
|
Details | |
(deleted),
patch
|
Details | Diff | Splinter Review |
nsEditorShell::OnLocationChange() is the callback used when the URL of a document
has changed after saving. There is some code there to detect a BASE element in
the head so it can update the new HREF, but that code is missing.
Assignee | ||
Comment 1•23 years ago
|
||
Assignee | ||
Updated•23 years ago
|
Assignee | ||
Comment 2•23 years ago
|
||
Here's complete block for better context:
nsCOMPtr<nsIDOMNode> baseNode;
if (nodeList)
{
PRUint32 count;
nodeList->GetLength(&count);
if (count >= 1)
{
rv = nodeList->Item(0, getter_AddRefs(baseNode));
if (NS_FAILED(rv)) return rv;
nsXPIDLCString newBaseUrl;
rv = aURI->GetSpec(getter_Copies(newBaseUrl));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDOMElement> baseElement = do_QueryInterface(baseNode);
//XXX INTERIM FIX: This is really not right!
// We shouldn't change this AFTER file is saved,
// it should be done before document is saved.
baseElement->SetAttribute(NS_LITERAL_STRING("href"),
NS_ConvertASCIItoUCS2(newBaseUrl));
}
}
// This is very important, else relative URLs for links and images are busted!
rv = doc->SetBaseURL(aURI);
Comment 3•23 years ago
|
||
I am not comfortable taking the fix here until we address the bug in
nsWebBrowserPersist which I filed earlier today (bug 125070?)
Assignee | ||
Comment 4•23 years ago
|
||
Assignee | ||
Comment 5•23 years ago
|
||
This fix is still needed for documents that already have a base tag.
The nsIWebBrowserPersist problem (always adding a base) tag just makes it much
more noticeable.
This problem *does* exist in NS6.2 release.
Test:
1. Save the attached Test file to a local drive.
2. Edit it with Composer. Look at HTML Source to see the base href =
"http://xxxxxxx.com"
3. Use "Save As" to save to a different name.
4. View HTML source again - the href should be changed to the new file url.
Assignee | ||
Updated•23 years ago
|
Assignee | ||
Updated•23 years ago
|
Assignee | ||
Comment 6•23 years ago
|
||
After further thought, we should NOT be changing a base tag href after file
saving, but we should *always* be setting the baseURL for the document when
document location changes.
Assignee | ||
Updated•23 years ago
|
Attachment #69107 -
Attachment is obsolete: true
Assignee | ||
Comment 7•23 years ago
|
||
Ok, take 3. There is not bug here. We should call SetBaseURL() only if there is
no base tag. If the base tag href is changed, that code should call SetBaseURL()
to keep the document baset and base tag href in synch.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
*** Bug 161651 has been marked as a duplicate of this bug. ***
Updated•20 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•