https://bugs.webkit.org/show_bug.cgi?id=215643
<rdar://problem/67430461>
Reviewed by Alan Bujtas.
Source/WebCore:
The CSS spec says that certain characters have to be invisible. Previously, we were doing this
by just treating these characters as if they were the zero width space character. However, this
is wrong for 2 reasons:
1. If the primary font supports the desired character but doesn't support the zero width space
character, we'll fallback past it and trigger a download for secondary fonts until
we find one that supports the ZWS character (which the page didn't even ask for!)
2. Shaping is Turing-complete, and expects that the correct glyphIDs are fed into the shaper.
We can't just arbitrarily swap out glyphIDs before shaping just because we feel like it.
Instead, the solution is to handle these invisible characters after font fallback, and after
shaping. This patch does it just like we handle adding letter-spacing, word-spacing, and
justification after shaping - by iterating over the glyphs output by the shaper and seeing if
any need to be adjusted.
This patch also includes a fix for the situation where the glyph buffer might be left in an
inconsistent state, where the array of glyphs is shorter than the array of characters -
this new codepath added in this patch revealed this existing problem, and fixes it here too.
Test: fast/text/zwj-ligature.html
* platform/graphics/Font.cpp:
(WebCore::createAndFillGlyphPage):
(WebCore::overrideControlCharacters): Deleted.
* platform/graphics/GlyphBuffer.h:
(WebCore::GlyphBuffer::glyphAt const):
(WebCore::GlyphBuffer::deleteGlyphWithoutAffectingSize):
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::applyCSSVisibilityRules):
(WebCore::WidthIterator::advance):
* platform/graphics/WidthIterator.h:
Source/WTF:
* wtf/unicode/CharacterNames.h:
LayoutTests:
* fast/text/resources/Ahem-GSUB-ligatures.ttf: Added.
* fast/text/zwj-ligature-expected.html: Added.
* fast/text/zwj-ligature.html: Added.
* platform/mac/fast/text/format-control-expected.txt: Progression! A new ligature is formed that wasn't formed before.
Also, this ligature is formed in both Chrome and Firefox, so we match them now.
* platform/win/TestExpectations:
Canonical link: https://commits.webkit.org/240804@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281389 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=229375
Source/WebCore:
Reviewed by Brady Eidson.
Client may dispatch custom events to an IDBRequest, and we should only change request state based on events
created internally.
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::dispatchEvent):
Source/WTF:
Protect callee in CrossThreadTask if it inherits from ThreadSafeRefCounted<T>.
Reviewed by Brady Eidson.
* wtf/CrossThreadTask.h:
Canonical link: https://commits.webkit.org/240799@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281384 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=229329
rdar://82162851
Reviewed by Yusuke Suzuki.
These assertion utility functions rely on tagged pointers always having non-zero
PAC bits. This is an incorrect assumption. A tagged pointer can have PAC bits
that are completely zero. Hence, these assert functions cannot be made to work
reliably. We should remove them to prevent them from being used, and potentially
resulting in flaky assertion failures that will be hard to debug later.
Note: assertIsNotTagged is fine to keep. It asserts that PAC bits of a pointer
are all 0. As a result, this assertion can have false positives where it may think
a tagged pointer is an untagged pointer. However, this is rare because it is not
common to have 0 PAC bits in tagged pointers. False positives on this assertion
won't result in flaky test failures that will waste our time later. Hence,
keeping the assertion will do more good (it will tend to help us find bugs) than
bad (it will rarely let false positives thru). As a result, I'm opting to not
remove it.
* wtf/PtrTag.h:
(WTF::assertIsTagged): Deleted.
(WTF::assertIsNullOrTagged): Deleted.
Canonical link: https://commits.webkit.org/240734@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281317 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228894
Reviewed by Simon Fraser.
LayoutTests/imported/w3c:
* web-platform-tests/css/selectors/has-basic-expected.txt:
* web-platform-tests/css/selectors/has-relative-argument-expected.txt:
* web-platform-tests/css/selectors/parsing/parse-has-expected.txt:
* web-platform-tests/dom/nodes/Element-closest-expected.txt:
Source/WebCore:
This patch adds basic support for :has() pseudo-class, https://drafts.csswg.org/selectors/#has-pseudo.
The initial implementation is very inefficient. There is no support for invalidation yet.
The feature is disabled by default.
* css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText const):
Serialization.
* css/CSSSelector.h:
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne const):
Selector matching using nested SelectorChecker.
* css/SelectorPseudoClassAndCompatibilityElementMap.in:
* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
(WebCore::add):
* css/parser/CSSParserContext.h:
* css/parser/CSSParserSelector.h:
(WebCore::CSSParserSelector::setPseudoClassType):
* css/parser/CSSSelectorParser.cpp:
(WebCore::CSSSelectorParser::consumeForgivingSelectorList):
Add a template version of the forgiving parsing function.
(WebCore::CSSSelectorParser::consumeForgivingComplexSelectorList):
Use it for complex selector lists.
(WebCore::CSSSelectorParser::consumeForgivingRelativeSelectorList):
And the new relative selector lists.
(WebCore::CSSSelectorParser::consumeRelativeSelector):
Parse relative selectors like "> foo".
(WebCore::CSSSelectorParser::consumePseudo):
(WebCore::CSSSelectorParser::consumeComplexForgivingSelectorList): Deleted.
* css/parser/CSSSelectorParser.h:
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):
No compiler support yet.
Source/WTF:
* Scripts/Preferences/WebPreferencesExperimental.yaml:
Add off-by-default HasPseudoClassEnabled preference value.
Canonical link: https://commits.webkit.org/240719@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281295 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228176
Reviewed by Sam Weinig.
Source/WebCore:
Modern versions of macOS and iOS can treat the system font as a variable font,
and be able to apply weights like "342" instead of just "300" or "400".
Tests: fast/text/variable-system-font-2.html
fast/text/variable-system-font.html
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::preparePlatformFont):
Source/WTF:
* wtf/PlatformUse.h:
LayoutTests:
Update tests.
* fast/text/resources/Ahem-trak.ttf: Added. This is a font which has a trak table.
* fast/text/trak-optimizeLegibility-expected-mismatch.html: Added.
* fast/text/trak-optimizeLegibility-expected.txt: Removed.
* fast/text/trak-optimizeLegibility.html:
* fast/text/variable-system-font-2-expected-mismatch.html: Added.
* fast/text/variable-system-font-2.html: Added.
* fast/text/variable-system-font-expected-mismatch.html: Added.
* fast/text/variable-system-font.html: Added.
* svg/dom/altGlyph-dom-expected.txt:
* svg/dom/resources/altGlyph-dom.js:
Canonical link: https://commits.webkit.org/240715@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281291 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=229145
Reviewed by Alicia Boya Garcia.
Source/WebCore:
Added GStreamerEMEUtilities to include implementation of
InitData::extractCencIfNeeded. This tries to parse the possible
XML inside an init data that could come from MPD manifests. If it
succeeds, it keeps the parsed init data, if not, it returns the
original one.
Based on a patch by Philippe Normand.
* platform/GStreamer.cmake:
* platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp: Added.
(WebCore::markupStartElement):
(WebCore::markupEndElement):
(WebCore::markupText):
(WebCore::markupPassthrough):
(WebCore::markupError):
(WebCore::InitData::extractCencIfNeeded):
* platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
(WebCore::InitData::InitData):
Source/WTF:
* wtf/glib/GUniquePtr.h: Added deleter for GMarkupParseContext.
Canonical link: https://commits.webkit.org/240628@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281183 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=227336
Patch by Alex Christensen <achristensen@webkit.org> on 2021-08-16
Reviewed by Chris Dumez.
It passes WPT tests except the following:
navigation-timing/nav2_test_redirect_chain_xserver_partial_opt_in.html and navigation-timing/nav2_test_redirect_xserver.html pass when run from wpt.live,
and other browsers also don't pass when run from our local hosting infrastructure, which doesn't have a good cross-domain redirect.
nav2_test_attributes_values.html fails in Chrome and Firefox. There's something wrong with the port detection in the test.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
Canonical link: https://commits.webkit.org/240570@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281111 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=229018
Reviewed by Geoffrey Garen.
Source/WTF:
Introduce CanMakeThreadSafeCheckedPtr which is a thread safe version of CanMakeCheckedPtr.
* wtf/CheckedRef.h:
(WTF::CanMakeCheckedPtrBase): Extracted from CanMakeCheckedPtr.
(WTF::CanMakeCheckedPtrBase::~CanMakeCheckedPtrBase):
(WTF::CanMakeCheckedPtrBase::ptrCount const):
(WTF::SingleThreadIntegralWrapper): Added.
(WTF::SingleThreadIntegralWrapper::SingleThreadIntegralWrapper):
(WTF::SingleThreadIntegralWrapper::operator IntegralType const):
(WTF::SingleThreadIntegralWrapper::operator! const):
(WTF::SingleThreadIntegralWrapper::operator++):
(WTF::SingleThreadIntegralWrapper::operator--):
(WTF::SingleThreadIntegralWrapper::assertThread const):
(WTF::CanMakeCheckedPtr): Redefined using CanMakeCheckedPtrBase and SimpleNonAtomicType.
(WTF::CanMakeThreadSafeCheckedPtr): Added.
Tools:
Added a unit test for CanMakeThreadSafeCheckedPtr
* TestWebKitAPI/Tests/WTF/CheckedPtr.cpp:
(TestWebKitAPI.ThreadSafeCheckedPtrObject)
(WTF_CheckedPtr.CanMakeThreadSafeCheckedPtr): Added.
Canonical link: https://commits.webkit.org/240564@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281105 268f45cc-cd09-0410-ab3c-d52691b4dbfc
<https://webkit.org/b/229113>
Reviewed by Chris Dumez.
* wtf/text/StringImpl.h:
(WTF::StringImpl::isStatic const):
- Add SUPPRESS_TSAN attribute since the 0x1 bit is set at
construction and refcounting occurs in increments of 0x2, so
the static bit never changes.
(WTF::StringImpl::ref):
(WTF::StringImpl::deref):
- Return early for static WTF::StringImpl objects to prevent
TSan from reporting data races for m_refCount.
Canonical link: https://commits.webkit.org/240551@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281091 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228227
Reviewed by Carlos Garcia Campos.
Source/WebKit:
Added webkit_website_data_manager_set_memory_pressure_settings() API function to pass a
WebKitMemoryPressureSettings instance as the settings to use by all the network processes.
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode const):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::NetworkProcess::platformInitializeNetworkProcess):
* UIProcess/API/glib/WebKitMemoryPressureSettings.cpp:
* UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
(webkit_website_data_manager_set_memory_pressure_settings):
* UIProcess/API/gtk/WebKitWebsiteDataManager.h:
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/wpe/WebKitWebsiteDataManager.h:
* UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didExceedMemoryLimit):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/WebProcessPool.h:
* UIProcess/soup/WebProcessPoolSoup.cpp:
(WebKit::memoryPressureMonitorDisabled):
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
Source/WTF:
Added a new method to MemoryPressureHandler to set the configuration by copying the parameter
instead of moving it.
* wtf/MemoryPressureHandler.h:
(WTF::MemoryPressureHandler::setConfiguration):
Tools:
Added an API test for webkit_website_data_manager_set_memory_pressure_settings().
* TestWebKitAPI/Tests/WebKitGLib/TestWebsiteData.cpp:
(MemoryPressureTest::setup):
(MemoryPressureTest::teardown):
(MemoryPressureTest::loadFailedCallback):
(MemoryPressureTest::waitUntilLoadFailed):
(testMemoryPressureSettings):
(beforeAll):
Canonical link: https://commits.webkit.org/240531@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281070 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228754
Reviewed by Alex Christensen.
LayoutTests/imported/w3c:
Rebaseline COEP WPT tests now that we are passing more checks.
* web-platform-tests/html/cross-origin-embedder-policy/blob.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/coep-frame-javascript.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/coep-on-response-from-service-worker.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/credentialless/iframe-coep-require-corp.tentative.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/cross-origin-isolated-permission.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/data.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/dedicated-worker-cache-storage.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/dedicated-worker.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/header-parsing.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/javascript.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/multi-globals/workers-coep-report.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/no-secure-context-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/none-sw-from-require-corp.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/none.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/reporting-to-endpoint.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/require-corp-about-blank-expected.txt: Removed.
* web-platform-tests/html/cross-origin-embedder-policy/require-corp-about-blank.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/require-corp-about-srcdoc-expected.txt: Removed.
* web-platform-tests/html/cross-origin-embedder-policy/require-corp-about-srcdoc.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/require-corp-load-from-cache-storage.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/require-corp-sw-from-none.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/require-corp-sw-from-require-corp.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/require-corp-sw.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/require-corp.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/sandbox.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/service-worker-cache-storage.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/srcdoc.https-expected.txt:
Source/WebCore:
Add initial support for Cross-Origin-Embedder-Policy (COEP) behind a runtime feature flag, off by default:
- https://html.spec.whatwg.org/multipage/origin.html#coep
The COEP header has the following impacts:
- When a document with `Cross-Origin-Embedder-Policy: require-corp` loads an iframe or a worker script, if the network
response for that iframe doesn't also contain `Cross-Origin-Embedder-Policy: require-corp`, then we fail the load.
- When a document with `Cross-Origin-Embedder-Policy: require-corp` loads cross-origin subresources, then either CORS
must be used or the resource response must be allowed by Cross-Origin-Resource-Policy (CORP) header.
Support is only for WK2 and checks are done in the network process for better security. Support for workers and service
workers (including cache storage) is included.
Most of the Web-Platform-Tests for COEP are passing with this patch. The exceptions are:
- Some tests relying on Blob are failing. Similarly to COOP, Blobs need to inherit COEP from their
creator. This is currently unimplemented as the change will likely be non-trivial. I will follow-up
to fix Blob support for both COOP and COEP.
- Tests in the credentialless/ folder are failing because we do not support `Cross-Origin-Embedder-Policy: credentialless`.
This seems to be a fairly recent extension proposed by Google and it is not part of the HTML specification yet.
- Some tests expect violation reporting and they are failing and we do not implement reporting yet.
Note that `self.crossOriginIsolated` still returns false, even if the pages opts into both COOP & COEP, and APIs such
as SharedArrayBuffer still are not permitted to use. In order to support this, we will have to actually implement process
swapping so that we know a process is not actually shared by several origins.
Test: http/wpt/html/cross-origin-embedder-policy/require-corp.https.html
* Modules/cache/DOMCache.cpp:
(WebCore::DOMCache::queryCache):
* Modules/cache/DOMCacheEngine.cpp:
(WebCore::DOMCacheEngine::convertToException):
* Modules/cache/DOMCacheEngine.h:
* Modules/cache/RetrieveRecordsOptions.h:
(WebCore::RetrieveRecordsOptions::isolatedCopy const):
(WebCore::RetrieveRecordsOptions::encode const):
(WebCore::RetrieveRecordsOptions::decode):
* dom/Document.cpp:
(WebCore::Document::initSecurityContext):
* dom/SecurityContext.h:
(WebCore::SecurityContext::crossOriginEmbedderPolicy const):
(WebCore::SecurityContext::setCrossOriginEmbedderPolicy):
* loader/CrossOriginAccessControl.cpp:
(WebCore::shouldCrossOriginResourcePolicyCancelLoad):
(WebCore::validateCrossOriginResourcePolicy):
* loader/CrossOriginAccessControl.h:
* loader/CrossOriginEmbedderPolicy.cpp:
(WebCore::obtainCrossOriginEmbedderPolicy):
(WebCore::CrossOriginEmbedderPolicy::isolatedCopy const):
* loader/CrossOriginEmbedderPolicy.h:
(WebCore::CrossOriginEmbedderPolicy::encode const):
(WebCore::CrossOriginEmbedderPolicy::decode):
* loader/CrossOriginOpenerPolicy.cpp:
(WebCore::obtainCrossOriginOpenerPolicy):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::loadResourceSynchronously):
(WebCore::DocumentThreadableLoader::create):
(WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
(WebCore::DocumentThreadableLoader::crossOriginEmbedderPolicy const):
* loader/DocumentThreadableLoader.h:
* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::begin):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didBeginDocument):
* loader/ResourceLoaderOptions.h:
* loader/WorkerThreadableLoader.cpp:
(WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
* page/SecurityOrigin.h:
* platform/network/HTTPParsers.cpp:
(WebCore::parseCrossOriginResourcePolicyHeader):
* platform/network/HTTPParsers.h:
* workers/Worker.cpp:
(WebCore::Worker::notifyFinished):
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::WorkerGlobalScope):
* workers/WorkerGlobalScopeProxy.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
* workers/WorkerMessagingProxy.h:
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::loadSynchronously):
(WebCore::WorkerScriptLoader::loadAsynchronously):
(WebCore::WorkerScriptLoader::didReceiveResponse):
* workers/WorkerScriptLoader.h:
(WebCore::WorkerScriptLoader::crossOriginEmbedderPolicy const):
* workers/WorkerThread.cpp:
(WebCore::WorkerParameters::isolatedCopy const):
* workers/WorkerThread.h:
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerContextData.cpp:
(WebCore::ServiceWorkerContextData::isolatedCopy const):
* workers/service/ServiceWorkerContextData.h:
(WebCore::ServiceWorkerContextData::encode const):
(WebCore::ServiceWorkerContextData::decode):
* workers/service/ServiceWorkerFetchResult.h:
(WebCore::ServiceWorkerFetchResult::isolatedCopy const):
(WebCore::serviceWorkerFetchError):
(WebCore::ServiceWorkerFetchResult::encode const):
(WebCore::ServiceWorkerFetchResult::decode):
* workers/service/ServiceWorkerJob.cpp:
(WebCore::ServiceWorkerJob::notifyFinished):
* workers/service/ServiceWorkerJobClient.h:
* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::ServiceWorkerThread):
* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::doPushChanges):
(WebCore::RegistrationDatabase::importRecords):
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::addRegistrationFromStore):
(WebCore::SWServer::updateWorker):
(WebCore::SWServer::installContextData):
* workers/service/server/SWServer.h:
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::scriptFetchFinished):
* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::SWServerWorker):
(WebCore::SWServerWorker::contextData const):
* workers/service/server/SWServerWorker.h:
Source/WebKit:
As mentioned in the WebCore changelog, we do all the COEP checks in the network process
instead of WebCore for added security. As a result, we need to pass more information
to the network process when doing loads in order to do those checks. The checks are done
in NetworkResourceLoader for navigations & worker script loads (similarly to CSP,
X-FrameOptions) and in NetworkLoadChecker for CORP checks of subresource loads (similarly
to CORS checks).
* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::NetworkLoadChecker):
(WebKit::NetworkLoadChecker::validateResponse):
* NetworkProcess/NetworkLoadChecker.h:
(WebKit::NetworkLoadChecker::setParentCrossOriginEmbedderPolicy):
(WebKit::NetworkLoadChecker::setCrossOriginEmbedderPolicy):
* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::parentOrigin const):
(WebKit::NetworkResourceLoadParameters::encode const):
(WebKit::NetworkResourceLoadParameters::decode):
* NetworkProcess/NetworkResourceLoadParameters.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
(WebKit::NetworkResourceLoader::shouldInterruptNavigationForCrossOriginEmbedderPolicy):
(WebKit::NetworkResourceLoader::shouldInterruptWorkerLoadForCrossOriginEmbedderPolicy):
(WebKit::NetworkResourceLoader::didReceiveResponse):
(WebKit::NetworkResourceLoader::willSendRedirectedRequest):
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/PingLoad.cpp:
(WebKit::PingLoad::PingLoad):
(WebKit::PingLoad::initialize):
* NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
(WebKit::ServiceWorkerFetchTask::didReceiveResponse):
* NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp:
(WebKit::ServiceWorkerSoftUpdateLoader::processResponse):
(WebKit::ServiceWorkerSoftUpdateLoader::didFinishLoading):
* NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.h:
* NetworkProcess/cache/CacheStorageEngineCache.cpp:
(WebKit::CacheStorage::Cache::retrieveRecords):
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::addParametersShared):
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
Source/WTF:
Add experimental feature flag for Cross-Origin-Embedder-Policy (COEP), off by default.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
LayoutTests:
Update test expectations now that we support COEP on WK2.
* TestExpectations:
* http/wpt/html/cross-origin-embedder-policy/require-corp.https-expected.txt: Added.
* http/wpt/html/cross-origin-embedder-policy/require-corp.https.html: Added.
* http/wpt/html/cross-origin-embedder-policy/require-corp.https.html.headers: Added.
* platform/mac-wk1/TestExpectations:
* platform/win/TestExpectations:
Canonical link: https://commits.webkit.org/240459@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280953 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228852
Reviewed by Sam Weinig.
Source/WebKit:
* UIProcess/mac/WKTextFinderClient.mm:
(-[WKTextFinderClient findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:]):
Test the deduction guide by writing RetainPtr instead of RetainPtr<NSProgress>.
Source/WTF:
* wtf/RetainPtr.h: Sort includes. Made many functions constexpr including the move
constructors and adoptCF. Use using instead of typedef in most places. Use
remove_pointer_t, conditional_t, is_convertible_v, is_same_v, and other such templates
to simplify expressions. Initialize the m_ptr data member and use the default constructor.
Removed unneeded StorageType synonym for CFTypeRef. Move some inline function bodies out
of the class template definition. Use if constexpr to get rid of the need for the overloaded
autoreleaseHelper function. Added a deduction guide so we can use expressions with the
type RetainPtr on the left side, and an Objective-C pointer or CFTypeRef on the right side,
and have the appropriate RetainPtr type deduced.
Canonical link: https://commits.webkit.org/240458@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280952 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228748
<rdar://problem/81626714>
Reviewed by Chris Dumez.
Source/WebKit:
When suspending ResourceLoadStatistics and LocalStorage, we dispatched a suspend task, which waits on a
condition, to their WorkQueue. That means the queue will be suspended after completing all tasks scheduled
before the suspend task. These tasks may take a long time to complete and assertion may be timed out.
When network process receives PrepareToSuspend message, we want the queues to suspend as soon as possible. To
achieve that, now we check if the queue needs to be suspended before each task, which ensures the queue
execute as most one task after suspend().
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
(WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
(WebKit::ResourceLoadStatisticsStore::workQueue):
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::sharedStatisticsQueue):
(WebKit::WebResourceLoadStatisticsStore::suspend):
(WebKit::WebResourceLoadStatisticsStore::resume):
(WebKit::WTF_GUARDED_BY_LOCK): Deleted.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
(WebKit::LocalStorageDatabase::create):
(WebKit::LocalStorageDatabase::LocalStorageDatabase):
* NetworkProcess/WebStorage/LocalStorageDatabase.h:
* NetworkProcess/WebStorage/LocalStorageNamespace.cpp:
(WebKit::LocalStorageNamespace::getOrCreateStorageArea):
* NetworkProcess/WebStorage/LocalStorageNamespace.h:
* NetworkProcess/WebStorage/SessionStorageNamespace.cpp:
(WebKit::SessionStorageNamespace::getOrCreateStorageArea):
* NetworkProcess/WebStorage/SessionStorageNamespace.h:
* NetworkProcess/WebStorage/StorageArea.cpp:
(WebKit::StorageArea::StorageArea):
* NetworkProcess/WebStorage/StorageArea.h:
* NetworkProcess/WebStorage/StorageManager.cpp:
(WebKit::StorageManager::createLocalStorageArea):
(WebKit::StorageManager::createTransientLocalStorageArea):
(WebKit::StorageManager::createSessionStorageArea):
* NetworkProcess/WebStorage/StorageManager.h:
* NetworkProcess/WebStorage/StorageManagerSet.cpp:
(WebKit::StorageManagerSet::StorageManagerSet):
(WebKit::StorageManagerSet::suspend):
(WebKit::StorageManagerSet::resume):
* NetworkProcess/WebStorage/StorageManagerSet.h:
(WebKit::StorageManagerSet::WTF_GUARDED_BY_LOCK): Deleted.
* NetworkProcess/WebStorage/TransientLocalStorageNamespace.cpp:
(WebKit::TransientLocalStorageNamespace::getOrCreateStorageArea):
* NetworkProcess/WebStorage/TransientLocalStorageNamespace.h:
Source/WTF:
Add SuspendableWorkQueue that would perform suspend check before each task.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Forward.h:
* wtf/SuspendableWorkQueue.cpp: Added.
(WTF::SuspendableWorkQueue::create):
(WTF::SuspendableWorkQueue::SuspendableWorkQueue):
(WTF::SuspendableWorkQueue::suspend):
(WTF::SuspendableWorkQueue::resume):
(WTF::SuspendableWorkQueue::dispatch):
(WTF::SuspendableWorkQueue::dispatchAfter):
(WTF::SuspendableWorkQueue::dispatchSync):
(WTF::SuspendableWorkQueue::invokeAllSuspensionCompletionHandlers):
(WTF::SuspendableWorkQueue::suspendIfNeeded):
* wtf/SuspendableWorkQueue.h: Added.
* wtf/WorkQueue.h:
(): Deleted.
Canonical link: https://commits.webkit.org/240451@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280934 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228931
Reviewed by Mark Lam.
Source/JavaScriptCore:
Right now current debugging code expects that the JS return PC on
the stack is already unsigned. This is not true on arm64e.
This patch now properly unsigns the return PC before passing it to
the ReturnAddressPC constructor.
* assembler/MacroAssemblerCodeRef.h:
(JSC::ReturnAddressPtr::fromTaggedPC):
* interpreter/AbstractPC.cpp:
(JSC::AbstractPC::AbstractPC):
* interpreter/AbstractPC.h:
(JSC::AbstractPC::AbstractPC):
(JSC::AbstractPC::jitReturnAddress const):
* interpreter/CallFrame.h:
(JSC::CallFrame::returnPC const):
Source/WTF:
Add a new helper to untag the return pc from a stack frame.
* wtf/PtrTag.h:
(WTF::untagReturnPC):
Canonical link: https://commits.webkit.org/240399@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280858 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228764
Reviewed by Simon Fraser.
Source/WebKit:
* Platform/Logging.h:
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
(WebKit::setAppleLanguagesPreference):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::setOverrideLanguages):
(WebKit::WebProcessPool::initializeNewWebProcess):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::getLaunchOptions):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::userPreferredLanguagesChanged const):
Source/WTF:
There have been a variety of bug reports over the past months/years about the procedure
by which we determine navigator.language. It's actually somewhat convoluted, so this
patch adds a (debug) log channel for it so we can follow what it's doing easily.
To enable all the logging, run these commands:
% defaults write com.apple.WebKit.WebContent.Development WTFLogging Language
% defaults write com.apple.WebKit.WebContent.Development WebKit2Logging Language
% defaults write com.apple.WebKit.WebContent WTFLogging Language
% defaults write com.apple.WebKit.WebContent WebKit2Logging Language
% defaults write -g WTFLogging Language
% defaults write -g WebKit2Logging Language
% defaults write /Users/$USER/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist WTFLogging Language
% defaults write /Users/$USER/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist WebKit2Logging Language
* wtf/Language.cpp:
(WTF::defaultLanguage):
(WTF::overrideUserPreferredLanguages):
(WTF::userPreferredLanguages):
* wtf/Logging.cpp:
* wtf/Logging.h:
* wtf/cf/LanguageCF.cpp:
(WTF::platformUserPreferredLanguages):
* wtf/cocoa/LanguageCocoa.mm:
(WTF::minimizedLanguagesFromLanguages):
Canonical link: https://commits.webkit.org/240381@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280811 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228809
Reviewed by Fujii Hironori.
Source/WebCore:
No new tests because there is no behavior change.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AXLogger.cpp:
* inspector/agents/page/PageConsoleAgent.cpp:
* page/Page.cpp:
* platform/LogInitialization.cpp: Copied from Source/WebCore/platform/LogInitialization.h.
(WebCore::logChannels):
(WebCore::getLogChannel):
* platform/LogInitialization.h:
* platform/Logging.cpp:
(WebCore::isLogChannelEnabled): Deleted.
(WebCore::setLogChannelToAccumulate): Deleted.
(WebCore::clearAllLogChannelsToAccumulate): Deleted.
(WebCore::initializeLogChannelsIfNecessary): Deleted.
(WebCore::getLogChannel): Deleted.
* platform/Logging.h:
* testing/js/WebCoreTestSupport.cpp:
(WebCoreTestSupport::setLogChannelToAccumulate):
(WebCoreTestSupport::clearAllLogChannelsToAccumulate):
(WebCoreTestSupport::initializeLogChannelsIfNecessary):
Source/WebKit:
* GPUProcess/GPUConnectionToWebProcess.cpp:
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::initializeGPUProcess):
* Platform/LogInitialization.cpp: Copied from Source/WebKit/Shared/WebKit2Initialize.cpp.
(WebKit::logChannels):
(WebKit::getLogChannel):
* Platform/LogInitialization.h:
* Platform/Logging.cpp:
(WebKit::initializeLogChannelsIfNecessary): Deleted.
(WebKit::getLogChannel): Deleted.
* Platform/Logging.h:
* Shared/AuxiliaryProcess.cpp:
(WebKit::AuxiliaryProcess::initialize):
* Shared/WebKit2Initialize.cpp:
(WebKit::InitializeWebKit2):
* Sources.txt:
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebProcessPool.cpp:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Source/WebKitLegacy/mac:
* Misc/WebKitLogInitialization.h: Copied from Source/WebKit/Platform/LogInitialization.h.
* Misc/WebKitLogInitialization.mm: Copied from Source/WebKitLegacy/mac/Misc/WebKitLogging.m.
(WebKit::logChannels):
(ReportDiscardedDelegateException):
* Misc/WebKitLogging.h:
* Misc/WebKitLogging.m:
(ReportDiscardedDelegateException): Deleted.
* WebCoreSupport/WebDragClient.mm:
* WebView/WebDelegateImplementationCaching.mm:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
Source/WTF:
The current infrastructure (before this patch) had the following duplicated for each framework:
- A .cpp file declared the list of logging channels for that framework
- The .cpp file also had algorithms to search, modify, and initialize these logging channels
Each framework's .cpp file had duplicate algorithms. (The initialization algorithm was even
duplicated 3 times!)
Because the algorithms directly name their specific list of logging channels, a naive deduplication
would have had to add new parameters to these algorithms to pass in the appropriate framework's
list. That's fine, but this is exactly the sort of thing classes were designed for - classes are
an association of algorithms and data. The algorithms are shared but the data isn't, which really
just means we should have 3 instances of a shared class - one for the 3 sets of data.
So, this patch creates the LogChannels class which contains the deduplicated algorithms, and each
framework has a NeverDestroyed singleton instance of that class. There is a single virtual method
in the class, so the appropriate "default write" variable can be queried for each framework.
The instances cannot be declared in the Logging.h files in the frameworks, because certain WebKit2
files want to initialize all 3 instances of LogChannels, but you can't #include multiple Logging.h
files at the same time because their LOG_CHANNEL_PREFIX #defines will collide with each other.
Luckily, LogInitialization.h files exist exactly to solve this purpose, so that's where the
LogChannels instances are declared in. After this change, the Logging.h files are just for the
declarations of the logging channels themselves, and the LogInitialization.h files are for the
LogChannels instances which contain the searching/modifying/initializing algorithms on the list of
logging channels. If you just want to LOG(...) something, #include the relevant Logging.h file, and
if you want to search/modify/initialize across the entire list of channels, then #include the
relevant LogInitialization.h file.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/LogChannels.cpp: Copied from Source/WebCore/platform/Logging.cpp.
(WTF::LogChannels::isLogChannelEnabled):
(WTF::LogChannels::setLogChannelToAccumulate):
(WTF::LogChannels::clearAllLogChannelsToAccumulate):
(WTF::LogChannels::initializeLogChannelsIfNecessary):
(WTF::LogChannels::getLogChannel):
* wtf/LogChannels.h: Copied from Source/WebCore/platform/LogInitialization.h.
Canonical link: https://commits.webkit.org/240343@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280758 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228809
Reviewed by Fujii Hironori.
Source/WebCore:
No new tests because there is no behavior change.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AXLogger.cpp:
* inspector/agents/page/PageConsoleAgent.cpp:
* page/Page.cpp:
* platform/LogInitialization.cpp: Copied from Source/WebCore/platform/LogInitialization.h.
(WebCore::logChannels):
(WebCore::getLogChannel):
* platform/LogInitialization.h:
* platform/Logging.cpp:
(WebCore::isLogChannelEnabled): Deleted.
(WebCore::setLogChannelToAccumulate): Deleted.
(WebCore::clearAllLogChannelsToAccumulate): Deleted.
(WebCore::initializeLogChannelsIfNecessary): Deleted.
(WebCore::getLogChannel): Deleted.
* platform/Logging.h:
* testing/js/WebCoreTestSupport.cpp:
(WebCoreTestSupport::setLogChannelToAccumulate):
(WebCoreTestSupport::clearAllLogChannelsToAccumulate):
(WebCoreTestSupport::initializeLogChannelsIfNecessary):
Source/WebKit:
* GPUProcess/GPUConnectionToWebProcess.cpp:
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::initializeGPUProcess):
* Platform/LogInitialization.cpp: Copied from Source/WebKit/Shared/WebKit2Initialize.cpp.
(WebKit::logChannels):
(WebKit::getLogChannel):
* Platform/LogInitialization.h:
* Platform/Logging.cpp:
(WebKit::initializeLogChannelsIfNecessary): Deleted.
(WebKit::getLogChannel): Deleted.
* Platform/Logging.h:
* Shared/AuxiliaryProcess.cpp:
(WebKit::AuxiliaryProcess::initialize):
* Shared/WebKit2Initialize.cpp:
(WebKit::InitializeWebKit2):
* Sources.txt:
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebProcessPool.cpp:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Source/WebKitLegacy/mac:
* Misc/WebKitLogInitialization.h: Copied from Source/WebKit/Platform/LogInitialization.h.
* Misc/WebKitLogInitialization.mm: Copied from Source/WebKitLegacy/mac/Misc/WebKitLogging.m.
(WebKit::logChannels):
(ReportDiscardedDelegateException):
* Misc/WebKitLogging.h:
* Misc/WebKitLogging.m:
(ReportDiscardedDelegateException): Deleted.
* WebCoreSupport/WebDragClient.mm:
* WebView/WebDelegateImplementationCaching.mm:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
Source/WTF:
The current infrastructure (before this patch) had the following duplicated for each framework:
- A .cpp file declared the list of logging channels for that framework
- The .cpp file also had algorithms to search, modify, and initialize these logging channels
Each framework's .cpp file had duplicate algorithms. (The initialization algorithm was even
duplicated 3 times!)
Because the algorithms directly name their specific list of logging channels, a naive deduplication
would have had to add new parameters to these algorithms to pass in the appropriate framework's
list. That's fine, but this is exactly the sort of thing classes were designed for - classes are
an association of algorithms and data. The algorithms are shared but the data isn't, which really
just means we should have 3 instances of a shared class - one for the 3 sets of data.
So, this patch creates the LogChannels class which contains the deduplicated algorithms, and each
framework has a NeverDestroyed singleton instance of that class. There is a single virtual method
in the class, so the appropriate "default write" variable can be queried for each framework.
The instances cannot be declared in the Logging.h files in the frameworks, because certain WebKit2
files want to initialize all 3 instances of LogChannels, but you can't #include multiple Logging.h
files at the same time because their LOG_CHANNEL_PREFIX #defines will collide with each other.
Luckily, LogInitialization.h files exist exactly to solve this purpose, so that's where the
LogChannels instances are declared in. After this change, the Logging.h files are just for the
declarations of the logging channels themselves, and the LogInitialization.h files are for the
LogChannels instances which contain the searching/modifying/initializing algorithms on the list of
logging channels. If you just want to LOG(...) something, #include the relevant Logging.h file, and
if you want to search/modify/initialize across the entire list of channels, then #include the
relevant LogInitialization.h file.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/LogChannels.cpp: Copied from Source/WebCore/platform/Logging.cpp.
(WTF::LogChannels::isLogChannelEnabled):
(WTF::LogChannels::setLogChannelToAccumulate):
(WTF::LogChannels::clearAllLogChannelsToAccumulate):
(WTF::LogChannels::initializeLogChannelsIfNecessary):
(WTF::LogChannels::getLogChannel):
* wtf/LogChannels.h: Copied from Source/WebCore/platform/LogInitialization.h.
Canonical link: https://commits.webkit.org/240341@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280756 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228601
Patch by Michael Catanzaro <mcatanzaro@gnome.org> on 2021-08-05
Reviewed by Carlos Garcia Campos.
.:
Prior to GCC 11, these were good warnings that could catch serious errors. But GCC 11 has
just become too sensitive and it's flagging what appear to be harmless cases, and not
providing enough feedback to know why. This has resulted in me littering our code with
pragmas to suppress GCC's false positives, and I think it's reached the point where it's
nicer to just turn off the warnings until such time that GCC gets this under control, and
rely on Clang instead in the meantime.
The GCC developers have indicated that these warnings will *always* produce false positives
in some circumstances, but with GCC 11 it's just too become too much IMO.
* Source/cmake/WebKitCompilerFlags.cmake:
Source/JavaScriptCore:
* b3/air/AirAllocateRegistersByGraphColoring.cpp:
* jit/JITCall.cpp:
(JSC::JIT::compileOpCall):
Source/WebCore:
* css/CSSValue.h:
(WebCore::CSSValue::deref):
* css/StyleRule.h:
(WebCore::StyleRuleBase::deref const):
* dom/Node.h:
(WebCore::Node::deref const):
Source/WebKit:
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::Stream::~Stream):
Source/WTF:
* wtf/Bitmap.h:
(WTF::WordType>::clear):
* wtf/Compiler.h:
* wtf/Packed.h:
(WTF::PackedAlignedPtr::get const):
* wtf/RefPtr.h:
(WTF::DefaultRefDerefTraits::derefIfNotNull):
Canonical link: https://commits.webkit.org/240291@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280689 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228766
Reviewed by Simon Fraser.
Source/WTF:
Instead of using -[NSArray description], which puts its output on multiple lines,
instead use the same formatting as WTF::Vector, which puts its output on a single line.
We can also use this opportunity to tweak the implementation of operator<<(id) to
allow it to be called with Core Foundation types in raw C++ code.
* wtf/text/TextStream.h:
* wtf/text/cocoa/TextStreamCocoa.mm:
(WTF::TextStream::operator<<):
Tools:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/cocoa/TextStreamCocoa.cpp: Added.
(TEST):
* TestWebKitAPI/Tests/WTF/cocoa/TextStreamCocoa.mm: Added.
(TEST):
Canonical link: https://commits.webkit.org/240262@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280651 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=227164
Reviewed by Geoffrey Garen.
Source/WTF:
Like r278344, this patch introduces a new type of smart pointer, CheckedRef,
which lets each object keep track of pointers pointing to the object.
As with CheckedPtr, the purpose of the internal counter for CheckedRef is
to release assert that there is no outstanding pointer at the time of destruction
instead of keeping the object alive when there is one.
This patch also removes makeCheckedPtr in favor of using CheckedPtr with
template argument deduction in C++17.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/CheckedPtr.h:
(WTF::CheckedPtr::CheckedPtr): Added variants which take CheckedRef as arguments.
(WTF::makeCheckedPtr): Deleted.
(WTF::CanMakeCheckedPtr): Moved to CheckedRef.h
* wtf/CheckedRef.h: Added.
(WTF::CheckedRef::~CheckedRef): Added.
(WTF::CheckedRef::CheckedRef): Added.
(WTF::CheckedRef::isHashTableDeletedValue const): Added.
(WTF::CheckedRef::isHashTableEmptyValue const): Added.
(WTF::CheckedRef::hashTableEmptyValue): Added.
(WTF::CheckedRef::ptrAllowingHashTableEmptyValue const): Added.
(WTF::CheckedRef::ptrAllowingHashTableEmptyValue): Added.
(WTF::CheckedRef::ptr const): Added.
(WTF::CheckedRef::ptr): Added.
(WTF::CheckedRef::get const): Added.
(WTF::CheckedRef::get): Added.
(WTF::CheckedRef::operator-> const): Added.
(WTF::CheckedRef::operator->): Added.
(WTF::CheckedRef::operator const T& const): Added.
(WTF::CheckedRef::operator T&): Added.
(WTF::CheckedRef::operator! const): Added.
(WTF::CheckedRef::operator=): Added.
(WTF::CheckedRef::releasePtr): Added. Returns m_ptr without calling decrementPtrCount.
This is equivalent of leakPtr in Ref but we don't call this that since CheckedRef or
CheckedPtr is generally not used to manage the object lifetime.
(WTF::CheckedRef::poison): Added.
(WTF::CheckedRef::unpoison): Added.
(WTF::is): Added.
(WTF::CheckedRefHashTraits): Added.
(WTF::CheckedRefHashTraits::emptyValue): Added.
(WTF::CheckedRefHashTraits::constructEmptyValue): Added.
(WTF::CheckedRefHashTraits::isEmptyValue): Added.
(WTF::CheckedRefHashTraits::peek): Added.
(WTF::CheckedRefHashTraits::take): Added.
(WTF::CanMakeCheckedPtr): Moved from CheckedPtr.h
* wtf/Forward.h:
Tools:
Added some unit tests for CheckedRef and updated the unit tests
for CheckedPtr per the removal of makeCheckedPtr.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/CheckedPtr.cpp:
(WTF_CheckedPtr.CheckedRef): Added
* TestWebKitAPI/Tests/WTF/CheckedRef.cpp: Added.
(TestWebKitAPI..CheckedObject): Added.
(TestWebKitAPI..DerivedCheckedObject): Added.
(WTF_CheckedRef.Basic): Added.
(WTF_CheckedRef.DerivedClass): Added.
(WTF_CheckedRef.HashSet): Added.
Canonical link: https://commits.webkit.org/240183@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280559 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228676
Reviewed by Saam Barati.
Source/JavaScriptCore:
We observed that using Bitmap instead of ByteVector does not pose performance
issue. It was neutral in jquery-todomvc-regexp.js. In that case, we should use
Bitmap since it is 8x smaller.
We also search reusable Bitmap from Vector since comparing 128bit Bitmap is
super fast so we do not need to bother about linear search here (# of Bitmap
is currently up to 4).
To make code simplified, we add regT2 to ARMv7 and MIPS backend of YarrJIT.
ToT Patched
jquery-todomvc-regexp 555.9566+-0.8856 555.0737+-0.9717
* yarr/YarrJIT.cpp:
(JSC::Yarr::BoyerMooreInfo::index const): Deleted.
(JSC::Yarr::BoyerMooreInfo::setIndex): Deleted.
* yarr/YarrJIT.h:
(JSC::Yarr::YarrCodeBlock::set8BitCode):
(JSC::Yarr::YarrCodeBlock::set16BitCode):
(JSC::Yarr::YarrCodeBlock::set8BitCodeMatchOnly):
(JSC::Yarr::YarrCodeBlock::set16BitCodeMatchOnly):
(JSC::Yarr::YarrCodeBlock::tryReuseBoyerMooreBitmap const):
(JSC::Yarr::BoyerMooreByteVector::BoyerMooreByteVector): Deleted.
(JSC::Yarr::YarrCodeBlock::tryReuseBoyerMooreByteVector const): Deleted.
Source/WTF:
* wtf/Bitmap.h:
Canonical link: https://commits.webkit.org/240171@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=198230
Patch by Rob Buis <rbuis@igalia.com> on 2021-07-30
Reviewed by Simon Fraser.
LayoutTests/imported/w3c:
* web-platform-tests/css/css-overflow/overflow-clip-hit-testing-expected.txt: Added.
* web-platform-tests/css/css-overflow/overflow-clip-scroll-size-expected.txt: Added.
* web-platform-tests/css/css-overflow/parsing/overflow-computed-expected.txt:
* web-platform-tests/css/css-overflow/parsing/overflow-valid-expected.txt:
Source/WebCore:
Implement overflow: clip. Parsing is like the other
overflow values but special logic is added to handle
the case where only one of overflow-x/overflow-y uses
'clip' [1]. Also adjusts code that computes layout and
visual overflow to take overflow: clip into account.
This matches Chrome and Firefox.
[1] https://drafts.csswg.org/css-overflow/#propdef-overflow-x
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator Overflow const):
* css/CSSProperties.json:
* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
(WebCore::add):
* css/parser/CSSParserContext.h:
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
* page/FrameView.cpp: handle scrollbars
on viewport element same as overflow: hidden.
(WebCore::FrameView::applyOverflowToViewport):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::updateFromStyle):
(WebCore::RenderBox::scrollWidth const): overflow clip
forbids all scrolling.
(WebCore::RenderBox::scrollHeight const): Ditto.
(WebCore::RenderBox::setScrollLeft): Ditto.
(WebCore::RenderBox::setScrollTop): Ditto.
(WebCore::RenderBox::setScrollPosition): Ditto.
(WebCore::RenderBox::requiresLayerWithScrollableArea const): do
not create layer with scrollable area for overflow: clip.
(WebCore::RenderBox::canBeProgramaticallyScrolled const): overflow clip
forbids all scrolling.
(WebCore::RenderBox::scrollPosition const): overflow clip
forbids all scrolling.
(WebCore::RenderBox::overflowClipRect const): only clip the rect horizontally
for overflow-x: clip and only vertically for overflow-y: clip.
(WebCore::RenderBox::createsNewFormattingContext const): do
not create formatting context for overflow: clip.
(WebCore::RenderBox::addOverflowFromChild):
(WebCore::RenderBox::addLayoutOverflow):
(WebCore::RenderBox::layoutOverflowRectForPropagation const):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::enclosingScrollableContainerForSnapping const):
* rendering/RenderObject.h: Add helper method that excludes overflow-x/y: clip.
(WebCore::RenderObject::hasPotentiallyScrollableOverflow const):
* rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<):
* rendering/style/RenderStyleConstants.h:
* style/StyleAdjuster.cpp: Add special logic is to handle the case where only
one of overflow-x/overflow-y uses 'clip'.
(WebCore::Style::Adjuster::adjust const):
Source/WTF:
Add preference for overflow: clip support.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
LayoutTests:
* TestExpectations:
Canonical link: https://commits.webkit.org/240141@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280509 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=192193
<rdar://problem/42013525>
Reviewed by Geoff Garen.
LayoutTests/imported/w3c:
Rebaseline WPT tests now that most tests are passing.
* web-platform-tests/IndexedDB/serialize-sharedarraybuffer-throws.https-expected.txt:
* web-platform-tests/html/cross-origin-embedder-policy/cross-origin-isolated-permission.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/blob-popup.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/coep-blob-popup.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/coep-navigate-popup.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/coep-redirect.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/coep.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/coop-coep-sandbox.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/coop-csp-sandbox-navigate.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/coop-csp-sandbox.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/coop-navigated-history-popup.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/coop-navigated-popup.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/coop-sandbox.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/header-parsing.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/historical/coep-navigate-popup-unsafe-inherit.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/historical/popup-same-origin-unsafe-allow-outgoing-with-cross-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/historical/popup-same-origin-unsafe-allow-outgoing-with-same-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/historical/popup-same-origin-unsafe-allow-outgoing-with-same-site.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/historical/popup-same-site-unsafe-allow-outgoing-with-cross-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/historical/popup-same-site-unsafe-allow-outgoing-with-same-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/historical/popup-same-site-unsafe-allow-outgoing-with-same-site.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/historical/popup-same-site-with-cross-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/historical/popup-same-site-with-same-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/historical/popup-same-site-with-same-site.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/iframe-popup-same-origin-allow-popups-to-same-origin-allow-popups.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/iframe-popup-same-origin-allow-popups-to-same-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/iframe-popup-same-origin-to-same-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/iframe-popup-same-origin-to-unsafe-none.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/iframe-popup-unsafe-none-to-same-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/javascript-url.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/navigate-to-aboutblank.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/no-https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/popup-coop-by-sw-from-coop.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/popup-coop-by-sw.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/popup-redirect-cache.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/popup-redirect-same-origin-allow-popups.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/popup-same-origin-allow-popups-with-cross-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/popup-same-origin-allow-popups-with-same-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/popup-same-origin-allow-popups-with-same-site.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/popup-same-origin-with-cross-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/popup-same-origin-with-same-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/popup-same-origin-with-same-site.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/popup-unsafe-none-with-cross-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/popup-unsafe-none-with-same-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/popup-unsafe-none-with-same-site.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/popup-unspecified-with-cross-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/popup-unspecified-with-same-origin.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/popup-unspecified-with-same-site.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/popup-with-structured-header.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/resource-popup.https-expected.txt:
* web-platform-tests/html/cross-origin-opener-policy/resources/resource-popup.html:
* web-platform-tests/html/dom/idlharness.worker-expected.txt:
Source/WebCore:
Add initial support for 'Cross-Origin-Opener-Policy' HTTP header:
- https://html.spec.whatwg.org/multipage/origin.html#cross-origin-opener-policy-value
Support is complete enough to pass most WPT tests with the exception of:
- The ones involving blob. Support for Blob does not seem trivial so I will address
separately (https://github.com/whatwg/html/issues/5198).
- The ones that requires reporting COOP enforcement as this is not supported yet.
This is a fairly large task so I'll handle separately.
- The ones that involve Cross-Origin-Embedder-Policy (COEP) and this is not yet
supported.
I tried to stay as close as possible to the HTML specification as possible in terms
of structuring and naming. I also have code comments to link to the relevant HTML
spec sections.
Note that as it stands, we do not currently swap process based on COOP header. We
merely do isolation of the new browsing context at JS level for now. At some point,
we'll want to actually process-swap, once we support COEP and we want to re-enable
some Web APIs such as SharedArrayBuffer.
No new tests, covered by web-plaform-tests/html/cross-origin-opener-policy.
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* dom/Document.cpp:
(WebCore::Document::initSecurityContext):
(WebCore::Document::shouldForceNoOpenerBasedOnCOOP const):
(WebCore::Document::crossOriginOpenerPolicy const):
(WebCore::Document::setCrossOriginOpenerPolicy):
* dom/Document.h:
(WebCore::Document::isSameOriginAsTopDocument const):
* dom/SecurityContext.cpp:
(WebCore::SecurityContext::enforceSandboxFlags):
* dom/SecurityContext.h:
(WebCore::SecurityContext::creationSandboxFlags const):
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::openURLExternally):
* loader/CrossOriginEmbedderPolicy.cpp: Copied from Source/WebCore/page/AbstractFrame.cpp.
(WebCore::obtainCrossOriginEmbedderPolicy):
* loader/CrossOriginEmbedderPolicy.h: Copied from Source/WebCore/page/AbstractFrame.cpp.
* loader/CrossOriginOpenerPolicy.cpp: Added.
(WebCore::obtainCrossOriginOpenerPolicy):
* loader/CrossOriginOpenerPolicy.h: Copied from Source/WebCore/page/AbstractFrame.h.
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::willSendRequest):
(WebCore::checkIfCOOPValuesRequireBrowsingContextGroupSwitch):
(WebCore::computeResponseOriginAndCOOP):
(WebCore::DocumentLoader::doCrossOriginOpenerHandlingOfResponse):
(WebCore::DocumentLoader::enforceResponseCrossOriginOpenerPolicy):
(WebCore::DocumentLoader::responseReceived):
(WebCore::DocumentLoader::maybeLoadEmpty):
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::crossOriginOpenerPolicy const):
* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::begin):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didBeginDocument):
(WebCore::FrameLoader::setOpener):
(WebCore::FrameLoader::loadURL):
(WebCore::FrameLoader::loadPostRequest):
(WebCore::createWindow):
(WebCore::FrameLoader::switchBrowsingContextsGroup):
* loader/FrameLoader.h:
* loader/NavigationAction.cpp:
* loader/NavigationAction.h:
(WebCore::NavigationAction::Requester::securityOrigin const):
(WebCore::NavigationAction::Requester::topOrigin const):
(WebCore::NavigationAction::Requester::crossOriginOpenerPolicy const):
* page/AbstractFrame.cpp:
(WebCore::AbstractFrame::resetWindowProxy):
* page/AbstractFrame.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::crossOriginIsolated const):
(WebCore::DOMWindow::createWindow):
* page/DOMWindow.h:
* page/Frame.cpp:
(WebCore::Frame::resetScript):
* page/Frame.h:
* page/Page.h:
(WebCore::Page::setOpenedByDOMWithOpener):
* page/WindowOrWorkerGlobalScope.idl:
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::applyPolicyToScriptExecutionContext):
* platform/network/HTTPHeaderNames.in:
* platform/network/HTTPParsers.cpp:
(WebCore::parseStructuredFieldValue):
* platform/network/HTTPParsers.h:
* platform/network/ResourceResponseBase.cpp:
(WebCore::isSafeRedirectionResponseHeader):
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::crossOriginIsolated const):
* workers/WorkerGlobalScope.h:
Source/WTF:
Add experimental feature flag for 'Cross-Origin-Opener-Policy' HTTP header
support.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
LayoutTests:
Update test expectations.
* TestExpectations:
* platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* platform/mac-wk2/TestExpectations:
* platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* platform/mac/TestExpectations:
Canonical link: https://commits.webkit.org/240136@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228599
<rdar://problem/81190366>
Reviewed by Andy Estes.
Source/WebCore:
r275169 made it so that `paymentMethodType` is no longer `required` so that `additionalShippingMethods`
can be specified without having to limit it to a specific payment method type. While this
works in theory, WebKit doesn't know about the user's selected payment method type until the
user actually selects a payment method, meaning that until then the `additionalShippingMethods`
are not used. Unfortunately (until now) `PKPaymentRequestPaymentMethodUpdate` did not
support providing a `NSArray<PKShippingMethod *> *`, so there was no way to update the list
of shipping methods when the user changed their selected payment method, meaning that WebKit
would have to wait/rely on the user to change their shipping address _after_ selecting a
payment method in order for `additionalShippingMethods` to take effect.
This also fixes an issue with WebKit's implementation of the W3C Payment Request API by
allowing any generic (i.e. things not specific to Apple Pay) `shippingOptions` provided in
`PaymentDetailsUpdate` to actually be used and update the Apple Pay sheet accordingly.
Test: http/tests/paymentrequest/ApplePayModifier-paymentMethodType.https.html
* Modules/applepay/ApplePayModifier.idl:
* Modules/applepay/ApplePayModifier.h:
* Modules/applepay/ApplePayPaymentMethodUpdate.idl:
* Modules/applepay/ApplePayPaymentMethodUpdate.h:
(WebCore::ApplePayPaymentMethodUpdate::encode const):
(WebCore::ApplePayPaymentMethodUpdate::decode):
* Modules/applepay/ApplePayShippingMethodUpdate.idl:
* Modules/applepay/ApplePayShippingMethodUpdate.h:
(WebCore::ApplePayShippingMethodUpdate::encode const):
(WebCore::ApplePayShippingMethodUpdate::decode):
Add (or wrap existing) `additionalShippingMethods`/`newShippingMethods` properties.
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
(WebCore::ApplePayPaymentHandler::computeShippingMethods):
(WebCore::ApplePayPaymentHandler::detailsUpdated):
(WebCore::ApplePayPaymentHandler::shippingOptionUpdated):
(WebCore::ApplePayPaymentHandler::paymentMethodUpdated):
Also call `computeShippingMethods()` and add the result to the update.
* testing/MockPaymentCoordinator.cpp:
(WebCore::MockPaymentCoordinator::completeShippingMethodSelection):
(WebCore::MockPaymentCoordinator::completeShippingContactSelection):
(WebCore::MockPaymentCoordinator::completePaymentMethodSelection):
(WebCore::MockPaymentCoordinator::completeCouponCodeChange):
Support for testing.
Source/WebCore/PAL:
r275169 made it so that `paymentMethodType` is no longer `required` so that `additionalShippingMethods`
can be specified without having to limit it to a specific payment method type. While this
works in theory, WebKit doesn't know about the user's selected payment method type until the
user actually selects a payment method, meaning that until then the `additionalShippingMethods`
are not used. Unfortunately (until now) `PKPaymentRequestPaymentMethodUpdate` did not
support providing a `NSArray<PKShippingMethod *> *`, so there was no way to update the list
of shipping methods when the user changed their selected payment method, meaning that WebKit
would have to wait/rely on the user to change their shipping address _after_ selecting a
payment method in order for `additionalShippingMethods` to take effect.
This also fixes an issue with WebKit's implementation of the W3C Payment Request API by
allowing any generic (i.e. things not specific to Apple Pay) `shippingOptions` provided in
`PaymentDetailsUpdate` to actually be used and update the Apple Pay sheet accordingly.
* pal/spi/cocoa/PassKitSPI.h:
- add the new `shippingMethods` property on `PKPaymentRequestUpdate`
- add the existing `errors` property on `PKPaymentRequestPaymentMethodUpdate`
Source/WebKit:
r275169 made it so that `paymentMethodType` is no longer `required` so that `additionalShippingMethods`
can be specified without having to limit it to a specific payment method type. While this
works in theory, WebKit doesn't know about the user's selected payment method type until the
user actually selects a payment method, meaning that until then the `additionalShippingMethods`
are not used. Unfortunately (until now) `PKPaymentRequestPaymentMethodUpdate` did not
support providing a `NSArray<PKShippingMethod *> *`, so there was no way to update the list
of shipping methods when the user changed their selected payment method, meaning that WebKit
would have to wait/rely on the user to change their shipping address _after_ selecting a
payment method in order for `additionalShippingMethods` to take effect.
This also fixes an issue with WebKit's implementation of the W3C Payment Request API by
allowing any generic (i.e. things not specific to Apple Pay) `shippingOptions` provided in
`PaymentDetailsUpdate` to actually be used and update the Apple Pay sheet accordingly.
* Platform/cocoa/PaymentAuthorizationPresenter.mm:
(WebKit::PaymentAuthorizationPresenter::completePaymentMethodSelection):
(WebKit::PaymentAuthorizationPresenter::completeShippingMethodSelection):
Also convert and set the `shippingMethods` on the update.
Source/WTF:
r275169 made it so that `paymentMethodType` is no longer `required` so that `additionalShippingMethods`
can be specified without having to limit it to a specific payment method type. While this
works in theory, WebKit doesn't know about the user's selected payment method type until the
user actually selects a payment method, meaning that until then the `additionalShippingMethods`
are not used. Unfortunately (until now) `PKPaymentRequestPaymentMethodUpdate` did not
support providing a `NSArray<PKShippingMethod *> *`, so there was no way to update the list
of shipping methods when the user changed their selected payment method, meaning that WebKit
would have to wait/rely on the user to change their shipping address _after_ selecting a
payment method in order for `additionalShippingMethods` to take effect.
This also fixes an issue with WebKit's implementation of the W3C Payment Request API by
allowing any generic (i.e. things not specific to Apple Pay) `shippingOptions` provided in
`PaymentDetailsUpdate` to actually be used and update the Apple Pay sheet accordingly.
* wtf/PlatformHave.h:
* wtf/PlatformEnableCocoa.h:
Add new compile flags for PassKit supporting modifying shipping methods with any update.
LayoutTests:
* http/tests/paymentrequest/ApplePayModifier-paymentMethodType.https.html: Added.
* http/tests/paymentrequest/ApplePayModifier-paymentMethodType.https-expected.txt: Added.
* platform/ios-14-wk2/TestExpectations:
* platform/mac-bigsur-wk2/TestExpectations: Added.
Skip on older macOS/iOS since they don't support modifying shipping methods with any update.
Canonical link: https://commits.webkit.org/240094@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280459 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228301
Reviewed by Saam Barati.
JSTests:
* microbenchmarks/jquery-todomvc-regexp.js:
* stress/regexp--bm-search-long-character.js: Added.
(shouldBe):
* stress/regexp--bm-search-long-map.js: Added.
(shouldBe):
* stress/regexp-bitvector-reuse.js: Added.
(shouldBe):
* stress/regexp-non-ascii-bm-search-character.js: Added.
(shouldBe):
* stress/regexp-non-ascii-bm-search-map.js: Added.
(shouldBe):
Source/JavaScriptCore:
This patch emits skipping fast-path at the beginning of body alternatives with a large stride. So we can quickly discard unrelated characters
and attempt to find possibly related sequence in the long sequence. The method is derived from V8's implementation (with some extensions).
If we have a searching pattern /abcdef/, then we can check the 6th character against a set of {a, b, c, d, e, f}.
If it does not match, we can shift 6 characters. We use this strategy since this way can be extended easily to support
disjunction, character-class, and ignore-cases. For example, in the case of /(?:abc|def)/, we can check 3rd character
against {a, b, c, d, e, f} and shift 3 characters if it does not match.
Then, the best way to perform the above shifting is that finding the longest character sequence which does not have
many candidates. In the case of /[a-z]aaaaaaa[a-z]/, we can extract "aaaaaaa" sequence and check 8th character against {a}.
If it does not match, then we can shift 7 characters (length of "aaaaaaa"). This shifting is better than using "[a-z]aaaaaaa[a-z]"
sequence and {a-z} set since {a-z} set will almost always match.
We first collect possible characters for each character position. Then, apply heuristics to extract good character sequence from
that and construct fast searching with long stride.
Microbenchmark which performs RegExp ops in Speedometer2/jQuery-TodoMVC shows 25% improvement.
ToT Patched
jquery-todomvc-regexp 723.9739+-1.3997 ^ 579.1698+-1.2505 ^ definitely 1.2500x faster
This improves Speedometer2/jQuery-TodoMVC by 3%.
----------------------------------------------------------------------------------------------------------------------------------
| subtest | ms | ms | b / a | pValue (significance using False Discovery Rate) |
----------------------------------------------------------------------------------------------------------------------------------
| Elm-TodoMVC |123.365625 |123.456250 |1.000735 | 0.804077 |
| VueJS-TodoMVC |26.912500 |26.925000 |1.000464 | 0.969603 |
| EmberJS-TodoMVC |127.540625 |127.562500 |1.000172 | 0.960474 |
| BackboneJS-TodoMVC |50.606250 |50.518750 |0.998271 | 0.670313 |
| Preact-TodoMVC |21.018750 |20.850000 |0.991971 | 0.563818 |
| AngularJS-TodoMVC |136.943750 |137.271875 |1.002396 | 0.531513 |
| Vanilla-ES2015-TodoMVC |68.521875 |68.593750 |1.001049 | 0.701376 |
| Inferno-TodoMVC |65.559375 |65.803125 |1.003718 | 0.414418 |
| Flight-TodoMVC |77.284375 |76.715625 |0.992641 | 0.219870 |
| Angular2-TypeScript-TodoMVC |40.725000 |40.318750 |0.990025 | 0.281212 |
| VanillaJS-TodoMVC |55.209375 |54.715625 |0.991057 | 0.056921 |
| jQuery-TodoMVC |266.396875 |258.471875 |0.970251 | 0.000000 (significant) |
| EmberJS-Debug-TodoMVC |341.550000 |341.856250 |1.000897 | 0.618140 |
| React-TodoMVC |88.731250 |88.871875 |1.001585 | 0.512407 |
| React-Redux-TodoMVC |150.340625 |150.065625 |0.998171 | 0.412940 |
| Vanilla-ES2015-Babel-Webpack-TodoMVC |65.390625 |65.362500 |0.999570 | 0.834760 |
----------------------------------------------------------------------------------------------------------------------------------
a mean = 245.96997
b mean = 246.86366
pValue = 0.0061448402
(Bigger means are better.)
1.004 times better
Results ARE significant
* runtime/OptionsList.h:
* yarr/YarrJIT.cpp:
(JSC::Yarr::BoyerMooreInfo::BoyerMooreInfo):
(JSC::Yarr::BoyerMooreInfo::length const):
(JSC::Yarr::BoyerMooreInfo::set):
(JSC::Yarr::BoyerMooreInfo::index const):
(JSC::Yarr::BoyerMooreInfo::setIndex):
(JSC::Yarr::BoyerMooreInfo::create):
(JSC::Yarr::BoyerMooreInfo::findBestCharacterSequence const):
(JSC::Yarr::BoyerMooreInfo::findWorthwhileCharacterSequenceForLookahead const):
(JSC::Yarr::BoyerMooreInfo::createCandidateBitmap const):
* yarr/YarrJIT.h:
(JSC::Yarr::BoyerMooreBitmap::count const):
(JSC::Yarr::BoyerMooreBitmap::map const):
(JSC::Yarr::BoyerMooreBitmap::isMaskEffective const):
(JSC::Yarr::BoyerMooreBitmap::add):
(JSC::Yarr::BoyerMooreByteVector::BoyerMooreByteVector):
(JSC::Yarr::YarrCodeBlock::set8BitCode):
(JSC::Yarr::YarrCodeBlock::set16BitCode):
(JSC::Yarr::YarrCodeBlock::set8BitCodeMatchOnly):
(JSC::Yarr::YarrCodeBlock::set16BitCodeMatchOnly):
(JSC::Yarr::YarrCodeBlock::clear):
(JSC::Yarr::YarrCodeBlock::findSameVector const):
Source/WTF:
* wtf/BitVector.cpp:
(WTF::BitVector::dump const):
* wtf/Bitmap.h:
(WTF::WordType>::dump const):
* wtf/UniqueRef.h:
(WTF::makeUniqueRefFromNonNullUniquePtr):
(WTF::UniqueRef::UniqueRef):
Canonical link: https://commits.webkit.org/240087@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280452 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=228116
<rdar://problem/80693607>
Patch by Brent Fulgham.
Patch by Kate Cheney <katherine_cheney@apple.com> on 2021-07-29
Reviewed by Per Arne Vollan.
Source/WebKit:
We should not be using the PAC key to confirm a valid WebContent process is the source of
WebAuthn-related messages. Instead, we should confirm the message source is an Apple-signed
executable, and that the signining identity is for the WebContent process.
* Shared/Cocoa/CodeSigning.h: Renamed from Source/WebKit/Shared/mac/CodeSigning.h.
* Shared/Cocoa/CodeSigning.mm: Renamed from Source/WebKit/Shared/mac/CodeSigning.mm.
(WebKit::codeSigningIdentifier):
(WebKit::codeSigningIdentifierForCurrentProcess):
(WebKit::currentProcessIsPlatformBinary):
(WebKit::codeSigningIdentifierAndPlatformBinaryStatus):
* Shared/Cocoa/XPCEndpoint.mm:
(WebKit::XPCEndpoint::XPCEndpoint):
* SourcesCocoa.txt:
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::messageSourceIsValidWebContentProcess):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::getWebAuthnProcessConnection):
* UIProcess/WebProcessProxy.h:
* UIProcess/mac/WebProcessProxyMac.mm:
* WebKit.xcodeproj/project.pbxproj:
Source/WTF:
Add new SPI header for code signing features.
* WTF.xcodeproj/project.pbxproj:
* wtf/spi/cocoa/SecuritySPI.h:
* wtf/spi/darwin/CodeSignSPI.h: Added.
Canonical link: https://commits.webkit.org/240086@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280451 268f45cc-cd09-0410-ab3c-d52691b4dbfc
<https://webkit.org/b/228066>
<rdar://problem/80577312>
Patch by David Kilzer.
Patch by Kate Cheney <katherine_cheney@apple.com> on 2021-07-29
Reviewed by David Kilzer.
Source/WebCore:
* platform/mac/PlatformSpeechSynthesizerMac.mm:
(WebCore::speechSynthesisGetDefaultVoiceIdentifierForLocale):
- Switch to use
CopyIdentifierStringForPreferredVoiceInListWithLocale()
in Monterey.
- Change to return RetainPtr<> to handle lifetime of
object returned from new function.
(WebCore::PlatformSpeechSynthesizer::initializeVoiceList):
- Change varible type to 'auto' since return type of
speechSynthesisGetDefaultVoiceIdentifierForLocale()
changed.
Source/WebCore/PAL:
* pal/spi/mac/SpeechSynthesisSPI.h:
* pal/spi/mac/SpeechSynthesisSPI.h:
(CopyIdentifierStringForPreferredVoiceInListWithLocale): Add.
- Define replacement function for
GetIdentifierStringForPreferredVoiceInListWithLocale()
in Monterey.
Source/WTF:
* wtf/PlatformHave.h:
- Add HAVE(SPEECHSYNTHESIS_MONTEREY_SPI).
Canonical link: https://commits.webkit.org/240079@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280441 268f45cc-cd09-0410-ab3c-d52691b4dbfc