NEW 123803
[WIN] Add a wrapper for setting the default settings
https://bugs.webkit.org/show_bug.cgi?id=123803
Summary [WIN] Add a wrapper for setting the default settings
Patrick R. Gansterer
Reported 2013-11-05 07:44:42 PST
[WIN] Add a wrapper for setting the default settings
Attachments
Patch (15.84 KB, patch)
2013-11-05 07:47 PST, Patrick R. Gansterer
no flags
Patch (15.87 KB, patch)
2013-11-06 16:04 PST, Patrick R. Gansterer
beidson: review-
Patrick R. Gansterer
Comment 1 2013-11-05 07:47:37 PST
Brent Fulgham
Comment 2 2013-11-06 10:12:45 PST
Comment on attachment 216040 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=216040&action=review This change is likely to introduce stability problems as versions of CoreFoundation or WebKit are changed out independently. > Source/WebKit/win/WebPreferences.cpp:116 > + RetainPtr<CFStringRef> cfValue = adoptCF(CFStringCreateWithCStringNoCopy(0, value, kCFStringEncodingASCII, 0)); This doesn't properly duplicate the behavior of the CFSTR macro. CFSTR(a) maps to __CFStringMakeConstantString(a), which builds a cached string value internally so that subsequent calls get the 'same' object back. We definitely don't want to use "CFStringCreateWithCStringNoCopy" because we can have allocator differences between the C++ RTL and whatever was used to build the specific version of CoreFoundation used with WebKit. It would be better to change this to CFStringCreateWithCString (allowing a copy to be made by the CoreFoundation allocator), and better still to use the __CFStringMakeConstantString method call.
Patrick R. Gansterer
Comment 3 2013-11-06 16:04:12 PST
Patrick R. Gansterer
Comment 4 2013-11-06 16:05:46 PST
Comment on attachment 216236 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=216236&action=review > Source/WebKit/win/WebPreferences.cpp:116 > + RetainPtr<CFStringRef> cfValue = adoptCF(CFStringCreateWithCStringNoCopy(0, value, kCFStringEncodingASCII, kCFAllocatorNull)); I added the missing kCFAllocatorNull, since all strings are compile-time-strings without allocation.
Alex Christensen
Comment 5 2014-01-31 23:52:30 PST
I'd do something like this to mimic existing behavior without a setInternal function: void set(const char* key, const char* value) { CFDictionaryAddValue(m_dictionary.get(), __CFStringMakeConstantString(key), __CFStringMakeConstantString(value)); } void set(const char* key, bool value) { CFDictionaryAddValue(m_dictionary.get(), __CFStringMakeConstantString(key), value ? kCFBooleanTrue : kCFBooleanFalse); } void set(const char* key, const String& value) { CFDictionaryAddValue(m_dictionary.get(), __CFStringMakeConstantString(key), value.createCFString().get()); }
Brady Eidson
Comment 6 2016-05-24 22:05:02 PDT
Comment on attachment 216236 [details] Patch Assuming that patches for review since 2013 are stale, r-
Note You need to log in before you can comment on or make changes to this bug.