Title: [104654] trunk/Source/WebCore
Revision
104654
Author
[email protected]
Date
2012-01-10 17:12:22 -0800 (Tue, 10 Jan 2012)

Log Message

Use the [Supplemental] IDL in SQLDatabase
https://bugs.webkit.org/show_bug.cgi?id=76004

Reviewed by Adam Barth.

We've been working on WebKit modularization. By using the [Supplemental] IDL,
we can move SQLDatabase related code from WebCore/page/DOMWindow.{h,cpp,idl}
to WebCore/storage/DOMWindowSQLDatabase.{h,cpp,idl}.

Tests: storage/open-database-creation-callback-isolated-world.html
       storage/open-database-creation-callback.html
       storage/open-database-empty-version.html
       storage/open-database-over-quota.html
       storage/open-database-set-empty-version.html
       storage/open-database-while-transaction-in-progress.html

* CMakeLists.txt: Added DOMWindowSQLDatabase.{idl,h,cpp} to the build script.
* DerivedSources.make: Ditto.
* DerivedSources.pri: Ditto.
* GNUmakefile.list.am: Ditto.
* Target.pri: Ditto.
* WebCore.gypi: Ditto.
* WebCore.vcproj/WebCore.vcproj: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.

* page/DOMWindow.cpp: Removed SQLDatabase related code.
* page/DOMWindow.idl: Ditto.
* page/DOMWindow.h: Ditto. Moved isCurrentlyDisplayedInFrame() from private: to public:
so that DOMWindowSQLDatabase::openDatabase() can access it.

* storage/DOMWindowSQLDatabase.cpp: Added. Moved openDatabase() from DOMWindow.cpp to here.
(WebCore::DOMWindowSQLDatabase::openDatabase):
* storage/DOMWindowSQLDatabase.h: Added. Moved openDatabase() from DOMWindow.h to here.
* storage/DOMWindowSQLDatabase.idl: Added. Using the [Supplemental] IDL, moved openDatabase()
and SQLException from DOMWindow.idl to here.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (104653 => 104654)


--- trunk/Source/WebCore/CMakeLists.txt	2012-01-11 01:10:08 UTC (rev 104653)
+++ trunk/Source/WebCore/CMakeLists.txt	2012-01-11 01:12:22 UTC (rev 104654)
@@ -1349,6 +1349,7 @@
 
     storage/AbstractDatabase.cpp
     storage/ChangeVersionWrapper.cpp
+    storage/DOMWindowSQLDatabase.cpp
     storage/Database.cpp
     storage/DatabaseAuthorizer.cpp
     storage/DatabaseSync.cpp
@@ -1468,6 +1469,7 @@
 
 IF (ENABLE_SQL_DATABASE)
     LIST(APPEND WebCore_IDL_FILES
+        storage/DOMWindowSQLDatabase.idl
         storage/Database.idl
         storage/DatabaseCallback.idl
         storage/DatabaseSync.idl

Modified: trunk/Source/WebCore/ChangeLog (104653 => 104654)


--- trunk/Source/WebCore/ChangeLog	2012-01-11 01:10:08 UTC (rev 104653)
+++ trunk/Source/WebCore/ChangeLog	2012-01-11 01:12:22 UTC (rev 104654)
@@ -1,3 +1,41 @@
+2012-01-10  Kentaro Hara  <[email protected]>
+
+        Use the [Supplemental] IDL in SQLDatabase
+        https://bugs.webkit.org/show_bug.cgi?id=76004
+
+        Reviewed by Adam Barth.
+
+        We've been working on WebKit modularization. By using the [Supplemental] IDL,
+        we can move SQLDatabase related code from WebCore/page/DOMWindow.{h,cpp,idl}
+        to WebCore/storage/DOMWindowSQLDatabase.{h,cpp,idl}.
+
+        Tests: storage/open-database-creation-callback-isolated-world.html
+               storage/open-database-creation-callback.html
+               storage/open-database-empty-version.html
+               storage/open-database-over-quota.html
+               storage/open-database-set-empty-version.html
+               storage/open-database-while-transaction-in-progress.html
+
+        * CMakeLists.txt: Added DOMWindowSQLDatabase.{idl,h,cpp} to the build script.
+        * DerivedSources.make: Ditto.
+        * DerivedSources.pri: Ditto.
+        * GNUmakefile.list.am: Ditto.
+        * Target.pri: Ditto.
+        * WebCore.gypi: Ditto.
+        * WebCore.vcproj/WebCore.vcproj: Ditto.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+
+        * page/DOMWindow.cpp: Removed SQLDatabase related code.
+        * page/DOMWindow.idl: Ditto.
+        * page/DOMWindow.h: Ditto. Moved isCurrentlyDisplayedInFrame() from private: to public:
+        so that DOMWindowSQLDatabase::openDatabase() can access it.
+
+        * storage/DOMWindowSQLDatabase.cpp: Added. Moved openDatabase() from DOMWindow.cpp to here.
+        (WebCore::DOMWindowSQLDatabase::openDatabase):
+        * storage/DOMWindowSQLDatabase.h: Added. Moved openDatabase() from DOMWindow.h to here.
+        * storage/DOMWindowSQLDatabase.idl: Added. Using the [Supplemental] IDL, moved openDatabase()
+        and SQLException from DOMWindow.idl to here.
+
 2012-01-10  Chris Marrin  <[email protected]>
 
         CIFilter version of Sepia Tone filter doesn't match software

Modified: trunk/Source/WebCore/DerivedSources.make (104653 => 104654)


--- trunk/Source/WebCore/DerivedSources.make	2012-01-11 01:10:08 UTC (rev 104653)
+++ trunk/Source/WebCore/DerivedSources.make	2012-01-11 01:12:22 UTC (rev 104654)
@@ -336,6 +336,7 @@
     $(WebCore)/plugins/DOMMimeTypeArray.idl \
     $(WebCore)/plugins/DOMPlugin.idl \
     $(WebCore)/plugins/DOMPluginArray.idl \
+    $(WebCore)/storage/DOMWindowSQLDatabase.idl \
     $(WebCore)/storage/Database.idl \
     $(WebCore)/storage/DatabaseCallback.idl \
     $(WebCore)/storage/DatabaseSync.idl \

Modified: trunk/Source/WebCore/DerivedSources.pri (104653 => 104654)


--- trunk/Source/WebCore/DerivedSources.pri	2012-01-11 01:10:08 UTC (rev 104653)
+++ trunk/Source/WebCore/DerivedSources.pri	2012-01-11 01:12:22 UTC (rev 104654)
@@ -365,6 +365,7 @@
     plugins/DOMMimeType.idl \
     plugins/DOMPluginArray.idl \
     plugins/DOMMimeTypeArray.idl \
+    storage/DOMWindowSQLDatabase.idl \
     storage/Database.idl \
     storage/DatabaseCallback.idl \
     storage/DatabaseSync.idl \

Modified: trunk/Source/WebCore/GNUmakefile.list.am (104653 => 104654)


--- trunk/Source/WebCore/GNUmakefile.list.am	2012-01-11 01:10:08 UTC (rev 104653)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2012-01-11 01:12:22 UTC (rev 104654)
@@ -3754,6 +3754,8 @@
 	Source/WebCore/storage/AbstractDatabase.h \
 	Source/WebCore/storage/ChangeVersionWrapper.cpp \
 	Source/WebCore/storage/ChangeVersionWrapper.h \
+	Source/WebCore/storage/DOMWindowSQLDatabase.cpp \
+	Source/WebCore/storage/DOMWindowSQLDatabase.h \
 	Source/WebCore/storage/DatabaseAuthorizer.cpp \
 	Source/WebCore/storage/DatabaseAuthorizer.h \
 	Source/WebCore/storage/DatabaseCallback.h \
@@ -4600,6 +4602,7 @@
 	DerivedSources/WebCore/JSSQLTransactionSyncCallback.h
 
 dom_binding_idls += \
+	$(WebCore)/storage/DOMWindowSQLDatabase.idl \
 	$(WebCore)/storage/Database.idl \
 	$(WebCore)/storage/DatabaseCallback.idl \
 	$(WebCore)/storage/DatabaseSync.idl \

Modified: trunk/Source/WebCore/Target.pri (104653 => 104654)


--- trunk/Source/WebCore/Target.pri	2012-01-11 01:10:08 UTC (rev 104653)
+++ trunk/Source/WebCore/Target.pri	2012-01-11 01:12:22 UTC (rev 104654)
@@ -1279,6 +1279,7 @@
     rendering/style/StyleTransformData.cpp \
     rendering/style/StyleVisualData.cpp \
     storage/AbstractDatabase.cpp \
+    storage/DOMWindowSQLDatabase.cpp \
     storage/Database.cpp \
     storage/DatabaseAuthorizer.cpp \
     storage/DatabaseSync.cpp \
@@ -2473,6 +2474,7 @@
     rendering/svg/SVGTextRunRenderingContext.h \
     storage/AbstractDatabase.h \
     storage/ChangeVersionWrapper.h \
+    storage/DOMWindowSQLDatabase.h \
     storage/DatabaseAuthorizer.h \
     storage/Database.h \
     storage/DatabaseCallback.h \

Modified: trunk/Source/WebCore/WebCore.gypi (104653 => 104654)


--- trunk/Source/WebCore/WebCore.gypi	2012-01-11 01:10:08 UTC (rev 104653)
+++ trunk/Source/WebCore/WebCore.gypi	2012-01-11 01:12:22 UTC (rev 104654)
@@ -1452,6 +1452,7 @@
             'plugins/DOMMimeTypeArray.idl',
             'plugins/DOMPlugin.idl',
             'plugins/DOMPluginArray.idl',
+            'storage/DOMWindowSQLDatabase.idl',
             'storage/Database.idl',
             'storage/DatabaseCallback.idl',
             'storage/DatabaseSync.idl',
@@ -4917,6 +4918,8 @@
             'storage/AbstractDatabase.cpp',
             'storage/ChangeVersionWrapper.cpp',
             'storage/ChangeVersionWrapper.h',
+            'storage/DOMWindowSQLDatabase.cpp',
+            'storage/DOMWindowSQLDatabase.h',
             'storage/Database.cpp',
             'storage/DatabaseAuthorizer.cpp',
             'storage/DatabaseAuthorizer.h',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (104653 => 104654)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-01-11 01:10:08 UTC (rev 104653)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-01-11 01:12:22 UTC (rev 104654)
@@ -70526,6 +70526,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\storage\DOMWindowSQLDatabase.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\storage\DOMWindowSQLDatabase.h"
+				>
+			</File>
+			<File
 				RelativePath="..\storage\Database.cpp"
 				>
 			</File>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (104653 => 104654)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-01-11 01:10:08 UTC (rev 104653)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-01-11 01:12:22 UTC (rev 104654)
@@ -4048,6 +4048,8 @@
 		A8EA800C0A19516E00A8EF5F /* StyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA80040A19516E00A8EF5F /* StyleSheet.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A8EA800D0A19516E00A8EF5F /* StyleSheet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA80050A19516E00A8EF5F /* StyleSheet.cpp */; };
 		A8EA800E0A19516E00A8EF5F /* MediaList.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA80060A19516E00A8EF5F /* MediaList.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		A8F457A014BC1A88000CEA59 /* DOMWindowSQLDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8F4579D14BC13EC000CEA59 /* DOMWindowSQLDatabase.cpp */; };
+		A8F457A114BC1A94000CEA59 /* DOMWindowSQLDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = A8F4579E14BC13EC000CEA59 /* DOMWindowSQLDatabase.h */; };
 		A8F46A840CB20A9D003A9670 /* DOMSVGClipPathElement.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 8503612C0ACE007B001F3D9E /* DOMSVGClipPathElement.h */; };
 		A8F46A880CB20A9D003A9670 /* DOMSVGGradientElement.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85C9A2EC0AD7E90300FBFF1E /* DOMSVGGradientElement.h */; };
 		A8F46A890CB20A9D003A9670 /* DOMSVGAnimateColorElement.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 850361280ACE007B001F3D9E /* DOMSVGAnimateColorElement.h */; };
@@ -11321,6 +11323,9 @@
 		A8EA80050A19516E00A8EF5F /* StyleSheet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StyleSheet.cpp; sourceTree = "<group>"; };
 		A8EA80060A19516E00A8EF5F /* MediaList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaList.h; sourceTree = "<group>"; };
 		A8F4578F14B2B004000CEA59 /* resolve-supplemental.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; name = "resolve-supplemental.pl"; path = "scripts/resolve-supplemental.pl"; sourceTree = "<group>"; };
+		A8F4579D14BC13EC000CEA59 /* DOMWindowSQLDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowSQLDatabase.cpp; sourceTree = "<group>"; };
+		A8F4579E14BC13EC000CEA59 /* DOMWindowSQLDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindowSQLDatabase.h; sourceTree = "<group>"; };
+		A8F4579F14BC13EC000CEA59 /* DOMWindowSQLDatabase.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMWindowSQLDatabase.idl; sourceTree = "<group>"; };
 		A8FA6E5B0E4CFDED00D5CF49 /* Pattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pattern.h; sourceTree = "<group>"; };
 		A8FA6E5C0E4CFDED00D5CF49 /* Pattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Pattern.cpp; sourceTree = "<group>"; };
 		A9C6E4E10D745E05006442E9 /* DOMMimeType.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DOMMimeType.cpp; sourceTree = "<group>"; };
@@ -14392,6 +14397,9 @@
 		1AE82EC90CAAE177002237AE /* storage */ = {
 			isa = PBXGroup;
 			children = (
+				A8F4579D14BC13EC000CEA59 /* DOMWindowSQLDatabase.cpp */,
+				A8F4579E14BC13EC000CEA59 /* DOMWindowSQLDatabase.h */,
+				A8F4579F14BC13EC000CEA59 /* DOMWindowSQLDatabase.idl */,
 				B5B5DC67119BB3D5002A8790 /* AbstractDatabase.cpp */,
 				B5B5DC68119BB3D5002A8790 /* AbstractDatabase.h */,
 				514185ED0CD65F0400763C99 /* ChangeVersionWrapper.cpp */,
@@ -24904,6 +24912,7 @@
 				974A862314B7ADBB003FDC76 /* FrameDestructionObserver.h in Headers */,
 				97D2AD0414B823A60093DF32 /* DOMWindowProperty.h in Headers */,
 				7AABA25A14BC613300AA9A11 /* DOMEditor.h in Headers */,
+				A8F457A114BC1A94000CEA59 /* DOMWindowSQLDatabase.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -27811,6 +27820,7 @@
 				974A862214B7ADBB003FDC76 /* FrameDestructionObserver.cpp in Sources */,
 				97D2AD0314B823A60093DF32 /* DOMWindowProperty.cpp in Sources */,
 				7AABA25914BC613300AA9A11 /* DOMEditor.cpp in Sources */,
+				A8F457A014BC1A88000CEA59 /* DOMWindowSQLDatabase.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (104653 => 104654)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2012-01-11 01:10:08 UTC (rev 104653)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2012-01-11 01:12:22 UTC (rev 104654)
@@ -1381,23 +1381,6 @@
     return page->deviceScaleFactor();
 }
 
-#if ENABLE(SQL_DATABASE)
-PassRefPtr<Database> DOMWindow::openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode& ec)
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-
-    RefPtr<Database> database = 0;
-    if (m_frame && AbstractDatabase::isAvailable() && m_frame->document()->securityOrigin()->canAccessDatabase())
-        database = Database::openDatabase(m_frame->document(), name, version, displayName, estimatedSize, creationCallback, ec);
-
-    if (!database && !ec)
-        ec = SECURITY_ERR;
-
-    return database;
-}
-#endif
-
 void DOMWindow::scrollBy(int x, int y) const
 {
     if (!isCurrentlyDisplayedInFrame())

Modified: trunk/Source/WebCore/page/DOMWindow.h (104653 => 104654)


--- trunk/Source/WebCore/page/DOMWindow.h	2012-01-11 01:10:08 UTC (rev 104653)
+++ trunk/Source/WebCore/page/DOMWindow.h	2012-01-11 01:12:22 UTC (rev 104654)
@@ -355,10 +355,6 @@
         DOMURL* webkitURL() const;
 #endif
 
-#if ENABLE(SQL_DATABASE)
-        PassRefPtr<Database> openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode&);
-#endif
-
 #if ENABLE(DEVICE_ORIENTATION)
         DEFINE_ATTRIBUTE_EVENT_LISTENER(devicemotion);
         DEFINE_ATTRIBUTE_EVENT_LISTENER(deviceorientation);
@@ -418,15 +414,15 @@
         Performance* performance() const;
 #endif
 
-    private:
-        explicit DOMWindow(Frame*);
-
         // FIXME: When this DOMWindow is no longer the active DOMWindow (i.e.,
         // when its document is no longer the document that is displayed in its
         // frame), we would like to zero out m_frame to avoid being confused
         // by the document that is currently active in m_frame.
         bool isCurrentlyDisplayedInFrame() const;
 
+    private:
+        explicit DOMWindow(Frame*);
+
         virtual void refEventTarget() { ref(); }
         virtual void derefEventTarget() { deref(); }
         virtual EventTargetData* eventTargetData();

Modified: trunk/Source/WebCore/page/DOMWindow.idl (104653 => 104654)


--- trunk/Source/WebCore/page/DOMWindow.idl	2012-01-11 01:10:08 UTC (rev 104653)
+++ trunk/Source/WebCore/page/DOMWindow.idl	2012-01-11 01:12:22 UTC (rev 104654)
@@ -163,10 +163,6 @@
                                                      in [Optional=CallWithDefaultValue] WebKitPoint p);
 
         readonly attribute [EnabledAtRuntime] DOMApplicationCache applicationCache;
-#if defined(ENABLE_SQL_DATABASE) && ENABLE_SQL_DATABASE
-        [EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Callback, Optional] DatabaseCallback creationCallback)
-            raises(DOMException);
-#endif
 
         readonly attribute [EnabledAtRuntime] Storage sessionStorage
             getter raises(DOMException);
@@ -794,9 +790,6 @@
 #endif
 #endif
 
-        attribute [Conditional=SQL_DATABASE] SQLExceptionConstructor SQLException;
-
-
         attribute DOMFormDataConstructor FormData;
 
         attribute [Conditional=BLOB|FILE_SYSTEM] FileErrorConstructor FileError;

Added: trunk/Source/WebCore/storage/DOMWindowSQLDatabase.cpp (0 => 104654)


--- trunk/Source/WebCore/storage/DOMWindowSQLDatabase.cpp	                        (rev 0)
+++ trunk/Source/WebCore/storage/DOMWindowSQLDatabase.cpp	2012-01-11 01:12:22 UTC (rev 104654)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2012 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 "DOMWindowSQLDatabase.h"
+
+#include "AbstractDatabase.h"
+#include "DOMWindow.h"
+#include "Database.h"
+#include "DatabaseCallback.h"
+#include "Document.h"
+#include "Frame.h"
+#include "SecurityOrigin.h"
+
+#if ENABLE(SQL_DATABASE)
+
+namespace WebCore {
+
+PassRefPtr<Database> DOMWindowSQLDatabase::openDatabase(DOMWindow* window, const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode& ec)
+{
+    if (!window->isCurrentlyDisplayedInFrame())
+        return 0;
+
+    RefPtr<Database> database = 0;
+    if (window->frame() && AbstractDatabase::isAvailable() && window->frame()->document()->securityOrigin()->canAccessDatabase())
+        database = Database::openDatabase(window->frame()->document(), name, version, displayName, estimatedSize, creationCallback, ec);
+
+    if (!database && !ec)
+        ec = SECURITY_ERR;
+
+    return database;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SQL_DATABASE)

Added: trunk/Source/WebCore/storage/DOMWindowSQLDatabase.h (0 => 104654)


--- trunk/Source/WebCore/storage/DOMWindowSQLDatabase.h	                        (rev 0)
+++ trunk/Source/WebCore/storage/DOMWindowSQLDatabase.h	2012-01-11 01:12:22 UTC (rev 104654)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2012 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 DOMWindowSQLDatabase_h
+#define DOMWindowSQLDatabase_h
+
+#if ENABLE(SQL_DATABASE)
+#include "ExceptionCode.h"
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class DOMWindow;
+class Database;
+class DatabaseCallback;
+class Frame;
+
+class DOMWindowSQLDatabase {
+public:
+    static PassRefPtr<Database> openDatabase(DOMWindow*, const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode&);
+
+private:
+    DOMWindowSQLDatabase() { };
+    ~DOMWindowSQLDatabase() { };
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SQL_DATABASE)
+
+#endif // DOMWindowSQLDatabase_h

Added: trunk/Source/WebCore/storage/DOMWindowSQLDatabase.idl (0 => 104654)


--- trunk/Source/WebCore/storage/DOMWindowSQLDatabase.idl	                        (rev 0)
+++ trunk/Source/WebCore/storage/DOMWindowSQLDatabase.idl	2012-01-11 01:12:22 UTC (rev 104654)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+module window {
+
+    interface [
+        Conditional=SQL_DATABASE,
+        Supplemental=DOMWindow
+    ] DOMWindowSQLDatabase {
+        [EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Callback, Optional] DatabaseCallback creationCallback)
+            raises(DOMException);
+        attribute SQLExceptionConstructor SQLException;
+    };
+
+}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to