Skip to content
Permalink
Browse files
2008-08-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
        Reviewed by Oliver Hunt.

        Bug 20093: JSC shell does not clear exceptions after it executes toString on an expression
        <https://bugs.webkit.org/show_bug.cgi?id=20093>

        Clear exceptions after evaluating any code in the JSC shell. We do not
        report exceptions that are caused by calling toString on the final
        valued, but at least we avoid incorrect behaviour.

        Also, print any exceptions that occurred while evaluating code at the
        interactive prompt, not just while evaluating code from a file.

        * kjs/Shell.cpp:
        (runWithScripts):
        (runInteractive):


Canonical link: https://commits.webkit.org/28316@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@35911 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Cameron Zwarich committed Aug 25, 2008
1 parent 92b744d commit 39e184e4043e466cf0c425bda658fb68824d4a31
Showing 2 changed files with 28 additions and 4 deletions.
@@ -1,3 +1,21 @@
2008-08-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>

Reviewed by Oliver Hunt.

Bug 20093: JSC shell does not clear exceptions after it executes toString on an expression
<https://bugs.webkit.org/show_bug.cgi?id=20093>

Clear exceptions after evaluating any code in the JSC shell. We do not
report exceptions that are caused by calling toString on the final
valued, but at least we avoid incorrect behaviour.

Also, print any exceptions that occurred while evaluating code at the
interactive prompt, not just while evaluating code from a file.

* kjs/Shell.cpp:
(runWithScripts):
(runInteractive):

2008-08-24 Mark Rowe <mrowe@apple.com>

Reviewed by Oliver Hunt.
@@ -350,12 +350,14 @@ static bool runWithScripts(GlobalObject* globalObject, const Vector<UString>& fi
Completion completion = Interpreter::evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), fileName, 1, script.data());
success = success && completion.complType() != Throw;
if (dump) {
if (success)
printf("End: %s\n", completion.value()->toString(globalObject->globalExec()).ascii());
else
if (completion.complType() == Throw)
printf("Exception: %s\n", completion.value()->toString(globalObject->globalExec()).ascii());
else
printf("End: %s\n", completion.value()->toString(globalObject->globalExec()).ascii());
}

globalObject->globalExec()->clearException();

#if ENABLE(SAMPLING_TOOL)
machine->m_sampler->stop();
machine->m_sampler->dump(globalObject->globalExec());
@@ -390,8 +392,12 @@ static void runInteractive(GlobalObject* globalObject)
line.append('\0');
Completion completion = Interpreter::evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), interpreterName, 1, line.data());
#endif
if (completion.isValueCompletion())
if (completion.complType() == Throw)
printf("Exception: %s\n", completion.value()->toString(globalObject->globalExec()).ascii());
else
printf("%s\n", completion.value()->toString(globalObject->globalExec()).UTF8String().c_str());

globalObject->globalExec()->clearException();
}
printf("\n");
}

0 comments on commit 39e184e

Please sign in to comment.