RESOLVED FIXED223231
[WebIDL] Fix convertRecord() to throw on enumerable symbol |key|
https://bugs.webkit.org/show_bug.cgi?id=223231
Summary [WebIDL] Fix convertRecord() to throw on enumerable symbol |key|
Alexey Shvayka
Reported 2021-03-15 18:17:50 PDT
[WebIDL] Fix convertRecord() to throw on enumerable symbol |key|
Attachments
Patch (10.55 KB, patch)
2021-03-15 18:25 PDT, Alexey Shvayka
no flags
Patch (10.58 KB, patch)
2021-03-16 15:24 PDT, Alexey Shvayka
no flags
Alexey Shvayka
Comment 1 2021-03-15 18:25:16 PDT
Darin Adler
Comment 2 2021-03-16 14:30:22 PDT
Comment on attachment 423276 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=423276&action=review > Source/WebCore/bindings/js/JSDOMConvertStrings.cpp:38 > + VM& vm = lexicalGlobalObject.vm(); > + auto scope = DECLARE_THROW_SCOPE(vm); Is there any performance benefit to moving this inside the if statement? > Source/WebCore/bindings/js/JSDOMConvertStrings.cpp:103 > + if (!string) > + return { }; This seems like an unimportant optimization. I would leave it out; the stringToUSVString function can handle the null string without causing any problems. Then this can just be a one-liner. Also, we generally write string.isNull() instead of !string. Not sure why. return stringToUSVString(identifierToString(lexicalGlobalObject, identifier));
Alexey Shvayka
Comment 3 2021-03-16 15:24:40 PDT
Created attachment 423404 [details] Patch Add UNLIKELY, move DECLARE_THROW_SCOPE into branch, and make identifierToUSVString() a one-liner.
Alexey Shvayka
Comment 4 2021-03-16 15:25:57 PDT
(In reply to Darin Adler from comment #2) Thank you for reviewing convertRecord() changes! > Is there any performance benefit to moving this inside the if statement? I've found a few precedents of ThrowScope() created inside a branch, in hot inlined methods. This won't break validation of exception checks. Also, added an UNLIKELY, which is merely a compiler hint on how to emits jumps so common case is optimized. > This seems like an unimportant optimization. I would leave it out; the > stringToUSVString function can handle the null string without causing any > problems. Then this can just be a one-liner. Also, we generally write > string.isNull() instead of !string. Not sure why. > > return stringToUSVString(identifierToString(lexicalGlobalObject, > identifier)); Nice, fixed.
EWS
Comment 5 2021-03-17 09:01:44 PDT
Committed r274561: <https://commits.webkit.org/r274561> All reviewed patches have been landed. Closing bug and clearing flags on attachment 423404 [details].
Radar WebKit Bug Importer
Comment 6 2021-03-17 09:02:16 PDT
Note You need to log in before you can comment on or make changes to this bug.