[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Should child frames have the base URL of the parent?
From: David Faure <faure () kde ! org>
Date: 2010-11-18 11:20:51
Message-ID: 201011181220.51621.faure () kde ! org
[Download RAW message or body]
Hello (Maksim?)
Today a Joomla developer came to #khtml and I tested some things for him,
and while doing that I found a bug: editing a webpage with an image didn't
load the image, because the base URL was empty -- so with
img src="images/foo.jpeg", it would try to load file:///images/foo.jpeg instead
of loading it from the website.
Testcase:
http://rouvenwessling.de/nokonk/index.php, login with toto/toto, follow link
to Sample Sites, Australian Parks, note the nice lake, click on the Edit icon
above it -> in the rich text editor that comes up (TinyMCE), the lake shows up
as a broken icon.
Or open this direct URL once you're logged in:
http://rouvenwessling.de/nokonk/index.php?option=com_content&view=form&layout=edit&id=6&Itemid=243
Investigation: a child frame is created for rendering the HTML, and that frame
gets an empty "base URL" by default.
My fix: setting the base URL of the parent frame, see attached patch. But I
have no idea if this is the right way to do things, or if this might break
countless websites with frames/iframes/objects.
--
David Faure, faure@kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).
["khtml_part_base_url.diff" (text/x-patch)]
Index: khtml_part.cpp
===================================================================
--- khtml_part.cpp (revision 1198108)
+++ khtml_part.cpp (working copy)
@@ -2046,7 +2046,12 @@
d->m_doc->open( );
if (!d->m_doc->attached())
d->m_doc->attach( );
- d->m_doc->setBaseURL( KUrl() );
+
+ KHTMLPart* parentHTMLPart = qobject_cast<KHTMLPart*>(parentPart());
+ if (parentHTMLPart)
+ d->m_doc->setBaseURL( parentHTMLPart->d->m_doc->baseURL() );
+ else
+ d->m_doc->setBaseURL( KUrl() );
d->m_doc->docLoader()->setShowAnimations( KHTMLGlobal::defaultHTMLSettings()->showAnimations() );
emit docCreated();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic