-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
atob() clones the output more than necessary
https://bugs.webkit.org/show_bug.cgi?id=258789 rdar://111993365 Reviewed by David Kilzer. Right now several users of `base64Decode` take the `Vector` returned and immediately convert it to a `String`. This conversion requires a copy as the `Vector` returned by `base64Decode` uses `VectorBufferMalloc` but `String` requires that the Vector backing store is malloced with `StringImplMalloc`. This patch simply adds a `base64DecodeToString` that calls `base64DecodeInternal` with a new template parameter telling `base64DecodeInternal` to use `StringImplMalloc`. Thus, avoiding the extra string copy. * Source/JavaScriptCore/jsc.cpp: (JSC_DEFINE_HOST_FUNCTION): * Source/WTF/wtf/text/Base64.cpp: (WTF::base64DecodeInternal): (WTF::base64DecodeToString): * Source/WTF/wtf/text/Base64.h: * Source/WTF/wtf/text/WTFString.h: * Source/WebCore/page/Base64Utilities.cpp: (WebCore::Base64Utilities::atob): * Source/WebCore/page/Page.cpp: (WebCore::Page::userStyleSheetLocationChanged): Canonical link: https://commits.webkit.org/266016@main
- Loading branch information
Showing
7 changed files
with
33 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters