Commit e33f5101 authored by fs@opera.com's avatar fs@opera.com

Fix resolving protocol-agnostic <svg:image> URLs in about:blank iframes

When resolving a protocol-agnostic URL against a base of 'about:blank',
the result would be an invalid (and empty) URL, because of missing special-
casing of 'about:blank' - which is present in
Document::completeURLWithOverride.
Fix by modifying SVGImageLoader::sourceURI to always resolve the URL using
Document::completeURLWithOverride to not miss out on this special-casing
logic for 'about:blank' base URLs.

BUG=379100

Review URL: https://codereview.chromium.org/329943003

git-svn-id: svn://svn.chromium.org/blink/trunk@176043 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b21387e6
<!DOCTYPE html>
<style>
body {
margin: 0;
padding: 0;
}
</style>
<img src="/resources/square100.png">
<!DOCTYPE html>
<style>
iframe {
border: none;
}
body, iframe {
margin: 0;
padding: 0;
}
</style>
<script>
if (window.testRunner)
testRunner.waitUntilDone();
function finishTest() {
if (window.testRunner)
testRunner.notifyDone();
}
</script>
<iframe></iframe>
<script>
var iframe = document.querySelector('iframe');
iframe.contentWindow.finishTest = finishTest;
iframe.contentDocument.body.innerHTML =
'<style>body { margin: 0; padding: 0; }</style>'+
'<svg width="100" height="100">'+
'<image width="100" height="100" xlink:href="//localhost:8000/resources/square100.png" onload="finishTest()"></image>'+
'</svg>';
</script>
...@@ -47,9 +47,9 @@ void SVGImageLoader::dispatchLoadEvent() ...@@ -47,9 +47,9 @@ void SVGImageLoader::dispatchLoadEvent()
String SVGImageLoader::sourceURI(const AtomicString& attribute) const String SVGImageLoader::sourceURI(const AtomicString& attribute) const
{ {
KURL base = element()->baseURI(); KURL base = element()->baseURI();
if (base.isValid()) if (!base.isValid())
return KURL(base, stripLeadingAndTrailingHTMLSpaces(attribute)).string(); base = element()->document().baseURI();
return element()->document().completeURL(stripLeadingAndTrailingHTMLSpaces(attribute)); return element()->document().completeURLWithOverride(stripLeadingAndTrailingHTMLSpaces(attribute), base);
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment