OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // ------------------------------------------------------------------- | 5 // ------------------------------------------------------------------- |
6 | 6 |
7 (function(global, utils) { | 7 (function(global, utils) { |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 %FunctionSetInstanceClassName(ErrorPrototype, 'Error'); | 930 %FunctionSetInstanceClassName(ErrorPrototype, 'Error'); |
931 %FunctionSetPrototype(f, new ErrorPrototype()); | 931 %FunctionSetPrototype(f, new ErrorPrototype()); |
932 } else { | 932 } else { |
933 %FunctionSetPrototype(f, new GlobalError()); | 933 %FunctionSetPrototype(f, new GlobalError()); |
934 %InternalSetPrototype(f, GlobalError); | 934 %InternalSetPrototype(f, GlobalError); |
935 } | 935 } |
936 %FunctionSetInstanceClassName(f, 'Error'); | 936 %FunctionSetInstanceClassName(f, 'Error'); |
937 %AddNamedProperty(f.prototype, 'constructor', f, DONT_ENUM); | 937 %AddNamedProperty(f.prototype, 'constructor', f, DONT_ENUM); |
938 %AddNamedProperty(f.prototype, 'name', name, DONT_ENUM); | 938 %AddNamedProperty(f.prototype, 'name', name, DONT_ENUM); |
939 %SetCode(f, function(m) { | 939 %SetCode(f, function(m) { |
940 if (%_IsConstructCall()) { | 940 if (!IS_UNDEFINED(new.target)) { |
941 try { captureStackTrace(this, f); } catch (e) { } | 941 try { captureStackTrace(this, f); } catch (e) { } |
942 // Define all the expected properties directly on the error | 942 // Define all the expected properties directly on the error |
943 // object. This avoids going through getters and setters defined | 943 // object. This avoids going through getters and setters defined |
944 // on prototype objects. | 944 // on prototype objects. |
945 if (!IS_UNDEFINED(m)) { | 945 if (!IS_UNDEFINED(m)) { |
946 %AddNamedProperty(this, 'message', TO_STRING(m), DONT_ENUM); | 946 %AddNamedProperty(this, 'message', TO_STRING(m), DONT_ENUM); |
947 } | 947 } |
948 } else { | 948 } else { |
949 return new f(m); | 949 return new f(m); |
950 } | 950 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 utils.Export(function(to) { | 1034 utils.Export(function(to) { |
1035 to.ErrorToString = ErrorToString; | 1035 to.ErrorToString = ErrorToString; |
1036 to.MakeError = MakeError; | 1036 to.MakeError = MakeError; |
1037 to.MakeRangeError = MakeRangeError; | 1037 to.MakeRangeError = MakeRangeError; |
1038 to.MakeSyntaxError = MakeSyntaxError; | 1038 to.MakeSyntaxError = MakeSyntaxError; |
1039 to.MakeTypeError = MakeTypeError; | 1039 to.MakeTypeError = MakeTypeError; |
1040 to.MakeURIError = MakeURIError; | 1040 to.MakeURIError = MakeURIError; |
1041 }); | 1041 }); |
1042 | 1042 |
1043 }); | 1043 }); |
OLD | NEW |