Bug 169489 - Add iOS plumbing to WebProcess to enable JavaScriptCore configuration and logging
Summary: Add iOS plumbing to WebProcess to enable JavaScriptCore configuration and log...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Michael Saboff
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-03-10 15:49 PST by Michael Saboff
Modified: 2017-03-13 10:51 PDT (History)
2 users (show)

See Also:


Attachments
Patch (14.04 KB, patch)
2017-03-10 15:51 PST, Michael Saboff
joepeck: review-
Details | Formatted Diff | Diff
Updated patch addressing the issues of the initial patch. (8.11 KB, patch)
2017-03-11 22:11 PST, Michael Saboff
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Saboff 2017-03-10 15:49:29 PST
This is to add the ability to configure JavaScriptCore debug and logging from within the Web process for iOS through the presence of a configuration file.
Comment 1 Michael Saboff 2017-03-10 15:49:47 PST
<rdar://problem/30983159>
Comment 2 Michael Saboff 2017-03-10 15:51:24 PST
Created attachment 304088 [details]
Patch
Comment 3 WebKit Commit Bot 2017-03-10 16:10:23 PST
Attachment 304088 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h:72:  The parameter name "shouldCreateDirectory" adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 1 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Joseph Pecoraro 2017-03-10 17:40:10 PST
Comment on attachment 304088 [details]
Patch

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

r- while you clean up the unnecessary settings.

The only setting that appears to be used is WebProcess reading a default directly from standardUserDefaults. That makes some sense (instead of using WKPreferences) because you want this to happen before initializing any pages. All of the rest (WebCore::Settings, WebKitLegacy WebPreferences, and WebKit2 WebPreferences) are unused and only partially implemented, so they should be removed.

> Source/WebCore/page/Settings.in:188
> +javaScriptCoreUseConfigurationFileEnabled initial=false

I don't see this WebCore::Setting getting used anywhere. Seems it can just be removed.

> Source/WebKit2/Shared/WebPreferencesDefinitions.h:295
> +    macro(JavaScriptCoreUseConfigurationFileEnabled, javaScriptCoreUseConfigurationFileEnabled, Bool, bool, false, "", "") \

This also looks like it is unused.

> Source/WebKit2/UIProcess/API/APIWebsiteDataStore.cpp:153
> +String WebsiteDataStore::defaultJavaScriptConfigurationDirectory()

This doesn't make sense to put in WebSiteDataStore. This JavaScript Configuration file is not data that a place to store data that a website produces (caches, web storage, etc).

The configuration directory is just a path WebKit wants to check for a config file. Also, it appears to only be used inside of WebProcess construction so it doesn't need to leak out into other places.

I realize that this already made it into WebsiteDataStore earlier with r213690. It is my understanding that WebsiteDataStore was used for its ease of getting a path within the container. That can still be used via the static WebsiteDataStore::tempDirectoryFileSystemRepresentation function. I'd suggest cleaning this up later, but it isn't critical to clean up now.

> Source/WebKit2/WebProcess/WebPage/WebPage.cpp:3151
> +    settings.setJavaScriptCoreUseConfigurationFileEnabled(store.getBoolValueForKey(WebPreferencesKey::javaScriptCoreUseConfigurationFileEnabledKey()));

This WebCore::Setting isn't getting used.

> Source/WebKit/mac/WebView/WebPreferences.mm:449
> +        [NSNumber numberWithBool:NO],   WebKitJavaScriptCoreUseConfigFile,

This isn't used by anything either.
Comment 5 Michael Saboff 2017-03-11 22:11:19 PST
Created attachment 304187 [details]
Updated patch addressing the issues of the initial patch.
Comment 6 WebKit Commit Bot 2017-03-11 22:13:10 PST
Attachment 304187 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h:72:  The parameter name "shouldCreateDirectory" adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 1 in 8 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Geoffrey Garen 2017-03-13 10:47:40 PDT
Comment on attachment 304187 [details]
Updated patch addressing the issues of the initial patch.

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

r=me

> Source/WebKit2/UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:118
> +    if (shouldCreateDirectory == CreateDirectory
> +        && (![[NSFileManager defaultManager] createDirectoryAtURL:url withIntermediateDirectories:YES attributes:nil error:nullptr]))

I don't really think this is a security measure, but I guess it's nice to be able to limit logging to a specific app, so I guess this is good.
Comment 8 Michael Saboff 2017-03-13 10:51:56 PDT
Committed r213854: <http://trac.webkit.org/changeset/213854>