From 1570af4ee8a3bf2203a124965d1a5e94b66454b5 Mon Sep 17 00:00:00 2001 From: Amol Virnodkar Date: Tue, 23 Jul 2024 19:40:26 +0530 Subject: [PATCH 1/2] =?UTF-8?q?ONEM-35907=20:=20[WPE2.38]=20-=20Tetris=20a?= =?UTF-8?q?pp=20shows=20black=20screen=20while=20opening=20ARRISEOS-45743?= =?UTF-8?q?=20:=20[WPE2.38][RDK16]=20Sometimes=20set=20URL=20from=20Thunde?= =?UTF-8?q?r=20fails.=E2=80=8B=E2=80=8B=E2=80=8B=E2=80=8B=E2=80=8B?= =?UTF-8?q?=E2=80=8B=E2=80=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstream ticket: https://github.com/WebPlatformForEmbedded/WPEWebKit/issues/1334 Patch from upstream: https://github.com/WebPlatformForEmbedded/WPEWebKit/commit/620bf81ccc14b76ff61c6c40a389a5b754fced1b --- Source/WebCore/loader/FrameLoader.cpp | 45 ++++++++++++++++----------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp index 55d4f50ec2360..1323de47ece5d 100644 --- a/Source/WebCore/loader/FrameLoader.cpp +++ b/Source/WebCore/loader/FrameLoader.cpp @@ -1349,23 +1349,6 @@ void FrameLoader::loadURL(FrameLoadRequest&& frameLoadRequest, const String& ref if (m_inStopAllLoaders || m_inClearProvisionalLoadForPolicyCheck) return; - static bool keepNavigationOnFragmentLoad = false; - static bool keepNavigationOnFragmentLoadInitialized = false; - - if (!keepNavigationOnFragmentLoadInitialized) { - keepNavigationOnFragmentLoad = !!getenv("WPE_KEEP_NAVIGATION_ON_FRAGMENT_LOAD"); - keepNavigationOnFragmentLoadInitialized = true; - } - - // If we have a policy or provisional request for a different document, a fragment scroll should be cancelled. - if (keepNavigationOnFragmentLoad && (m_policyDocumentLoader && !equalIgnoringFragmentIdentifier(m_policyDocumentLoader->request().url(), frameLoadRequest.resourceRequest().url()) || - m_provisionalDocumentLoader && !equalIgnoringFragmentIdentifier(m_provisionalDocumentLoader->request().url(), frameLoadRequest.resourceRequest().url()))) { - const auto fragmentNavigationURL = frameLoadRequest.resourceRequest().url(); - const auto navigationURL = m_policyDocumentLoader ? m_policyDocumentLoader->request().url(): m_provisionalDocumentLoader->request().url(); - FRAMELOADER_RELEASE_LOG(ResourceLoading, "loadURL: fragment navigation: %s is cancelled because of ongoing navigation change to url: %s", fragmentNavigationURL.string().utf8().data(), navigationURL.string().utf8().data()); - return; - } - Ref protect(m_frame); // Anchor target is ignored when the download attribute is set since it will download the hyperlink rather than follow it. @@ -1427,14 +1410,40 @@ void FrameLoader::loadURL(FrameLoadRequest&& frameLoadRequest, const String& ref // exactly the same so pages with '#' links and DHTML side effects // work properly. if (shouldPerformFragmentNavigation(isFormSubmission, httpMethod, newLoadType, newURL)) { + + static bool keepNavigationOnFragmentLoad = false; + static bool keepNavigationOnFragmentLoadInitialized = false; + + if (!keepNavigationOnFragmentLoadInitialized) { + keepNavigationOnFragmentLoad = !!getenv("WPE_KEEP_NAVIGATION_ON_FRAGMENT_LOAD"); + keepNavigationOnFragmentLoadInitialized = true; + } + oldDocumentLoader->setTriggeringAction(WTFMove(action)); oldDocumentLoader->setLastCheckedRequest(ResourceRequest()); - policyChecker().stopCheck(); + auto loadType = policyChecker().loadType(); + bool resetLoadTypeAfterFragmentNavigation = false; + if (keepNavigationOnFragmentLoad && (m_policyDocumentLoader && !equalIgnoringFragmentIdentifier(m_policyDocumentLoader->request().url(), frameLoadRequest.resourceRequest().url()) || + m_provisionalDocumentLoader && !equalIgnoringFragmentIdentifier(m_provisionalDocumentLoader->request().url(), frameLoadRequest.resourceRequest().url()))) { + resetLoadTypeAfterFragmentNavigation = true; + + const auto fragmentNavigationURL = frameLoadRequest.resourceRequest().url(); + const auto navigationURL = m_policyDocumentLoader ? m_policyDocumentLoader->request().url(): m_provisionalDocumentLoader->request().url(); + FRAMELOADER_RELEASE_LOG(ResourceLoading, "loadURL: navigation to: %s will be continued after fragment navigation to url: %s", + navigationURL.string().utf8().data(), fragmentNavigationURL.string().utf8().data()); + } else { + policyChecker().stopCheck(); + } + policyChecker().setLoadType(newLoadType); RELEASE_ASSERT(!isBackForwardLoadType(newLoadType) || history().provisionalItem()); policyChecker().checkNavigationPolicy(WTFMove(request), ResourceResponse { } /* redirectResponse */, oldDocumentLoader.get(), WTFMove(formState), [this, protectedFrame = Ref { m_frame }, requesterOrigin = Ref { frameLoadRequest.requesterSecurityOrigin() }] (const ResourceRequest& request, WeakPtr&&, NavigationPolicyDecision navigationPolicyDecision) { continueFragmentScrollAfterNavigationPolicy(request, requesterOrigin.ptr(), navigationPolicyDecision == NavigationPolicyDecision::ContinueLoad); }, PolicyDecisionMode::Synchronous); + + if (resetLoadTypeAfterFragmentNavigation) + policyChecker().setLoadType(loadType); + return; } From 54811ef04bc8359289e315991d50f5c58f8e99ca Mon Sep 17 00:00:00 2001 From: Amol Virnodkar Date: Mon, 29 Jul 2024 10:45:01 +0530 Subject: [PATCH 2/2] =?UTF-8?q?ONEM-35907=20:=20[WPE2.38]=20-=20Tetris=20a?= =?UTF-8?q?pp=20shows=20black=20screen=20while=20opening=20ARRISEOS-45743?= =?UTF-8?q?=20:=20[WPE2.38][RDK16]=20Sometimes=20set=20URL=20from=20Thunde?= =?UTF-8?q?r=20fails.=E2=80=8B=E2=80=8B=E2=80=8B=E2=80=8B=E2=80=8B?= =?UTF-8?q?=E2=80=8B=E2=80=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix for an assert crash in WPE 2.42 --- .../WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp index eff7e85973e0a..2cdb167411741 100644 --- a/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp @@ -1022,7 +1022,9 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const Navigat // the provisional load's DocumentLoader needs to receive navigation policy decisions. We need a better model for this state. documentLoader = static_cast(coreFrame->loader().provisionalDocumentLoader()); } - if (!documentLoader) + // PolicyDecisionMode::Synchronous means that it is a FragmentNavigation and in that case we should use documentLoader, + // because there can be ongoing (in policy or provisional state) navigation. + if (!documentLoader || policyDecisionMode == PolicyDecisionMode::Synchronous) documentLoader = static_cast(coreFrame->loader().documentLoader()); navigationActionData.clientRedirectSourceForHistory = documentLoader->clientRedirectSourceForHistory();