mirror of
https://github.com/electron/electron.git
synced 2026-03-19 03:02:02 -04:00
Compare commits
3 Commits
view-macos
...
feat/notif
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae1bf816f7 | ||
|
|
771a502c76 | ||
|
|
9e57b2bc04 |
2
.github/workflows/apply-patches.yml
vendored
2
.github/workflows/apply-patches.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
||||
# Use dorny/paths-filter instead of the path filter under the on: pull_request: block
|
||||
# so that the output can be used to conditionally run the apply-patches job, which lets
|
||||
# the job be marked as a required status check (conditional skip counts as a success).
|
||||
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
|
||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
|
||||
2
.github/workflows/audit-branch-ci.yml
vendored
2
.github/workflows/audit-branch-ci.yml
vendored
@@ -155,7 +155,7 @@ jobs:
|
||||
await core.summary.write();
|
||||
- name: Send Slack message if errors
|
||||
if: ${{ always() && steps.audit-errors.outputs.errorsFound && github.ref == 'refs/heads/main' }}
|
||||
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
|
||||
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
|
||||
with:
|
||||
payload: |
|
||||
link: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
|
||||
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -61,7 +61,7 @@ jobs:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
|
||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
|
||||
@@ -126,7 +126,7 @@ jobs:
|
||||
cd src/electron
|
||||
git pack-refs
|
||||
- name: Download Out Gen Artifacts
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
|
||||
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3
|
||||
with:
|
||||
name: out_gen_artifacts_${{ env.ARTIFACT_KEY }}
|
||||
path: ./src/out/${{ env.ELECTRON_OUT_DIR }}/gen
|
||||
|
||||
@@ -173,12 +173,12 @@ jobs:
|
||||
echo "DISABLE_CRASH_REPORTER_TESTS=true" >> $GITHUB_ENV
|
||||
echo "IS_ASAN=true" >> $GITHUB_ENV
|
||||
- name: Download Generated Artifacts
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
|
||||
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3
|
||||
with:
|
||||
name: generated_artifacts_${{ env.ARTIFACT_KEY }}
|
||||
path: ./generated_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }}
|
||||
- name: Download Src Artifacts
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
|
||||
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3
|
||||
with:
|
||||
name: src_artifacts_${{ env.ARTIFACT_KEY }}
|
||||
path: ./src_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }}
|
||||
@@ -214,7 +214,7 @@ jobs:
|
||||
|
||||
- name: Run Electron Tests
|
||||
shell: bash
|
||||
timeout-minutes: 60
|
||||
timeout-minutes: 40
|
||||
env:
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
|
||||
|
||||
@@ -65,12 +65,12 @@ jobs:
|
||||
- name: Install Dependencies
|
||||
uses: ./src/electron/.github/actions/install-dependencies
|
||||
- name: Download Generated Artifacts
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
|
||||
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3
|
||||
with:
|
||||
name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
|
||||
path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
|
||||
- name: Download Src Artifacts
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
|
||||
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3
|
||||
with:
|
||||
name: src_artifacts_linux_${{ env.TARGET_ARCH }}
|
||||
path: ./src_artifacts_linux_${{ env.TARGET_ARCH }}
|
||||
@@ -121,12 +121,12 @@ jobs:
|
||||
- name: Install Dependencies
|
||||
uses: ./src/electron/.github/actions/install-dependencies
|
||||
- name: Download Generated Artifacts
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
|
||||
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3
|
||||
with:
|
||||
name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
|
||||
path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
|
||||
- name: Download Src Artifacts
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
|
||||
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3
|
||||
with:
|
||||
name: src_artifacts_linux_${{ env.TARGET_ARCH }}
|
||||
path: ./src_artifacts_linux_${{ env.TARGET_ARCH }}
|
||||
|
||||
2
.github/workflows/pull-request-labeled.yml
vendored
2
.github/workflows/pull-request-labeled.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
permissions: {}
|
||||
steps:
|
||||
- name: Trigger Slack workflow
|
||||
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
|
||||
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
|
||||
with:
|
||||
webhook: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }}
|
||||
webhook-type: webhook-trigger
|
||||
|
||||
2
.github/workflows/scorecards.yml
vendored
2
.github/workflows/scorecards.yml
vendored
@@ -51,6 +51,6 @@ jobs:
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@b1bff81932f5cdfc8695c7752dcee935dcd061c8 # v3.29.5
|
||||
uses: github/codeql-action/upload-sarif@0d579ffd059c29b07949a3cce3983f0780820c98 # v3.29.5
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
2
DEPS
2
DEPS
@@ -2,7 +2,7 @@ gclient_gn_args_from = 'src'
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'148.0.7737.0',
|
||||
'148.0.7733.0',
|
||||
'node_version':
|
||||
'v24.14.0',
|
||||
'nan_version':
|
||||
|
||||
@@ -76,11 +76,87 @@ app.whenReady().then(() => {
|
||||
})
|
||||
```
|
||||
|
||||
#### `Notification.getHistory()` _macOS_
|
||||
|
||||
Returns `Promise<Notification[]>` - Resolves with an array of `Notification` objects representing all delivered notifications still present in Notification Center.
|
||||
|
||||
Each returned `Notification` is a live object connected to the corresponding delivered notification. Interaction events (`click`, `reply`, `action`, `close`) will fire on these objects when the user interacts with the notification in Notification Center. This is useful after an app restart to re-attach event handlers to notifications from a previous session.
|
||||
|
||||
The returned notifications have their `id`, `groupId`, `title`, `subtitle`, and `body` properties populated from what macOS provides. Other properties (e.g., `actions`, `silent`, `icon`) are not available from delivered notifications and will have default values.
|
||||
|
||||
> [!NOTE]
|
||||
> Like all macOS notification APIs, this method requires the application to be
|
||||
> code-signed. In unsigned development builds, notifications are not delivered
|
||||
> to Notification Center and this method will resolve with an empty array.
|
||||
|
||||
> [!NOTE]
|
||||
> Unlike notifications created with `new Notification()`, notifications returned
|
||||
> by `getHistory()` will remain visible in Notification Center when the object
|
||||
> is garbage collected.
|
||||
|
||||
```js
|
||||
const { Notification, app } = require('electron')
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
// Restore notifications from a previous session
|
||||
const notifications = await Notification.getHistory()
|
||||
for (const n of notifications) {
|
||||
console.log(`Found delivered notification: ${n.id} - ${n.title}`)
|
||||
n.on('click', () => {
|
||||
console.log(`User clicked: ${n.id}`)
|
||||
})
|
||||
n.on('reply', (event) => {
|
||||
console.log(`User replied to ${n.id}: ${event.reply}`)
|
||||
})
|
||||
}
|
||||
// Keep references so events continue to fire
|
||||
})
|
||||
```
|
||||
|
||||
#### `Notification.remove(id)` _macOS_
|
||||
|
||||
* `id` (string | string[]) - The notification identifier(s) to remove. These correspond to the `id` values set in the [`Notification` constructor](#new-notificationoptions).
|
||||
|
||||
Removes one or more delivered notifications from Notification Center by their identifier(s).
|
||||
|
||||
```js
|
||||
const { Notification } = require('electron')
|
||||
|
||||
// Remove a single notification
|
||||
Notification.remove('my-notification-id')
|
||||
|
||||
// Remove multiple notifications
|
||||
Notification.remove(['msg-1', 'msg-2', 'msg-3'])
|
||||
```
|
||||
|
||||
#### `Notification.removeAll()` _macOS_
|
||||
|
||||
Removes all of the app's delivered notifications from Notification Center.
|
||||
|
||||
```js
|
||||
const { Notification } = require('electron')
|
||||
|
||||
Notification.removeAll()
|
||||
```
|
||||
|
||||
#### `Notification.removeGroup(groupId)` _macOS_
|
||||
|
||||
* `groupId` string - The group identifier of the notifications to remove. This corresponds to the `groupId` value set in the [`Notification` constructor](#new-notificationoptions).
|
||||
|
||||
Removes all delivered notifications with the given `groupId` from Notification Center.
|
||||
|
||||
```js
|
||||
const { Notification } = require('electron')
|
||||
|
||||
// Remove all notifications in the 'chat-thread-1' group
|
||||
Notification.removeGroup('chat-thread-1')
|
||||
```
|
||||
|
||||
### `new Notification([options])`
|
||||
|
||||
* `options` Object (optional)
|
||||
* `id` string (optional) _macOS_ - A unique identifier for the notification, mapping to `UNNotificationRequest`'s [`identifier`](https://developer.apple.com/documentation/usernotifications/unnotificationrequest/identifier) property. Defaults to a random UUID if not provided or if an empty string is passed. This can be used to remove or update previously delivered notifications.
|
||||
* `groupId` string (optional) _macOS_ - A string identifier used to visually group notifications together in Notification Center. Maps to `UNNotificationContent`'s [`threadIdentifier`](https://developer.apple.com/documentation/usernotifications/unnotificationcontent/threadidentifier) property.
|
||||
* `id` string (optional) _macOS_ - A unique identifier for the notification, mapping to `UNNotificationRequest`'s [`identifier`](https://developer.apple.com/documentation/usernotifications/unnotificationrequest/identifier) property. Defaults to a random UUID if not provided or if an empty string is passed. Use this identifier with [`Notification.remove()`](#notificationremoveid-macos) to remove specific delivered notifications, or with [`Notification.getHistory()`](#notificationgethistory-macos) to identify them.
|
||||
* `groupId` string (optional) _macOS_ - A string identifier used to visually group notifications together in Notification Center. Maps to `UNNotificationContent`'s [`threadIdentifier`](https://developer.apple.com/documentation/usernotifications/unnotificationcontent/threadidentifier) property. Use this identifier with [`Notification.removeGroup()`](#notificationremovegroupgroupid-macos) to remove all notifications in a group.
|
||||
* `title` string (optional) - A title for the notification, which will be displayed at the top of the notification window when it is shown.
|
||||
* `subtitle` string (optional) _macOS_ - A subtitle for the notification, which will be displayed below the title.
|
||||
* `body` string (optional) - The body text of the notification, which will be displayed below the title or subtitle.
|
||||
|
||||
@@ -179,7 +179,6 @@ auto_filenames = {
|
||||
"lib/common/define-properties.ts",
|
||||
"lib/common/deprecate.ts",
|
||||
"lib/common/ipc-messages.ts",
|
||||
"lib/common/timers-shim.ts",
|
||||
"lib/common/web-view-methods.ts",
|
||||
"lib/common/webpack-globals-provider.ts",
|
||||
"lib/renderer/api/context-bridge.ts",
|
||||
|
||||
@@ -2,6 +2,10 @@ const binding = process._linkedBinding('electron_browser_notification');
|
||||
|
||||
const ElectronNotification = binding.Notification;
|
||||
ElectronNotification.isSupported = binding.isSupported;
|
||||
ElectronNotification.getHistory = binding.getHistory;
|
||||
ElectronNotification.remove = binding.remove;
|
||||
ElectronNotification.removeAll = binding.removeAll;
|
||||
ElectronNotification.removeGroup = binding.removeGroup;
|
||||
|
||||
if (process.platform === 'win32' && binding.handleActivation) {
|
||||
ElectronNotification.handleActivation = binding.handleActivation;
|
||||
|
||||
@@ -128,6 +128,7 @@ fix_win32_synchronous_spellcheck.patch
|
||||
chore_grandfather_in_electron_views_and_delegates.patch
|
||||
refactor_patch_electron_permissiontypes_into_blink.patch
|
||||
revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch
|
||||
build_partial_revert_mac_fullscreen_top_chrome_mouse_events.patch
|
||||
fix_add_macos_memory_query_fallback_to_avoid_crash.patch
|
||||
fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch
|
||||
feat_add_support_for_embedder_snapshot_validation.patch
|
||||
|
||||
@@ -49,7 +49,7 @@ index 901b727ed898cdd840df5ff7e2380fbee5d7fde2..1caacaeed9ddf1162cfa393fe4a7c86a
|
||||
// its owning reference back to our owning LocalFrame.
|
||||
client_->Detached(type);
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
index 79e918fbad2706986ee13188efa99004ac2ece7c..61a32900134e2b977d29290089faf537894037e3 100644
|
||||
index 85b472e644c4e705b5a176a6c8bcbdf15cdded54..4af17ceeb6e6eb6cf07c6e8723a2065671d12d13 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
@@ -757,10 +757,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) {
|
||||
|
||||
@@ -33,10 +33,10 @@ index 4b1fd316496e33f9e805aec89a91062587e6ee16..1b6fce9e2780a37e1e8bf3f8a62dc6bc
|
||||
"//base",
|
||||
"//build:branding_buildflags",
|
||||
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
|
||||
index c36fc5c088b3921ce18b0997e582ba821a2edcab..42f22c828d0982280cc009b3abbc768195ace90c 100644
|
||||
index 8e3ef4d024dcf59f3a3d481312dc27521e313162..befd4aa9b849fcb6c249048095d55b4b7688550e 100644
|
||||
--- a/chrome/browser/BUILD.gn
|
||||
+++ b/chrome/browser/BUILD.gn
|
||||
@@ -4565,7 +4565,7 @@ static_library("browser") {
|
||||
@@ -4588,7 +4588,7 @@ static_library("browser") {
|
||||
]
|
||||
}
|
||||
|
||||
@@ -46,10 +46,10 @@ index c36fc5c088b3921ce18b0997e582ba821a2edcab..42f22c828d0982280cc009b3abbc7681
|
||||
# than here in :chrome_dll.
|
||||
deps += [ "//chrome:packed_resources_integrity_header" ]
|
||||
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
|
||||
index 503cb312afe9c24a29565664287a1f47678202ef..e4427dd7ac14f466e6d5ef777658cc77d9f2ff40 100644
|
||||
index b800bca928e2c9c5e843fbf7b29d42e397c5f351..bd4a891a764152dc08b2ee08a09e5430bd83040e 100644
|
||||
--- a/chrome/test/BUILD.gn
|
||||
+++ b/chrome/test/BUILD.gn
|
||||
@@ -7769,9 +7769,12 @@ test("unit_tests") {
|
||||
@@ -7757,9 +7757,12 @@ test("unit_tests") {
|
||||
"//chrome/notification_helper",
|
||||
]
|
||||
|
||||
@@ -63,7 +63,7 @@ index 503cb312afe9c24a29565664287a1f47678202ef..e4427dd7ac14f466e6d5ef777658cc77
|
||||
"//chrome//services/util_win:unit_tests",
|
||||
"//chrome/app:chrome_dll_resources",
|
||||
"//chrome/app:win_unit_tests",
|
||||
@@ -8767,6 +8770,10 @@ test("unit_tests") {
|
||||
@@ -8753,6 +8756,10 @@ test("unit_tests") {
|
||||
"../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc",
|
||||
]
|
||||
|
||||
@@ -74,7 +74,7 @@ index 503cb312afe9c24a29565664287a1f47678202ef..e4427dd7ac14f466e6d5ef777658cc77
|
||||
sources += [
|
||||
# The importer code is not used on Android.
|
||||
"../common/importer/firefox_importer_utils_unittest.cc",
|
||||
@@ -8824,7 +8831,6 @@ test("unit_tests") {
|
||||
@@ -8810,7 +8817,6 @@ test("unit_tests") {
|
||||
# TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above?
|
||||
deps += [
|
||||
"../browser/screen_ai:screen_ai_install_state",
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Keeley Hammond <khammond@slack-corp.com>
|
||||
Date: Wed, 25 Jun 2025 10:21:31 -0400
|
||||
Subject: build: partially revert Mac fullscreen top-chrome mouse events
|
||||
|
||||
Reverts "mac: fix missing mouse up and down event in fullscreen top-chrome".
|
||||
This CL caused all interactions to fail when loading a page via loadURL
|
||||
on Mac. This patch can be removed when upstream is fixed, or when a better
|
||||
solution is put in place.
|
||||
|
||||
This reverts commit 8c004781dde7d42d9a3fed8cafcaa4929943dd69.
|
||||
|
||||
diff --git a/components/remote_cocoa/app_shim/bridged_content_view.mm b/components/remote_cocoa/app_shim/bridged_content_view.mm
|
||||
index c8e9717e6612291256d0c12613d5d1cf927b890b..7359eb46eb40933d2ec9bd664ec87139af5260df 100644
|
||||
--- a/components/remote_cocoa/app_shim/bridged_content_view.mm
|
||||
+++ b/components/remote_cocoa/app_shim/bridged_content_view.mm
|
||||
@@ -305,14 +305,6 @@ - (NSView*)hitTest:(NSPoint)point {
|
||||
return nil;
|
||||
}
|
||||
|
||||
- // Send event to views::RootView.
|
||||
- if (hitTestResult == remote_cocoa::mojom::HitTestResult::kRootView) {
|
||||
- // Most commonly this NSView is NSWindow's contentView. However in immersive
|
||||
- // fullscreen, the view may be a subview of another AppKit-owned view in the
|
||||
- // titlebar.
|
||||
- return self;
|
||||
- }
|
||||
-
|
||||
return [super hitTest:point];
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@ potentially prevent a window from being created.
|
||||
TODO(loc): this patch is currently broken.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
index 2e4480b98b9d8adf9abacff49e82e611511540c8..bb1442bcf2575bfd754469748d8322bb7ed76b17 100644
|
||||
index 12304d459b01d0e951065f90c98f4d24c4b138d3..43d64ce77ce86b961bbfd0e0e661577dae0708ca 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -10126,6 +10126,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
@@ -10134,6 +10134,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
last_committed_origin_, params->window_container_type,
|
||||
params->target_url, params->referrer.To<Referrer>(),
|
||||
params->frame_name, params->disposition, *params->features,
|
||||
@@ -224,7 +224,7 @@ index d92bab531c12c62a5321a23f4a0cb89691668127..2060e04795ba8e7a923fd0fe3485b8c5
|
||||
|
||||
} // namespace blink
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
index 715ca6e188c7e821478fcbaa4496efd25a673c61..e58465eb936b2a8b3479201ec24580501f7fc2f3 100644
|
||||
index 3fbc88748183fee47003947a9c2c3f9c2d768a59..90d6ef7e75a1765be57bdc4e28aeed69bd3289c2 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
@@ -2341,6 +2341,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
|
||||
|
||||
@@ -80,7 +80,7 @@ index 39fa45f0a0f9076bd7ac0be6f455dd540a276512..3d0381d463eed73470b28085830f2a23
|
||||
content::WebContents* source,
|
||||
const content::OpenURLParams& params,
|
||||
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
|
||||
index 8899a3216052582e35c5c046e1e0baee48052452..461cb574dc1083fae0bc96e53ed94ba117f7691d 100644
|
||||
index f47a1155907d92146dabd72b5c7e8120a2b71c77..9122edca238bffc3b0949d71a217f2e6414d3fa9 100644
|
||||
--- a/chrome/browser/ui/browser.cc
|
||||
+++ b/chrome/browser/ui/browser.cc
|
||||
@@ -2288,7 +2288,8 @@ bool Browser::IsWebContentsCreationOverridden(
|
||||
|
||||
@@ -8,10 +8,10 @@ Allow registering custom protocols to handle service worker main script fetching
|
||||
Refs https://bugs.chromium.org/p/chromium/issues/detail?id=996511
|
||||
|
||||
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc
|
||||
index ca69af7a6a14182fe3b9eb049e9bfee476c8eb77..cbdc905d6578675b48045ebf5fa8c5d5bef2ee67 100644
|
||||
index 59b61e92921c2a21ec6d0d98fecc27cb2465d917..a527eb1558a070361285070e047587a122423654 100644
|
||||
--- a/content/browser/service_worker/service_worker_context_wrapper.cc
|
||||
+++ b/content/browser/service_worker/service_worker_context_wrapper.cc
|
||||
@@ -1963,6 +1963,26 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
|
||||
@@ -1958,6 +1958,26 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
|
||||
loader_factory_bundle_info =
|
||||
context()->loader_factory_bundle_for_update_check()->Clone();
|
||||
|
||||
@@ -38,7 +38,7 @@ index ca69af7a6a14182fe3b9eb049e9bfee476c8eb77..cbdc905d6578675b48045ebf5fa8c5d5
|
||||
if (auto* config = content::WebUIConfigMap::GetInstance().GetConfig(
|
||||
browser_context(), scope)) {
|
||||
// If this is a Service Worker for a WebUI, the WebUI's URLDataSource
|
||||
@@ -1982,9 +2002,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
|
||||
@@ -1977,9 +1997,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest(
|
||||
features::kEnableServiceWorkersForChromeScheme) &&
|
||||
scope.scheme() == kChromeUIScheme) {
|
||||
config->RegisterURLDataSource(browser_context());
|
||||
|
||||
@@ -17,7 +17,7 @@ as well as keeps these storage areas limited to a bounded
|
||||
size meanwhile giving application developers more space to work with.
|
||||
|
||||
diff --git a/components/services/storage/dom_storage/dom_storage_constants.h b/components/services/storage/dom_storage/dom_storage_constants.h
|
||||
index 2ded9daa5611d3121677f4d67d19fcdbbcc68d26..d5a9f43850d3d7c3a73873ebb24bf2ccb937a6ed 100644
|
||||
index 6168559e4ee26c29d15aa56a84f23c6c68b8382a..58005a64044c0da29f221aa23c51a1d8b082af5b 100644
|
||||
--- a/components/services/storage/dom_storage/dom_storage_constants.h
|
||||
+++ b/components/services/storage/dom_storage/dom_storage_constants.h
|
||||
@@ -11,7 +11,8 @@ namespace storage {
|
||||
|
||||
@@ -193,10 +193,10 @@ index d9c14f91747bde0e76056d7f2f2ada166e67f994..09335acac17f526fb8d8e42e4b2d993b
|
||||
|
||||
UtilityProcessHost::Start(std::move(utility_options),
|
||||
diff --git a/content/browser/service_host/utility_process_host.cc b/content/browser/service_host/utility_process_host.cc
|
||||
index 1b6c5d15eaf06224d40bee70b2da2a6b9c623f9a..23731f8c98c50c3140867debba688c5720684444 100644
|
||||
index bcb910d6c715535843ef515ee0bd7d3d794fb6c0..3739d028b77b5e33ad0435f99a101b6407128a0d 100644
|
||||
--- a/content/browser/service_host/utility_process_host.cc
|
||||
+++ b/content/browser/service_host/utility_process_host.cc
|
||||
@@ -242,13 +242,13 @@ UtilityProcessHost::Options& UtilityProcessHost::Options::WithFileToPreload(
|
||||
@@ -241,13 +241,13 @@ UtilityProcessHost::Options& UtilityProcessHost::Options::WithFileToPreload(
|
||||
}
|
||||
#endif // BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
|
||||
@@ -213,7 +213,7 @@ index 1b6c5d15eaf06224d40bee70b2da2a6b9c623f9a..23731f8c98c50c3140867debba688c57
|
||||
|
||||
#if BUILDFLAG(USE_ZYGOTE)
|
||||
UtilityProcessHost::Options& UtilityProcessHost::Options::WithZygoteForTesting(
|
||||
@@ -258,6 +258,45 @@ UtilityProcessHost::Options& UtilityProcessHost::Options::WithZygoteForTesting(
|
||||
@@ -257,6 +257,45 @@ UtilityProcessHost::Options& UtilityProcessHost::Options::WithZygoteForTesting(
|
||||
}
|
||||
#endif // BUILDFLAG(USE_ZYGOTE)
|
||||
|
||||
@@ -259,7 +259,7 @@ index 1b6c5d15eaf06224d40bee70b2da2a6b9c623f9a..23731f8c98c50c3140867debba688c57
|
||||
UtilityProcessHost::Options&
|
||||
UtilityProcessHost::Options::WithBoundReceiverOnChildProcessForTesting(
|
||||
mojo::GenericPendingReceiver receiver) {
|
||||
@@ -535,9 +574,30 @@ bool UtilityProcessHost::StartProcess() {
|
||||
@@ -534,9 +573,30 @@ bool UtilityProcessHost::StartProcess() {
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_GPU_CHANNEL_MEDIA_CAPTURE) && !BUILDFLAG(IS_WIN)
|
||||
|
||||
|
||||
@@ -46,10 +46,10 @@ index 6e60de1319c5506d7180719fa230ab9cf537b832..e570e335fbd413340ddedeee423eca71
|
||||
'internal-forced-visited-'):
|
||||
internal_visited_order = 0
|
||||
diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5
|
||||
index 39e8cc9179c512d5598ad1d87e6f81a25141db35..20e32baac65381bae5927cb74935c6a8a4737d3b 100644
|
||||
index bce3a012ce093c64b273045a9fbcd4db88c4c365..6175f0d0ddbfbc6a4e43f0135c6b84f39efcecb0 100644
|
||||
--- a/third_party/blink/renderer/core/css/css_properties.json5
|
||||
+++ b/third_party/blink/renderer/core/css/css_properties.json5
|
||||
@@ -9605,6 +9605,27 @@
|
||||
@@ -9606,6 +9606,27 @@
|
||||
property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"],
|
||||
},
|
||||
|
||||
@@ -132,10 +132,10 @@ index 59a95a74f542eea6b1a1ee85f77b6f8c124ebcad..6a6ab6dec5d9496380c876c1aef70ee7
|
||||
} // namespace css_longhand
|
||||
} // namespace blink
|
||||
diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
|
||||
index b9be661d5723388aebd68037612ac2ac91377912..8737ab0c93639074341863f323e61c03e3abb622 100644
|
||||
index 59cbbbaf800308d1f2c917adeb25e55df394bee4..0022411e2a7cb36997c51c23f0214d369daef48c 100644
|
||||
--- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
|
||||
+++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
|
||||
@@ -4193,6 +4193,15 @@ PositionTryFallback StyleBuilderConverter::ConvertSinglePositionTryFallback(
|
||||
@@ -4191,6 +4191,15 @@ PositionTryFallback StyleBuilderConverter::ConvertSinglePositionTryFallback(
|
||||
return PositionTryFallback(scoped_name, tactic_list);
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ index 18f283e625101318ee14b50e6e765dfd1c9a1a44..44a3a55974c9e4b9e715574075f25661
|
||||
|
||||
auto DrawAsSinglePath = [&]() {
|
||||
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||
index 3c89773a5ac4d27a6802cdb2ea2c78c5e8688b12..301634f4adab9e105df463b3d191528fc6b75103 100644
|
||||
index 7afb28fffccf3c117d742f08b31c1365e84af4b0..35bcd34d7a281a95c12c5831dc97a601715157b5 100644
|
||||
--- a/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||
+++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||
@@ -214,6 +214,10 @@
|
||||
|
||||
@@ -90,7 +90,7 @@ index 8af69cac78b7488d28f1f05ccb174793fe5148cd..9f74e511c263d147b5fbe81fe100d217
|
||||
private:
|
||||
const HWND hwnd_;
|
||||
diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn
|
||||
index 4ed0b92bd84e0bd97ebd0c6336d92191cc7bb8e8..901f6a4f446ba615a0d0d259735fcc055aeafe93 100644
|
||||
index cbdc5064414818b8320ecf3ff1e3439d52adee08..134f2b52029760bbb6ffd5d6fd0df1840e6b4d66 100644
|
||||
--- a/components/viz/service/BUILD.gn
|
||||
+++ b/components/viz/service/BUILD.gn
|
||||
@@ -176,6 +176,8 @@ viz_component("service") {
|
||||
|
||||
@@ -84,10 +84,10 @@ index 2648adb1cf38ab557b66ffd0e3034b26b04d76d6..98eab587f343f6ca472efc3d4e7b31b2
|
||||
private:
|
||||
const std::string service_interface_name_;
|
||||
diff --git a/content/browser/service_host/utility_process_host.cc b/content/browser/service_host/utility_process_host.cc
|
||||
index 23731f8c98c50c3140867debba688c5720684444..234e822d265b09fcc338f0677e2135747699d70c 100644
|
||||
index 3739d028b77b5e33ad0435f99a101b6407128a0d..512426af65fc421dfe48fe07a2a9a8274e5f33ec 100644
|
||||
--- a/content/browser/service_host/utility_process_host.cc
|
||||
+++ b/content/browser/service_host/utility_process_host.cc
|
||||
@@ -652,7 +652,7 @@ void UtilityProcessHost::OnProcessCrashed(int exit_code) {
|
||||
@@ -651,7 +651,7 @@ void UtilityProcessHost::OnProcessCrashed(int exit_code) {
|
||||
: Client::CrashType::kPreIpcInitialization;
|
||||
}
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
@@ -17,7 +17,7 @@ headers, moving forward we should find a way in upstream to provide
|
||||
access to these headers for loader clients created on the browser process.
|
||||
|
||||
diff --git a/services/network/public/cpp/resource_request.cc b/services/network/public/cpp/resource_request.cc
|
||||
index 87258c4eb6234a4e2b78ca84cfaeeb0536239cdb..ed46dc02d646da1e4ffa1b9c10325b51ffe862d0 100644
|
||||
index f23e677790e757c664a80ff6d56cc85fe6bdd7c5..f2512fcd5c2a87ed0e51ad420b868f2a88d75297 100644
|
||||
--- a/services/network/public/cpp/resource_request.cc
|
||||
+++ b/services/network/public/cpp/resource_request.cc
|
||||
@@ -203,6 +203,7 @@ ResourceRequest::TrustedParams& ResourceRequest::TrustedParams::operator=(
|
||||
@@ -28,7 +28,7 @@ index 87258c4eb6234a4e2b78ca84cfaeeb0536239cdb..ed46dc02d646da1e4ffa1b9c10325b51
|
||||
enabled_client_hints = other.enabled_client_hints;
|
||||
cookie_observer =
|
||||
Clone(&const_cast<mojo::PendingRemote<mojom::CookieAccessObserver>&>(
|
||||
@@ -243,6 +244,7 @@ bool ResourceRequest::TrustedParams::EqualsForTesting(
|
||||
@@ -241,6 +242,7 @@ bool ResourceRequest::TrustedParams::EqualsForTesting(
|
||||
const TrustedParams& other) const {
|
||||
return isolation_info.IsEqualForTesting(other.isolation_info) &&
|
||||
disable_secure_dns == other.disable_secure_dns &&
|
||||
@@ -37,7 +37,7 @@ index 87258c4eb6234a4e2b78ca84cfaeeb0536239cdb..ed46dc02d646da1e4ffa1b9c10325b51
|
||||
allow_cookies_from_browser == other.allow_cookies_from_browser &&
|
||||
include_request_cookies_with_response ==
|
||||
diff --git a/services/network/public/cpp/resource_request.h b/services/network/public/cpp/resource_request.h
|
||||
index cfc57e89c8d609a329ebfdc514ddf909ef764401..0ecc81ae28d43d62fbddf232dd11786e2a1ae691 100644
|
||||
index 9318e70ace85699b8931c3f86f5f2c41cb46751d..307fc7afc4479cda7a8529c40c236e67ecd3aafb 100644
|
||||
--- a/services/network/public/cpp/resource_request.h
|
||||
+++ b/services/network/public/cpp/resource_request.h
|
||||
@@ -116,6 +116,7 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE) ResourceRequest {
|
||||
@@ -49,7 +49,7 @@ index cfc57e89c8d609a329ebfdc514ddf909ef764401..0ecc81ae28d43d62fbddf232dd11786e
|
||||
mojo::PendingRemote<mojom::CookieAccessObserver> cookie_observer;
|
||||
mojo::PendingRemote<mojom::TrustTokenAccessObserver> trust_token_observer;
|
||||
diff --git a/services/network/public/cpp/url_request_mojom_traits.cc b/services/network/public/cpp/url_request_mojom_traits.cc
|
||||
index 3146eb91f25befedbe45cbd0e5ca33a22c7a4cc3..4621fc82a435cdde0984798a59ec5fbd4efde56b 100644
|
||||
index cdd4b909515cbf9734f21c8542e641df26acf584..1e8f18ee1612b8eef35f964ee72db6ddefea18b4 100644
|
||||
--- a/services/network/public/cpp/url_request_mojom_traits.cc
|
||||
+++ b/services/network/public/cpp/url_request_mojom_traits.cc
|
||||
@@ -67,6 +67,7 @@ bool StructTraits<network::mojom::TrustedUrlRequestParamsDataView,
|
||||
@@ -61,7 +61,7 @@ index 3146eb91f25befedbe45cbd0e5ca33a22c7a4cc3..4621fc82a435cdde0984798a59ec5fbd
|
||||
return false;
|
||||
}
|
||||
diff --git a/services/network/public/cpp/url_request_mojom_traits.h b/services/network/public/cpp/url_request_mojom_traits.h
|
||||
index cb7367119e7ec2dcc89b3dff381e8f8651dee40d..d914c57f6732dc64c2eb734316ca1a8aca64d7f3 100644
|
||||
index 3969949030e7c73f4a53a28a5d0a22802389b058..a1f3302a43f23308d7d4ee0b35090377394c5a21 100644
|
||||
--- a/services/network/public/cpp/url_request_mojom_traits.h
|
||||
+++ b/services/network/public/cpp/url_request_mojom_traits.h
|
||||
@@ -109,6 +109,10 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE)
|
||||
@@ -76,7 +76,7 @@ index cb7367119e7ec2dcc89b3dff381e8f8651dee40d..d914c57f6732dc64c2eb734316ca1a8a
|
||||
network::ResourceRequest::TrustedParams::EnabledClientHints>&
|
||||
enabled_client_hints(
|
||||
diff --git a/services/network/public/mojom/url_request.mojom b/services/network/public/mojom/url_request.mojom
|
||||
index 4fc03c32965010a466b96d05c0e3b3afc9ab0d9b..57a67b5980c2d4b66d3eedead6b8fc0cc4dc73e7 100644
|
||||
index e503e4940c6c5afa8e4907ce3fcabdf8a12e8d81..3df4be54916dda28e3725baba53a7bef1d369dc2 100644
|
||||
--- a/services/network/public/mojom/url_request.mojom
|
||||
+++ b/services/network/public/mojom/url_request.mojom
|
||||
@@ -111,6 +111,9 @@ struct TrustedUrlRequestParams {
|
||||
|
||||
@@ -34,10 +34,10 @@ index 2f6fbe5270245ddb1ef82f097ac1258781acb66e..727b73a37a3258aa44643d66dceba790
|
||||
}
|
||||
|
||||
diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc
|
||||
index e25fee83684f514801199d3edf865bfee3684ae1..a75a65bed13d548494ad9a646e447002ef8b4ad4 100644
|
||||
index f263d96b11aee75bbd0e6b8f4ff5a520f7047e9e..d278eae0806c1d51e949c7026fa01f01494c8dd3 100644
|
||||
--- a/content/browser/permissions/permission_controller_impl.cc
|
||||
+++ b/content/browser/permissions/permission_controller_impl.cc
|
||||
@@ -98,7 +98,8 @@ PermissionToSchedulingFeature(PermissionType permission_name) {
|
||||
@@ -97,7 +97,8 @@ PermissionToSchedulingFeature(PermissionType permission_name) {
|
||||
case PermissionType::LOCAL_NETWORK_ACCESS:
|
||||
case PermissionType::LOCAL_NETWORK:
|
||||
case PermissionType::LOOPBACK_NETWORK:
|
||||
|
||||
@@ -106,10 +106,10 @@ index 79eece0dfff27b4fdb6beb895271e419007de4e3..9dda823b2e80048ba6fdedf398c40327
|
||||
bool is_visible_on_all_workspaces_ = false;
|
||||
gfx::Rect window_bounds_before_fullscreen_;
|
||||
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
||||
index 96678f5de2a0b67cd338012fb84b9ea7ff904084..afc4c3030d15eeb7a270ca6d3cc29e64a2ad003d 100644
|
||||
index 03caee9409869b7009750cc68e1d1503b9719b76..994483c8e95451ed43aa00f5c4c4e45354bfa8bd 100644
|
||||
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
||||
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
||||
@@ -481,6 +481,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
@@ -477,6 +477,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
if (!is_tooltip) {
|
||||
tooltip_manager_ = std::make_unique<TooltipManagerMac>(GetNSWindowMojo());
|
||||
}
|
||||
@@ -117,7 +117,7 @@ index 96678f5de2a0b67cd338012fb84b9ea7ff904084..afc4c3030d15eeb7a270ca6d3cc29e64
|
||||
|
||||
if (params.workspace.length()) {
|
||||
if (std::optional<std::vector<uint8_t>> restoration_data =
|
||||
@@ -498,6 +499,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
@@ -494,6 +495,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
window_params->modal_type = widget->widget_delegate()->GetModalType();
|
||||
window_params->is_translucent =
|
||||
params.opacity == Widget::InitParams::WindowOpacity::kTranslucent;
|
||||
@@ -125,7 +125,7 @@ index 96678f5de2a0b67cd338012fb84b9ea7ff904084..afc4c3030d15eeb7a270ca6d3cc29e64
|
||||
window_params->is_tooltip = is_tooltip;
|
||||
|
||||
// macOS likes to put shadows on most things. However, frameless windows
|
||||
@@ -687,9 +689,10 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
@@ -682,9 +684,10 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
// case it will never become visible but we want its compositor to produce
|
||||
// frames for screenshooting and screencasting.
|
||||
UpdateCompositorProperties();
|
||||
|
||||
@@ -28,10 +28,10 @@ The patch should be removed in favor of either:
|
||||
Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397.
|
||||
|
||||
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc
|
||||
index 26f3bf19ec8df47ac11b90a2d7afb1f8730d8eed..5c0fc3b9c49970528798644db3fd5b7983e60d10 100644
|
||||
index 26d4c43c9e09b58c764d38f8fbf62afc8f3a3c86..c9cbf38a30e299eb37552a1885362a87bd249495 100644
|
||||
--- a/content/browser/renderer_host/navigation_request.cc
|
||||
+++ b/content/browser/renderer_host/navigation_request.cc
|
||||
@@ -11744,6 +11744,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() {
|
||||
@@ -11712,6 +11712,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() {
|
||||
target_rph_id);
|
||||
}
|
||||
|
||||
@@ -44,10 +44,10 @@ index 26f3bf19ec8df47ac11b90a2d7afb1f8730d8eed..5c0fc3b9c49970528798644db3fd5b79
|
||||
// origin of |common_params.url| and/or |common_params.initiator_origin|.
|
||||
url::Origin resolved_origin = url::Origin::Resolve(
|
||||
diff --git a/third_party/blink/renderer/core/loader/document_loader.cc b/third_party/blink/renderer/core/loader/document_loader.cc
|
||||
index 34d9311842e191d0cfa3c42e60076ee7b3e0cb62..e770e4db684c420d90420ef8615db3eede15b8a9 100644
|
||||
index f70c3db4c441a500d000fdcd939a4cb988deb74a..caf60e5bffb5e8b0f109c42a9dfc4b2426fe9bb2 100644
|
||||
--- a/third_party/blink/renderer/core/loader/document_loader.cc
|
||||
+++ b/third_party/blink/renderer/core/loader/document_loader.cc
|
||||
@@ -2356,6 +2356,7 @@ Frame* DocumentLoader::CalculateOwnerFrame() {
|
||||
@@ -2355,6 +2355,7 @@ Frame* DocumentLoader::CalculateOwnerFrame() {
|
||||
scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin(
|
||||
Document* owner_document) {
|
||||
scoped_refptr<SecurityOrigin> origin;
|
||||
@@ -55,7 +55,7 @@ index 34d9311842e191d0cfa3c42e60076ee7b3e0cb62..e770e4db684c420d90420ef8615db3ee
|
||||
// Whether the origin is newly created within this call, instead of copied
|
||||
// from an existing document's origin or from `origin_to_commit_`. If this is
|
||||
// true, we won't try to compare the nonce of this origin (if it's opaque) to
|
||||
@@ -2392,6 +2393,9 @@ scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin(
|
||||
@@ -2391,6 +2392,9 @@ scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin(
|
||||
// non-renderer only origin bits will be the same, which will be asserted at
|
||||
// the end of this function.
|
||||
origin = origin_to_commit_;
|
||||
|
||||
@@ -12,7 +12,7 @@ invisible state of the `viz::DisplayScheduler` owned
|
||||
by the `ui::Compositor`.
|
||||
|
||||
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
|
||||
index e1d4c2dd4cf8c47ea555bf550f9c51bfd3a2e2fe..0a09e16571eeeb4ad8f2140f9a47b54da3d45e70 100644
|
||||
index f12e18ad1255c0e0228805f2ba334519b446ef63..10f4b53423a8a7cf7f1f09e4570871fa1ead27ca 100644
|
||||
--- a/ui/compositor/compositor.cc
|
||||
+++ b/ui/compositor/compositor.cc
|
||||
@@ -369,7 +369,8 @@ void Compositor::SetLayerTreeFrameSink(
|
||||
|
||||
@@ -59,10 +59,10 @@ index cba373664bec3a32abad6fe0396bd67b53b7e67f..a54f1b3351efd2d8f324436f7f35cd43
|
||||
|
||||
#endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_SCRIPT_EXECUTION_CALLBACK_H_
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
index 61a32900134e2b977d29290089faf537894037e3..214053450d585246b347da2a7a51e5c8820cbff7 100644
|
||||
index 4af17ceeb6e6eb6cf07c6e8723a2065671d12d13..b8973d07dd6beedf26a943149f856da7bd546cf9 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
|
||||
@@ -3196,6 +3196,7 @@ void LocalFrame::RequestExecuteScript(
|
||||
@@ -3200,6 +3200,7 @@ void LocalFrame::RequestExecuteScript(
|
||||
mojom::blink::EvaluationTiming evaluation_timing,
|
||||
mojom::blink::LoadEventBlockingOption blocking_option,
|
||||
WebScriptExecutionCallback callback,
|
||||
@@ -70,7 +70,7 @@ index 61a32900134e2b977d29290089faf537894037e3..214053450d585246b347da2a7a51e5c8
|
||||
BackForwardCacheAware back_forward_cache_aware,
|
||||
mojom::blink::WantResultOption want_result_option,
|
||||
mojom::blink::PromiseResultOption promise_behavior) {
|
||||
@@ -3253,7 +3254,7 @@ void LocalFrame::RequestExecuteScript(
|
||||
@@ -3257,7 +3258,7 @@ void LocalFrame::RequestExecuteScript(
|
||||
PausableScriptExecutor::CreateAndRun(
|
||||
script_state, std::move(script_sources), execute_script_policy,
|
||||
user_gesture, evaluation_timing, blocking_option, want_result_option,
|
||||
@@ -80,10 +80,10 @@ index 61a32900134e2b977d29290089faf537894037e3..214053450d585246b347da2a7a51e5c8
|
||||
|
||||
void LocalFrame::SetEvictCachedSessionStorageOnFreezeOrUnload() {
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h
|
||||
index 0f119c1170f3379754b03ff38358ed6f191fb578..64024aaa3630bacbaf13b7491ff4ed5453f2abfd 100644
|
||||
index d48612c83ed164949227ca70aac6deaaa5388a36..c7efc832a839056dfb479df8e9955adecae07e7c 100644
|
||||
--- a/third_party/blink/renderer/core/frame/local_frame.h
|
||||
+++ b/third_party/blink/renderer/core/frame/local_frame.h
|
||||
@@ -832,6 +832,7 @@ class CORE_EXPORT LocalFrame final
|
||||
@@ -835,6 +835,7 @@ class CORE_EXPORT LocalFrame final
|
||||
mojom::blink::EvaluationTiming,
|
||||
mojom::blink::LoadEventBlockingOption,
|
||||
WebScriptExecutionCallback,
|
||||
@@ -211,10 +211,10 @@ index f2c94689450f0333a144ccf82cf147c194896e6b..1c2e9fe36c297f7d614d9ca290e4d13c
|
||||
const mojom::blink::UserActivationOption user_activation_option_;
|
||||
const mojom::blink::LoadEventBlockingOption blocking_option_;
|
||||
diff --git a/third_party/blink/renderer/core/frame/web_frame_test.cc b/third_party/blink/renderer/core/frame/web_frame_test.cc
|
||||
index 6e87cd9a855bd3f1145f864367f34d966088ce6c..6b0448254eec33896686544ebc2a9bf662a5bd56 100644
|
||||
index e281d26513e644465359d9c99e7240d24f6aaace..1688b62c0dd283f9d6a5190e7e269c8551c0f6f6 100644
|
||||
--- a/third_party/blink/renderer/core/frame/web_frame_test.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/web_frame_test.cc
|
||||
@@ -300,6 +300,7 @@ void ExecuteScriptsInMainWorld(
|
||||
@@ -298,6 +298,7 @@ void ExecuteScriptsInMainWorld(
|
||||
DOMWrapperWorld::kMainWorldId, sources, user_gesture,
|
||||
mojom::blink::EvaluationTiming::kSynchronous,
|
||||
mojom::blink::LoadEventBlockingOption::kDoNotBlock, std::move(callback),
|
||||
|
||||
@@ -50,10 +50,10 @@ system font by checking if it's kCTFontPriorityAttribute is set to
|
||||
system priority.
|
||||
|
||||
diff --git a/base/BUILD.gn b/base/BUILD.gn
|
||||
index bc18a7ef68c23614b3bbdd9968139e63a8e81f44..95f40f43451a103cb19de86e632e1679e36fda3f 100644
|
||||
index 7ab4379d92fdaa2e7047100c18df204265656cf1..1590dd3ae2ee86daff32edb14281589bb34df3df 100644
|
||||
--- a/base/BUILD.gn
|
||||
+++ b/base/BUILD.gn
|
||||
@@ -1084,6 +1084,7 @@ component("base") {
|
||||
@@ -1082,6 +1082,7 @@ component("base") {
|
||||
"//build:ios_buildflags",
|
||||
"//build/config/compiler:compiler_buildflags",
|
||||
"//third_party/modp_b64",
|
||||
@@ -869,7 +869,7 @@ index 15c81d1f61c5dd994f24a194665de639b6355460..e74be476326c22821087939060ff744b
|
||||
|
||||
void NativeWidgetNSWindowBridge::SetColorMode(
|
||||
diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn
|
||||
index dcdb614b91a773273e4785aff92a44b3bba6cf59..4ed0b92bd84e0bd97ebd0c6336d92191cc7bb8e8 100644
|
||||
index 7aab80076a041fac6cd81f477456a6c9169c3cb5..cbdc5064414818b8320ecf3ff1e3439d52adee08 100644
|
||||
--- a/components/viz/service/BUILD.gn
|
||||
+++ b/components/viz/service/BUILD.gn
|
||||
@@ -390,6 +390,7 @@ viz_component("service") {
|
||||
@@ -880,7 +880,7 @@ index dcdb614b91a773273e4785aff92a44b3bba6cf59..4ed0b92bd84e0bd97ebd0c6336d92191
|
||||
}
|
||||
|
||||
if (is_ios) {
|
||||
@@ -720,6 +721,7 @@ viz_source_set("unit_tests") {
|
||||
@@ -717,6 +718,7 @@ viz_source_set("unit_tests") {
|
||||
"display_embedder/software_output_device_mac_unittest.mm",
|
||||
]
|
||||
frameworks = [ "IOSurface.framework" ]
|
||||
@@ -940,7 +940,7 @@ index 010c713090e5038dc90db131c8f621422d30c03b..20c35e887a0496ee609c077e3b0494bd
|
||||
|
||||
void ForwardKeyboardEvent(const input::NativeWebKeyboardEvent& key_event,
|
||||
diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
||||
index 26e72978755365e99feef34c4210b35e0a1d0790..c83b38bf9d392301924805a1083079dc3dd0b27f 100644
|
||||
index 2f1fcace77c403c0e136ae2fc40633cccccce038..9ce9c1771310e81b18ba6fe4569544ff58730c73 100644
|
||||
--- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
||||
+++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
||||
@@ -33,6 +33,7 @@
|
||||
@@ -951,7 +951,7 @@ index 26e72978755365e99feef34c4210b35e0a1d0790..c83b38bf9d392301924805a1083079dc
|
||||
#include "skia/ext/skia_utils_mac.h"
|
||||
#include "third_party/blink/public/common/features.h"
|
||||
#include "third_party/blink/public/mojom/input/input_handler.mojom.h"
|
||||
@@ -2233,15 +2234,21 @@ - (NSAccessibilityRole)accessibilityRole {
|
||||
@@ -2209,15 +2210,21 @@ - (NSAccessibilityRole)accessibilityRole {
|
||||
// Since this implementation doesn't have to wait any IPC calls, this doesn't
|
||||
// make any key-typing jank. --hbono 7/23/09
|
||||
//
|
||||
@@ -2416,10 +2416,10 @@ index aa73ba06160c983189dd214529344a8bcf9fbe98..79eece0dfff27b4fdb6beb895271e419
|
||||
// Used to force the NSApplication's focused accessibility element to be the
|
||||
// views::Views accessibility tree when the NSView for this is focused.
|
||||
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
||||
index 56caa43bcaaa536c66aa5734ec07cf95f99a95b3..96678f5de2a0b67cd338012fb84b9ea7ff904084 100644
|
||||
index 16d4bc1c96c8bb18f13fd66b12588c9f929c5c9a..03caee9409869b7009750cc68e1d1503b9719b76 100644
|
||||
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
||||
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
||||
@@ -22,6 +22,7 @@
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "components/remote_cocoa/browser/ns_view_ids.h"
|
||||
#include "components/remote_cocoa/browser/window.h"
|
||||
#include "components/remote_cocoa/common/native_widget_ns_window.mojom.h"
|
||||
@@ -2427,7 +2427,7 @@ index 56caa43bcaaa536c66aa5734ec07cf95f99a95b3..96678f5de2a0b67cd338012fb84b9ea7
|
||||
#include "mojo/public/cpp/bindings/self_owned_associated_receiver.h"
|
||||
#include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
|
||||
#include "ui/accessibility/accessibility_features.h"
|
||||
@@ -376,8 +377,12 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
@@ -372,8 +373,12 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
if (in_process_ns_window_bridge_) {
|
||||
return gfx::NativeViewAccessible(in_process_ns_window_bridge_->ns_view());
|
||||
}
|
||||
@@ -2440,7 +2440,7 @@ index 56caa43bcaaa536c66aa5734ec07cf95f99a95b3..96678f5de2a0b67cd338012fb84b9ea7
|
||||
}
|
||||
|
||||
gfx::NativeViewAccessible
|
||||
@@ -393,8 +398,12 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
@@ -389,8 +394,12 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
[in_process_ns_window_bridge_->ns_view() window]);
|
||||
}
|
||||
|
||||
@@ -2453,7 +2453,7 @@ index 56caa43bcaaa536c66aa5734ec07cf95f99a95b3..96678f5de2a0b67cd338012fb84b9ea7
|
||||
}
|
||||
|
||||
remote_cocoa::mojom::NativeWidgetNSWindow*
|
||||
@@ -1505,9 +1514,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
@@ -1500,9 +1509,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
// for PWAs. However this breaks accessibility on in-process windows,
|
||||
// so set it back to NO when a local window gains focus. See
|
||||
// https://crbug.com/41485830.
|
||||
@@ -2465,7 +2465,7 @@ index 56caa43bcaaa536c66aa5734ec07cf95f99a95b3..96678f5de2a0b67cd338012fb84b9ea7
|
||||
// Explicitly set the keyboard accessibility state on regaining key
|
||||
// window status.
|
||||
if (is_key && is_content_first_responder) {
|
||||
@@ -1660,17 +1671,20 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
@@ -1655,17 +1666,20 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens(
|
||||
const std::vector<uint8_t>& window_token,
|
||||
const std::vector<uint8_t>& view_token) {
|
||||
@@ -2486,7 +2486,7 @@ index 56caa43bcaaa536c66aa5734ec07cf95f99a95b3..96678f5de2a0b67cd338012fb84b9ea7
|
||||
*pid = getpid();
|
||||
id element_id = GetNativeViewAccessible();
|
||||
|
||||
@@ -1683,6 +1697,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
@@ -1678,6 +1692,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
||||
}
|
||||
|
||||
*token = ui::RemoteAccessibility::GetTokenForLocalElement(element_id);
|
||||
|
||||
@@ -133,7 +133,7 @@ index 9bf238e64af483294ae3c3f18a4e9aed49a8658d..b9b2a4c8c387b8e8b4eb1f02fc0f891c
|
||||
const GURL& document_url,
|
||||
const WeakDocumentPtr& weak_document_ptr,
|
||||
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
|
||||
index ffa9cb9f1b001786f4315464a99cafcb666b7a4f..73e7132a5fcbfee56bfc0d1caad173ded4525453 100644
|
||||
index 99ced941ed095fdb2b6c3c5599733ac1f3ec73c0..c56d8ce7b8d346357ad9f8293b252eaae0c8655d 100644
|
||||
--- a/content/browser/renderer_host/render_process_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_process_host_impl.cc
|
||||
@@ -2376,7 +2376,7 @@ void RenderProcessHostImpl::CreateNotificationService(
|
||||
|
||||
@@ -30,10 +30,10 @@ index 727b73a37a3258aa44643d66dceba79017d9dbc8..b3d872be603b68bb7aa2af267f05212a
|
||||
|
||||
return ContentSettingsType::DEFAULT;
|
||||
diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc
|
||||
index a75a65bed13d548494ad9a646e447002ef8b4ad4..a425f011524f1e4a9d43400c2f9251c925312fe9 100644
|
||||
index d278eae0806c1d51e949c7026fa01f01494c8dd3..6e663bb95de59ddc06064a9bf26e6e58828c1a7f 100644
|
||||
--- a/content/browser/permissions/permission_controller_impl.cc
|
||||
+++ b/content/browser/permissions/permission_controller_impl.cc
|
||||
@@ -98,9 +98,15 @@ PermissionToSchedulingFeature(PermissionType permission_name) {
|
||||
@@ -97,9 +97,15 @@ PermissionToSchedulingFeature(PermissionType permission_name) {
|
||||
case PermissionType::LOCAL_NETWORK_ACCESS:
|
||||
case PermissionType::LOCAL_NETWORK:
|
||||
case PermissionType::LOOPBACK_NETWORK:
|
||||
|
||||
@@ -8,7 +8,7 @@ respond to the first mouse click in their window, which is desirable for some
|
||||
kinds of utility windows. Similarly for `disableAutoHideCursor`.
|
||||
|
||||
diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
||||
index d21256326ab6b031545a032809c21fbe9251317c..26e72978755365e99feef34c4210b35e0a1d0790 100644
|
||||
index 971e2bf13b1afc456484556004b066cc55111617..2f1fcace77c403c0e136ae2fc40633cccccce038 100644
|
||||
--- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
||||
+++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
||||
@@ -179,6 +179,15 @@ void ExtractUnderlines(NSAttributedString* string,
|
||||
@@ -47,7 +47,7 @@ index d21256326ab6b031545a032809c21fbe9251317c..26e72978755365e99feef34c4210b35e
|
||||
if (view == self)
|
||||
hitSelf = YES;
|
||||
if ([view isKindOfClass:[self class]] && ![view isEqual:self] &&
|
||||
@@ -1337,6 +1352,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv {
|
||||
@@ -1313,6 +1328,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv {
|
||||
eventType == NSEventTypeKeyDown &&
|
||||
!(modifierFlags & NSEventModifierFlagCommand);
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't
|
||||
necessary.
|
||||
|
||||
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json
|
||||
index 96c9e029764cc6605e1ca129233daf471d2b8f52..e386cb32cd1234100f58506aabd0adcb903b7bb9 100644
|
||||
index 7f5e80f63cea16d9c75237ebeb198e1cdba6e595..d3a292eb0200ae2e0b517d1549ba945475afae61 100644
|
||||
--- a/testing/variations/fieldtrial_testing_config.json
|
||||
+++ b/testing/variations/fieldtrial_testing_config.json
|
||||
@@ -21956,6 +21956,21 @@
|
||||
@@ -21997,6 +21997,21 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -22,7 +22,7 @@ However, the patch would need to be reviewed by the security team, as it
|
||||
does touch a security-sensitive class.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
|
||||
index 73e7132a5fcbfee56bfc0d1caad173ded4525453..dbc16dba57f72d40575eacf63558888296a518af 100644
|
||||
index c56d8ce7b8d346357ad9f8293b252eaae0c8655d..a5826fd8d3ae43d0fcd3190f28ecb20ceeade474 100644
|
||||
--- a/content/browser/renderer_host/render_process_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_process_host_impl.cc
|
||||
@@ -1956,6 +1956,10 @@ bool RenderProcessHostImpl::Init() {
|
||||
|
||||
@@ -15,10 +15,10 @@ Note that we also need to manually update embedder's
|
||||
`api::WebContents::IsFullscreenForTabOrPending` value.
|
||||
|
||||
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
index bb1442bcf2575bfd754469748d8322bb7ed76b17..4b315dcc125506ee43083e8d148ca75be4e46ab2 100644
|
||||
index 43d64ce77ce86b961bbfd0e0e661577dae0708ca..de6a1722a3dd3879549822893624dd5c4b8e33f6 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -9190,6 +9190,17 @@ void RenderFrameHostImpl::EnterFullscreen(
|
||||
@@ -9189,6 +9189,17 @@ void RenderFrameHostImpl::EnterFullscreen(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "shell/browser/api/electron_api_notification.h"
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/uuid.h"
|
||||
#include "build/build_config.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
@@ -13,10 +14,12 @@
|
||||
#include "shell/browser/browser.h"
|
||||
#include "shell/browser/electron_browser_client.h"
|
||||
#include "shell/common/gin_converters/image_converter.h"
|
||||
#include "shell/common/gin_converters/value_converter.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/gin_helper/error_thrower.h"
|
||||
#include "shell/common/gin_helper/handle.h"
|
||||
#include "shell/common/gin_helper/object_template_builder.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
@@ -72,27 +75,29 @@ Notification::Notification(gin::Arguments* args) {
|
||||
presenter_ = static_cast<ElectronBrowserClient*>(ElectronBrowserClient::Get())
|
||||
->GetNotificationPresenter();
|
||||
|
||||
gin::Dictionary opts(nullptr);
|
||||
if (args->GetNext(&opts)) {
|
||||
opts.Get("id", &id_);
|
||||
opts.Get("groupId", &group_id_);
|
||||
opts.Get("title", &title_);
|
||||
opts.Get("subtitle", &subtitle_);
|
||||
opts.Get("body", &body_);
|
||||
opts.Get("icon", &icon_);
|
||||
opts.Get("silent", &silent_);
|
||||
opts.Get("replyPlaceholder", &reply_placeholder_);
|
||||
opts.Get("urgency", &urgency_);
|
||||
opts.Get("hasReply", &has_reply_);
|
||||
opts.Get("timeoutType", &timeout_type_);
|
||||
opts.Get("actions", &actions_);
|
||||
opts.Get("sound", &sound_);
|
||||
opts.Get("closeButtonText", &close_button_text_);
|
||||
opts.Get("toastXml", &toast_xml_);
|
||||
}
|
||||
if (args) {
|
||||
gin::Dictionary opts(nullptr);
|
||||
if (args->GetNext(&opts)) {
|
||||
opts.Get("id", &id_);
|
||||
opts.Get("groupId", &group_id_);
|
||||
opts.Get("title", &title_);
|
||||
opts.Get("subtitle", &subtitle_);
|
||||
opts.Get("body", &body_);
|
||||
opts.Get("icon", &icon_);
|
||||
opts.Get("silent", &silent_);
|
||||
opts.Get("replyPlaceholder", &reply_placeholder_);
|
||||
opts.Get("urgency", &urgency_);
|
||||
opts.Get("hasReply", &has_reply_);
|
||||
opts.Get("timeoutType", &timeout_type_);
|
||||
opts.Get("actions", &actions_);
|
||||
opts.Get("sound", &sound_);
|
||||
opts.Get("closeButtonText", &close_button_text_);
|
||||
opts.Get("toastXml", &toast_xml_);
|
||||
}
|
||||
|
||||
if (id_.empty())
|
||||
id_ = base::Uuid::GenerateRandomV4().AsLowercaseString();
|
||||
if (id_.empty())
|
||||
id_ = base::Uuid::GenerateRandomV4().AsLowercaseString();
|
||||
}
|
||||
}
|
||||
|
||||
Notification::~Notification() {
|
||||
@@ -342,6 +347,115 @@ void Notification::HandleActivation(v8::Isolate* isolate,
|
||||
}
|
||||
#endif
|
||||
|
||||
// static
|
||||
v8::Local<v8::Promise> Notification::GetHistory(v8::Isolate* isolate) {
|
||||
gin_helper::Promise<v8::Local<v8::Value>> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
auto* presenter =
|
||||
static_cast<ElectronBrowserClient*>(ElectronBrowserClient::Get())
|
||||
->GetNotificationPresenter();
|
||||
if (!presenter) {
|
||||
promise.Resolve(v8::Array::New(isolate));
|
||||
return handle;
|
||||
}
|
||||
|
||||
presenter->GetDeliveredNotifications(base::BindOnce(
|
||||
[](gin_helper::Promise<v8::Local<v8::Value>> promise,
|
||||
electron::NotificationPresenter* presenter,
|
||||
std::vector<electron::NotificationInfo> notifications) {
|
||||
v8::Isolate* isolate = promise.isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Array> result =
|
||||
v8::Array::New(isolate, notifications.size());
|
||||
for (size_t i = 0; i < notifications.size(); i++) {
|
||||
const auto& info = notifications[i];
|
||||
|
||||
// Create a live Notification object for each delivered notification.
|
||||
auto* notif = new Notification(/*args=*/nullptr);
|
||||
notif->id_ = info.id;
|
||||
notif->group_id_ = info.group_id;
|
||||
notif->title_ = base::UTF8ToUTF16(info.title);
|
||||
notif->subtitle_ = base::UTF8ToUTF16(info.subtitle);
|
||||
notif->body_ = base::UTF8ToUTF16(info.body);
|
||||
|
||||
// Register with the presenter so click/reply events route here.
|
||||
if (presenter) {
|
||||
notif->notification_ =
|
||||
presenter->CreateNotification(notif, notif->id_);
|
||||
if (notif->notification_)
|
||||
notif->notification_->Restore();
|
||||
}
|
||||
|
||||
auto handle = gin_helper::CreateHandle(isolate, notif);
|
||||
result
|
||||
->Set(isolate->GetCurrentContext(), static_cast<uint32_t>(i),
|
||||
handle.ToV8())
|
||||
.Check();
|
||||
}
|
||||
|
||||
promise.Resolve(result.As<v8::Value>());
|
||||
},
|
||||
std::move(promise), presenter));
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
// static
|
||||
void Notification::Remove(gin::Arguments* args) {
|
||||
auto* presenter =
|
||||
static_cast<ElectronBrowserClient*>(ElectronBrowserClient::Get())
|
||||
->GetNotificationPresenter();
|
||||
if (!presenter)
|
||||
return;
|
||||
|
||||
// Accept either a single string or an array of strings.
|
||||
// Peek at the value type first to avoid gin::Arguments cursor issues.
|
||||
v8::Local<v8::Value> val;
|
||||
if (!args->GetNext(&val)) {
|
||||
args->ThrowTypeError("Expected a string or array of strings");
|
||||
return;
|
||||
}
|
||||
|
||||
if (val->IsString()) {
|
||||
std::string id;
|
||||
gin::ConvertFromV8(args->isolate(), val, &id);
|
||||
presenter->RemoveDeliveredNotifications({id});
|
||||
} else if (val->IsArray()) {
|
||||
std::vector<std::string> ids;
|
||||
if (!gin::ConvertFromV8(args->isolate(), val, &ids)) {
|
||||
args->ThrowTypeError("Expected a string or array of strings");
|
||||
return;
|
||||
}
|
||||
presenter->RemoveDeliveredNotifications(ids);
|
||||
} else {
|
||||
args->ThrowTypeError("Expected a string or array of strings");
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void Notification::RemoveAll() {
|
||||
auto* presenter =
|
||||
static_cast<ElectronBrowserClient*>(ElectronBrowserClient::Get())
|
||||
->GetNotificationPresenter();
|
||||
if (!presenter)
|
||||
return;
|
||||
|
||||
presenter->RemoveAllDeliveredNotifications();
|
||||
}
|
||||
|
||||
// static
|
||||
void Notification::RemoveGroup(const std::string& group_id) {
|
||||
auto* presenter =
|
||||
static_cast<ElectronBrowserClient*>(ElectronBrowserClient::Get())
|
||||
->GetNotificationPresenter();
|
||||
if (!presenter)
|
||||
return;
|
||||
|
||||
presenter->RemoveDeliveredNotificationsByGroupId(group_id);
|
||||
}
|
||||
|
||||
void Notification::FillObjectTemplate(v8::Isolate* isolate,
|
||||
v8::Local<v8::ObjectTemplate> templ) {
|
||||
gin::ObjectTemplateBuilder(isolate, GetClassName(), templ)
|
||||
@@ -395,6 +509,10 @@ void Initialize(v8::Local<v8::Object> exports,
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
dict.SetMethod("handleActivation", &Notification::HandleActivation);
|
||||
#endif
|
||||
dict.SetMethod("getHistory", &Notification::GetHistory);
|
||||
dict.SetMethod("remove", &Notification::Remove);
|
||||
dict.SetMethod("removeAll", &Notification::RemoveAll);
|
||||
dict.SetMethod("removeGroup", &Notification::RemoveGroup);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -38,6 +38,10 @@ class Notification final : public gin_helper::DeprecatedWrappable<Notification>,
|
||||
public NotificationDelegate {
|
||||
public:
|
||||
static bool IsSupported();
|
||||
static v8::Local<v8::Promise> GetHistory(v8::Isolate* isolate);
|
||||
static void Remove(gin::Arguments* args);
|
||||
static void RemoveAll();
|
||||
static void RemoveGroup(const std::string& group_id);
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Register a callback to handle all notification activations.
|
||||
|
||||
@@ -242,7 +242,7 @@ v8::Local<v8::Promise> ServiceWorkerContext::StartWorkerForScope(
|
||||
void ServiceWorkerContext::DidStartWorkerForScope(
|
||||
std::shared_ptr<gin_helper::Promise<v8::Local<v8::Value>>> shared_promise,
|
||||
int64_t version_id,
|
||||
content::ChildProcessId process_id,
|
||||
int process_id,
|
||||
int thread_id,
|
||||
const blink::ServiceWorkerToken& token) {
|
||||
v8::Isolate* isolate = shared_promise->isolate();
|
||||
|
||||
@@ -55,7 +55,7 @@ class ServiceWorkerContext final
|
||||
void DidStartWorkerForScope(
|
||||
std::shared_ptr<gin_helper::Promise<v8::Local<v8::Value>>> shared_promise,
|
||||
int64_t version_id,
|
||||
content::ChildProcessId process_id,
|
||||
int process_id,
|
||||
int thread_id,
|
||||
const blink::ServiceWorkerToken& token);
|
||||
void DidFailToStartWorkerForScope(
|
||||
|
||||
@@ -45,8 +45,6 @@
|
||||
#include "ui/gl/gpu_switching_manager.h"
|
||||
#include "ui/views/background.h"
|
||||
#include "ui/views/cocoa/native_widget_mac_ns_window_host.h"
|
||||
#include "ui/views/view_targeter.h"
|
||||
#include "ui/views/view_targeter_delegate.h"
|
||||
#include "ui/views/widget/widget.h"
|
||||
#include "ui/views/window/native_frame_view_mac.h"
|
||||
|
||||
@@ -114,43 +112,6 @@ struct Converter<electron::NativeWindowMac::VisualEffectState> {
|
||||
|
||||
} // namespace gin
|
||||
|
||||
namespace {
|
||||
|
||||
// A ViewTargeterDelegate installed on content_view_ to make it event-
|
||||
// transparent when no children cover the target point.
|
||||
//
|
||||
// In BrowserWindow, the WebContentsView is added as a sibling of content_view_
|
||||
// at a lower Z-order (behind it) so that user-added child views paint above
|
||||
// the web content. However, views::ViewTargeterDelegate::TargetForRect
|
||||
// iterates children front-to-back and returns the first child whose
|
||||
// HitTestRect() is true. content_view_ covers the full window area, so the
|
||||
// WebContentsView (and its NativeViewHost) is never reached.
|
||||
//
|
||||
// Chromium's BridgedContentView::hitTest: uses GetHitTestResult() to classify
|
||||
// the result: NativeViewHost → kSubView (routes to RenderWidgetHostViewCocoa);
|
||||
// anything else non-null → kRootView (BridgedContentView absorbs the event,
|
||||
// breaking all web content interaction with loadURL); null → kOther (falls
|
||||
// through to [super hitTest:] which finds RenderWidgetHostViewCocoa directly).
|
||||
//
|
||||
// By returning nullptr instead of root when no children cover the target rect,
|
||||
// GetEventHandlerForPoint propagates null up the chain → GetHitTestResult
|
||||
// returns kOther → hitTest: falls through to [super hitTest:] → NSView walk
|
||||
// finds RenderWidgetHostViewCocoa → web content interaction works correctly.
|
||||
class ContentViewTargeterDelegate : public views::ViewTargeterDelegate {
|
||||
public:
|
||||
views::View* TargetForRect(views::View* root,
|
||||
const gfx::Rect& rect) override {
|
||||
views::View* result =
|
||||
views::ViewTargeterDelegate::TargetForRect(root, rect);
|
||||
// The default TargetForRect returns |root| when no children cover |rect|.
|
||||
// Return nullptr instead so event routing falls through to the sibling
|
||||
// WebContentsView and finds RenderWidgetHostViewCocoa.
|
||||
return result == root ? nullptr : result;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace electron {
|
||||
|
||||
NativeWindowMac::~NativeWindowMac() = default;
|
||||
@@ -354,7 +315,7 @@ NativeWindowMac::NativeWindowMac(const int32_t base_window_id,
|
||||
// by calls to other APIs.
|
||||
SetMaximizable(maximizable);
|
||||
|
||||
// Default content view (replaced by BaseWindow::SetContentView).
|
||||
// Default content view.
|
||||
SetContentView(new views::View());
|
||||
AddContentViewLayers();
|
||||
|
||||
@@ -368,17 +329,6 @@ void NativeWindowMac::SetContentView(views::View* view) {
|
||||
root_view->RemoveChildView(content_view());
|
||||
|
||||
set_content_view(view);
|
||||
|
||||
// Install event-transparent targeting on content_view_. In BrowserWindow,
|
||||
// content_view_ sits in front of the sibling WebContentsView (higher Z-order)
|
||||
// so user-added child views paint above web content. This targeter makes
|
||||
// content_view_ event-transparent when no children cover the target point,
|
||||
// returning nullptr instead of itself so GetHitTestResult produces kOther
|
||||
// and BridgedContentView::hitTest: falls through to [super hitTest:] which
|
||||
// finds RenderWidgetHostViewCocoa for web content mouse events.
|
||||
view->SetEventTargeter(std::make_unique<views::ViewTargeter>(
|
||||
std::make_unique<ContentViewTargeterDelegate>()));
|
||||
|
||||
root_view->AddChildViewRaw(content_view());
|
||||
|
||||
root_view->DeprecatedLayoutImmediately();
|
||||
|
||||
@@ -24,6 +24,7 @@ class CocoaNotification : public Notification {
|
||||
// Notification:
|
||||
void Show(const NotificationOptions& options) override;
|
||||
void Dismiss() override;
|
||||
void Restore() override;
|
||||
|
||||
void NotificationDisplayed();
|
||||
void NotificationReplied(const std::string& reply);
|
||||
@@ -38,6 +39,7 @@ class CocoaNotification : public Notification {
|
||||
void LogAction(const char* action);
|
||||
void ScheduleNotification(UNMutableNotificationContent* content);
|
||||
|
||||
bool is_restored_ = false;
|
||||
UNNotificationRequest* __strong notification_request_;
|
||||
};
|
||||
|
||||
|
||||
@@ -31,7 +31,10 @@ CocoaNotification::CocoaNotification(NotificationDelegate* delegate,
|
||||
: Notification(delegate, presenter) {}
|
||||
|
||||
CocoaNotification::~CocoaNotification() {
|
||||
if (notification_request_)
|
||||
// Don't remove from Notification Center if this was a restored notification.
|
||||
// Restored notifications are observed, not owned — destruction should just
|
||||
// disconnect the event handler, not remove the visible notification.
|
||||
if (notification_request_ && !is_restored_)
|
||||
[[UNUserNotificationCenter currentNotificationCenter]
|
||||
removeDeliveredNotificationsWithIdentifiers:@[
|
||||
notification_request_.identifier
|
||||
@@ -233,6 +236,24 @@ void CocoaNotification::ScheduleNotification(
|
||||
}];
|
||||
}
|
||||
|
||||
void CocoaNotification::Restore() {
|
||||
// Create a minimal UNNotificationRequest with just the identifier so that
|
||||
// GetNotification() can match this object when the user interacts with the
|
||||
// notification in Notification Center.
|
||||
NSString* identifier = base::SysUTF8ToNSString(notification_id());
|
||||
UNMutableNotificationContent* content =
|
||||
[[UNMutableNotificationContent alloc] init];
|
||||
notification_request_ =
|
||||
[UNNotificationRequest requestWithIdentifier:identifier
|
||||
content:content
|
||||
trigger:nil];
|
||||
is_restored_ = true;
|
||||
|
||||
if (electron::debug_notifications) {
|
||||
LOG(INFO) << "Notification restored (" << [identifier UTF8String] << ")";
|
||||
}
|
||||
}
|
||||
|
||||
void CocoaNotification::Dismiss() {
|
||||
if (notification_request_)
|
||||
[[UNUserNotificationCenter currentNotificationCenter]
|
||||
|
||||
@@ -24,6 +24,15 @@ class NotificationPresenterMac : public NotificationPresenter {
|
||||
NotificationPresenterMac();
|
||||
~NotificationPresenterMac() override;
|
||||
|
||||
// NotificationPresenter
|
||||
void GetDeliveredNotifications(
|
||||
GetDeliveredNotificationsCallback callback) override;
|
||||
void RemoveDeliveredNotifications(
|
||||
const std::vector<std::string>& identifiers) override;
|
||||
void RemoveAllDeliveredNotifications() override;
|
||||
void RemoveDeliveredNotificationsByGroupId(
|
||||
const std::string& group_id) override;
|
||||
|
||||
NotificationImageRetainer* image_retainer() { return image_retainer_.get(); }
|
||||
scoped_refptr<base::SequencedTaskRunner> image_task_runner() {
|
||||
return image_task_runner_;
|
||||
|
||||
@@ -2,11 +2,16 @@
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/task/thread_pool.h"
|
||||
|
||||
#include "shell/browser/notifications/mac/notification_presenter_mac.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "shell/browser/notifications/mac/cocoa_notification.h"
|
||||
#include "shell/browser/notifications/mac/notification_center_delegate.h"
|
||||
|
||||
@@ -80,4 +85,72 @@ Notification* NotificationPresenterMac::CreateNotificationObject(
|
||||
return new CocoaNotification(delegate, this);
|
||||
}
|
||||
|
||||
void NotificationPresenterMac::GetDeliveredNotifications(
|
||||
GetDeliveredNotificationsCallback callback) {
|
||||
scoped_refptr<base::SequencedTaskRunner> task_runner =
|
||||
base::SequencedTaskRunner::GetCurrentDefault();
|
||||
|
||||
__block GetDeliveredNotificationsCallback block_callback =
|
||||
std::move(callback);
|
||||
|
||||
[[UNUserNotificationCenter currentNotificationCenter]
|
||||
getDeliveredNotificationsWithCompletionHandler:^(
|
||||
NSArray<UNNotification*>* _Nonnull notifications) {
|
||||
std::vector<NotificationInfo> results;
|
||||
results.reserve([notifications count]);
|
||||
|
||||
for (UNNotification* notification in notifications) {
|
||||
UNNotificationContent* content = notification.request.content;
|
||||
NotificationInfo info;
|
||||
info.id = base::SysNSStringToUTF8(notification.request.identifier);
|
||||
info.title = base::SysNSStringToUTF8(content.title);
|
||||
info.subtitle = base::SysNSStringToUTF8(content.subtitle);
|
||||
info.body = base::SysNSStringToUTF8(content.body);
|
||||
info.group_id = base::SysNSStringToUTF8(content.threadIdentifier);
|
||||
results.push_back(std::move(info));
|
||||
}
|
||||
|
||||
task_runner->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(std::move(block_callback), std::move(results)));
|
||||
}];
|
||||
}
|
||||
|
||||
void NotificationPresenterMac::RemoveDeliveredNotifications(
|
||||
const std::vector<std::string>& identifiers) {
|
||||
NSMutableArray* ns_identifiers =
|
||||
[NSMutableArray arrayWithCapacity:identifiers.size()];
|
||||
for (const auto& id : identifiers) {
|
||||
[ns_identifiers addObject:base::SysUTF8ToNSString(id)];
|
||||
}
|
||||
[[UNUserNotificationCenter currentNotificationCenter]
|
||||
removeDeliveredNotificationsWithIdentifiers:ns_identifiers];
|
||||
}
|
||||
|
||||
void NotificationPresenterMac::RemoveAllDeliveredNotifications() {
|
||||
[[UNUserNotificationCenter currentNotificationCenter]
|
||||
removeAllDeliveredNotifications];
|
||||
}
|
||||
|
||||
void NotificationPresenterMac::RemoveDeliveredNotificationsByGroupId(
|
||||
const std::string& group_id) {
|
||||
NSString* target_group = base::SysUTF8ToNSString(group_id);
|
||||
UNUserNotificationCenter* center =
|
||||
[UNUserNotificationCenter currentNotificationCenter];
|
||||
|
||||
[center getDeliveredNotificationsWithCompletionHandler:^(
|
||||
NSArray<UNNotification*>* _Nonnull notifications) {
|
||||
NSMutableArray* matching_ids = [NSMutableArray array];
|
||||
for (UNNotification* notification in notifications) {
|
||||
if ([notification.request.content.threadIdentifier
|
||||
isEqualToString:target_group]) {
|
||||
[matching_ids addObject:notification.request.identifier];
|
||||
}
|
||||
}
|
||||
if (matching_ids.count > 0) {
|
||||
[center removeDeliveredNotificationsWithIdentifiers:matching_ids];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
||||
@@ -22,6 +22,15 @@ NotificationOptions& NotificationOptions::operator=(NotificationOptions&&) =
|
||||
default;
|
||||
NotificationOptions::~NotificationOptions() = default;
|
||||
|
||||
NotificationInfo::NotificationInfo() = default;
|
||||
NotificationInfo::~NotificationInfo() = default;
|
||||
NotificationInfo::NotificationInfo(const NotificationInfo&) = default;
|
||||
NotificationInfo& NotificationInfo::operator=(const NotificationInfo&) =
|
||||
default;
|
||||
NotificationInfo::NotificationInfo(NotificationInfo&&) noexcept = default;
|
||||
NotificationInfo& NotificationInfo::operator=(NotificationInfo&&) noexcept =
|
||||
default;
|
||||
|
||||
NotificationAction::NotificationAction() = default;
|
||||
NotificationAction::~NotificationAction() = default;
|
||||
NotificationAction::NotificationAction(const NotificationAction&) = default;
|
||||
|
||||
@@ -59,6 +59,21 @@ struct NotificationOptions {
|
||||
~NotificationOptions();
|
||||
};
|
||||
|
||||
struct NotificationInfo {
|
||||
std::string id;
|
||||
std::string title;
|
||||
std::string subtitle;
|
||||
std::string body;
|
||||
std::string group_id;
|
||||
|
||||
NotificationInfo();
|
||||
~NotificationInfo();
|
||||
NotificationInfo(const NotificationInfo&);
|
||||
NotificationInfo& operator=(const NotificationInfo&);
|
||||
NotificationInfo(NotificationInfo&&) noexcept;
|
||||
NotificationInfo& operator=(NotificationInfo&&) noexcept;
|
||||
};
|
||||
|
||||
class Notification {
|
||||
public:
|
||||
virtual ~Notification();
|
||||
@@ -75,6 +90,11 @@ class Notification {
|
||||
// as can happen on some platforms including Windows.
|
||||
virtual void Remove() {}
|
||||
|
||||
// Restores a previously delivered notification for event handling without
|
||||
// re-showing it. Sets up platform state so interaction events (click, reply,
|
||||
// etc.) route to this object.
|
||||
virtual void Restore() {}
|
||||
|
||||
// Should be called by derived classes.
|
||||
void NotificationClicked();
|
||||
void NotificationDismissed(bool should_destroy = true,
|
||||
|
||||
@@ -44,4 +44,24 @@ void NotificationPresenter::CloseNotificationWithId(
|
||||
}
|
||||
}
|
||||
|
||||
void NotificationPresenter::GetDeliveredNotifications(
|
||||
GetDeliveredNotificationsCallback callback) {
|
||||
// Default: return empty list. Overridden on macOS.
|
||||
std::move(callback).Run({});
|
||||
}
|
||||
|
||||
void NotificationPresenter::RemoveDeliveredNotifications(
|
||||
const std::vector<std::string>& identifiers) {
|
||||
// Default: no-op. Overridden on macOS.
|
||||
}
|
||||
|
||||
void NotificationPresenter::RemoveAllDeliveredNotifications() {
|
||||
// Default: no-op. Overridden on macOS.
|
||||
}
|
||||
|
||||
void NotificationPresenter::RemoveDeliveredNotificationsByGroupId(
|
||||
const std::string& group_id) {
|
||||
// Default: no-op. Overridden on macOS.
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
||||
@@ -8,12 +8,14 @@
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "shell/browser/notifications/notification.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
class Notification;
|
||||
class NotificationDelegate;
|
||||
|
||||
class NotificationPresenter {
|
||||
@@ -22,11 +24,22 @@ class NotificationPresenter {
|
||||
|
||||
virtual ~NotificationPresenter();
|
||||
|
||||
using GetDeliveredNotificationsCallback =
|
||||
base::OnceCallback<void(std::vector<NotificationInfo>)>;
|
||||
|
||||
base::WeakPtr<Notification> CreateNotification(
|
||||
NotificationDelegate* delegate,
|
||||
const std::string& notification_id);
|
||||
void CloseNotificationWithId(const std::string& notification_id);
|
||||
|
||||
virtual void GetDeliveredNotifications(
|
||||
GetDeliveredNotificationsCallback callback);
|
||||
virtual void RemoveDeliveredNotifications(
|
||||
const std::vector<std::string>& identifiers);
|
||||
virtual void RemoveAllDeliveredNotifications();
|
||||
virtual void RemoveDeliveredNotificationsByGroupId(
|
||||
const std::string& group_id);
|
||||
|
||||
std::set<Notification*> notifications() const { return notifications_; }
|
||||
|
||||
// disable copy
|
||||
|
||||
@@ -261,4 +261,223 @@ describe('Notification module', () => {
|
||||
});
|
||||
|
||||
// TODO(sethlu): Find way to test init with notification icon?
|
||||
|
||||
describe('static methods', () => {
|
||||
ifit(process.platform === 'darwin')('getHistory returns a promise that resolves to an array', async () => {
|
||||
const result = Notification.getHistory();
|
||||
expect(result).to.be.a('promise');
|
||||
const history = await result;
|
||||
expect(history).to.be.an('array');
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('remove does not throw with a string argument', () => {
|
||||
expect(() => Notification.remove('nonexistent-id')).to.not.throw();
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('remove does not throw with an array argument', () => {
|
||||
expect(() => Notification.remove(['id-1', 'id-2'])).to.not.throw();
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('remove throws with no arguments', () => {
|
||||
expect(() => (Notification.remove as any)()).to.throw(/Expected a string or array of strings/);
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('remove throws with an invalid argument type', () => {
|
||||
expect(() => (Notification.remove as any)(123)).to.throw(/Expected a string or array of strings/);
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('removeAll does not throw', () => {
|
||||
expect(() => Notification.removeAll()).to.not.throw();
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('getHistory returns Notification instances with correct properties', async () => {
|
||||
const n = new Notification({
|
||||
id: 'history-test-id',
|
||||
title: 'history test',
|
||||
subtitle: 'history subtitle',
|
||||
body: 'history body',
|
||||
groupId: 'history-group',
|
||||
silent: true
|
||||
});
|
||||
|
||||
const shown = once(n, 'show');
|
||||
n.show();
|
||||
await shown;
|
||||
|
||||
const history = await Notification.getHistory();
|
||||
// getHistory requires code-signed builds to return results;
|
||||
// skip the content assertions if Notification Center is empty.
|
||||
if (history.length > 0) {
|
||||
const found = history.find((item: any) => item.id === 'history-test-id');
|
||||
expect(found).to.not.be.undefined();
|
||||
expect(found).to.be.an.instanceOf(Notification);
|
||||
expect(found.title).to.equal('history test');
|
||||
expect(found.subtitle).to.equal('history subtitle');
|
||||
expect(found.body).to.equal('history body');
|
||||
expect(found.groupId).to.equal('history-group');
|
||||
}
|
||||
|
||||
n.close();
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('getHistory returned notifications can be shown and closed', async () => {
|
||||
const n = new Notification({
|
||||
id: 'history-show-close',
|
||||
title: 'show close test',
|
||||
body: 'body',
|
||||
silent: true
|
||||
});
|
||||
|
||||
const shown = once(n, 'show');
|
||||
n.show();
|
||||
await shown;
|
||||
|
||||
const history = await Notification.getHistory();
|
||||
if (history.length > 0) {
|
||||
const found = history.find((item: any) => item.id === 'history-show-close');
|
||||
expect(found).to.not.be.undefined();
|
||||
// Calling show() and close() on a restored notification should not throw
|
||||
expect(() => {
|
||||
found.show();
|
||||
found.close();
|
||||
}).to.not.throw();
|
||||
}
|
||||
|
||||
Notification.removeAll();
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('remove removes a notification by id', async () => {
|
||||
const n = new Notification({
|
||||
id: 'remove-test-id',
|
||||
title: 'remove test',
|
||||
body: 'remove body',
|
||||
silent: true
|
||||
});
|
||||
|
||||
const shown = once(n, 'show');
|
||||
n.show();
|
||||
await shown;
|
||||
|
||||
Notification.remove('remove-test-id');
|
||||
|
||||
// Give the notification center a moment to process the removal
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
|
||||
const history = await Notification.getHistory();
|
||||
const found = history.find((item: any) => item.id === 'remove-test-id');
|
||||
expect(found).to.be.undefined();
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('remove accepts an array of ids', async () => {
|
||||
const n1 = new Notification({
|
||||
id: 'remove-array-1',
|
||||
title: 'test 1',
|
||||
body: 'body 1',
|
||||
silent: true
|
||||
});
|
||||
const n2 = new Notification({
|
||||
id: 'remove-array-2',
|
||||
title: 'test 2',
|
||||
body: 'body 2',
|
||||
silent: true
|
||||
});
|
||||
|
||||
const shown1 = once(n1, 'show');
|
||||
n1.show();
|
||||
await shown1;
|
||||
|
||||
const shown2 = once(n2, 'show');
|
||||
n2.show();
|
||||
await shown2;
|
||||
|
||||
Notification.remove(['remove-array-1', 'remove-array-2']);
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
|
||||
const history = await Notification.getHistory();
|
||||
const found1 = history.find((item: any) => item.id === 'remove-array-1');
|
||||
const found2 = history.find((item: any) => item.id === 'remove-array-2');
|
||||
expect(found1).to.be.undefined();
|
||||
expect(found2).to.be.undefined();
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('removeAll removes all notifications', async () => {
|
||||
const n = new Notification({
|
||||
id: 'remove-all-test',
|
||||
title: 'removeAll test',
|
||||
body: 'body',
|
||||
silent: true
|
||||
});
|
||||
|
||||
const shown = once(n, 'show');
|
||||
n.show();
|
||||
await shown;
|
||||
|
||||
Notification.removeAll();
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
|
||||
const history = await Notification.getHistory();
|
||||
const found = history.find((item: any) => item.id === 'remove-all-test');
|
||||
expect(found).to.be.undefined();
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('remove does not throw with an empty array', () => {
|
||||
expect(() => Notification.remove([])).to.not.throw();
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('remove does not throw with an empty string', () => {
|
||||
expect(() => Notification.remove('')).to.not.throw();
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('removeGroup does not throw', () => {
|
||||
expect(() => Notification.removeGroup('nonexistent-group')).to.not.throw();
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('removeGroup removes notifications by groupId', async () => {
|
||||
const n1 = new Notification({
|
||||
id: 'group-keep',
|
||||
title: 'keep',
|
||||
body: 'body',
|
||||
groupId: 'group-a',
|
||||
silent: true
|
||||
});
|
||||
const n2 = new Notification({
|
||||
id: 'group-remove-1',
|
||||
title: 'remove 1',
|
||||
body: 'body',
|
||||
groupId: 'group-b',
|
||||
silent: true
|
||||
});
|
||||
const n3 = new Notification({
|
||||
id: 'group-remove-2',
|
||||
title: 'remove 2',
|
||||
body: 'body',
|
||||
groupId: 'group-b',
|
||||
silent: true
|
||||
});
|
||||
|
||||
for (const n of [n1, n2, n3]) {
|
||||
const shown = once(n, 'show');
|
||||
n.show();
|
||||
await shown;
|
||||
}
|
||||
|
||||
Notification.removeGroup('group-b');
|
||||
|
||||
// Give the notification center a moment to fetch and remove
|
||||
await new Promise(resolve => setTimeout(resolve, 500));
|
||||
|
||||
const history = await Notification.getHistory();
|
||||
// In code-signed builds, group-a notification should remain
|
||||
// while group-b notifications should be gone
|
||||
const foundB1 = history.find((item: any) => item.id === 'group-remove-1');
|
||||
const foundB2 = history.find((item: any) => item.id === 'group-remove-2');
|
||||
expect(foundB1).to.be.undefined();
|
||||
expect(foundB2).to.be.undefined();
|
||||
|
||||
// Clean up
|
||||
Notification.removeAll();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
4
typings/internal-ambient.d.ts
vendored
4
typings/internal-ambient.d.ts
vendored
@@ -118,6 +118,10 @@ declare namespace NodeJS {
|
||||
|
||||
interface NotificationBinding {
|
||||
isSupported(): boolean;
|
||||
getHistory(): Promise<Electron.Notification[]>;
|
||||
remove(id: string | string[]): void;
|
||||
removeAll(): void;
|
||||
removeGroup(groupId: string): void;
|
||||
Notification: typeof Electron.Notification;
|
||||
// Windows-only callback for cold-start notification activation
|
||||
handleActivation?: (callback: (details: ActivationArgumentsInternal) => void) => void;
|
||||
|
||||
Reference in New Issue
Block a user