mirror of https://github.com/tc39/test262.git
[source-phase-imports] Dynamic import source call
Add source phase import support in import calls with necessary embedder APIs. When a imported module does not support source phase representation, a ReferenceError is thrown in d8. Bug: 42204365 Change-Id: If40cadfcdf0a547f24d20c67149bba559480341d Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5878343 Commit-Queue: Chengzhong Wu (legendecas) <legendecas@gmail.com> Reviewed-by: Shu-yu Guo <syg@chromium.org> Cr-Commit-Position: refs/heads/main@{#96473}
This commit is contained in:
parent
6c967a8bbb
commit
0596ff6981
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2024 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
GetModuleSource of SourceTextModule throws a ReferenceError.
|
||||
esid: sec-source-text-module-record-getmodulesource
|
||||
features: [source-phase-imports]
|
||||
flags: [async]
|
||||
includes: [asyncHelpers.js]
|
||||
---*/
|
||||
|
||||
asyncTest(async function () {
|
||||
await assert.throwsAsync(
|
||||
ReferenceError,
|
||||
() => import.source('./modules-simple_FIXTURE.js'),
|
||||
"Promise should be rejected with ReferenceError");
|
||||
|
||||
// Import a module that has a source phase import.
|
||||
await assert.throwsAsync(
|
||||
ReferenceError,
|
||||
() => import('./modules-import-source_FIXTURE.js'),
|
||||
"Promise should be rejected with ReferenceError in indirect import source");
|
||||
});
|
|
@ -0,0 +1,5 @@
|
|||
// Copyright 2024 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import source x from './modules-simple_FIXTURE.js';
|
|
@ -0,0 +1,6 @@
|
|||
// Copyright 2024 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Just a module file that does nothing.
|
||||
export const x = 42;
|
Loading…
Reference in New Issue