mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibJS: Stop tracking whether execution context is strict mode or not
This was only used for basic testing, and forced us to plumb this flag flag in a bunch of places.
This commit is contained in:
parent
fb05063dde
commit
fdb85a330e
Notes:
github-actions[bot]
2025-10-29 20:22:21 +00:00
Author: https://github.com/awesomekling
Commit: fdb85a330e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6629
19 changed files with 4 additions and 320 deletions
|
|
@ -1,64 +1,3 @@
|
|||
test("non strict-mode by default", () => {
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
test("use strict with double quotes", () => {
|
||||
"use strict";
|
||||
expect(isStrictMode()).toBeTrue();
|
||||
});
|
||||
|
||||
// prettier-ignore
|
||||
test("use strict with single quotes", () => {
|
||||
'use strict';
|
||||
expect(isStrictMode()).toBeTrue();
|
||||
});
|
||||
|
||||
// prettier-ignore
|
||||
test("use strict with backticks does not yield strict mode", () => {
|
||||
`use strict`;
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
// prettier-ignore
|
||||
test("use strict with single quotes after statement does not yield strict mode code", () => {
|
||||
;'use strict';
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
// prettier-ignore
|
||||
test("use strict with double quotes after statement does not yield strict mode code", () => {
|
||||
;"use strict";
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
test("use strict interrupted by a line continuation does not yield strict mode code", () => {
|
||||
"use \
|
||||
strict";
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
test("strict mode propagates down the scope chain", () => {
|
||||
"use strict";
|
||||
expect(isStrictMode()).toBeTrue();
|
||||
(function () {
|
||||
expect(isStrictMode()).toBeTrue();
|
||||
})();
|
||||
});
|
||||
|
||||
test("strict mode does not propagate up the scope chain", () => {
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
(function () {
|
||||
"use strict";
|
||||
expect(isStrictMode()).toBeTrue();
|
||||
})();
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
test('only the string "use strict" yields strict mode code', () => {
|
||||
"use stric";
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
test("strict mode does not apply global object to |this|", () => {
|
||||
"use strict";
|
||||
let functionThis;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue