Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: libadblockplus-android/jni/JniJsEngine.cpp

Issue 29424615: Issue 4231 - Fix unstable FilterEngineTest.testSetRemoveFilterChangeCallback (Closed)
Patch Set: changed impl for reading file as bytes array, modified test. AndroidFileSystem now does not resolveā€¦ Created May 29, 2017, 11:26 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: libadblockplus-android/jni/JniJsEngine.cpp
diff --git a/libadblockplus-android/jni/JniJsEngine.cpp b/libadblockplus-android/jni/JniJsEngine.cpp
index d30cb3376830a5ea43fea013a4e6c4b08b58bea4..ad170a7ce58714005c52922b79b187a949cd92ab 100644
--- a/libadblockplus-android/jni/JniJsEngine.cpp
+++ b/libadblockplus-android/jni/JniJsEngine.cpp
@@ -136,6 +136,18 @@ static void JNICALL JniSetDefaultFileSystem(JNIEnv* env, jclass clazz, jlong ptr
CATCH_AND_THROW(env)
}
+static void JNICALL JniSetFileSystem(JNIEnv* env, jclass clazz, jlong ptr, jlong fileSystemPtr)
+{
+ AdblockPlus::JsEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::JsEnginePtr>(ptr);
+
+ try
+ {
+ AdblockPlus::FileSystemPtr fileSystem = *JniLongToTypePtr<AdblockPlus::FileSystemPtr>(fileSystemPtr);
+ engine->SetFileSystem(fileSystem);
+ }
+ CATCH_AND_THROW(env)
+}
+
static void JNICALL JniSetDefaultWebRequest(JNIEnv* env, jclass clazz, jlong ptr)
{
AdblockPlus::JsEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::JsEnginePtr>(ptr);
@@ -242,6 +254,7 @@ static JNINativeMethod methods[] =
{ (char*)"evaluate", (char*)"(JLjava/lang/String;Ljava/lang/String;)" TYP("JsValue"), (void*)JniEvaluate },
+ { (char*)"setFileSystem", (char*)"(JJ)V", (void*)JniSetFileSystem },
{ (char*)"setDefaultFileSystem", (char*)"(JLjava/lang/String;)V", (void*)JniSetDefaultFileSystem },
{ (char*)"setLogSystem", (char*)"(JJ)V", (void*)JniSetLogSystem },
{ (char*)"setDefaultLogSystem", (char*)"(J)V", (void*)JniSetDefaultLogSystem },

Powered by Google App Engine
This is Rietveld