Summary: | Create an assertion mechanism to ensure proper WebCore use in each WebKit Process | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Brent Fulgham <bfulgham> | ||||
Component: | WebCore Misc. | Assignee: | Brent Fulgham <bfulgham> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | beidson, bfulgham, ddkilzer, rniwa, webkit-bug-importer | ||||
Priority: | P2 | Keywords: | InRadar | ||||
Version: | WebKit Nightly Build | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Bug Depends on: | |||||||
Bug Blocks: | 183911 | ||||||
Attachments: |
|
Description
Brent Fulgham
2018-03-20 21:41:54 PDT
Usage: In a method we want to protect, we can add an assertion describing the process privileges needed to execute the code: For example, for cookie access we might use this: ASSERT(WTF::hasProcessPrivilege(WTF::ProcessPrivilege::CanAccessRawCookies)); At the launch of the UIProcess we would use this method to ensure all privileges are available: WTF::setProcessPrivileges(WTF::ProcessPrivilege::All); In the network process, during platform initialization, we would use something like this: WTF::setProcessPrivileges(WTF::ProcessPrivilege::CanAccessRawCookies | WTF::ProcessPrivilege::CanAccessCredentials); In the WebContent process, we would not set any privileges. We could just leave it as the default initialization, or use this: WTF::setProcessPrivileges(WTF::ProcessPrivilege::None); Later, when we attempt to execute the initial code, we would expect an assertion for WebContent process, while Network and UIProcess pass the assertion. Created attachment 336178 [details]
Patch
Comment on attachment 336178 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=336178&action=review r=me with the use of OptionSet. > Source/WTF/wtf/ProcessPrivilege.h:39 > +WTF_EXPORT void setProcessPrivileges(unsigned /* bitmap of privileges */); > +WTF_EXPORT bool hasProcessPrivilege(ProcessPrivilege); Please use OptionSet<ProcessPrivilege>. (In reply to Ryosuke Niwa from comment #4) > Comment on attachment 336178 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=336178&action=review > > r=me with the use of OptionSet. > > > Source/WTF/wtf/ProcessPrivilege.h:39 > > +WTF_EXPORT void setProcessPrivileges(unsigned /* bitmap of privileges */); > > +WTF_EXPORT bool hasProcessPrivilege(ProcessPrivilege); > > Please use OptionSet<ProcessPrivilege>. Will do. Committed r229845: <https://trac.webkit.org/changeset/229845> |