Diff
Modified: trunk/JSTests/ChangeLog (235830 => 235831)
--- trunk/JSTests/ChangeLog 2018-09-08 20:19:22 UTC (rev 235830)
+++ trunk/JSTests/ChangeLog 2018-09-08 20:51:22 UTC (rev 235831)
@@ -1,3 +1,25 @@
+2018-09-08 Yusuke Suzuki <[email protected]>
+
+ [JSC] Remove loadModule function in jsc.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=184808
+
+ Reviewed by Darin Adler.
+
+ Use `import` _expression_ instead.
+
+ * modules/different-view.js:
+ (from.string_appeared_here.shouldThrow): Deleted.
+ * modules/fallback-ambiguous.js:
+ (from.string_appeared_here.shouldThrow): Deleted.
+ * modules/import-error.js:
+ (from.string_appeared_here.shouldThrow): Deleted.
+ (shouldThrow): Deleted.
+ * modules/indirect-export-error.js:
+ (from.string_appeared_here.shouldThrow): Deleted.
+ (shouldThrow): Deleted.
+ * modules/namespace-error.js:
+ (from.string_appeared_here.shouldThrow): Deleted.
+
2018-09-07 Mark Lam <[email protected]>
Ensure that handleIntrinsicCall() is only applied on op_call shaped instructions.
Modified: trunk/JSTests/modules/different-view.js (235830 => 235831)
--- trunk/JSTests/modules/different-view.js 2018-09-08 20:19:22 UTC (rev 235830)
+++ trunk/JSTests/modules/different-view.js 2018-09-08 20:51:22 UTC (rev 235831)
@@ -1,7 +1,5 @@
-import { shouldBe, shouldThrow } from "./resources/assert.js"
+import { shouldBe } from "./resources/assert.js"
-shouldThrow(() => {
- loadModule('./different-view/main.js');
-}, `SyntaxError: Importing binding name 'A' cannot be resolved due to ambiguous multiple bindings.`);
-
-
+import('./different-view/main.js').then($vm.abort, function (error) {
+ shouldBe(String(error), `SyntaxError: Importing binding name 'A' cannot be resolved due to ambiguous multiple bindings.`);
+}).catch($vm.abort);
Modified: trunk/JSTests/modules/fallback-ambiguous.js (235830 => 235831)
--- trunk/JSTests/modules/fallback-ambiguous.js 2018-09-08 20:19:22 UTC (rev 235830)
+++ trunk/JSTests/modules/fallback-ambiguous.js 2018-09-08 20:51:22 UTC (rev 235831)
@@ -6,7 +6,8 @@
// | |
// v @
// (B)
-import { shouldThrow } from "./resources/assert.js"
-shouldThrow(() => {
- loadModule("./fallback-ambiguous/main.js");
-}, `SyntaxError: Indirectly exported binding name 'A' cannot be resolved due to ambiguous multiple bindings.`);
+import { shouldBe } from "./resources/assert.js"
+
+import('./fallback-ambiguous/main.js').then($vm.abort, function (error) {
+ shouldBe(String(error), `SyntaxError: Indirectly exported binding name 'A' cannot be resolved due to ambiguous multiple bindings.`);
+}).catch($vm.abort);
Modified: trunk/JSTests/modules/import-error.js (235830 => 235831)
--- trunk/JSTests/modules/import-error.js 2018-09-08 20:19:22 UTC (rev 235830)
+++ trunk/JSTests/modules/import-error.js 2018-09-08 20:51:22 UTC (rev 235831)
@@ -1,13 +1,16 @@
-import { shouldBe, shouldThrow } from "./resources/assert.js"
+import { shouldBe } from "./resources/assert.js"
-shouldThrow(() => {
- loadModule('./import-error/import-not-found.js');
-}, `SyntaxError: Importing binding name 'B' is not found.`);
-
-shouldThrow(() => {
- loadModule('./import-error/import-ambiguous.js');
-}, `SyntaxError: Importing binding name 'B' cannot be resolved due to ambiguous multiple bindings.`);
-
-shouldThrow(() => {
- loadModule('./import-error/import-default-from-star.js');
-}, `SyntaxError: Importing binding name 'default' cannot be resolved by star export entries.`);
+Promise.all([
+ import('./import-error/import-not-found.js')
+ .then($vm.abort, function (error) {
+ shouldBe(String(error), `SyntaxError: Importing binding name 'B' is not found.`);
+ }).catch($vm.abort),
+ import('./import-error/import-ambiguous.js')
+ .then($vm.abort, function (error) {
+ shouldBe(String(error), `SyntaxError: Importing binding name 'B' cannot be resolved due to ambiguous multiple bindings.`);
+ }).catch($vm.abort),
+ import('./import-error/import-default-from-star.js')
+ .then($vm.abort, function (error) {
+ shouldBe(String(error), `SyntaxError: Importing binding name 'default' cannot be resolved by star export entries.`);
+ }).catch($vm.abort),
+]).catch($vm.abort);
Modified: trunk/JSTests/modules/indirect-export-error.js (235830 => 235831)
--- trunk/JSTests/modules/indirect-export-error.js 2018-09-08 20:19:22 UTC (rev 235830)
+++ trunk/JSTests/modules/indirect-export-error.js 2018-09-08 20:51:22 UTC (rev 235831)
@@ -1,13 +1,17 @@
-import { shouldBe, shouldThrow } from "./resources/assert.js"
+import { shouldBe } from "./resources/assert.js"
-shouldThrow(() => {
- loadModule('./indirect-export-error/indirect-export-not-found.js');
-}, `SyntaxError: Indirectly exported binding name 'B' is not found.`);
-shouldThrow(() => {
- loadModule('./indirect-export-error/indirect-export-ambiguous.js');
-}, `SyntaxError: Indirectly exported binding name 'B' cannot be resolved due to ambiguous multiple bindings.`);
-
-shouldThrow(() => {
- loadModule('./indirect-export-error/indirect-export-default.js');
-}, `SyntaxError: Indirectly exported binding name 'default' cannot be resolved by star export entries.`);
+Promise.all([
+ import('./indirect-export-error/indirect-export-not-found.js')
+ .then($vm.abort, function (error) {
+ shouldBe(String(error), `SyntaxError: Indirectly exported binding name 'B' is not found.`);
+ }).catch($vm.abort),
+ import('./indirect-export-error/indirect-export-ambiguous.js')
+ .then($vm.abort, function (error) {
+ shouldBe(String(error), `SyntaxError: Indirectly exported binding name 'B' cannot be resolved due to ambiguous multiple bindings.`);
+ }).catch($vm.abort),
+ import('./indirect-export-error/indirect-export-default.js')
+ .then($vm.abort, function (error) {
+ shouldBe(String(error), `SyntaxError: Indirectly exported binding name 'default' cannot be resolved by star export entries.`);
+ }).catch($vm.abort),
+]).catch($vm.abort);
Modified: trunk/JSTests/modules/namespace-error.js (235830 => 235831)
--- trunk/JSTests/modules/namespace-error.js 2018-09-08 20:19:22 UTC (rev 235830)
+++ trunk/JSTests/modules/namespace-error.js 2018-09-08 20:51:22 UTC (rev 235831)
@@ -1,5 +1,5 @@
-import { shouldThrow } from "./resources/assert.js"
+import { shouldBe } from "./resources/assert.js"
-shouldThrow(() => {
- loadModule('./namespace-error/namespace-local-error-should-hide-global-ambiguity.js');
-}, `SyntaxError: Indirectly exported binding name 'default' cannot be resolved by star export entries.`);
+import('./namespace-error/namespace-local-error-should-hide-global-ambiguity.js').then($vm.abort, function (error) {
+ shouldBe(String(error), `SyntaxError: Indirectly exported binding name 'default' cannot be resolved by star export entries.`);
+}).catch($vm.abort);
Modified: trunk/Source/_javascript_Core/ChangeLog (235830 => 235831)
--- trunk/Source/_javascript_Core/ChangeLog 2018-09-08 20:19:22 UTC (rev 235830)
+++ trunk/Source/_javascript_Core/ChangeLog 2018-09-08 20:51:22 UTC (rev 235831)
@@ -1,3 +1,16 @@
+2018-09-08 Yusuke Suzuki <[email protected]>
+
+ [JSC] Remove loadModule function in jsc.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=184808
+
+ Reviewed by Darin Adler.
+
+ Since we have `import`, we do not need to have `loadModule` function for testing purpose.
+
+ * jsc.cpp:
+ (GlobalObject::finishCreation):
+ (functionLoadModule): Deleted.
+
2018-09-07 Mark Lam <[email protected]>
Ensure that handleIntrinsicCall() is only applied on op_call shaped instructions.
Modified: trunk/Source/_javascript_Core/jsc.cpp (235830 => 235831)
--- trunk/Source/_javascript_Core/jsc.cpp 2018-09-08 20:19:22 UTC (rev 235830)
+++ trunk/Source/_javascript_Core/jsc.cpp 2018-09-08 20:51:22 UTC (rev 235831)
@@ -300,7 +300,6 @@
static EncodedJSValue JSC_HOST_CALL functionDumpTypesForAllVariables(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionDrainMicrotasks(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionIs32BitPlatform(ExecState*);
-static EncodedJSValue JSC_HOST_CALL functionLoadModule(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionCheckModuleSyntax(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionPlatformSupportsSamplingProfiler(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionGenerateHeapSnapshot(ExecState*);
@@ -538,7 +537,6 @@
addFunction(vm, "is32BitPlatform", functionIs32BitPlatform, 0);
- addFunction(vm, "loadModule", functionLoadModule, 1);
addFunction(vm, "checkModuleSyntax", functionCheckModuleSyntax, 1);
addFunction(vm, "platformSupportsSamplingProfiler", functionPlatformSupportsSamplingProfiler, 0);
@@ -1964,34 +1962,6 @@
#endif
}
-EncodedJSValue JSC_HOST_CALL functionLoadModule(ExecState* exec)
-{
- VM& vm = exec->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- String fileName = exec->argument(0).toWTFString(exec);
- RETURN_IF_EXCEPTION(scope, encodedJSValue());
- Vector<char> script;
- if (!fetchScriptFromLocalFileSystem(fileName, script))
- return JSValue::encode(throwException(exec, scope, createError(exec, "Could not open file."_s)));
-
- JSInternalPromise* promise = loadAndEvaluateModule(exec, fileName, jsUndefined(), jsUndefined());
- RETURN_IF_EXCEPTION(scope, encodedJSValue());
-
- JSValue error;
- JSFunction* errorHandler = JSNativeStdFunction::create(vm, exec->lexicalGlobalObject(), 1, String(), [&](ExecState* exec) {
- error = exec->argument(0);
- return JSValue::encode(jsUndefined());
- });
-
- promise->then(exec, nullptr, errorHandler);
- RETURN_IF_EXCEPTION(scope, encodedJSValue());
- vm.drainMicrotasks();
- if (error)
- return JSValue::encode(throwException(exec, scope, error));
- return JSValue::encode(jsUndefined());
-}
-
EncodedJSValue JSC_HOST_CALL functionCreateGlobalObject(ExecState* exec)
{
VM& vm = exec->vm();