瀏覽代碼

Fix Http.requestUrl() in WebWorker

window not available when script is running inside a WebWorker
dfadev 9 年之前
父節點
當前提交
273b094c5a
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      std/haxe/Http.hx

+ 1 - 1
std/haxe/Http.hx

@@ -204,7 +204,7 @@ class Http {
 			if( r.readyState != 4 )
 				return;
 			var s = try r.status catch( e : Dynamic ) null;
-			if ( s != null ) {
+			if ( s != null && untyped __js__('"undefined" !== typeof window') ) {
 				// 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):$/;