[webkit-dev] Getting at Settings object from WorkerContext

Jeremy Orlow jorlow at chromium.org
Thu Jan 6 11:43:26 PST 2011


Btw, the reason that this behavior has to live in the bindings and not
WebCore is to ensure feature detection code still works.  For example, if
indexedDB is disabled at runtime, then the webkitIndexedDB attribute on
window needs to not exist in any form.

Also, IIRC, because of optimizations, the runtime features are actually more
of initialize time features in v8.  I.e. once window has been accessed, any
of the RuntimeEnabledFeatures settings are locked in until you restart
WebKit.  I don't know how hard it'd be to make it something that can change
on the fly.

J

On Thu, Jan 6, 2011 at 7:38 PM, Jeremy Orlow <jorlow at chromium.org> wrote:

> Hmm.  It might still be v8-only, though I'm surprised since the class was
> moved from the v8 directory to generic.  If that's the case, then I suppose
> it'll need to be ported to JSC.
>
> J
>
> On Thu, Jan 6, 2011 at 7:24 PM, Joe Mason <jmason at rim.com> wrote:
>
>> Hmm, I can’t get the RuntimeEnabledFeatures class working.
>>
>>
>>
>> bool RuntimeEnabledFeatures::webSocketEnabled()
>>
>> {
>>
>>     return WebSocket::isAvailable();
>>
>> }
>>
>>
>>
>> So it looks from that like I should just be able to call
>> WebSocket::setIsAvailable(false), and then websockets would automatically
>> drop out.  But when I tried that (and I’ve verified that nothings setting it
>> to true behind my back), JSDOMWindow::webSocket still gets called and
>> returns the socket prototype.  I can’t seem to find any code that calls
>> webSocketEnabled.
>>
>>
>>
>> I notice that RuntimeEnabledFeatures is referenced in CodeGeneratorV8.pm,
>> but not any other code generator.  Is this a V8-only thing?
>>
>>
>>
>> Joe
>>
>>
>>
>> *From:* webkit-dev-bounces at lists.webkit.org [mailto:
>> webkit-dev-bounces at lists.webkit.org] *On Behalf Of *Joe Mason
>> *Sent:* Thursday, January 06, 2011 1:52 PM
>> *To:* Jeremy Orlow
>>
>> *Cc:* webkit-dev Development
>> *Subject:* Re: [webkit-dev] Getting at Settings object from WorkerContext
>>
>>
>>
>> Aha, there is already a “websocketsEnabled” method there!  Thanks, that’s
>> perfect.
>>
>>
>>
>> *From:* jorlow at google.com [mailto:jorlow at google.com] *On Behalf Of *Jeremy
>> Orlow
>> *Sent:* Thursday, January 06, 2011 1:25 PM
>> *To:* Joe Mason
>> *Cc:* webkit-dev Development
>> *Subject:* Re: [webkit-dev] Getting at Settings object from WorkerContext
>>
>>
>>
>> The RuntimeEnabledFeatures class [1] seems like what you're looking for.
>>
>>
>>
>> J
>>
>>
>>
>> [1]
>> http://codesearch.google.com/codesearch/p?hl=en#OAMlx_jo-ck/src/third_party/WebKit/WebCore/bindings/generic/RuntimeEnabledFeatures.h&q=RuntimeFeature&exact_package=chromium&d=6
>>
>> On Thu, Jan 6, 2011 at 6:05 PM, Joe Mason <jmason at rim.com> wrote:
>>
>> I'm trying to add a setting to enable/disable WebSockets at runtime (so
>> that the browser can make websockets available as a user preference, for
>> instance).  It's easy to add a flag to Settings, and check it from
>> JSDOMWindowCustom::webSocket to return undefined for the websocket object
>> when it's disabled.  But you can also get a websocket object from a worker,
>> with JSWorkerContext::webSocket.  And since there's no frame or page
>> associated here, there's no way to get a Settings object.
>>
>> Is it possible to get a Settings object from a WorkerContext?
>>
>> If not, I think I need to make the setting a static on the Settings
>> object.  There's precedent for this in setMinDOMTimerInterval and
>> setShouldUseHighResolutionTimer, but it doesn't feel right for a high-level
>> feature like this.
>>
>> Joe
>>
>> ---------------------------------------------------------------------
>> This transmission (including any attachments) may contain confidential
>> information, privileged material (including material protected by the
>> solicitor-client or other applicable privileges), or constitute non-public
>> information. Any use of this information by anyone other than the intended
>> recipient is prohibited. If you have received this transmission in error,
>> please immediately reply to the sender and delete this information from your
>> system. Use, dissemination, distribution, or reproduction of this
>> transmission by unintended recipients is not authorized and may be unlawful.
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>
>>
>>
>> ---------------------------------------------------------------------
>> This transmission (including any attachments) may contain confidential
>> information, privileged material (including material protected by the
>> solicitor-client or other applicable privileges), or constitute non-public
>> information. Any use of this information by anyone other than the intended
>> recipient is prohibited. If you have received this transmission in error,
>> please immediately reply to the sender and delete this information from your
>> system. Use, dissemination, distribution, or reproduction of this
>> transmission by unintended recipients is not authorized and may be unlawful.
>>
>> ---------------------------------------------------------------------
>> This transmission (including any attachments) may contain confidential
>> information, privileged material (including material protected by the
>> solicitor-client or other applicable privileges), or constitute non-public
>> information. Any use of this information by anyone other than the intended
>> recipient is prohibited. If you have received this transmission in error,
>> please immediately reply to the sender and delete this information from your
>> system. Use, dissemination, distribution, or reproduction of this
>> transmission by unintended recipients is not authorized and may be unlawful.
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110106/d79635c4/attachment.html>


More information about the webkit-dev mailing list