Changeset 54593 in webkit


Ignore:
Timestamp:
Feb 10, 2010 2:36:40 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-02-10 Yaar Schnitman <yaar@chromium.org>

Reviewed by Adam Barth.

Simplified RuntimeEnabledFeatures and corresponding v8 generated code
https://bugs.webkit.org/show_bug.cgi?id=34667

  • WebCore.gypi:
  • bindings/generic/RuntimeEnabledFeatures.cpp: Added. (WebCore::RuntimeEnabledFeatures::audioEnabled): (WebCore::RuntimeEnabledFeatures::htmlMediaElementEnabled): (WebCore::RuntimeEnabledFeatures::htmlAudioElementEnabled): (WebCore::RuntimeEnabledFeatures::htmlVideoElementEnabled): (WebCore::RuntimeEnabledFeatures::mediaErrorEnabled): (WebCore::RuntimeEnabledFeatures::sharedWorkerEnabled): (WebCore::RuntimeEnabledFeatures::webSocketEnabled): (WebCore::RuntimeEnabledFeatures::openDatabaseEnabled):
  • bindings/generic/RuntimeEnabledFeatures.h: Added. (WebCore::RuntimeEnabledFeatures::setLocalStorageEnabled): (WebCore::RuntimeEnabledFeatures::localStorageEnabled): (WebCore::RuntimeEnabledFeatures::setSessionStorageEnabled): (WebCore::RuntimeEnabledFeatures::sessionStorageEnabled): (WebCore::RuntimeEnabledFeatures::setWebkitNotificationsEnabled): (WebCore::RuntimeEnabledFeatures::webkitNotificationsEnabled): (WebCore::RuntimeEnabledFeatures::setApplicationCacheEnabled): (WebCore::RuntimeEnabledFeatures::applicationCacheEnabled): (WebCore::RuntimeEnabledFeatures::setGeolocationEnabled): (WebCore::RuntimeEnabledFeatures::geolocationEnabled): (WebCore::RuntimeEnabledFeatures::setIndexedDBEnabled): (WebCore::RuntimeEnabledFeatures::indexedDBEnabled): (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
  • bindings/scripts/CodeGenerator.pm:
  • bindings/scripts/CodeGeneratorV8.pm:
  • bindings/v8/RuntimeEnabledFeatures.cpp: Removed.
  • bindings/v8/RuntimeEnabledFeatures.h: Removed.
  • bindings/v8/custom/V8DOMWindowCustom.cpp:
  • bindings/v8/custom/V8NavigatorCustom.cpp:
  • bindings/v8/custom/V8WorkerContextCustom.cpp:
Location:
trunk
Files:
8 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r54591 r54593  
     12010-02-10  Yaar Schnitman  <yaar@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Simplified RuntimeEnabledFeatures and corresponding v8 generated code
     6        https://bugs.webkit.org/show_bug.cgi?id=34667
     7
     8        * WebCore.gypi:
     9        * bindings/generic/RuntimeEnabledFeatures.cpp: Added.
     10        (WebCore::RuntimeEnabledFeatures::audioEnabled):
     11        (WebCore::RuntimeEnabledFeatures::htmlMediaElementEnabled):
     12        (WebCore::RuntimeEnabledFeatures::htmlAudioElementEnabled):
     13        (WebCore::RuntimeEnabledFeatures::htmlVideoElementEnabled):
     14        (WebCore::RuntimeEnabledFeatures::mediaErrorEnabled):
     15        (WebCore::RuntimeEnabledFeatures::sharedWorkerEnabled):
     16        (WebCore::RuntimeEnabledFeatures::webSocketEnabled):
     17        (WebCore::RuntimeEnabledFeatures::openDatabaseEnabled):
     18        * bindings/generic/RuntimeEnabledFeatures.h: Added.
     19        (WebCore::RuntimeEnabledFeatures::setLocalStorageEnabled):
     20        (WebCore::RuntimeEnabledFeatures::localStorageEnabled):
     21        (WebCore::RuntimeEnabledFeatures::setSessionStorageEnabled):
     22        (WebCore::RuntimeEnabledFeatures::sessionStorageEnabled):
     23        (WebCore::RuntimeEnabledFeatures::setWebkitNotificationsEnabled):
     24        (WebCore::RuntimeEnabledFeatures::webkitNotificationsEnabled):
     25        (WebCore::RuntimeEnabledFeatures::setApplicationCacheEnabled):
     26        (WebCore::RuntimeEnabledFeatures::applicationCacheEnabled):
     27        (WebCore::RuntimeEnabledFeatures::setGeolocationEnabled):
     28        (WebCore::RuntimeEnabledFeatures::geolocationEnabled):
     29        (WebCore::RuntimeEnabledFeatures::setIndexedDBEnabled):
     30        (WebCore::RuntimeEnabledFeatures::indexedDBEnabled):
     31        (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
     32        * bindings/scripts/CodeGenerator.pm:
     33        * bindings/scripts/CodeGeneratorV8.pm:
     34        * bindings/v8/RuntimeEnabledFeatures.cpp: Removed.
     35        * bindings/v8/RuntimeEnabledFeatures.h: Removed.
     36        * bindings/v8/custom/V8DOMWindowCustom.cpp:
     37        * bindings/v8/custom/V8NavigatorCustom.cpp:
     38        * bindings/v8/custom/V8WorkerContextCustom.cpp:
     39
    1402010-02-09  Alexander Pavlov  <apavlov@chromium.org>
    241
  • trunk/WebCore/WebCore.gypi

    r54591 r54593  
    456456            'bindings/generic/BindingSecurityBase.h',
    457457            'bindings/generic/GenericBinding.h',
     458            'bindings/generic/RuntimeEnabledFeatures.cpp',
     459            'bindings/generic/RuntimeEnabledFeatures.h',
    458460            'bindings/js/CachedScriptSourceProvider.h',
    459461            'bindings/js/DOMObjectWithSVGContext.h',
     
    787789            'bindings/v8/NPV8Object.h',
    788790            'bindings/v8/OwnHandle.h',
    789             'bindings/v8/RuntimeEnabledFeatures.cpp',
    790             'bindings/v8/RuntimeEnabledFeatures.h',
    791791            'bindings/v8/ScheduledAction.cpp',
    792792            'bindings/v8/ScheduledAction.h',
     
    38243824            'inspector/front-end/Images/errorIcon.png',
    38253825            'inspector/front-end/Images/errorMediumIcon.png',
    3826             'inspector/front-end/Images/errorRedDot.png',           
     3826            'inspector/front-end/Images/errorRedDot.png',
    38273827            'inspector/front-end/Images/excludeButtonGlyph.png',
    38283828            'inspector/front-end/Images/focusButtonGlyph.png',
  • trunk/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp

    r54591 r54593  
    3232#include "RuntimeEnabledFeatures.h"
    3333
     34#include "Database.h"
     35#include "MediaPlayer.h"
     36#include "SharedWorkerRepository.h"
     37#include "WebSocket.h"
     38
    3439namespace WebCore {
    3540
    3641bool RuntimeEnabledFeatures::isLocalStorageEnabled = true;
    3742bool RuntimeEnabledFeatures::isSessionStorageEnabled = true;
    38 bool RuntimeEnabledFeatures::isNotificationsEnabled = false;
     43bool RuntimeEnabledFeatures::isWebkitNotificationsEnabled = false;
    3944bool RuntimeEnabledFeatures::isApplicationCacheEnabled = false;
    4045bool RuntimeEnabledFeatures::isGeolocationEnabled = false;
    41 bool RuntimeEnabledFeatures::isIndexedDatabaseEnabled = false;
     46bool RuntimeEnabledFeatures::isIndexedDBEnabled = false;
     47
     48#if ENABLE(VIDEO)
     49
     50bool RuntimeEnabledFeatures::audioEnabled()
     51{
     52    return MediaPlayer::isAvailable();
     53}
     54
     55bool RuntimeEnabledFeatures::htmlMediaElementEnabled()
     56{
     57    return MediaPlayer::isAvailable();
     58}
     59
     60bool RuntimeEnabledFeatures::htmlAudioElementEnabled()
     61{
     62    return MediaPlayer::isAvailable();
     63}
     64
     65bool RuntimeEnabledFeatures::htmlVideoElementEnabled()
     66{
     67    return MediaPlayer::isAvailable();
     68}
     69
     70bool RuntimeEnabledFeatures::mediaErrorEnabled()
     71{
     72    return MediaPlayer::isAvailable();
     73}
     74
     75#endif
     76
     77#if ENABLE(SHARED_WORKERS)
     78bool RuntimeEnabledFeatures::sharedWorkerEnabled()
     79{
     80    return SharedWorkerRepository::isAvailable();
     81}
     82#endif
     83
     84#if ENABLE(WEB_SOCKETS)
     85bool RuntimeEnabledFeatures::webSocketEnabled()
     86{
     87    return WebSocket::isAvailable();
     88}
     89#endif
     90
     91#if ENABLE(DATABASE)
     92bool RuntimeEnabledFeatures::openDatabaseEnabled()
     93{
     94    return Database::isAvailable();
     95}
     96#endif
    4297
    4398} // namespace WebCore
  • trunk/WebCore/bindings/generic/RuntimeEnabledFeatures.h

    r54591 r54593  
    3434namespace WebCore {
    3535
    36 // A class that stores static enablers for all experimental features
     36// A class that stores static enablers for all experimental features. Note that
     37// the method names must line up with the JavaScript method they enable for code
     38// generation to work properly.
     39
    3740class RuntimeEnabledFeatures {
    3841public:
     
    4346    static bool sessionStorageEnabled() { return isSessionStorageEnabled; }
    4447
    45     static void setNotificationsEnabled(bool isEnabled) { isNotificationsEnabled = isEnabled; }
    46     static bool notificationsEnabled() { return isNotificationsEnabled; }
     48    static void setWebkitNotificationsEnabled(bool isEnabled) { isWebkitNotificationsEnabled = isEnabled; }
     49    static bool webkitNotificationsEnabled() { return isWebkitNotificationsEnabled; }
    4750
    4851    static void setApplicationCacheEnabled(bool isEnabled) { isApplicationCacheEnabled = isEnabled; }
     
    5255    static bool geolocationEnabled() { return isGeolocationEnabled; }
    5356
    54     static void setIndexedDatabaseEnabled(bool isEnabled) { isIndexedDatabaseEnabled = isEnabled; }
    55     static bool indexedDatabaseEnabled() { return isIndexedDatabaseEnabled; }
     57    static void setIndexedDBEnabled(bool isEnabled) { isIndexedDBEnabled = isEnabled; }
     58    static bool indexedDBEnabled() { return isIndexedDBEnabled; }
     59
     60#if ENABLE(VIDEO)
     61    static bool audioEnabled();
     62    static bool htmlMediaElementEnabled();
     63    static bool htmlAudioElementEnabled();
     64    static bool htmlVideoElementEnabled();
     65    static bool mediaErrorEnabled();
     66#endif
     67
     68#if ENABLE(SHARED_WORKERS)
     69    static bool sharedWorkerEnabled();
     70#endif
     71
     72#if ENABLE(WEB_SOCKETS)
     73    static bool webSocketEnabled();
     74#endif
     75
     76#if ENABLE(DATABASE)
     77    static bool openDatabaseEnabled();
     78#endif
    5679
    5780private:
     
    6184    static bool isLocalStorageEnabled;
    6285    static bool isSessionStorageEnabled;
    63     static bool isNotificationsEnabled;
     86    static bool isWebkitNotificationsEnabled;
    6487    static bool isApplicationCacheEnabled;
    6588    static bool isGeolocationEnabled;
    66     static bool isIndexedDatabaseEnabled;
     89    static bool isIndexedDBEnabled;
    6790};
    6891
  • trunk/WebCore/bindings/scripts/CodeGenerator.pm

    r53890 r54593  
    11#
    22# WebKit IDL parser
    3 # 
     3#
    44# Copyright (C) 2005 Nikolas Zimmermann <wildfox@kde.org>
    55# Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
    66# Copyright (C) 2007 Apple Inc. All rights reserved.
    77# Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
    8 # 
     8#
    99# This library is free software; you can redistribute it and/or
    1010# modify it under the terms of the GNU Library General Public
    1111# License as published by the Free Software Foundation; either
    1212# version 2 of the License, or (at your option) any later version.
    13 # 
     13#
    1414# This library is distributed in the hope that it will be useful,
    1515# but WITHOUT ANY WARRANTY; without even the implied warranty of
    1616# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1717# Library General Public License for more details.
    18 # 
     18#
    1919# You should have received a copy of the GNU Library General Public License
    2020# aint with this library; see the file COPYING.LIB.  If not, write to
    2121# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    2222# Boston, MA 02110-1301, USA.
    23 # 
     23#
    2424
    2525package CodeGenerator;
     
    4040my $verbose = 0;
    4141
    42 my %primitiveTypeHash = ("int" => 1, "short" => 1, "long" => 1, "long long" => 1, 
     42my %primitiveTypeHash = ("int" => 1, "short" => 1, "long" => 1, "long long" => 1,
    4343                         "unsigned int" => 1, "unsigned short" => 1,
    44                          "unsigned long" => 1, "unsigned long long" => 1, 
    45                          "float" => 1, "double" => 1, 
     44                         "unsigned long" => 1, "unsigned long long" => 1,
     45                         "float" => 1, "double" => 1,
    4646                         "boolean" => 1, "void" => 1,
    4747                         "Date" => 1);
     
    329329
    330330    return 1 if $svgAnimatedTypeHash{$type};
    331     return 0; 
    332 }
    333 
    334 # Uppercase the first letter while respecting WebKit style guidelines. 
     331    return 0;
     332}
     333
     334# Uppercase the first letter while respecting WebKit style guidelines.
    335335# E.g., xmlEncoding becomes XMLEncoding, but xmlllang becomes Xmllang.
    336336sub WK_ucfirst
     
    342342}
    343343
    344 # Lowercase the first letter while respecting WebKit style guidelines. 
     344# Lowercase the first letter while respecting WebKit style guidelines.
    345345# URL becomes url, but SetURL becomes setURL.
    346346sub WK_lcfirst
     
    348348    my ($object, $param) = @_;
    349349    my $ret = lcfirst($param);
     350    $ret =~ s/hTML/html/ if $ret =~ /^hTML/;
    350351    $ret =~ s/uRL/url/ if $ret =~ /^uRL/;
    351352    $ret =~ s/jS/js/ if $ret =~ /^jS/;
  • trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r54503 r54593  
    304304END
    305305    }
    306    
     306
    307307    foreach my $attribute (@{$dataNode->attributes}) {
    308308        my $name = $attribute->signature->name;
     
    325325    }
    326326
    327     GenerateHeaderRuntimeEnablerDeclarations(@enabledAtRuntime);
    328327    GenerateHeaderNamedAndIndexedPropertyAccessors($dataNode);
    329328    GenerateHeaderCustomCall($dataNode);
    330329    GenerateHeaderCustomInternalFieldIndices($dataNode);
    331    
     330
    332331    if ($dataNode->extendedAttributes->{"CheckDomainSecurity"}) {
    333332        push(@headerContent, <<END);
     
    358357    my $dataNode = shift;
    359358    my $name = $dataNode->name;
    360    
     359
    361360    # FIXME: I am hideous and hard-coded.  Make me beautiful.
    362361    return ("cacheIndex", "implementationIndex") if ($name eq "Document") || ($name eq "SVGDocument");
     
    414413}
    415414
    416 sub GenerateHeaderRuntimeEnablerDeclarations
    417 {
    418     my @enabledAtRuntime = @_;
    419    
    420     foreach my $runtime_attr (@enabledAtRuntime) {
    421         my $enabledAtRuntimeConditionalString = GenerateConditionalString($runtime_attr->signature);
    422         my $enabler = $codeGenerator->WK_ucfirst($runtime_attr->signature->name);
    423         if ($enabledAtRuntimeConditionalString) {
    424             push(@headerContent, "\n#if ${enabledAtRuntimeConditionalString}\n");
    425         }
    426         push(@headerContent, <<END);
    427   static bool ${enabler}Enabled();
    428 END
    429         if ($enabledAtRuntimeConditionalString) {
    430             push(@headerContent, "#endif\n");
    431         }
    432     }
    433 }
    434 
    435415my %indexerSpecialCases = (
    436416    "Storage" => 1,
     
    470450END
    471451    }
    472      
     452
    473453    if ($isIndexerSpecialCase || $hasCustomIndexedSetter) {
    474454        push(@headerContent, <<END);
     
    506486{
    507487    my $dataNode = shift;
    508    
     488
    509489    if ($dataNode->extendedAttributes->{"CustomCall"}) {
    510490        push(@headerContent, "  static v8::Handle<v8::Value> callAsFunctionCallback(const v8::Arguments&);\n");
     
    995975    $function = shift;
    996976    $dataNode = shift;
    997    
     977
    998978    my $interfaceName = $dataNode->name;
    999979    my $name = $function->signature->name;
     
    10631043"    }\n");
    10641044    }
    1065    
     1045
    10661046    my $raisesExceptions = @{$function->raisesExceptions};
    10671047    if (!$raisesExceptions) {
     
    11481128        push(@implContentDecls, "    return v8::Handle<v8::Value>();\n");
    11491129    }
    1150    
     1130
    11511131    push(@implContentDecls, "  }\n\n");
    11521132}
     
    14711451    push(@implFixedHeader,
    14721452         "#include \"config.h\"\n" .
     1453         "#include \"RuntimeEnabledFeatures.h\"\n" .
    14731454         "#include \"V8Proxy.h\"\n" .
    14741455         "#include \"V8Binding.h\"\n" .
     
    15391520        GenerateConstructorGetter($implClassName, $classIndex);
    15401521    }
    1541    
     1522
    15421523    my $indexer;
    15431524    my $namedPropertyGetter;
     
    16001581        push(@implContent, "};\n");
    16011582    }
    1602    
     1583
    16031584    # Setup table of standard callback functions
    16041585    $num_callbacks = 0;
     
    16981679        last;
    16991680    }
    1700    
     1681
    17011682    # Generate the template configuration method
    17021683    push(@implContent,  <<END);
     
    17151696END
    17161697    }
    1717    
     1698
    17181699    if ($has_callbacks) {
    17191700        push(@implContent, <<END);
     
    17331714
    17341715    if ($access_check or @enabledAtRuntime or @{$dataNode->functions} or $has_constants) {
    1735     push(@implContent,  <<END);
     1716        push(@implContent,  <<END);
    17361717  v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    17371718  v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
     
    17401721
    17411722    push(@implContent,  "  $access_check\n");
    1742    
     1723
    17431724    # Setup the enable-at-runtime attrs if we have them
    17441725    foreach my $runtime_attr (@enabledAtRuntime) {
    1745         $enable_function = $interfaceName . "::" . $codeGenerator->WK_ucfirst($runtime_attr->signature->name);
     1726        # A function named RuntimeEnabledFeatures::{methodName}Enabled() need to be written by hand.
     1727        $enable_function = "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($runtime_attr->signature->name) . "Enabled";
    17461728        my $conditionalString = GenerateConditionalString($runtime_attr->signature);
    17471729        push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString;
    1748         push(@implContent, "    if (V8${enable_function}Enabled()) {\n");
     1730        push(@implContent, "    if (${enable_function}()) {\n");
    17491731        push(@implContent, "        static const BatchedAttribute attrData =\\\n");
    17501732        GenerateSingleBatchedAttribute($interfaceName, $runtime_attr, ";", "    ");
     
    17861768        if ($attrExt->{"EnabledAtRuntime"}) {
    17871769            # Only call Set()/SetAccessor() if this method should be enabled
    1788             $enable_function = $interfaceName . "::" . $codeGenerator->WK_ucfirst($function->signature->name);
    1789             $conditional = "if (V8${enable_function}Enabled())\n";
     1770            $enable_function = "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($function->signature->name) . "Enabled";
     1771            $conditional = "if (${enable_function}())\n";
    17901772        }
    17911773
     
    18341816      # Normal function call is a template
    18351817      my $callback = GetFunctionTemplateCallbackName($function, $dataNode);
    1836      
     1818
    18371819      if ($property_attributes eq "v8::DontDelete") {
    18381820          $property_attributes = "";
     
    18401822          $property_attributes = ", static_cast<v8::PropertyAttribute>($property_attributes)";
    18411823      }
    1842      
     1824
    18431825      if ($template eq "proto" && $conditional eq "" && $signature eq "default_signature" && $property_attributes eq "") {
    18441826          # Standard type of callback, already created in the batch, so skip it here.
    18451827          next;
    18461828      }
    1847      
     1829
    18481830      push(@implContent, <<END);
    18491831  ${conditional}$template->Set(v8::String::New("$name"), v8::FunctionTemplate::New($callback, v8::Handle<v8::Value>(), ${signature})$property_attributes);
     
    18511833      $num_callbacks++;
    18521834    }
    1853    
     1835
    18541836    die "Wrong number of callbacks generated for $interfaceName ($num_callbacks, should be $total_functions)" if $num_callbacks != $total_functions;
    18551837
     
    18591841END
    18601842    }
    1861    
     1843
    18621844    # Special cases
    18631845    if ($interfaceName eq "DOMWindow") {
    18641846        push(@implContent, <<END);
    1865  
     1847
    18661848  proto->SetInternalFieldCount(V8DOMWindow::internalFieldCount);
    18671849  desc->SetHiddenPrototype(true);
     
    18751857    if ($interfaceName eq "Location") {
    18761858        push(@implContent, <<END);
    1877  
    1878   // For security reasons, these functions are on the instance instead 
     1859
     1860  // For security reasons, these functions are on the instance instead
    18791861  // of on the prototype object to insure that they cannot be overwritten.
    18801862  instance->SetAccessor(v8::String::New("reload"), V8Location::reloadAccessorGetter, 0, v8::Handle<v8::Value>(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
     
    18891871    }
    18901872    push(@implContent, <<END);
    1891  
     1873
    18921874  // Custom toString template
    18931875  desc->Set(getToStringName(), getToStringTemplate());
     
    19061888
    19071889${nativeType}* ${className}::toNative(v8::Handle<v8::Object> object) {
    1908   return reinterpret_cast<${nativeType}*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex)); 
     1890  return reinterpret_cast<${nativeType}*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex));
    19091891}
    19101892
     
    19271909END
    19281910    }
    1929    
     1911
    19301912    GenerateToV8Converters($dataNode, $interfaceName, $className, $nativeType);
    19311913
     
    19371919}
    19381920
    1939 sub GenerateToV8Converters 
     1921sub GenerateToV8Converters
    19401922{
    19411923    my $dataNode = shift;
     
    19431925    my $className = shift;
    19441926    my $nativeType = shift;
    1945    
     1927
    19461928    my $wrapperType = "V8ClassIndex::" . uc($interfaceName);
    19471929    my $domMapFunction = GetDomMapFunction($dataNode, $interfaceName);
    19481930    my $forceNewObjectInput = IsDOMNodeType($interfaceName) ? ", bool forceNewObject" : "";
    19491931    my $forceNewObjectCall = IsDOMNodeType($interfaceName) ? ", forceNewObject" : "";
    1950    
    1951     push(@implContent, <<END);   
     1932
     1933    push(@implContent, <<END);
    19521934
    19531935v8::Handle<v8::Object> ${className}::wrap(${nativeType}* impl${forceNewObjectInput}) {
     
    20041986END
    20051987    }
    2006    
     1988
    20071989    push(@implContent, <<END);
    20081990  if (wrapper.IsEmpty())
     
    20302012END
    20312013    }
    2032    
     2014
    20332015    if (!HasCustomToV8Implementation($dataNode, $interfaceName)) {
    20342016        push(@implContent, <<END);
     
    20472029    $dataNode = shift;
    20482030    $interfaceName = shift;
    2049    
     2031
    20502032    # We generate a custom converter (but JSC doesn't) for the following:
    20512033    return 1 if $interfaceName eq "BarInfo";
     
    20652047    return 1 if $interfaceName eq "Screen";
    20662048    return 1 if $interfaceName eq "WorkerContext";
    2067    
    20682049    # We don't generate a custom converter (but JSC does) for the following:
    20692050    return 0 if $interfaceName eq "AbstractWorker";
     
    22942275
    22952276    $type = GetNativeType($type, $parameterIndex >= 0 ? 1 : 0);
    2296    
     2277
    22972278    if ($parameterIndex >= 0 && $type eq "V8Parameter") {
    22982279        my $mode = "";
     
    23042285        $type .= "<$mode>";
    23052286    }
    2306    
     2287
    23072288    return $type;
    23082289}
  • trunk/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp

    r54349 r54593  
    11/*
    22 * Copyright (C) 2009 Google Inc. All rights reserved.
    3  * 
     3 *
    44 * Redistribution and use in source and binary forms, with or without
    55 * modification, are permitted provided that the following conditions are
    66 * met:
    7  * 
     7 *
    88 *     * Redistributions of source code must retain the above copyright
    99 * notice, this list of conditions and the following disclaimer.
     
    1515 * contributors may be used to endorse or promote products derived from
    1616 * this software without specific prior written permission.
    17  * 
     17 *
    1818 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1919 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     
    4646#include "Page.h"
    4747#include "PlatformScreen.h"
    48 #include "RuntimeEnabledFeatures.h"
    4948#include "ScheduledAction.h"
    5049#include "ScriptSourceCode.h"
     
    9695            v8::Handle<v8::Value> v8String = function->ToString();
    9796
    98             // Bail out if string conversion failed. 
    99             if (v8String.IsEmpty()) 
    100                 return v8::Undefined(); 
     97            // Bail out if string conversion failed.
     98            if (v8String.IsEmpty())
     99                return v8::Undefined();
    101100
    102101            functionString = toWebCoreString(v8String);
     
    229228    if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
    230229        return;
    231  
     230
    232231    // Opener can be shadowed if it is in the same domain.
    233232    // Have a special handling of null value to behave
     
    255254}
    256255
    257 bool V8DOMWindow::AudioEnabled()
    258 {
    259     return MediaPlayer::isAvailable();
    260 }
    261 
    262 bool V8DOMWindow::HTMLMediaElementEnabled()
    263 {
    264     return MediaPlayer::isAvailable();
    265 }
    266 
    267 bool V8DOMWindow::HTMLAudioElementEnabled()
    268 {
    269     return MediaPlayer::isAvailable();
    270 }
    271 
    272 bool V8DOMWindow::HTMLVideoElementEnabled()
    273 {
    274     return MediaPlayer::isAvailable();
    275 }
    276 
    277 bool V8DOMWindow::MediaErrorEnabled()
    278 {
    279     return MediaPlayer::isAvailable();
    280 }
    281 
    282 #endif
    283 
    284 #if ENABLE(SHARED_WORKERS)
    285 bool V8DOMWindow::SharedWorkerEnabled()
    286 {
    287     return SharedWorkerRepository::isAvailable();
    288 }
    289 #endif
    290 
    291 #if ENABLE(WEB_SOCKETS)
    292 bool V8DOMWindow::WebSocketEnabled()
    293 {
    294     return WebSocket::isAvailable();
    295 }
    296 #endif
    297 
    298 #if ENABLE(DATABASE)
    299 bool V8DOMWindow::OpenDatabaseEnabled()
    300 {
    301     return Database::isAvailable();
    302 }
    303 #endif
    304 
    305 #if ENABLE(INDEXED_DATABASE)
    306 bool V8DOMWindow::IndexedDBEnabled()
    307 {
    308     return RuntimeEnabledFeatures::indexedDatabaseEnabled();
    309 }
    310 #endif
    311 
    312 #if ENABLE(DOM_STORAGE)
    313 bool V8DOMWindow::LocalStorageEnabled()
    314 {
    315     return RuntimeEnabledFeatures::localStorageEnabled();
    316 }
    317 
    318 bool V8DOMWindow::SessionStorageEnabled()
    319 {
    320     return RuntimeEnabledFeatures::sessionStorageEnabled();
    321 }
    322 #endif
    323 
    324 #if ENABLE(NOTIFICATIONS)
    325 bool V8DOMWindow::WebkitNotificationsEnabled()
    326 {
    327     return RuntimeEnabledFeatures::notificationsEnabled();
    328 }
    329 #endif
    330 
    331 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
    332 bool V8DOMWindow::ApplicationCacheEnabled()
    333 {
    334     return RuntimeEnabledFeatures::applicationCacheEnabled();
    335 }
    336256#endif
    337257
     
    596516    windowFeatures.height = WindowFeatures::floatFeature(features, "dialogheight", 100, screenRect.height(), 450);
    597517    windowFeatures.heightSet = true;
    598  
     518
    599519    windowFeatures.x = WindowFeatures::floatFeature(features, "dialogleft", screenRect.x(), screenRect.right() - windowFeatures.width, -1);
    600520    windowFeatures.xSet = windowFeatures.x > 0;
     
    695615        if (!shouldAllowNavigation(frame))
    696616            return v8::Undefined();
    697    
     617
    698618        String completedUrl;
    699619        if (!urlString.isEmpty())
    700620            completedUrl = completeURL(urlString);
    701    
     621
    702622        if (!completedUrl.isEmpty() &&
    703623            (!protocolIsJavaScript(completedUrl) || ScriptController::isSafeScript(frame))) {
  • trunk/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp

    r54150 r54593  
    11/*
    22 * Copyright (C) 2010 Google Inc. All rights reserved.
    3  * 
     3 *
    44 * Redistribution and use in source and binary forms, with or without
    55 * modification, are permitted provided that the following conditions are
    66 * met:
    7  * 
     7 *
    88 *     * Redistributions of source code must retain the above copyright
    99 * notice, this list of conditions and the following disclaimer.
     
    1515 * contributors may be used to endorse or promote products derived from
    1616 * this software without specific prior written permission.
    17  * 
     17 *
    1818 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1919 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     
    3838namespace WebCore {
    3939
    40 #if ENABLE(GEOLOCATION)
    41 bool V8Navigator::GeolocationEnabled()
    42 {
    43     return RuntimeEnabledFeatures::geolocationEnabled();
    44 }
    45 #endif
    46 
    4740v8::Handle<v8::Value> toV8(Navigator* impl)
    4841{
  • trunk/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp

    r54499 r54593  
    3636#include "DOMTimer.h"
    3737#include "ExceptionCode.h"
    38 #include "RuntimeEnabledFeatures.h"
    3938#include "ScheduledAction.h"
    4039#include "V8Binding.h"
     
    4746
    4847namespace WebCore {
    49 
    50 #if ENABLE(NOTIFICATIONS)
    51 bool V8WorkerContext::WebkitNotificationsEnabled()
    52 {
    53     return RuntimeEnabledFeatures::notificationsEnabled();
    54 }
    55 #endif
    56 
    57 #if ENABLE(WEB_SOCKETS)
    58 bool V8WorkerContext::WebSocketEnabled()
    59 {
    60     return WebSocket::isAvailable();
    61 }
    62 #endif
    6348
    6449v8::Handle<v8::Value> SetTimeoutOrInterval(const v8::Arguments& args, bool singleShot)
  • trunk/WebKit/chromium/src/WebRuntimeFeatures.cpp

    r54085 r54593  
    124124{
    125125#if ENABLE(NOTIFICATIONS)
    126     RuntimeEnabledFeatures::setNotificationsEnabled(enable);
     126    RuntimeEnabledFeatures::setWebkitNotificationsEnabled(enable);
    127127#endif
    128128}
     
    131131{
    132132#if ENABLE(NOTIFICATIONS)
    133     return RuntimeEnabledFeatures::notificationsEnabled();
     133    return RuntimeEnabledFeatures::webkitNotificationsEnabled();
    134134#else
    135135    return false;
     
    172172{
    173173#if ENABLE(INDEXED_DATABASE)
    174     RuntimeEnabledFeatures::setIndexedDatabaseEnabled(enable);
     174    RuntimeEnabledFeatures::setIndexedDBEnabled(enable);
    175175#endif
    176176}
     
    179179{
    180180#if ENABLE(INDEXED_DATABASE)
    181     return RuntimeEnabledFeatures::indexedDatabaseEnabled();
     181    return RuntimeEnabledFeatures::indexedDBEnabled();
    182182#else
    183183    return false;
Note: See TracChangeset for help on using the changeset viewer.