Bug 906963 - Add extra tests and review suggestions from jimb that I missed

This commit is contained in:
Eddy Bruel 2013-09-11 19:07:57 +02:00
parent e0552f2a51
commit 88739e94bd
2 changed files with 6 additions and 1 deletions

View File

@ -62,3 +62,7 @@ test("function f() { throw new Error(); } try { f(); } catch (e) {}", [true, tru
test("function f() { throw new Error(); } try { f(); } catch (e) { throw e; }", [true, true, false]);
test("try { eval('throw new Error()'); } catch (e) {}", [true, true]);
test("try { eval('throw new Error()'); } catch (e) { throw e; }", [true, true, false]);
// Should correctly detect catch blocks just before and just after throws
test("throw new Error; try {} catch (e) {}", [false]);
test("try {} catch (e) {} throw new Error();", [false]);

View File

@ -3542,7 +3542,8 @@ DebuggerScript_isInCatchScope(JSContext *cx, unsigned argc, Value* vp)
JSTryNote* tnBegin = script->trynotes()->vector;
JSTryNote* tnEnd = tnBegin + script->trynotes()->length;
while (tnBegin != tnEnd) {
if (offset - tnBegin->start < tnBegin->length &&
if (tnBegin->start <= offset &&
offset <= tnBegin->start + tnBegin->length &&
tnBegin->kind == JSTRY_CATCH)
{
args.rval().setBoolean(true);