<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[280824] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/280824">280824</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2021-08-09 20:33:03 -0700 (Mon, 09 Aug 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Blob URL changes after loading it
https://bugs.webkit.org/show_bug.cgi?id=228923

Reviewed by Geoff Garen.

Source/WebCore:

Blob URL changes after loading it. This is because we use URLWithBlobURLLifetimeExtension to
extend the lifetime of the Blob URL during the load and URLWithBlobURLLifetimeExtension ends
up creating a new public Blob URL. This is Web-observable so we need a way to extend the
lifetime of a Blob URL without actually generating a new Blob URL.

This patch replaces URLWithBlobURLLifetimeExtension with a new BlobURLHandle class which
extends the lifetime of a Blob URL as long as there are BlobURLHandle objects referring
to it. BlobURLHandle works with both private and public Blob URLs so it replaces
Blob::Handle as well (which I recently introduced via <a href="http://trac.webkit.org/projects/webkit/changeset/280547">r280547</a>). The Blob URL no longer
changes when we extend its lifetime. Instead, the Blob registry now keeps track of
references to a given Blob and only removes a Blob URL once there are no longer any
references to it.

Test: fast/files/blob-as-frame-url.html

* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::serialize):
(WebCore::CloneSerializer::CloneSerializer):
(WebCore::CloneSerializer::dumpIfTerminal):
(WebCore::SerializedScriptValue::SerializedScriptValue):
(WebCore::SerializedScriptValue::create):
* bindings/js/SerializedScriptValue.h:
(WebCore::SerializedScriptValue::blobHandles const):
(WebCore::SerializedScriptValue::SerializedScriptValue):
* fileapi/Blob.cpp:
(WebCore::Blob::Blob):
(WebCore::Blob::slice const):
(WebCore::Blob::size const):
(WebCore::Blob::handle const):
* fileapi/Blob.h:
(WebCore::Blob::url const):
* fileapi/BlobURL.cpp:
(WebCore::BlobURLHandle::BlobURLHandle):
(WebCore::BlobURLHandle::~BlobURLHandle):
(WebCore::BlobURLHandle::registerBlobURLHandleIfNecessary):
(WebCore::BlobURLHandle::unregisterBlobURLHandleIfNecessary):
(WebCore::BlobURLHandle::operator=):
(WebCore::BlobURLHandle::clear):
* fileapi/BlobURL.h:
(WebCore::BlobURLHandle::BlobURLHandle):
(WebCore::BlobURLHandle::url const):
* fileapi/ThreadableBlobRegistry.cpp:
(WebCore::ThreadableBlobRegistry::registerBlobURLHandle):
(WebCore::ThreadableBlobRegistry::unregisterBlobURLHandle):
* fileapi/ThreadableBlobRegistry.h:
* loader/PolicyChecker.cpp:
(WebCore::FrameLoader::PolicyChecker::extendBlobURLLifetimeIfNecessary const):
(WebCore::FrameLoader::PolicyChecker::checkNavigationPolicy):
(WebCore::FrameLoader::PolicyChecker::checkNewWindowPolicy):
* loader/PolicyChecker.h:
* platform/network/BlobRegistry.h:
* platform/network/BlobRegistryImpl.cpp:
(WebCore::BlobRegistryImpl::registerFileBlobURL):
(WebCore::BlobRegistryImpl::registerBlobURL):
(WebCore::BlobRegistryImpl::registerBlobURLOptionallyFileBacked):
(WebCore::BlobRegistryImpl::registerBlobURLForSlice):
(WebCore::BlobRegistryImpl::unregisterBlobURL):
(WebCore::BlobRegistryImpl::addBlobData):
(WebCore::BlobRegistryImpl::registerBlobURLHandle):
(WebCore::BlobRegistryImpl::unregisterBlobURLHandle):
* platform/network/BlobRegistryImpl.h:
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::setResponseType):
(WebCore::XMLHttpRequest::open):
(WebCore::XMLHttpRequest::prepareToSend):
(WebCore::XMLHttpRequest::send):
(WebCore::XMLHttpRequest::createRequest):
(WebCore::XMLHttpRequest::clearRequest):
(WebCore::XMLHttpRequest::didFinishLoading):
* xml/XMLHttpRequest.h:

Source/WebKit:

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::registerBlobURLHandle):
(WebKit::NetworkConnectionToWebProcess::unregisterBlobURLHandle):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcessPlatformStrategies.cpp:
(WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
* WebProcess/FileAPI/BlobRegistryProxy.cpp:
(WebKit::BlobRegistryProxy::registerBlobURLHandle):
(WebKit::BlobRegistryProxy::unregisterBlobURLHandle):
* WebProcess/FileAPI/BlobRegistryProxy.h:

Source/WebKitLegacy/mac:

* WebCoreSupport/WebPlatformStrategies.mm:

Source/WebKitLegacy/win:

* WebCoreSupport/WebPlatformStrategies.cpp:

LayoutTests:

Add layout test coverage.

* fast/files/blob-as-frame-url-expected.txt: Added.
* fast/files/blob-as-frame-url.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLAnchorElementanchorfileblobdownloadthenrevokeexpectedtxt">trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-then-revoke-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLAnchorElementanchorfileblobdownloadthenrevokehtml">trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-then-revoke.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsFileAPIurlurlintagswindowexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-in-tags.window-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsFileAPIurlurlreloadwindowexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-reload.window-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscontentsecuritypolicyinheritancehistorysubexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/inheritance/history.sub-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreHeaderscmake">trunk/Source/WebCore/Headers.cmake</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsSerializedScriptValuecpp">trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsSerializedScriptValueh">trunk/Source/WebCore/bindings/js/SerializedScriptValue.h</a></li>
<li><a href="#trunkSourceWebCorefileapiBlobcpp">trunk/Source/WebCore/fileapi/Blob.cpp</a></li>
<li><a href="#trunkSourceWebCorefileapiBlobh">trunk/Source/WebCore/fileapi/Blob.h</a></li>
<li><a href="#trunkSourceWebCorefileapiBlobURLcpp">trunk/Source/WebCore/fileapi/BlobURL.cpp</a></li>
<li><a href="#trunkSourceWebCorefileapiBlobURLh">trunk/Source/WebCore/fileapi/BlobURL.h</a></li>
<li><a href="#trunkSourceWebCorefileapiThreadableBlobRegistrycpp">trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp</a></li>
<li><a href="#trunkSourceWebCorefileapiThreadableBlobRegistryh">trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h</a></li>
<li><a href="#trunkSourceWebCoreloaderPolicyCheckercpp">trunk/Source/WebCore/loader/PolicyChecker.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderPolicyCheckerh">trunk/Source/WebCore/loader/PolicyChecker.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkBlobRegistryh">trunk/Source/WebCore/platform/network/BlobRegistry.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkBlobRegistryImplcpp">trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkBlobRegistryImplh">trunk/Source/WebCore/platform/network/BlobRegistryImpl.h</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequestcpp">trunk/Source/WebCore/xml/XMLHttpRequest.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequesth">trunk/Source/WebCore/xml/XMLHttpRequest.h</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkConnectionToWebProcesscpp">trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkConnectionToWebProcessh">trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkConnectionToWebProcessmessagesin">trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkProcessPlatformStrategiescpp">trunk/Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessFileAPIBlobRegistryProxycpp">trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessFileAPIBlobRegistryProxyh">trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.h</a></li>
<li><a href="#trunkSourceWebKitLegacymacChangeLog">trunk/Source/WebKitLegacy/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitLegacymacWebCoreSupportWebPlatformStrategiesmm">trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm</a></li>
<li><a href="#trunkSourceWebKitLegacywinChangeLog">trunk/Source/WebKitLegacy/win/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitLegacywinWebCoreSupportWebPlatformStrategiescpp">trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastfilesblobasframeurlexpectedtxt">trunk/LayoutTests/fast/files/blob-as-frame-url-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastfilesblobasframeurlhtml">trunk/LayoutTests/fast/files/blob-as-frame-url.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/LayoutTests/ChangeLog 2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2021-08-09  Chris Dumez  <cdumez@apple.com>
+
+        Blob URL changes after loading it
+        https://bugs.webkit.org/show_bug.cgi?id=228923
+
+        Reviewed by Geoff Garen.
+
+        Add layout test coverage.
+
+        * fast/files/blob-as-frame-url-expected.txt: Added.
+        * fast/files/blob-as-frame-url.html: Added.
+
</ins><span class="cx"> 2021-08-09  Lauro Moura  <lmoura@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         [GLIB] Garden two getUserMedia timeouts
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLAnchorElementanchorfileblobdownloadthenrevokeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-then-revoke-expected.txt (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-then-revoke-expected.txt  2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-then-revoke-expected.txt     2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -1,4 +1,3 @@
</span><del>-CONSOLE MESSAGE: PASS: URL was revoked
</del><span class="cx"> Download started.
</span><span class="cx"> Downloading URL with suggested filename "foo.txt"
</span><span class="cx"> Download completed.
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLAnchorElementanchorfileblobdownloadthenrevokehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-then-revoke.html (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-then-revoke.html  2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-file-blob-download-then-revoke.html     2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -23,18 +23,6 @@
</span><span class="cx">     link.click();
</span><span class="cx">     // Revoke the URL right away.
</span><span class="cx">     window.URL.revokeObjectURL(link.href);
</span><del>-
-    // Make sure the URL was revoked.
-    xhr = new XMLHttpRequest();
-    xhr.open("GET", link.href, false);
-    try {
-        xhr.send(null);
-    } catch (e) {
-    }
-    if (xhr.status == 200)
-        console.log("FAIL: URL was not revoked");
-    else
-        console.log("PASS: URL was revoked");
</del><span class="cx"> }
</span><span class="cx"> runTest();
</span><span class="cx"> </script>
</span></span></pre></div>
<a id="trunkLayoutTestsfastfilesblobasframeurlexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/files/blob-as-frame-url-expected.txt (0 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/files/blob-as-frame-url-expected.txt                              (rev 0)
+++ trunk/LayoutTests/fast/files/blob-as-frame-url-expected.txt 2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+Makes sure that using a Blob URL as frame URL works as expected.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS iframe.contentDocument.body.innerText is "FOO"
+PASS iframe.contentWindow.location.href == blobURL is true
+PASS iframe.contentDocument.URL == blobURL is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastfilesblobasframeurlhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/files/blob-as-frame-url.html (0 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/files/blob-as-frame-url.html                              (rev 0)
+++ trunk/LayoutTests/fast/files/blob-as-frame-url.html 2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<script src="../../resources/js-test.js"></script>
+<script>
+description("Makes sure that using a Blob URL as frame URL works as expected.");
+jsTestIsAsync = true;
+
+let blobContents = `<body>FOO</body>`;
+let iframe = document.createElement("iframe");
+let blob = new Blob([blobContents], { type: "text/html" });
+let blobURL = URL.createObjectURL(blob);
+iframe.src = blobURL;
+iframe.onload = () => {
+    shouldBeEqualToString("iframe.contentDocument.body.innerText", "FOO");
+    shouldBeTrue("iframe.contentWindow.location.href == blobURL");
+    shouldBeTrue("iframe.contentDocument.URL == blobURL");
+    finishJSTest();
+};
+document.body.append(iframe);
+blob = null;
+gc();
+setTimeout(gc, 0);
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsFileAPIurlurlintagswindowexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-in-tags.window-expected.txt (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-in-tags.window-expected.txt    2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-in-tags.window-expected.txt       2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -1,7 +1,5 @@
</span><span class="cx"> 
</span><del>-Harness Error (TIMEOUT), message = null
-
</del><span class="cx"> PASS Blob URLs can be used in <script> tags
</span><span class="cx"> PASS Blob URLs can be used in iframes, and are treated same origin
</span><del>-TIMEOUT Blob URL fragment is implemented. Test timed out
</del><ins>+PASS Blob URL fragment is implemented.
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsFileAPIurlurlreloadwindowexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-reload.window-expected.txt (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-reload.window-expected.txt     2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/url/url-reload.window-expected.txt        2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> 
</span><span class="cx"> Harness Error (TIMEOUT), message = null
</span><span class="cx"> 
</span><del>-TIMEOUT Reloading a blob URL succeeds. Test timed out
</del><ins>+PASS Reloading a blob URL succeeds.
</ins><span class="cx"> TIMEOUT Reloading a blob URL succeeds even if the URL was revoked. Test timed out
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscontentsecuritypolicyinheritancehistorysubexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/inheritance/history.sub-expected.txt (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/inheritance/history.sub-expected.txt   2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/inheritance/history.sub-expected.txt      2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -1,8 +1,8 @@
</span><span class="cx"> 
</span><span class="cx"> PASS History navigation: "about:blank" document is navigated back from history same-origin.
</span><span class="cx"> PASS History navigation: "about:blank" document is navigated back from history cross-origin.
</span><del>-FAIL History navigation: blob URL document is navigated back from history same-origin. step_wait_func: Wait for the popup to navigate. Timed out waiting on condition
-FAIL History navigation: blob URL document is navigated back from history cross-origin. step_wait_func: Wait for the popup to navigate. Timed out waiting on condition
-FAIL History navigation: blob URL document is navigated back from history (without bfcache on Firefox) same-origin. step_wait_func: Wait for the popup to navigate. Timed out waiting on condition
-FAIL History navigation: blob URL document is navigated back from history (without bfcache on Firefox) cross-origin. step_wait_func: Wait for the popup to navigate. Timed out waiting on condition
</del><ins>+FAIL History navigation: blob URL document is navigated back from history same-origin. assert_equals: Image should be blocked by CSP inherited from navigation initiator. expected "img blocked" but got "img loaded"
+FAIL History navigation: blob URL document is navigated back from history cross-origin. assert_equals: Image should be blocked by CSP inherited from navigation initiator. expected "img blocked" but got "img loaded"
+FAIL History navigation: blob URL document is navigated back from history (without bfcache on Firefox) same-origin. assert_equals: Image should be blocked by CSP inherited from navigation initiator. expected "img blocked" but got "img loaded"
+FAIL History navigation: blob URL document is navigated back from history (without bfcache on Firefox) cross-origin. assert_equals: Image should be blocked by CSP inherited from navigation initiator. expected "img blocked" but got "img loaded"
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/ChangeLog      2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -1,3 +1,83 @@
</span><ins>+2021-08-09  Chris Dumez  <cdumez@apple.com>
+
+        Blob URL changes after loading it
+        https://bugs.webkit.org/show_bug.cgi?id=228923
+
+        Reviewed by Geoff Garen.
+
+        Blob URL changes after loading it. This is because we use URLWithBlobURLLifetimeExtension to
+        extend the lifetime of the Blob URL during the load and URLWithBlobURLLifetimeExtension ends
+        up creating a new public Blob URL. This is Web-observable so we need a way to extend the
+        lifetime of a Blob URL without actually generating a new Blob URL.
+
+        This patch replaces URLWithBlobURLLifetimeExtension with a new BlobURLHandle class which
+        extends the lifetime of a Blob URL as long as there are BlobURLHandle objects referring
+        to it. BlobURLHandle works with both private and public Blob URLs so it replaces
+        Blob::Handle as well (which I recently introduced via r280547). The Blob URL no longer
+        changes when we extend its lifetime. Instead, the Blob registry now keeps track of
+        references to a given Blob and only removes a Blob URL once there are no longer any
+        references to it.
+
+        Test: fast/files/blob-as-frame-url.html
+
+        * Headers.cmake:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/SerializedScriptValue.cpp:
+        (WebCore::CloneSerializer::serialize):
+        (WebCore::CloneSerializer::CloneSerializer):
+        (WebCore::CloneSerializer::dumpIfTerminal):
+        (WebCore::SerializedScriptValue::SerializedScriptValue):
+        (WebCore::SerializedScriptValue::create):
+        * bindings/js/SerializedScriptValue.h:
+        (WebCore::SerializedScriptValue::blobHandles const):
+        (WebCore::SerializedScriptValue::SerializedScriptValue):
+        * fileapi/Blob.cpp:
+        (WebCore::Blob::Blob):
+        (WebCore::Blob::slice const):
+        (WebCore::Blob::size const):
+        (WebCore::Blob::handle const):
+        * fileapi/Blob.h:
+        (WebCore::Blob::url const):
+        * fileapi/BlobURL.cpp:
+        (WebCore::BlobURLHandle::BlobURLHandle):
+        (WebCore::BlobURLHandle::~BlobURLHandle):
+        (WebCore::BlobURLHandle::registerBlobURLHandleIfNecessary):
+        (WebCore::BlobURLHandle::unregisterBlobURLHandleIfNecessary):
+        (WebCore::BlobURLHandle::operator=):
+        (WebCore::BlobURLHandle::clear):
+        * fileapi/BlobURL.h:
+        (WebCore::BlobURLHandle::BlobURLHandle):
+        (WebCore::BlobURLHandle::url const):
+        * fileapi/ThreadableBlobRegistry.cpp:
+        (WebCore::ThreadableBlobRegistry::registerBlobURLHandle):
+        (WebCore::ThreadableBlobRegistry::unregisterBlobURLHandle):
+        * fileapi/ThreadableBlobRegistry.h:
+        * loader/PolicyChecker.cpp:
+        (WebCore::FrameLoader::PolicyChecker::extendBlobURLLifetimeIfNecessary const):
+        (WebCore::FrameLoader::PolicyChecker::checkNavigationPolicy):
+        (WebCore::FrameLoader::PolicyChecker::checkNewWindowPolicy):
+        * loader/PolicyChecker.h:
+        * platform/network/BlobRegistry.h:
+        * platform/network/BlobRegistryImpl.cpp:
+        (WebCore::BlobRegistryImpl::registerFileBlobURL):
+        (WebCore::BlobRegistryImpl::registerBlobURL):
+        (WebCore::BlobRegistryImpl::registerBlobURLOptionallyFileBacked):
+        (WebCore::BlobRegistryImpl::registerBlobURLForSlice):
+        (WebCore::BlobRegistryImpl::unregisterBlobURL):
+        (WebCore::BlobRegistryImpl::addBlobData):
+        (WebCore::BlobRegistryImpl::registerBlobURLHandle):
+        (WebCore::BlobRegistryImpl::unregisterBlobURLHandle):
+        * platform/network/BlobRegistryImpl.h:
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::setResponseType):
+        (WebCore::XMLHttpRequest::open):
+        (WebCore::XMLHttpRequest::prepareToSend):
+        (WebCore::XMLHttpRequest::send):
+        (WebCore::XMLHttpRequest::createRequest):
+        (WebCore::XMLHttpRequest::clearRequest):
+        (WebCore::XMLHttpRequest::didFinishLoading):
+        * xml/XMLHttpRequest.h:
+
</ins><span class="cx"> 2021-08-09  Simon Fraser  <simon.fraser@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Vertical scroll with mouse wheel in horizontal scroller fails to propagate to the document
</span></span></pre></div>
<a id="trunkSourceWebCoreHeaderscmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Headers.cmake (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Headers.cmake       2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/Headers.cmake  2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -598,6 +598,7 @@
</span><span class="cx">     fileapi/AsyncFileStream.h
</span><span class="cx">     fileapi/Blob.h
</span><span class="cx">     fileapi/BlobPropertyBag.h
</span><ins>+    fileapi/BlobURL.h
</ins><span class="cx">     fileapi/EndingType.h
</span><span class="cx">     fileapi/File.h
</span><span class="cx">     fileapi/FileList.h
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj   2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj      2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -3037,7 +3037,7 @@
</span><span class="cx">          97627B9814FB5424002CDCA1 /* Supplementable.h in Headers */ = {isa = PBXBuildFile; fileRef = 97627B9714FB5424002CDCA1 /* Supplementable.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          976D6C79122B8A3D001FD1F7 /* Blob.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C5A122B8A3D001FD1F7 /* Blob.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          976D6C7C122B8A3D001FD1F7 /* BlobBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C5D122B8A3D001FD1F7 /* BlobBuilder.h */; };
</span><del>-               976D6C7F122B8A3D001FD1F7 /* BlobURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C60122B8A3D001FD1F7 /* BlobURL.h */; };
</del><ins>+                976D6C7F122B8A3D001FD1F7 /* BlobURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C60122B8A3D001FD1F7 /* BlobURL.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">           976D6C81122B8A3D001FD1F7 /* File.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C62122B8A3D001FD1F7 /* File.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          976D6C86122B8A3D001FD1F7 /* FileList.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C67122B8A3D001FD1F7 /* FileList.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          976D6C89122B8A3D001FD1F7 /* FileReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C6A122B8A3D001FD1F7 /* FileReader.h */; };
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsSerializedScriptValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp       2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp  2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -600,7 +600,7 @@
</span><span class="cx">             WasmModuleArray& wasmModules,
</span><span class="cx">             WasmMemoryHandleArray& wasmMemoryHandles,
</span><span class="cx"> #endif
</span><del>-        Vector<Blob::Handle>& blobHandles, Vector<uint8_t>& out, SerializationContext context, ArrayBufferContentsArray& sharedBuffers)
</del><ins>+        Vector<BlobURLHandle>& blobHandles, Vector<uint8_t>& out, SerializationContext context, ArrayBufferContentsArray& sharedBuffers)
</ins><span class="cx">     {
</span><span class="cx">         CloneSerializer serializer(lexicalGlobalObject, messagePorts, arrayBuffers, imageBitmaps,
</span><span class="cx"> #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS)
</span><span class="lines">@@ -647,7 +647,7 @@
</span><span class="cx">             WasmModuleArray& wasmModules,
</span><span class="cx">             WasmMemoryHandleArray& wasmMemoryHandles,
</span><span class="cx"> #endif
</span><del>-        Vector<Blob::Handle>& blobHandles, Vector<uint8_t>& out, SerializationContext context, ArrayBufferContentsArray& sharedBuffers)
</del><ins>+        Vector<BlobURLHandle>& blobHandles, Vector<uint8_t>& out, SerializationContext context, ArrayBufferContentsArray& sharedBuffers)
</ins><span class="cx">         : CloneBase(lexicalGlobalObject)
</span><span class="cx">         , m_buffer(out)
</span><span class="cx">         , m_blobHandles(blobHandles)
</span><span class="lines">@@ -1297,7 +1297,7 @@
</span><span class="cx">             if (auto* key = JSCryptoKey::toWrapped(vm, obj)) {
</span><span class="cx">                 write(CryptoKeyTag);
</span><span class="cx">                 Vector<uint8_t> serializedKey;
</span><del>-                Vector<Blob::Handle> dummyBlobHandles;
</del><ins>+                Vector<BlobURLHandle> dummyBlobHandles;
</ins><span class="cx">                 Vector<RefPtr<MessagePort>> dummyMessagePorts;
</span><span class="cx">                 Vector<RefPtr<JSC::ArrayBuffer>> dummyArrayBuffers;
</span><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="lines">@@ -1760,7 +1760,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Vector<uint8_t>& m_buffer;
</span><del>-    Vector<Blob::Handle>& m_blobHandles;
</del><ins>+    Vector<BlobURLHandle>& m_blobHandles;
</ins><span class="cx">     ObjectPool m_objectPool;
</span><span class="cx">     ObjectPool m_transferredMessagePorts;
</span><span class="cx">     ObjectPool m_transferredArrayBuffers;
</span><span class="lines">@@ -3915,7 +3915,7 @@
</span><span class="cx">     m_memoryCost = computeMemoryCost();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SerializedScriptValue::SerializedScriptValue(Vector<uint8_t>&& buffer, const Vector<Blob::Handle>& blobHandles, std::unique_ptr<ArrayBufferContentsArray> arrayBufferContentsArray, std::unique_ptr<ArrayBufferContentsArray> sharedBufferContentsArray, Vector<std::optional<ImageBitmapBacking>>&& backingStores
</del><ins>+SerializedScriptValue::SerializedScriptValue(Vector<uint8_t>&& buffer, const Vector<BlobURLHandle>& blobHandles, std::unique_ptr<ArrayBufferContentsArray> arrayBufferContentsArray, std::unique_ptr<ArrayBufferContentsArray> sharedBufferContentsArray, Vector<std::optional<ImageBitmapBacking>>&& backingStores
</ins><span class="cx"> #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS)
</span><span class="cx">         , Vector<std::unique_ptr<DetachedOffscreenCanvas>>&& detachedOffscreenCanvases
</span><span class="cx"> #endif
</span><span class="lines">@@ -4065,7 +4065,7 @@
</span><span class="cx"> RefPtr<SerializedScriptValue> SerializedScriptValue::create(JSGlobalObject& lexicalGlobalObject, JSValue value, SerializationErrorMode throwExceptions)
</span><span class="cx"> {
</span><span class="cx">     Vector<uint8_t> buffer;
</span><del>-    Vector<Blob::Handle> blobHandles;
</del><ins>+    Vector<BlobURLHandle> blobHandles;
</ins><span class="cx">     Vector<RefPtr<MessagePort>> dummyMessagePorts;
</span><span class="cx">     Vector<RefPtr<ImageBitmap>> dummyImageBitmaps;
</span><span class="cx"> #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS)
</span><span class="lines">@@ -4217,7 +4217,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     Vector<uint8_t> buffer;
</span><del>-    Vector<Blob::Handle> blobHandles;
</del><ins>+    Vector<BlobURLHandle> blobHandles;
</ins><span class="cx"> #if ENABLE(WEBASSEMBLY)
</span><span class="cx">     WasmModuleArray wasmModules;
</span><span class="cx">     WasmMemoryHandleArray wasmMemoryHandles;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsSerializedScriptValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.h (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.h 2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.h    2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx">     bool hasBlobURLs() const { return !m_blobHandles.isEmpty(); }
</span><span class="cx"> 
</span><span class="cx">     Vector<String> blobURLs() const;
</span><del>-    const Vector<Blob::Handle>& blobHandles() const { return m_blobHandles; }
</del><ins>+    const Vector<BlobURLHandle>& blobHandles() const { return m_blobHandles; }
</ins><span class="cx">     void writeBlobsToDiskForIndexedDB(CompletionHandler<void(IDBValue&&)>&&);
</span><span class="cx">     IDBValue writeBlobsToDiskForIndexedDBSynchronously();
</span><span class="cx">     static Ref<SerializedScriptValue> createFromWireBytes(Vector<uint8_t>&& data)
</span><span class="lines">@@ -123,7 +123,7 @@
</span><span class="cx"> #endif
</span><span class="cx">         );
</span><span class="cx"> 
</span><del>-    SerializedScriptValue(Vector<unsigned char>&&, const Vector<Blob::Handle>& blobHandles, std::unique_ptr<ArrayBufferContentsArray>, std::unique_ptr<ArrayBufferContentsArray> sharedBuffers, Vector<std::optional<ImageBitmapBacking>>&& backingStores
</del><ins>+    SerializedScriptValue(Vector<unsigned char>&&, const Vector<BlobURLHandle>& blobHandles, std::unique_ptr<ArrayBufferContentsArray>, std::unique_ptr<ArrayBufferContentsArray> sharedBuffers, Vector<std::optional<ImageBitmapBacking>>&& backingStores
</ins><span class="cx"> #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS)
</span><span class="cx">         , Vector<std::unique_ptr<DetachedOffscreenCanvas>>&& = { }
</span><span class="cx"> #endif
</span><span class="lines">@@ -152,7 +152,7 @@
</span><span class="cx">     std::unique_ptr<WasmModuleArray> m_wasmModulesArray;
</span><span class="cx">     std::unique_ptr<WasmMemoryHandleArray> m_wasmMemoryHandlesArray;
</span><span class="cx"> #endif
</span><del>-    Vector<Blob::Handle> m_blobHandles;
</del><ins>+    Vector<BlobURLHandle> m_blobHandles;
</ins><span class="cx">     size_t m_memoryCost { 0 };
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiBlobcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/Blob.cpp (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/Blob.cpp    2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/fileapi/Blob.cpp       2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -76,67 +76,10 @@
</span><span class="cx">     return instance;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Unregisters the Blob's internal URL upon destruction. This can be used to extend the lifetime of the Blob data
-// without actually keeping the Blob object alive.
-class BlobInternalURL : public ThreadSafeRefCounted<BlobInternalURL> {
-public:
-    static Ref<BlobInternalURL> create(Vector<BlobPart>&& blobParts, const String& contentType)
-    {
-        return adoptRef(*new BlobInternalURL(WTFMove(blobParts), contentType));
-    }
-
-    static Ref<BlobInternalURL> createForDeserialization(const URL& sourceURL, const String& fileBackedPath, const String& type)
-    {
-        return adoptRef(*new BlobInternalURL(sourceURL, fileBackedPath, type));
-    }
-
-    static Ref<BlobInternalURL> createForSlice(const URL& sourceURL, long long start, long long end, const String& type)
-    {
-        return adoptRef(*new BlobInternalURL(sourceURL, start, end, type));
-    }
-
-    static Ref<BlobInternalURL> adoptInternalURL(const URL& url)
-    {
-        return adoptRef(*new BlobInternalURL(crossThreadCopy(url)));
-    }
-
-    ~BlobInternalURL()
-    {
-        ThreadableBlobRegistry::unregisterBlobURL(m_internalURL);
-    }
-
-    URL url() const { return m_internalURL.isolatedCopy(); }
-
-private:
-    BlobInternalURL(Vector<BlobPart>&& blobParts, const String& contentType)
-        : m_internalURL(BlobURL::createInternalURL())
-    {
-        ThreadableBlobRegistry::registerBlobURL(m_internalURL, WTFMove(blobParts), contentType);
-    }
-    BlobInternalURL(const URL& sourceURL, long long start, long long end, const String& type)
-        : m_internalURL(BlobURL::createInternalURL())
-    {
-        ThreadableBlobRegistry::registerBlobURLForSlice(m_internalURL, sourceURL, start, end, type);
-    }
-    BlobInternalURL(const URL& sourceURL, const String& fileBackedPath, const String& type)
-        : m_internalURL(BlobURL::createInternalURL())
-    {
-        if (fileBackedPath.isEmpty())
-            ThreadableBlobRegistry::registerBlobURL(nullptr, m_internalURL, sourceURL);
-        else
-            ThreadableBlobRegistry::registerBlobURLOptionallyFileBacked(m_internalURL, sourceURL, fileBackedPath, type);
-    }
-    BlobInternalURL(URL&& internalURL)
-        : m_internalURL(WTFMove(internalURL))
-    { }
-
-    URL m_internalURL;
-};
-
</del><span class="cx"> Blob::Blob(UninitializedContructor, ScriptExecutionContext* context, URL&& url, String&& type)
</span><span class="cx">     : ActiveDOMObject(context)
</span><span class="cx">     , m_type(WTFMove(type))
</span><del>-    , m_internalURL(BlobInternalURL::adoptInternalURL(url))
</del><ins>+    , m_internalURL(WTFMove(url))
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -143,8 +86,9 @@
</span><span class="cx"> Blob::Blob(ScriptExecutionContext* context)
</span><span class="cx">     : ActiveDOMObject(context)
</span><span class="cx">     , m_size(0)
</span><del>-    , m_internalURL(BlobInternalURL::create({ }, { }))
</del><ins>+    , m_internalURL(BlobURL::createInternalURL())
</ins><span class="cx"> {
</span><ins>+    ThreadableBlobRegistry::registerBlobURL(m_internalURL, { }, { });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static Vector<BlobPart> buildBlobData(Vector<BlobPartVariant>&& blobPartVariants, const BlobPropertyBag& propertyBag)
</span><span class="lines">@@ -163,8 +107,9 @@
</span><span class="cx"> Blob::Blob(ScriptExecutionContext& context, Vector<BlobPartVariant>&& blobPartVariants, const BlobPropertyBag& propertyBag)
</span><span class="cx">     : ActiveDOMObject(&context)
</span><span class="cx">     , m_type(normalizedContentType(propertyBag.type))
</span><del>-    , m_internalURL(BlobInternalURL::create(buildBlobData(WTFMove(blobPartVariants), propertyBag), m_type))
</del><ins>+    , m_internalURL(BlobURL::createInternalURL())
</ins><span class="cx"> {
</span><ins>+    ThreadableBlobRegistry::registerBlobURL(m_internalURL, buildBlobData(WTFMove(blobPartVariants), propertyBag), m_type);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Blob::Blob(ScriptExecutionContext* context, Vector<uint8_t>&& data, const String& contentType)
</span><span class="lines">@@ -171,8 +116,9 @@
</span><span class="cx">     : ActiveDOMObject(context)
</span><span class="cx">     , m_type(contentType)
</span><span class="cx">     , m_size(data.size())
</span><del>-    , m_internalURL(BlobInternalURL::create({ BlobPart(WTFMove(data)) }, contentType))
</del><ins>+    , m_internalURL(BlobURL::createInternalURL())
</ins><span class="cx"> {
</span><ins>+    ThreadableBlobRegistry::registerBlobURL(m_internalURL, { BlobPart(WTFMove(data)) }, contentType);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Blob::Blob(ReferencingExistingBlobConstructor, ScriptExecutionContext* context, const Blob& blob)
</span><span class="lines">@@ -179,8 +125,9 @@
</span><span class="cx">     : ActiveDOMObject(context)
</span><span class="cx">     , m_type(blob.type())
</span><span class="cx">     , m_size(blob.size())
</span><del>-    , m_internalURL(BlobInternalURL::create({ BlobPart(blob.url()) } , m_type))
</del><ins>+    , m_internalURL(BlobURL::createInternalURL())
</ins><span class="cx"> {
</span><ins>+    ThreadableBlobRegistry::registerBlobURL(m_internalURL, { BlobPart(blob.url()) } , m_type);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Blob::Blob(DeserializationContructor, ScriptExecutionContext* context, const URL& srcURL, const String& type, std::optional<unsigned long long> size, const String& fileBackedPath)
</span><span class="lines">@@ -187,16 +134,21 @@
</span><span class="cx">     : ActiveDOMObject(context)
</span><span class="cx">     , m_type(normalizedContentType(type))
</span><span class="cx">     , m_size(size)
</span><del>-    , m_internalURL(BlobInternalURL::createForDeserialization(srcURL, fileBackedPath, m_type))
</del><ins>+    , m_internalURL(BlobURL::createInternalURL())
</ins><span class="cx"> {
</span><ins>+    if (fileBackedPath.isEmpty())
+        ThreadableBlobRegistry::registerBlobURL(nullptr, m_internalURL, srcURL);
+    else
+        ThreadableBlobRegistry::registerBlobURLOptionallyFileBacked(m_internalURL, srcURL, fileBackedPath, m_type);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Blob::Blob(ScriptExecutionContext* context, const URL& srcURL, long long start, long long end, const String& type)
</span><span class="cx">     : ActiveDOMObject(context)
</span><span class="cx">     , m_type(normalizedContentType(type))
</span><del>-    , m_internalURL(BlobInternalURL::createForSlice(srcURL, start, end, m_type))
</del><ins>+    , m_internalURL(BlobURL::createInternalURL())
</ins><span class="cx">     // m_size is not necessarily equal to end - start so we do not initialize it here.
</span><span class="cx"> {
</span><ins>+    ThreadableBlobRegistry::registerBlobURLForSlice(m_internalURL, srcURL, start, end, m_type);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Blob::~Blob()
</span><span class="lines">@@ -205,14 +157,9 @@
</span><span class="cx">         (*m_blobLoaders.begin())->cancel();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-URL Blob::url() const
-{
-    return m_internalURL->url();
-}
-
</del><span class="cx"> Ref<Blob> Blob::slice(ScriptExecutionContext& context, long long start, long long end, const String& contentType) const
</span><span class="cx"> {
</span><del>-    auto blob = adoptRef(*new Blob(&context, m_internalURL->url(), start, end, contentType));
</del><ins>+    auto blob = adoptRef(*new Blob(&context, m_internalURL, start, end, contentType));
</ins><span class="cx">     blob->suspendIfNeeded();
</span><span class="cx">     return blob;
</span><span class="cx"> }
</span><span class="lines">@@ -222,7 +169,7 @@
</span><span class="cx">     if (!m_size) {
</span><span class="cx">         // FIXME: JavaScript cannot represent sizes as large as unsigned long long, we need to
</span><span class="cx">         // come up with an exception to throw if file size is not representable.
</span><del>-        unsigned long long actualSize = ThreadableBlobRegistry::blobSize(m_internalURL->url());
</del><ins>+        unsigned long long actualSize = ThreadableBlobRegistry::blobSize(m_internalURL);
</ins><span class="cx">         m_size = isInBounds<long long>(actualSize) ? actualSize : 0;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -395,23 +342,9 @@
</span><span class="cx">     return "Blob";
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Blob::Handle Blob::handle() const
</del><ins>+BlobURLHandle Blob::handle() const
</ins><span class="cx"> {
</span><del>-    return Handle { m_internalURL.copyRef() };
</del><ins>+    return BlobURLHandle { m_internalURL };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Blob::Handle::Handle(Ref<BlobInternalURL>&& internalURL)
-    : m_internalURL(WTFMove(internalURL))
-{ }
-
-Blob::Handle::~Handle() = default;
-
-Blob::Handle::Handle(Handle&&) = default;
-Blob::Handle::Handle(const Handle&) = default;
-
-URL Blob::Handle::url() const
-{
-    return m_internalURL->url();
-}
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiBlobh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/Blob.h (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/Blob.h      2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/fileapi/Blob.h 2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include "BlobPropertyBag.h"
</span><ins>+#include "BlobURL.h"
</ins><span class="cx"> #include "FileReaderLoader.h"
</span><span class="cx"> #include "ScriptExecutionContext.h"
</span><span class="cx"> #include "ScriptWrappable.h"
</span><span class="lines">@@ -57,7 +58,6 @@
</span><span class="cx"> template<typename> class ExceptionOr;
</span><span class="cx"> 
</span><span class="cx"> using BlobPartVariant = Variant<RefPtr<JSC::ArrayBufferView>, RefPtr<JSC::ArrayBuffer>, RefPtr<Blob>, String>;
</span><del>-class BlobInternalURL;
</del><span class="cx"> 
</span><span class="cx"> class Blob : public ScriptWrappable, public URLRegistrable, public RefCounted<Blob>, public ActiveDOMObject {
</span><span class="cx">     WTF_MAKE_ISO_ALLOCATED_EXPORT(Blob, WEBCORE_EXPORT);
</span><span class="lines">@@ -93,7 +93,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual ~Blob();
</span><span class="cx"> 
</span><del>-    WEBCORE_EXPORT URL url() const;
</del><ins>+    URL url() const { return m_internalURL; }
</ins><span class="cx">     const String& type() const { return m_type; }
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT unsigned long long size() const;
</span><span class="lines">@@ -117,19 +117,8 @@
</span><span class="cx">     void arrayBuffer(ScriptExecutionContext&, Ref<DeferredPromise>&&);
</span><span class="cx">     ExceptionOr<Ref<ReadableStream>> stream(ScriptExecutionContext&);
</span><span class="cx"> 
</span><del>-    class Handle {
-    public:
-        explicit Handle(Ref<BlobInternalURL>&&);
-        ~Handle();
-        Handle(Handle&&);
-        Handle(const Handle&);
-        URL url() const;
-    private:
-        Ref<BlobInternalURL> m_internalURL;
-    };
-
</del><span class="cx">     // Keeping the handle alive will keep the Blob data alive (but not the Blob object).
</span><del>-    Handle handle() const;
</del><ins>+    BlobURLHandle handle() const;
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     WEBCORE_EXPORT explicit Blob(ScriptExecutionContext*);
</span><span class="lines">@@ -160,7 +149,7 @@
</span><span class="cx">     // This is an internal URL referring to the blob data associated with this object. It serves
</span><span class="cx">     // as an identifier for this blob. The internal URL is never used to source the blob's content
</span><span class="cx">     // into an HTML or for FileRead'ing, public blob URLs must be used for those purposes.
</span><del>-    Ref<BlobInternalURL> m_internalURL;
</del><ins>+    URL m_internalURL;
</ins><span class="cx"> 
</span><span class="cx">     HashSet<std::unique_ptr<BlobLoader>> m_blobLoaders;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiBlobURLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/BlobURL.cpp (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/BlobURL.cpp 2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/fileapi/BlobURL.cpp    2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -96,45 +96,67 @@
</span><span class="cx">     return URL({ }, urlString);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-URLWithBlobURLLifetimeExtension::URLWithBlobURLLifetimeExtension(const URL& url)
-    : m_url(url)
</del><ins>+BlobURLHandle::BlobURLHandle(const BlobURLHandle& other)
+    : m_url(other.m_url.isolatedCopy())
</ins><span class="cx"> {
</span><del>-    extendBlobURLLifetimeIfNecessary();
</del><ins>+    registerBlobURLHandleIfNecessary();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-URLWithBlobURLLifetimeExtension::~URLWithBlobURLLifetimeExtension()
</del><ins>+BlobURLHandle::BlobURLHandle(const URL& url)
+    : m_url(url.isolatedCopy())
</ins><span class="cx"> {
</span><del>-    unregisterCurrentURLIfNecessary();
</del><ins>+    ASSERT(m_url.protocolIsBlob());
+    registerBlobURLHandleIfNecessary();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void URLWithBlobURLLifetimeExtension::extendBlobURLLifetimeIfNecessary()
</del><ins>+BlobURLHandle::~BlobURLHandle()
</ins><span class="cx"> {
</span><del>-    if (m_url.protocolIsBlob()) {
-        auto origin = SecurityOrigin::create(BlobURL::getOriginURL(m_url));
-        URL temporaryBlobURL = BlobURL::createPublicURL(origin.ptr());
-        ThreadableBlobRegistry::registerBlobURL(origin.ptr(), temporaryBlobURL, m_url);
-        m_url = WTFMove(temporaryBlobURL);
-    }
</del><ins>+    unregisterBlobURLHandleIfNecessary();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void URLWithBlobURLLifetimeExtension::unregisterCurrentURLIfNecessary()
</del><ins>+void BlobURLHandle::registerBlobURLHandleIfNecessary()
</ins><span class="cx"> {
</span><span class="cx">     if (m_url.protocolIsBlob())
</span><del>-        ThreadableBlobRegistry::unregisterBlobURL(m_url);
</del><ins>+        ThreadableBlobRegistry::registerBlobURLHandle(m_url);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-URLWithBlobURLLifetimeExtension& URLWithBlobURLLifetimeExtension::operator=(URLWithBlobURLLifetimeExtension&& other)
</del><ins>+void BlobURLHandle::unregisterBlobURLHandleIfNecessary()
</ins><span class="cx"> {
</span><del>-    unregisterCurrentURLIfNecessary();
</del><ins>+    if (m_url.protocolIsBlob())
+        ThreadableBlobRegistry::unregisterBlobURLHandle(m_url);
+}
+
+BlobURLHandle& BlobURLHandle::operator=(const BlobURLHandle& other)
+{
+    if (this == &other)
+        return *this;
+
+    unregisterBlobURLHandleIfNecessary();
+    m_url = other.m_url.isolatedCopy();
+    registerBlobURLHandleIfNecessary();
+
+    return *this;
+}
+
+void BlobURLHandle::clear()
+{
+    unregisterBlobURLHandleIfNecessary();
+    m_url = { };
+}
+
+BlobURLHandle& BlobURLHandle::operator=(BlobURLHandle&& other)
+{
+    unregisterBlobURLHandleIfNecessary();
</ins><span class="cx">     m_url = std::exchange(other.m_url, { });
</span><span class="cx">     return *this;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-URLWithBlobURLLifetimeExtension& URLWithBlobURLLifetimeExtension::operator=(URL&& url)
</del><ins>+BlobURLHandle& BlobURLHandle::operator=(const URL& url)
</ins><span class="cx"> {
</span><del>-    unregisterCurrentURLIfNecessary();
-    m_url = WTFMove(url);
-    extendBlobURLLifetimeIfNecessary();
</del><ins>+    ASSERT(url.protocolIsBlob());
+    unregisterBlobURLHandleIfNecessary();
+    m_url = url.isolatedCopy();
+    registerBlobURLHandleIfNecessary();
</ins><span class="cx">     return *this;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiBlobURLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/BlobURL.h (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/BlobURL.h   2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/fileapi/BlobURL.h      2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -58,27 +58,31 @@
</span><span class="cx">     BlobURL() { }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-class URLWithBlobURLLifetimeExtension {
</del><ins>+// Extends the lifetime of the Blob URL. This means that the blob URL will remain valid after
+// revokeObjectURL() has been called, as long as BlobURLHandle objects refer to the blob URL.
+class BlobURLHandle {
</ins><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><del>-    WTF_MAKE_NONCOPYABLE(URLWithBlobURLLifetimeExtension);
</del><span class="cx"> public:
</span><del>-    URLWithBlobURLLifetimeExtension() = default;
-    explicit URLWithBlobURLLifetimeExtension(const URL&);
-    ~URLWithBlobURLLifetimeExtension();
</del><ins>+    BlobURLHandle() = default;
+    explicit BlobURLHandle(const URL&);
+    ~BlobURLHandle();
</ins><span class="cx"> 
</span><del>-    URLWithBlobURLLifetimeExtension(URLWithBlobURLLifetimeExtension&& other)
</del><ins>+    BlobURLHandle(const BlobURLHandle&);
+    BlobURLHandle(BlobURLHandle&& other)
</ins><span class="cx">         : m_url(std::exchange(other.m_url, { }))
</span><span class="cx">     { }
</span><span class="cx"> 
</span><del>-    URLWithBlobURLLifetimeExtension& operator=(URLWithBlobURLLifetimeExtension&&);
-    URLWithBlobURLLifetimeExtension& operator=(URL&&);
</del><ins>+    BlobURLHandle& operator=(const BlobURLHandle&);
+    BlobURLHandle& operator=(BlobURLHandle&&);
+    BlobURLHandle& operator=(const URL&);
</ins><span class="cx"> 
</span><del>-    operator const URL&() const { return m_url; }
-    const URL& url() const { return m_url; }
</del><ins>+    URL url() const { return m_url.isolatedCopy(); }
</ins><span class="cx"> 
</span><ins>+    void clear();
+
</ins><span class="cx"> private:
</span><del>-    void unregisterCurrentURLIfNecessary();
-    void extendBlobURLLifetimeIfNecessary();
</del><ins>+    void unregisterBlobURLHandleIfNecessary();
+    void registerBlobURLHandleIfNecessary();
</ins><span class="cx"> 
</span><span class="cx">     URL m_url;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiThreadableBlobRegistrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp  2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp     2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -155,15 +155,25 @@
</span><span class="cx">     if (isBlobURLContainsNullOrigin(url))
</span><span class="cx">         originMap()->remove(url.string());
</span><span class="cx"> 
</span><del>-    if (isMainThread()) {
</del><ins>+    ensureOnMainThread([url = url.isolatedCopy()] {
</ins><span class="cx">         blobRegistry().unregisterBlobURL(url);
</span><del>-        return;
-    }
-    callOnMainThread([url = url.isolatedCopy()] {
-        blobRegistry().unregisterBlobURL(url);
</del><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ThreadableBlobRegistry::registerBlobURLHandle(const URL& url)
+{
+    ensureOnMainThread([url = url.isolatedCopy()] {
+        blobRegistry().registerBlobURLHandle(url);
+    });
+}
+
+void ThreadableBlobRegistry::unregisterBlobURLHandle(const URL& url)
+{
+    ensureOnMainThread([url = url.isolatedCopy()] {
+        blobRegistry().unregisterBlobURLHandle(url);
+    });
+}
+
</ins><span class="cx"> RefPtr<SecurityOrigin> ThreadableBlobRegistry::getCachedOrigin(const URL& url)
</span><span class="cx"> {
</span><span class="cx">     if (auto cachedOrigin = originMap()->get(url.string()))
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiThreadableBlobRegistryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h    2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h       2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -47,6 +47,9 @@
</span><span class="cx">     static void registerBlobURLForSlice(const URL& newURL, const URL& srcURL, long long start, long long end, const String& contentType);
</span><span class="cx">     static void unregisterBlobURL(const URL&);
</span><span class="cx"> 
</span><ins>+    static void registerBlobURLHandle(const URL&);
+    static void unregisterBlobURLHandle(const URL&);
+
</ins><span class="cx">     static unsigned long long blobSize(const URL&);
</span><span class="cx"> 
</span><span class="cx">     // Returns the origin for the given blob URL. This is because we are not able to embed the unique security origin or the origin of file URL
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderPolicyCheckercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/PolicyChecker.cpp (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/PolicyChecker.cpp    2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/loader/PolicyChecker.cpp       2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -104,17 +104,12 @@
</span><span class="cx">     checkNavigationPolicy(WTFMove(newRequest), redirectResponse, m_frame.loader().activeDocumentLoader(), { }, WTFMove(function));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-URLWithBlobURLLifetimeExtension FrameLoader::PolicyChecker::extendBlobURLLifetimeIfNecessary(ResourceRequest& request, DocumentLoader* loader, PolicyDecisionMode mode) const
</del><ins>+BlobURLHandle FrameLoader::PolicyChecker::extendBlobURLLifetimeIfNecessary(const ResourceRequest& request, PolicyDecisionMode mode) const
</ins><span class="cx"> {
</span><span class="cx">     if (mode != PolicyDecisionMode::Asynchronous || !request.url().protocolIsBlob())
</span><span class="cx">         return { };
</span><span class="cx"> 
</span><del>-    URLWithBlobURLLifetimeExtension urlWithLifetimeExtension(request.url());
-    request.setURL(urlWithLifetimeExtension);
-    if (loader)
-        loader->request().setURL(urlWithLifetimeExtension);
-
-    return urlWithLifetimeExtension;
</del><ins>+    return BlobURLHandle { request.url() };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FrameLoader::PolicyChecker::checkNavigationPolicy(ResourceRequest&& request, const ResourceResponse& redirectResponse, DocumentLoader* loader, RefPtr<FormState>&& formState, NavigationPolicyDecisionFunction&& function, PolicyDecisionMode policyDecisionMode)
</span><span class="lines">@@ -197,7 +192,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_frame.loader().clearProvisionalLoadForPolicyCheck();
</span><span class="cx"> 
</span><del>-    auto blobURLLifetimeExtension = extendBlobURLLifetimeIfNecessary(request, loader, policyDecisionMode);
</del><ins>+    auto blobURLLifetimeExtension = extendBlobURLLifetimeIfNecessary(request, policyDecisionMode);
</ins><span class="cx"> 
</span><span class="cx">     bool isInitialEmptyDocumentLoad = !m_frame.loader().stateMachine().committedFirstRealDocumentLoad() && request.url().protocolIsAbout() && !substituteData.isValid();
</span><span class="cx">     auto requestIdentifier = PolicyCheckIdentifier::create();
</span><span class="lines">@@ -255,7 +250,7 @@
</span><span class="cx">     if (!DOMWindow::allowPopUp(m_frame))
</span><span class="cx">         return function({ }, nullptr, { }, { }, ShouldContinuePolicyCheck::No);
</span><span class="cx"> 
</span><del>-    auto blobURLLifetimeExtension = extendBlobURLLifetimeIfNecessary(request, nullptr);
</del><ins>+    auto blobURLLifetimeExtension = extendBlobURLLifetimeIfNecessary(request);
</ins><span class="cx"> 
</span><span class="cx">     auto requestIdentifier = PolicyCheckIdentifier::create();
</span><span class="cx">     m_frame.loader().client().dispatchDecidePolicyForNewWindowAction(navigationAction, request, formState.get(), frameName, requestIdentifier, [frame = makeRef(m_frame), request,
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderPolicyCheckerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/PolicyChecker.h (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/PolicyChecker.h      2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/loader/PolicyChecker.h 2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx"> class NavigationAction;
</span><span class="cx"> class ResourceError;
</span><span class="cx"> class ResourceResponse;
</span><del>-class URLWithBlobURLLifetimeExtension;
</del><ins>+class BlobURLHandle;
</ins><span class="cx"> 
</span><span class="cx"> enum class NavigationPolicyDecision : uint8_t {
</span><span class="cx">     ContinueLoad,
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     void handleUnimplementablePolicy(const ResourceError&);
</span><del>-    URLWithBlobURLLifetimeExtension extendBlobURLLifetimeIfNecessary(ResourceRequest&, DocumentLoader*, PolicyDecisionMode = PolicyDecisionMode::Asynchronous) const;
</del><ins>+    BlobURLHandle extendBlobURLLifetimeIfNecessary(const ResourceRequest&, PolicyDecisionMode = PolicyDecisionMode::Asynchronous) const;
</ins><span class="cx"> 
</span><span class="cx">     Frame& m_frame;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkBlobRegistryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/BlobRegistry.h (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/BlobRegistry.h     2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/platform/network/BlobRegistry.h        2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -63,6 +63,9 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void unregisterBlobURL(const URL&) = 0;
</span><span class="cx"> 
</span><ins>+    virtual void registerBlobURLHandle(const URL&) = 0;
+    virtual void unregisterBlobURLHandle(const URL&) = 0;
+
</ins><span class="cx">     virtual unsigned long long blobSize(const URL&) = 0;
</span><span class="cx"> 
</span><span class="cx">     virtual void writeBlobsToTemporaryFiles(const Vector<String>& blobURLs, CompletionHandler<void(Vector<String>&& filePaths)>&&) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkBlobRegistryImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp       2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp  2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -115,7 +115,7 @@
</span><span class="cx"> 
</span><span class="cx">     auto blobData = BlobData::create(contentType);
</span><span class="cx">     blobData->appendFile(WTFMove(file));
</span><del>-    m_blobs.set(url.string(), WTFMove(blobData));
</del><ins>+    addBlobData(url.string(), WTFMove(blobData));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void BlobRegistryImpl::registerBlobURL(const URL& url, Vector<BlobPart>&& blobParts, const String& contentType)
</span><span class="lines">@@ -149,7 +149,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_blobs.set(url.string(), WTFMove(blobData));
</del><ins>+    addBlobData(url.string(), WTFMove(blobData));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void BlobRegistryImpl::registerBlobURL(const URL& url, const URL& srcURL)
</span><span class="lines">@@ -164,7 +164,7 @@
</span><span class="cx"> 
</span><span class="cx">     BlobData* src = getBlobDataFromURL(srcURL);
</span><span class="cx">     if (src) {
</span><del>-        m_blobs.set(url.string(), src);
</del><ins>+        addBlobData(url.string(), src);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -174,7 +174,7 @@
</span><span class="cx">     auto backingFile = BlobData::create(contentType);
</span><span class="cx">     backingFile->appendFile(file.releaseNonNull());
</span><span class="cx"> 
</span><del>-    m_blobs.set(url.string(), WTFMove(backingFile));
</del><ins>+    addBlobData(url.string(), WTFMove(backingFile));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void BlobRegistryImpl::registerBlobURLForSlice(const URL& url, const URL& srcURL, long long start, long long end, const String& contentType)
</span><span class="lines">@@ -210,13 +210,14 @@
</span><span class="cx"> 
</span><span class="cx">     appendStorageItems(newData.ptr(), originalData->items(), start, newLength);
</span><span class="cx"> 
</span><del>-    m_blobs.set(url.string(), WTFMove(newData));
</del><ins>+    addBlobData(url.string(), WTFMove(newData));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void BlobRegistryImpl::unregisterBlobURL(const URL& url)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><del>-    m_blobs.remove(url.string());
</del><ins>+    if (m_blobReferences.remove(url.string()))
+        m_blobs.remove(url.string());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> BlobData* BlobRegistryImpl::getBlobDataFromURL(const URL& url) const
</span><span class="lines">@@ -359,4 +360,23 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void BlobRegistryImpl::addBlobData(const String& url, RefPtr<BlobData>&& blobData)
+{
+    auto addResult = m_blobs.set(url, WTFMove(blobData));
+    if (addResult.isNewEntry)
+        m_blobReferences.add(url);
+}
+
+void BlobRegistryImpl::registerBlobURLHandle(const URL& url)
+{
+    if (m_blobs.contains(url.string()))
+        m_blobReferences.add(url.string());
+}
+
+void BlobRegistryImpl::unregisterBlobURLHandle(const URL& url)
+{
+    if (m_blobReferences.remove(url.string()))
+        m_blobs.remove(url.string());
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkBlobRegistryImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/BlobRegistryImpl.h (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/BlobRegistryImpl.h 2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/platform/network/BlobRegistryImpl.h    2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include "BlobData.h"
</span><span class="cx"> #include "BlobRegistry.h"
</span><ins>+#include <wtf/HashCountedSet.h>
</ins><span class="cx"> #include <wtf/HashMap.h>
</span><span class="cx"> #include <wtf/URLHash.h>
</span><span class="cx"> #include <wtf/text/StringHash.h>
</span><span class="lines">@@ -65,6 +66,9 @@
</span><span class="cx">     void registerBlobURLForSlice(const URL&, const URL& srcURL, long long start, long long end, const String& contentType);
</span><span class="cx">     void unregisterBlobURL(const URL&);
</span><span class="cx"> 
</span><ins>+    void registerBlobURLHandle(const URL&);
+    void unregisterBlobURLHandle(const URL&);
+
</ins><span class="cx">     unsigned long long blobSize(const URL&);
</span><span class="cx"> 
</span><span class="cx">     void writeBlobsToTemporaryFiles(const Vector<String>& blobURLs, CompletionHandler<void(Vector<String>&& filePaths)>&&);
</span><span class="lines">@@ -78,6 +82,9 @@
</span><span class="cx">     Vector<RefPtr<BlobDataFileReference>> filesInBlob(const URL&) const;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+    void addBlobData(const String& url, RefPtr<BlobData>&&);
+
+    HashCountedSet<String> m_blobReferences;
</ins><span class="cx">     HashMap<String, RefPtr<BlobData>> m_blobs;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp      2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -251,7 +251,7 @@
</span><span class="cx">     // attempt to discourage synchronous XHR use. responseType is one such piece of functionality.
</span><span class="cx">     // We'll only disable this functionality for HTTP(S) requests since sync requests for local protocols
</span><span class="cx">     // such as file: and data: still make sense to allow.
</span><del>-    if (!m_async && scriptExecutionContext()->isDocument() && m_url.url().protocolIsInHTTPFamily()) {
</del><ins>+    if (!m_async && scriptExecutionContext()->isDocument() && m_url.protocolIsInHTTPFamily()) {
</ins><span class="cx">         logConsoleError(scriptExecutionContext(), "XMLHttpRequest.responseType cannot be changed for synchronous HTTP(S) requests made from the window context.");
</span><span class="cx">         return Exception { InvalidAccessError };
</span><span class="cx">     }
</span><span class="lines">@@ -382,9 +382,10 @@
</span><span class="cx">     clearResponse();
</span><span class="cx">     clearRequest();
</span><span class="cx"> 
</span><del>-    auto upgradedURL = url;
-    context->contentSecurityPolicy()->upgradeInsecureRequestIfNeeded(upgradedURL, ContentSecurityPolicy::InsecureRequestType::Load);
-    m_url = WTFMove(upgradedURL);
</del><ins>+    m_url = url;
+    context->contentSecurityPolicy()->upgradeInsecureRequestIfNeeded(m_url, ContentSecurityPolicy::InsecureRequestType::Load);
+    if (m_url.protocolIsBlob())
+        m_blobURLLifetimeExtension = m_url;
</ins><span class="cx"> 
</span><span class="cx">     m_async = async;
</span><span class="cx"> 
</span><span class="lines">@@ -417,7 +418,7 @@
</span><span class="cx">     auto& context = *scriptExecutionContext();
</span><span class="cx"> 
</span><span class="cx">     if (is<Document>(context) && downcast<Document>(context).shouldIgnoreSyncXHRs()) {
</span><del>-        logConsoleError(scriptExecutionContext(), makeString("Ignoring XMLHttpRequest.send() call for '", m_url.url().string(), "' because the maximum number of synchronous failures was reached."));
</del><ins>+        logConsoleError(scriptExecutionContext(), makeString("Ignoring XMLHttpRequest.send() call for '", m_url.string(), "' because the maximum number of synchronous failures was reached."));
</ins><span class="cx">         return ExceptionOr<void> { };
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -521,7 +522,7 @@
</span><span class="cx">         return WTFMove(result.value());
</span><span class="cx"> 
</span><span class="cx">     if (m_method != "GET" && m_method != "HEAD") {
</span><del>-        if (!m_url.url().protocolIsInHTTPFamily()) {
</del><ins>+        if (!m_url.protocolIsInHTTPFamily()) {
</ins><span class="cx">             // FIXME: We would like to support posting Blobs to non-http URLs (e.g. custom URL schemes)
</span><span class="cx">             // but because of the architecture of blob-handling that will require a fair amount of work.
</span><span class="cx">             
</span><span class="lines">@@ -594,8 +595,10 @@
</span><span class="cx"> ExceptionOr<void> XMLHttpRequest::createRequest()
</span><span class="cx"> {
</span><span class="cx">     // Only GET request is supported for blob URL.
</span><del>-    if (!m_async && m_url.url().protocolIsBlob() && m_method != "GET")
</del><ins>+    if (!m_async && m_url.protocolIsBlob() && m_method != "GET") {
+        m_blobURLLifetimeExtension.clear();
</ins><span class="cx">         return Exception { NetworkError };
</span><ins>+    }
</ins><span class="cx"> 
</span><span class="cx">     if (m_async && m_upload && m_upload->hasEventListeners())
</span><span class="cx">         m_uploadListenerFlag = true;
</span><span class="lines">@@ -747,6 +750,7 @@
</span><span class="cx">     m_requestHeaders.clear();
</span><span class="cx">     m_requestEntityBody = nullptr;
</span><span class="cx">     m_url = URL { };
</span><ins>+    m_blobURLLifetimeExtension.clear();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void XMLHttpRequest::genericError()
</span><span class="lines">@@ -939,6 +943,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_loadingActivity = std::nullopt;
</span><span class="cx">     m_url = URL { };
</span><ins>+    m_blobURLLifetimeExtension.clear();
</ins><span class="cx"> 
</span><span class="cx">     m_sendFlag = false;
</span><span class="cx">     changeState(DONE);
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequest.h (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequest.h        2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.h   2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -216,7 +216,8 @@
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr<XMLHttpRequestUpload> m_upload;
</span><span class="cx"> 
</span><del>-    URLWithBlobURLLifetimeExtension m_url;
</del><ins>+    URL m_url;
+    BlobURLHandle m_blobURLLifetimeExtension;
</ins><span class="cx">     String m_method;
</span><span class="cx">     HTTPHeaderMap m_requestHeaders;
</span><span class="cx">     RefPtr<FormData> m_requestEntityBody;
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebKit/ChangeLog       2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2021-08-09  Chris Dumez  <cdumez@apple.com>
+
+        Blob URL changes after loading it
+        https://bugs.webkit.org/show_bug.cgi?id=228923
+
+        Reviewed by Geoff Garen.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::registerBlobURLHandle):
+        (WebKit::NetworkConnectionToWebProcess::unregisterBlobURLHandle):
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+        * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
+        (WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
+        * WebProcess/FileAPI/BlobRegistryProxy.cpp:
+        (WebKit::BlobRegistryProxy::registerBlobURLHandle):
+        (WebKit::BlobRegistryProxy::unregisterBlobURLHandle):
+        * WebProcess/FileAPI/BlobRegistryProxy.h:
+
</ins><span class="cx"> 2021-08-09  Myles C. Maxfield  <mmaxfield@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Create a Language log channel
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkConnectionToWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp     2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp        2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -866,6 +866,24 @@
</span><span class="cx">     session->blobRegistry().unregisterBlobURL(url);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void NetworkConnectionToWebProcess::registerBlobURLHandle(const URL& url)
+{
+    auto* session = networkSession();
+    if (!session)
+        return;
+
+    session->blobRegistry().registerBlobURLHandle(url);
+}
+
+void NetworkConnectionToWebProcess::unregisterBlobURLHandle(const URL& url)
+{
+    auto* session = networkSession();
+    if (!session)
+        return;
+
+    session->blobRegistry().unregisterBlobURLHandle(url);
+}
+
</ins><span class="cx"> void NetworkConnectionToWebProcess::blobSize(const URL& url, CompletionHandler<void(uint64_t)>&& completionHandler)
</span><span class="cx"> {
</span><span class="cx">     auto* session = networkSession();
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkConnectionToWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h       2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h  2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -236,6 +236,9 @@
</span><span class="cx">     void unregisterBlobURL(const URL&);
</span><span class="cx">     void writeBlobsToTemporaryFiles(const Vector<String>& blobURLs, CompletionHandler<void(Vector<String>&&)>&&);
</span><span class="cx"> 
</span><ins>+    void registerBlobURLHandle(const URL&);
+    void unregisterBlobURLHandle(const URL&);
+
</ins><span class="cx">     void setCaptureExtraNetworkLoadMetricsEnabled(bool);
</span><span class="cx"> 
</span><span class="cx">     void createSocketStream(URL&&, String cachePartition, WebCore::WebSocketIdentifier);
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkConnectionToWebProcessmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in     2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in        2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -56,6 +56,8 @@
</span><span class="cx">     UnregisterBlobURL(URL url)
</span><span class="cx">     BlobSize(URL url) -> (uint64_t resultSize) Synchronous
</span><span class="cx">     WriteBlobsToTemporaryFiles(Vector<String> blobURLs) -> (Vector<String> fileNames) Async
</span><ins>+    RegisterBlobURLHandle(URL url);
+    UnregisterBlobURLHandle(URL url);
</ins><span class="cx"> 
</span><span class="cx">     SetCaptureExtraNetworkLoadMetricsEnabled(bool enabled)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkProcessPlatformStrategiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.cpp (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.cpp  2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.cpp     2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -65,6 +65,8 @@
</span><span class="cx">         void unregisterBlobURL(const URL&) final { ASSERT_NOT_REACHED(); }
</span><span class="cx">         unsigned long long blobSize(const URL&) final { ASSERT_NOT_REACHED(); return 0; }
</span><span class="cx">         void writeBlobsToTemporaryFiles(const Vector<String>& blobURLs, CompletionHandler<void(Vector<String>&& filePaths)>&&) final { ASSERT_NOT_REACHED(); }
</span><ins>+        void registerBlobURLHandle(const URL&) final { ASSERT_NOT_REACHED(); }
+        void unregisterBlobURLHandle(const URL&) final { ASSERT_NOT_REACHED(); }
</ins><span class="cx">     };
</span><span class="cx">     static NeverDestroyed<EmptyBlobRegistry> blobRegistry;
</span><span class="cx">     return &blobRegistry.get();
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessFileAPIBlobRegistryProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.cpp (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.cpp     2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.cpp        2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -74,6 +74,16 @@
</span><span class="cx">     WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLForSlice(url, srcURL, start, end, contentType), 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void BlobRegistryProxy::registerBlobURLHandle(const URL& url)
+{
+    WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLHandle(url), 0);
+}
+
+void BlobRegistryProxy::unregisterBlobURLHandle(const URL& url)
+{
+    WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::UnregisterBlobURLHandle(url), 0);
+}
+
</ins><span class="cx"> unsigned long long BlobRegistryProxy::blobSize(const URL& url)
</span><span class="cx"> {
</span><span class="cx">     uint64_t resultSize;
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessFileAPIBlobRegistryProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.h (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.h       2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebKit/WebProcess/FileAPI/BlobRegistryProxy.h  2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -39,6 +39,8 @@
</span><span class="cx">     void registerBlobURLForSlice(const URL&, const URL& srcURL, long long start, long long end, const String& contentType) final;
</span><span class="cx">     unsigned long long blobSize(const URL&) final;
</span><span class="cx">     void writeBlobsToTemporaryFiles(const Vector<String>& blobURLs, CompletionHandler<void(Vector<String>&& filePaths)>&&) final;
</span><ins>+    void registerBlobURLHandle(const URL&) final;
+    void unregisterBlobURLHandle(const URL&) final;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitLegacymacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/mac/ChangeLog  2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog     2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2021-08-09  Chris Dumez  <cdumez@apple.com>
+
+        Blob URL changes after loading it
+        https://bugs.webkit.org/show_bug.cgi?id=228923
+
+        Reviewed by Geoff Garen.
+
+        * WebCoreSupport/WebPlatformStrategies.mm:
+
</ins><span class="cx"> 2021-08-09  Myles C. Maxfield  <mmaxfield@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Support WTF logging channels
</span></span></pre></div>
<a id="trunkSourceWebKitLegacymacWebCoreSupportWebPlatformStrategiesmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm    2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm       2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -91,6 +91,8 @@
</span><span class="cx">     void unregisterBlobURL(const URL& url) final { m_blobRegistry.unregisterBlobURL(url); }
</span><span class="cx">     unsigned long long blobSize(const URL& url) final { return m_blobRegistry.blobSize(url); }
</span><span class="cx">     void writeBlobsToTemporaryFiles(const Vector<String>& blobURLs, CompletionHandler<void(Vector<String>&& filePaths)>&& completionHandler) final { m_blobRegistry.writeBlobsToTemporaryFiles(blobURLs, WTFMove(completionHandler)); }
</span><ins>+    void registerBlobURLHandle(const URL& url) final { m_blobRegistry.registerBlobURLHandle(url); }
+    void unregisterBlobURLHandle(const URL& url) final { m_blobRegistry.unregisterBlobURLHandle(url); }
</ins><span class="cx"> 
</span><span class="cx">     BlobRegistryImpl* blobRegistryImpl() final { return &m_blobRegistry; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitLegacywinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/win/ChangeLog (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/win/ChangeLog  2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebKitLegacy/win/ChangeLog     2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2021-08-09  Chris Dumez  <cdumez@apple.com>
+
+        Blob URL changes after loading it
+        https://bugs.webkit.org/show_bug.cgi?id=228923
+
+        Reviewed by Geoff Garen.
+
+        * WebCoreSupport/WebPlatformStrategies.cpp:
+
</ins><span class="cx"> 2021-08-09  Stephan Szabo  <stephan.szabo@sony.com>
</span><span class="cx"> 
</span><span class="cx">         [WinCairo][Debug] Build fix after r280756
</span></span></pre></div>
<a id="trunkSourceWebKitLegacywinWebCoreSupportWebPlatformStrategiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp (280823 => 280824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp   2021-08-10 03:11:48 UTC (rev 280823)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp      2021-08-10 03:33:03 UTC (rev 280824)
</span><span class="lines">@@ -87,6 +87,8 @@
</span><span class="cx">     void unregisterBlobURL(const URL& url) final { m_blobRegistry.unregisterBlobURL(url); }
</span><span class="cx">     unsigned long long blobSize(const URL& url) final { return m_blobRegistry.blobSize(url); }
</span><span class="cx">     void writeBlobsToTemporaryFiles(const Vector<String>& blobURLs, CompletionHandler<void(Vector<String>&& filePaths)>&& completionHandler) final { m_blobRegistry.writeBlobsToTemporaryFiles(blobURLs, WTFMove(completionHandler)); }
</span><ins>+    void registerBlobURLHandle(const URL& url) final { m_blobRegistry.registerBlobURLHandle(url); }
+    void unregisterBlobURLHandle(const URL& url) final { m_blobRegistry.unregisterBlobURLHandle(url); }
</ins><span class="cx"> 
</span><span class="cx">     BlobRegistryImpl* blobRegistryImpl() final { return &m_blobRegistry; }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>