Unprefix IndexedDB
authordgrogan@chromium.org <dgrogan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2012 17:17:22 +0000 (17:17 +0000)
committerdgrogan@chromium.org <dgrogan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2012 17:17:22 +0000 (17:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=96548

Reviewed by Adam Barth.

Source/WebCore:

We are largely compatible with the FF implementation and the w3c test
suite submitted by MS. The w3c test suite doesn't yet check
for lack of prefix; this is mostly to signal to devs that we think our
implementation is stable.

This patch uses the new FeatureObserver to get data about prefixed
vs unprefixed usage.

Tests: storage/indexeddb/unprefix-workers.html
       storage/indexeddb/unprefix.html

* Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
(WebCore::DOMWindowIndexedDatabase::indexedDB):
* Modules/indexeddb/DOMWindowIndexedDatabase.h:
(DOMWindowIndexedDatabase):
* Modules/indexeddb/DOMWindowIndexedDatabase.idl:
* Modules/indexeddb/WorkerContextIndexedDatabase.cpp:
(WebCore::WorkerContextIndexedDatabase::indexedDB):
* Modules/indexeddb/WorkerContextIndexedDatabase.h:
(WorkerContextIndexedDatabase):
* Modules/indexeddb/WorkerContextIndexedDatabase.idl:
* bindings/generic/RuntimeEnabledFeatures.h:
Making the auxiliary objects RuntimeEnabled didn't make much sense as
they are useless without the factory, so always enable them.

(WebCore::RuntimeEnabledFeatures::indexedDBEnabled):
* bindings/scripts/CodeGeneratorGObject.pm:
(SkipAttribute):
* page/FeatureObserver.h:

LayoutTests:

* storage/indexeddb/resources/unprefix.js: Added.
(test):
* storage/indexeddb/unprefix-expected.txt: Added.
* storage/indexeddb/unprefix-workers-expected.txt: Added.
* storage/indexeddb/unprefix-workers.html: Added.
* storage/indexeddb/unprefix.html: Added.

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

16 files changed:
LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/resources/unprefix.js [new file with mode: 0644]
LayoutTests/storage/indexeddb/unprefix-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/unprefix-workers-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/unprefix-workers.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/unprefix.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp
Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.h
Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.idl
Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.cpp
Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.h
Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.idl
Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h
Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm
Source/WebCore/page/FeatureObserver.h

index 2f4a793..6ae2ecb 100644 (file)
@@ -1,3 +1,17 @@
+2012-09-24  David Grogan  <dgrogan@chromium.org>
+
+        Unprefix IndexedDB
+        https://bugs.webkit.org/show_bug.cgi?id=96548
+
+        Reviewed by Adam Barth.
+
+        * storage/indexeddb/resources/unprefix.js: Added.
+        (test):
+        * storage/indexeddb/unprefix-expected.txt: Added.
+        * storage/indexeddb/unprefix-workers-expected.txt: Added.
+        * storage/indexeddb/unprefix-workers.html: Added.
+        * storage/indexeddb/unprefix.html: Added.
+
 2012-09-24  W. James MacLean  <wjmaclean@chromium.org>
 
         [chromium] Rebaseline gesture highlight test expectation images.
diff --git a/LayoutTests/storage/indexeddb/resources/unprefix.js b/LayoutTests/storage/indexeddb/resources/unprefix.js
new file mode 100644 (file)
index 0000000..503b512
--- /dev/null
@@ -0,0 +1,23 @@
+if (this.importScripts) {
+    importScripts('../../../fast/js/resources/js-test-pre.js');
+    importScripts('shared.js');
+}
+
+description("Check that IDBFactory is available through the prefixed or unprefixed entry point.");
+
+function test()
+{
+    shouldBeEqualToString("String(self.indexedDB)", "[object IDBFactory]");
+    shouldBeEqualToString("String(self.webkitIndexedDB)", "[object IDBFactory]");
+    shouldBeNonNull("IDBCursor");
+    shouldBeNonNull("IDBDatabase");
+    shouldBeNonNull("IDBFactory");
+    shouldBeNonNull("IDBIndex");
+    shouldBeNonNull("IDBKeyRange");
+    shouldBeNonNull("IDBObjectStore");
+    shouldBeNonNull("IDBRequest");
+    shouldBeNonNull("IDBTransaction");
+    finishJSTest();
+}
+
+test();
diff --git a/LayoutTests/storage/indexeddb/unprefix-expected.txt b/LayoutTests/storage/indexeddb/unprefix-expected.txt
new file mode 100644 (file)
index 0000000..1d4c2ef
--- /dev/null
@@ -0,0 +1,19 @@
+Check that IDBFactory is available through the prefixed or unprefixed entry point.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS String(self.indexedDB) is "[object IDBFactory]"
+PASS String(self.webkitIndexedDB) is "[object IDBFactory]"
+PASS IDBCursor is non-null.
+PASS IDBDatabase is non-null.
+PASS IDBFactory is non-null.
+PASS IDBIndex is non-null.
+PASS IDBKeyRange is non-null.
+PASS IDBObjectStore is non-null.
+PASS IDBRequest is non-null.
+PASS IDBTransaction is non-null.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/unprefix-workers-expected.txt b/LayoutTests/storage/indexeddb/unprefix-workers-expected.txt
new file mode 100644 (file)
index 0000000..5e78ee2
--- /dev/null
@@ -0,0 +1,20 @@
+[Worker] Check that IDBFactory is available through the prefixed or unprefixed entry point.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/unprefix.js
+PASS [Worker] String(self.indexedDB) is "[object IDBFactory]"
+PASS [Worker] String(self.webkitIndexedDB) is "[object IDBFactory]"
+PASS [Worker] IDBCursor is non-null.
+PASS [Worker] IDBDatabase is non-null.
+PASS [Worker] IDBFactory is non-null.
+PASS [Worker] IDBIndex is non-null.
+PASS [Worker] IDBKeyRange is non-null.
+PASS [Worker] IDBObjectStore is non-null.
+PASS [Worker] IDBRequest is non-null.
+PASS [Worker] IDBTransaction is non-null.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/unprefix-workers.html b/LayoutTests/storage/indexeddb/unprefix-workers.html
new file mode 100644 (file)
index 0000000..da6f1d4
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<script>startWorker('resources/unprefix.js');</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/unprefix.html b/LayoutTests/storage/indexeddb/unprefix.html
new file mode 100644 (file)
index 0000000..e25cb6c
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<script src="resources/unprefix.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
index 4c4cd1e..da0cf03 100644 (file)
@@ -1,3 +1,40 @@
+2012-09-24  David Grogan  <dgrogan@chromium.org>
+
+        Unprefix IndexedDB
+        https://bugs.webkit.org/show_bug.cgi?id=96548
+
+        Reviewed by Adam Barth.
+
+        We are largely compatible with the FF implementation and the w3c test
+        suite submitted by MS. The w3c test suite doesn't yet check
+        for lack of prefix; this is mostly to signal to devs that we think our
+        implementation is stable.
+
+        This patch uses the new FeatureObserver to get data about prefixed
+        vs unprefixed usage.
+
+        Tests: storage/indexeddb/unprefix-workers.html
+               storage/indexeddb/unprefix.html
+
+        * Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
+        (WebCore::DOMWindowIndexedDatabase::indexedDB):
+        * Modules/indexeddb/DOMWindowIndexedDatabase.h:
+        (DOMWindowIndexedDatabase):
+        * Modules/indexeddb/DOMWindowIndexedDatabase.idl:
+        * Modules/indexeddb/WorkerContextIndexedDatabase.cpp:
+        (WebCore::WorkerContextIndexedDatabase::indexedDB):
+        * Modules/indexeddb/WorkerContextIndexedDatabase.h:
+        (WorkerContextIndexedDatabase):
+        * Modules/indexeddb/WorkerContextIndexedDatabase.idl:
+        * bindings/generic/RuntimeEnabledFeatures.h:
+        Making the auxiliary objects RuntimeEnabled didn't make much sense as
+        they are useless without the factory, so always enable them.
+
+        (WebCore::RuntimeEnabledFeatures::indexedDBEnabled):
+        * bindings/scripts/CodeGeneratorGObject.pm:
+        (SkipAttribute):
+        * page/FeatureObserver.h:
+
 2012-09-24  Andrey Adaikin  <aandrey@chromium.org>
 
         Web Inspector: [WebGL] First step towards 2D canvas instrumentation in injected script
index 9f4cbb4..168028b 100644 (file)
@@ -88,12 +88,12 @@ void DOMWindowIndexedDatabase::willDetachGlobalObjectFromFrame()
     DOMWindowProperty::willDetachGlobalObjectFromFrame();
 }
 
-IDBFactory* DOMWindowIndexedDatabase::webkitIndexedDB(DOMWindow* window)
+IDBFactory* DOMWindowIndexedDatabase::indexedDB(DOMWindow* window)
 {
-    return from(window)->webkitIndexedDB();
+    return from(window)->indexedDB();
 }
 
-IDBFactory* DOMWindowIndexedDatabase::webkitIndexedDB()
+IDBFactory* DOMWindowIndexedDatabase::indexedDB()
 {
     Document* document = m_window->document();
     if (!document)
index fd32f9d..c8c6303 100644 (file)
@@ -41,7 +41,7 @@ public:
     virtual ~DOMWindowIndexedDatabase();
     static DOMWindowIndexedDatabase* from(DOMWindow*);
 
-    static IDBFactory* webkitIndexedDB(DOMWindow*);
+    static IDBFactory* indexedDB(DOMWindow*);
 
     virtual void disconnectFrameForPageCache() OVERRIDE;
     virtual void reconnectFrameFromPageCache(Frame*) OVERRIDE;
@@ -52,7 +52,7 @@ public:
 private:
     explicit DOMWindowIndexedDatabase(DOMWindow*);
 
-    IDBFactory* webkitIndexedDB();
+    IDBFactory* indexedDB();
 
     DOMWindow* m_window;
     RefPtr<IDBFactory> m_idbFactory;
index 09513f1..a290b73 100644 (file)
@@ -30,7 +30,7 @@ module window {
         Conditional=INDEXED_DATABASE,
         Supplemental=DOMWindow
     ] DOMWindowIndexedDatabase {
-        readonly attribute [V8MeasureAs=PrefixedIndexedDB] IDBFactory webkitIndexedDB;
+        readonly attribute [ImplementedAs=indexedDB,V8MeasureAs=PrefixedIndexedDB] IDBFactory webkitIndexedDB;
 
         attribute IDBCursorConstructor webkitIDBCursor;
         attribute IDBDatabaseConstructor webkitIDBDatabase;
@@ -41,6 +41,18 @@ module window {
         attribute IDBObjectStoreConstructor webkitIDBObjectStore;
         attribute IDBRequestConstructor webkitIDBRequest;
         attribute IDBTransactionConstructor webkitIDBTransaction;
+
+        readonly attribute [V8MeasureAs=UnprefixedIndexedDB] IDBFactory indexedDB;
+
+        attribute IDBCursorConstructor IDBCursor;
+        attribute IDBDatabaseConstructor IDBDatabase;
+        attribute IDBDatabaseExceptionConstructor IDBDatabaseException;
+        attribute IDBFactoryConstructor IDBFactory;
+        attribute IDBIndexConstructor IDBIndex;
+        attribute IDBKeyRangeConstructor IDBKeyRange;
+        attribute IDBObjectStoreConstructor IDBObjectStore;
+        attribute IDBRequestConstructor IDBRequest;
+        attribute IDBTransactionConstructor IDBTransaction;
     };
 
 }
index b3d2099..0a25ea7 100644 (file)
@@ -58,12 +58,12 @@ WorkerContextIndexedDatabase* WorkerContextIndexedDatabase::from(ScriptExecution
     return supplement;
 }
 
-IDBFactory* WorkerContextIndexedDatabase::webkitIndexedDB(ScriptExecutionContext* context)
+IDBFactory* WorkerContextIndexedDatabase::indexedDB(ScriptExecutionContext* context)
 {
-    return from(context)->webkitIndexedDB();
+    return from(context)->indexedDB();
 }
 
-IDBFactory* WorkerContextIndexedDatabase::webkitIndexedDB()
+IDBFactory* WorkerContextIndexedDatabase::indexedDB()
 {
     if (!m_context->securityOrigin()->canAccessDatabase())
         return 0;
index 836caa8..9a84f17 100644 (file)
@@ -42,12 +42,12 @@ public:
     virtual ~WorkerContextIndexedDatabase();
     static WorkerContextIndexedDatabase* from(ScriptExecutionContext*);
 
-    static IDBFactory* webkitIndexedDB(ScriptExecutionContext*);
+    static IDBFactory* indexedDB(ScriptExecutionContext*);
 
 private:
     explicit WorkerContextIndexedDatabase(ScriptExecutionContext*);
 
-    IDBFactory* webkitIndexedDB();
+    IDBFactory* indexedDB();
 
     ScriptExecutionContext* m_context;
     RefPtr<IDBFactoryBackendInterface> m_factoryBackend;
index c336c57..acc5565 100644 (file)
@@ -30,17 +30,29 @@ module threads {
         Conditional=INDEXED_DATABASE,
         Supplemental=WorkerContext
     ] WorkerContextIndexedDatabase {
-        readonly attribute [V8EnabledAtRuntime] IDBFactory webkitIndexedDB;
+        readonly attribute [ImplementedAs=indexedDB,V8EnabledAtRuntime] IDBFactory webkitIndexedDB;
 
-        attribute [V8EnabledAtRuntime] IDBCursorConstructor webkitIDBCursor;
-        attribute [V8EnabledAtRuntime] IDBDatabaseConstructor webkitIDBDatabase;
-        attribute [V8EnabledAtRuntime] IDBDatabaseExceptionConstructor webkitIDBDatabaseException;
-        attribute [V8EnabledAtRuntime] IDBFactoryConstructor webkitIDBFactory;
-        attribute [V8EnabledAtRuntime] IDBIndexConstructor webkitIDBIndex;
-        attribute [V8EnabledAtRuntime] IDBKeyRangeConstructor webkitIDBKeyRange;
-        attribute [V8EnabledAtRuntime] IDBObjectStoreConstructor webkitIDBObjectStore;
-        attribute [V8EnabledAtRuntime] IDBRequestConstructor webkitIDBRequest;
-        attribute [V8EnabledAtRuntime] IDBTransactionConstructor webkitIDBTransaction;
+        attribute IDBCursorConstructor webkitIDBCursor;
+        attribute IDBDatabaseConstructor webkitIDBDatabase;
+        attribute IDBDatabaseExceptionConstructor webkitIDBDatabaseException;
+        attribute IDBFactoryConstructor webkitIDBFactory;
+        attribute IDBIndexConstructor webkitIDBIndex;
+        attribute IDBKeyRangeConstructor webkitIDBKeyRange;
+        attribute IDBObjectStoreConstructor webkitIDBObjectStore;
+        attribute IDBRequestConstructor webkitIDBRequest;
+        attribute IDBTransactionConstructor webkitIDBTransaction;
+
+        readonly attribute [V8EnabledAtRuntime] IDBFactory indexedDB;
+
+        attribute IDBCursorConstructor IDBCursor;
+        attribute IDBDatabaseConstructor IDBDatabase;
+        attribute IDBDatabaseExceptionConstructor IDBDatabaseException;
+        attribute IDBFactoryConstructor IDBFactory;
+        attribute IDBIndexConstructor IDBIndex;
+        attribute IDBKeyRangeConstructor IDBKeyRange;
+        attribute IDBObjectStoreConstructor IDBObjectStore;
+        attribute IDBRequestConstructor IDBRequest;
+        attribute IDBTransactionConstructor IDBTransaction;
     };
 
 }
index fa59458..33a7e6f 100644 (file)
@@ -61,16 +61,7 @@ public:
 
     static void setWebkitIndexedDBEnabled(bool isEnabled) { isIndexedDBEnabled = isEnabled; }
     static bool webkitIndexedDBEnabled() { return isIndexedDBEnabled; }
-    static bool webkitIDBCursorEnabled() { return isIndexedDBEnabled; }
-    static bool webkitIDBDatabaseEnabled() { return isIndexedDBEnabled; }
-    static bool webkitIDBDatabaseErrorEnabled() { return isIndexedDBEnabled; }
-    static bool webkitIDBDatabaseExceptionEnabled() { return isIndexedDBEnabled; }
-    static bool webkitIDBFactoryEnabled() { return isIndexedDBEnabled; }
-    static bool webkitIDBIndexEnabled() { return isIndexedDBEnabled; }
-    static bool webkitIDBKeyRangeEnabled() { return isIndexedDBEnabled; }
-    static bool webkitIDBObjectStoreEnabled() { return isIndexedDBEnabled; }
-    static bool webkitIDBRequestEnabled() { return isIndexedDBEnabled; }
-    static bool webkitIDBTransactionEnabled() { return isIndexedDBEnabled; }
+    static bool indexedDBEnabled() { return isIndexedDBEnabled; }
 
 #if ENABLE(CSS_EXCLUSIONS)
     static void setCSSExclusionsEnabled(bool isEnabled) { isCSSExclusionsEnabled = isEnabled; }
index c84087b..5d8af4a 100644 (file)
@@ -203,7 +203,7 @@ sub SkipAttribute {
     }
 
     # Skip indexed database attributes for now, they aren't yet supported for the GObject generator.
-    if ($attribute->signature->name =~ /^webkitIndexedDB/ or $attribute->signature->name =~ /^webkitIDB/) {
+    if ($attribute->signature->name =~ /^(?:webkit)?[Ii]ndexedDB/ or $attribute->signature->name =~ /^(?:webkit)?IDB/) {
         return 1;
     }
 
index 9096ec5..6a50c53 100644 (file)
@@ -48,6 +48,7 @@ public:
         LegacyWebAudioNoteOn,
         WebAudioStart,
         PrefixedContentSecurityPolicy,
+        UnprefixedIndexedDB,
         // Add new features above this line.
         NumberOfFeatures, // This enum value must be last.
     };