@@ -130,8 +130,42 @@ EXPORT_TO_JS(HasCaughtNestedBoth) {
130130
131131EXPORT_TO_JS (HasTerminatedNoException) {
132132 TryCatch tryCatch (args.GetIsolate ());
133- // bool result = tryCatch.HasTerminated(); //TODO
134- bool result = false ;
133+ bool result = tryCatch.HasTerminated ();
134+ args.GetReturnValue ().Set (result);
135+ }
136+
137+ EXPORT_TO_JS (HasTerminatedNestedOuter) {
138+ Isolate* isolate = args.GetIsolate ();
139+ bool result = true ;
140+ TryCatch tryCatch (isolate);
141+ result &= !tryCatch.HasTerminated ();
142+ TryCatch_InvokeCallback (args);
143+ result &= tryCatch.HasTerminated ();
144+ isolate->CancelTerminateExecution ();
145+ result &= !tryCatch.HasTerminated ();
146+ args.GetReturnValue ().Set (result);
147+ }
148+
149+ EXPORT_TO_JS (HasTerminatedNestedInner) {
150+ Isolate* isolate = args.GetIsolate ();
151+ // The following TryCatch looks unused but we are testing
152+ // that it does not swallow the termination exception
153+ TryCatch tryCatch (isolate);
154+ isolate->TerminateExecution ();
155+ TryCatch_InvokeCallback (args);
156+ }
157+
158+ EXPORT_TO_JS (HasTerminatedBasic) {
159+ Isolate* isolate = args.GetIsolate ();
160+ bool result = true ;
161+ TryCatch tryCatch (isolate);
162+ result &= !tryCatch.HasTerminated ();
163+ isolate->TerminateExecution ();
164+ result &= !tryCatch.HasTerminated ();
165+ TryCatch_InvokeCallback (args);
166+ result &= tryCatch.HasTerminated ();
167+ isolate->CancelTerminateExecution ();
168+ result &= !tryCatch.HasTerminated ();
135169 args.GetReturnValue ().Set (result);
136170}
137171
0 commit comments