Remove SupportPartitionedBlobUrl feature flag
The flag now acts as always-enabled. Bug: 346498600 Change-Id: Ifb4c977a748149e9e10ae68066cd960d137a5e4c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5647510 Reviewed-by: Brendon Tiszka <tiszka@chromium.org> Reviewed-by: David Baron <dbaron@chromium.org> Auto-Submit: Janice Liu <janiceliu@google.com> Commit-Queue: Janice Liu <janiceliu@google.com> Reviewed-by: Evan Stade <estade@chromium.org> Cr-Commit-Position: refs/heads/main@{#1324991}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
305e573101
commit
2457d49d76
android_webview/java/src/org/chromium/android_webview/common
chrome/browser
content
browser
blob_storage
browser_interface_binders.ccrenderer_host
security_exploit_browsertest.ccstorage_partition_impl.cccommon
public
net/base
storage/browser/blob
blob_registry_impl.ccblob_registry_impl.hblob_registry_impl_unittest.ccblob_url_registry.ccblob_url_registry_unittest.ccblob_url_store_impl.ccblob_url_store_impl_unittest.cc
third_party/blink
public
mojom
renderer
core
platform
blob
@ -653,10 +653,6 @@ public final class ProductionSupportedFlagList {
|
||||
Flag.baseFeature(
|
||||
BlinkFeatures.ANDROID_EXTENDED_KEYBOARD_SHORTCUTS,
|
||||
"Enables WebView to use the extended keyboard shortcuts added for Android U"),
|
||||
Flag.baseFeature(
|
||||
NetFeatures.SUPPORT_PARTITIONED_BLOB_URL,
|
||||
"Enables the new Blob URL implementation needed for third-party storage"
|
||||
+ " partitioning"),
|
||||
Flag.baseFeature(
|
||||
NetFeatures.THIRD_PARTY_STORAGE_PARTITIONING,
|
||||
"Enables partitioning of third-party storage by top-level site. Note: this is under"
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "net/dns/mock_host_resolver.h"
|
||||
#include "net/test/embedded_test_server/embedded_test_server.h"
|
||||
#include "storage/browser/blob/blob_registry_impl.h"
|
||||
#include "storage/browser/blob/blob_url_registry.h"
|
||||
#include "third_party/blink/public/common/blob/blob_utils.h"
|
||||
#include "third_party/blink/public/common/features.h"
|
||||
#include "third_party/blink/public/common/storage_key/storage_key.h"
|
||||
@ -445,45 +446,9 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityExploitBrowserTest,
|
||||
body);
|
||||
}
|
||||
|
||||
enum class ChromeSecurityExploitBrowserTestMojoBlobURLsTestCase {
|
||||
kSupportPartitionedBlobUrlDisabled,
|
||||
kSupportPartitionedBlobUrlEnabled,
|
||||
};
|
||||
|
||||
class ChromeSecurityExploitBrowserTestMojoBlobURLsP
|
||||
: public ChromeSecurityExploitBrowserTest,
|
||||
public testing::WithParamInterface<
|
||||
ChromeSecurityExploitBrowserTestMojoBlobURLsTestCase> {
|
||||
public:
|
||||
ChromeSecurityExploitBrowserTestMojoBlobURLsP() = default;
|
||||
|
||||
void SetUp() override {
|
||||
test_case_ = GetParam();
|
||||
scoped_feature_list_.InitWithFeatureState(
|
||||
net::features::kSupportPartitionedBlobUrl,
|
||||
test_case_ == ChromeSecurityExploitBrowserTestMojoBlobURLsTestCase::
|
||||
kSupportPartitionedBlobUrlEnabled);
|
||||
|
||||
ChromeSecurityExploitBrowserTest::SetUp();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
if (base::FeatureList::IsEnabled(
|
||||
net::features::kSupportPartitionedBlobUrl)) {
|
||||
storage::BlobUrlRegistry::SetURLStoreCreationHookForTesting(nullptr);
|
||||
} else {
|
||||
storage::BlobRegistryImpl::SetURLStoreCreationHookForTesting(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
ChromeSecurityExploitBrowserTestMojoBlobURLsTestCase test_case_;
|
||||
base::test::ScopedFeatureList scoped_feature_list_;
|
||||
};
|
||||
|
||||
// Extension isolation prevents a normal renderer process from being able to
|
||||
// create a "blob:chrome-extension://" resource.
|
||||
IN_PROC_BROWSER_TEST_P(ChromeSecurityExploitBrowserTestMojoBlobURLsP,
|
||||
IN_PROC_BROWSER_TEST_F(ChromeSecurityExploitBrowserTest,
|
||||
CreateBlobInExtensionOrigin) {
|
||||
// Target an extension.
|
||||
std::string target_origin = "chrome-extension://" + extension()->id();
|
||||
@ -495,19 +460,11 @@ IN_PROC_BROWSER_TEST_P(ChromeSecurityExploitBrowserTestMojoBlobURLsP,
|
||||
mojo::SelfOwnedAssociatedReceiverRef<blink::mojom::BlobURLStore>)>
|
||||
blob_registry_impl_intercept_hook;
|
||||
|
||||
if (base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl)) {
|
||||
blob_url_registry_intercept_hook =
|
||||
base::BindRepeating(&content::BlobURLStoreInterceptor::Intercept,
|
||||
GURL("blob:" + target_origin + "/" + blob_path));
|
||||
storage::BlobUrlRegistry::SetURLStoreCreationHookForTesting(
|
||||
&blob_url_registry_intercept_hook);
|
||||
} else {
|
||||
blob_registry_impl_intercept_hook = base::BindRepeating(
|
||||
&content::BlobURLStoreInterceptor::InterceptDeprecated,
|
||||
GURL("blob:" + target_origin + "/" + blob_path));
|
||||
storage::BlobRegistryImpl::SetURLStoreCreationHookForTesting(
|
||||
&blob_registry_impl_intercept_hook);
|
||||
}
|
||||
blob_url_registry_intercept_hook =
|
||||
base::BindRepeating(&content::BlobURLStoreInterceptor::Intercept,
|
||||
GURL("blob:" + target_origin + "/" + blob_path));
|
||||
storage::BlobUrlRegistry::SetURLStoreCreationHookForTesting(
|
||||
&blob_url_registry_intercept_hook);
|
||||
|
||||
ASSERT_TRUE(ui_test_utils::NavigateToURL(
|
||||
browser(),
|
||||
@ -533,7 +490,7 @@ IN_PROC_BROWSER_TEST_P(ChromeSecurityExploitBrowserTestMojoBlobURLsP,
|
||||
}
|
||||
|
||||
// chrome://xyz should not be able to create a "blob:chrome://abc" resource.
|
||||
IN_PROC_BROWSER_TEST_P(ChromeSecurityExploitBrowserTestMojoBlobURLsP,
|
||||
IN_PROC_BROWSER_TEST_F(ChromeSecurityExploitBrowserTest,
|
||||
CreateBlobInOtherChromeUIOrigin) {
|
||||
ASSERT_TRUE(
|
||||
ui_test_utils::NavigateToURL(browser(), GURL("chrome://version")));
|
||||
@ -552,19 +509,11 @@ IN_PROC_BROWSER_TEST_P(ChromeSecurityExploitBrowserTestMojoBlobURLsP,
|
||||
mojo::SelfOwnedAssociatedReceiverRef<blink::mojom::BlobURLStore>)>
|
||||
blob_registry_impl_intercept_hook;
|
||||
|
||||
if (base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl)) {
|
||||
blob_url_registry_intercept_hook =
|
||||
base::BindRepeating(&content::BlobURLStoreInterceptor::Intercept,
|
||||
GURL("blob:" + target_origin + "/" + blob_path));
|
||||
storage::BlobUrlRegistry::SetURLStoreCreationHookForTesting(
|
||||
&blob_url_registry_intercept_hook);
|
||||
} else {
|
||||
blob_registry_impl_intercept_hook = base::BindRepeating(
|
||||
&content::BlobURLStoreInterceptor::InterceptDeprecated,
|
||||
GURL("blob:" + target_origin + "/" + blob_path));
|
||||
storage::BlobRegistryImpl::SetURLStoreCreationHookForTesting(
|
||||
&blob_registry_impl_intercept_hook);
|
||||
}
|
||||
blob_url_registry_intercept_hook =
|
||||
base::BindRepeating(&content::BlobURLStoreInterceptor::Intercept,
|
||||
GURL("blob:" + target_origin + "/" + blob_path));
|
||||
storage::BlobUrlRegistry::SetURLStoreCreationHookForTesting(
|
||||
&blob_url_registry_intercept_hook);
|
||||
|
||||
content::RenderFrameHost* rfh = browser()
|
||||
->tab_strip_model()
|
||||
@ -584,11 +533,3 @@ IN_PROC_BROWSER_TEST_P(ChromeSecurityExploitBrowserTestMojoBlobURLsP,
|
||||
"URL with invalid origin passed to BlobURLStore::Register",
|
||||
crash_observer.Wait());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
ChromeSecurityExploitBrowserTestMojoBlobURLs,
|
||||
ChromeSecurityExploitBrowserTestMojoBlobURLsP,
|
||||
::testing::Values(ChromeSecurityExploitBrowserTestMojoBlobURLsTestCase::
|
||||
kSupportPartitionedBlobUrlDisabled,
|
||||
ChromeSecurityExploitBrowserTestMojoBlobURLsTestCase::
|
||||
kSupportPartitionedBlobUrlEnabled));
|
||||
|
@ -39,26 +39,9 @@ class BindingDelegate : public storage::BlobRegistryImpl::Delegate {
|
||||
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
scoped_refptr<BlobRegistryWrapper> BlobRegistryWrapper::Create(
|
||||
scoped_refptr<ChromeBlobStorageContext> blob_storage_context,
|
||||
base::WeakPtr<storage::BlobUrlRegistry> blob_url_registry) {
|
||||
DCHECK(
|
||||
!base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl));
|
||||
scoped_refptr<BlobRegistryWrapper> result(new BlobRegistryWrapper());
|
||||
GetIOThreadTaskRunner({})->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(&BlobRegistryWrapper::InitializeOnIOThreadDeprecated,
|
||||
result, std::move(blob_storage_context),
|
||||
std::move(blob_url_registry)));
|
||||
return result;
|
||||
}
|
||||
|
||||
// static
|
||||
scoped_refptr<BlobRegistryWrapper> BlobRegistryWrapper::Create(
|
||||
scoped_refptr<ChromeBlobStorageContext> blob_storage_context) {
|
||||
DCHECK(
|
||||
base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl));
|
||||
scoped_refptr<BlobRegistryWrapper> result(new BlobRegistryWrapper());
|
||||
GetIOThreadTaskRunner({})->PostTask(
|
||||
FROM_HERE, base::BindOnce(&BlobRegistryWrapper::InitializeOnIOThread,
|
||||
@ -81,21 +64,8 @@ void BlobRegistryWrapper::Bind(
|
||||
|
||||
BlobRegistryWrapper::~BlobRegistryWrapper() = default;
|
||||
|
||||
void BlobRegistryWrapper::InitializeOnIOThreadDeprecated(
|
||||
scoped_refptr<ChromeBlobStorageContext> blob_storage_context,
|
||||
base::WeakPtr<storage::BlobUrlRegistry> blob_url_registry) {
|
||||
DCHECK(
|
||||
!base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl));
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
blob_registry_ = std::make_unique<storage::BlobRegistryImpl>(
|
||||
blob_storage_context->context()->AsWeakPtr(),
|
||||
std::move(blob_url_registry), GetUIThreadTaskRunner({}));
|
||||
}
|
||||
|
||||
void BlobRegistryWrapper::InitializeOnIOThread(
|
||||
scoped_refptr<ChromeBlobStorageContext> blob_storage_context) {
|
||||
DCHECK(
|
||||
base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl));
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
blob_registry_ = std::make_unique<storage::BlobRegistryImpl>(
|
||||
blob_storage_context->context()->AsWeakPtr());
|
||||
|
@ -747,11 +747,8 @@ void PopulateFrameBinders(RenderFrameHostImpl* host, mojo::BinderMap* map) {
|
||||
map->Add<blink::mojom::CodeCacheHost>(base::BindRepeating(
|
||||
&RenderFrameHostImpl::CreateCodeCacheHost, base::Unretained(host)));
|
||||
|
||||
if (base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl)) {
|
||||
map->Add<blink::mojom::BlobURLStore>(
|
||||
base::BindRepeating(&RenderFrameHostImpl::BindBlobUrlStoreReceiver,
|
||||
base::Unretained(host)));
|
||||
}
|
||||
map->Add<blink::mojom::BlobURLStore>(base::BindRepeating(
|
||||
&RenderFrameHostImpl::BindBlobUrlStoreReceiver, base::Unretained(host)));
|
||||
|
||||
if (base::FeatureList::IsEnabled(blink::features::kComputePressure)) {
|
||||
map->Add<blink::mojom::WebPressureManager>(
|
||||
@ -1343,11 +1340,9 @@ void PopulateDedicatedWorkerBinders(DedicatedWorkerHost* host,
|
||||
map->Add<blink::mojom::BroadcastChannelProvider>(
|
||||
base::BindRepeating(&DedicatedWorkerHost::CreateBroadcastChannelProvider,
|
||||
base::Unretained(host)));
|
||||
if (base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl)) {
|
||||
map->Add<blink::mojom::BlobURLStore>(
|
||||
base::BindRepeating(&DedicatedWorkerHost::CreateBlobUrlStoreProvider,
|
||||
base::Unretained(host)));
|
||||
}
|
||||
map->Add<blink::mojom::BlobURLStore>(
|
||||
base::BindRepeating(&DedicatedWorkerHost::CreateBlobUrlStoreProvider,
|
||||
base::Unretained(host)));
|
||||
map->Add<blink::mojom::ReportingServiceProxy>(base::BindRepeating(
|
||||
&CreateReportingServiceProxyForDedicatedWorker, base::Unretained(host)));
|
||||
#if !BUILDFLAG(IS_ANDROID)
|
||||
@ -1457,10 +1452,8 @@ void PopulateSharedWorkerBinders(SharedWorkerHost* host, mojo::BinderMap* map) {
|
||||
map->Add<blink::mojom::BroadcastChannelProvider>(
|
||||
base::BindRepeating(&SharedWorkerHost::CreateBroadcastChannelProvider,
|
||||
base::Unretained(host)));
|
||||
if (base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl)) {
|
||||
map->Add<blink::mojom::BlobURLStore>(base::BindRepeating(
|
||||
&SharedWorkerHost::CreateBlobUrlStoreProvider, base::Unretained(host)));
|
||||
}
|
||||
map->Add<blink::mojom::BlobURLStore>(base::BindRepeating(
|
||||
&SharedWorkerHost::CreateBlobUrlStoreProvider, base::Unretained(host)));
|
||||
map->Add<blink::mojom::ReportingServiceProxy>(base::BindRepeating(
|
||||
&CreateReportingServiceProxyForSharedWorker, base::Unretained(host)));
|
||||
map->Add<blink::mojom::BucketManagerHost>(base::BindRepeating(
|
||||
@ -1560,11 +1553,8 @@ void PopulateServiceWorkerBinders(ServiceWorkerHost* host,
|
||||
map->Add<blink::mojom::BroadcastChannelProvider>(
|
||||
base::BindRepeating(&ServiceWorkerHost::CreateBroadcastChannelProvider,
|
||||
base::Unretained(host)));
|
||||
if (base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl)) {
|
||||
map->Add<blink::mojom::BlobURLStore>(
|
||||
base::BindRepeating(&ServiceWorkerHost::CreateBlobUrlStoreProvider,
|
||||
base::Unretained(host)));
|
||||
}
|
||||
map->Add<blink::mojom::BlobURLStore>(base::BindRepeating(
|
||||
&ServiceWorkerHost::CreateBlobUrlStoreProvider, base::Unretained(host)));
|
||||
map->Add<blink::mojom::ReportingServiceProxy>(base::BindRepeating(
|
||||
&CreateReportingServiceProxyForServiceWorker, base::Unretained(host)));
|
||||
#if !BUILDFLAG(IS_ANDROID)
|
||||
|
@ -331,12 +331,10 @@ void RenderFrameHostImpl::SetUpMojoConnection() {
|
||||
base::BindRepeating(&RenderFrameHostImpl::CreateBroadcastChannelProvider,
|
||||
base::Unretained(this)));
|
||||
|
||||
if (base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl)) {
|
||||
associated_registry_->AddInterface<blink::mojom::BlobURLStore>(
|
||||
base::BindRepeating(
|
||||
&RenderFrameHostImpl::BindBlobUrlStoreAssociatedReceiver,
|
||||
base::Unretained(this)));
|
||||
}
|
||||
associated_registry_->AddInterface<blink::mojom::BlobURLStore>(
|
||||
base::BindRepeating(
|
||||
&RenderFrameHostImpl::BindBlobUrlStoreAssociatedReceiver,
|
||||
base::Unretained(this)));
|
||||
|
||||
if (base::FeatureList::IsEnabled(
|
||||
blink::features::kEnableFileBackedBlobFactory)) {
|
||||
|
@ -284,6 +284,10 @@ class SecurityExploitBrowserTest : public ContentBrowserTest {
|
||||
",EXCLUDE localhost");
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
storage::BlobUrlRegistry::SetURLStoreCreationHookForTesting(nullptr);
|
||||
}
|
||||
|
||||
void SetUpOnMainThread() override {
|
||||
// Complete the manual Start() after ContentBrowserTest's own
|
||||
// initialization, ref. comment on InitializeAndListen() above.
|
||||
@ -771,46 +775,10 @@ IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest,
|
||||
kill_waiter.Wait());
|
||||
}
|
||||
|
||||
enum class SecurityExploitBrowserTestMojoBlobURLsTestCase {
|
||||
kSupportPartitionedBlobUrlDisabled,
|
||||
kSupportPartitionedBlobUrlEnabled,
|
||||
};
|
||||
|
||||
class SecurityExploitBrowserTestMojoBlobURLsP
|
||||
: public SecurityExploitBrowserTest,
|
||||
public testing::WithParamInterface<
|
||||
SecurityExploitBrowserTestMojoBlobURLsTestCase> {
|
||||
public:
|
||||
SecurityExploitBrowserTestMojoBlobURLsP() = default;
|
||||
|
||||
void SetUp() override {
|
||||
test_case_ = GetParam();
|
||||
scoped_feature_list_.InitWithFeatureState(
|
||||
net::features::kSupportPartitionedBlobUrl,
|
||||
test_case_ == SecurityExploitBrowserTestMojoBlobURLsTestCase::
|
||||
kSupportPartitionedBlobUrlEnabled);
|
||||
|
||||
SecurityExploitBrowserTest::SetUp();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
if (base::FeatureList::IsEnabled(
|
||||
net::features::kSupportPartitionedBlobUrl)) {
|
||||
storage::BlobUrlRegistry::SetURLStoreCreationHookForTesting(nullptr);
|
||||
} else {
|
||||
storage::BlobRegistryImpl::SetURLStoreCreationHookForTesting(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
SecurityExploitBrowserTestMojoBlobURLsTestCase test_case_;
|
||||
base::test::ScopedFeatureList scoped_feature_list_;
|
||||
};
|
||||
|
||||
// Check that when site isolation is enabled, an origin can't create a blob URL
|
||||
// for a different origin. Similar to the test above, but checks the
|
||||
// mojo-based Blob URL implementation. See https://crbug.com/886976.
|
||||
IN_PROC_BROWSER_TEST_P(SecurityExploitBrowserTestMojoBlobURLsP,
|
||||
IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest,
|
||||
CreateMojoBlobURLInDifferentOrigin) {
|
||||
IsolateAllSitesForTesting(base::CommandLine::ForCurrentProcess());
|
||||
|
||||
@ -825,23 +793,12 @@ IN_PROC_BROWSER_TEST_P(SecurityExploitBrowserTestMojoBlobURLsP,
|
||||
|
||||
base::RepeatingCallback<void(storage::BlobUrlRegistry*, mojo::ReceiverId)>
|
||||
blob_url_registry_intercept_hook;
|
||||
base::RepeatingCallback<void(
|
||||
mojo::SelfOwnedAssociatedReceiverRef<blink::mojom::BlobURLStore>)>
|
||||
blob_registry_impl_intercept_hook;
|
||||
|
||||
if (base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl)) {
|
||||
blob_url_registry_intercept_hook =
|
||||
base::BindRepeating(&BlobURLStoreInterceptor::Intercept,
|
||||
GURL("blob:" + target_origin + "/" + blob_path));
|
||||
storage::BlobUrlRegistry::SetURLStoreCreationHookForTesting(
|
||||
&blob_url_registry_intercept_hook);
|
||||
} else {
|
||||
blob_registry_impl_intercept_hook =
|
||||
base::BindRepeating(&BlobURLStoreInterceptor::InterceptDeprecated,
|
||||
GURL("blob:" + target_origin + "/" + blob_path));
|
||||
storage::BlobRegistryImpl::SetURLStoreCreationHookForTesting(
|
||||
&blob_registry_impl_intercept_hook);
|
||||
}
|
||||
blob_url_registry_intercept_hook =
|
||||
base::BindRepeating(&BlobURLStoreInterceptor::Intercept,
|
||||
GURL("blob:" + target_origin + "/" + blob_path));
|
||||
storage::BlobUrlRegistry::SetURLStoreCreationHookForTesting(
|
||||
&blob_url_registry_intercept_hook);
|
||||
|
||||
// Register a blob URL from the a.com main frame, which will go through the
|
||||
// interceptor above and be rewritten to register the blob URL with the b.com
|
||||
@ -2408,13 +2365,4 @@ IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTestFencedFrames,
|
||||
fenced_rfh->DidFocusFrame();
|
||||
EXPECT_EQ(bad_message::RFH_FOCUS_ACROSS_FENCED_BOUNDARY, kill_waiter.Wait());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
SecurityExploitBrowserTestMojoBlobURLs,
|
||||
SecurityExploitBrowserTestMojoBlobURLsP,
|
||||
::testing::Values(SecurityExploitBrowserTestMojoBlobURLsTestCase::
|
||||
kSupportPartitionedBlobUrlDisabled,
|
||||
SecurityExploitBrowserTestMojoBlobURLsTestCase::
|
||||
kSupportPartitionedBlobUrlEnabled));
|
||||
|
||||
} // namespace content
|
||||
|
@ -1403,13 +1403,7 @@ void StoragePartitionImpl::Initialize(
|
||||
? fallback_for_blob_urls->GetBlobUrlRegistry()->AsWeakPtr()
|
||||
: nullptr);
|
||||
|
||||
if (base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl)) {
|
||||
blob_registry_ = BlobRegistryWrapper::Create(blob_context);
|
||||
|
||||
} else {
|
||||
blob_registry_ = BlobRegistryWrapper::Create(
|
||||
blob_context, blob_url_registry_->AsWeakPtr());
|
||||
}
|
||||
blob_registry_ = BlobRegistryWrapper::Create(blob_context);
|
||||
|
||||
subresource_proxying_url_loader_service_ =
|
||||
std::make_unique<SubresourceProxyingURLLoaderService>(browser_context_);
|
||||
|
@ -195,13 +195,8 @@ bool ShouldQueueNavigationsWhenPendingCommitRFHExists() {
|
||||
}
|
||||
|
||||
bool ShouldRestrictCanAccessDataForOriginToUIThread() {
|
||||
// Only restrict calls to the UI thread if:
|
||||
// - the feature is enabled
|
||||
// - the new blob URL support is enabled
|
||||
return base::FeatureList::IsEnabled(
|
||||
features::kRestrictCanAccessDataForOriginToUIThread) &&
|
||||
base::FeatureList::IsEnabled(
|
||||
net::features::kSupportPartitionedBlobUrl);
|
||||
features::kRestrictCanAccessDataForOriginToUIThread);
|
||||
}
|
||||
|
||||
bool ShouldCreateSiteInstanceForDataUrls() {
|
||||
|
@ -3957,24 +3957,10 @@ void VerifyStaleContentOnFrameEviction(
|
||||
|
||||
#endif // defined(USE_AURA)
|
||||
|
||||
// static
|
||||
void BlobURLStoreInterceptor::InterceptDeprecated(
|
||||
GURL target_url,
|
||||
mojo::SelfOwnedAssociatedReceiverRef<blink::mojom::BlobURLStore> receiver) {
|
||||
DCHECK(
|
||||
!base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl));
|
||||
auto interceptor = base::WrapUnique(new BlobURLStoreInterceptor(target_url));
|
||||
auto* raw_interceptor = interceptor.get();
|
||||
auto impl = receiver->SwapImplForTesting(std::move(interceptor));
|
||||
raw_interceptor->url_store_ = std::move(impl);
|
||||
}
|
||||
|
||||
// static
|
||||
void BlobURLStoreInterceptor::Intercept(GURL target_url,
|
||||
storage::BlobUrlRegistry* registry,
|
||||
mojo::ReceiverId receiver_id) {
|
||||
DCHECK(
|
||||
base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl));
|
||||
auto interceptor = base::WrapUnique(new BlobURLStoreInterceptor(target_url));
|
||||
auto* raw_interceptor = interceptor.get();
|
||||
auto impl = registry->receivers_for_testing().SwapImplForTesting(
|
||||
|
@ -238,10 +238,6 @@ BASE_FEATURE(kThirdPartyStoragePartitioning,
|
||||
// Whether to use the new code paths needed to support partitioning Blob URLs.
|
||||
// This exists as a kill-switch in case an issue is identified with the Blob
|
||||
// URL implementation that causes breakage.
|
||||
BASE_FEATURE(kSupportPartitionedBlobUrl,
|
||||
"SupportPartitionedBlobUrl",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
BASE_FEATURE(kTopLevelTpcdOriginTrial,
|
||||
"TopLevelTpcdOriginTrial",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
@ -255,7 +255,6 @@ NET_EXPORT BASE_DECLARE_FEATURE(kStaticKeyPinningEnforcement);
|
||||
NET_EXPORT BASE_DECLARE_FEATURE(kCookieDomainRejectNonASCII);
|
||||
|
||||
NET_EXPORT BASE_DECLARE_FEATURE(kThirdPartyStoragePartitioning);
|
||||
NET_EXPORT BASE_DECLARE_FEATURE(kSupportPartitionedBlobUrl);
|
||||
|
||||
// Controls consideration of top-level 3PCD origin trial settings.
|
||||
NET_EXPORT BASE_DECLARE_FEATURE(kTopLevelTpcdOriginTrial);
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/not_fatal_until.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "net/base/features.h"
|
||||
#include "storage/browser/blob/blob_builder_from_stream.h"
|
||||
#include "storage/browser/blob/blob_data_builder.h"
|
||||
#include "storage/browser/blob/blob_impl.h"
|
||||
@ -495,22 +494,8 @@ bool BlobRegistryImpl::BlobUnderConstruction::ContainsCycles(
|
||||
}
|
||||
#endif
|
||||
|
||||
BlobRegistryImpl::BlobRegistryImpl(
|
||||
base::WeakPtr<BlobStorageContext> context,
|
||||
base::WeakPtr<BlobUrlRegistry> url_registry,
|
||||
scoped_refptr<base::TaskRunner> url_registry_runner)
|
||||
: context_(std::move(context)),
|
||||
url_registry_(std::move(url_registry)),
|
||||
url_registry_runner_(std::move(url_registry_runner)) {
|
||||
DCHECK(
|
||||
!base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl));
|
||||
}
|
||||
|
||||
BlobRegistryImpl::BlobRegistryImpl(base::WeakPtr<BlobStorageContext> context)
|
||||
: context_(std::move(context)) {
|
||||
DCHECK(
|
||||
base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl));
|
||||
}
|
||||
: context_(std::move(context)) {}
|
||||
|
||||
BlobRegistryImpl::~BlobRegistryImpl() {
|
||||
// BlobBuilderFromStream needs to be aborted before it can be destroyed, but
|
||||
@ -627,56 +612,9 @@ void BlobRegistryImpl::GetBlobFromUUID(
|
||||
std::move(callback).Run();
|
||||
}
|
||||
|
||||
void BlobRegistryImpl::URLStoreForOrigin(
|
||||
const url::Origin& origin,
|
||||
mojo::PendingAssociatedReceiver<blink::mojom::BlobURLStore> receiver) {
|
||||
Delegate* delegate = receivers_.current_context().get();
|
||||
DCHECK(delegate);
|
||||
if (base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl)) {
|
||||
mojo::ReportBadMessage(
|
||||
"BlobRegistryImpl::URLStoreForOrigin isn't available when the "
|
||||
"kSupportPartitionedBlobUrl flag is enabled");
|
||||
return;
|
||||
}
|
||||
// TODO(crbug.com/40109437, crbug.com/325410297): The opaque origin exception
|
||||
// should ideally be removed, so that ChildProcessSecurityPolicy can also
|
||||
// verify the opaque origin's precursor. This may happen "for free" if/when
|
||||
// kSupportPartitionedBlobUrl becomes the default, since this whole code path
|
||||
// will go away. Otherwise, note that removing the opaque check will need to
|
||||
// be careful about sandboxed frames: CanAccessDataForOrigin() blocks all
|
||||
// access for sandboxed frames, yet sandboxed frames can actually create and
|
||||
// use blob URLs (with opaque origins). So, removing `origin.opaque()` may
|
||||
// necessitate using `ChildProcessSecurityPolicy::HostsOrigin()` instead.
|
||||
if (!origin.opaque() && !delegate->CanAccessDataForOrigin(origin)) {
|
||||
mojo::ReportBadMessage(
|
||||
"Cannot access data for origin passed to "
|
||||
"BlobRegistryImpl::URLStoreForOrigin");
|
||||
return;
|
||||
}
|
||||
url_registry_runner_->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(
|
||||
[](const url::Origin& origin,
|
||||
mojo::PendingAssociatedReceiver<blink::mojom::BlobURLStore>
|
||||
receiver,
|
||||
base::WeakPtr<BlobUrlRegistry> url_registry) {
|
||||
auto self_owned_associated_receiver =
|
||||
mojo::MakeSelfOwnedAssociatedReceiver(
|
||||
std::make_unique<BlobURLStoreImpl>(
|
||||
blink::StorageKey::CreateFirstParty(origin),
|
||||
std::move(url_registry)),
|
||||
std::move(receiver));
|
||||
if (g_url_store_creation_hook)
|
||||
g_url_store_creation_hook->Run(self_owned_associated_receiver);
|
||||
},
|
||||
origin, std::move(receiver), url_registry_));
|
||||
}
|
||||
|
||||
// static
|
||||
void BlobRegistryImpl::SetURLStoreCreationHookForTesting(
|
||||
URLStoreCreationHook* hook) {
|
||||
DCHECK(
|
||||
!base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl));
|
||||
g_url_store_creation_hook = hook;
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#define STORAGE_BROWSER_BLOB_BLOB_REGISTRY_IMPL_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/component_export.h"
|
||||
#include "base/containers/flat_set.h"
|
||||
#include "base/containers/unique_ptr_adapters.h"
|
||||
@ -14,7 +15,6 @@
|
||||
#include "components/file_access/scoped_file_access_delegate.h"
|
||||
#include "mojo/public/cpp/bindings/receiver_set.h"
|
||||
#include "mojo/public/cpp/bindings/self_owned_associated_receiver.h"
|
||||
#include "storage/browser/blob/blob_url_registry.h"
|
||||
#include "third_party/blink/public/mojom/blob/blob_registry.mojom.h"
|
||||
#include "url/origin.h"
|
||||
|
||||
@ -40,10 +40,6 @@ class COMPONENT_EXPORT(STORAGE_BROWSER) BlobRegistryImpl
|
||||
virtual bool CanAccessDataForOrigin(const url::Origin& origin) = 0;
|
||||
};
|
||||
|
||||
BlobRegistryImpl(base::WeakPtr<BlobStorageContext> context,
|
||||
base::WeakPtr<BlobUrlRegistry> url_registry,
|
||||
scoped_refptr<base::TaskRunner> url_registry_runner);
|
||||
|
||||
explicit BlobRegistryImpl(base::WeakPtr<BlobStorageContext> context);
|
||||
|
||||
BlobRegistryImpl(const BlobRegistryImpl&) = delete;
|
||||
@ -72,11 +68,6 @@ class COMPONENT_EXPORT(STORAGE_BROWSER) BlobRegistryImpl
|
||||
const std::string& uuid,
|
||||
GetBlobFromUUIDCallback callback) override;
|
||||
|
||||
void URLStoreForOrigin(
|
||||
const url::Origin& origin,
|
||||
mojo::PendingAssociatedReceiver<blink::mojom::BlobURLStore> url_store)
|
||||
override;
|
||||
|
||||
size_t BlobsUnderConstructionForTesting() const {
|
||||
return blobs_under_construction_.size();
|
||||
}
|
||||
@ -102,10 +93,6 @@ class COMPONENT_EXPORT(STORAGE_BROWSER) BlobRegistryImpl
|
||||
|
||||
base::WeakPtr<BlobStorageContext> context_;
|
||||
|
||||
// `url_registry_` should only be accessed on `url_registry_runner_`.
|
||||
base::WeakPtr<BlobUrlRegistry> url_registry_;
|
||||
scoped_refptr<base::TaskRunner> url_registry_runner_;
|
||||
|
||||
mojo::ReceiverSet<blink::mojom::BlobRegistry, std::unique_ptr<Delegate>>
|
||||
receivers_;
|
||||
|
||||
|
@ -76,15 +76,7 @@ class BlobRegistryImplTest : public testing::Test {
|
||||
data_dir_.GetPath(), data_dir_.GetPath(),
|
||||
base::ThreadPool::CreateTaskRunner({base::MayBlock()}));
|
||||
auto storage_policy = base::MakeRefCounted<MockSpecialStoragePolicy>();
|
||||
if (base::FeatureList::IsEnabled(
|
||||
net::features::kSupportPartitionedBlobUrl)) {
|
||||
registry_impl_ =
|
||||
std::make_unique<BlobRegistryImpl>(context_->AsWeakPtr());
|
||||
} else {
|
||||
registry_impl_ = std::make_unique<BlobRegistryImpl>(
|
||||
context_->AsWeakPtr(), url_registry_.AsWeakPtr(),
|
||||
base::SequencedTaskRunner::GetCurrentDefault());
|
||||
}
|
||||
registry_impl_ = std::make_unique<BlobRegistryImpl>(context_->AsWeakPtr());
|
||||
auto delegate = std::make_unique<MockBlobRegistryDelegate>();
|
||||
delegate_ptr_ = delegate->AsWeakPtr();
|
||||
registry_impl_->Bind(registry_.BindNewPipeAndPassReceiver(),
|
||||
@ -196,7 +188,6 @@ class BlobRegistryImplTest : public testing::Test {
|
||||
base::test::TaskEnvironment task_environment_;
|
||||
std::optional<base::ScopedDisallowBlocking> disallow_blocking_;
|
||||
std::unique_ptr<BlobStorageContext> context_;
|
||||
BlobUrlRegistry url_registry_;
|
||||
std::unique_ptr<BlobRegistryImpl> registry_impl_;
|
||||
mojo::Remote<blink::mojom::BlobRegistry> registry_;
|
||||
base::WeakPtr<MockBlobRegistryDelegate> delegate_ptr_;
|
||||
|
@ -30,8 +30,6 @@ BlobUrlRegistry::~BlobUrlRegistry() {
|
||||
void BlobUrlRegistry::AddReceiver(
|
||||
const blink::StorageKey& storage_key,
|
||||
mojo::PendingAssociatedReceiver<blink::mojom::BlobURLStore> receiver) {
|
||||
DCHECK(
|
||||
base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl));
|
||||
mojo::ReceiverId receiver_id = frame_receivers_.Add(
|
||||
std::make_unique<storage::BlobURLStoreImpl>(storage_key, AsWeakPtr()),
|
||||
std::move(receiver));
|
||||
@ -45,8 +43,6 @@ void BlobUrlRegistry::AddReceiver(
|
||||
const blink::StorageKey& storage_key,
|
||||
mojo::PendingReceiver<blink::mojom::BlobURLStore> receiver,
|
||||
BlobURLValidityCheckBehavior validity_check_behavior) {
|
||||
DCHECK(
|
||||
base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl));
|
||||
worker_receivers_.Add(std::make_unique<storage::BlobURLStoreImpl>(
|
||||
storage_key, AsWeakPtr(), validity_check_behavior),
|
||||
std::move(receiver));
|
||||
@ -80,10 +76,8 @@ bool BlobUrlRegistry::RemoveUrlMapping(const GURL& blob_url,
|
||||
if (blob_it == url_to_blob_.end()) {
|
||||
return false;
|
||||
}
|
||||
if (base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl)) {
|
||||
if (url_to_storage_key_.at(blob_url) != storage_key) {
|
||||
return false;
|
||||
}
|
||||
if (url_to_storage_key_.at(blob_url) != storage_key) {
|
||||
return false;
|
||||
}
|
||||
url_to_blob_.erase(blob_it);
|
||||
url_to_unsafe_agent_cluster_id_.erase(blob_url);
|
||||
@ -95,16 +89,10 @@ bool BlobUrlRegistry::RemoveUrlMapping(const GURL& blob_url,
|
||||
bool BlobUrlRegistry::IsUrlMapped(const GURL& blob_url,
|
||||
const blink::StorageKey& storage_key) const {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
if (base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl)) {
|
||||
if (base::Contains(url_to_blob_, blob_url) &&
|
||||
base::Contains(url_to_storage_key_, blob_url) &&
|
||||
url_to_storage_key_.at(blob_url) == storage_key) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (base::Contains(url_to_blob_, blob_url)) {
|
||||
return true;
|
||||
}
|
||||
if (base::Contains(url_to_blob_, blob_url) &&
|
||||
base::Contains(url_to_storage_key_, blob_url) &&
|
||||
url_to_storage_key_.at(blob_url) == storage_key) {
|
||||
return true;
|
||||
}
|
||||
if (fallback_) {
|
||||
return fallback_->IsUrlMapped(blob_url, storage_key);
|
||||
@ -181,8 +169,6 @@ bool BlobUrlRegistry::GetTokenMapping(
|
||||
// static
|
||||
void BlobUrlRegistry::SetURLStoreCreationHookForTesting(
|
||||
URLStoreCreationHook* hook) {
|
||||
DCHECK(
|
||||
base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl));
|
||||
g_url_store_creation_hook = hook;
|
||||
}
|
||||
|
||||
|
@ -34,10 +34,8 @@ std::string UuidFromBlob(mojo::PendingRemote<blink::mojom::Blob> pending_blob) {
|
||||
}
|
||||
|
||||
enum class PartitionedBlobUrlTestCase {
|
||||
kPartitioningDisabledWithSupportDisabled,
|
||||
kPartitioningDisabledWithSupportEnabled,
|
||||
kPartitioningEnabledWithSupportDisabled,
|
||||
kPartitioningEnabledWithSupportEnabled,
|
||||
kPartitioningDisabled,
|
||||
kPartitioningEnabled,
|
||||
};
|
||||
|
||||
class BlobUrlRegistryTestP
|
||||
@ -50,39 +48,14 @@ class BlobUrlRegistryTestP
|
||||
}
|
||||
|
||||
void InitializeScopedFeatureList() {
|
||||
std::vector<base::test::FeatureRef> enabled_features{};
|
||||
std::vector<base::test::FeatureRef> disabled_features{};
|
||||
|
||||
if (PartitionedBlobUrlSupported()) {
|
||||
enabled_features.push_back(net::features::kSupportPartitionedBlobUrl);
|
||||
} else {
|
||||
disabled_features.push_back(net::features::kSupportPartitionedBlobUrl);
|
||||
}
|
||||
|
||||
if (StoragePartitioningEnabled()) {
|
||||
enabled_features.push_back(net::features::kThirdPartyStoragePartitioning);
|
||||
} else {
|
||||
disabled_features.push_back(
|
||||
net::features::kThirdPartyStoragePartitioning);
|
||||
}
|
||||
|
||||
scoped_feature_list_.InitWithFeatures(enabled_features, disabled_features);
|
||||
scoped_feature_list_.InitWithFeatureState(
|
||||
net::features::kThirdPartyStoragePartitioning,
|
||||
StoragePartitioningEnabled());
|
||||
}
|
||||
|
||||
bool StoragePartitioningEnabled() {
|
||||
switch (test_case_) {
|
||||
case PartitionedBlobUrlTestCase::kPartitioningEnabledWithSupportDisabled:
|
||||
case PartitionedBlobUrlTestCase::kPartitioningEnabledWithSupportEnabled:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool PartitionedBlobUrlSupported() {
|
||||
switch (test_case_) {
|
||||
case PartitionedBlobUrlTestCase::kPartitioningDisabledWithSupportEnabled:
|
||||
case PartitionedBlobUrlTestCase::kPartitioningEnabledWithSupportEnabled:
|
||||
case PartitionedBlobUrlTestCase::kPartitioningEnabled:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@ -156,18 +129,11 @@ TEST_P(BlobUrlRegistryTestP, URLRegistration) {
|
||||
EXPECT_TRUE(registry.RemoveUrlMapping(kURL2, storageKey2));
|
||||
|
||||
// Test using a storage key that doesn't correspond to the Blob URL.
|
||||
if (PartitionedBlobUrlSupported()) {
|
||||
EXPECT_NE(storageKey1, storageKey2);
|
||||
EXPECT_FALSE(registry.IsUrlMapped(kURL1, storageKey2));
|
||||
EXPECT_FALSE(registry.RemoveUrlMapping(kURL1, storageKey2));
|
||||
EXPECT_TRUE(registry.IsUrlMapped(kURL1, storageKey1));
|
||||
EXPECT_TRUE(registry.RemoveUrlMapping(kURL1, storageKey1));
|
||||
} else {
|
||||
// Storage key is ignored.
|
||||
EXPECT_TRUE(registry.IsUrlMapped(kURL1, storageKey2));
|
||||
EXPECT_TRUE(registry.RemoveUrlMapping(kURL1, storageKey2));
|
||||
EXPECT_FALSE(registry.IsUrlMapped(kURL1, storageKey1));
|
||||
}
|
||||
EXPECT_NE(storageKey1, storageKey2);
|
||||
EXPECT_FALSE(registry.IsUrlMapped(kURL1, storageKey2));
|
||||
EXPECT_FALSE(registry.RemoveUrlMapping(kURL1, storageKey2));
|
||||
EXPECT_TRUE(registry.IsUrlMapped(kURL1, storageKey1));
|
||||
EXPECT_TRUE(registry.RemoveUrlMapping(kURL1, storageKey1));
|
||||
|
||||
EXPECT_EQ(0u, registry.url_count());
|
||||
|
||||
@ -187,17 +153,10 @@ TEST_P(BlobUrlRegistryTestP, URLRegistration) {
|
||||
EXPECT_EQ(kBlobId1, UuidFromBlob(registry.GetBlobFromUrl(kURL1)));
|
||||
EXPECT_TRUE(registry.GetBlobFromUrl(kURL1));
|
||||
|
||||
if (PartitionedBlobUrlSupported()) {
|
||||
EXPECT_FALSE(registry.IsUrlMapped(kURL1, partitionedStorageKey2));
|
||||
EXPECT_FALSE(registry.RemoveUrlMapping(kURL1, partitionedStorageKey2));
|
||||
EXPECT_TRUE(registry.IsUrlMapped(kURL1, partitionedStorageKey1));
|
||||
EXPECT_TRUE(registry.RemoveUrlMapping(kURL1, partitionedStorageKey1));
|
||||
} else {
|
||||
// Storage key is ignored.
|
||||
EXPECT_TRUE(registry.IsUrlMapped(kURL1, partitionedStorageKey2));
|
||||
EXPECT_TRUE(registry.RemoveUrlMapping(kURL1, partitionedStorageKey2));
|
||||
EXPECT_FALSE(registry.IsUrlMapped(kURL1, partitionedStorageKey1));
|
||||
}
|
||||
EXPECT_FALSE(registry.IsUrlMapped(kURL1, partitionedStorageKey2));
|
||||
EXPECT_FALSE(registry.RemoveUrlMapping(kURL1, partitionedStorageKey2));
|
||||
EXPECT_TRUE(registry.IsUrlMapped(kURL1, partitionedStorageKey1));
|
||||
EXPECT_TRUE(registry.RemoveUrlMapping(kURL1, partitionedStorageKey1));
|
||||
}
|
||||
EXPECT_EQ(0u, registry.url_count());
|
||||
}
|
||||
@ -205,11 +164,8 @@ TEST_P(BlobUrlRegistryTestP, URLRegistration) {
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
BlobUrlRegistryTests,
|
||||
BlobUrlRegistryTestP,
|
||||
::testing::Values(
|
||||
PartitionedBlobUrlTestCase::kPartitioningDisabledWithSupportDisabled,
|
||||
PartitionedBlobUrlTestCase::kPartitioningDisabledWithSupportEnabled,
|
||||
PartitionedBlobUrlTestCase::kPartitioningEnabledWithSupportDisabled,
|
||||
PartitionedBlobUrlTestCase::kPartitioningEnabledWithSupportEnabled));
|
||||
::testing::Values(PartitionedBlobUrlTestCase::kPartitioningDisabled,
|
||||
PartitionedBlobUrlTestCase::kPartitioningEnabled));
|
||||
|
||||
} // namespace
|
||||
} // namespace storage
|
||||
|
@ -70,11 +70,7 @@ BlobURLStoreImpl::BlobURLStoreImpl(
|
||||
: storage_key_(storage_key),
|
||||
registry_(std::move(registry)),
|
||||
validity_check_behavior_(validity_check_behavior) {
|
||||
if (validity_check_behavior_ ==
|
||||
BlobURLValidityCheckBehavior::ALLOW_OPAQUE_ORIGIN_STORAGE_KEY_MISMATCH) {
|
||||
DCHECK(base::FeatureList::IsEnabled(
|
||||
net::features::kSupportPartitionedBlobUrl));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BlobURLStoreImpl::~BlobURLStoreImpl() {
|
||||
|
@ -59,12 +59,6 @@ class BlobURLStoreImplTestP
|
||||
std::vector<base::test::FeatureRef> enabled_features{};
|
||||
std::vector<base::test::FeatureRef> disabled_features{};
|
||||
|
||||
if (PartitionedBlobUrlSupported()) {
|
||||
enabled_features.push_back(net::features::kSupportPartitionedBlobUrl);
|
||||
} else {
|
||||
disabled_features.push_back(net::features::kSupportPartitionedBlobUrl);
|
||||
}
|
||||
|
||||
if (StoragePartitioningEnabled()) {
|
||||
enabled_features.push_back(net::features::kThirdPartyStoragePartitioning);
|
||||
} else {
|
||||
@ -85,16 +79,6 @@ class BlobURLStoreImplTestP
|
||||
}
|
||||
}
|
||||
|
||||
bool PartitionedBlobUrlSupported() {
|
||||
switch (test_case_) {
|
||||
case PartitionedBlobUrlTestCase::kPartitioningDisabledWithSupportEnabled:
|
||||
case PartitionedBlobUrlTestCase::kPartitioningEnabledWithSupportEnabled:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void OnBadMessage(const std::string& error) {
|
||||
bad_messages_.push_back(error);
|
||||
}
|
||||
@ -127,15 +111,8 @@ class BlobURLStoreImplTestP
|
||||
|
||||
mojo::PendingRemote<BlobURLStore> CreateURLStore() {
|
||||
mojo::PendingRemote<BlobURLStore> result;
|
||||
if (base::FeatureList::IsEnabled(
|
||||
net::features::kSupportPartitionedBlobUrl)) {
|
||||
url_registry_.AddReceiver(kStorageKey,
|
||||
result.InitWithNewPipeAndPassReceiver());
|
||||
} else {
|
||||
mojo::MakeSelfOwnedReceiver(std::make_unique<BlobURLStoreImpl>(
|
||||
kStorageKey, url_registry_.AsWeakPtr()),
|
||||
result.InitWithNewPipeAndPassReceiver());
|
||||
}
|
||||
url_registry_.AddReceiver(kStorageKey,
|
||||
result.InitWithNewPipeAndPassReceiver());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -293,7 +270,7 @@ TEST_P(BlobURLStoreImplTestP, RevokeWrongStorageKey) {
|
||||
EXPECT_TRUE(url_registry_.GetBlobFromUrl(kValidUrl));
|
||||
|
||||
url_store2.Revoke(kValidUrl);
|
||||
if (StoragePartitioningEnabled() && PartitionedBlobUrlSupported()) {
|
||||
if (StoragePartitioningEnabled()) {
|
||||
EXPECT_TRUE(url_registry_.GetBlobFromUrl(kValidUrl));
|
||||
} else {
|
||||
// The storage keys are either the same or are ignored by the Revoke call.
|
||||
|
@ -52,7 +52,4 @@ interface BlobRegistry {
|
||||
// TODO(mek): Remove when crbug.com/740744 is resolved.
|
||||
[Sync] GetBlobFromUUID(pending_receiver<Blob> blob, string uuid) => ();
|
||||
|
||||
// Returns a BlobURLStore for a specific origin.
|
||||
URLStoreForOrigin(url.mojom.Origin origin,
|
||||
pending_associated_receiver<blink.mojom.BlobURLStore> url_store);
|
||||
};
|
||||
|
@ -69,9 +69,37 @@ PublicURLManager::PublicURLManager(ExecutionContext* execution_context)
|
||||
: ExecutionContextLifecycleObserver(execution_context),
|
||||
frame_url_store_(execution_context),
|
||||
worker_url_store_(execution_context) {
|
||||
if (base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl)) {
|
||||
if (auto* window = DynamicTo<LocalDOMWindow>(execution_context)) {
|
||||
LocalFrame* frame = window->GetFrame();
|
||||
if (auto* window = DynamicTo<LocalDOMWindow>(execution_context)) {
|
||||
LocalFrame* frame = window->GetFrame();
|
||||
if (!frame) {
|
||||
is_stopped_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
frame->GetRemoteNavigationAssociatedInterfaces()->GetInterface(
|
||||
frame_url_store_.BindNewEndpointAndPassReceiver(
|
||||
execution_context->GetTaskRunner(TaskType::kFileReading)));
|
||||
|
||||
} else if (auto* worker_global_scope =
|
||||
DynamicTo<WorkerGlobalScope>(execution_context)) {
|
||||
if (worker_global_scope->IsClosing()) {
|
||||
is_stopped_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
worker_global_scope->GetBrowserInterfaceBroker().GetInterface(
|
||||
worker_url_store_.BindNewPipeAndPassReceiver(
|
||||
execution_context->GetTaskRunner(TaskType::kFileReading)));
|
||||
|
||||
} else if (auto* worklet_global_scope =
|
||||
DynamicTo<WorkletGlobalScope>(execution_context)) {
|
||||
if (worklet_global_scope->IsClosing()) {
|
||||
is_stopped_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (worklet_global_scope->IsMainThreadWorkletGlobalScope()) {
|
||||
LocalFrame* frame = worklet_global_scope->GetFrame();
|
||||
if (!frame) {
|
||||
is_stopped_ = true;
|
||||
return;
|
||||
@ -80,54 +108,19 @@ PublicURLManager::PublicURLManager(ExecutionContext* execution_context)
|
||||
frame->GetRemoteNavigationAssociatedInterfaces()->GetInterface(
|
||||
frame_url_store_.BindNewEndpointAndPassReceiver(
|
||||
execution_context->GetTaskRunner(TaskType::kFileReading)));
|
||||
|
||||
} else if (auto* worker_global_scope =
|
||||
DynamicTo<WorkerGlobalScope>(execution_context)) {
|
||||
if (worker_global_scope->IsClosing()) {
|
||||
is_stopped_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
worker_global_scope->GetBrowserInterfaceBroker().GetInterface(
|
||||
worker_url_store_.BindNewPipeAndPassReceiver(
|
||||
execution_context->GetTaskRunner(TaskType::kFileReading)));
|
||||
|
||||
} else if (auto* worklet_global_scope =
|
||||
DynamicTo<WorkletGlobalScope>(execution_context)) {
|
||||
if (worklet_global_scope->IsClosing()) {
|
||||
is_stopped_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (worklet_global_scope->IsMainThreadWorkletGlobalScope()) {
|
||||
LocalFrame* frame = worklet_global_scope->GetFrame();
|
||||
if (!frame) {
|
||||
is_stopped_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
frame->GetRemoteNavigationAssociatedInterfaces()->GetInterface(
|
||||
frame_url_store_.BindNewEndpointAndPassReceiver(
|
||||
execution_context->GetTaskRunner(TaskType::kFileReading)));
|
||||
} else {
|
||||
// For threaded worklets we don't have a frame accessible here, so
|
||||
// instead we'll use a PendingRemote provided by the frame that created
|
||||
// this worklet.
|
||||
mojo::PendingRemote<mojom::blink::BlobURLStore> pending_remote =
|
||||
worklet_global_scope->TakeBlobUrlStorePendingRemote();
|
||||
DCHECK(pending_remote.is_valid());
|
||||
worker_url_store_.Bind(
|
||||
std::move(pending_remote),
|
||||
execution_context->GetTaskRunner(TaskType::kFileReading));
|
||||
}
|
||||
} else {
|
||||
NOTREACHED_IN_MIGRATION();
|
||||
// For threaded worklets we don't have a frame accessible here, so
|
||||
// instead we'll use a PendingRemote provided by the frame that created
|
||||
// this worklet.
|
||||
mojo::PendingRemote<mojom::blink::BlobURLStore> pending_remote =
|
||||
worklet_global_scope->TakeBlobUrlStorePendingRemote();
|
||||
DCHECK(pending_remote.is_valid());
|
||||
worker_url_store_.Bind(
|
||||
std::move(pending_remote),
|
||||
execution_context->GetTaskRunner(TaskType::kFileReading));
|
||||
}
|
||||
} else {
|
||||
BlobDataHandle::GetBlobRegistry()->URLStoreForOrigin(
|
||||
execution_context->GetSecurityOrigin(),
|
||||
frame_url_store_.BindNewEndpointAndPassReceiver(
|
||||
execution_context->GetTaskRunner(TaskType::kFileReading)));
|
||||
NOTREACHED_IN_MIGRATION();
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,8 +142,6 @@ mojom::blink::BlobURLStore& PublicURLManager::GetBlobURLStore() {
|
||||
if (frame_url_store_.is_bound()) {
|
||||
return *frame_url_store_.get();
|
||||
} else {
|
||||
DCHECK(base::FeatureList::IsEnabled(
|
||||
net::features::kSupportPartitionedBlobUrl));
|
||||
return *worker_url_store_.get();
|
||||
}
|
||||
}
|
||||
|
@ -63,26 +63,13 @@ class FakeURLRegistry : public URLRegistry {
|
||||
Vector<Registration> registrations;
|
||||
};
|
||||
|
||||
enum class PublicURLManagerTestCase {
|
||||
kSupportPartitionedBlobUrlDisabled,
|
||||
kSupportPartitionedBlobUrlEnabled,
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
class PublicURLManagerTestP
|
||||
: public testing::Test,
|
||||
public testing::WithParamInterface<PublicURLManagerTestCase> {
|
||||
class PublicURLManagerTest : public testing::Test {
|
||||
public:
|
||||
PublicURLManagerTestP() : url_store_receiver_(&url_store_) {}
|
||||
PublicURLManagerTest() : url_store_receiver_(&url_store_) {}
|
||||
|
||||
void SetUp() override {
|
||||
test_case_ = GetParam();
|
||||
scoped_feature_list_.InitWithFeatureState(
|
||||
net::features::kSupportPartitionedBlobUrl,
|
||||
test_case_ ==
|
||||
PublicURLManagerTestCase::kSupportPartitionedBlobUrlEnabled);
|
||||
|
||||
page_holder_ = std::make_unique<DummyPageHolder>();
|
||||
// By default this creates a unique origin, which is exactly what this test
|
||||
// wants.
|
||||
@ -127,7 +114,6 @@ class PublicURLManagerTestP
|
||||
protected:
|
||||
test::TaskEnvironment task_environment_;
|
||||
|
||||
PublicURLManagerTestCase test_case_;
|
||||
base::test::ScopedFeatureList scoped_feature_list_;
|
||||
|
||||
std::unique_ptr<DummyPageHolder> page_holder_;
|
||||
@ -136,7 +122,7 @@ class PublicURLManagerTestP
|
||||
mojo::AssociatedReceiver<BlobURLStore> url_store_receiver_;
|
||||
};
|
||||
|
||||
TEST_P(PublicURLManagerTestP, RegisterNonMojoBlob) {
|
||||
TEST_F(PublicURLManagerTest, RegisterNonMojoBlob) {
|
||||
FakeURLRegistry registry;
|
||||
TestURLRegistrable registrable(®istry);
|
||||
String url = url_manager().RegisterURL(®istrable);
|
||||
@ -160,7 +146,7 @@ TEST_P(PublicURLManagerTestP, RegisterNonMojoBlob) {
|
||||
EXPECT_EQ(url, url_store_.revocations[0]);
|
||||
}
|
||||
|
||||
TEST_P(PublicURLManagerTestP, RegisterMojoBlob) {
|
||||
TEST_F(PublicURLManagerTest, RegisterMojoBlob) {
|
||||
FakeURLRegistry registry;
|
||||
TestURLRegistrable registrable(®istry, CreateMojoBlob("id"));
|
||||
String url = url_manager().RegisterURL(®istrable);
|
||||
@ -182,7 +168,7 @@ TEST_P(PublicURLManagerTestP, RegisterMojoBlob) {
|
||||
EXPECT_EQ(url, url_store_.revocations[0]);
|
||||
}
|
||||
|
||||
TEST_P(PublicURLManagerTestP, RevokeValidNonRegisteredURL) {
|
||||
TEST_F(PublicURLManagerTest, RevokeValidNonRegisteredURL) {
|
||||
SetURL(KURL("http://example.com/foo/bar"));
|
||||
SetUpSecurityContextForTesting();
|
||||
|
||||
@ -193,7 +179,7 @@ TEST_P(PublicURLManagerTestP, RevokeValidNonRegisteredURL) {
|
||||
EXPECT_EQ(url, url_store_.revocations[0]);
|
||||
}
|
||||
|
||||
TEST_P(PublicURLManagerTestP, RevokeInvalidURL) {
|
||||
TEST_F(PublicURLManagerTest, RevokeInvalidURL) {
|
||||
SetURL(KURL("http://example.com/foo/bar"));
|
||||
SetUpSecurityContextForTesting();
|
||||
|
||||
@ -208,11 +194,4 @@ TEST_P(PublicURLManagerTestP, RevokeInvalidURL) {
|
||||
EXPECT_TRUE(url_store_.revocations.empty());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PublicURLManagerTest,
|
||||
PublicURLManagerTestP,
|
||||
::testing::Values(
|
||||
PublicURLManagerTestCase::kSupportPartitionedBlobUrlDisabled,
|
||||
PublicURLManagerTestCase::kSupportPartitionedBlobUrlEnabled));
|
||||
|
||||
} // namespace blink
|
||||
|
@ -3889,14 +3889,10 @@ void LocalFrame::WriteIntoTrace(perfetto::TracedValue ctx) const {
|
||||
|
||||
mojo::PendingRemote<mojom::blink::BlobURLStore>
|
||||
LocalFrame::GetBlobUrlStorePendingRemote() {
|
||||
if (base::FeatureList::IsEnabled(net::features::kSupportPartitionedBlobUrl)) {
|
||||
mojo::PendingRemote<mojom::blink::BlobURLStore> pending_remote;
|
||||
GetBrowserInterfaceBroker().GetInterface(
|
||||
pending_remote.InitWithNewPipeAndPassReceiver());
|
||||
return pending_remote;
|
||||
} else {
|
||||
return mojo::NullRemote();
|
||||
}
|
||||
mojo::PendingRemote<mojom::blink::BlobURLStore> pending_remote;
|
||||
GetBrowserInterfaceBroker().GetInterface(
|
||||
pending_remote.InitWithNewPipeAndPassReceiver());
|
||||
return pending_remote;
|
||||
}
|
||||
|
||||
#if !BUILDFLAG(IS_ANDROID)
|
||||
|
@ -11730,12 +11730,6 @@ class BlobRegistryForSaveImageFromDataURL : public mojom::blink::BlobRegistry {
|
||||
GetBlobFromUUIDCallback) override {
|
||||
NOTREACHED_IN_MIGRATION();
|
||||
}
|
||||
|
||||
void URLStoreForOrigin(
|
||||
const scoped_refptr<const SecurityOrigin>&,
|
||||
mojo::PendingAssociatedReceiver<mojom::blink::BlobURLStore>) override {
|
||||
NOTREACHED_IN_MIGRATION();
|
||||
}
|
||||
};
|
||||
|
||||
// blink::mojom::LocalFrameHost instance that intecepts DownloadURL() mojo
|
||||
|
@ -80,10 +80,4 @@ void FakeBlobRegistry::GetBlobFromUUID(
|
||||
std::move(callback).Run();
|
||||
}
|
||||
|
||||
void FakeBlobRegistry::URLStoreForOrigin(
|
||||
const scoped_refptr<const SecurityOrigin>& origin,
|
||||
mojo::PendingAssociatedReceiver<mojom::blink::BlobURLStore> receiver) {
|
||||
NOTREACHED_IN_MIGRATION();
|
||||
}
|
||||
|
||||
} // namespace blink
|
||||
|
@ -36,11 +36,6 @@ class FakeBlobRegistry : public mojom::blink::BlobRegistry {
|
||||
void GetBlobFromUUID(mojo::PendingReceiver<mojom::blink::Blob>,
|
||||
const String& uuid,
|
||||
GetBlobFromUUIDCallback) override;
|
||||
|
||||
void URLStoreForOrigin(
|
||||
const scoped_refptr<const SecurityOrigin>&,
|
||||
mojo::PendingAssociatedReceiver<mojom::blink::BlobURLStore>) override;
|
||||
|
||||
struct Registration {
|
||||
String uuid;
|
||||
String content_type;
|
||||
|
Reference in New Issue
Block a user