Bug 38554

Summary: [Qt] The image plugin used for decoding images should be configurable
Product: WebKit Reporter: Benjamin Poulain <benjamin>
Component: WebKit APIAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Enhancement CC: diegohcg, jturcotte
Priority: P2 Keywords: Qt, QtTriaged
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
Initial implementation of configurable images loading. none

Description Benjamin Poulain 2010-05-04 16:29:53 PDT
Currently, all the images plugins can be used to decode images.

That can be a security issue, one might want to avoid some image formats when decoding images from the Web: Tiff, SVG (see https://bugs.webkit.org/show_bug.cgi?id=37826), mng for example.

We could add an API in QWebSettings to name explicitly the plugins that can be loaded:
QWebSettings::disableAutoImageLoading()
QWebSettings::enableImagePlugin("jpg");
Comment 1 Igor Trindade Oliveira 2011-04-14 12:52:05 PDT
Created attachment 89629 [details]
Initial implementation of configurable images loading.

Add initial implementation of configurable images auto loading.
Right now i am just handling png and jpeg and the public api will be changed.
Comment 2 Antonio Gomes 2011-04-17 22:21:38 PDT
Comment on attachment 89629 [details]
Initial implementation of configurable images loading.

View in context: https://bugs.webkit.org/attachment.cgi?id=89629&action=review

> Source/WebCore/page/Settings.cpp:57
> +    for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
> +        frame->document()->cachedResourceLoader()->setLoadJPEGImage(page->settings()->loadsSiteJPEGImagesIgnoringImageLoadingSetting());

this could be called outside the loop.

page->settings()->loadsSiteJPEGImagesIgnoringImageLoadingSetting()

> Source/WebCore/page/Settings.cpp:63
> +    for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
> +        frame->document()->cachedResourceLoader()->setLoadPNGImage(page->settings()->loadsSitePNGImagesIgnoringImageLoadingSetting());

Ditto

> Source/WebKit/qt/Api/qwebsettings.cpp:630
> +void QWebSettings::enableLoadingImage(const QString &image)

& positioned wrong.

The goal should be clean, and comments are needed.

> Source/WebKit/qt/Api/qwebsettings.cpp:638
> +    if (image == QLatin1String("jpeg"))
> +        d->settings->setLoadsSiteJPEGImagesIgnoringImageLoadingSetting(true);
> +    else if(image == QLatin1String("png"))
> +        d->settings->setLoadsSitePNGImagesIgnoringImageLoadingSetting(true);

Only caring about these two formats?
Comment 3 Jocelyn Turcotte 2014-02-03 03:16:28 PST
=== Bulk closing of Qt bugs ===

If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it and remove [Qt] from the summary.

If you believe that this is still an important QtWebKit bug, please fill a new report at https://bugreports.qt-project.org and add a link to this issue. See http://qt-project.org/wiki/ReportingBugsInQt for additional guidelines.