RESOLVED FIXED35048
an 'undefined' return value from a statement error callback should be treated as 'true'
https://bugs.webkit.org/show_bug.cgi?id=35048
Summary an 'undefined' return value from a statement error callback should be treated...
Dumitru Daniliuc
Reported 2010-02-17 12:32:12 PST
According to the Web SQL Database spec and http://www.mail-archive.com/public-webapps@w3.org/msg06679.html, if a statement error callback returns 'undefined' (doesn't return anything), we should treat it as 'not false', and roll back the transaction. Currently we treat it as 'false'.
Attachments
patch (7.39 KB, patch)
2010-02-17 16:10 PST, Dumitru Daniliuc
dumi: commit-queue-
patch (13.25 KB, patch)
2010-02-17 16:45 PST, Dumitru Daniliuc
dumi: commit-queue-
patch (13.73 KB, patch)
2010-02-17 17:49 PST, Dumitru Daniliuc
darin: review+
dumi: commit-queue-
Dumitru Daniliuc
Comment 1 2010-02-17 16:10:24 PST
WebKit Review Bot
Comment 2 2010-02-17 16:13:20 PST
Attachment 48944 [details] did not pass style-queue: Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1 WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp:101: Place brace on its own line for function definitions. [whitespace/braces] [4] WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp:102: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp:103: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp:104: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp:105: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp:108: Place brace on its own line for function definitions. [whitespace/braces] [4] WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp:109: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp:110: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp:111: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp:112: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Total errors found: 10 If any of these errors are false positives, please file a bug against check-webkit-style.
Dumitru Daniliuc
Comment 3 2010-02-17 16:45:46 PST
Darin Adler
Comment 4 2010-02-17 17:09:31 PST
Comment on attachment 48946 [details] patch What about null? Should that still be false?
Dumitru Daniliuc
Comment 5 2010-02-17 17:49:32 PST
Created attachment 48953 [details] patch (In reply to comment #4) > (From update of attachment 48946 [details]) > What about null? Should that still be false? fixed. treating all non-boolean values as 'true' (since the spec seems to divide all return values into 'false' and 'everything else'). also added more test cases to storage/statement-error-callback.html to test all kind of non-boolean return types (including 'null').
Darin Adler
Comment 6 2010-02-18 10:51:44 PST
Comment on attachment 48953 [details] patch > - return result.toBoolean(exec); > + return !result.isBoolean() || result.toBoolean(exec); While this will work, it's unnecessarily inefficient. The toBoolean function's job is to convert things from other types to boolean. The efficient way is to write: return result.isFalse(); The patch otherwise seems fine. r=me, but please make the fix I suggest above.
Dumitru Daniliuc
Comment 7 2010-02-18 12:12:57 PST
(In reply to comment #6) > (From update of attachment 48953 [details]) > > - return result.toBoolean(exec); > > + return !result.isBoolean() || result.toBoolean(exec); > > While this will work, it's unnecessarily inefficient. The toBoolean function's > job is to convert things from other types to boolean. The efficient way is to > write: > > return result.isFalse(); > > The patch otherwise seems fine. r=me, but please make the fix I suggest above. nice optimization! will change this in the JSC and V8 code before submitting.
Dumitru Daniliuc
Comment 8 2010-02-18 12:52:32 PST
Landed as r54981.
Note You need to log in before you can comment on or make changes to this bug.