Bug 115448

Summary: ipc-posix-shm backwards compatibility
Product: WebKit Reporter: Simon Cooper <scooper>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Major CC: ap, commit-queue, mrowe, scooper
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.7   
Attachments:
Description Flags
Patch none

Description Simon Cooper 2013-04-30 15:06:29 PDT
Need backwards compatibility for older ipc-posix-shm operations.
Comment 1 Simon Cooper 2013-04-30 17:35:28 PDT
Created attachment 200194 [details]
Patch
Comment 2 Alexey Proskuryakov 2013-04-30 22:26:46 PDT
Comment on attachment 200194 [details]
Patch

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

r=me

> Source/WebKit2/Resources/PlugInSandboxProfiles/com.apple.WebKit.plugin-common.sb:250
> +(if (not (defined? 'ipc-posix-shm*))
> +    (define ipc-posix-shm* ipc-posix-shm))

I wish we pre-processed plug-in sandbox profile files, so that we could do conditional compilation. With an #if check, removing obsolete code is much more straightforward.

Also, we wouldn't have to merge parts at runtime, as we could simply #include "com.apple.WebKit.plugin-common.sb", and let preprocessor build a complete profile.
Comment 3 WebKit Commit Bot 2013-04-30 23:07:57 PDT
Comment on attachment 200194 [details]
Patch

Clearing flags on attachment: 200194

Committed r149427: <http://trac.webkit.org/changeset/149427>
Comment 4 WebKit Commit Bot 2013-04-30 23:08:00 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Simon Cooper 2013-05-01 14:48:20 PDT
(In reply to comment #2)
> (From update of attachment 200194 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=200194&action=review
> 
> r=me
> 
> > Source/WebKit2/Resources/PlugInSandboxProfiles/com.apple.WebKit.plugin-common.sb:250
> > +(if (not (defined? 'ipc-posix-shm*))
> > +    (define ipc-posix-shm* ipc-posix-shm))
> 
> I wish we pre-processed plug-in sandbox profile files, so that we could do conditional compilation. With an #if check, removing obsolete code is much more straightforward.

This isn't obsolete code -- it provides backwards compatibility.

> Also, we wouldn't have to merge parts at runtime, as we could simply #include "com.apple.WebKit.plugin-common.sb", and let preprocessor build a complete profile.

This is not a good idea. 

- This will not work if the AppleConnect profile is moved to a different project.

- Forcing cpp preprocessing means that some sort of  "compilation step" has to occur before passing to sandbox which makes it harder to develop and debug profiles.
Comment 6 Alexey Proskuryakov 2013-05-01 15:02:34 PDT
> This isn't obsolete code -- it provides backwards compatibility.

It will be obsolete relatively soon, at which point we'll certainly forget to remove it, because there is no indication in code about when it can be removed. We know this currently, and being good forward looking engineers, we can pave the path now.

Conditional compilation macros is how we do this in other code, so this would be the most straightforward way for profiles too.

> - This will not work if the AppleConnect profile is moved to a different project.

I can't agree with that. In fact, it's the opposite - having half of the profile in WebKit and another half in a different project is not workable long term.

> - Forcing cpp preprocessing means that some sort of  "compilation step" has to occur before passing to sandbox which makes it harder to develop and debug profiles.

We perform preprocessing for some of the profiles, and haven't had any issues with that yet.
Comment 7 Simon Cooper 2013-05-01 18:20:04 PDT
(In reply to comment #6)
> > This isn't obsolete code -- it provides backwards compatibility.
> 
> It will be obsolete relatively soon, at which point we'll certainly forget to remove it, because there is no indication in code about when it can be removed. We know this currently, and being good forward looking engineers, we can pave the path now.

If that is the issue, it can certainly be addressed.  What specifically do you need to see?
Comment 8 Alexey Proskuryakov 2013-05-01 21:49:07 PDT
CC'ing Mark, as I think that he is the one who most frequently does such cleanup. I _think_ that preprocessor checks like "#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1070" would make it easiest.

Alternatively, a FIXME comment explaining when the code can be removed would help us do that eventually, even if with a bit more manual work.