Skip to content

Commit 205e942

Browse files
committed
Forcing the disable of weak refs
1 parent 6c31bad commit 205e942

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

Sources/JavaScriptKit/Features.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ enum LibraryFeatures {
44

55
@_cdecl("_library_features")
66
func _library_features() -> Int32 {
7-
var features: Int32 = 0
8-
#if !JAVASCRIPTKIT_WITHOUT_WEAKREFS
9-
features |= LibraryFeatures.weakRefs
10-
#endif
11-
return features
7+
.zero
8+
// Disabling JAVASCRIPTKIT_WITHOUT_WEAKREFS till they fix https://bugs.swift.org/browse/SR-15611
9+
// var features: Int32 = 0
10+
//#if !JAVASCRIPTKIT_WITHOUT_WEAKREFS
11+
// features |= LibraryFeatures.weakRefs
12+
//#endif
13+
// return features
1214
}

Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ public class JSClosure: JSObject, JSClosureProtocol {
5959

6060
private var hostFuncRef: JavaScriptHostFuncRef = 0
6161

62-
#if JAVASCRIPTKIT_WITHOUT_WEAKREFS
62+
// Disabling JAVASCRIPTKIT_WITHOUT_WEAKREFS till they fix https://bugs.swift.org/browse/SR-15611
63+
// #if JAVASCRIPTKIT_WITHOUT_WEAKREFS
6364
private var isReleased: Bool = false
64-
#endif
65+
// #endif
6566

6667
@available(*, deprecated, message: "This initializer will be removed in the next minor version update. Please use `init(_ body: @escaping ([JSValue]) -> JSValue)` and add `return .undefined` to the end of your closure")
6768
@_disfavoredOverload
@@ -84,13 +85,14 @@ public class JSClosure: JSObject, JSClosureProtocol {
8485
Self.sharedClosures[hostFuncRef] = (self, body)
8586
}
8687

87-
#if JAVASCRIPTKIT_WITHOUT_WEAKREFS
88+
// Disabling JAVASCRIPTKIT_WITHOUT_WEAKREFS till they fix https://bugs.swift.org/browse/SR-15611
89+
// #if JAVASCRIPTKIT_WITHOUT_WEAKREFS
8890
deinit {
8991
guard isReleased else {
9092
fatalError("release() must be called on JSClosure objects manually before they are deallocated")
9193
}
9294
}
93-
#endif
95+
// #endif
9496
}
9597

9698

@@ -149,7 +151,9 @@ func _call_host_function_impl(
149151
/// [WeakRefs](https://github.com/tc39/proposal-weakrefs) are already Stage 4,
150152
/// but was added recently enough that older browser versions don’t support it.
151153
/// Build with `-Xswiftc -DJAVASCRIPTKIT_WITHOUT_WEAKREFS` to disable the relevant behavior.
152-
#if JAVASCRIPTKIT_WITHOUT_WEAKREFS
154+
///
155+
// Disabling JAVASCRIPTKIT_WITHOUT_WEAKREFS till they fix https://bugs.swift.org/browse/SR-15611
156+
//#if JAVASCRIPTKIT_WITHOUT_WEAKREFS
153157

154158
// MARK: - Legacy Closure Types
155159

@@ -163,7 +167,9 @@ extension JSClosure {
163167
@_cdecl("_free_host_function_impl")
164168
func _free_host_function_impl(_ hostFuncRef: JavaScriptHostFuncRef) {}
165169

166-
#else
170+
//#else
171+
// Disabling JAVASCRIPTKIT_WITHOUT_WEAKREFS till they fix https://bugs.swift.org/browse/SR-15611
172+
#if false
167173

168174
extension JSClosure {
169175

0 commit comments

Comments
 (0)