Browse Source

Fix Http.requestUrl() in WebWorker

window not available when script is running inside a WebWorker
dfadev 9 years ago
parent
commit
273b094c5a
1 changed files with 1 additions and 1 deletions
  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):$/;