Index: third_party/WebKit/Source/core/dom/Document.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp |
index 575395007f8ab3d302e05cca6ea46b6a0ebcc58f..6a5661578eb88cb6cbb275fce3c2b41e5cc6024f 100644 |
--- a/third_party/WebKit/Source/core/dom/Document.cpp |
+++ b/third_party/WebKit/Source/core/dom/Document.cpp |
@@ -4312,6 +4312,15 @@ KURL Document::completeURLWithOverride(const String& url, const KURL& baseURLOve |
if (url.isNull()) |
return KURL(); |
// This logic is deliberately spread over many statements in an attempt to track down http://crbug.com/312410. |
+ const KURL& baseURL = baseURLForOverride(baseURLOverride); |
+ if (!encoding().isValid()) |
+ return KURL(baseURL, url); |
+ return KURL(baseURL, url, encoding()); |
+} |
+ |
+const KURL& Document::baseURLForOverride(const KURL& baseURLOverride) const |
+{ |
+ // This logic is deliberately spread over many statements in an attempt to track down http://crbug.com/312410. |
const KURL* baseURLFromParent = 0; |
bool shouldUseParentBaseURL = baseURLOverride.isEmpty(); |
if (!shouldUseParentBaseURL) { |
@@ -4322,10 +4331,7 @@ KURL Document::completeURLWithOverride(const String& url, const KURL& baseURLOve |
if (Document* parent = parentDocument()) |
baseURLFromParent = &parent->baseURL(); |
} |
- const KURL& baseURL = baseURLFromParent ? *baseURLFromParent : baseURLOverride; |
- if (!encoding().isValid()) |
- return KURL(baseURL, url); |
- return KURL(baseURL, url, encoding()); |
+ return baseURLFromParent ? *baseURLFromParent : baseURLOverride; |
} |
// Support for Javascript execCommand, and related methods |