Browse Source

Testcase changes for duk_activation linked list

pull/1487/head
Sami Vaarala 8 years ago
parent
commit
ad00c42887
  1. 3
      tests/ecmascript/test-err-callstack-headroom-1.js
  2. 35
      tests/ecmascript/test-err-callstack-headroom-2.js
  3. 37
      tests/ecmascript/test-err-errcreate-error.js
  4. 37
      tests/ecmascript/test-err-errthrow-error.js

3
tests/ecmascript/test-err-callstack-headroom.js → tests/ecmascript/test-err-callstack-headroom-1.js

@ -41,7 +41,6 @@ try {
function f() { f(); }
f();
}
catch(e) {
} catch(e) {
print(e);
}

35
tests/ecmascript/test-err-callstack-headroom-2.js

@ -0,0 +1,35 @@
/*
* Error handling callstack headroom (GH-191)
*
* Check that relaxed callstack limit during error creation is still bounded
* so that an errCreate callback doing unbounded recursion is caught. The
* result is a DoubleError.
*/
/*---
{
"custom": true
}
---*/
/*===
DoubleError: error in error handling
===*/
try {
function recurse() {
var dummy;
recurse();
dummy = 1;
}
Duktape.errCreate = function(e) {
recurse();
return e;
};
function f() { f(); }
f();
} catch(e) {
print(e);
}

37
tests/ecmascript/test-err-errcreate-error.js

@ -0,0 +1,37 @@
/*
* Errors thrown by Duktape internals during an errCreate() will work
* normally except they won't be augmented to avoid recursion.
*/
/*===
errCreate: RangeError
internal error: URIError
internal error: EvalError
errThrow: RangeError
RangeError
===*/
try {
Duktape.errCreate = function (e) {
print('errCreate:', e.name);
try {
decodeURIComponent('%ff%ff');
} catch (e2) {
print('internal error:', e2.name);
}
try {
throw new EvalError('user error'); // created but not augmented
} catch (e2) {
print('internal error:', e2.name);
}
return e;
};
Duktape.errThrow = function (e) {
print('errThrow:', e.name);
return e;
};
throw new RangeError('aiee');
} catch (e) {
print(e.name);
}

37
tests/ecmascript/test-err-errthrow-error.js

@ -0,0 +1,37 @@
/*
* Errors thrown by Duktape internals during an errThrow() will work
* normally except they won't be augmented to avoid recursion.
*/
/*===
errCreate: RangeError
errThrow: RangeError
internal error: URIError
internal error: EvalError
RangeError
===*/
try {
Duktape.errCreate = function (e) {
print('errCreate:', e.name);
return e;
};
Duktape.errThrow = function (e) {
print('errThrow:', e.name);
try {
decodeURIComponent('%ff%ff');
} catch (e2) {
print('internal error:', e2.name);
}
try {
throw new EvalError('user error'); // created but not augmented
} catch (e2) {
print('internal error:', e2.name);
}
return e;
};
throw new RangeError('aiee');
} catch (e) {
print(e.name);
}
Loading…
Cancel
Save