Skip to content

Implement CSS module scripts - #72110

Closed
tuankiet65 wants to merge 1 commit into
WebKit:mainfrom
tuankiet65:eng/Implement-CSS-module-scripts
Closed

tuankiet65 wants to merge 1 commit into
WebKit:mainfrom
tuankiet65:eng/Implement-CSS-module-scripts

Conversation

@tuankiet65

@tuankiet65 tuankiet65 commented Aug 21, 2026 •

Copy link
Copy Markdown
Member

28638cf

Implement CSS module scripts
rdar://80917329
https://bugs.webkit.org/show_bug.cgi?id=227967

Reviewed by NOBODY (OOPS!).

Explanation of why this fixes the bug (OOPS!).

No new tests (OOPS!).

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/content-security-policy/style-src/import-style-allowed.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/content-security-policy/style-src/import-style-blocked.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-style-element/tentative/style-element-basic-import-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-style-element/tentative/style-element-fixed-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/charset-2-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/charset-bom-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/charset-bom.html:
* 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/content-type-checking-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/content-type-checking.html:
* 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/credentials.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/css-module-parse-error-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/import-css-module-basic-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/css-module/integrity-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/load-error-events-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/redirect-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/referrer-policies.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/relative-urls-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/repeated-import-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/should-not-be-loaded.js: Added.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/tentative/shadowrootadoptedstylesheets/shadowrootadoptedstylesheets-fetched-module-expected.txt:
* Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::scriptTypeForScript):
* Source/JavaScriptCore/jsc.cpp:
(GlobalObject::moduleLoaderFetch):
* Source/JavaScriptCore/parser/NodesAnalyzeModule.cpp:
(JSC::tryCreateAttributes):
* Source/JavaScriptCore/parser/SourceProvider.h:
(JSC::SourceProvider::isModuleType const):
* Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp:
(JSC::AbstractModuleRecord::moduleType const):
* Source/JavaScriptCore/runtime/Completion.cpp:
(JSC::getSourceType):
(JSC::retrieveTypeImportAttribute):
* Source/JavaScriptCore/runtime/JSMicrotask.cpp:
(JSC::moduleRegistryFetchSettled):
(JSC::moduleLoadTopSettled):
* Source/JavaScriptCore/runtime/JSModuleLoader.cpp:
(JSC::JSModuleLoader::provideFetch):
(JSC::JSModuleLoader::makeModule):
(JSC::JSModuleLoader::hostLoadImportedModule):
* Source/JavaScriptCore/runtime/JSModuleLoader.h:
* Source/JavaScriptCore/runtime/ModuleRegistryEntry.cpp:
(JSC::ModuleRegistryEntry::provideFetch):
* Source/JavaScriptCore/runtime/ModuleRegistryEntry.h:
* Source/JavaScriptCore/runtime/ScriptFetchParameters.h:
(JSC::ScriptFetchParameters::parseType):
* Source/JavaScriptCore/runtime/SyntheticModuleRecord.h:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/bindings/js/CachedModuleScriptLoader.cpp:
(WebCore::CachedModuleScriptLoader::load):
(WebCore::CachedModuleScriptLoader::notifyFinished):
(WebCore::CachedModuleScriptLoader::setCSSStyleSheet):
(WebCore::CachedModuleScriptLoader::notifyFinishedInternal):
* Source/WebCore/bindings/js/CachedModuleScriptLoader.h:
* Source/WebCore/bindings/js/CachedScriptFetcher.cpp:
(WebCore::CachedScriptFetcher::requestResourceWithCache const):
* Source/WebCore/bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::moduleTypeCanBeLoaded):
* Source/WebCore/bindings/js/JSDOMGlobalObject.h:
* Source/WebCore/bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::globalObjectMethodTable):
* Source/WebCore/bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::importModule):
(WebCore::createCSSModule):
(WebCore::ScriptModuleLoader::notifyFinished):
* Source/WebCore/bindings/js/ScriptModuleLoader.h:
* Source/WebCore/bindings/js/WorkerModuleScriptLoader.cpp:
(WebCore::WorkerModuleScriptLoader::load):
* Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp:
(WebCore::CachedCSSStyleSheet::sheetText const):
* Source/WebCore/loader/cache/CachedCSSStyleSheet.h:
* Tools/Scripts/webkitpy/style/checkers/cpp.py:

28638cf

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe 💥 🛠 win ⏳ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ❌ 🧪 wpe-wk2 💥 🧪 win-tests ⏳ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ⏳ 🛠 vision-apple
✅ 🧪 webkitpy ✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🧪 jsc-wpe
✅ 🧪 jsc-x86-64 ✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk3-gcc
✅ 🛠 🧪 jsc-debug-arm64 ✅ 🛠 ios-safer-cpp ✅ 🧪 mac-AS-debug-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-wk2-stress ❌ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-intel-wk2 ✅ 🧪 api-gtk
✅ 🧪 vision-wk2 ✅ 🛠 mac-safer-cpp ✅ 🛠 playstation
✅ 🛠 tv ✅ 🧪 mac-site-isolation
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@tuankiet65 tuankiet65 added the CSS Cascading Style Sheets implementation label Aug 21, 2026
.disabled = false
};
auto sheetOrException= CSSStyleSheet::create(*document, WTF::move(sheetInit));
RETURN_IF_EXCEPTION(throwScope, jsUndefined());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can CSSStyleSheet::create() really throw a JS exception? I doubt it.

auto sheet = sheetOrException.releaseReturnValue();
// FIXME: exception here should bubble up to script's parse error
auto maybeException = sheet->replaceSync(source.toStringWithoutCopying());
RETURN_IF_EXCEPTION(throwScope, jsUndefined());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can replaceSync() really throw a JS exception? I doubt it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, I suspect ignoring the exception potentially returned by replaceSync() and stored in maybeException is likely not good.

@@ -108,7 +108,10 @@ void WorkerModuleScriptLoader::load(ScriptExecutionContext& context, URL&& sourc
}
}

if (cspCheckFailed) {
// Workers and worklets are forbid from fetching CSS modules.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forbid -> forbidden

@@ -79,6 +79,7 @@ const GlobalObjectMethodTable* JSWorkerGlobalScopeBase::globalObjectMethodTable(
codeForEval,
canCompileStrings,
trustedScriptStructure,
nullptr // createCSSStyleSheetFromSourceScript, not available in Worker.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean createCSSStyleSheetFromSource ?

@@ -71,6 +71,7 @@ const GlobalObjectMethodTable* JSWorkletGlobalScopeBase::globalObjectMethodTable
codeForEval,
canCompileStrings,
trustedScriptStructure,
nullptr // createCSSStyleSheetFromSourceScript, not available in Worklet.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean createCSSStyleSheetFromSource ?

@@ -97,6 +98,7 @@ class SourceProvider : public ThreadSafeRefCounted<SourceProvider> {
case SourceProviderSourceType::Module:
case SourceProviderSourceType::JSON:
case SourceProviderSourceType::Text:
case SourceProviderSourceType::CSS:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious what JSC people such as @Constellation think about using a WebCore concept (CSS) in JSC code. In the past, they have objected to things like this. However, this may be OK / unavoidable here. Just highlighting it for their attention.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like an “external” type that delegates to WebCore should be achievable.

@Constellation Constellation Aug 27, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The module loader needs this type information as its key in the map is (URL, type) according to the spec. Thus I think it is fine to have them. If we are not in a situation where importing CSS implementation into JSC, I think this is fine 😉

@@ -87,6 +87,7 @@ struct GlobalObjectMethodTable {
String (*codeForEval)(JSGlobalObject*, JSValue);
bool (*canCompileStrings)(JSGlobalObject*, CompilationType, String, const ArgList&);
Structure* (*trustedScriptStructure)(JSGlobalObject*);
JSValue (*createCSSStyleSheetFromSource)(JSGlobalObject*, StringView sourceString);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming JSC reviewers object to having a WebCore concept here (please follow their advice) here are a couple of alternative proposals:

  1. Minimal

Generalize the hook and let WebCore switch on the type:

  // GlobalObjectMethodTable.h
  JSValue (*createSyntheticModuleDefaultExport)(JSGlobalObject*, ScriptFetchParameters::Type, StringView source);

SyntheticModuleRecord::createCSSStyleSheetFromSource becomes createHostDefinedModule(JSGlobalObject*, const Identifier&, SourceCode&&, ScriptFetchParameters::Type), with the CSS comments and the html-spec link moving to JSDOMWindowBase. JSC's null-hook error message becomes generic ("module type is not supported in this environment"). WebCore-side cost: one extra parameter and a switch; the WebCore function keeps its current name, which is fine there.

  1. Larger but cleaner I think?

Let the host build the whole record (I think this is what Blink does with v8::Module::CreateSyntheticModule):

  AbstractModuleRecord* (*createHostDefinedModule)(JSGlobalObject*, const Identifier& moduleKey, const SourceCode&, ScriptFetchParameters::Type);

makeModule gets one delegating case, and SyntheticModuleRecord.cpp needs no change at all.

Cost: tryCreateDefaultExportSyntheticModule is currently private and unexported, so it'd need to become public + JS_EXPORT_PRIVATE.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just pushed a patch that does something different.

The current way is that JSC requests a fetch from WebCore. WebCore fetches then returns the source code to JSC. JSC then parses the returned source code. This works for JS/WASM/JSON/text because those must be handled by JSC, but for CSS modules, it can be handled by WebCore.

I changed it so that when JSC requests a fetch from WebCore, depending on the requested module type, WebCore can either return a source code (for JS/WASM/JSON/text), or a JSValue. Returning a JSValue means WebCore knows how to turn the module into a JSValue, and JSC should just use that as the default module export. In this patch, when the requested module type is CSS, then WebCore turns it in JSCSSStyleSheet before giving it to JSC.

This offers some benefits over the previous approach:

  1. JSC knows less about the CSS modules. All it knows is that CSS modules exist, and the host (WebCore) will deal with it somehow.
  2. No round tripping of CSS source code. In the previous approach, WebCore sends the source code to JSC, then JSC sends it back to WebCore to parse. With the new approach, the source code stays in WebCore
  3. As a consequence of (2), there's no need for a new method in the global object method table

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 21, 2026
@tuankiet65 tuankiet65 removed the merging-blocked Applied to prevent a change from being merged label Aug 23, 2026
@tuankiet65
tuankiet65 force-pushed the eng/Implement-CSS-module-scripts branch from d4027ef to 125a938 Compare August 23, 2026 09:42
@webkit-early-warning-system

Copy link
Copy Markdown
Collaborator

Starting EWS tests for 125a938. Live statuses available at the PR page, #72110

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 23, 2026
@tuankiet65 tuankiet65 removed the merging-blocked Applied to prevent a change from being merged label Aug 23, 2026
@tuankiet65
tuankiet65 force-pushed the eng/Implement-CSS-module-scripts branch from 125a938 to 32d0e5b Compare August 23, 2026 22:16
@webkit-early-warning-system

Copy link
Copy Markdown
Collaborator

Starting EWS tests for 32d0e5b. Live statuses available at the PR page, #72110

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 23, 2026
@tuankiet65 tuankiet65 removed the merging-blocked Applied to prevent a change from being merged label Aug 25, 2026
@tuankiet65
tuankiet65 force-pushed the eng/Implement-CSS-module-scripts branch from 32d0e5b to 6079649 Compare August 25, 2026 06:47
@tuankiet65
tuankiet65 requested a review from rniwa as a code owner August 25, 2026 06:47
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 25, 2026
@tuankiet65 tuankiet65 removed the merging-blocked Applied to prevent a change from being merged label Aug 25, 2026
@tuankiet65
tuankiet65 force-pushed the eng/Implement-CSS-module-scripts branch from 6079649 to 2b9b70d Compare August 25, 2026 20:23
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 25, 2026
@tuankiet65 tuankiet65 removed the merging-blocked Applied to prevent a change from being merged label Aug 26, 2026
@tuankiet65
tuankiet65 force-pushed the eng/Implement-CSS-module-scripts branch from 2b9b70d to 45e0444 Compare August 26, 2026 10:00
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 26, 2026
@tuankiet65 tuankiet65 removed the merging-blocked Applied to prevent a change from being merged label Aug 26, 2026
@tuankiet65
tuankiet65 force-pushed the eng/Implement-CSS-module-scripts branch from 45e0444 to 0ade3f6 Compare August 26, 2026 10:09
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 26, 2026
@webkit-ews-buildbot

Copy link
Copy Markdown
Collaborator

iOS Safer C++ Build #49611 (0ade3f6)

❌ Found 1 failing file with 1 issue. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming.
(cc @rniwa)

@webkit-ews-buildbot

Copy link
Copy Markdown
Collaborator

macOS Safer C++ Build #129607 (0ade3f6)

❌ Found 1 failing file with 1 issue. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming.
(cc @rniwa)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it makes sense to have a fast path here? WDYT about adding a microbenchmark and perf testing that to ensure there is no regression?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can name this in a way that is more flexible?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not too sure if this comment is needed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@nt1m
nt1m requested a review from darinadler August 27, 2026 17:04
@tuankiet65 tuankiet65 removed the merging-blocked Applied to prevent a change from being merged label Sep 23, 2026
@tuankiet65
tuankiet65 force-pushed the eng/Implement-CSS-module-scripts branch from 0ade3f6 to 8e41c06 Compare September 23, 2026 20:45
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 23, 2026
rdar://80917329
https://bugs.webkit.org/show_bug.cgi?id=227967

Reviewed by NOBODY (OOPS!).

Explanation of why this fixes the bug (OOPS!).

No new tests (OOPS!).

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/content-security-policy/style-src/import-style-allowed.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/content-security-policy/style-src/import-style-blocked.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/destination/fetch-destination.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-style-element/tentative/style-element-basic-import-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-style-element/tentative/style-element-fixed-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/charset-2-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/charset-bom-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/charset-bom.html:
* 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/content-type-checking-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/content-type-checking.html:
* 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/credentials.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/css-module-parse-error-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/import-css-module-basic-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/css-module/integrity-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/load-error-events-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/redirect-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/referrer-policies.sub-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/relative-urls-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/repeated-import-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/resources/should-not-be-loaded.js: Added.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/tentative/shadowrootadoptedstylesheets/shadowrootadoptedstylesheets-fetched-module-expected.txt:
* Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::scriptTypeForScript):
* Source/JavaScriptCore/jsc.cpp:
(GlobalObject::moduleLoaderFetch):
* Source/JavaScriptCore/parser/NodesAnalyzeModule.cpp:
(JSC::tryCreateAttributes):
* Source/JavaScriptCore/parser/SourceProvider.h:
(JSC::SourceProvider::isModuleType const):
* Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp:
(JSC::AbstractModuleRecord::moduleType const):
* Source/JavaScriptCore/runtime/Completion.cpp:
(JSC::getSourceType):
(JSC::retrieveTypeImportAttribute):
* Source/JavaScriptCore/runtime/JSMicrotask.cpp:
(JSC::moduleRegistryFetchSettled):
(JSC::moduleLoadTopSettled):
* Source/JavaScriptCore/runtime/JSModuleLoader.cpp:
(JSC::JSModuleLoader::provideFetch):
(JSC::JSModuleLoader::makeModule):
(JSC::JSModuleLoader::hostLoadImportedModule):
* Source/JavaScriptCore/runtime/JSModuleLoader.h:
* Source/JavaScriptCore/runtime/ModuleRegistryEntry.cpp:
(JSC::ModuleRegistryEntry::provideFetch):
* Source/JavaScriptCore/runtime/ModuleRegistryEntry.h:
* Source/JavaScriptCore/runtime/ScriptFetchParameters.h:
(JSC::ScriptFetchParameters::parseType):
* Source/JavaScriptCore/runtime/SyntheticModuleRecord.h:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/bindings/js/CachedModuleScriptLoader.cpp:
(WebCore::CachedModuleScriptLoader::load):
(WebCore::CachedModuleScriptLoader::notifyFinished):
(WebCore::CachedModuleScriptLoader::setCSSStyleSheet):
(WebCore::CachedModuleScriptLoader::notifyFinishedInternal):
* Source/WebCore/bindings/js/CachedModuleScriptLoader.h:
* Source/WebCore/bindings/js/CachedScriptFetcher.cpp:
(WebCore::CachedScriptFetcher::requestResourceWithCache const):
* Source/WebCore/bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::moduleTypeCanBeLoaded):
* Source/WebCore/bindings/js/JSDOMGlobalObject.h:
* Source/WebCore/bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::globalObjectMethodTable):
* Source/WebCore/bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::importModule):
(WebCore::createCSSModule):
(WebCore::ScriptModuleLoader::notifyFinished):
* Source/WebCore/bindings/js/ScriptModuleLoader.h:
* Source/WebCore/bindings/js/WorkerModuleScriptLoader.cpp:
(WebCore::WorkerModuleScriptLoader::load):
* Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp:
(WebCore::CachedCSSStyleSheet::sheetText const):
* Source/WebCore/loader/cache/CachedCSSStyleSheet.h:
* Tools/Scripts/webkitpy/style/checkers/cpp.py:
@tuankiet65 tuankiet65 removed the merging-blocked Applied to prevent a change from being merged label Sep 25, 2026
@tuankiet65
tuankiet65 force-pushed the eng/Implement-CSS-module-scripts branch 2 times, most recently from 8e41c06 to 28638cf Compare September 25, 2026 00:03
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 25, 2026
@tuankiet65 tuankiet65 closed this Sep 25, 2026
@tuankiet65

Copy link
Copy Markdown
Member Author

This patch initially started out as a rough proof-of-concept. Since then I've iterated on it more and splitted it into multiple pieces for upstreaming. The last piece to enable CSS module scripts is here: #74961

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CSS Cascading Style Sheets implementation merging-blocked Applied to prevent a change from being merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants