summaryrefslogtreecommitdiffstats
path: root/meta/recipes-sato/webkit/webkitgtk/49a19c49c6de8af74e521f36cb43e6c1ec2e391c.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-sato/webkit/webkitgtk/49a19c49c6de8af74e521f36cb43e6c1ec2e391c.patch')
-rw-r--r--meta/recipes-sato/webkit/webkitgtk/49a19c49c6de8af74e521f36cb43e6c1ec2e391c.patch155
1 files changed, 0 insertions, 155 deletions
diff --git a/meta/recipes-sato/webkit/webkitgtk/49a19c49c6de8af74e521f36cb43e6c1ec2e391c.patch b/meta/recipes-sato/webkit/webkitgtk/49a19c49c6de8af74e521f36cb43e6c1ec2e391c.patch
deleted file mode 100644
index ef70361c55..0000000000
--- a/meta/recipes-sato/webkit/webkitgtk/49a19c49c6de8af74e521f36cb43e6c1ec2e391c.patch
+++ /dev/null
@@ -1,155 +0,0 @@
1From 49a19c49c6de8af74e521f36cb43e6c1ec2e391c Mon Sep 17 00:00:00 2001
2From: Ross Kirsling <ross.kirsling@sony.com>
3Date: Tue, 13 Apr 2021 02:04:15 +0000
4Subject: [PATCH] ICU 69 deprecates ubrk_safeClone in favor of ubrk_clone
5 https://bugs.webkit.org/show_bug.cgi?id=224093
6
7Reviewed by Yusuke Suzuki.
8
9In a shining example of "disappointing library practices", ICU 69 deprecates ubrk_safeClone in favor of
10a new *draft* API ubrk_clone, meaning that no function with this functionality is exposed by default.
11
12This patch introduces a function cloneUBreakIterator to abstract over this change; however, since we need to:
13
14 1. confine the effects of disabling U_HIDE_DRAFT_API to a non-unified implementation file
15 2. still be able to include ubrk.h from IntlSegmenter.h to instantiate ICUDeleter<ubrk_close> (*not* `clone`!)
16
17...the new helper function is introduced in a *headerless* implementation file, IntlWorkaround.cpp.
18
19* JavaScriptCore.xcodeproj/project.pbxproj:
20* Sources.txt:
21* runtime/IntlSegmenter.cpp:
22(JSC::IntlSegmenter::segment const):
23* runtime/IntlSegmenter.h:
24* runtime/IntlSegments.cpp:
25(JSC::IntlSegments::createSegmentIterator):
26* runtime/IntlWorkaround.cpp: Added.
27(JSC::cloneUBreakIterator):
28
29
30Canonical link: https://commits.webkit.org/236421@main
31git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275856 268f45cc-cd09-0410-ab3c-d52691b4dbfc
32
33Upstream-Status: Backport
34Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
35---
36 Source/JavaScriptCore/ChangeLog | 27 ++++++++++
37 .../JavaScriptCore.xcodeproj/project.pbxproj | 16 +++---
38 Source/JavaScriptCore/Sources.txt | 1 +
39 .../JavaScriptCore/runtime/IntlSegmenter.cpp | 2 +-
40 Source/JavaScriptCore/runtime/IntlSegmenter.h | 4 ++
41 .../JavaScriptCore/runtime/IntlSegments.cpp | 2 +-
42 .../JavaScriptCore/runtime/IntlWorkaround.cpp | 53 +++++++++++++++++++
43 7 files changed, 97 insertions(+), 8 deletions(-)
44 create mode 100644 Source/JavaScriptCore/runtime/IntlWorkaround.cpp
45
46diff --git a/Source/JavaScriptCore/Sources.txt b/Source/JavaScriptCore/Sources.txt
47index 28b5b83632b9..b6492dfdcb75 100644
48--- a/Source/JavaScriptCore/Sources.txt
49+++ b/Source/JavaScriptCore/Sources.txt
50@@ -849,6 +849,7 @@ runtime/IntlSegmenterConstructor.cpp
51 runtime/IntlSegmenterPrototype.cpp
52 runtime/IntlSegments.cpp
53 runtime/IntlSegmentsPrototype.cpp
54+runtime/IntlWorkaround.cpp @no-unify // Confine U_HIDE_DRAFT_API's effect to this file.
55 runtime/IteratorOperations.cpp
56 runtime/IteratorPrototype.cpp
57 runtime/JSArray.cpp
58diff --git a/Source/JavaScriptCore/runtime/IntlSegmenter.cpp b/Source/JavaScriptCore/runtime/IntlSegmenter.cpp
59index 2ad74f94bbe8..93c9b2032847 100644
60--- a/Source/JavaScriptCore/runtime/IntlSegmenter.cpp
61+++ b/Source/JavaScriptCore/runtime/IntlSegmenter.cpp
62@@ -125,7 +125,7 @@ JSValue IntlSegmenter::segment(JSGlobalObject* globalObject, JSValue stringValue
63 auto upconvertedCharacters = Box<Vector<UChar>>::create(string.charactersWithoutNullTermination());
64
65 UErrorCode status = U_ZERO_ERROR;
66- auto segmenter = std::unique_ptr<UBreakIterator, UBreakIteratorDeleter>(ubrk_safeClone(m_segmenter.get(), nullptr, nullptr, &status));
67+ auto segmenter = std::unique_ptr<UBreakIterator, UBreakIteratorDeleter>(cloneUBreakIterator(m_segmenter.get(), &status));
68 if (U_FAILURE(status)) {
69 throwTypeError(globalObject, scope, "failed to initialize Segments"_s);
70 return { };
71diff --git a/Source/JavaScriptCore/runtime/IntlSegmenter.h b/Source/JavaScriptCore/runtime/IntlSegmenter.h
72index cd0f426c4897..a5239575a9f3 100644
73--- a/Source/JavaScriptCore/runtime/IntlSegmenter.h
74+++ b/Source/JavaScriptCore/runtime/IntlSegmenter.h
75@@ -75,4 +75,8 @@ class IntlSegmenter final : public JSNonFinalObject {
76 Granularity m_granularity { Granularity::Grapheme };
77 };
78
79+// Abstraction to call ubrk_safeClone or ubrk_clone depending on ICU version.
80+// This is implemented in IntlWorkaround.cpp in order to confine draft API visibility.
81+UBreakIterator* cloneUBreakIterator(const UBreakIterator*, UErrorCode*);
82+
83 } // namespace JSC
84diff --git a/Source/JavaScriptCore/runtime/IntlSegments.cpp b/Source/JavaScriptCore/runtime/IntlSegments.cpp
85index b6aba32fb822..8b81791e4133 100644
86--- a/Source/JavaScriptCore/runtime/IntlSegments.cpp
87+++ b/Source/JavaScriptCore/runtime/IntlSegments.cpp
88@@ -100,7 +100,7 @@ JSObject* IntlSegments::createSegmentIterator(JSGlobalObject* globalObject)
89 auto scope = DECLARE_THROW_SCOPE(vm);
90
91 UErrorCode status = U_ZERO_ERROR;
92- auto segmenter = std::unique_ptr<UBreakIterator, UBreakIteratorDeleter>(ubrk_safeClone(m_segmenter.get(), nullptr, nullptr, &status));
93+ auto segmenter = std::unique_ptr<UBreakIterator, UBreakIteratorDeleter>(cloneUBreakIterator(m_segmenter.get(), &status));
94 if (U_FAILURE(status)) {
95 throwTypeError(globalObject, scope, "failed to initialize SegmentIterator"_s);
96 return nullptr;
97diff --git a/Source/JavaScriptCore/runtime/IntlWorkaround.cpp b/Source/JavaScriptCore/runtime/IntlWorkaround.cpp
98new file mode 100644
99index 000000000000..8d820857ec22
100--- /dev/null
101+++ b/Source/JavaScriptCore/runtime/IntlWorkaround.cpp
102@@ -0,0 +1,53 @@
103+/*
104+ * Copyright (C) 2021 Sony Interactive Entertainment Inc.
105+ *
106+ * Redistribution and use in source and binary forms, with or without
107+ * modification, are permitted provided that the following conditions
108+ * are met:
109+ * 1. Redistributions of source code must retain the above copyright
110+ * notice, this list of conditions and the following disclaimer.
111+ * 2. Redistributions in binary form must reproduce the above copyright
112+ * notice, this list of conditions and the following disclaimer in the
113+ * documentation and/or other materials provided with the distribution.
114+ *
115+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
116+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
117+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
118+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
119+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
120+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
121+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
122+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
123+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
124+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
125+ * THE POSSIBILITY OF SUCH DAMAGE.
126+ */
127+
128+#include "config.h"
129+
130+#include <unicode/uvernum.h>
131+
132+// ICU 69 introduces draft API ubrk_clone and deprecates ubrk_safeClone.
133+#if U_ICU_VERSION_MAJOR_NUM >= 69
134+#define HAVE_ICU_UBRK_CLONE 1
135+#endif
136+
137+#if defined(U_HIDE_DRAFT_API)
138+#undef U_HIDE_DRAFT_API
139+#endif
140+#include <unicode/ubrk.h>
141+
142+namespace JSC {
143+
144+UBreakIterator* cloneUBreakIterator(const UBreakIterator*, UErrorCode*);
145+
146+UBreakIterator* cloneUBreakIterator(const UBreakIterator* iterator, UErrorCode* status)
147+{
148+#if HAVE(ICU_UBRK_CLONE)
149+ return ubrk_clone(iterator, status);
150+#else
151+ return ubrk_safeClone(iterator, nullptr, nullptr, status);
152+#endif
153+}
154+
155+} // namespace JSC