diff --git a/deps/chakrashim/include/v8.h b/deps/chakrashim/include/v8.h index 7b7093c45f7..0fdc2850b67 100644 --- a/deps/chakrashim/include/v8.h +++ b/deps/chakrashim/include/v8.h @@ -303,6 +303,7 @@ class Local { friend class HandleScope; friend class Integer; friend class Map; + friend class Message; friend class Number; friend class NumberObject; friend class Object; @@ -2736,8 +2737,10 @@ class V8_EXPORT TryCatch { void SetNonUser() { user = false; } void GetAndClearException(); void CheckReportExternalException(); + JsValueRef EnsureException() const; - JsValueRef error; + + JsValueRef metadata; TryCatch* prev; bool rethrow; bool user; diff --git a/deps/chakrashim/src/jsrtcachedpropertyidref.inc b/deps/chakrashim/src/jsrtcachedpropertyidref.inc index 1d642a7f4b1..bebf48bddbb 100644 --- a/deps/chakrashim/src/jsrtcachedpropertyidref.inc +++ b/deps/chakrashim/src/jsrtcachedpropertyidref.inc @@ -119,6 +119,8 @@ DEF(subtype) DEF(thisObject) DEF(type) DEF(uncaught) +DEF(url) + DEFSYMBOL(self) DEFSYMBOL(__external__) diff --git a/deps/chakrashim/src/v8message.cc b/deps/chakrashim/src/v8message.cc index ea5e51735fe..1fc5203f45b 100644 --- a/deps/chakrashim/src/v8message.cc +++ b/deps/chakrashim/src/v8message.cc @@ -28,8 +28,15 @@ Local Message::Get() const { } MaybeLocal Message::GetSourceLine(Local context) const { - // CHAKRA-TODO: Figure out how to transmit this info...? - return Local(); + JsPropertyIdRef source = jsrt::IsolateShim::GetCurrent() + ->GetCachedPropertyIdRef(jsrt::CachedPropertyIdRef::source); + + JsValueRef result; + if (JsGetProperty((JsValueRef)this, source, &result) != JsNoError) { + return Local(); + } + + return Local::New(result); } Local Message::GetSourceLine() const { @@ -41,19 +48,35 @@ ScriptOrigin Message::GetScriptOrigin() const { return ScriptOrigin(Local()); } -Handle Message::GetScriptResourceName() const { - // CHAKRA-TODO: Figure out how to transmit this info...? - return Handle(); -} - Local Message::GetStackTrace() const { // CHAKRA-TODO: Figure out what to do here return Local(); } +Handle Message::GetScriptResourceName() const { + JsPropertyIdRef url = jsrt::IsolateShim::GetCurrent() + ->GetCachedPropertyIdRef(jsrt::CachedPropertyIdRef::url); + + JsValueRef result; + if (JsGetProperty((JsValueRef)this, url, &result) != JsNoError) { + return Local(); + } + return Handle::New(result); +} + Maybe Message::GetLineNumber(Local context) const { - // CHAKRA-TODO: Figure out how to transmit this info...? - return Nothing(); + JsPropertyIdRef lineProp = jsrt::IsolateShim::GetCurrent() + ->GetCachedPropertyIdRef(jsrt::CachedPropertyIdRef::line); + + JsValueRef result; + if (JsGetProperty((JsValueRef)this, lineProp, &result) != JsNoError) { + return Nothing(); + } + int line; + if (jsrt::ValueToIntLikely(result, &line) != JsNoError) { + return Nothing(); + } + return Just(line + 1); } int Message::GetLineNumber() const { @@ -61,8 +84,18 @@ int Message::GetLineNumber() const { } Maybe Message::GetStartColumn(Local context) const { - // CHAKRA-TODO: Figure out how to transmit this info...? - return Nothing(); + JsPropertyIdRef columnProp = jsrt::IsolateShim::GetCurrent() + ->GetCachedPropertyIdRef(jsrt::CachedPropertyIdRef::column); + + JsValueRef result; + if (JsGetProperty((JsValueRef)this, columnProp, &result) != JsNoError) { + return Nothing(); + } + int column; + if (jsrt::ValueToIntLikely(result, &column) != JsNoError) { + return Nothing(); + } + return Just(column); } int Message::GetStartColumn() const { @@ -70,8 +103,21 @@ int Message::GetStartColumn() const { } Maybe Message::GetEndColumn(Local context) const { - // CHAKRA-TODO: Figure out how to transmit this info...? - return Nothing(); + int column = GetStartColumn(); + JsPropertyIdRef lengthProp = jsrt::IsolateShim::GetCurrent() + ->GetCachedPropertyIdRef(jsrt::CachedPropertyIdRef::length); + + + JsValueRef result; + if (JsGetProperty((JsValueRef)this, lengthProp, &result) != JsNoError) { + return Nothing(); + } + int length; + if (jsrt::ValueToIntLikely(result, &length) != JsNoError) { + return Nothing(); + } + + return Just(column + length + 1); } int Message::GetEndColumn() const { diff --git a/deps/chakrashim/src/v8trycatch.cc b/deps/chakrashim/src/v8trycatch.cc index 9277ef1b836..225ebbc5346 100644 --- a/deps/chakrashim/src/v8trycatch.cc +++ b/deps/chakrashim/src/v8trycatch.cc @@ -24,7 +24,7 @@ namespace v8 { TryCatch::TryCatch(Isolate* isolate) - : error(JS_INVALID_REFERENCE), + : metadata(JS_INVALID_REFERENCE), rethrow(false), user(true), verbose(false) { @@ -42,11 +42,11 @@ TryCatch::~TryCatch() { } bool TryCatch::HasCaught() const { - if (error == JS_INVALID_REFERENCE) { + if (metadata == JS_INVALID_REFERENCE) { const_cast(this)->GetAndClearException(); } - if (error != JS_INVALID_REFERENCE) { + if (metadata != JS_INVALID_REFERENCE) { return true; } bool hasException; @@ -78,22 +78,19 @@ void TryCatch::GetAndClearException() { } if (hasException) { - JsValueRef exceptionRef; - errorCode = JsGetAndClearException(&exceptionRef); + JsValueRef metadataRef; + errorCode = JsGetAndClearExceptionWithMetadata(&metadataRef); // We came here through JsHasException, so script shouldn't be in disabled // state. CHAKRA_ASSERT(errorCode != JsErrorInDisabledState); if (errorCode == JsNoError) { - error = exceptionRef; + metadata = metadataRef; } } } Handle TryCatch::ReThrow() { - if (error == JS_INVALID_REFERENCE) { - GetAndClearException(); - } - + JsValueRef error = this->EnsureException(); if (error == JS_INVALID_REFERENCE) { return Local(); } @@ -107,10 +104,7 @@ Handle TryCatch::ReThrow() { } Local TryCatch::Exception() const { - if (error == JS_INVALID_REFERENCE) { - const_cast(this)->GetAndClearException(); - } - + JsValueRef error = this->EnsureException(); if (error == JS_INVALID_REFERENCE) { return Local(); } @@ -119,19 +113,13 @@ Local TryCatch::Exception() const { } MaybeLocal TryCatch::StackTrace(Local context) const { - if (error == JS_INVALID_REFERENCE) { - const_cast(this)->GetAndClearException(); - } - + JsValueRef error = this->EnsureException(); if (error == JS_INVALID_REFERENCE) { return Local(); } JsPropertyIdRef stack = jsrt::IsolateShim::GetCurrent() - ->GetCachedPropertyIdRef(jsrt::CachedPropertyIdRef::stack); - if (stack == JS_INVALID_REFERENCE) { - return Local(); - } + ->GetCachedPropertyIdRef(jsrt::CachedPropertyIdRef::stack); JsValueRef trace; if (JsGetProperty(error, stack, &trace) != JsNoError) { @@ -146,10 +134,14 @@ Local TryCatch::StackTrace() const { } Local TryCatch::Message() const { - // return an empty ref for now, so no nulls/empty messages will be printed - // should be changed once we understand how to retreive the info for each - // errror message - return Local(); + if (metadata == JS_INVALID_REFERENCE) { + const_cast(this)->GetAndClearException(); + } + + if (metadata == JS_INVALID_REFERENCE) { + return Local(); + } + return Local::New(metadata); } void TryCatch::SetVerbose(bool value) { @@ -181,4 +173,24 @@ void TryCatch::CheckReportExternalException() { } } +JsValueRef TryCatch::EnsureException() const { + if (metadata == JS_INVALID_REFERENCE) { + const_cast(this)->GetAndClearException(); + } + + if (metadata == JS_INVALID_REFERENCE) { + return JS_INVALID_REFERENCE; + } + + JsPropertyIdRef err = jsrt::IsolateShim::GetCurrent() + ->GetCachedPropertyIdRef(jsrt::CachedPropertyIdRef::exception); + + JsValueRef exception; + if (JsGetProperty(metadata, err, &exception) != JsNoError) { + return JS_INVALID_REFERENCE; + } + + return exception; +} + } // namespace v8 diff --git a/test/message/core_line_numbers.chakracore.out b/test/message/core_line_numbers.chakracore.out index 54f6ec06911..1eb98632882 100644 --- a/test/message/core_line_numbers.chakracore.out +++ b/test/message/core_line_numbers.chakracore.out @@ -1,5 +1,9 @@ +punycode.js:* + throw new RangeError(errors[type]); + ^ + RangeError: Invalid input - at error (punycode.js:42:*) + at error (punycode.js:*:*) at decode (punycode.js:*:*) at Anonymous function (*test*message*core_line_numbers.js:*:*) at Module.prototype._compile (module.js:*:*) diff --git a/test/message/error_exit.chakracore.out b/test/message/error_exit.chakracore.out index 1b83e45425d..f48b0cb75fb 100644 --- a/test/message/error_exit.chakracore.out +++ b/test/message/error_exit.chakracore.out @@ -1,4 +1,8 @@ Exiting with code=1 +assert.js:* + throw new errors.AssertionError({ + ^ + AssertionError [ERR_ASSERTION]: 1 === 2 at Anonymous function (*test*message*error_exit.js:*:*) at Module.prototype._compile (module.js:*:*) diff --git a/test/message/eval_messages.chakracore.out b/test/message/eval_messages.chakracore.out index a2c0471343d..06459e4df6f 100644 --- a/test/message/eval_messages.chakracore.out +++ b/test/message/eval_messages.chakracore.out @@ -1,4 +1,8 @@ [eval] +[eval]:1 +'use strict'; with(this){__filename} + ^^^^^ + SyntaxError: 'with' statements are not allowed in strict mode at createScript (vm.js:*:*) at runInThisContext (vm.js:*:*) @@ -9,18 +13,26 @@ SyntaxError: 'with' statements are not allowed in strict mode at Anonymous function (bootstrap_node.js:*:*) 42 42 +[eval]:1 +throw new Error("hello") +^ + Error: hello - at Global code ([eval]:1:1) - at Script.prototype.runInThisContext (vm.js:*:*) + at Global code ([eval]:*:*) + at Script.prototype.runInThisContext (vm.js:*:*) at runInThisContext (vm.js:*:*) at Anonymous function ([eval]-wrapper:*:*) at Module.prototype._compile (module.js:*:*) at evalScript (bootstrap_node.js:*:*) at startup (bootstrap_node.js:*:*) at Anonymous function (bootstrap_node.js:*:*) +[eval]:1 +'use strict'; throw new Error("hello") + ^ + Error: hello - at Global code ([eval]:1:15) - at Script.prototype.runInThisContext (vm.js:*:*) + at Global code ([eval]:*:*) + at Script.prototype.runInThisContext (vm.js:*:*) at runInThisContext (vm.js:*:*) at Anonymous function ([eval]-wrapper:*:*) at Module.prototype._compile (module.js:*:*) @@ -28,15 +40,27 @@ Error: hello at startup (bootstrap_node.js:*:*) at Anonymous function (bootstrap_node.js:*:*) 100 +[eval]:1 +'use strict'; var x = 100; y = x; + ^ + ReferenceError: Variable undefined in strict mode - at Global code ([eval]:1:28) - at Script.prototype.runInThisContext (vm.js:*:*) + at Global code ([eval]:*:*) + at Script.prototype.runInThisContext (vm.js:*:*) at runInThisContext (vm.js:*:*) at Anonymous function ([eval]-wrapper:*:*) at Module.prototype._compile (module.js:*:*) at evalScript (bootstrap_node.js:*:*) at startup (bootstrap_node.js:*:*) at Anonymous function (bootstrap_node.js:*:*) + +vm.js:* + return realRunInThisContext.call(this, options); + ^ 10 + +vm.js:* + return realRunInThisContext.call(this, options); + ^ 10 -done +done \ No newline at end of file diff --git a/test/message/nexttick_throw.chakracore.out b/test/message/nexttick_throw.chakracore.out index c779d930ed1..0cf9c37555c 100644 --- a/test/message/nexttick_throw.chakracore.out +++ b/test/message/nexttick_throw.chakracore.out @@ -1,7 +1,11 @@ -ReferenceError: 'undefined_reference_error_maker' is not defined - at Anonymous function (*test*message*nexttick_throw.js:*:*) - at _combinedTickCallback (internal/process/next_tick.js:*:*) - at _tickCallback (internal/process/next_tick.js:*:*) - at Module.runMain (module.js:*:*) - at startup (bootstrap_node.js:*:*) - at Anonymous function (bootstrap_node.js:*:*) + +*test*message*nexttick_throw.js:* +*undefined_reference_error_maker; +*^ +ReferenceError: *undefined_reference_error_maker* +*at *test*message*nexttick_throw.js:*:* +*at _combinedTickCallback (internal/process/next_tick.js:*:*) +*at *_tickCallback (internal/process/next_tick.js:*:*) +*at Module.runMain (module.js:*:*) +*at startup (bootstrap_node.js:*:*) +*at *bootstrap_node.js:*:* diff --git a/test/message/nexttick_throw.v8.out b/test/message/nexttick_throw.v8.out index 1b72ea2d3cf..420b953460e 100644 --- a/test/message/nexttick_throw.v8.out +++ b/test/message/nexttick_throw.v8.out @@ -1,11 +1,12 @@ *test*message*nexttick_throw.js:* - undefined_reference_error_maker; - ^ -ReferenceError: undefined_reference_error_maker is not defined - at *test*message*nexttick_throw.js:*:* - at _combinedTickCallback (internal/process/next_tick.js:*:*) - at process._tickCallback (internal/process/next_tick.js:*:*) - at Function.Module.runMain (module.js:*:*) - at startup (bootstrap_node.js:*:*) - at bootstrap_node.js:*:* +*undefined_reference_error_maker; +*^ +ReferenceError: *undefined_reference_error_maker* +*at *test*message*nexttick_throw.js:*:* +*at _combinedTickCallback (internal/process/next_tick.js:*:*) +*at *_tickCallback (internal/process/next_tick.js:*:*) +*at Module.runMain (module.js:*:*) +*at run (bootstrap_node.js:*:*) +*at startup (bootstrap_node.js:*:*) +*at *bootstrap_node.js:*:* diff --git a/test/message/stack_overflow.chakracore.out b/test/message/stack_overflow.chakracore.out index a18023f3510..61ed76be33b 100644 --- a/test/message/stack_overflow.chakracore.out +++ b/test/message/stack_overflow.chakracore.out @@ -1,2 +1,6 @@ before +*test*message*stack_overflow.js:* +JSON.stringify(array); +^ + Error: Out of stack space diff --git a/test/message/stdin_messages.chakracore.out b/test/message/stdin_messages.chakracore.out old mode 100644 new mode 100755 index 668a442cac6..8981bfcb929 --- a/test/message/stdin_messages.chakracore.out +++ b/test/message/stdin_messages.chakracore.out @@ -1,56 +1,75 @@ -[stdin] -SyntaxError: 'with' statements are not allowed in strict mode - at createScript (vm.js:*) - at runInThisContext (vm.js:*) - at Anonymous function ([stdin]-wrapper:*:*) - at Module.prototype._compile (module.js:*:*) - at evalScript (bootstrap_node.js:*:*) - at Anonymous function (bootstrap_node.js:*:*) - at emitNone (events.js:*:*) - at emit (events.js:*:*) - at endReadableNT (_stream_readable.js:*:*) - at _combinedTickCallback (internal/process/next_tick.js:*:*) - -42 -42 -Error: hello - at Global code ([stdin]:*) - at Script.prototype.runInThisContext (vm.js:*:*) - at runInThisContext (vm.js:*) - at Anonymous function ([stdin]-wrapper:*:*) - at Module.prototype._compile (module.js:*:*) - at evalScript (bootstrap_node.js:*:*) - at Anonymous function (bootstrap_node.js:*:*) - at emitNone (events.js:*:*) - at emit (events.js:*:*) - at endReadableNT (_stream_readable.js:*:*) - -Error: hello - at Global code ([stdin]:*) - at Script.prototype.runInThisContext (vm.js:*:*) - at runInThisContext (vm.js:*) - at Anonymous function ([stdin]-wrapper:*:*) - at Module.prototype._compile (module.js:*:*) - at evalScript (bootstrap_node.js:*:*) - at Anonymous function (bootstrap_node.js:*:*) - at emitNone (events.js:*:*) - at emit (events.js:*:*) - at endReadableNT (_stream_readable.js:*:*) - - -100 -ReferenceError: Variable undefined in strict mode - at Global code ([stdin]:*) - at Script.prototype.runInThisContext (vm.js:*:*) - at runInThisContext (vm.js:*) - at Anonymous function ([stdin]-wrapper:*:*) - at Module.prototype._compile (module.js:*:*) - at evalScript (bootstrap_node.js:*:*) - at Anonymous function (bootstrap_node.js:*:*) - at emitNone (events.js:*:*) - at emit (events.js:*:*) - at endReadableNT (_stream_readable.js:*:*) - -10 -10 -done +[stdin] +[stdin]:1 +'use strict'; with(this){__filename} + ^^^^^ + +SyntaxError: 'with' statements are not allowed in strict mode + at createScript (vm.js:*:*) + at runInThisContext (vm.js:*:*) + at Anonymous function ([stdin]-wrapper:*:*) + at Module.prototype._compile (module.js:*:*) + at evalScript (bootstrap_node.js:*:*) + at Anonymous function (bootstrap_node.js:*:*) + at emitNone (events.js:*:*) + at emit (events.js:*:*) + at endReadableNT (_stream_readable.js:*:*) + at _combinedTickCallback (internal/process/next_tick.js:*:*) +42 +42 +[stdin]:1 +throw new Error("hello") +^ + +Error: hello + at Global code ([stdin]:*:*) + at Script.prototype.runInThisContext (vm.js:*:*) + at runInThisContext (vm.js:*:*) + at Anonymous function ([stdin]-wrapper:*:*) + at Module.prototype._compile (module.js:*:*) + at evalScript (bootstrap_node.js:*:*) + at Anonymous function (bootstrap_node.js:*:*) + at emitNone (events.js:*:*) + at emit (events.js:*:*) + at endReadableNT (_stream_readable.js:*:*) +[stdin]:1 +'use strict'; throw new Error("hello") + ^ + +Error: hello + at Global code ([stdin]:*:*) + at Script.prototype.runInThisContext (vm.js:*:*) + at runInThisContext (vm.js:*:*) + at Anonymous function ([stdin]-wrapper:*:*) + at Module.prototype._compile (module.js:*:*) + at evalScript (bootstrap_node.js:*:*) + at Anonymous function (bootstrap_node.js:*:*) + at emitNone (events.js:*:*) + at emit (events.js:*:*) + at endReadableNT (_stream_readable.js:*:*) +100 +[stdin]:1 +'use strict'; var x = 100; y = x; + ^ + +ReferenceError: Variable undefined in strict mode + at Global code ([stdin]:*:*) + at Script.prototype.runInThisContext (vm.js:*:*) + at runInThisContext (vm.js:*:*) + at Anonymous function ([stdin]-wrapper:*:*) + at Module.prototype._compile (module.js:*:*) + at evalScript (bootstrap_node.js:*:*) + at Anonymous function (bootstrap_node.js:*:*) + at emitNone (events.js:*:*) + at emit (events.js:*:*) + at endReadableNT (_stream_readable.js:*:*) + +vm.js:* + return realRunInThisContext.call(this, options); + ^ +10 + +vm.js:* + return realRunInThisContext.call(this, options); + ^ +10 +done \ No newline at end of file diff --git a/test/message/throw_custom_error.chakracore.out b/test/message/throw_custom_error.chakracore.out deleted file mode 100644 index 3b609b09a7a..00000000000 --- a/test/message/throw_custom_error.chakracore.out +++ /dev/null @@ -1 +0,0 @@ -MyCustomError: This is a custom message diff --git a/test/message/throw_custom_error.v8.out b/test/message/throw_custom_error.out similarity index 100% rename from test/message/throw_custom_error.v8.out rename to test/message/throw_custom_error.out diff --git a/test/message/throw_in_line_with_tabs.chakracore.out b/test/message/throw_in_line_with_tabs.chakracore.out deleted file mode 100644 index b0a64c67f96..00000000000 --- a/test/message/throw_in_line_with_tabs.chakracore.out +++ /dev/null @@ -1,2 +0,0 @@ -before -[object Object] diff --git a/test/message/throw_in_line_with_tabs.v8.out b/test/message/throw_in_line_with_tabs.out similarity index 100% rename from test/message/throw_in_line_with_tabs.v8.out rename to test/message/throw_in_line_with_tabs.out diff --git a/test/message/throw_non_error.chakracore.out b/test/message/throw_non_error.chakracore.out deleted file mode 100644 index 5bf11029905..00000000000 --- a/test/message/throw_non_error.chakracore.out +++ /dev/null @@ -1 +0,0 @@ -[object Object] diff --git a/test/message/throw_non_error.v8.out b/test/message/throw_non_error.out similarity index 100% rename from test/message/throw_non_error.v8.out rename to test/message/throw_non_error.out diff --git a/test/message/throw_null.chakracore.out b/test/message/throw_null.chakracore.out deleted file mode 100644 index 19765bd501b..00000000000 --- a/test/message/throw_null.chakracore.out +++ /dev/null @@ -1 +0,0 @@ -null diff --git a/test/message/throw_null.v8.out b/test/message/throw_null.out similarity index 100% rename from test/message/throw_null.v8.out rename to test/message/throw_null.out diff --git a/test/message/throw_undefined.chakracore.out b/test/message/throw_undefined.chakracore.out deleted file mode 100644 index 417b7b5370d..00000000000 --- a/test/message/throw_undefined.chakracore.out +++ /dev/null @@ -1 +0,0 @@ -undefined diff --git a/test/message/throw_undefined.v8.out b/test/message/throw_undefined.out similarity index 100% rename from test/message/throw_undefined.v8.out rename to test/message/throw_undefined.out diff --git a/test/message/timeout_throw.chakracore.out b/test/message/timeout_throw.chakracore.out index 1fb90b55ff9..25117b73ff4 100644 --- a/test/message/timeout_throw.chakracore.out +++ b/test/message/timeout_throw.chakracore.out @@ -1,3 +1,7 @@ +*test*message*timeout_throw.js:* + undefined_reference_error_maker; + ^ + ReferenceError: 'undefined_reference_error_maker' is not defined at Anonymous function (*test*message*timeout_throw.js:*:*) at ontimeout (timers.js:*:*) diff --git a/test/message/undefined_reference_in_new_context.chakracore.out b/test/message/undefined_reference_in_new_context.chakracore.out index 3fc92fecb12..e2597bac981 100644 --- a/test/message/undefined_reference_in_new_context.chakracore.out +++ b/test/message/undefined_reference_in_new_context.chakracore.out @@ -1,4 +1,8 @@ before +evalmachine.:1 +foo.bar = 5; +^ + TypeError: Unable to set property 'bar' of undefined or null reference at Global code (evalmachine.:1:1) at Script.prototype.runInContext (vm.js:*) diff --git a/test/message/vm_display_runtime_error.chakracore.out b/test/message/vm_display_runtime_error.chakracore.out index 01231a1e218..2831d9f4fd5 100644 --- a/test/message/vm_display_runtime_error.chakracore.out +++ b/test/message/vm_display_runtime_error.chakracore.out @@ -1,4 +1,8 @@ beginning +test.vm:1 +throw new Error("boo!") +^ + Error: boo! at Global code (test.vm:*) at Script.prototype.runInThisContext (vm.js:*:*) @@ -10,6 +14,9 @@ Error: boo! at tryModuleLoad (module.js:*) at Module._load (module.js:*) at Module.runMain (module.js:*) +test.vm:1 +throw new Error("spooky!") +^ Error: spooky! at Global code (test.vm:*) at Script.prototype.runInThisContext (vm.js:*:*) diff --git a/test/message/vm_display_syntax_error.chakracore.out b/test/message/vm_display_syntax_error.chakracore.out index c53a4d0218b..7a5509833be 100644 --- a/test/message/vm_display_syntax_error.chakracore.out +++ b/test/message/vm_display_syntax_error.chakracore.out @@ -10,6 +10,10 @@ SyntaxError: Expected identifier at Module._load (module.js:*) at Module.runMain (module.js:*) at startup (bootstrap_node.js:*) +test.vm:* +var 5; + ^^ + SyntaxError: Expected identifier at createScript (vm.js:*) at runInThisContext (vm.js:*) diff --git a/test/message/vm_dont_display_runtime_error.chakracore.out b/test/message/vm_dont_display_runtime_error.chakracore.out index 4a5a79d9996..3e3bfc58ae0 100644 --- a/test/message/vm_dont_display_runtime_error.chakracore.out +++ b/test/message/vm_dont_display_runtime_error.chakracore.out @@ -1,5 +1,9 @@ beginning middle +vm.js:* + return realRunInThisContext.call(this, options); + ^ + Error: boo! at Global code (test.vm:*) at Script.prototype.runInThisContext (vm.js:*:*) diff --git a/test/message/vm_dont_display_syntax_error.chakracore.out b/test/message/vm_dont_display_syntax_error.chakracore.out index b2ddbe89fcc..3d20b55d425 100644 --- a/test/message/vm_dont_display_syntax_error.chakracore.out +++ b/test/message/vm_dont_display_syntax_error.chakracore.out @@ -1,5 +1,9 @@ beginning middle +vm.js:* + return new Script(code, options); + ^ + SyntaxError: Expected identifier at createScript (vm.js:*) at runInThisContext (vm.js:*) diff --git a/test/parallel/test-cli-syntax.js b/test/parallel/test-cli-syntax.js index fa9e2476e55..531ace4526e 100644 --- a/test/parallel/test-cli-syntax.js +++ b/test/parallel/test-cli-syntax.js @@ -53,12 +53,8 @@ const syntaxArgs = [ assert.strictEqual(c.stdout, '', 'stdout produced'); // stderr should include the filename - // TODO(digitalinfinity): Remove this check - // Node-ChakraCore currently doesn't populate TryCatch.Message - if (process.jsEngine === 'v8') { - assert(c.stderr.startsWith(file), - "stderr doesn't start with the filename"); - } + assert(c.stderr.startsWith(file), + "stderr doesn't start with the filename"); // stderr should have a syntax error message const match = c.stderr.match(common.engineSpecificMessage({ diff --git a/test/parallel/test-vm-syntax-error-stderr.js b/test/parallel/test-vm-syntax-error-stderr.js index a4b1b404d4c..0660347d61d 100644 --- a/test/parallel/test-vm-syntax-error-stderr.js +++ b/test/parallel/test-vm-syntax-error-stderr.js @@ -23,13 +23,10 @@ p.stderr.on('data', function(data) { }); process.on('exit', function() { - // chakra engine don't point line in script file - if (common.isChakraEngine) { - assert(/^SyntaxError: Expected ';'/.test(output)); - } else { - assert(/BEGIN CERT/.test(output)); - assert(/^\s+\^/m.test(output)); - assert(/Invalid left-hand side expression in prefix operation/ - .test(output)); - } + assert(/BEGIN CERT/.test(output)); + assert(/^\s+\^/m.test(output)); + common.engineSpecificMessage({ + v8: /Invalid left-hand side expression in prefix operation/, + chakracore: /SyntaxError: Expected ';'/ + }).test(output); });