Adding a class that allows us to enable/disable features at
authordumi@chromium.org <dumi@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Oct 2009 19:38:21 +0000 (19:38 +0000)
committerdumi@chromium.org <dumi@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Oct 2009 19:38:21 +0000 (19:38 +0000)
runtime. Adding a flag to enable database support.

Patch by Dumitru Daniliuc <dumi@chromium.org> on 2009-10-22
Reviewed by Dmitry Titov.

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

* WebCore.gypi:
* bindings/v8/RuntimeEnabledFeatures.cpp: Added.
* bindings/v8/RuntimeEnabledFeatures.h: Added.
(WebCore::RuntimeEnabledFeatures::setDatabaseEnabled):
(WebCore::RuntimeEnabledFeatures::databaseEnabled):
(WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
* bindings/v8/custom/V8CustomBinding.h:
* bindings/v8/custom/V8DOMWindowCustom.cpp:
(WebCore::ACCESSOR_RUNTIME_ENABLER):
* page/DOMWindow.idl:

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

WebCore/ChangeLog
WebCore/WebCore.gypi
WebCore/bindings/v8/RuntimeEnabledFeatures.cpp [new file with mode: 0644]
WebCore/bindings/v8/RuntimeEnabledFeatures.h [new file with mode: 0644]
WebCore/bindings/v8/custom/V8CustomBinding.h
WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
WebCore/page/DOMWindow.idl

index 6ed4e0fabae05661b8912fe5754c97dcb8f23a5e..d0cbe32360a088d83aab30708cd4c6ec8812011c 100644 (file)
@@ -1,3 +1,23 @@
+2009-10-22  Dumitru Daniliuc  <dumi@chromium.org>
+
+        Reviewed by Dmitry Titov.
+
+        Adding a class that allows us to enable/disable features at
+        runtime. Adding a flag to enable database support.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30653
+
+        * WebCore.gypi:
+        * bindings/v8/RuntimeEnabledFeatures.cpp: Added.
+        * bindings/v8/RuntimeEnabledFeatures.h: Added.
+        (WebCore::RuntimeEnabledFeatures::setDatabaseEnabled):
+        (WebCore::RuntimeEnabledFeatures::databaseEnabled):
+        (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
+        * bindings/v8/custom/V8CustomBinding.h:
+        * bindings/v8/custom/V8DOMWindowCustom.cpp:
+        (WebCore::ACCESSOR_RUNTIME_ENABLER):
+        * page/DOMWindow.idl:
+
 2009-10-23  Keishi Hattori  <casey.hattori@gmail.com>
 
         Reviewed by Timothy Hatcher.
index fca5d88a1ecbabba9f623c1a1d082daf2d29a764..ffa27a2f9db5929378b39c33eccb7f09a4c514f8 100644 (file)
             'bindings/v8/NPV8Object.cpp',
             'bindings/v8/NPV8Object.h',
             'bindings/v8/OwnHandle.h',
+            'bindings/v8/RuntimeEnabledFeatures.cpp',
+            'bindings/v8/RuntimeEnabledFeatures.h',
             'bindings/v8/ScheduledAction.cpp',
             'bindings/v8/ScheduledAction.h',
             'bindings/v8/ScopedDOMDataStore.cpp',
diff --git a/WebCore/bindings/v8/RuntimeEnabledFeatures.cpp b/WebCore/bindings/v8/RuntimeEnabledFeatures.cpp
new file mode 100644 (file)
index 0000000..3dd7ad6
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RuntimeEnabledFeatures.h"
+
+namespace WebCore {
+
+bool RuntimeEnabledFeatures::isDatabaseEnabled = false;
+
+} // namespace WebCore
diff --git a/WebCore/bindings/v8/RuntimeEnabledFeatures.h b/WebCore/bindings/v8/RuntimeEnabledFeatures.h
new file mode 100644 (file)
index 0000000..87419e8
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RuntimeEnabledFeatures_h
+#define RuntimeEnabledFeatures_h
+
+namespace WebCore {
+
+// A class that stores static enablers for all experimental features
+class RuntimeEnabledFeatures {
+public:
+    static void setDatabaseEnabled(bool isEnabled) { isDatabaseEnabled = isEnabled; }
+    static bool databaseEnabled() { return isDatabaseEnabled; }
+
+private:
+    RuntimeEnabledFeatures() { }
+
+    static bool isDatabaseEnabled;
+};
+
+} // namespace WebCore
+
+#endif // RuntimeEnabledFeatures_h
index 126392d8c3ed0d69e1afa83bf455027dfd4c94f0..765dbe0a17b465ee8382285a7462dae8c74e90f9 100644 (file)
@@ -569,12 +569,16 @@ namespace WebCore {
 
         DECLARE_INDEXED_PROPERTY_GETTER(ClientRectList);
         DECLARE_INDEXED_PROPERTY_GETTER(FileList);
-  
+
 #if ENABLE(DATAGRID)
         DECLARE_PROPERTY_ACCESSOR(HTMLDataGridElementDataSource);
         DECLARE_INDEXED_PROPERTY_GETTER(DataGridColumnList);
         DECLARE_NAMED_PROPERTY_GETTER(DataGridColumnList);
-#endif      
+#endif
+
+#if ENABLE(DATABASE)
+        DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowOpenDatabase);
+#endif
 
 #if ENABLE(DOM_STORAGE)
         DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowLocalStorage);
index 6dc8b548c930c38c192a50a39cd60ffe25d90e69..bd165ef088a160aa5589746c823142734ad6bf99 100644 (file)
@@ -49,6 +49,7 @@
 #include "NotificationCenter.h"
 #include "Page.h"
 #include "PlatformScreen.h"
+#include "RuntimeEnabledFeatures.h"
 #include "ScheduledAction.h"
 #include "ScriptSourceCode.h"
 #include "SerializedScriptValue.h"
@@ -281,6 +282,13 @@ ACCESSOR_RUNTIME_ENABLER(DOMWindowWebSocket)
 }
 #endif
 
+#if ENABLE(DATABASE)
+ACCESSOR_RUNTIME_ENABLER(DOMWindowOpenDatabase)
+{
+    return WebCore::RuntimeEnabledFeatures::databaseEnabled();
+}
+#endif
+
 #if ENABLE(DOM_STORAGE)
 ACCESSOR_RUNTIME_ENABLER(DOMWindowLocalStorage)
 {
index 7dfc7d0c36241929b04eb28ca52aabd9a7f8b1ea..e86ebc59b1dc295a5074f0489d0285452123b743 100644 (file)
@@ -160,7 +160,7 @@ module window {
         readonly attribute DOMApplicationCache applicationCache;
 #endif    
 #if defined(ENABLE_DATABASE) && ENABLE_DATABASE
-        Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize)
+        [EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize)
             raises(DOMException);
 #endif
 #if defined(ENABLE_DOM_STORAGE) && ENABLE_DOM_STORAGE