From 87e4f43be04313da7b4b5ede81c9c97b6bd5394c Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sat, 14 Apr 2018 08:40:37 +0200 Subject: Bug 1320993 - Fix exporting default class expression --- js/src/jit-test/tests/modules/bug-1320993.js | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 js/src/jit-test/tests/modules/bug-1320993.js (limited to 'js/src/jit-test') diff --git a/js/src/jit-test/tests/modules/bug-1320993.js b/js/src/jit-test/tests/modules/bug-1320993.js new file mode 100644 index 000000000..bece5731a --- /dev/null +++ b/js/src/jit-test/tests/modules/bug-1320993.js @@ -0,0 +1,2 @@ +parseModule("export default (class {})"); +parseModule("export default (class A {})"); -- cgit v1.2.3 From b2ec36808a240cd8169190168c915cd0463f8c87 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sat, 14 Apr 2018 08:49:15 +0200 Subject: Bug 1326453 - Part 1: Remove @@iterator method from module namespace objects per ES2017 --- js/src/jit-test/tests/modules/import-namespace.js | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'js/src/jit-test') diff --git a/js/src/jit-test/tests/modules/import-namespace.js b/js/src/jit-test/tests/modules/import-namespace.js index f44d4568a..94a48461d 100644 --- a/js/src/jit-test/tests/modules/import-namespace.js +++ b/js/src/jit-test/tests/modules/import-namespace.js @@ -64,25 +64,6 @@ assertEq(typeof desc.get, "undefined"); assertEq(typeof desc.set, "undefined"); assertEq(Object.prototype.toString.call(ns), "[object Module]"); -// Test @@iterator method. -let iteratorFun = ns[Symbol.iterator]; -assertEq(iteratorFun.name, "[Symbol.iterator]"); - -let iterator = ns[Symbol.iterator](); -assertEq(iterator[Symbol.iterator](), iterator); -assertIteratorNext(iterator, "a"); -assertIteratorNext(iterator, "b"); -assertIteratorDone(iterator); - -// The iterator's next method can only be called on the object it was originally -// associated with. -iterator = ns[Symbol.iterator](); -let iterator2 = ns[Symbol.iterator](); -assertThrowsInstanceOf(() => iterator.next.call({}), TypeError); -assertThrowsInstanceOf(() => iterator.next.call(iterator2), TypeError); -assertEq(iterator.next.call(iterator).value, "a"); -assertEq(iterator2.next.call(iterator2).value, "a"); - // Test cyclic namespace import and access in module evaluation. let c = moduleRepo['c'] = parseModule("export let c = 1; import * as ns from 'd'; let d = ns.d;"); -- cgit v1.2.3 From a7f7a2231938e49ca2521fd417be7a313045c006 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sat, 14 Apr 2018 08:50:17 +0200 Subject: Bug 1326453 - Part 2: Change @@toStringTag for module namespace objects to non-configurable --- js/src/jit-test/tests/modules/import-namespace.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/jit-test') diff --git a/js/src/jit-test/tests/modules/import-namespace.js b/js/src/jit-test/tests/modules/import-namespace.js index 94a48461d..71a1ce7df 100644 --- a/js/src/jit-test/tests/modules/import-namespace.js +++ b/js/src/jit-test/tests/modules/import-namespace.js @@ -59,7 +59,7 @@ desc = Object.getOwnPropertyDescriptor(ns, Symbol.toStringTag); assertEq(desc.value, "Module"); assertEq(desc.writable, false); assertEq(desc.enumerable, false); -assertEq(desc.configurable, true); +assertEq(desc.configurable, false); assertEq(typeof desc.get, "undefined"); assertEq(typeof desc.set, "undefined"); assertEq(Object.prototype.toString.call(ns), "[object Module]"); -- cgit v1.2.3 From e2719e1dbf7b706cd5ec8b3ecd899d2fc063c20f Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sat, 14 Apr 2018 08:51:05 +0200 Subject: Bug 1326453 - Part 3: Don't throw a TypeError when SetPrototypeOf for module namespace objects is called with null --- js/src/jit-test/tests/modules/import-namespace.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'js/src/jit-test') diff --git a/js/src/jit-test/tests/modules/import-namespace.js b/js/src/jit-test/tests/modules/import-namespace.js index 71a1ce7df..27d0193aa 100644 --- a/js/src/jit-test/tests/modules/import-namespace.js +++ b/js/src/jit-test/tests/modules/import-namespace.js @@ -39,7 +39,9 @@ assertEq(getModuleEnvironmentValue(b, "x"), 3); // Test module namespace internal methods as defined in 9.4.6 assertEq(Object.getPrototypeOf(ns), null); -assertThrowsInstanceOf(() => Object.setPrototypeOf(ns, null), TypeError); +assertEq(Reflect.setPrototypeOf(ns, null), true); +assertEq(Reflect.setPrototypeOf(ns, Object.prototype), false); +assertThrowsInstanceOf(() => Object.setPrototypeOf(ns, {}), TypeError); assertThrowsInstanceOf(function() { ns.foo = 1; }, TypeError); assertEq(Object.isExtensible(ns), false); Object.preventExtensions(ns); -- cgit v1.2.3 From 6452e3c9785260f21c5013d31e855e7b3e0497f4 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sat, 14 Apr 2018 08:52:37 +0200 Subject: Bug 1326453 - Part 4: Return @@toStringTag in [[OwnPropertyKeys]] trap for module namespace objects --- js/src/jit-test/tests/modules/import-namespace.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'js/src/jit-test') diff --git a/js/src/jit-test/tests/modules/import-namespace.js b/js/src/jit-test/tests/modules/import-namespace.js index 27d0193aa..2094c27fe 100644 --- a/js/src/jit-test/tests/modules/import-namespace.js +++ b/js/src/jit-test/tests/modules/import-namespace.js @@ -19,9 +19,19 @@ function testHasNames(names, expected) { }); } +function testEqualArrays(actual, expected) { + assertEq(Array.isArray(actual), true); + assertEq(Array.isArray(expected), true); + assertEq(actual.length, expected.length); + for (let i = 0; i < expected.length; i++) { + assertEq(actual[i], expected[i]); + } +} + let a = moduleRepo['a'] = parseModule( - `export var a = 1; - export var b = 2;` + `// Reflection methods should return these exports alphabetically sorted. + export var b = 2; + export var a = 1;` ); let b = moduleRepo['b'] = parseModule( @@ -66,6 +76,11 @@ assertEq(typeof desc.get, "undefined"); assertEq(typeof desc.set, "undefined"); assertEq(Object.prototype.toString.call(ns), "[object Module]"); +// Test [[OwnPropertyKeys]] internal method. +testEqualArrays(Reflect.ownKeys(ns), ["a", "b", Symbol.toStringTag]); +testEqualArrays(Object.getOwnPropertyNames(ns), ["a", "b"]); +testEqualArrays(Object.getOwnPropertySymbols(ns), [Symbol.toStringTag]); + // Test cyclic namespace import and access in module evaluation. let c = moduleRepo['c'] = parseModule("export let c = 1; import * as ns from 'd'; let d = ns.d;"); -- cgit v1.2.3 From ba6602b2de951beb74ef0f43a1cbae33ff0548e2 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sat, 14 Apr 2018 08:55:29 +0200 Subject: Bug 1326453 - Part 5: Remove no longer used ListIterator implementation --- js/src/jit-test/tests/basic/bug1220766.js | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 js/src/jit-test/tests/basic/bug1220766.js (limited to 'js/src/jit-test') diff --git a/js/src/jit-test/tests/basic/bug1220766.js b/js/src/jit-test/tests/basic/bug1220766.js deleted file mode 100644 index fca11eafe..000000000 --- a/js/src/jit-test/tests/basic/bug1220766.js +++ /dev/null @@ -1,3 +0,0 @@ -iter = getSelfHostedValue("CreateListIterator")([]); -iter.next(); -iter.next(); -- cgit v1.2.3 From 3bd16c90800e8ec6ef8d7f135d8435bbbc0b94e6 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sat, 14 Apr 2018 08:57:05 +0200 Subject: Bug 1341256 - Fix module namespace object get handler --- js/src/jit-test/tests/modules/import-namespace.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'js/src/jit-test') diff --git a/js/src/jit-test/tests/modules/import-namespace.js b/js/src/jit-test/tests/modules/import-namespace.js index 2094c27fe..0287f7a60 100644 --- a/js/src/jit-test/tests/modules/import-namespace.js +++ b/js/src/jit-test/tests/modules/import-namespace.js @@ -45,6 +45,9 @@ b.evaluation(); testHasNames(getModuleEnvironmentNames(b), ["ns", "x"]); let ns = getModuleEnvironmentValue(b, "ns"); testHasNames(Object.keys(ns), ["a", "b"]); +assertEq(ns.a, 1); +assertEq(ns.b, 2); +assertEq(ns.c, undefined); assertEq(getModuleEnvironmentValue(b, "x"), 3); // Test module namespace internal methods as defined in 9.4.6 -- cgit v1.2.3 From 8af513a2072d7f808f03a44b32130ff6ffcd7daa Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sat, 14 Apr 2018 09:00:53 +0200 Subject: Bug 1341411 - Support circular module dependencies through export* per ES2017 --- js/src/jit-test/modules/empty.js | 1 + js/src/jit-test/modules/export-star-circular-1.js | 1 + js/src/jit-test/modules/export-star-circular-2.js | 3 +++ .../tests/modules/export-star-cannot-rescue-missing-export.js | 4 ++++ js/src/jit-test/tests/modules/export-star-circular-dependencies.js | 6 ++++++ 5 files changed, 15 insertions(+) create mode 100644 js/src/jit-test/modules/empty.js create mode 100644 js/src/jit-test/modules/export-star-circular-1.js create mode 100644 js/src/jit-test/modules/export-star-circular-2.js create mode 100644 js/src/jit-test/tests/modules/export-star-cannot-rescue-missing-export.js create mode 100644 js/src/jit-test/tests/modules/export-star-circular-dependencies.js (limited to 'js/src/jit-test') diff --git a/js/src/jit-test/modules/empty.js b/js/src/jit-test/modules/empty.js new file mode 100644 index 000000000..bd9ec079d --- /dev/null +++ b/js/src/jit-test/modules/empty.js @@ -0,0 +1 @@ +// Intentionally empty. diff --git a/js/src/jit-test/modules/export-star-circular-1.js b/js/src/jit-test/modules/export-star-circular-1.js new file mode 100644 index 000000000..9a0771b02 --- /dev/null +++ b/js/src/jit-test/modules/export-star-circular-1.js @@ -0,0 +1 @@ +export* from "export-star-circular-2.js"; diff --git a/js/src/jit-test/modules/export-star-circular-2.js b/js/src/jit-test/modules/export-star-circular-2.js new file mode 100644 index 000000000..b273d9cef --- /dev/null +++ b/js/src/jit-test/modules/export-star-circular-2.js @@ -0,0 +1,3 @@ +export {y as x} from "export-star-circular-1.js"; + +export var y = "pass"; diff --git a/js/src/jit-test/tests/modules/export-star-cannot-rescue-missing-export.js b/js/src/jit-test/tests/modules/export-star-cannot-rescue-missing-export.js new file mode 100644 index 000000000..f87829d89 --- /dev/null +++ b/js/src/jit-test/tests/modules/export-star-cannot-rescue-missing-export.js @@ -0,0 +1,4 @@ +// |jit-test| module; error:SyntaxError + +export { a } from "empty.js"; +export* from "module1.js"; diff --git a/js/src/jit-test/tests/modules/export-star-circular-dependencies.js b/js/src/jit-test/tests/modules/export-star-circular-dependencies.js new file mode 100644 index 000000000..9aa612f08 --- /dev/null +++ b/js/src/jit-test/tests/modules/export-star-circular-dependencies.js @@ -0,0 +1,6 @@ +// |jit-test| module + +import { x, y } from "export-star-circular-1.js"; + +assertEq(x, "pass"); +assertEq(y, "pass"); -- cgit v1.2.3 From ad9ee72dcd7981bc47b3844a224d69fadfdfd8ef Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sat, 14 Apr 2018 09:02:03 +0200 Subject: Bug 1341298 - Relax expected module state when resolving modules and circular module dependencies are present --- js/src/jit-test/modules/export-circular-nonexisting-binding-1.js | 4 ++++ js/src/jit-test/modules/export-circular-nonexisting-binding-2.js | 1 + js/src/jit-test/tests/modules/export-circular-nonexisting-binding.js | 3 +++ 3 files changed, 8 insertions(+) create mode 100644 js/src/jit-test/modules/export-circular-nonexisting-binding-1.js create mode 100644 js/src/jit-test/modules/export-circular-nonexisting-binding-2.js create mode 100644 js/src/jit-test/tests/modules/export-circular-nonexisting-binding.js (limited to 'js/src/jit-test') diff --git a/js/src/jit-test/modules/export-circular-nonexisting-binding-1.js b/js/src/jit-test/modules/export-circular-nonexisting-binding-1.js new file mode 100644 index 000000000..2b91b6a28 --- /dev/null +++ b/js/src/jit-test/modules/export-circular-nonexisting-binding-1.js @@ -0,0 +1,4 @@ +import "export-circular-nonexisting-binding-2.js"; + +export* from "empty.js"; +export {x} from "empty.js"; diff --git a/js/src/jit-test/modules/export-circular-nonexisting-binding-2.js b/js/src/jit-test/modules/export-circular-nonexisting-binding-2.js new file mode 100644 index 000000000..ba7dcc1b4 --- /dev/null +++ b/js/src/jit-test/modules/export-circular-nonexisting-binding-2.js @@ -0,0 +1 @@ +export {x} from "export-circular-nonexisting-binding-1.js"; diff --git a/js/src/jit-test/tests/modules/export-circular-nonexisting-binding.js b/js/src/jit-test/tests/modules/export-circular-nonexisting-binding.js new file mode 100644 index 000000000..387c7c369 --- /dev/null +++ b/js/src/jit-test/tests/modules/export-circular-nonexisting-binding.js @@ -0,0 +1,3 @@ +// |jit-test| module; error:SyntaxError + +import "export-circular-nonexisting-binding-1.js"; -- cgit v1.2.3