Summary: | convertToUTF8String converts null string to empty string | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Hamish Mackenzie <Hamish.K.Mackenzie> | ||||||
Component: | WebKitGTK | Assignee: | Nobody <webkit-unassigned> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | berto, cgarcia, mrobinson, zan | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Hamish Mackenzie
2014-06-14 09:38:06 PDT
I agree, and it's consistent with the rest of the API that uses NULL instead of "". My only concern is that it might break existing applications relying on DOM functions returning always valid pointers. We have just broken the API/ABI so maybe it's a good momento for a change like this one, though. I guess if we really want to do this and it's not too late already, then it's now or never. I had forgotten this, we should have changed it before the 2.6 release, but people are still migrating, s we can probably change it now. Created attachment 242899 [details]
Patch
Created attachment 242928 [details]
Patch
I added a test
Comment on attachment 242928 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=242928&action=review Thanks! > Source/WebCore/bindings/gobject/ConvertToUTF8String.cpp:33 > + return 0; nullptr > Source/WebCore/bindings/gobject/ConvertToUTF8String.cpp:35 > return g_strdup(s.utf8().data()); We could probably do something like return s.isNull() ? nullptr : g_strdup(s.utf8().data()); We should merge this in the stable branch too. Committed r177019: <http://trac.webkit.org/changeset/177019> |