Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ServiceWorker downloads fail when chunks are sent via postMessage
https://bugs.webkit.org/show_bug.cgi?id=256698
rdar://problem/109561888

Reviewed by Chris Dumez.

When isolatedCopying() && a URLKeepingBlobAlive, we would register the blob URL handle for the new URLKeepingBlobAlive,
but the moved URLKeepingBlobAlive would no longer unregister itself if its url is empty.
To prevent this, we remove the isolatedCopy() && version.
We could make URLKeepingBlobAlive to a move only type in a follow-up.

* Source/WebCore/fileapi/URLKeepingBlobAlive.cpp:
(WebCore::URLKeepingBlobAlive::isolatedCopy const):
(WebCore::URLKeepingBlobAlive::isolatedCopy): Deleted.
* Source/WebCore/fileapi/URLKeepingBlobAlive.h:

Canonical link: https://commits.webkit.org/264412@main
  • Loading branch information
youennf committed May 23, 2023
1 parent b39f7b6 commit fb9630a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions Source/WebCore/fileapi/URLKeepingBlobAlive.cpp
Expand Up @@ -91,13 +91,9 @@ void URLKeepingBlobAlive::unregisterBlobURLHandleIfNecessary()
ThreadableBlobRegistry::unregisterBlobURLHandle(m_url);
}

URLKeepingBlobAlive URLKeepingBlobAlive::isolatedCopy() const &
URLKeepingBlobAlive URLKeepingBlobAlive::isolatedCopy() const
{
return { m_url.isolatedCopy(), m_topOrigin.isolatedCopy() };
}

URLKeepingBlobAlive URLKeepingBlobAlive::isolatedCopy() &&
{
return { WTFMove(m_url).isolatedCopy(), WTFMove(m_topOrigin).isolatedCopy() };
}
} // namespace WebCore
4 changes: 2 additions & 2 deletions Source/WebCore/fileapi/URLKeepingBlobAlive.h
Expand Up @@ -49,8 +49,8 @@ class URLKeepingBlobAlive {

void clear();

URLKeepingBlobAlive WARN_UNUSED_RETURN isolatedCopy() const &;
URLKeepingBlobAlive WARN_UNUSED_RETURN isolatedCopy() &&;
// We do not introduce a && version since it might break the register/unregister balance.
WEBCORE_EXPORT URLKeepingBlobAlive WARN_UNUSED_RETURN isolatedCopy() const;

private:
void registerBlobURLHandleIfNecessary();
Expand Down

0 comments on commit fb9630a

Please sign in to comment.