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

[js] Added try/catch to HaxeError.init for IE8 compatibility (#9062)

* Added try/catch to HaxeError.init for IE8 compatibility

* Uses .code for more clean output
Aleksandr Kuzmenko 5 жил өмнө
parent
commit
1497c61886
2 өөрчлөгдсөн 2 нэмэгдсэн , 1 устгасан
  1. 1 0
      extra/CHANGES.txt
  2. 1 1
      std/js/Boot.hx

+ 1 - 0
extra/CHANGES.txt

@@ -3,6 +3,7 @@
 	Bugfixes:
 
 	all : emit an error on an attempt to modify abstract `this` through a chain of inlined calls in a non-inlined method (#9067)
+	js : fix startup exception in IE8 related to `Object.defineProperty` (#6918)
 
 2019-12-17: 4.0.5
 

+ 1 - 1
std/js/Boot.hx

@@ -40,7 +40,7 @@ private class HaxeError extends js.lib.Error {
 	}
 
 	static function __init__() {
-		js.lib.Object.defineProperty((cast HaxeError).prototype, "message", {get: () -> (cast String)(js.Lib.nativeThis.val)});
+		js.Syntax.code("try{Object.defineProperty({0}.prototype, \"message\", {get: function(){return String(this.val)}})}catch(e){}", HaxeError);
 	}
 }