Skip to content

Commit 588eb5e

Browse files
committed
Initial setup for Compression Dictionary Transport
https://bugs.webkit.org/show_bug.cgi?id=295249 - Add build/runtime flag for compression dictionary transport. - Add "compression-dictionary" destination type. whatwg/fetch#1854 - Add Link rel "compression-dictionary". whatwg/html#11619
1 parent 51f2873 commit 588eb5e

10 files changed

Lines changed: 37 additions & 0 deletions

File tree

Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,6 +1900,22 @@ CompositingRepaintCountersVisible:
19001900
WebCore:
19011901
default: false
19021902

1903+
CompressionDictionaryEnabled:
1904+
type: bool
1905+
status: testable
1906+
category: networking
1907+
condition: ENABLE(COMPRESSION_DICTIONARY_TRANSPORT)
1908+
humanReadableName: "Compression Dictionary Transport"
1909+
humanReadableDescription: "Enable compression dictionary transport"
1910+
defaultValue:
1911+
WebKitLegacy:
1912+
default: false
1913+
WebKit:
1914+
default: false
1915+
WebCore:
1916+
default: false
1917+
sharedPreferenceForWebProcess: true
1918+
19031919
CompressionStreamEnabled:
19041920
type: bool
19051921
status: stable

Source/WTF/wtf/PlatformEnableGlib.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,7 @@
7474
#if ENABLE(WPE_PLATFORM) || PLATFORM(GTK)
7575
#define ENABLE_DAMAGE_TRACKING 1
7676
#endif
77+
78+
#if PLATFORM(GTK)
79+
#define ENABLE_COMPRESSION_DICTIONARY_TRANSPORT 1
80+
#endif

Source/WebCore/Modules/fetch/FetchRequestDestination.idl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ enum FetchRequestDestination {
3131
"",
3232
"audio",
3333
"audioworklet",
34+
"compression-dictionary",
3435
"document",
3536
"embed",
3637
"environmentmap",

Source/WebCore/html/LinkRelAttribute.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ static constexpr SortedArrayMap linkTypes { WTF::toArray<std::pair<ComparableLet
5353
{ "alternate"_s, { [](auto) { return true; }, [](auto relAttribute) { relAttribute.isAlternate = true; } } },
5454
{ "apple-touch-icon"_s, { [](auto) { return true; }, [](auto relAttribute) { relAttribute.iconType = LinkIconType::TouchIcon; } } },
5555
{ "apple-touch-icon-precomposed"_s, { [](auto) { return true; }, [](auto relAttribute) { relAttribute.iconType = LinkIconType::TouchPrecomposedIcon; } } },
56+
#if ENABLE(COMPRESSSION_DICTIONARY_TRANSPORT)
57+
{ "compression-dictionary"_s, { [](auto) { return document.settings().compressionDictionaryEnabled(); }, [](auto relAttribute) { relAttribute.isCompressionDictionary = true; } } },
58+
#else
59+
{ "compression-dictionary"_s, { [](auto) { return false; }, [](auto) { } } },
60+
#endif
5661
{ "dns-prefetch"_s, { [](auto) { return true; }, [](auto relAttribute) { relAttribute.isDNSPrefetch = true; } } },
5762
{ "expect"_s, { [](auto) { return true; }, [](auto relAttribute) { relAttribute.isInternalResourceLink = true; } } },
5863
{ "icon"_s, { [](auto) { return true; }, [](auto relAttribute) { relAttribute.iconType = LinkIconType::Favicon; } } },

Source/WebCore/html/LinkRelAttribute.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ struct LinkRelAttribute {
5656
#if ENABLE(WEB_PAGE_SPATIAL_BACKDROP)
5757
bool isSpatialBackdrop : 1 { false };
5858
#endif
59+
#if ENABLE(COMPRESSION_DICTIONARY_TRANSPORT)
60+
bool isCompressionDictionary : 1 { false };
61+
#endif
5962

6063
LinkRelAttribute() = default;
6164
LinkRelAttribute(Document&, StringView);

Source/WebCore/loader/FetchOptionsDestination.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ enum class FetchOptionsDestination : uint8_t {
3131
EmptyString,
3232
Audio,
3333
Audioworklet,
34+
CompressionDictionary,
3435
Document,
3536
Embed,
3637
Environmentmap,

Source/WebCore/loader/LinkLoader.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ std::optional<CachedResource::Type> LinkLoader::resourceTypeFromAsAttribute(cons
170170
return CachedResource::Type::Script;
171171
case FetchRequestDestination::Document:
172172
return std::nullopt;
173+
case FetchRequestDestination::CompressionDictionary:
174+
return std::nullopt;
173175
case FetchRequestDestination::Embed:
174176
return std::nullopt;
175177
case FetchRequestDestination::Environmentmap:

Source/WebCore/platform/network/HTTPHeaderNames.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Access-Control-Request-Headers
3838
Access-Control-Request-Method
3939
Age
4040
Authorization
41+
Available-Dictionary
4142
Cache-Control
4243
Clear-Site-Data
4344
Connection
@@ -60,6 +61,7 @@ Cross-Origin-Resource-Policy
6061
Date
6162
DNT
6263
Default-Style
64+
Dictionary-ID
6365
ETag
6466
Expect
6567
Expires
@@ -112,6 +114,7 @@ Trailer
112114
Transfer-Encoding
113115
Upgrade
114116
Upgrade-Insecure-Requests
117+
Use-As-Dictionary
115118
User-Agent
116119
Vary
117120
Via

Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ bool NetworkLoadChecker::isAllowedByContentSecurityPolicy(const ResourceRequest&
425425
return false;
426426
// FIXME: Check CSP for non-importScripts() initiated loads.
427427
return true;
428+
case FetchOptions::Destination::CompressionDictionary:
428429
case FetchOptions::Destination::EmptyString:
429430
return contentSecurityPolicy->allowConnectToSource(request.url(), { }, redirectResponseReceived, preRedirectURL);
430431
case FetchOptions::Destination::Audio:

Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ ResourceLoadInfo NetworkResourceLoader::resourceLoadInfo()
504504
case WebCore::FetchOptions::Destination::Audio:
505505
return ResourceLoadInfo::Type::Media;
506506
case WebCore::FetchOptions::Destination::Audioworklet:
507+
case WebCore::FetchOptions::Destination::CompressionDictionary:
507508
return ResourceLoadInfo::Type::Other;
508509
case WebCore::FetchOptions::Destination::Document:
509510
case WebCore::FetchOptions::Destination::Iframe:

0 commit comments

Comments
 (0)