HTTPRequest thread fix
This commit is contained in:
@@ -100,7 +100,7 @@ class NativeHTTPRequest {
|
|||||||
|
|
||||||
if (path == null #if (sys && !android) || !FileSystem.exists (path) #end) {
|
if (path == null #if (sys && !android) || !FileSystem.exists (path) #end) {
|
||||||
|
|
||||||
promise.error ("Cannot load file: " + path);
|
worker.sendError ("Cannot load file: " + path);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -108,16 +108,26 @@ class NativeHTTPRequest {
|
|||||||
|
|
||||||
if (bytes != null) {
|
if (bytes != null) {
|
||||||
|
|
||||||
promise.complete (bytes);
|
worker.sendComplete (bytes);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
promise.error ("Cannot load file: " + path);
|
worker.sendError ("Cannot load file: " + path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
worker.onComplete.add (function (result) {
|
||||||
|
|
||||||
|
promise.complete (result);
|
||||||
|
|
||||||
|
});
|
||||||
|
worker.onError.add (function (message) {
|
||||||
|
|
||||||
|
promise.error (message);
|
||||||
|
|
||||||
});
|
});
|
||||||
worker.run ();
|
worker.run ();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user