Bug 121883

Summary: [Windows] Refactor RuntimeEnabledFeatures as a Singleton to prevent crashes caused by cross-DLL boundary access
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: WebKit Misc.Assignee: Brent Fulgham <bfulgham>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, betravis, bfulgham, buildbot, eflews.bot, gtk-ews, gyuyoung.kim, jer.noble, philn, rniwa, webkit-ews, xan.lopez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Updated after removal of HTMLContentElement.cpp
none
Patch
none
Removed offending WebCore.exp.in entries
none
Removed typo from WebCore.exp.in
none
Updated with missing symbol in WebCore.exp.in jer.noble: review+

Brent Fulgham
Reported 2013-09-24 17:21:31 PDT
The RuntimeEnabledFeatures pseudo-singleton class has a number of inline getters and setters. When these are used to access the static members of the class across a DLL boundary, we are encountering crashes under Windows. While this seems to be behavior specific to Visual Studio, it is not a good design and should be refactored to act as a 'real' Singleton object to avoid non-deterministic behavior for reading/writing this memory.
Attachments
Patch (99.21 KB, patch)
2013-09-24 18:33 PDT, Brent Fulgham
no flags
Patch (125.19 KB, patch)
2013-09-25 10:43 PDT, Brent Fulgham
no flags
Updated after removal of HTMLContentElement.cpp (124.28 KB, patch)
2013-09-25 10:57 PDT, Brent Fulgham
no flags
Patch (124.41 KB, patch)
2013-09-25 11:19 PDT, Brent Fulgham
no flags
Removed offending WebCore.exp.in entries (126.61 KB, patch)
2013-09-25 12:05 PDT, Brent Fulgham
no flags
Removed typo from WebCore.exp.in (126.42 KB, patch)
2013-09-25 13:39 PDT, Brent Fulgham
no flags
Updated with missing symbol in WebCore.exp.in (126.48 KB, patch)
2013-09-25 14:15 PDT, Brent Fulgham
jer.noble: review+
Brent Fulgham
Comment 1 2013-09-24 18:33:21 PDT
Early Warning System Bot
Comment 2 2013-09-24 18:41:34 PDT
Early Warning System Bot
Comment 3 2013-09-24 18:43:07 PDT
EFL EWS Bot
Comment 4 2013-09-24 18:50:39 PDT
Build Bot
Comment 5 2013-09-24 19:16:54 PDT
Build Bot
Comment 6 2013-09-24 19:23:24 PDT
kov's GTK+ EWS bot
Comment 7 2013-09-24 19:42:24 PDT
EFL EWS Bot
Comment 8 2013-09-24 19:44:40 PDT
Jer Noble
Comment 9 2013-09-25 08:30:32 PDT
Comment on attachment 212529 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=212529&action=review Awesome. Just a few nits. > Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp:142 > +RuntimeEnabledFeatures& RuntimeEnabledFeatures::sharedRuntimeEnabledFeatures() RuntimeEnabledFeatures::sharedRuntimeEnabledFeatures() seems a bit redundant. How about RuntimeEnabledFeatures::sharedFeatures()? > Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h:45 > class RuntimeEnabledFeatures { > public: You should add WTF_MAKE_NONCOPYABLE(RuntimeEnabledFeatures) here now that we have an instance. > Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h:317 > + bool isLocalStorageEnabled; > + bool isSessionStorageEnabled; > + bool isWebkitNotificationsEnabled; > + bool isApplicationCacheEnabled; > + bool isDataTransferItemsEnabled; > + bool isGeolocationEnabled; > + bool isIndexedDBEnabled; > + bool isTouchEnabled; > + bool isDeviceMotionEnabled; > + bool isDeviceOrientationEnabled; > + bool isSpeechInputEnabled; > + bool isCanvasPathEnabled; > + bool isCSSExclusionsEnabled; > + bool isCSSShapesEnabled; > + bool isCSSRegionsEnabled; > + bool isCSSCompositingEnabled; > + bool isLangAttributeAwareFormControlUIEnabled; While we're cleaning up bad coding style, we should really make all these variables conform to WebKit Coding Style, with m_ prefixes for each.
Brent Fulgham
Comment 10 2013-09-25 10:43:41 PDT
Brent Fulgham
Comment 11 2013-09-25 10:57:04 PDT
Created attachment 212604 [details] Updated after removal of HTMLContentElement.cpp
Brent Fulgham
Comment 12 2013-09-25 11:01:37 PDT
Once this patch is in place we can reactivate CSS Shapes on Windows (i.e., revert Bug 121879).
Early Warning System Bot
Comment 13 2013-09-25 11:07:29 PDT
Comment on attachment 212604 [details] Updated after removal of HTMLContentElement.cpp Attachment 212604 [details] did not pass qt-wk2-ews (qt-wk2): Output: http://webkit-queues.appspot.com/results/2212053
Early Warning System Bot
Comment 14 2013-09-25 11:13:08 PDT
Comment on attachment 212604 [details] Updated after removal of HTMLContentElement.cpp Attachment 212604 [details] did not pass qt-ews (qt): Output: http://webkit-queues.appspot.com/results/2217054
Brent Fulgham
Comment 15 2013-09-25 11:19:07 PDT
Build Bot
Comment 16 2013-09-25 11:51:26 PDT
Brent Fulgham
Comment 17 2013-09-25 12:05:19 PDT
Created attachment 212612 [details] Removed offending WebCore.exp.in entries
Brent Fulgham
Comment 18 2013-09-25 12:26:10 PDT
Comment on attachment 212612 [details] Removed offending WebCore.exp.in entries Watching the mac/mac-wk2 bots. They will probably fail one more time to show me the symbol I need to add to WebCore.exp.in to support the new Singleton object.
Build Bot
Comment 19 2013-09-25 12:45:11 PDT
Comment on attachment 212612 [details] Removed offending WebCore.exp.in entries Attachment 212612 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/2224054
Build Bot
Comment 20 2013-09-25 13:08:18 PDT
Comment on attachment 212612 [details] Removed offending WebCore.exp.in entries Attachment 212612 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/2220014
Brent Fulgham
Comment 21 2013-09-25 13:39:01 PDT
Created attachment 212620 [details] Removed typo from WebCore.exp.in
Build Bot
Comment 22 2013-09-25 14:11:32 PDT
Comment on attachment 212620 [details] Removed typo from WebCore.exp.in Attachment 212620 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/2240010
Brent Fulgham
Comment 23 2013-09-25 14:15:24 PDT
Created attachment 212625 [details] Updated with missing symbol in WebCore.exp.in
Jer Noble
Comment 24 2013-09-25 14:18:40 PDT
Comment on attachment 212625 [details] Updated with missing symbol in WebCore.exp.in r=me
Brent Fulgham
Comment 25 2013-09-25 15:18:22 PDT
Csaba Osztrogonác
Comment 26 2013-10-29 08:38:08 PDT
Comment on attachment 212625 [details] Updated with missing symbol in WebCore.exp.in View in context: https://bugs.webkit.org/attachment.cgi?id=212625&action=review > Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h:419 > +#ifndef CLASS_IF_GCC > +#if COMPILER(GCC) > +#define CLASS_IF_GCC class > +#else > +#define CLASS_IF_GCC > +#endif > +#endif > + friend CLASS_IF_GCC NeverDestroyed<RuntimeEnabledFeatures>; Sooooooo ugly. :-/ Is it a well-known MSVC bug? It seems we ran into the same bug in https://bugs.webkit.org/show_bug.cgi?id=123442 But I prefer a general fix for it instead of adding workarounds everywhere.
Note You need to log in before you can comment on or make changes to this bug.