[webkit-help] DownloadPolicy help

Jack Wootton jackwootton at gmail.com
Thu Mar 11 08:24:30 PST 2010


I'm looking at webkit, specifically the way it handles HTTP errors.  Even
more specifically, how it handles HTTP errors with a Content Type (MIME
Type) of something other than the norm (html/text, plain/text).  For
example, I wanted to look into the handling of a content type of foo/foo
(for example).

My understanding after looking at the code, is that if the MIME Type cannot
be handled, a policy decision is made and policy is set to
WebCore::PolicyDownload. The method which determines which MIME Types can be
handled is:

bool WebPolicyManager::canShowMIMEType(const String& MIMEType) const

In this context, it always returns false, since it cannot handle foo/foo.

An edited version of the callstack so far looks like:

// Make a policy decision
function, const String& MIMEType, const ResourceRequest& request)

// Determine which MIME Types can be handled
bool WebPolicyManager::canShowMIMEType(const String& MIMEType) const

void MainResourceLoader::continueAfterContentPolicy(PolicyAction
contentPolicy, const ResourceResponse& r)

// I read this as "Interruption for policy change so change error."
ResourceError MainResourceLoader::interruptionForPolicyChangeError() const

My questions are:

1. What is the role of "policy" in this context (WebCore::PolicyIgnore,
WebCore::PolicyDownload, WebCore::PolicyUse)?

2. What specifically is the purpose of WebCore::EPolicyDownload? From the
name I kind of assumed that perhaps it was a way of the browser attempting
to download an application that can handle the MIME type.

3. Is there anywhere I can read more about this area of "policy" in WebKit?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20100311/524d7a50/attachment.html>

More information about the webkit-help mailing list