瀏覽代碼

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

Aleksandr Kuzmenko 5 年之前
父節點
當前提交
de092baa80
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      std/haxe/http/HttpJs.hx

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

@@ -58,7 +58,7 @@ class HttpJs extends haxe.http.HttpBase {
 			if (r.readyState != 4)
 				return;
 			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):
 				var protocol = js.Browser.location.protocol.toLowerCase();
 				var rlocalProtocol = ~/^(?:about|app|app-storage|.+-extension|file|res|widget):$/;