WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
108103
String constructed from Literals should be non-empty
https://bugs.webkit.org/show_bug.cgi?id=108103
Summary
String constructed from Literals should be non-empty
Benjamin Poulain
Reported
2013-01-28 12:41:40 PST
Empty strings can be evil and should be marked as such.
Attachments
Patch
(3.45 KB, patch)
2013-01-28 12:47 PST
,
Benjamin Poulain
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Benjamin Poulain
Comment 1
2013-01-28 12:47:46 PST
Created
attachment 185038
[details]
Patch
Benjamin Poulain
Comment 2
2013-01-28 17:30:34 PST
Comment on
attachment 185038
[details]
Patch Clearing flags on attachment: 185038 Committed
r141030
: <
http://trac.webkit.org/changeset/141030
>
Benjamin Poulain
Comment 3
2013-01-28 17:30:36 PST
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 4
2013-01-29 09:50:46 PST
Comment on
attachment 185038
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=185038&action=review
This patch disagrees with itself.
> Source/WTF/wtf/text/StringImpl.cpp:154 > + ASSERT_WITH_MESSAGE(length, "Use StringImpl::empty() to create an empty string");
This says you should use StringImpl::empty().T
> Source/WebCore/html/HTMLMediaElement.cpp:691 > + canPlay = emptyString();
This uses emptyString().
Benjamin Poulain
Comment 5
2013-01-29 10:16:00 PST
My rationale:
> > Source/WTF/wtf/text/StringImpl.cpp:154 > > + ASSERT_WITH_MESSAGE(length, "Use StringImpl::empty() to create an empty string"); > > This says you should use StringImpl::empty().T
The assertion is in StringImpl. You can get here from multiple path. From StringImpl, StringImpl::empty() is the empty String.
> > Source/WebCore/html/HTMLMediaElement.cpp:691 > > + canPlay = emptyString(); > > This uses emptyString().
The variable "canPlay" is a WTFString, so here I used the empty string constructor for WTFString. If you think that can cause confusion, I can add similar assertions in WTFString, AtomicString and maybe JSString.
Darin Adler
Comment 6
2013-01-29 10:37:51 PST
No, probably not really confusing in practice.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug