Index: Source/WebCore/dom/Document.cpp |
=================================================================== |
--- Source/WebCore/dom/Document.cpp (revision 100576) |
+++ Source/WebCore/dom/Document.cpp (working copy) |
@@ -2377,12 +2377,16 @@ |
// DOM 3 Core: When the Document supports the feature "HTML" [DOM Level 2 HTML], the base URI is computed using |
// first the value of the href attribute of the HTML BASE element if any, and the value of the documentURI attribute |
// from the Document interface otherwise. |
- if (m_baseElementURL.isEmpty()) { |
+ if (!m_baseElementURL.isEmpty()) |
+ m_baseURL = m_baseElementURL; |
+ else if (!m_baseURLOverride.isEmpty()) |
+ m_baseURL = m_baseURLOverride; |
+ else { |
// The documentURI attribute is an arbitrary string. DOM 3 Core does not specify how it should be resolved, |
// so we use a null base URL. |
m_baseURL = KURL(KURL(), documentURI()); |
- } else |
- m_baseURL = m_baseElementURL; |
+ } |
+ |
if (!m_baseURL.isValid()) |
m_baseURL = KURL(); |
@@ -2392,6 +2396,12 @@ |
m_mappedElementSheet->setFinalURL(m_baseURL); |
} |
+void Document::setBaseURLOverride(const KURL& url) |
+{ |
+ m_baseURLOverride = url; |
+ updateBaseURL(); |
+} |
+ |
void Document::processBaseElement() |
{ |
// Find the first href attribute in a base element and the first target attribute in a base element. |