Bug 122604 - WebViews inside OS X screen savers have large caches, but should not
Summary: WebViews inside OS X screen savers have large caches, but should not
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac (Intel) OS X 10.8
: P2 Normal
Assignee: Adam Roben (:aroben)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-10 09:34 PDT by Adam Roben (:aroben)
Modified: 2013-10-12 21:04 PDT (History)
5 users (show)

See Also:


Attachments
Patch (2.03 KB, patch)
2013-10-10 09:38 PDT, Adam Roben (:aroben)
no flags Details | Formatted Diff | Diff
Patch (7.47 KB, patch)
2013-10-11 06:41 PDT, Adam Roben (:aroben)
no flags Details | Formatted Diff | Diff
Patch ignoring whitespace (4.05 KB, patch)
2013-10-11 06:43 PDT, Adam Roben (:aroben)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Roben (:aroben) 2013-10-10 09:34:59 PDT
WebViews inside OS X screen savers have large caches, but should not
Comment 1 Adam Roben (:aroben) 2013-10-10 09:38:55 PDT
Created attachment 213892 [details]
Patch
Comment 2 Alexey Proskuryakov 2013-10-10 10:08:22 PDT
This whole mechanism with hardcoded bundle IDs is so icky that I can't make myself r+ the patch. 

But I don't see anything wrong with the patch per se, it seems likely indeed that screen saver modules don't use WebViews to create a browser with back/forward navigation.
Comment 3 Geoffrey Garen 2013-10-10 11:59:10 PDT
Comment on attachment 213892 [details]
Patch

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

Hi Adam!

> Source/WebKit/mac/ChangeLog:10
> +        against legacy WebKit. ScreenSaverEngine.app doesn't link against
> +        WebKit at all, and thus falls into the legacy case by accident because
> +        NSVersionOfLinkTimeLibrary("WebKit") returns -1.

I don't think that was the original intent. Also, the new behavior has been around long enough that backwards-compatibility is less of a concern. I think we should give the new WebCacheModelDocumentViewer behavior to any app that does not link directly against WebKit.
Comment 4 Adam Roben (:aroben) 2013-10-10 12:08:37 PDT
Comment on attachment 213892 [details]
Patch

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

>> Source/WebKit/mac/ChangeLog:10
>> +        NSVersionOfLinkTimeLibrary("WebKit") returns -1.
> 
> I don't think that was the original intent. Also, the new behavior has been around long enough that backwards-compatibility is less of a concern. I think we should give the new WebCacheModelDocumentViewer behavior to any app that does not link directly against WebKit.

Are you also saying we should give WebCacheModelDocumentViewer behavior to apps linked against very old versions of WebKit?
Comment 5 Adam Roben (:aroben) 2013-10-10 12:10:22 PDT
(Hi Geoff!)
Comment 6 Geoffrey Garen 2013-10-10 15:20:05 PDT
> Are you also saying we should give WebCacheModelDocumentViewer behavior to apps linked against very old versions of WebKit?

Let's see... I don't think so.

I guess I'm saying this:

(1) Very old apps that link to WebKit should get the backwards-compatible thing (i.e., WebCacheModelDocumentBrowser, unless they're in the specific list of exceptions detailed by cacheModelForMainBundle).

(2) Old and/or new apps that don't link to WebKit at all should get the new thing (i.e., WebCacheModelDocumentViewer). It's reasonable to assume that, if you don't link to WebKit, you probably aren't a browser.

(3) New apps that do link to WebKit should get the new thing (i.e., WebCacheModelDocumentViewer).

I could be convinced either way on (1), since the use case is rare at this point. (2) and (3) seem essential. We don't want to surprise unsuspecting apps with high memory footprint.
Comment 7 Adam Roben (:aroben) 2013-10-11 04:06:02 PDT
OK, thanks for the clarification. I wanted to make sure I was interpreting your "backwards-compatibility" comment correctly, and I wasn't. New patch coming up!
Comment 8 Adam Roben (:aroben) 2013-10-11 06:41:43 PDT
Created attachment 213984 [details]
Patch
Comment 9 Adam Roben (:aroben) 2013-10-11 06:43:11 PDT
Created attachment 213985 [details]
Patch ignoring whitespace

Here's a copy of the patch with whitespace changes ignored, to make it easier to see the real changes without the indentation forced by @autoreleasepool {}.
Comment 10 Darin Adler 2013-10-12 20:39:14 PDT
Comment on attachment 213984 [details]
Patch

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

> Source/WebKit/mac/WebView/WebPreferences.mm:134
> +        if (contains(documentViewerIDs, sizeof(documentViewerIDs) / sizeof(documentViewerIDs[0]), bundleID))
> +            return WebCacheModelDocumentViewer;
> +        if (contains(documentBrowserIDs, sizeof(documentBrowserIDs) / sizeof(documentBrowserIDs[0]), bundleID))
> +            return WebCacheModelDocumentBrowser;
> +        if (contains(primaryWebBrowserIDs, sizeof(primaryWebBrowserIDs) / sizeof(primaryWebBrowserIDs[0]), bundleID))
> +            return WebCacheModelPrimaryWebBrowser;

As long as you were modernizing, you could have used WTF_ARRAY_LENGTH here.
Comment 11 WebKit Commit Bot 2013-10-12 21:04:17 PDT
Comment on attachment 213984 [details]
Patch

Clearing flags on attachment: 213984

Committed r157351: <http://trac.webkit.org/changeset/157351>
Comment 12 WebKit Commit Bot 2013-10-12 21:04:21 PDT
All reviewed patches have been landed.  Closing bug.