diff --git a/LayoutTests/platform/wk2/webarchive/loading/test-loading-archive-subresource-null-mimetype-expected.txt b/LayoutTests/platform/wk2/webarchive/loading/test-loading-archive-subresource-null-mimetype-expected.txt index e5c7ca454678..c2a845973b2a 100644 --- a/LayoutTests/platform/wk2/webarchive/loading/test-loading-archive-subresource-null-mimetype-expected.txt +++ b/LayoutTests/platform/wk2/webarchive/loading/test-loading-archive-subresource-null-mimetype-expected.txt @@ -6,11 +6,11 @@ frame "" - didStartProvisionalLoadForFrame resources/subresource-null-mimetype.webarchive - willSendRequest redirectResponse (null) resources/subresource-null-mimetype.webarchive - didReceiveResponse frame "" - didCommitLoadForFrame -webarchive+file:///test.png - willSendRequest redirectResponse (null) +test.png - willSendRequest redirectResponse (null) frame "" - didFinishDocumentLoadForFrame resources/subresource-null-mimetype.webarchive - didFinishLoading -webarchive+file:///test.png - didReceiveResponse -webarchive+file:///test.png - didFinishLoading +test.png - didReceiveResponse +test.png - didFinishLoading frame "" - didHandleOnloadEventsForFrame main frame - didHandleOnloadEventsForFrame frame "" - didFinishLoadForFrame diff --git a/LayoutTests/webarchive/loading/test-loading-archive-subresource-null-mimetype-expected.txt b/LayoutTests/webarchive/loading/test-loading-archive-subresource-null-mimetype-expected.txt index 54a3b6b466b0..0385e3913841 100644 --- a/LayoutTests/webarchive/loading/test-loading-archive-subresource-null-mimetype-expected.txt +++ b/LayoutTests/webarchive/loading/test-loading-archive-subresource-null-mimetype-expected.txt @@ -6,11 +6,11 @@ main frame - didFinishDocumentLoadForFrame test-loading-archive-subresource-null-mimetype.html - didFinishLoading resources/subresource-null-mimetype.webarchive - didReceiveResponse frame "" - didCommitLoadForFrame -webarchive+file:///test.png - willSendRequest redirectResponse (null) +test.png - willSendRequest redirectResponse (null) frame "" - didFinishDocumentLoadForFrame resources/subresource-null-mimetype.webarchive - didFinishLoading -webarchive+file:///test.png - didReceiveResponse -webarchive+file:///test.png - didFinishLoading +test.png - didReceiveResponse +test.png - didFinishLoading frame "" - didHandleOnloadEventsForFrame main frame - didHandleOnloadEventsForFrame frame "" - didFinishLoadForFrame diff --git a/Source/WTF/Scripts/Preferences/WebPreferences.yaml b/Source/WTF/Scripts/Preferences/WebPreferences.yaml index 253a1cb242be..89650e31c220 100644 --- a/Source/WTF/Scripts/Preferences/WebPreferences.yaml +++ b/Source/WTF/Scripts/Preferences/WebPreferences.yaml @@ -2481,17 +2481,6 @@ WebArchiveDebugModeEnabled: WebCore: default: false -WebArchiveTestingModeEnabled: - type: bool - condition: ENABLE(WEB_ARCHIVE) - defaultValue: - WebKitLegacy: - default: false - WebKit: - default: false - WebCore: - default: false - WebAudioEnabled: type: bool condition: ENABLE(WEB_AUDIO) diff --git a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm b/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm index 90ab6e95661a..9b62b7f10078 100644 --- a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm +++ b/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm @@ -429,7 +429,7 @@ static void replaceRichContentWithAttachments(Frame& frame, DocumentFragment& fr static std::optional extractMarkupAndArchive(SharedBuffer& buffer, const std::function& canShowMIMETypeAsHTML) { - auto archive = LegacyWebArchive::create(buffer); + auto archive = LegacyWebArchive::create(URL(), buffer); if (!archive) return std::nullopt; diff --git a/Source/WebCore/loader/DocumentLoader.cpp b/Source/WebCore/loader/DocumentLoader.cpp index 7a907db28ee9..8988e7c1b366 100644 --- a/Source/WebCore/loader/DocumentLoader.cpp +++ b/Source/WebCore/loader/DocumentLoader.cpp @@ -1212,21 +1212,6 @@ static inline bool shouldUseActiveServiceWorkerFromParent(const Document& docume } #endif -#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML) -bool DocumentLoader::isLoadingRemoteArchive() const -{ -#if ENABLE(MHTML) - return m_archive && m_archive->shouldOverrideBaseURL(); -#else - bool isQuickLookPreview = false; -#if USE(QUICK_LOOK) - isQuickLookPreview = isQuickLookPreviewURL(m_response.url()); -#endif // QUICK_LOOK - return m_archive && !m_frame->settings().webArchiveTestingModeEnabled() && !isQuickLookPreview; -#endif // !MHTML -} -#endif // WEBARCHIVE || MHTML - void DocumentLoader::commitData(const SharedBuffer& data) { if (!m_gotFirstByte) { @@ -1254,21 +1239,9 @@ void DocumentLoader::commitData(const SharedBuffer& data) return; #if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML) - if (isLoadingRemoteArchive()) { - auto& url { m_archive->mainResource()->url() }; - if (m_archive->shouldOverrideBaseURL()) - document.setBaseURLOverride(url); -#if ENABLE(WEB_ARCHIVE) - constexpr auto webArchivePrefix { "webarchive+"_s }; - if (url.protocol().startsWith(webArchivePrefix)) { - auto unprefixedScheme { url.protocol().substring(webArchivePrefix.length()) }; - if (LegacySchemeRegistry::shouldTreatURLSchemeAsLocal(unprefixedScheme.toStringWithoutCopying())) - document.securityOrigin().grantLoadLocalResources(); - } -#endif // WEB_ARCHIVE - } -#endif // WEB_ARCHIVE || MHTML - + if (m_archive && m_archive->shouldOverrideBaseURL()) + document.setBaseURLOverride(m_archive->mainResource()->url()); +#endif #if ENABLE(SERVICE_WORKER) if (m_canUseServiceWorkers) { if (!document.securityOrigin().isUnique()) { @@ -1819,7 +1792,12 @@ bool DocumentLoader::scheduleArchiveLoad(ResourceLoader& loader, const ResourceR if (!m_archive) return false; - DOCUMENTLOADER_RELEASE_LOG("scheduleArchiveLoad: Failed to unarchive subresource"); +#if ENABLE(WEB_ARCHIVE) + // The idea of WebArchiveDebugMode is that we should fail instead of trying to fetch from the network. + // Returning true ensures the caller will not try to fetch from the network. + if (m_frame->settings().webArchiveDebugModeEnabled() && responseMIMEType() == "application/x-webarchive"_s) + return true; +#endif // If we want to load from the archive only, then we should always return true so that the caller // does not try to fetch from the network. diff --git a/Source/WebCore/loader/DocumentLoader.h b/Source/WebCore/loader/DocumentLoader.h index a08220d0fd3c..c7ce40d32b75 100644 --- a/Source/WebCore/loader/DocumentLoader.h +++ b/Source/WebCore/loader/DocumentLoader.h @@ -507,10 +507,6 @@ class DocumentLoader void clearArchiveResources(); #endif -#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML) - bool isLoadingRemoteArchive() const; -#endif - void willSendRequest(ResourceRequest&&, const ResourceResponse&, CompletionHandler&&); void finishedLoading(); void mainReceivedError(const ResourceError&); diff --git a/Source/WebCore/loader/ResourceLoader.cpp b/Source/WebCore/loader/ResourceLoader.cpp index 61b3a527c6c7..34f3c5c46882 100644 --- a/Source/WebCore/loader/ResourceLoader.cpp +++ b/Source/WebCore/loader/ResourceLoader.cpp @@ -222,16 +222,6 @@ void ResourceLoader::start() #if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML) if (m_documentLoader && m_documentLoader->scheduleArchiveLoad(*this, m_request)) return; - -#if ENABLE(WEB_ARCHIVE) - constexpr auto webArchivePrefix { "webarchive+"_s }; - if (m_request.url().protocol().startsWith(webArchivePrefix)) { - auto url { m_request.url() }; - const auto unprefixedScheme { url.protocol().substring(webArchivePrefix.length()) }; - url.setProtocol(unprefixedScheme); - m_request.setURL(url); - } -#endif #endif if (m_documentLoader && m_documentLoader->applicationCacheHost().maybeLoadResource(*this, m_request, m_request.url())) diff --git a/Source/WebCore/loader/archive/ArchiveResourceCollection.cpp b/Source/WebCore/loader/archive/ArchiveResourceCollection.cpp index 286dbb4aca37..24b49875fa5d 100644 --- a/Source/WebCore/loader/archive/ArchiveResourceCollection.cpp +++ b/Source/WebCore/loader/archive/ArchiveResourceCollection.cpp @@ -33,10 +33,6 @@ namespace WebCore { -#if ENABLE(WEB_ARCHIVE) && USE(CF) -constexpr auto webArchivePrefix { "webarchive+"_s }; -#endif - void ArchiveResourceCollection::addAllResources(Archive& archive) { for (auto& subresource : archive.subresources()) @@ -57,34 +53,19 @@ void ArchiveResourceCollection::addAllResources(Archive& archive) // Can we change the design in a manner that will let us deprecate that API without reducing functionality of those apps? void ArchiveResourceCollection::addResource(Ref&& resource) { -#if ENABLE(WEB_ARCHIVE) && USE(CF) - const bool addPrefix = !resource->url().protocol().startsWith(webArchivePrefix); - const auto prefix { addPrefix ? webArchivePrefix : ""_s }; - const auto subresourceKey { String { prefix + resource->url().string() } }; -#else - const auto& subresourceKey = resource->url().string(); -#endif - m_subresources.set(subresourceKey, WTFMove(resource)); + auto& url = resource->url(); + m_subresources.set(url.string(), WTFMove(resource)); } -ArchiveResource* ArchiveResourceCollection::archiveResourceForURL(URL url) +ArchiveResource* ArchiveResourceCollection::archiveResourceForURL(const URL& url) { -#if ENABLE(WEB_ARCHIVE) && USE(CF) - const auto httpsScheme = String { webArchivePrefix + "https"_str }; - const auto httpScheme = String { webArchivePrefix + "http"_str }; - if (!url.protocol().startsWith(webArchivePrefix)) - url.setProtocol(String { webArchivePrefix + url.protocol() }); -#else - constexpr auto httpsScheme = "https"_s; - constexpr auto httpScheme = "http"_s; -#endif - if (auto* resource = m_subresources.get(url.string())) return resource; - if (!url.protocolIs(httpsScheme)) + if (!url.protocolIs("https"_s)) return nullptr; - url.setProtocol(httpScheme); - return m_subresources.get(url.string()); + URL httpURL = url; + httpURL.setProtocol("http"_s); + return m_subresources.get(httpURL.string()); } RefPtr ArchiveResourceCollection::popSubframeArchive(const String& frameName, const URL& url) diff --git a/Source/WebCore/loader/archive/ArchiveResourceCollection.h b/Source/WebCore/loader/archive/ArchiveResourceCollection.h index 4ccbea08a534..e460b69c2aed 100644 --- a/Source/WebCore/loader/archive/ArchiveResourceCollection.h +++ b/Source/WebCore/loader/archive/ArchiveResourceCollection.h @@ -48,7 +48,7 @@ class ArchiveResourceCollection { void addResource(Ref&&); void addAllResources(Archive&); - WEBCORE_EXPORT ArchiveResource* archiveResourceForURL(URL); + WEBCORE_EXPORT ArchiveResource* archiveResourceForURL(const URL&); RefPtr popSubframeArchive(const String& frameName, const URL&); private: diff --git a/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp b/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp index 46bb2372d0f1..412c082d4fc6 100644 --- a/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp +++ b/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp @@ -172,7 +172,7 @@ ResourceResponse LegacyWebArchive::createResourceResponseFromPropertyListData(CF return ResourceResponse(); } -RefPtr LegacyWebArchive::createResource(CFDictionaryRef dictionary, const UsePrefixedScheme usePrefixedScheme) +RefPtr LegacyWebArchive::createResource(CFDictionaryRef dictionary) { ASSERT(dictionary); if (!dictionary) @@ -196,16 +196,12 @@ RefPtr LegacyWebArchive::createResource(CFDictionaryRef diction return nullptr; } - const auto cfURL = static_cast(CFDictionaryGetValue(dictionary, LegacyWebArchiveResourceURLKey)); - if (cfURL && CFGetTypeID(cfURL) != CFStringGetTypeID()) { + auto url = static_cast(CFDictionaryGetValue(dictionary, LegacyWebArchiveResourceURLKey)); + if (url && CFGetTypeID(url) != CFStringGetTypeID()) { LOG(Archives, "LegacyWebArchive - URL is not of type CFString, cannot create invalid resource"); return nullptr; } - const String stringURL { cfURL }; - const auto schemePrefix = usePrefixedScheme == UsePrefixedScheme::Yes ? "webarchive+"_s : ""_s; - const URL url { schemePrefix + stringURL }; - auto textEncoding = static_cast(CFDictionaryGetValue(dictionary, LegacyWebArchiveResourceTextEncodingNameKey)); if (textEncoding && CFGetTypeID(textEncoding) != CFStringGetTypeID()) { LOG(Archives, "LegacyWebArchive - Text encoding is not of type CFString, cannot create invalid resource"); @@ -229,7 +225,7 @@ RefPtr LegacyWebArchive::createResource(CFDictionaryRef diction response = createResourceResponseFromPropertyListData(resourceResponseData, resourceResponseVersion); } - return ArchiveResource::create(SharedBuffer::create(resourceData), url, mimeType, textEncoding, frameName, response); + return ArchiveResource::create(SharedBuffer::create(resourceData), URL { url }, mimeType, textEncoding, frameName, response); } Ref LegacyWebArchive::create() @@ -254,15 +250,10 @@ Ref LegacyWebArchive::create(Ref&& mainResour RefPtr LegacyWebArchive::create(FragmentedSharedBuffer& data) { - return create(URL(), data, UsePrefixedScheme::No); + return create(URL(), data); } RefPtr LegacyWebArchive::create(const URL&, FragmentedSharedBuffer& data) -{ - return create(URL(), data, UsePrefixedScheme::Yes); -} - -RefPtr LegacyWebArchive::create(const URL&, FragmentedSharedBuffer& data, const UsePrefixedScheme usePrefixedScheme) { LOG(Archives, "LegacyWebArchive - Creating from raw data"); @@ -291,13 +282,13 @@ RefPtr LegacyWebArchive::create(const URL&, FragmentedSharedBu return nullptr; } - if (!archive->extract(plist.get(), usePrefixedScheme)) + if (!archive->extract(plist.get())) return nullptr; return WTFMove(archive); } -bool LegacyWebArchive::extract(CFDictionaryRef dictionary, const UsePrefixedScheme usePrefixedScheme) +bool LegacyWebArchive::extract(CFDictionaryRef dictionary) { ASSERT(dictionary); if (!dictionary) { @@ -315,7 +306,7 @@ bool LegacyWebArchive::extract(CFDictionaryRef dictionary, const UsePrefixedSche return false; } - auto mainResource = createResource(mainResourceDict, usePrefixedScheme); + auto mainResource = createResource(mainResourceDict); if (!mainResource) { LOG(Archives, "LegacyWebArchive - Failed to parse main resource from CFDictionary or main resource does not exist, aborting invalid WebArchive"); return false; @@ -343,7 +334,7 @@ bool LegacyWebArchive::extract(CFDictionaryRef dictionary, const UsePrefixedSche return false; } - if (auto subresource = createResource(subresourceDict, usePrefixedScheme)) + if (auto subresource = createResource(subresourceDict)) addSubresource(subresource.releaseNonNull()); } } @@ -364,7 +355,7 @@ bool LegacyWebArchive::extract(CFDictionaryRef dictionary, const UsePrefixedSche } auto subframeArchive = create(); - if (subframeArchive->extract(subframeDict, usePrefixedScheme)) + if (subframeArchive->extract(subframeDict)) addSubframeArchive(WTFMove(subframeArchive)); else LOG(Archives, "LegacyWebArchive - Invalid subframe archive skipped"); diff --git a/Source/WebCore/loader/archive/cf/LegacyWebArchive.h b/Source/WebCore/loader/archive/cf/LegacyWebArchive.h index 4b3238ea6076..5a07b10b4be6 100644 --- a/Source/WebCore/loader/archive/cf/LegacyWebArchive.h +++ b/Source/WebCore/loader/archive/cf/LegacyWebArchive.h @@ -52,8 +52,6 @@ class LegacyWebArchive final : public Archive { WEBCORE_EXPORT RetainPtr rawDataRepresentation(); private: - enum class UsePrefixedScheme : bool { No, Yes }; - LegacyWebArchive() = default; bool shouldLoadFromArchiveOnly() const final { return false; } @@ -63,16 +61,15 @@ class LegacyWebArchive final : public Archive { enum MainResourceStatus { Subresource, MainResource }; - static RefPtr create(const URL&, FragmentedSharedBuffer&, const UsePrefixedScheme); static RefPtr create(const String& markupString, Frame&, const Vector& nodes, Function&& frameFilter); - static RefPtr createResource(CFDictionaryRef, const UsePrefixedScheme); + static RefPtr createResource(CFDictionaryRef); static ResourceResponse createResourceResponseFromMacArchivedData(CFDataRef); static ResourceResponse createResourceResponseFromPropertyListData(CFDataRef, CFStringRef responseDataType); static RetainPtr createPropertyListRepresentation(const ResourceResponse&); static RetainPtr createPropertyListRepresentation(Archive&); static RetainPtr createPropertyListRepresentation(ArchiveResource*, MainResourceStatus); - bool extract(CFDictionaryRef, const UsePrefixedScheme); + bool extract(CFDictionaryRef); }; } // namespace WebCore diff --git a/Source/WebCore/page/SecurityOrigin.cpp b/Source/WebCore/page/SecurityOrigin.cpp index f825bdfb0900..cb3da95edc8b 100644 --- a/Source/WebCore/page/SecurityOrigin.cpp +++ b/Source/WebCore/page/SecurityOrigin.cpp @@ -119,11 +119,6 @@ static bool shouldTreatAsUniqueOrigin(const URL& url) || url.protocolIs("x-apple-ql-id2"_s) || url.protocolIs("x-apple-ql-magic"_s) #endif -#if ENABLE(WEB_ARCHIVE) && USE(CF) - || url.protocolIs("webarchive+http"_s) - || url.protocolIs("webarchive+https"_s) - || url.protocolIs("webarchive+ftp"_s) -#endif #if PLATFORM(GTK) || PLATFORM(WPE) || url.protocolIs("resource"_s) #if ENABLE(PDFJS) diff --git a/Source/WebKit/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit/UIProcess/API/C/WKPreferences.cpp index 4af9465841d7..789fbf5c4bf9 100644 --- a/Source/WebKit/UIProcess/API/C/WKPreferences.cpp +++ b/Source/WebKit/UIProcess/API/C/WKPreferences.cpp @@ -555,14 +555,14 @@ bool WKPreferencesGetDOMTimersThrottlingEnabled(WKPreferencesRef preferencesRef) return toImpl(preferencesRef)->domTimersThrottlingEnabled(); } -void WKPreferencesSetWebArchiveTestingModeEnabled(WKPreferencesRef preferencesRef, bool enabled) +void WKPreferencesSetWebArchiveDebugModeEnabled(WKPreferencesRef preferencesRef, bool enabled) { - toImpl(preferencesRef)->setWebArchiveTestingModeEnabled(enabled); + toImpl(preferencesRef)->setWebArchiveDebugModeEnabled(enabled); } -bool WKPreferencesGetWebArchiveTestingModeEnabled(WKPreferencesRef preferencesRef) +bool WKPreferencesGetWebArchiveDebugModeEnabled(WKPreferencesRef preferencesRef) { - return toImpl(preferencesRef)->webArchiveTestingModeEnabled(); + return toImpl(preferencesRef)->webArchiveDebugModeEnabled(); } void WKPreferencesSetLocalFileContentSniffingEnabled(WKPreferencesRef preferencesRef, bool enabled) @@ -2143,15 +2143,6 @@ bool WKPreferencesGetXSSAuditorEnabled(WKPreferencesRef) return false; } -void WKPreferencesSetWebArchiveDebugModeEnabled(WKPreferencesRef preferencesRef, bool enabled) -{ -} - -bool WKPreferencesGetWebArchiveDebugModeEnabled(WKPreferencesRef preferencesRef) -{ - return false; -} - void WKPreferencesSetJavaEnabled(WKPreferencesRef, bool) { } diff --git a/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h b/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h index 6614ea662db1..11be798b5699 100644 --- a/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h +++ b/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h @@ -124,8 +124,8 @@ WK_EXPORT void WKPreferencesSetDOMTimersThrottlingEnabled(WKPreferencesRef prefe WK_EXPORT bool WKPreferencesGetDOMTimersThrottlingEnabled(WKPreferencesRef preferences); // Defaults to false. -WK_EXPORT void WKPreferencesSetWebArchiveTestingModeEnabled(WKPreferencesRef preferences, bool enabled); -WK_EXPORT bool WKPreferencesGetWebArchiveTestingModeEnabled(WKPreferencesRef preferences); +WK_EXPORT void WKPreferencesSetWebArchiveDebugModeEnabled(WKPreferencesRef preferences, bool enabled); +WK_EXPORT bool WKPreferencesGetWebArchiveDebugModeEnabled(WKPreferencesRef preferences); // Defaults to false. WK_EXPORT void WKPreferencesSetLocalFileContentSniffingEnabled(WKPreferencesRef preferences, bool enabled); @@ -563,8 +563,6 @@ WK_EXPORT void WKPreferencesSetResourceTimingEnabled(WKPreferencesRef, bool) WK_ WK_EXPORT bool WKPreferencesGetResourceTimingEnabled(WKPreferencesRef) WK_C_API_DEPRECATED; WK_EXPORT void WKPreferencesSetSubpixelCSSOMElementMetricsEnabled(WKPreferencesRef, bool) WK_C_API_DEPRECATED; WK_EXPORT bool WKPreferencesGetSubpixelCSSOMElementMetricsEnabled(WKPreferencesRef) WK_C_API_DEPRECATED; -WK_EXPORT void WKPreferencesSetWebArchiveDebugModeEnabled(WKPreferencesRef preferences, bool enabled) WK_C_API_DEPRECATED; -WK_EXPORT bool WKPreferencesGetWebArchiveDebugModeEnabled(WKPreferencesRef preferences) WK_C_API_DEPRECATED; #ifdef __cplusplus } diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm b/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm index 348f152a759f..3c96e97c4ad7 100644 --- a/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm +++ b/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm @@ -978,14 +978,14 @@ - (BOOL)_domTimersThrottlingEnabled return _preferences->domTimersThrottlingEnabled(); } -- (void)_setWebArchiveTestingModeEnabled:(BOOL)enabled +- (void)_setWebArchiveDebugModeEnabled:(BOOL)enabled { - _preferences->setWebArchiveTestingModeEnabled(enabled); + _preferences->setWebArchiveDebugModeEnabled(enabled); } -- (BOOL)_webArchiveTestingModeEnabled +- (BOOL)_webArchiveDebugModeEnabled { - return _preferences->webArchiveTestingModeEnabled(); + return _preferences->webArchiveDebugModeEnabled(); } - (void)_setLocalFileContentSniffingEnabled:(BOOL)enabled @@ -1616,15 +1616,6 @@ - (BOOL)_subpixelCSSOMElementMetricsEnabled return NO; } -- (void)_setWebArchiveDebugModeEnabled:(BOOL)enabled -{ -} - -- (BOOL)_webArchiveDebugModeEnabled -{ - return NO; -} - #endif #if PLATFORM(MAC) diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h b/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h index 192b8317f596..5df3734a9f01 100644 --- a/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h +++ b/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h @@ -186,7 +186,7 @@ typedef NS_ENUM(NSInteger, _WKPitchCorrectionAlgorithm) { @property (nonatomic, setter=_setDefaultTextEncodingName:) NSString *_defaultTextEncodingName WK_API_AVAILABLE(macos(10.13.4)); @property (nonatomic, setter=_setAuthorAndUserStylesEnabled:) BOOL _authorAndUserStylesEnabled WK_API_AVAILABLE(macos(10.13.4)); @property (nonatomic, setter=_setDOMTimersThrottlingEnabled:) BOOL _domTimersThrottlingEnabled WK_API_AVAILABLE(macos(10.13.4)); -@property (nonatomic, setter=_setWebArchiveTestingModeEnabled:) BOOL _webArchiveTestingModeEnabled WK_API_AVAILABLE(macos(13.0)); +@property (nonatomic, setter=_setWebArchiveDebugModeEnabled:) BOOL _webArchiveDebugModeEnabled WK_API_AVAILABLE(macos(10.13.4)); @property (nonatomic, setter=_setLocalFileContentSniffingEnabled:) BOOL _localFileContentSniffingEnabled WK_API_AVAILABLE(macos(10.13.4)); @property (nonatomic, setter=_setUsesPageCache:) BOOL _usesPageCache WK_API_AVAILABLE(macos(10.13.4)); @property (nonatomic, setter=_setPageCacheSupportsPlugins:) BOOL _pageCacheSupportsPlugins WK_API_AVAILABLE(macos(10.13.4)); @@ -231,6 +231,6 @@ typedef NS_ENUM(NSInteger, _WKPitchCorrectionAlgorithm) { @property (nonatomic, setter=_setRequestAnimationFrameEnabled:) BOOL _requestAnimationFrameEnabled WK_API_DEPRECATED("requestAnimationFrame is always enabled", macos(10.15.4, 13.0), ios(13.4, 16.0)); #if !TARGET_OS_IPHONE @property (nonatomic, setter=_setSubpixelCSSOMElementMetricsEnabled:) BOOL _subpixelCSSOMElementMetricsEnabled WK_API_DEPRECATED("Subpixel CSSOM element metrics are no longer supported", macos(10.13.4, 10.15)); -@property (nonatomic, setter=_setWebArchiveDebugModeEnabled:) BOOL _webArchiveDebugModeEnabled WK_API_DEPRECATED("WebArchive Debug Mode is no longer supported", macos(10.13.4, 13.0)); #endif + @end diff --git a/Source/WebKitLegacy/mac/WebView/WebView.mm b/Source/WebKitLegacy/mac/WebView/WebView.mm index 894ab525b4af..3f61c2bbc21e 100644 --- a/Source/WebKitLegacy/mac/WebView/WebView.mm +++ b/Source/WebKitLegacy/mac/WebView/WebView.mm @@ -3273,13 +3273,6 @@ + (BOOL)_canHandleRequest:(NSURLRequest *)request forMainFrame:(BOOL)forMainFram if ([scheme _webkit_isCaseInsensitiveEqualToString:@"blob"]) return YES; - NSString* webArchivePrefix = @"webarchive+"; - if ([scheme _webkit_hasCaseInsensitivePrefix:webArchivePrefix]) { - auto url = [request URL]; - NSString* modifiedURL = [[url absoluteString] substringFromIndex:[webArchivePrefix length]]; - return [self _canHandleRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:modifiedURL]] forMainFrame:forMainFrame]; - } - return NO; } diff --git a/Tools/TestWebKitAPI/Tests/mac/LoadWebArchive.mm b/Tools/TestWebKitAPI/Tests/mac/LoadWebArchive.mm index fb39c5b845e6..71102b996ea0 100644 --- a/Tools/TestWebKitAPI/Tests/mac/LoadWebArchive.mm +++ b/Tools/TestWebKitAPI/Tests/mac/LoadWebArchive.mm @@ -32,7 +32,6 @@ #import "TestWKWebView.h" #import #import -#import #import #import #import @@ -206,9 +205,9 @@ - (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWe EXPECT_WK_STREQ(finalURL, ""); } -static NSData* constructArchive(const char *script) +static NSData* constructArchive() { - auto *js = [NSString stringWithUTF8String:script]; + NSString *js = @"alert('loaded http subresource successfully')"; auto response = adoptNS([[NSURLResponse alloc] initWithURL:[NSURL URLWithString:@"http://download/script.js"] MIMEType:@"application/javascript" expectedContentLength:js.length textEncodingName:@"utf-8"]); auto responseArchiver = adoptNS([[NSKeyedArchiver alloc] initRequiringSecureCoding:YES]); [responseArchiver encodeObject:response.get() forKey:@"WebResourceResponse"]; @@ -233,7 +232,7 @@ - (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWe TEST(LoadWebArchive, HTTPSUpgrade) { - NSData *data = constructArchive("alert('loaded http subresource successfully')"); + NSData *data = constructArchive(); auto webView = adoptNS([WKWebView new]); [webView loadData:data MIMEType:@"application/x-webarchive" characterEncodingName:@"utf-8" baseURL:[NSURL URLWithString:@"http://download/"]]; @@ -242,7 +241,7 @@ - (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWe TEST(LoadWebArchive, DisallowedNetworkHosts) { - NSData *data = constructArchive("alert('loaded http subresource successfully')"); + NSData *data = constructArchive(); auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); configuration.get()._allowedNetworkHosts = [NSSet set]; @@ -253,7 +252,3 @@ - (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWe } } // namespace TestWebKitAPI - -#if USE(APPLE_INTERNAL_SDK) -#import -#endif