mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-08 09:09:42 +00:00
This didn't make any sense, and was already handled by pushing a new execution context anyway. By simply removing these bogus lines of code, we fix a bug where throwing inside a function whose bytecode was shorter than the calling function would crash trying to generate an Error stack trace (because the bytecode offset we were trying to symbolicate was actually from the longer caller function, and not valid in the callee function.) This makes --log-all-js-exceptions less crash prone and more helpful.
20 lines
582 B
JavaScript
20 lines
582 B
JavaScript
test("Don't crash when throwing exception inside a callee smaller than the caller", () => {
|
|
function make() {
|
|
let o = {};
|
|
Object.defineProperty(o, "go", {
|
|
get: function () {
|
|
return doesNotExist;
|
|
},
|
|
});
|
|
return o;
|
|
}
|
|
|
|
// Some nonsense to make sure this function has a longer bytecode than the throwing getter.
|
|
function x() {
|
|
return 3;
|
|
}
|
|
function b() {}
|
|
b(x() + x() + x());
|
|
|
|
expect(() => make().go()).toThrowWithMessage(ReferenceError, "'doesNotExist' is not defined");
|
|
});
|