Skip to content

Commit

Permalink
[JSC] Enable import-attributes
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=260238
rdar://113940597

Reviewed by Mark Lam.

This patch updates import-attributes from import-assertions and enable it.
Currently, this is kind of aligned to existing import-assertions implementation,
replacing "assert" with "with".

* JSTests/modules/import-attributes-empty.js: Added.
* JSTests/modules/import-attributes-trailing.js: Added.
* JSTests/modules/import-attributes-unsupported.js: Added.
(catch):
(shouldBe.String):
(shouldBe):
* JSTests/modules/resources/import-attributes-unsupported-1.js: Added.
* JSTests/modules/resources/import-attributes-unsupported-2.js: Added.
* JSTests/modules/resources/import-attributes-unsupported-3.js: Added.
* JSTests/modules/resources/x.js: Added.
* JSTests/modules/resources/y.js: Added.
* JSTests/modules/resources/z.js: Added.
* JSTests/stress/modules-syntax-import-assertion-error.js:
* JSTests/stress/modules-syntax-import-assertion.js:
* JSTests/test262/config.yaml:
* JSTests/test262/expectations.yaml:
* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/resources/import-expectations.json:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/charset-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/cors-crossorigin-requests-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/css-module-worker-test-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/import-css-module-dynamic-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/dynamic-import-with-attributes-argument.any-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/dynamic-import-with-attributes-argument.any.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/dynamic-import-with-attributes-argument.any.js: Added.
(promise_test.async test):
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/dynamic-import-with-attributes-argument.any.sharedworker-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/dynamic-import-with-attributes-argument.any.sharedworker.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/dynamic-import-with-attributes-argument.any.worker-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/dynamic-import-with-attributes-argument.any.worker.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/empty-attributes-clause-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/empty-attributes-clause.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/empty-attributes-clause.js: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/empty-type-attribute.js: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/export-hello.js: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/hello.js: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/invalid-type-attribute-error-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/invalid-type-attribute-error.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/invalid-type-attribute.js: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/javascript-type-attribute.js: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/js-type-attribute.js: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/unsupported-attribute-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/unsupported-attribute.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/unsupported-attribute.js: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/w3c-import.log: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/charset-2.html:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/charset-bom.any.js:
(promise_test.async const):
(promise_test):
(promise_test.async test):
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/charset.html:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/credentials-iframe.sub.html:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/crossorigin-import-parse-error-with-cors.sub.html:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/crossorigin-import-with-cors.sub.html:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/crossorigin-import-without-cors.sub.html:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/integrity-matches.js:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/integrity-mismatches.js:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/invalid-content-type-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/invalid-content-type.any.js:
(const.content_type.of.content_types.promise_test.async test):
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/load-error-events.html:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/load-error-events.py:
(main):
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/module.html:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/non-object.any.js:
(string_appeared_here.promise_test.async t):
(promise_test.async t):
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/referrer-policies.sub.html:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/repeated-imports.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/repeated-imports.any.js:
(promise_test.async test):
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/repeated-imports.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/repeated-imports.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/serviceworker-dynamic-import.js:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/serviceworker.js:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/valid-content-type.html:
* Source/JavaScriptCore/API/JSAPIGlobalObject.mm:
(JSC::JSAPIGlobalObject::moduleLoaderImportModule):
* Source/JavaScriptCore/jsc.cpp:
(GlobalObject::moduleLoaderImportModule):
(GlobalObject::moduleLoaderFetch):
* Source/JavaScriptCore/parser/ASTBuilder.h:
(JSC::ASTBuilder::createImportAttributesList):
(JSC::ASTBuilder::appendImportAttribute):
(JSC::ASTBuilder::createImportDeclaration):
(JSC::ASTBuilder::createExportAllDeclaration):
(JSC::ASTBuilder::createExportNamedDeclaration):
(JSC::ASTBuilder::createImportAssertionList): Deleted.
(JSC::ASTBuilder::appendImportAssertion): Deleted.
* Source/JavaScriptCore/parser/ModuleAnalyzer.cpp:
(JSC::ModuleAnalyzer::appendRequestedModule):
(JSC::ModuleAnalyzer::analyze):
* Source/JavaScriptCore/parser/ModuleAnalyzer.h:
(JSC::ModuleAnalyzer::fail):
* Source/JavaScriptCore/parser/NodeConstructors.h:
(JSC::ImportDeclarationNode::ImportDeclarationNode):
(JSC::ExportAllDeclarationNode::ExportAllDeclarationNode):
(JSC::ExportNamedDeclarationNode::ExportNamedDeclarationNode):
* Source/JavaScriptCore/parser/Nodes.h:
* Source/JavaScriptCore/parser/NodesAnalyzeModule.cpp:
(JSC::tryCreateAttributes):
(JSC::ImportDeclarationNode::analyzeModule):
(JSC::ExportAllDeclarationNode::analyzeModule):
(JSC::ExportNamedDeclarationNode::analyzeModule):
(JSC::tryCreateAssertion): Deleted.
* Source/JavaScriptCore/parser/Parser.cpp:
(JSC::Parser<LexerType>::parseImportAttributes):
(JSC::Parser<LexerType>::parseImportDeclaration):
(JSC::Parser<LexerType>::parseExportDeclaration):
(JSC::Parser<LexerType>::parseImportAssertions): Deleted.
* Source/JavaScriptCore/parser/Parser.h:
* Source/JavaScriptCore/parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createImportAttributesList):
(JSC::SyntaxChecker::appendImportAssertion):
(JSC::SyntaxChecker::createImportDeclaration):
(JSC::SyntaxChecker::createExportAllDeclaration):
(JSC::SyntaxChecker::createExportNamedDeclaration):
(JSC::SyntaxChecker::createImportAssertionList): Deleted.
* Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp:
(JSC::AbstractModuleRecord::appendRequestedModule):
(JSC::AbstractModuleRecord::dump):
* Source/JavaScriptCore/runtime/AbstractModuleRecord.h:
* Source/JavaScriptCore/runtime/Completion.cpp:
(JSC::retrieveImportAttributesFromDynamicImportOptions):
(JSC::retrieveTypeImportAttribute):
(JSC::retrieveAssertionsFromDynamicImportOptions): Deleted.
(JSC::retrieveTypeAssertion): Deleted.
* Source/JavaScriptCore/runtime/Completion.h:
* Source/JavaScriptCore/runtime/JSModuleLoader.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/OptionsList.h:
* Source/WebCore/bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::importModule):

Canonical link: https://commits.webkit.org/266957@main
  • Loading branch information
Constellation committed Aug 16, 2023
1 parent 943a874 commit 587c5d4
Show file tree
Hide file tree
Showing 88 changed files with 537 additions and 244 deletions.
4 changes: 4 additions & 0 deletions JSTests/modules/import-attributes-empty.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//@ requireOptions("--useImportAttributes=1")
import x from './resources/x.js' with {};
import './resources/y.js' with {};
export * from './resources/z.js' with {};
5 changes: 5 additions & 0 deletions JSTests/modules/import-attributes-trailing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//@ requireOptions("--useImportAttributes=1")

import { shouldBe } from "./resources/assert.js";
import x from './resources/x.json' with { type: "json", };
shouldBe(JSON.stringify(x), `["x"]`);
30 changes: 30 additions & 0 deletions JSTests/modules/import-attributes-unsupported.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//@ requireOptions("--useImportAttributes=1")
import { shouldBe } from "./resources/assert.js";

{
let error = null;
try {
await import("./resources/import-attributes-unsupported-1.js");
} catch (e) {
error = e;
}
shouldBe(String(error), `SyntaxError: Unexpected keyword 'true'. Expected an attribute value.`);
}
{
let error = null;
try {
await import("./resources/import-attributes-unsupported-2.js");
} catch (e) {
error = e;
}
shouldBe(String(error), `SyntaxError: Import attribute "unsupported" is not supported`);
}
{
let error = null;
try {
await import("./resources/import-attributes-unsupported-3.js");
} catch (e) {
error = e;
}
shouldBe(String(error), `SyntaxError: Unexpected number '42'. Expected an attribute key.`);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "./x.js" with { type: true };
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "./x.js" with { unsupported: "json" };
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "./x.js" with { 42: "json" };
2 changes: 2 additions & 0 deletions JSTests/modules/resources/x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
let x = 'x';
export default x;
1 change: 1 addition & 0 deletions JSTests/modules/resources/x.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ "x" ]
1 change: 1 addition & 0 deletions JSTests/modules/resources/y.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export let y = 'y';
1 change: 1 addition & 0 deletions JSTests/modules/resources/z.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export let z = 'z';
2 changes: 1 addition & 1 deletion JSTests/stress/invalid-import-assertion.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import("./resources/empty.js", { assert: { type: "<invalid>" } }).then($vm.abort, function () {});
import("./resources/empty.js", { with: { type: "<invalid>" } }).then($vm.abort, function () {});
2 changes: 1 addition & 1 deletion JSTests/stress/modules-syntax-import-assertion-error.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@requireOptions("--useImportAssertion=true")
//@requireOptions("--useImportAttributes=true")

function shouldThrow(func, errorMessage) {
var errorThrown = false;
Expand Down
11 changes: 5 additions & 6 deletions JSTests/stress/modules-syntax-import-assertion.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@requireOptions("--useImportAssertion=true")
//@requireOptions("--useImportAttributes=true")

var list = [
String.raw`import v from "mod"`,
Expand Down Expand Up @@ -33,9 +33,8 @@ var list = [
];

for (let entry of list) {
checkModuleSyntax(entry + ` assert { }`);
checkModuleSyntax(entry + ` assert { type: "json" }`);
checkModuleSyntax(entry + ` assert { "type": "json" }`);
checkModuleSyntax(entry + ` assert { "type": "json", }`);
checkModuleSyntax(entry + ` assert { type: "json", hello: "world" }`);
checkModuleSyntax(entry + ` with { }`);
checkModuleSyntax(entry + ` with { type: "json" }`);
checkModuleSyntax(entry + ` with { "type": "json" }`);
checkModuleSyntax(entry + ` with { "type": "json", }`);
}
4 changes: 2 additions & 2 deletions JSTests/test262/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ flags:
Temporal: useTemporal
array-grouping: useArrayGroupMethod
ShadowRealm: useShadowRealm
import-assertions: useImportAssertion
json-modules: useImportAssertion
resizable-arraybuffer: useArrayBufferTransfer
import-assertions: useImportAttributes
json-modules: useImportAttributes
skip:
features:
- callable-boundary-realms
Expand Down
56 changes: 56 additions & 0 deletions JSTests/test262/expectations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2092,6 +2092,24 @@ test/language/expressions/dynamic-import/catch/nested-async-gen-return-await-eva
test/language/expressions/dynamic-import/for-await-resolution-and-error-agen-yield.js:
default: 'Test262:AsyncTestFailure:Test262Error: Test262Error: f Expected SameValue(«null», «foo») to be true'
strict mode: 'Test262:AsyncTestFailure:Test262Error: Test262Error: f Expected SameValue(«null», «foo») to be true'
test/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-abrupt.js:
default: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Expected promise to be rejected, but promise was fulfilled.'
strict mode: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Expected promise to be rejected, but promise was fulfilled.'
test/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration.js:
default: 'Test262Error: Expected SameValue(«0», «2») to be true'
strict mode: 'Test262Error: Expected SameValue(«0», «2») to be true'
test/language/expressions/dynamic-import/import-assertions/2nd-param-assert-non-object.js:
default: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Promise for null was not rejected.'
strict mode: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Promise for null was not rejected.'
test/language/expressions/dynamic-import/import-assertions/2nd-param-assert-value-abrupt.js:
default: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Expected promise to be rejected, but it was fulfilled'
strict mode: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Expected promise to be rejected, but it was fulfilled'
test/language/expressions/dynamic-import/import-assertions/2nd-param-assert-value-non-string.js:
default: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Promise for undefined was not rejected.'
strict mode: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Promise for undefined was not rejected.'
test/language/expressions/dynamic-import/import-assertions/2nd-param-get-assert-error.js:
default: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Expected an error, but observed no error'
strict mode: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Expected an error, but observed no error'
test/language/expressions/function/scope-param-rest-elem-var-open.js:
default: 'Test262Error: Expected SameValue(«outside», «inside») to be true'
test/language/expressions/generators/generator-created-after-decl-inst.js:
Expand Down Expand Up @@ -2186,6 +2204,26 @@ test/language/identifiers/start-unicode-8.0.0-class.js:
test/language/identifiers/start-unicode-9.0.0-class.js:
default: "SyntaxError: Invalid character: '#'"
strict mode: "SyntaxError: Invalid character: '#'"
test/language/import/import-assertions/json-extensibility-array.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/import/import-assertions/json-extensibility-object.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/import/import-assertions/json-idempotency.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/import/import-assertions/json-value-array.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/import/import-assertions/json-value-boolean.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/import/import-assertions/json-value-null.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/import/import-assertions/json-value-number.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/import/import-assertions/json-value-object.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/import/import-assertions/json-value-string.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/import/import-assertions/json-via-namespace.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/literals/regexp/u-astral-char-class-invert.js:
default: 'Test262Error: Expected SameValue(«�», «null») to be true'
strict mode: 'Test262Error: Expected SameValue(«�», «null») to be true'
Expand All @@ -2199,6 +2237,24 @@ test/language/module-code/early-dup-top-function.js:
module: 'Test262: This statement should not be evaluated.'
test/language/module-code/import-assertions/eval-gtbndng-indirect-faux-assertion.js:
raw: "SyntaxError: Unexpected identifier 'x'. import call expects one or two arguments."
test/language/module-code/import-assertions/import-assertion-empty.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/module-code/import-assertions/import-assertion-key-identifiername.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/module-code/import-assertions/import-assertion-key-string-double.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/module-code/import-assertions/import-assertion-key-string-single.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/module-code/import-assertions/import-assertion-many.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/module-code/import-assertions/import-assertion-newlines.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/module-code/import-assertions/import-assertion-trlng-comma.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/module-code/import-assertions/import-assertion-value-string-double.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/module-code/import-assertions/import-assertion-value-string-single.js:
module: "SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration."
test/language/module-code/parse-err-hoist-lex-fun.js:
module: 'Test262: This statement should not be evaluated.'
test/language/module-code/parse-err-hoist-lex-gen.js:
Expand Down
13 changes: 7 additions & 6 deletions LayoutTests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,9 @@ imported/w3c/web-platform-tests/html/browsers/history/the-history-interface/comb
imported/w3c/web-platform-tests/html/cross-origin-opener-policy/tentative/restrict-properties/iframe-popup-to-un.https.html [ Failure Pass ]
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/058.html [ Failure Pass ]
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/repeated-imports.any.sharedworker.html [ Failure Pass ]
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/dynamic-import-with-attributes-argument.any.html [ Failure Pass ]
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/dynamic-import-with-attributes-argument.any.worker.html [ Failure Pass ]
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes/dynamic-import-with-attributes-argument.any.sharedworker.html [ Failure Pass ]
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/microtasks/evaluation-order-1.html [ Failure Pass ]
imported/w3c/web-platform-tests/html/rendering/widgets/baseline-alignment-and-overflow.tentative.html [ Failure Pass ]
imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-pointer-remove-source.html [ Failure Pass ]
Expand Down Expand Up @@ -6261,12 +6264,7 @@ imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/cs
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-assertions/empty-assertion-clause.html [ Skip ]
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-assertions/invalid-type-assertion-error.html [ Skip ]
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-assertions/unsupported-assertion.html [ Skip ]
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/charset.html [ Skip ]
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/integrity.html [ Skip ]
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/json-module-service-worker-test.https.html [ Skip ]
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/load-error-events.html [ Skip ]
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/module.html [ Skip ]
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/valid-content-type.html [ Skip ]
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/integrity.html [ Pass Failure ]

webkit.org/b/252183 imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-overflowing-float-margins-tirmmed-at-final-position-block-layout.html [ ImageOnlyFailure ]
webkit.org/b/253055 imported/w3c/web-platform-tests/css/css-box/margin-trim/block-container-floats-adjacent-to-containing-block-should-be-trimmed-only.html [ ImageOnlyFailure ]
Expand Down Expand Up @@ -6556,3 +6554,6 @@ imported/w3c/web-platform-tests/html/canvas/offscreen/fill-and-stroke-styles/2d.
webkit.org/b/225349 imported/w3c/web-platform-tests/html/canvas/element/reset/2d.reset.state.clip.html [ ImageOnlyFailure ]
webkit.org/b/225349 imported/w3c/web-platform-tests/html/canvas/offscreen/reset/2d.reset.state.clip.html [ ImageOnlyFailure ]
webkit.org/b/225349 imported/w3c/web-platform-tests/html/canvas/offscreen/reset/2d.reset.state.clip.w.html [ Timeout ]

# We only support import-attributes and do not support import-assertions.
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/import-assertions
5 changes: 5 additions & 0 deletions LayoutTests/imported/w3c/resources/import-expectations.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,12 @@
"web-platform-tests/html/semantics/links/following-hyperlinks": "skip",
"web-platform-tests/html/semantics/links/links-created-by-a-and-area-elements": "skip",
"web-platform-tests/html/semantics/popovers": "import",
"web-platform-tests/html/semantics/scripting-1/the-script-element/css-module-assertions": "skip",
"web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing": "skip",
"web-platform-tests/html/semantics/scripting-1/the-script-element/import-assertions": "skip",
"web-platform-tests/html/semantics/scripting-1/the-script-element/import-attributes": "import",
"web-platform-tests/html/semantics/scripting-1/the-script-element/json-module": "import",
"web-platform-tests/html/semantics/scripting-1/the-script-element/json-module-assertions": "skip",
"web-platform-tests/html/semantics/scripting-1/the-script-element/module": "import",
"web-platform-tests/html/semantics/scripting-1/the-script-element/script-for-event.xhtml": "skip",
"web-platform-tests/html/semantics/scripting-1/the-script-element/script-text.xhtml": "skip",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
CONSOLE MESSAGE: TypeError: 'text/css' is not a valid JavaScript MIME type.
CONSOLE MESSAGE: ReferenceError: Can't find variable: unreachable
CONSOLE MESSAGE: TypeError: 'text/css' is not a valid JavaScript MIME type.
CONSOLE MESSAGE: ReferenceError: Can't find variable: unreachable
CONSOLE MESSAGE: SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration.
CONSOLE MESSAGE: SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration.
CONSOLE MESSAGE: SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration.
CONSOLE MESSAGE: SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration.
CONSOLE MESSAGE: SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration.

Harness Error (FAIL), message = ReferenceError: Can't find variable: unreachable
Harness Error (FAIL), message = SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration.


Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Blocked access to external URL http://www2.localhost:8800/html/semantics/scripting-1/the-script-element/css-module/resources/basic.css?pipe=header(Access-Control-Allow-Origin,*)
Blocked access to external URL http://www2.localhost:8800/html/semantics/scripting-1/the-script-element/css-module/resources/parse-error.css?pipe=header(Access-Control-Allow-Origin,*)
Blocked access to external URL http://www2.localhost:8800/html/semantics/scripting-1/the-script-element/css-module/resources/basic.css
CONSOLE MESSAGE: SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration.
CONSOLE MESSAGE: SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration.
CONSOLE MESSAGE: SyntaxError: Unexpected identifier 'assert'. Expected a ';' following a targeted import declaration.
css-module-crossorigin



FAIL Imported CSS module, cross-origin with CORS assert_equals: Unexpected _log value expected "imported CSS: #test { background-color: rgb(255, 0, 0); }" but got ""
PASS Imported CSS module, cross-origin, missing CORS ACAO header
FAIL Imported CSS module with parse error, cross-origin, with CORS assert_equals: Unexpected _log value expected "imported CSS rules count: 0" but got ""
FAIL Imported CSS module, cross-origin with CORS assert_equals: Unexpected _log value expected "imported CSS: #test { background-color: rgb(255, 0, 0); }" but got "10-0"
FAIL Imported CSS module, cross-origin, missing CORS ACAO header assert_equals: Unexpected _log value expected "error" but got "10-0"
FAIL Imported CSS module with parse error, cross-origin, with CORS assert_equals: Unexpected _log value expected "imported CSS rules count: 0" but got "10-0"

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

FAIL A static import CSS Module within a web worker should not load and should not attempt to fetch the module. assert_equals: Shouldn't have tried fetching CSS module in worker expected 0 but got 1
PASS A static import CSS Module within a web worker should not load and should not attempt to fetch the module.
FAIL A dynamic import CSS Module within a web worker should not load and should not attempt to fetch the module. assert_equals: Shouldn't have tried fetching CSS module in worker expected 0 but got 1
PASS An attempt to load a CSS module as a worker should fail.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

FAIL Load a CSS module with dynamic import() promise_test: Unhandled rejection with value: object "TypeError: Import assertion type "css" is not valid"
FAIL Load a CSS module with dynamic import() promise_test: Unhandled rejection with value: object "TypeError: 'text/css' is not a valid JavaScript MIME type."
PASS Ensure that loading a CSS module with dymnamic import() fails without a type assertion

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

PASS Dynamic import with an empty with clause should succeed
PASS Dynamic import with an unsupported import attribute should fail
FAIL Dynamic import with an unsupported type attribute should fail assert_unreached: Should have rejected: Dynamic import with an unsupported type attribute should fail Reached unreachable code

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- This file is required for WebKit test infrastructure to run the templated test -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// META: global=window,dedicatedworker,sharedworker

promise_test(async test => {
const result = await import("./export-hello.js", { with: { } });
assert_equals(result.default, "hello");
}, "Dynamic import with an empty with clause should succeed");

promise_test(async test => {
return promise_rejects_js(test, TypeError,
import("./export-hello.js", { with: { unsupportedAssertionKey: "unsupportedAssertionValue"} }),
"Dynamic import with an unsupported import attribute should fail");
}, "Dynamic import with an unsupported import attribute should fail");

promise_test(test => {
return promise_rejects_js(test, TypeError,
import("./export-hello.js", { assert: { type: "notARealType"} } ),
"Dynamic import with an unsupported type attribute should fail");
}, "Dynamic import with an unsupported type attribute should fail");

0 comments on commit 587c5d4

Please sign in to comment.