Adding the ability to enable/disable functions in V8 at runtime.
authordumi@chromium.org <dumi@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Oct 2009 23:57:01 +0000 (23:57 +0000)
committerdumi@chromium.org <dumi@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Oct 2009 23:57:01 +0000 (23:57 +0000)
Patch by Dumitru Daniliuc <dumi@chromium.org> on 2009-10-21
Reviewed by Dimitri Glazkov.

https://bugs.webkit.org/show_bug.cgi?id=30650

* bindings/scripts/CodeGeneratorV8.pm:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@49929 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/bindings/scripts/CodeGeneratorV8.pm

index 05676b8a22859bfe897f5d46b422585b66b00be5..df63cf552196ba64b234cf5bf043647eaefb4186 100644 (file)
@@ -1,3 +1,13 @@
+2009-10-21  Dumitru Daniliuc  <dumi@chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Adding the ability to enable/disable functions in V8 at runtime.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30650
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+
 2009-10-21  Darin Adler  <darin@apple.com>
 
         Swedish search (and other languages as well) is broken while fixing Japanese search
index 28562f1ab5b088c0f388424a6997411a2e7d77d3..4135414a455d16077fdeaa739b64b0444ba31e0b 100644 (file)
@@ -1322,6 +1322,13 @@ END
             $template = "instance";
         }
 
+        my $conditional = "";
+        if ($attrExt->{"EnabledAtRuntime"}) {
+            # Only call Set()/SetAccessor() if this method should be enabled
+            $enable_function = $interfaceName . $codeGenerator->WK_ucfirst($function->signature->name);
+            $conditional = "if (V8Custom::v8${enable_function}Enabled())\n";
+        }
+
         if ($attrExt->{"DoNotCheckDomainSecurity"} &&
             ($dataNode->extendedAttributes->{"CheckDomainSecurity"} || $interfaceName eq "DOMWindow")) {
             # Mark the accessor as ReadOnly and set it on the proto object so
@@ -1342,7 +1349,7 @@ END
             push(@implContent, <<END);
 
   // $commentInfo
-  $template->SetAccessor(
+  $conditional $template->SetAccessor(
       v8::String::New("$name"),
       ${interfaceName}Internal::${name}AttrGetter,
       0,
@@ -1370,7 +1377,7 @@ END
       push(@implContent, <<END);
 
   // $commentInfo
-  ${template}->Set(
+  $conditional ${template}->Set(
       v8::String::New("$name"),
       $templateFunction,
       static_cast<v8::PropertyAttribute>($property_attributes));