WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 238264
Prepare JSC for making the String(const char*) constructor explicit
https://bugs.webkit.org/show_bug.cgi?id=238264
Summary
Prepare JSC for making the String(const char*) constructor explicit
Chris Dumez
Reported
2022-03-23 09:28:34 PDT
Prepare JSC for making the String(const char*) constructor explicit. Making this constructor explicit helps catch at compile time cases where the ""_s prefix is missing on String literals.
Attachments
Patch
(651.97 KB, patch)
2022-03-23 10:50 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(652.23 KB, patch)
2022-03-23 11:30 PDT
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(652.25 KB, patch)
2022-03-23 11:36 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(651.99 KB, patch)
2022-03-23 11:51 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(651.99 KB, patch)
2022-03-23 12:29 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(651.18 KB, patch)
2022-03-23 16:04 PDT
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2022-03-23 10:50:01 PDT
Created
attachment 455518
[details]
Patch
Chris Dumez
Comment 2
2022-03-23 11:30:42 PDT
Created
attachment 455530
[details]
Patch
Chris Dumez
Comment 3
2022-03-23 11:36:46 PDT
Created
attachment 455533
[details]
Patch
Chris Dumez
Comment 4
2022-03-23 11:51:25 PDT
Created
attachment 455534
[details]
Patch
Darin Adler
Comment 5
2022-03-23 12:17:27 PDT
Comment on
attachment 455518
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=455518&action=review
I love how this reveals the idioms used. Some comments about the less-great ones here. Another thing this points out is cases where Latin-1 may not be the right way to interpret non-ASCII characters and we might want UTF-8 instead. I like the idea of landing the obviously 100% correct _s cases first, so the biggest patch is the most obviously right. Like all the ClassInfo.
> Source/JavaScriptCore/API/JSAPIGlobalObject.mm:93 > + absoluteURL = URL(URL({ }, "file://"_s), specifier);
This isn’t taking advantage of our new simpler URL constructor!
> Source/JavaScriptCore/API/JSValue.mm:1182 > + StructHandlers::iterator iter = structHandlers->find(String { type.get() });
Seems like an unfortunate situation where we have to make a String just to search for something. Probably fixable.
> Source/JavaScriptCore/API/JSValue.mm:1220 > + StructHandlers::iterator iter = structHandlers->find(String { encodedType });
Ditto.
> Source/JavaScriptCore/API/JSWrapperMap.mm:454 > + auto iter = initTable.find(String { name });
Ditto.
> Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.cpp:95 > + auto functionString = makeString("(function(WebInspectorAudit) { \"use strict\"; return eval(`(", String { test }.replace('`', "\\`"_s), ")`)(WebInspectorAudit); })");
Ah, make a String just to pass it to replace, yuck.
> Source/JavaScriptCore/jsc.cpp:1099 > + return FileSystem::pathByAppendingComponent(String { cachePath }, makeString(source().toString().hash(), '-', filename, ".bytecode-cache"));
Maybe this FileSystem function should be changed to take StringView.
Chris Dumez
Comment 6
2022-03-23 12:19:38 PDT
(In reply to Darin Adler from
comment #5
)
> Comment on
attachment 455518
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=455518&action=review
> > I love how this reveals the idioms used. Some comments about the less-great > ones here. > > Another thing this points out is cases where Latin-1 may not be the right > way to interpret non-ASCII characters and we might want UTF-8 instead. > > I like the idea of landing the obviously 100% correct _s cases first, so the > biggest patch is the most obviously right. Like all the ClassInfo. > > > Source/JavaScriptCore/API/JSAPIGlobalObject.mm:93 > > + absoluteURL = URL(URL({ }, "file://"_s), specifier); > > This isn’t taking advantage of our new simpler URL constructor! > > > Source/JavaScriptCore/API/JSValue.mm:1182 > > + StructHandlers::iterator iter = structHandlers->find(String { type.get() }); > > Seems like an unfortunate situation where we have to make a String just to > search for something. Probably fixable. > > > Source/JavaScriptCore/API/JSValue.mm:1220 > > + StructHandlers::iterator iter = structHandlers->find(String { encodedType }); > > Ditto. > > > Source/JavaScriptCore/API/JSWrapperMap.mm:454 > > + auto iter = initTable.find(String { name }); > > Ditto. > > > Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.cpp:95 > > + auto functionString = makeString("(function(WebInspectorAudit) { \"use strict\"; return eval(`(", String { test }.replace('`', "\\`"_s), ")`)(WebInspectorAudit); })"); > > Ah, make a String just to pass it to replace, yuck.
Yes, I am working on adding an overload that takes a StringView separately.
> > > Source/JavaScriptCore/jsc.cpp:1099 > > + return FileSystem::pathByAppendingComponent(String { cachePath }, makeString(source().toString().hash(), '-', filename, ".bytecode-cache")); > > Maybe this FileSystem function should be changed to take StringView.
Chris Dumez
Comment 7
2022-03-23 12:29:11 PDT
Created
attachment 455538
[details]
Patch
Geoffrey Garen
Comment 8
2022-03-23 15:58:53 PDT
Comment on
attachment 455538
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=455538&action=review
r=me
> Source/JavaScriptCore/API/JSCallbackObjectFunctions.h:214 > - className = thisObject->className(vm); > + className = thisObject->className(vm);
oops?
Chris Dumez
Comment 9
2022-03-23 16:04:23 PDT
Created
attachment 455574
[details]
Patch
Chris Dumez
Comment 10
2022-03-23 18:40:50 PDT
Committed
r291779
(
248807@trunk
): <
https://commits.webkit.org/248807@trunk
>
Radar WebKit Bug Importer
Comment 11
2022-03-23 18:41:47 PDT
<
rdar://problem/90738742
>
EWS
Comment 12
2022-03-23 20:40:57 PDT
Found 1 new test failure: imported/w3c/web-platform-tests/webstorage/event_case_sensitive.html
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