2
0
Эх сурвалжийг харах

[js] fixed crash on detecting local Http requests
in non-browser environments with "window" object defined
#9118

Aleksandr Kuzmenko 5 жил өмнө
parent
commit
de092baa80

+ 1 - 1
std/haxe/http/HttpJs.hx

@@ -58,7 +58,7 @@ class HttpJs extends haxe.http.HttpBase {
 			if (r.readyState != 4)
 			if (r.readyState != 4)
 				return;
 				return;
 			var s = try r.status catch (e:Dynamic) null;
 			var s = try r.status catch (e:Dynamic) null;
-			if (s == 0 && js.Browser.supported) {
+			if (s == 0 && js.Browser.supported && js.Browser.location != null) {
 				// If the request is local and we have data: assume a success (jQuery approach):
 				// If the request is local and we have data: assume a success (jQuery approach):
 				var protocol = js.Browser.location.protocol.toLowerCase();
 				var protocol = js.Browser.location.protocol.toLowerCase();
 				var rlocalProtocol = ~/^(?:about|app|app-storage|.+-extension|file|res|widget):$/;
 				var rlocalProtocol = ~/^(?:about|app|app-storage|.+-extension|file|res|widget):$/;