Bug 21781 - WebCore::Settings should have a maximum decoded image size setting
Summary: WebCore::Settings should have a maximum decoded image size setting
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
Depends on:
Reported: 2008-10-21 19:14 PDT by David Kilzer (:ddkilzer)
Modified: 2008-10-22 19:54 PDT (History)
1 user (show)

See Also:

Patch v1 (6.46 KB, patch)
2008-10-21 19:19 PDT, David Kilzer (:ddkilzer)
koivisto: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2008-10-21 19:14:05 PDT
It would be nice for WebCore::Settings to have a maximum image size setting to limit the size of images on some platforms.
Comment 1 David Kilzer (:ddkilzer) 2008-10-21 19:19:15 PDT
Created attachment 24549 [details]
Patch v1
Comment 2 Antti Koivisto 2008-10-22 12:17:47 PDT
Comment on attachment 24549 [details]
Patch v1

r=me, with some comments.

+        frame = docLoader() ? docLoader()->frame() : 0;

+    DocLoader* docLoader() const { return m_docLoader; }

The CachedResource::m_docLoader is non-zero only in some special cases (it should have a better name). Using m_request->docLoader() covers all cases we care about. These changes are probably not needed.

             // FIXME: I'm not convinced this case can even be hit.

I guess this FIXME can go now. We clearly can hit this case when maxImageSize is limited (plus it was not true even before). 

+        void setMaximumImageSize(size_t size) { m_maximumImageSize = size; }
+        size_t maximumImageSize() const { return m_maximumImageSize; }

How about maximumDecodedImageSize to avoid confusion between encoded and decoded size?
Comment 3 David Kilzer (:ddkilzer) 2008-10-22 19:53:20 PDT
Committed r37803
Comment 4 David Kilzer (:ddkilzer) 2008-10-22 19:54:09 PDT
(In reply to comment #2)
> (From update of attachment 24549 [details] [edit])
> r=me, with some comments.

I made all of these recommended changes before landing.