Bug 172235 - Bindings: Support runtime-enabled features in specific worlds
Summary: Bindings: Support runtime-enabled features in specific worlds
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Bindings (show other bugs)
Version: WebKit Local Build
Hardware: All All
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-17 12:03 PDT by Daniel Bates
Modified: 2017-05-20 12:34 PDT (History)
6 users (show)

See Also:


Attachments
Patch and tests (22.77 KB, patch)
2017-05-17 12:05 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch and tests (19.54 KB, patch)
2017-05-18 15:09 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2017-05-17 12:03:27 PDT
Currently an interface, function, or attribute can be annotated with either EnabledAtRuntime or EnabledForWorld, but not both. Even though we do not have any interfaces, functions, or attributes that are annotated with both at the time of writing, it seems reasonable to support such a combination of annotations. This will also generalize the CodeGenerator code that exposes/conceals an interface, function, or attribute so as to make it straightforward to support the extended attribute SecureContext.
Comment 1 Daniel Bates 2017-05-17 12:05:39 PDT
Created attachment 310423 [details]
Patch and tests
Comment 2 Sam Weinig 2017-05-17 14:16:15 PDT
I am not a fan of continuing to promote the use of RuntimeEnabledFeature, and instead think we should be use Settings for all "settings".  I'd rather not see more features being added to support RuntimeEnabledFeature.
Comment 3 Daniel Bates 2017-05-17 16:53:32 PDT
(In reply to Sam Weinig from comment #2)
> I am not a fan of continuing to promote the use of RuntimeEnabledFeature,
> and instead think we should be use Settings for all "settings".  I'd rather
> not see more features being added to support RuntimeEnabledFeature.

We can likely remove the code generation logic for RuntimeEnabledFeature. I see this an an orthogonal issue to the purpose of this patch, generalizing code generation logic for arbitrary runtime enabled features, because the infrastructure that supports code generation of RuntimeEnabledFeature feature checks (e.g. GetRuntimeEnableFunctionName()) is also being used to support the extended attribute EnabledForWorld - to restrict interfaces, attributes, and functions to specific DOM worlds. I was planning to make use of this machinery to support the extended attribute SecureContext. We may be able to further refactor the CodeGeneratorJS machinery for features enabled via settings into the GetRuntimeEnableFunctionName() machinery.
Comment 4 Daniel Bates 2017-05-18 15:09:06 PDT
Created attachment 310555 [details]
Patch and tests

Updated patch following the landing of the patch for bug #172252
Comment 5 Chris Dumez 2017-05-18 16:48:18 PDT
Comment on attachment 310555 [details]
Patch and tests

This does not really add complexity and Daniel explains this is a first step towards supporting SecureContext, so OK.
Comment 6 Chris Dumez 2017-05-18 16:49:46 PDT
(In reply to Sam Weinig from comment #2)
> I am not a fan of continuing to promote the use of RuntimeEnabledFeature,
> and instead think we should be use Settings for all "settings".  I'd rather
> not see more features being added to support RuntimeEnabledFeature.

I think this should be a webkit-dev thread then. There was a mail thread about using RuntimeEnabled more not too long ago. I even spent time improving our support for RuntimeEnabled in the bindings generator as a result.
Comment 7 Daniel Bates 2017-05-19 13:13:20 PDT
Comment on attachment 310555 [details]
Patch and tests

Clearing flags on attachment: 310555

Committed r217146: <http://trac.webkit.org/changeset/217146>
Comment 8 Daniel Bates 2017-05-19 13:13:22 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Sam Weinig 2017-05-20 11:52:43 PDT
(In reply to Chris Dumez from comment #6)
> (In reply to Sam Weinig from comment #2)
> > I am not a fan of continuing to promote the use of RuntimeEnabledFeature,
> > and instead think we should be use Settings for all "settings".  I'd rather
> > not see more features being added to support RuntimeEnabledFeature.
> 
> I think this should be a webkit-dev thread then. There was a mail thread
> about using RuntimeEnabled more not too long ago. I even spent time
> improving our support for RuntimeEnabled in the bindings generator as a
> result.

Do you have a link to that thread in the archives, I'd be interested to go over it. 

By the way, in case it wasn't clear, I am all in favor of enabling features at runtime rather than compile time, I just think we should stick to one class for such configurations, and that class should be Settings. I've plumbed through support for using Settings in the bindings, so I don't think that should be the issue.

What are the virtues of having both RuntimeEnabledFeature and Settings?
Comment 10 Chris Dumez 2017-05-20 12:34:33 PDT
(In reply to Sam Weinig from comment #9)
> (In reply to Chris Dumez from comment #6)
> > (In reply to Sam Weinig from comment #2)
> > > I am not a fan of continuing to promote the use of RuntimeEnabledFeature,
> > > and instead think we should be use Settings for all "settings".  I'd rather
> > > not see more features being added to support RuntimeEnabledFeature.
> > 
> > I think this should be a webkit-dev thread then. There was a mail thread
> > about using RuntimeEnabled more not too long ago. I even spent time
> > improving our support for RuntimeEnabled in the bindings generator as a
> > result.
> 
> Do you have a link to that thread in the archives, I'd be interested to go
> over it. 
> 
> By the way, in case it wasn't clear, I am all in favor of enabling features
> at runtime rather than compile time, I just think we should stick to one
> class for such configurations, and that class should be Settings. I've
> plumbed through support for using Settings in the bindings, so I don't think
> that should be the issue.
> 
> What are the virtues of having both RuntimeEnabledFeature and Settings?

Not much AFAICT. I did not even know the Settings version until you pointed it out. I have been using RuntimeEnabledFeature exclusively for a while, most people have (You can see how little EnabledBySetting is used right now compared to EnabledAtEuntime).

I am not saying EnabledAtEuntime is better. I am saying that if EnabledBySetting is better, then this needs to be discussed and we need to actively port code from one to another. We should also make sure EnabledBySetting works for all cases, like EnabledAtEuntime (e.g. On instance, on Prototype, on Window, ...).