Skip to content
Permalink
Browse files
Use a JSString for the TerminationException value instead of a Symbol.
https://bugs.webkit.org/show_bug.cgi?id=224490

Reviewed by Yusuke Suzuki.

This makes it convertible to a String for clients that wish to report the exception.
Clients, in this case, does not apply to JS code, only C++ code that catches the
exception at the outermost point to handle the termination.  The TerminationException
value is not visible to JS code because the TerminationException cannot be caught.
So, this change is transparent to JS code.

* runtime/VM.cpp:
(JSC::VM::ensureTerminationException):


Canonical link: https://commits.webkit.org/236467@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275902 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Mark Lam committed Apr 13, 2021
1 parent 8cf364a commit 57e024766ff5a223f56e51b9da9797aae21c1556
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
@@ -1,3 +1,19 @@
2021-04-13 Mark Lam <mark.lam@apple.com>

Use a JSString for the TerminationException value instead of a Symbol.
https://bugs.webkit.org/show_bug.cgi?id=224490

Reviewed by Yusuke Suzuki.

This makes it convertible to a String for clients that wish to report the exception.
Clients, in this case, does not apply to JS code, only C++ code that catches the
exception at the outermost point to handle the termination. The TerminationException
value is not visible to JS code because the TerminationException cannot be caught.
So, this change is transparent to JS code.

* runtime/VM.cpp:
(JSC::VM::ensureTerminationException):

2021-04-13 Commit Queue <commit-queue@webkit.org>

Unreviewed, reverting r275867.
@@ -763,12 +763,11 @@ SamplingProfiler& VM::ensureSamplingProfiler(Ref<Stopwatch>&& stopwatch)
}
#endif // ENABLE(SAMPLING_PROFILER)

static SymbolImpl::StaticSymbolImpl terminationErrorSymbol { "TerminationError", SymbolImpl::s_flagIsPrivate };

static StringImpl::StaticStringImpl terminationErrorString { "JavaScript execution terminated." };
Exception* VM::ensureTerminationException()
{
if (!m_terminationException) {
Symbol* terminationError = Symbol::create(*this, terminationErrorSymbol);
JSString* terminationError = jsNontrivialString(*this, terminationErrorString);
m_terminationException = Exception::create(*this, terminationError, Exception::DoNotCaptureStack);
}
return m_terminationException;

0 comments on commit 57e0247

Please sign in to comment.