fix sublime plugin issue with ui mode, object prototype pollution, try for ui api

This commit is contained in:
hyb1996
2017-05-14 23:34:38 +08:00
parent 36ef8c8396
commit 6102f6e8fe
13 changed files with 50 additions and 43 deletions

View File

@@ -26,6 +26,8 @@ import com.stardust.util.AssetsCache;
import java.io.File;
import javax.xml.parsers.DocumentBuilderFactory;
/**
* Created by Stardust on 2017/5/3.
*/

View File

@@ -87,26 +87,22 @@ public class SublimePluginClient {
if (mSocket == null) {
throw new IllegalStateException("Socket is not listening ");
}
if (Looper.myLooper() == Looper.getMainLooper()) {
if (mExecutor == null) {
mExecutor = Executors.newSingleThreadExecutor();
}
mExecutor.execute(new Runnable() {
@Override
public void run() {
send(object);
if (mExecutor == null) {
mExecutor = Executors.newSingleThreadExecutor();
}
mExecutor.execute(new Runnable() {
@Override
public void run() {
try {
mOutputStream.write(object.toString().getBytes());
mOutputStream.write("\n".getBytes());
mOutputStream.flush();
} catch (IOException e) {
e.printStackTrace();
tryClose();
}
});
}
try {
mOutputStream.write(object.toString().getBytes());
mOutputStream.write("\n".getBytes());
mOutputStream.flush();
} catch (IOException e) {
e.printStackTrace();
tryClose();
}
}
});
}
public void close() throws IOException {