Index: src/builtins.cc |
diff --git a/src/builtins.cc b/src/builtins.cc |
index d7824504cae7b1a5c4d780914732a8728997bf7d..22ad3fa22cd39da15cf5d045f6561c99d676cf54 100644 |
--- a/src/builtins.cc |
+++ b/src/builtins.cc |
@@ -1762,6 +1762,9 @@ BUILTIN(SymbolConstructor) { |
// ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Construct]] case. |
BUILTIN(SymbolConstructor_ConstructStub) { |
HandleScope scope(isolate); |
+ // The ConstructStub is executed in the context of the caller, so we need |
+ // to enter the callee context first before raising an exception. |
+ isolate->set_context(args.called_function()->context()); |
THROW_NEW_ERROR_RETURN_FAILURE( |
isolate, NewTypeError(MessageTemplate::kNotConstructor, |
isolate->factory()->Symbol_string())); |