RESOLVED FIXED 75880
IndexedDB: Negative zero not round-tripped as a value
https://bugs.webkit.org/show_bug.cgi?id=75880
Summary IndexedDB: Negative zero not round-tripped as a value
Joshua Bell
Reported 2012-01-09 11:49:40 PST
Repro: var negative_zero = -0; function is_negative_zero() { return x === 0 && 1/x === -Infinity; } var request = store.put(negative_zero, "neg_zero"); request.onsuccess = function () { request = store.get("neg_zero"); request.onsuccess = function () { ASSERT(is_negative_zero(request.result)); }; }; Reason: In the V8 implementation of SerializedScriptValue, Int32s are serialized in a more efficient way than other numbers (which are serialized as doubles). The test calls v8::Value::IsInt32() which returns true for -0. When serialized/deserialized, this turns into plain old 0. Either v8::Value::IsInt32() (and Uint32) should be changed or a special case should be added to SerializedScriptValue.
Attachments
Joshua Bell
Comment 1 2012-01-10 08:52:52 PST
This was acknowledged as a v8 bug and fixed in http://code.google.com/p/v8/source/detail?r=10361 This should be fixed when the chromium port rolls that revision.
Joshua Bell
Comment 2 2012-01-26 13:29:26 PST
The V8 patch landed, and local testing confirms the fix. The layout test in https://bugs.webkit.org/show_bug.cgi?id=74897 covers this case, and I should land that soon.
Note You need to log in before you can comment on or make changes to this bug.