Commit eccbfd32 authored by andersca@apple.com's avatar andersca@apple.com

* WebProcess/WebPage/WebFrame.cpp:

(WebKit::WebFrame::url):
Get the URL from the loader, not from the document.

Reviewed by Sam Weinig.

(WebKit::WebFrame::suggestedFilenameForResourceWithURL):
Return the correct suggested filename for the main resource.

(WebKit::WebFrame::mimeTypeForResourceWithURL):
Return the correct mime type for the main resource.



git-svn-id: svn://svn.chromium.org/blink/trunk@80945 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 433cdb1a
2011-03-12 Anders Carlsson <andersca@apple.com>
Reviewed by Sam Weinig.
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::url):
Get the URL from the loader, not from the document.
(WebKit::WebFrame::suggestedFilenameForResourceWithURL):
Return the correct suggested filename for the main resource.
(WebKit::WebFrame::mimeTypeForResourceWithURL):
Return the correct mime type for the main resource.
2011-03-12 Anders Carlsson <andersca@apple.com> 2011-03-12 Anders Carlsson <andersca@apple.com>
Reviewed by Sam Weinig. Reviewed by Sam Weinig.
......
...@@ -335,7 +335,11 @@ String WebFrame::url() const ...@@ -335,7 +335,11 @@ String WebFrame::url() const
if (!m_coreFrame) if (!m_coreFrame)
return String(); return String();
return m_coreFrame->document()->url().string(); DocumentLoader* documentLoader = m_coreFrame->loader()->documentLoader();
if (!documentLoader)
return String();
return documentLoader->url().string();
} }
String WebFrame::innerText() const String WebFrame::innerText() const
...@@ -611,7 +615,12 @@ String WebFrame::suggestedFilenameForResourceWithURL(const KURL& url) const ...@@ -611,7 +615,12 @@ String WebFrame::suggestedFilenameForResourceWithURL(const KURL& url) const
DocumentLoader* loader = m_coreFrame->loader()->documentLoader(); DocumentLoader* loader = m_coreFrame->loader()->documentLoader();
if (!loader) if (!loader)
return String(); return String();
// First, try the main resource.
if (loader->url() == url)
return loader->response().suggestedFilename();
// Next, try subresources.
RefPtr<ArchiveResource> resource = loader->subresource(url); RefPtr<ArchiveResource> resource = loader->subresource(url);
if (!resource) if (!resource)
return String(); return String();
...@@ -627,7 +636,12 @@ String WebFrame::mimeTypeForResourceWithURL(const KURL& url) const ...@@ -627,7 +636,12 @@ String WebFrame::mimeTypeForResourceWithURL(const KURL& url) const
DocumentLoader* loader = m_coreFrame->loader()->documentLoader(); DocumentLoader* loader = m_coreFrame->loader()->documentLoader();
if (!loader) if (!loader)
return String(); return String();
// First, try the main resource.
if (loader->url() == url)
return loader->response().mimeType();
// Next, try subresources.
RefPtr<ArchiveResource> resource = loader->subresource(url); RefPtr<ArchiveResource> resource = loader->subresource(url);
if (resource) if (resource)
return resource->mimeType(); return resource->mimeType();
......
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