|
1 | 1 | #include <Foundation/Foundation.h> |
2 | 2 | #include <sstream> |
3 | | -#include <unordered_set> |
4 | 3 | #include "ArgConverter.h" |
5 | 4 | #include "NativeScriptException.h" |
6 | 5 | #include "DictionaryAdapter.h" |
7 | 6 | #include "ObjectManager.h" |
8 | 7 | #include "Interop.h" |
9 | 8 | #include "Helpers.h" |
10 | 9 | #include "Runtime.h" |
11 | | -#include "RuntimeConfig.h" |
12 | 10 |
|
13 | 11 | using namespace v8; |
14 | 12 | using namespace std; |
|
29 | 27 | bool callSuper = false; |
30 | 28 | if (instanceMethod) { |
31 | 29 | BaseDataWrapper* wrapper = tns::GetValue(isolate, receiver); |
32 | | - |
33 | | - if (wrapper == nullptr) { |
34 | | - // During fast view churn like HMR in development, JS objects can outlive their |
35 | | - // native wrappers briefly. In Debug, avoid a crash and just skip the native call. |
36 | | - // In Release, assert so crash reporting can capture unexpected cases. |
37 | | - if (RuntimeConfig.IsDebug) { |
38 | | - const char* selectorStr = meta ? meta->selectorAsString() : "<unknown>"; |
39 | | - const char* jsNameStr = meta ? meta->jsName() : "<unknown>"; |
40 | | - const char* classNameStr = klass ? class_getName(klass) : "<unknown>"; |
41 | | - // Suppress duplicate logs: only log once per class+selector for this process. |
42 | | - static std::unordered_set<std::string> s_logged; |
43 | | - std::string key = std::string(classNameStr) + ":" + selectorStr; |
44 | | - if (s_logged.insert(key).second) { |
45 | | - Log(@"Note: ignore method on non-native receiver (class: %s, selector: %s, jsName: %s, args: %d). Common during HMR.", |
46 | | - classNameStr, selectorStr, jsNameStr, (int)args.Length()); |
47 | | - } |
48 | | - return v8::Undefined(isolate); |
49 | | - } else { |
50 | | - tns::Assert(false, isolate); |
51 | | - } |
52 | | - } |
| 30 | + tns::Assert(wrapper != nullptr, isolate); |
53 | 31 |
|
54 | 32 | if (wrapper->Type() == WrapperType::ObjCAllocObject) { |
55 | 33 | ObjCAllocDataWrapper* allocWrapper = static_cast<ObjCAllocDataWrapper*>(wrapper); |
|
65 | 43 | // For extended classes we will call the base method |
66 | 44 | callSuper = isMethodCallback && it != cache->ClassPrototypes.end(); |
67 | 45 | } else { |
68 | | - if (RuntimeConfig.IsDebug) { |
69 | | - const char* selectorStr = meta ? meta->selectorAsString() : "<unknown>"; |
70 | | - const char* jsNameStr = meta ? meta->jsName() : "<unknown>"; |
71 | | - const char* classNameStr = klass ? class_getName(klass) : "<unknown>"; |
72 | | - // Suppress duplicate logs: only log once per class+selector for this process. |
73 | | - static std::unordered_set<std::string> s_logged; |
74 | | - std::string key = std::string(classNameStr) + ":" + selectorStr; |
75 | | - if (s_logged.insert(key).second) { |
76 | | - Log(@"Note: ignore receiver wrapper type %d (class: %s, selector: %s, jsName: %s). Common during HMR.", |
77 | | - (int)wrapper->Type(), classNameStr, selectorStr, jsNameStr); |
78 | | - } |
79 | | - return v8::Undefined(isolate); |
80 | | - } else { |
81 | | - tns::Assert(false, isolate); |
82 | | - } |
| 46 | + tns::Assert(false, isolate); |
83 | 47 | } |
84 | 48 | } |
85 | 49 |
|
|
914 | 878 | Local<Object> thiz = args.This(); |
915 | 879 | Isolate* isolate = args.GetIsolate(); |
916 | 880 | BaseDataWrapper* wrapper = tns::GetValue(isolate, thiz); |
917 | | - if (wrapper == nullptr || wrapper->Type() != WrapperType::ObjCObject) { |
| 881 | + if (wrapper == nullptr && wrapper->Type() != WrapperType::ObjCObject) { |
918 | 882 | return; |
919 | 883 | } |
920 | 884 |
|
|
0 commit comments