Changeset 105378 in webkit


Ignore:
Timestamp:
Jan 18, 2012 9:20:17 PM (12 years ago)
Author:
rolandsteiner@chromium.org
Message:

Unreviewed, rolling out r105376.
http://trac.webkit.org/changeset/105376
https://bugs.webkit.org/show_bug.cgi?id=76601

Roll 76493 back in after discussion with jsbell (Requested by
rolandsteiner on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-01-18

Source/WebCore:

  • bindings/v8/IDBBindingUtilities.cpp:

(WebCore::injectIDBKeyIntoSerializedValue):

LayoutTests:

  • storage/indexeddb/objectstore-autoincrement-expected.txt:
  • storage/indexeddb/objectstore-autoincrement.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r105376 r105378  
     12012-01-18  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r105376.
     4        http://trac.webkit.org/changeset/105376
     5        https://bugs.webkit.org/show_bug.cgi?id=76601
     6
     7        Roll 76493 back in after discussion with jsbell (Requested by
     8        rolandsteiner on #webkit).
     9
     10        * storage/indexeddb/objectstore-autoincrement-expected.txt:
     11        * storage/indexeddb/objectstore-autoincrement.html:
     12
    1132012-01-18  Sheriff Bot  <webkit.review.bot@gmail.com>
    214
  • trunk/LayoutTests/storage/indexeddb/objectstore-autoincrement-expected.txt

    r105376 r105378  
    1616db.createObjectStore('StoreWithAutoIncrement', {autoIncrement: true})
    1717db.createObjectStore('PlainOldStore', {autoIncrement: false})
     18db.createObjectStore('StoreWithLongKeyPath', {keyPath: 'a.b.c.id', autoIncrement: true})
    1819storeNames = db.objectStoreNames
    1920PASS store.name is "StoreWithKeyPath"
     
    2223PASS storeNames.contains('StoreWithAutoIncrement') is true
    2324PASS storeNames.contains('PlainOldStore') is true
    24 PASS storeNames.length is 3
     25PASS storeNames.length is 4
    2526setVersionCompleted():
    2627trans = db.transaction(['StoreWithKeyPath', 'StoreWithAutoIncrement', 'PlainOldStore'], webkitIDBTransaction.READ_WRITE)
     
    6364addAdamSuccess():
    6465PASS event.target.result is 1
     66testLongKeyPath():
     67trans = db.transaction('StoreWithLongKeyPath', webkitIDBTransaction.READ_WRITE)
     68store = trans.objectStore('StoreWithLongKeyPath')
     69store.add({foo: 'bar'})
     70store.add({foo: 'bar', a: {}})
     71store.add({foo: 'bar', a: {b: {}}})
     72store.add({foo: 'bar', a: {b: {c: {}}}})
     73store.openCursor()
     74expected = null
     75count = 0
     76expected = cursor.value.a.b.c.id + 1
     77PASS cursor.value.foo is 'bar'
     78PASS cursor.value.a.b.c.id is expected
     79expected = cursor.value.a.b.c.id + 1
     80PASS cursor.value.foo is 'bar'
     81PASS cursor.value.a.b.c.id is expected
     82expected = cursor.value.a.b.c.id + 1
     83PASS cursor.value.foo is 'bar'
     84PASS cursor.value.a.b.c.id is expected
     85expected = cursor.value.a.b.c.id + 1
     86PASS count is 4
    6587PASS successfullyParsed is true
    6688
  • trunk/LayoutTests/storage/indexeddb/objectstore-autoincrement.html

    r105376 r105378  
    4444    evalAndLog("db.createObjectStore('StoreWithAutoIncrement', {autoIncrement: true})");
    4545    evalAndLog("db.createObjectStore('PlainOldStore', {autoIncrement: false})");
     46    evalAndLog("db.createObjectStore('StoreWithLongKeyPath', {keyPath: 'a.b.c.id', autoIncrement: true})");
    4647    var storeNames = evalAndLog("storeNames = db.objectStoreNames");
    4748
     
    5152    shouldBe("storeNames.contains('StoreWithAutoIncrement')", "true");
    5253    shouldBe("storeNames.contains('PlainOldStore')", "true");
    53     shouldBe("storeNames.length", "3");
     54    shouldBe("storeNames.length", "4");
    5455
    5556    // Let the setVersion transaction complete.
     
    6263    window.trans = evalAndLog("trans = db.transaction(['StoreWithKeyPath', 'StoreWithAutoIncrement', 'PlainOldStore'], webkitIDBTransaction.READ_WRITE)");
    6364    trans.onabort = unexpectedAbortCallback;
    64     trans.oncomplete = done;
     65    trans.oncomplete = testLongKeyPath;
    6566
    6667    window.store = evalAndLog("store = trans.objectStore('StoreWithKeyPath')");
     
    158159}
    159160
     161function testLongKeyPath()
     162{
     163    debug("testLongKeyPath():");
     164    trans = evalAndLog("trans = db.transaction('StoreWithLongKeyPath', webkitIDBTransaction.READ_WRITE)");
     165    trans.onabort = unexpectedAbortCallback;
     166    trans.oncomplete = done;
     167
     168    store = evalAndLog("store = trans.objectStore('StoreWithLongKeyPath')");
     169    request = evalAndLog("store.add({foo: 'bar'})");
     170    request.onerror = unexpectedErrorCallback;
     171    request = evalAndLog("store.add({foo: 'bar', a: {}})");
     172    request.onerror = unexpectedErrorCallback;
     173    request = evalAndLog("store.add({foo: 'bar', a: {b: {}}})");
     174    request.onerror = unexpectedErrorCallback;
     175    request = evalAndLog("store.add({foo: 'bar', a: {b: {c: {}}}})");
     176    request.onerror = unexpectedErrorCallback;
     177    cursorRequest = evalAndLog("store.openCursor()");
     178    cursorRequest.onerror = unexpectedErrorCallback;
     179    evalAndLog("expected = null");
     180    evalAndLog("count = 0");
     181    cursorRequest.onsuccess = function () {
     182        cursor = cursorRequest.result;
     183        if (!cursor) {
     184            shouldBe("count", "4");
     185            return;
     186        }
     187        if (expected === null) {
     188            evalAndLog("expected = cursor.value.a.b.c.id + 1");
     189        } else {
     190            shouldBe("cursor.value.foo", "'bar'");
     191            shouldBe("cursor.value.a.b.c.id", "expected");
     192            evalAndLog("expected = cursor.value.a.b.c.id + 1");
     193        }
     194        count++;
     195        cursor.continue();
     196    };
     197}
     198
     199
    160200test();
    161201
  • trunk/Source/WebCore/ChangeLog

    r105377 r105378  
     12012-01-18  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r105376.
     4        http://trac.webkit.org/changeset/105376
     5        https://bugs.webkit.org/show_bug.cgi?id=76601
     6
     7        Roll 76493 back in after discussion with jsbell (Requested by
     8        rolandsteiner on #webkit).
     9
     10        * bindings/v8/IDBBindingUtilities.cpp:
     11        (WebCore::injectIDBKeyIntoSerializedValue):
     12
    1132012-01-18  Ian Vollick  <vollick@chromium.org>
    214
  • trunk/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp

    r105376 r105378  
    126126}
    127127
     128v8::Handle<v8::Value> ensureNthValueOnKeyPath(v8::Handle<v8::Value>& rootValue, const Vector<String>& keyPathElements, size_t index)
     129{
     130    v8::Handle<v8::Value> currentValue(rootValue);
     131
     132    ASSERT(index <= keyPathElements.size());
     133    for (size_t i = 0; i < index; ++i) {
     134        v8::Handle<v8::Value> parentValue(currentValue);
     135        const String& keyPathElement = keyPathElements[i];
     136        if (!get(currentValue, keyPathElement)) {
     137            v8::Handle<v8::Object> object = v8::Object::New();
     138            if (!set(parentValue, keyPathElement, object))
     139                return v8::Handle<v8::Value>();
     140            currentValue = object;
     141        }
     142    }
     143
     144    return currentValue;
     145}
     146
    128147} // anonymous namespace
    129148
     
    145164
    146165    v8::Handle<v8::Value> v8Value(value->deserialize());
    147     v8::Handle<v8::Value> parent(getNthValueOnKeyPath(v8Value, keyPath, keyPath.size() - 1));
     166    v8::Handle<v8::Value> parent(ensureNthValueOnKeyPath(v8Value, keyPath, keyPath.size() - 1));
    148167    if (parent.IsEmpty())
    149168        return 0;
Note: See TracChangeset for help on using the changeset viewer.