Bug 21499 - HTML content set by QWebView::setHtml can't access local files
Summary: HTML content set by QWebView::setHtml can't access local files
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: All Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: Qt
Depends on:
Blocks:
 
Reported: 2008-10-09 02:48 PDT by Bernhard Rosenkraenzer
Modified: 2009-11-23 05:28 PST (History)
2 users (show)

See Also:


Attachments
Suggested fix (1.60 KB, patch)
2008-10-09 07:24 PDT, Bernhard Rosenkraenzer
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bernhard Rosenkraenzer 2008-10-09 02:48:20 PDT
Loading images from the local filesystem (file:/ URLs) fails in current snapshots if the HTML code has been set by QWebView::setHtml (e.g. HTML code generated on the fly by a local application) as opposed to having been loaded from a file:/ URL.

This is caused by current WebKit defaulting FrameLoader::localLoadPolicy to AllowLocalLoadsForLocalOnly (as opposed to AllowLocalLoadsForLocalAndSubstituteData), and the QtWebKit API not having the functionality to override this.

There should be a way to set FrameLoader::localLoadPolicy through the QtWebKit API (QWebSettings::globalSettings()->setAttribute(QWebSettings::allowLocalLoads); or something?).
For compatibility with some legacy applications, it may also make sense to have the option to set localLoadPolicy to AllowLocalLoadsForAll, the way it used to be in older WebKit versions.
Comment 1 Bernhard Rosenkraenzer 2008-10-09 07:24:42 PDT
Created attachment 24231 [details]
Suggested fix

Suggested fix
Comment 2 nacho 2009-01-22 03:10:02 PST
ok this bug is solved changing in FrameLoader.cpp the code 

static FrameLoader::LocalLoadPolicy localLoadPolicy = FrameLoader::AllowLocalLoadsForLocalOnly for

static FrameLoader::LocalLoadPolicy localLoadPolicy = FrameLoader::AllowLocalLoadsForAll. 

But now, I can't to access an image provided by a AdServer. 
	
Are there any restrictions on access to external images?
Comment 3 Simon Hausmann 2009-11-23 05:28:14 PST
Fixed in http://trac.webkit.org/changeset/38493