Bug 93138

Summary: Cleanup locations of various checks in requestPlugin and loadPlugin
Product: WebKit Reporter: Mike West <mkwst>
Component: WebCore Misc.Assignee: Mike West <mkwst>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, japhet, jochen, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 92649    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch none

Mike West
Reported 2012-08-03 10:24:04 PDT
For example, the sandbox check should be by the Content Security Policy check.
Attachments
Patch (7.28 KB, patch)
2012-08-04 11:54 PDT, Mike West
no flags
Patch (7.38 KB, patch)
2012-08-04 14:08 PDT, Mike West
no flags
Mike West
Comment 1 2012-08-04 11:54:33 PDT
Mike West
Comment 2 2012-08-04 11:56:24 PDT
What do you think about this, Adam and Jochen (since I think both you know things about SubframeLoader)? I think it makes sense to extract these tests out into a separate method, but the structure as it stands isn't terribly clear to me. Is there a good reason to have both requestPlugin and loadPlugin? Perhaps we could simply merge them?
Adam Barth
Comment 3 2012-08-04 12:18:37 PDT
Comment on attachment 156535 [details] Patch Makes sense. Usually we phrase these sorts of functions in terms of what's allowed rather than what's blocked to avoid having too many confusing double negatives.
Adam Barth
Comment 4 2012-08-04 12:24:52 PDT
Comment on attachment 156535 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=156535&action=review > Source/WebCore/loader/SubframeLoader.cpp:116 > + if (document() && document()->securityOrigin()->isLocal() && !settings->isJavaEnabledForLocalFiles()) For a followup patch, I wonder if we should be getting the document from the pluginElement. That way we'll always find it and we can remove these null checks.
Mike West
Comment 5 2012-08-04 12:36:25 PDT
(In reply to comment #3) > (From update of attachment 156535 [details]) > Makes sense. Usually we phrase these sorts of functions in terms of what's allowed rather than what's blocked to avoid having too many confusing double negatives. There's already `allowPlugins`, which (I think) is more concerned with content settings. I'm not sure it makes a lot of sense to have `allowPlugins?` directly followed by `isPluginAllowed?`. Conceptually, it's clear ("Are plugins allowed, in general?" is a different question to "Is this specific plugin allowed?"), but it doesn't read well. I'd originally planned to push the `isSandboxed` check into `allowPlugins` (since it falls into the former question), but stopped since it would have the side-effect of notifying `didNotAllowPlugins`, which I think Chromium does something interesting with. Any thoughts on that split?
Adam Barth
Comment 6 2012-08-04 12:38:21 PDT
> There's already `allowPlugins`, which (I think) is more concerned with content settings. I'm not sure it makes a lot of sense to have `allowPlugins?` directly followed by `isPluginAllowed?`. Conceptually, it's clear ("Are plugins allowed, in general?" is a different question to "Is this specific plugin allowed?"), but it doesn't read well. > > I'd originally planned to push the `isSandboxed` check into `allowPlugins` (since it falls into the former question), but stopped since it would have the side-effect of notifying `didNotAllowPlugins`, which I think Chromium does something interesting with. > > Any thoughts on that split? I think it's better to keep the sandbox check separate. That's what we do in other cases. Perhaps shouldLoadPlugin(...) is a good name for the function?
Mike West
Comment 7 2012-08-04 12:49:22 PDT
(In reply to comment #6) > > There's already `allowPlugins`, which (I think) is more concerned with content settings. I'm not sure it makes a lot of sense to have `allowPlugins?` directly followed by `isPluginAllowed?`. Conceptually, it's clear ("Are plugins allowed, in general?" is a different question to "Is this specific plugin allowed?"), but it doesn't read well. > > > > I'd originally planned to push the `isSandboxed` check into `allowPlugins` (since it falls into the former question), but stopped since it would have the side-effect of notifying `didNotAllowPlugins`, which I think Chromium does something interesting with. > > > > Any thoughts on that split? > > I think it's better to keep the sandbox check separate. That's what we do in other cases. Perhaps shouldLoadPlugin(...) is a good name for the function? Makes sense. However, there's already `shouldUsePlugin`, which determines whether the plugin rendering process should be kicked off for a particular resource. I've been sitting here about 5 minutes typing new suggestions for names, and then backspacing over them. :)
Mike West
Comment 8 2012-08-04 12:51:24 PDT
(In reply to comment #7) > (In reply to comment #6) > > > There's already `allowPlugins`, which (I think) is more concerned with content settings. I'm not sure it makes a lot of sense to have `allowPlugins?` directly followed by `isPluginAllowed?`. Conceptually, it's clear ("Are plugins allowed, in general?" is a different question to "Is this specific plugin allowed?"), but it doesn't read well. > > > > > > I'd originally planned to push the `isSandboxed` check into `allowPlugins` (since it falls into the former question), but stopped since it would have the side-effect of notifying `didNotAllowPlugins`, which I think Chromium does something interesting with. > > > > > > Any thoughts on that split? > > > > I think it's better to keep the sandbox check separate. That's what we do in other cases. Perhaps shouldLoadPlugin(...) is a good name for the function? > > Makes sense. However, there's already `shouldUsePlugin`, which determines whether the plugin rendering process should be kicked off for a particular resource. > > I've been sitting here about 5 minutes typing new suggestions for names, and then backspacing over them. :) pluginIsLoadable?
Adam Barth
Comment 9 2012-08-04 13:34:20 PDT
Lets not get too hung up on the name. Pick you favorite. :)
Mike West
Comment 10 2012-08-04 14:08:18 PDT
Mike West
Comment 11 2012-08-04 14:09:13 PDT
(In reply to comment #9) > Lets not get too hung up on the name. Pick you favorite. :) `pluginIsLoadable` is the least bad name I've come up with. CQ? :)
WebKit Review Bot
Comment 12 2012-08-04 15:49:35 PDT
Comment on attachment 156539 [details] Patch Clearing flags on attachment: 156539 Committed r124704: <http://trac.webkit.org/changeset/124704>
WebKit Review Bot
Comment 13 2012-08-04 15:49:39 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.