[webkit-changes] [WebKit/WebKit] fa3e4b: ResouceLoader should have a weak reference to its ...

Alex Christensen noreply at github.com
Fri Jan 10 19:46:38 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fa3e4b9a0f97e02aabb703c771847ab45b089ed5
      https://github.com/WebKit/WebKit/commit/fa3e4b9a0f97e02aabb703c771847ab45b089ed5
  Author: Alex Christensen <achristensen at apple.com>
  Date:   2025-01-10 (Fri, 10 Jan 2025)

  Changed paths:
    M Source/WebCore/loader/ResourceLoader.cpp
    M Source/WebCore/loader/ResourceLoader.h
    M Source/WebCore/loader/SubresourceIntegrity.cpp
    M Source/WebCore/loader/SubresourceLoader.cpp
    M Source/WebCore/loader/cache/CachedFont.cpp

  Log Message:
  -----------
  ResouceLoader should have a weak reference to its LocalFrame
https://bugs.webkit.org/show_bug.cgi?id=285780
rdar://142712762

Reviewed by Pascoe.

There are occasional crashes caused by a ResourceLoader dropping the last
strong reference to a Frame, especially with site isolation enabled.
A ResourceLoader does not need to prevent a LocalFrame from being destroyed,
it was just written before WeakPtr and it needs a weak reference to the
LocalFrame.  It's ok if the LocalFrame is destroyed.  I added strong references
on the stack when using it, and null checks to fail gracefully if the
LocalFrame does not exist any more.

* Source/WebCore/loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::init):
(WebCore::ResourceLoader::frameLoader const):
(WebCore::ResourceLoader::loadDataURL):
(WebCore::ResourceLoader::willSendRequestInternal):
(WebCore::ResourceLoader::shouldAllowResourceToAskForCredentials const):
(WebCore::ResourceLoader::didBlockAuthenticationChallenge):
(WebCore::ResourceLoader::didReceiveResponse):
(WebCore::ResourceLoader::didReceiveBuffer):
(WebCore::ResourceLoader::cleanupForError):
(WebCore::ResourceLoader::shouldUseCredentialStorage):
(WebCore::ResourceLoader::isAllowedToAskUserForCredentials const):
(WebCore::ResourceLoader::isPDFJSResourceLoad const):
(WebCore::ResourceLoader::protectedFrame const):
(WebCore::ResourceLoader::frame const):
(WebCore::ResourceLoader::resourceMonitorIfExists):
* Source/WebCore/loader/ResourceLoader.h:
(WebCore::ResourceLoader::frame const): Deleted.
* Source/WebCore/loader/SubresourceIntegrity.cpp:
(WebCore::reportHashesIfNeeded):
* Source/WebCore/loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):
(WebCore::SubresourceLoader::didReceiveResponse):
(WebCore::SubresourceLoader::didFail):
* Source/WebCore/loader/cache/CachedFont.cpp:
(WebCore::CachedFont::policyForCustomFont):

Canonical link: https://commits.webkit.org/288750@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list