Skip to content

Commit 29b5446

Browse files
committed
Integrate Assert-fix commit.
1 parent 5fc7f41 commit 29b5446

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

src/jni/Require.cpp

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,22 @@ namespace tns
5454
{
5555
SET_PROFILER_FRAME();
5656

57-
ASSERT_MESSAGE(args.Length() == 2, "require should be called with two parameters");
58-
ASSERT_MESSAGE(!args[0]->IsUndefined() && !args[0]->IsNull(), "require called with undefined moduleName parameter");
59-
ASSERT_MESSAGE(!args[1]->IsUndefined() && !args[1]->IsNull(), "require called with undefined callingModulePath parameter");
60-
ASSERT_MESSAGE(args[0]->IsString(), "require should be called with string parameter");
61-
ASSERT_MESSAGE(args[1]->IsString(), "require should be called with string parameter");
57+
auto isolate = Isolate::GetCurrent();
58+
if (args.Length() != 2)
59+
{
60+
isolate->ThrowException(ConvertToV8String("require should be called with two parameters"));
61+
return;
62+
}
63+
if (!args[0]->IsString())
64+
{
65+
isolate->ThrowException(ConvertToV8String("require's first parameter should be string"));
66+
return;
67+
}
68+
if (!args[1]->IsString())
69+
{
70+
isolate->ThrowException(ConvertToV8String("require's second parameter should be string"));
71+
return;
72+
}
6273

6374
string moduleName = ConvertToString(args[0].As<String>());
6475
string callingModuleDirName = ConvertToString(args[1].As<String>());
@@ -100,7 +111,7 @@ namespace tns
100111
}
101112
else
102113
{
103-
moduleObj = Local<Object>::New(Isolate::GetCurrent(), *((*it).second));
114+
moduleObj = Local<Object>::New(isolate, *((*it).second));
104115
}
105116

106117
if(!hasError){

src/src/com/tns/Platform.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
import java.util.HashMap;
1717
import java.util.HashSet;
1818

19-
import org.json.JSONObject;
20-
2119
import android.util.SparseArray;
2220

2321
import com.tns.bindings.ProxyGenerator;

0 commit comments

Comments
 (0)