Skip to content

Commit

Permalink
Workaround Object.freeze() for JSI hosted object.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kudo committed Dec 16, 2019
1 parent b789894 commit 0657f57
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
48 changes: 48 additions & 0 deletions patches/workaround_jsi_object_freeze.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
diff --git a/src/objects/js-objects.cc b/src/objects/js-objects.cc
index 3666f5a..d17dba4 100644
--- a/src/objects/js-objects.cc
+++ b/src/objects/js-objects.cc
@@ -3815,24 +3815,25 @@ Maybe<bool> JSObject::PreventExtensionsWithTransition(
PrototypeIterator::GetCurrent<JSObject>(iter), should_throw);
}

- if (object->map().has_named_interceptor() ||
- object->map().has_indexed_interceptor()) {
- MessageTemplate message = MessageTemplate::kNone;
- switch (attrs) {
- case NONE:
- message = MessageTemplate::kCannotPreventExt;
- break;
-
- case SEALED:
- message = MessageTemplate::kCannotSeal;
- break;
-
- case FROZEN:
- message = MessageTemplate::kCannotFreeze;
- break;
- }
- RETURN_FAILURE(isolate, should_throw, NewTypeError(message));
- }
+ // Workaround Object.freeze() for JSI hosted object - https://github.com/Kudo/react-native-v8/issues/27
+ // if (object->map().has_named_interceptor() ||
+ // object->map().has_indexed_interceptor()) {
+ // MessageTemplate message = MessageTemplate::kNone;
+ // switch (attrs) {
+ // case NONE:
+ // message = MessageTemplate::kCannotPreventExt;
+ // break;
+ //
+ // case SEALED:
+ // message = MessageTemplate::kCannotSeal;
+ // break;
+ //
+ // case FROZEN:
+ // message = MessageTemplate::kCannotFreeze;
+ // break;
+ // }
+ // RETURN_FAILURE(isolate, should_throw, NewTypeError(message));
+ // }

Handle<Symbol> transition_marker;
if (attrs == NONE) {
6 changes: 6 additions & 0 deletions scripts/patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ source $(dirname $0)/env.sh
V8_PATCHSET_ANDROID=(
# V8 shared library support
"v8_shared_library.patch"

# https://github.com/Kudo/react-native-v8/issues/27
"workaround_jsi_object_freeze.patch"
)

V8_PATCHSET_IOS=(
# V8 shared library support
"v8_shared_library_ios.patch"

# https://github.com/Kudo/react-native-v8/issues/27
"workaround_jsi_object_freeze.patch"
)

######################################################################################
Expand Down

0 comments on commit 0657f57

Please sign in to comment.