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)

x86
Windows 2000
defect
Not set
normal

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)

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.
Attached patch Fix (obsolete) (deleted) — Splinter Review
Status: NEW → ASSIGNED
Keywords: nsbeta1+, patch, review
Whiteboard: FIX IN HAND, need r=,sr=
Target Milestone: --- → mozilla0.9.9
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);
I am not comfortable taking the fix here until we address the bug in nsWebBrowserPersist which I filed earlier today (bug 125070?)
Keywords: nsbeta1+, patch, review
Whiteboard: FIX IN HAND, need r=,sr=
Target Milestone: mozilla0.9.9 → ---
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.
Keywords: nsbeta1
Whiteboard: publish, FIX IN HAND, need r=,sr=
Target Milestone: --- → mozilla0.9.9
Keywords: nsbeta1nsbeta1+
Attached patch updated fix (deleted) — Splinter Review
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.
Attachment #69107 - Attachment is obsolete: true
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
v
Status: RESOLVED → VERIFIED
Alias: base
*** Bug 161651 has been marked as a duplicate of this bug. ***
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: