electron/patches/chromium/notification_provenance.patch
electron-roller[bot] cc01272a8d
chore: bump chromium to 96.0.4647.0 (main) (#30814)
* chore: bump chromium in DEPS to 95.0.4630.0

* 3133701: Fix chrome root store codegen for cross-compile builds.

https://chromium-review.googlesource.com/c/chromium/src/+/3133701

* 49125: Include SHA512-256 in EVP_get_digestbyname and EVP_MD_do_all.

https://boringssl-review.googlesource.com/c/boringssl/+/49125

* chore: fixup patch indices

* 3131662: [Code Health] Remove ListValue::Append(Integer|Boolean)

https://chromium-review.googlesource.com/c/chromium/src/+/3131662

* chore: bump chromium in DEPS to 95.0.4631.0

* chore: update patches

* chore: bump chromium in DEPS to 95.0.4635.0

* chore: update patches

* chore: bump chromium in DEPS to 95.0.4636.0

* chore: bump chromium in DEPS to 95.0.4637.0

* chore: update patches

* refactor: move PlatformNotificationService into BrowserContext

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/3137256

* refactor: ListValue::GetSize and ListValue::AppendString were removed

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/3144540

* chore: bump chromium in DEPS to 95.0.4638.0

* chore: bump chromium in DEPS to 95.0.4638.4

* chore: bump chromium in DEPS to 96.0.4640.0

* chore: bump chromium in DEPS to 96.0.4641.0

* chore: bump chromium in DEPS to 96.0.4642.0

* chore: update patches

Co-authored-by: Michaela Laurencin <mlaurencin@electronjs.org>

* 3134756: Move extensions/browser/value_store to components/value_store.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3134756

* 3150092: [Autofill] Allow aligning Autofill suggestions to the field's center

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3150092

* chore: bump chromium in DEPS to 96.0.4643.0

* chore: update patches

* chore: bump chromium in DEPS to 96.0.4644.0

* chore: update patches

* chore: bump chromium in DEPS to 96.0.4645.0

* chore: update patches

* chore: bump chromium in DEPS to 96.0.4646.0

* chore: bump chromium in DEPS to 96.0.4647.0

* chore: update patches

Ref (for chromium): https://chromium-review.googlesource.com/c/chromium/src/+/3165772

* 3162087: Reland "Ensure Branch Target Identification is enabled for executable pages."

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3162087

* chore: update evert_add_inline_and_inline_origin_records_to_symbol_file.patch

Xref: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3166678

Xref: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3166674

* chore: update Allocator construction

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3135195

Change RefCount::kAllowed/Disallowed semantics into BackupRefPtr::kEnabled/Disabled

* chore: add UseConfigurablePool to v8::ArrayBuffer::Allocator invocation

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3090845

* chore: do not set network_context_params.context_name

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3155743

Remove name field from mojom::NetworkContext

* fix: use ForEachRenderFrameHost to iterate frames.

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3163336

New implementation partially cribbed from
https://source.chromium.org/chromium/chromium/src/+/main:extensions/browser/script_executor.cc;drc=f894f106c6d5fac8e0b75158f622256e0f34f593;l=109

* [Blink Cleanup] Remove WebLocalFrame::RequestExecuteScriptAndReturnValue()

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3149699

ExecuteJavaScript's RequestExecuteScript() new params are cribbed from
https://chromium-review.googlesource.com/c/chromium/src/+/3149699/4/third_party/blink/renderer/core/frame/web_local_frame_impl.cc

* Remove IsDescendantOf API on RenderFrameHost.

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3165357

function is trivial to implement, so make a local copy in anon namespace

* Rewrite IsDescendantOf check to check GetParentOrOuterDocument.

https://chromium-review.googlesource.com/c/chromium/src/+/3160061

* Remove GetFramesInSubtree from RenderFrameHost

https://chromium-review.googlesource.com/c/chromium/src/+/3163336

* fix: dump_syms for macOS

* chore: update patches

* [Code Health] Remove ListValue::AppendString and ListValue::GetSize

https://chromium-review.googlesource.com/c/chromium/src/+/3144540

* fix: gn check

https://chromium-review.googlesource.com/c/chromium/src/+/3163890

* fix: crash with Isolate::GetHeapCodeAndMetadataStatistics

https://chromium-review.googlesource.com/c/v8/v8/+/3175820

* chore: update patches

* chore: fix windows build

* Add kPrintWithPostScriptType42Fonts feature.

https://chromium-review.googlesource.com/c/chromium/src/+/3150776

* chore: update patches

* chore: fix tests

* ozone/x11: fix VA-API.

https://chromium-review.googlesource.com/c/chromium/src/+/3141878

* Revert "ozone/x11: fix VA-API."

This reverts commit 23e742acb1032bf4afc1a45e4bed38e42184fd01.

* Reland "Make Ozone/X11 default."

https://chromium-review.googlesource.com/c/chromium/src/+/3114071

* fixup Reland "Make Ozone/X11 default."

* fixup Reland "Make Ozone/X11 default." for clipboard

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: Michaela Laurencin <mlaurencin@electronjs.org>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
2021-10-05 19:21:00 -07:00

166 lines
9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jeremy Apthorp <jeremya@chromium.org>
Date: Fri, 5 Oct 2018 14:22:06 -0700
Subject: notification_provenance.patch
Pass RenderProcessHost through to PlatformNotificationService
so Electron can identify which renderer a notification came from.
diff --git a/content/browser/notifications/blink_notification_service_impl.cc b/content/browser/notifications/blink_notification_service_impl.cc
index 442b856f8bcfbcea7742188897f0ce0a25cd60f4..6165eb772901faa25514c9bbefd13ff6b45d6b33 100644
--- a/content/browser/notifications/blink_notification_service_impl.cc
+++ b/content/browser/notifications/blink_notification_service_impl.cc
@@ -81,10 +81,12 @@ BlinkNotificationServiceImpl::BlinkNotificationServiceImpl(
PlatformNotificationContextImpl* notification_context,
BrowserContext* browser_context,
scoped_refptr<ServiceWorkerContextWrapper> service_worker_context,
+ RenderFrameHost* render_frame_host,
const url::Origin& origin,
const GURL& document_url,
mojo::PendingReceiver<blink::mojom::NotificationService> receiver)
: notification_context_(notification_context),
+ render_frame_host_(render_frame_host),
browser_context_(browser_context),
service_worker_context_(std::move(service_worker_context)),
origin_(origin),
@@ -147,7 +149,7 @@ void BlinkNotificationServiceImpl::DisplayNonPersistentNotification(
notification_id, std::move(event_listener_remote));
browser_context_->GetPlatformNotificationService()->DisplayNotification(
- notification_id, origin_.GetURL(), document_url_,
+ render_frame_host_, notification_id, origin_.GetURL(), document_url_,
platform_notification_data, notification_resources);
}
diff --git a/content/browser/notifications/blink_notification_service_impl.h b/content/browser/notifications/blink_notification_service_impl.h
index 19c2beb1f1949f0dc4466a8728f151c035544b24..f7aa5f94d6dea0e6b2c1107b8ef01600bf13903b 100644
--- a/content/browser/notifications/blink_notification_service_impl.h
+++ b/content/browser/notifications/blink_notification_service_impl.h
@@ -41,6 +41,7 @@ class CONTENT_EXPORT BlinkNotificationServiceImpl
PlatformNotificationContextImpl* notification_context,
BrowserContext* browser_context,
scoped_refptr<ServiceWorkerContextWrapper> service_worker_context,
+ RenderFrameHost* render_frame_host,
const url::Origin& origin,
const GURL& document_url,
mojo::PendingReceiver<blink::mojom::NotificationService> receiver);
@@ -96,6 +97,7 @@ class CONTENT_EXPORT BlinkNotificationServiceImpl
// The notification context that owns this service instance.
PlatformNotificationContextImpl* notification_context_;
+ RenderFrameHost* render_frame_host_;
BrowserContext* browser_context_;
scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
diff --git a/content/browser/notifications/blink_notification_service_impl_unittest.cc b/content/browser/notifications/blink_notification_service_impl_unittest.cc
index 740b591e68522f211177f4578d8cd3b9aa49f152..6190edab32f373a8076820eac943afb1c6bebe99 100644
--- a/content/browser/notifications/blink_notification_service_impl_unittest.cc
+++ b/content/browser/notifications/blink_notification_service_impl_unittest.cc
@@ -122,7 +122,7 @@ class BlinkNotificationServiceImplTest : public ::testing::Test {
notification_service_ = std::make_unique<BlinkNotificationServiceImpl>(
notification_context_.get(), &browser_context_,
- embedded_worker_helper_->context_wrapper(),
+ embedded_worker_helper_->context_wrapper(), nullptr,
url::Origin::Create(GURL(kTestOrigin)),
/*document_url=*/GURL(),
notification_service_remote_.BindNewPipeAndPassReceiver());
diff --git a/content/browser/notifications/platform_notification_context_impl.cc b/content/browser/notifications/platform_notification_context_impl.cc
index 32f66cfb52ae240f5a8311779421f01920a31bb2..128355a4791ebb68045522627a5a8db183c1c070 100644
--- a/content/browser/notifications/platform_notification_context_impl.cc
+++ b/content/browser/notifications/platform_notification_context_impl.cc
@@ -282,13 +282,14 @@ void PlatformNotificationContextImpl::Shutdown() {
}
void PlatformNotificationContextImpl::CreateService(
+ RenderFrameHost* render_frame_host,
const url::Origin& origin,
const GURL& document_url,
mojo::PendingReceiver<blink::mojom::NotificationService> receiver) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
services_.push_back(std::make_unique<BlinkNotificationServiceImpl>(
- this, browser_context_, service_worker_context_, origin, document_url,
- std::move(receiver)));
+ this, browser_context_, service_worker_context_, render_frame_host,
+ origin, document_url, std::move(receiver)));
}
void PlatformNotificationContextImpl::RemoveService(
diff --git a/content/browser/notifications/platform_notification_context_impl.h b/content/browser/notifications/platform_notification_context_impl.h
index 78f9ab684d2eeef9a647d82ccb39c1b208e999d4..d55a4e51a0d263ec07ca115715cccc30f89bd9e0 100644
--- a/content/browser/notifications/platform_notification_context_impl.h
+++ b/content/browser/notifications/platform_notification_context_impl.h
@@ -48,6 +48,7 @@ class BrowserContext;
struct NotificationDatabaseData;
class PlatformNotificationServiceProxy;
class ServiceWorkerContextWrapper;
+class RenderFrameHost;
// Implementation of the Web Notification storage context. The public methods
// defined in this interface must only be called on the UI thread.
@@ -72,6 +73,7 @@ class CONTENT_EXPORT PlatformNotificationContextImpl
// Creates a BlinkNotificationServiceImpl that is owned by this context.
// |document_url| is empty when originating from a worker.
void CreateService(
+ RenderFrameHost* render_frame_host,
const url::Origin& origin,
const GURL& document_url,
mojo::PendingReceiver<blink::mojom::NotificationService> receiver);
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index f788e63de17e478ad749c61a2744747ef59af75a..d64ad2d8d3a9515768d82ff02e7be26383dd5b66 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -2273,7 +2273,7 @@ void RenderProcessHostImpl::CreateNotificationService(
document_url = rfh->GetLastCommittedURL();
storage_partition_impl_->GetPlatformNotificationContext()->CreateService(
- origin, document_url, std::move(receiver));
+ RenderFrameHost::FromID(GetID(), render_frame_id), origin, document_url, std::move(receiver));
}
void RenderProcessHostImpl::CreateWebSocketConnector(
diff --git a/content/public/browser/platform_notification_service.h b/content/public/browser/platform_notification_service.h
index 9646cbeb31141e3518f51482801431f3a6010360..b13b6ab07b4931b892749c84879d9a6adb3bcb58 100644
--- a/content/public/browser/platform_notification_service.h
+++ b/content/public/browser/platform_notification_service.h
@@ -26,6 +26,8 @@ struct PlatformNotificationData;
namespace content {
+class RenderFrameHost;
+
// The service using which notifications can be presented to the user. There
// should be a unique instance of the PlatformNotificationService depending
// on the browsing context being used.
@@ -41,6 +43,7 @@ class CONTENT_EXPORT PlatformNotificationService {
// This method must be called on the UI thread. |document_url| is empty when
// the display notification originates from a worker.
virtual void DisplayNotification(
+ RenderFrameHost* render_frame_host,
const std::string& notification_id,
const GURL& origin,
const GURL& document_url,
diff --git a/content/test/mock_platform_notification_service.cc b/content/test/mock_platform_notification_service.cc
index 7397963a36bec7016ae92fbc4bb741825e5fb8d1..d928e1ea629cd69ff188ce53e311786acc069222 100644
--- a/content/test/mock_platform_notification_service.cc
+++ b/content/test/mock_platform_notification_service.cc
@@ -29,6 +29,7 @@ MockPlatformNotificationService::MockPlatformNotificationService(
MockPlatformNotificationService::~MockPlatformNotificationService() = default;
void MockPlatformNotificationService::DisplayNotification(
+ RenderProcessHost* render_process_host,
const std::string& notification_id,
const GURL& origin,
const GURL& document_url,
diff --git a/content/test/mock_platform_notification_service.h b/content/test/mock_platform_notification_service.h
index f2047771199f29ef4fe2a1817bf44acb54fe99b9..bea2d5e78bceb48678bfaeebe1745173967b983f 100644
--- a/content/test/mock_platform_notification_service.h
+++ b/content/test/mock_platform_notification_service.h
@@ -46,6 +46,7 @@ class MockPlatformNotificationService : public PlatformNotificationService {
// PlatformNotificationService implementation.
void DisplayNotification(
+ RenderProcessHost* render_process_host,
const std::string& notification_id,
const GURL& origin,
const GURL& document_url,