Bug 18837 - Database panel fails to display tables if any value is NULL
Summary: Database panel fails to display tables if any value is NULL
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Adam Roben (:aroben)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-01 15:57 PDT by Tom Davis
Modified: 2008-06-08 13:58 PDT (History)
2 users (show)

See Also:


Attachments
Proposed patch (1.89 KB, patch)
2008-05-01 22:03 PDT, Tom Davis
darin: review-
Details | Formatted Diff | Diff
patch + changelog (3.59 KB, patch)
2008-06-08 13:19 PDT, Adam Roben (:aroben)
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Davis 2008-05-01 15:57:25 PDT
An SQL NULL value in an SQLite database is correctly returned in the results as having the javascript null type, which (in file DatabasesPanel.js, function _tableForResult ) either causes the div.textContent or the text.length to throw an exception.

The fix is to check for null and then reassign the text value, possible adding a new classname to the div as in:
--- DatabasesPanel.js	2008/05/01 22:48:06	1.1
+++ DatabasesPanel.js	2008/05/01 22:51:23	1.2
@@ -204,6 +204,10 @@
 
                 var text = row[column];
                 var div = document.createElement("div");
+		if ( text == null ) {
+		    text = "NULL"
+		    div.className = "sql_null";
+		}
                 div.textContent = text;
                 div.title = text;
                 td.appendChild(div);

To make use of the className = "sql_null", append the following to inspector.js:
.sql_null {
    text-align: center;
    color: #faa;
}
Comment 1 Matt Lilek 2008-05-01 16:26:03 PDT
Please submit a patch using the instructions at <http://webkit.org/coding/contributing.html>.  Our code style guidelines are available at <http://webkit.org/coding/coding-style.html>.
Comment 2 Tom Davis 2008-05-01 22:03:39 PDT
Created attachment 20919 [details]
Proposed patch
Comment 3 Maciej Stachowiak 2008-05-02 03:59:07 PDT
Comment on attachment 20919 [details]
Proposed patch

r=me
Comment 4 Darin Adler 2008-06-08 11:47:41 PDT
Comment on attachment 20919 [details]
Proposed patch

Sorry. This patch was great, but it wasn't landed.

Now the Databases panel has changed too much to land it. It's now using a DataGrid class.

I couldn't figure out exactly how to merge this or if the code has this issue any more. For now, setting review to review-. We can close this bug if it's already fixed, or rework the patch if not.
Comment 5 Adam Roben (:aroben) 2008-06-08 13:19:37 PDT
Created attachment 21578 [details]
patch + changelog
Comment 6 Darin Adler 2008-06-08 13:21:09 PDT
Comment on attachment 21578 [details]
patch + changelog

r=me

The original patch had special formatting for null values. Did you decide that wasn't worthwhile?
Comment 7 Adam Roben (:aroben) 2008-06-08 13:25:01 PDT
(In reply to comment #6)
> The original patch had special formatting for null values. Did you decide that
> wasn't worthwhile?

It probably is worthwhile, but I didn't want to add that while fixing this bug. I'll file a new bug about special formatting and add a FIXME.

Thanks!
Comment 8 Adam Roben (:aroben) 2008-06-08 13:27:51 PDT
(In reply to comment #7)
> I'll file a new bug about special formatting

Bug 19439
Comment 9 Adam Roben (:aroben) 2008-06-08 13:58:58 PDT
Committed in r34456