From 34a9268e97592afcb662f5cc6d5c1b1489549387 Mon Sep 17 00:00:00 2001 From: Keeley Hammond Date: Mon, 30 May 2022 01:28:33 -0700 Subject: [PATCH 01/14] ci: re-enable CalculateNativeWinOcclusion (#34374) --- appveyor.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 540fd50f0df75..25aeea817e440 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -211,10 +211,9 @@ test_script: echo "Skipping tests for $env:GN_CONFIG build" } - cd electron - # CalculateNativeWinOcclusion is disabled due to https://bugs.chromium.org/p/chromium/issues/detail?id=1139022 - - if "%RUN_TESTS%"=="true" ( echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging=file --log-file=%cd%\electron.log --disable-features=CalculateNativeWinOcclusion ) - - if "%RUN_TESTS%"=="true" ( echo Running remote test suite & node script/yarn test -- --trace-uncaught --runners=remote --runTestFilesSeperately --enable-logging=file --log-file=%cd%\electron.log --disable-features=CalculateNativeWinOcclusion ) - - if "%RUN_TESTS%"=="true" ( echo Running native test suite & node script/yarn test -- --trace-uncaught --runners=native --enable-logging=file --log-file=%cd%\electron.log --disable-features=CalculateNativeWinOcclusion ) + - if "%RUN_TESTS%"=="true" ( echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging=file --log-file=%cd%\electron.log ) + - if "%RUN_TESTS%"=="true" ( echo Running remote test suite & node script/yarn test -- --trace-uncaught --runners=remote --runTestFilesSeperately --enable-logging=file --log-file=%cd%\electron.log ) + - if "%RUN_TESTS%"=="true" ( echo Running native test suite & node script/yarn test -- --trace-uncaught --runners=native --enable-logging=file --log-file=%cd%\electron.log ) - cd .. - if "%RUN_TESTS%"=="true" ( echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg ) - echo "About to verify mksnapshot" From fd88908457a986f06e310e80499e4b2775d8ba70 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Mon, 30 May 2022 05:13:48 -0700 Subject: [PATCH 02/14] fix: hide content protected windows during screen capture with `ScreenCaptureKitMac` (#34362) fix: hide content protected windows during screen capture --- patches/chromium/.patches | 1 + ...indows_in_the_current_application_in.patch | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 patches/chromium/feat_filter_out_non-shareable_windows_in_the_current_application_in.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 6dc083326fbdd..547c0b5e6240e 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -110,3 +110,4 @@ introduce_ozoneplatform_electron_can_call_x11_property.patch make_gtk_getlibgtk_public.patch build_disable_print_content_analysis.patch custom_protocols_plzserviceworker.patch +feat_filter_out_non-shareable_windows_in_the_current_application_in.patch diff --git a/patches/chromium/feat_filter_out_non-shareable_windows_in_the_current_application_in.patch b/patches/chromium/feat_filter_out_non-shareable_windows_in_the_current_application_in.patch new file mode 100644 index 0000000000000..c72abdbc38363 --- /dev/null +++ b/patches/chromium/feat_filter_out_non-shareable_windows_in_the_current_application_in.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Samuel Attard +Date: Thu, 26 May 2022 15:38:32 -0700 +Subject: feat: filter out non-shareable windows in the current application in + ScreenCaptureKitDevice + +This patch ensures that windows protected via win.setContentProtection(true) do not appear in full display captures via desktopCapturer. This patch could be upstreamed but as the check is limited to in-process windows it doesn't make a lot of sense for Chromium itself. This patch currently has a limitation that it only function for windows created / protected BEFORE the stream is started. There is theoretical future work we can do via polling / observers to automatically update the SCContentFilter when new windows are made but for now this will solve 99+% of the problem and folks can re-order their logic a bit to get it working for their use cases. + +diff --git a/content/browser/media/capture/screen_capture_kit_device_mac.mm b/content/browser/media/capture/screen_capture_kit_device_mac.mm +index 50a779be2e7d3a95496e2791187a6b56266786eb..5876babb99b5e98b151e13e4091305763a417a9e 100644 +--- a/content/browser/media/capture/screen_capture_kit_device_mac.mm ++++ b/content/browser/media/capture/screen_capture_kit_device_mac.mm +@@ -100,7 +100,15 @@ void OnShareableContentCreated( + case DesktopMediaID::TYPE_SCREEN: + for (SCDisplay* display : [content displays]) { + if (source_.id == [display displayID]) { +- NSArray* exclude_windows = nil; ++ NSArray* exclude_ns_windows = [[[NSApplication sharedApplication] windows] filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSWindow* win, NSDictionary *bindings) { ++ return [win sharingType] == NSWindowSharingNone; ++ }]]; ++ NSArray* exclude_windows = [[content windows] filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(SCWindow* win, NSDictionary *bindings) { ++ for (NSWindow* excluded : exclude_ns_windows) { ++ if ((CGWindowID)[excluded windowNumber] == [win windowID]) return true; ++ } ++ return false; ++ }]]; + filter.reset([[SCContentFilter alloc] + initWithDisplay:display + excludingWindows:exclude_windows]); From 0d69067dee3f05db568820e480f7db3aa8b724aa Mon Sep 17 00:00:00 2001 From: Sudowoodo Release Bot <88427002+sudowoodo-release-bot[bot]@users.noreply.github.com> Date: Mon, 30 May 2022 06:01:33 -0700 Subject: [PATCH 03/14] Bump v21.0.0-nightly.20220530 --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index 6ee6d87b0d7c1..d26213de57bfa 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -21.0.0-nightly.20220527 \ No newline at end of file +21.0.0-nightly.20220530 \ No newline at end of file diff --git a/package.json b/package.json index 5dbc562fc464a..1abee71072b9f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "21.0.0-nightly.20220527", + "version": "21.0.0-nightly.20220530", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index 043e140d9fe9a..41ec4c7402d4c 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 21,0,0,20220527 - PRODUCTVERSION 21,0,0,20220527 + FILEVERSION 21,0,0,20220530 + PRODUCTVERSION 21,0,0,20220530 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From 93b39b92b5078071f870b8e97c31e24c1974a49f Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 31 May 2022 08:21:25 +0200 Subject: [PATCH 04/14] refactor: printToPDF should be headless (#33654) --- BUILD.gn | 2 - chromium_src/BUILD.gn | 2 + docs/api/web-contents.md | 53 ++-- docs/api/webview-tag.md | 30 +-- docs/breaking-changes.md | 55 ++++ lib/browser/api/web-contents.ts | 236 ++++++++--------- patches/chromium/printing.patch | 105 ++------ .../browser/api/electron_api_web_contents.cc | 86 +++++- shell/browser/api/electron_api_web_contents.h | 6 +- .../electron_extensions_api_client.cc | 2 - .../printing/print_preview_message_handler.h | 108 -------- .../printing/print_view_manager_electron.cc | 247 +++++++++++++++++- .../printing/print_view_manager_electron.h | 69 ++++- spec-main/api-web-contents-spec.ts | 19 +- spec/ts-smoke/electron/main.ts | 7 +- spec/webview-spec.js | 14 +- typings/internal-electron.d.ts | 5 + 17 files changed, 640 insertions(+), 406 deletions(-) delete mode 100644 shell/browser/printing/print_preview_message_handler.h diff --git a/BUILD.gn b/BUILD.gn index 107f317be548f..5c5f4d27e01e6 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -667,8 +667,6 @@ source_set("electron_lib") { if (enable_basic_printing) { sources += [ - "shell/browser/printing/print_preview_message_handler.cc", - "shell/browser/printing/print_preview_message_handler.h", "shell/browser/printing/print_view_manager_electron.cc", "shell/browser/printing/print_view_manager_electron.h", "shell/renderer/printing/print_render_frame_helper_delegate.cc", diff --git a/chromium_src/BUILD.gn b/chromium_src/BUILD.gn index 41aad0ed3b942..f5a8939902246 100644 --- a/chromium_src/BUILD.gn +++ b/chromium_src/BUILD.gn @@ -216,6 +216,8 @@ static_library("chrome") { "//chrome/browser/printing/printer_query.h", "//chrome/browser/printing/printing_service.cc", "//chrome/browser/printing/printing_service.h", + "//components/printing/browser/print_to_pdf/pdf_print_utils.cc", + "//components/printing/browser/print_to_pdf/pdf_print_utils.h", ] if (enable_oop_printing) { diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index bdfa225332567..d3f5b82a773fd 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -1428,7 +1428,7 @@ Returns `Promise` - Resolves with a [`PrinterInfo[]`](structures/ * `header` string (optional) - string to be printed as page header. * `footer` string (optional) - string to be printed as page footer. * `pageSize` string | Size (optional) - Specify page size of the printed document. Can be `A3`, - `A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height`. + `A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height` and `width`. * `callback` Function (optional) * `success` boolean - Indicates success of the print call. * `failureReason` string - Error description called back if the print fails. @@ -1459,43 +1459,28 @@ win.webContents.print(options, (success, errorType) => { #### `contents.printToPDF(options)` * `options` Object - * `headerFooter` Record (optional) - the header and footer for the PDF. - * `title` string - The title for the PDF header. - * `url` string - the url for the PDF footer. - * `landscape` boolean (optional) - `true` for landscape, `false` for portrait. - * `marginsType` Integer (optional) - Specifies the type of margins to use. Uses 0 for - default margin, 1 for no margin, and 2 for minimum margin. - * `scaleFactor` number (optional) - The scale factor of the web page. Can range from 0 to 100. - * `pageRanges` Record (optional) - The page range to print. - * `from` number - Index of the first page to print (0-based). - * `to` number - Index of the last page to print (inclusive) (0-based). - * `pageSize` string | Size (optional) - Specify page size of the generated PDF. Can be `A3`, - `A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height` and `width` in microns. - * `printBackground` boolean (optional) - Whether to print CSS backgrounds. - * `printSelectionOnly` boolean (optional) - Whether to print selection only. + * `landscape` boolean (optional) - Paper orientation.`true` for landscape, `false` for portrait. Defaults to false. + * `displayHeaderFooter` boolean (optional) - Whether to display header and footer. Defaults to false. + * `printBackground` boolean (optional) - Whether to print background graphics. Defaults to false. + * `scale` number(optional) - Scale of the webpage rendering. Defaults to 1. + * `pageSize` string | Size (optional) - Specify page size of the generated PDF. Can be `A0`, `A1`, `A2`, `A3`, + `A4`, `A5`, `A6`, `Legal`, `Letter`, `Tabloid`, `Ledger`, or an Object containing `height` and `width` in inches. Defaults to `Letter`. + * `margins` Object (optional) + * `top` number (optional) - Top margin in inches. Defaults to 1cm (~0.4 inches). + * `bottom` number (optional) - Bottom margin in inches. Defaults to 1cm (~0.4 inches). + * `left` number (optional) - Left margin in inches. Defaults to 1cm (~0.4 inches). + * `right` number (optional) - Right margin in inches. Defaults to 1cm (~0.4 inches). + * `pageRanges` string (optional) - Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages. + * `headerTemplate` string (optional) - HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: `date` (formatted print date), `title` (document title), `url` (document location), `pageNumber` (current page number) and `totalPages` (total pages in the document). For example, `` would generate span containing the title. + * `footerTemplate` string (optional) - HTML template for the print footer. Should use the same format as the `headerTemplate`. + * `preferCSSPageSize` boolean (optional) - Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size. Returns `Promise` - Resolves with the generated PDF data. -Prints window's web page as PDF with Chromium's preview printing custom -settings. +Prints the window's web page as PDF. The `landscape` will be ignored if `@page` CSS at-rule is used in the web page. -By default, an empty `options` will be regarded as: - -```javascript -{ - marginsType: 0, - printBackground: false, - printSelectionOnly: false, - landscape: false, - pageSize: 'A4', - scaleFactor: 100 -} -``` - -Use `page-break-before: always;` CSS style to force to print to a new page. - An example of `webContents.printToPDF`: ```javascript @@ -1504,7 +1489,7 @@ const fs = require('fs') const path = require('path') const os = require('os') -const win = new BrowserWindow({ width: 800, height: 600 }) +const win = new BrowserWindow() win.loadURL('http://github.com') win.webContents.on('did-finish-load', () => { @@ -1521,6 +1506,8 @@ win.webContents.on('did-finish-load', () => { }) ``` +See [Page.printToPdf](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF) for more information. + #### `contents.addWorkSpace(path)` * `path` string diff --git a/docs/api/webview-tag.md b/docs/api/webview-tag.md index 865b101168ad6..cc86a05d5be4d 100644 --- a/docs/api/webview-tag.md +++ b/docs/api/webview-tag.md @@ -565,21 +565,21 @@ Prints `webview`'s web page. Same as `webContents.print([options])`. ### `.printToPDF(options)` * `options` Object - * `headerFooter` Record (optional) - the header and footer for the PDF. - * `title` string - The title for the PDF header. - * `url` string - the url for the PDF footer. - * `landscape` boolean (optional) - `true` for landscape, `false` for portrait. - * `marginsType` Integer (optional) - Specifies the type of margins to use. Uses 0 for - default margin, 1 for no margin, and 2 for minimum margin. - and `width` in microns. - * `scaleFactor` number (optional) - The scale factor of the web page. Can range from 0 to 100. - * `pageRanges` Record (optional) - The page range to print. On macOS, only the first range is honored. - * `from` number - Index of the first page to print (0-based). - * `to` number - Index of the last page to print (inclusive) (0-based). - * `pageSize` string | Size (optional) - Specify page size of the generated PDF. Can be `A3`, - `A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height` - * `printBackground` boolean (optional) - Whether to print CSS backgrounds. - * `printSelectionOnly` boolean (optional) - Whether to print selection only. + * `landscape` boolean (optional) - Paper orientation.`true` for landscape, `false` for portrait. Defaults to false. + * `displayHeaderFooter` boolean (optional) - Whether to display header and footer. Defaults to false. + * `printBackground` boolean (optional) - Whether to print background graphics. Defaults to false. + * `scale` number(optional) - Scale of the webpage rendering. Defaults to 1. + * `pageSize` string | Size (optional) - Specify page size of the generated PDF. Can be `A0`, `A1`, `A2`, `A3`, + `A4`, `A5`, `A6`, `Legal`, `Letter`, `Tabloid`, `Ledger`, or an Object containing `height` and `width` in inches. Defaults to `Letter`. + * `margins` Object (optional) + * `top` number (optional) - Top margin in inches. Defaults to 1cm (~0.4 inches). + * `bottom` number (optional) - Bottom margin in inches. Defaults to 1cm (~0.4 inches). + * `left` number (optional) - Left margin in inches. Defaults to 1cm (~0.4 inches). + * `right` number (optional) - Right margin in inches. Defaults to 1cm (~0.4 inches). + * `pageRanges` string (optional) - Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages. + * `headerTemplate` string (optional) - HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: `date` (formatted print date), `title` (document title), `url` (document location), `pageNumber` (current page number) and `totalPages` (total pages in the document). For example, `` would generate span containing the title. + * `footerTemplate` string (optional) - HTML template for the print footer. Should use the same format as the `headerTemplate`. + * `preferCSSPageSize` boolean (optional) - Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size. Returns `Promise` - Resolves with the generated PDF data. diff --git a/docs/breaking-changes.md b/docs/breaking-changes.md index cf0e48d0df670..e0dea89dfd9a2 100644 --- a/docs/breaking-changes.md +++ b/docs/breaking-changes.md @@ -14,6 +14,61 @@ This document uses the following convention to categorize breaking changes: ## Planned Breaking API Changes (20.0) +### API Changed: `webContents.printToPDF()` + +`webContents.printToPDF()` has been modified to conform to [`Page.printToPDF`](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF) in the Chrome DevTools Protocol. This has been changes in order to +address changes upstream that made our previous implementation untenable and rife with bugs. + +**Arguments Changed** + +* `pageRanges` + +**Arguments Removed** + +* `printSelectionOnly` +* `marginsType` +* `headerFooter` +* `scaleFactor` + +**Arguments Added** + +* `headerTemplate` +* `footerTemplate` +* `displayHeaderFooter` +* `margins` +* `scale` +* `preferCSSPageSize` + +```js +// Main process +const { webContents } = require('electron') + +webContents.printToPDF({ + landscape: true, + displayHeaderFooter: true, + printBackground: true, + scale: 2, + pageSize: 'Ledger', + margins: { + top: 2, + bottom: 2, + left: 2, + right: 2 + }, + pageRanges: '1-5, 8, 11-13', + headerTemplate: '

Title

', + footerTemplate: '
', + preferCSSPageSize: true +}).then(data => { + fs.writeFile(pdfPath, data, (error) => { + if (error) throw error + console.log(`Wrote PDF successfully to ${pdfPath}`) + }) +}).catch(error => { + console.log(`Failed to write PDF to ${pdfPath}: `, error) +}) +``` + ### Default Changed: renderers without `nodeIntegration: true` are sandboxed by default Previously, renderers that specified a preload script defaulted to being diff --git a/lib/browser/api/web-contents.ts b/lib/browser/api/web-contents.ts index b2407ee7e0a37..f54b6369a4447 100644 --- a/lib/browser/api/web-contents.ts +++ b/lib/browser/api/web-contents.ts @@ -63,6 +63,20 @@ const PDFPageSizes: Record = { } } as const; +const paperFormats: Record = { + letter: { width: 8.5, height: 11 }, + legal: { width: 8.5, height: 14 }, + tabloid: { width: 11, height: 17 }, + ledger: { width: 17, height: 11 }, + a0: { width: 33.1, height: 46.8 }, + a1: { width: 23.4, height: 33.1 }, + a2: { width: 16.54, height: 23.4 }, + a3: { width: 11.7, height: 16.54 }, + a4: { width: 8.27, height: 11.7 }, + a5: { width: 5.83, height: 8.27 }, + a6: { width: 4.13, height: 5.83 } +} as const; + // The minimum micron size Chromium accepts is that where: // Per printing/units.h: // * kMicronsPerInch - Length of an inch in 0.001mm unit. @@ -76,42 +90,6 @@ const isValidCustomPageSize = (width: number, height: number) => { return [width, height].every(x => x > 352); }; -// Default printing setting -const defaultPrintingSetting = { - // Customizable. - pageRange: [] as {from: number, to: number}[], - mediaSize: {} as ElectronInternal.MediaSize, - landscape: false, - headerFooterEnabled: false, - marginsType: 0, - scaleFactor: 100, - shouldPrintBackgrounds: false, - shouldPrintSelectionOnly: false, - // Non-customizable. - printWithCloudPrint: false, - printWithPrivet: false, - printWithExtension: false, - pagesPerSheet: 1, - isFirstRequest: false, - previewUIID: 0, - // True, if the document source is modifiable. e.g. HTML and not PDF. - previewModifiable: true, - printToPDF: true, - deviceName: 'Save as PDF', - generateDraftData: true, - dpiHorizontal: 72, - dpiVertical: 72, - rasterizePDF: false, - duplex: 0, - copies: 1, - // 2 = color - see ColorModel in //printing/print_job_constants.h - color: 2, - collate: true, - printerType: 2, - title: undefined as string | undefined, - url: undefined as string | undefined -} as const; - // JavaScript implementations of WebContents. const binding = process._linkedBinding('electron_browser_web_contents'); const printing = process._linkedBinding('electron_browser_printing'); @@ -193,136 +171,136 @@ WebContents.prototype.executeJavaScriptInIsolatedWorld = async function (worldId let pendingPromise: Promise | undefined; WebContents.prototype.printToPDF = async function (options) { const printSettings: Record = { - ...defaultPrintingSetting, - requestID: getNextId() + requestID: getNextId(), + landscape: false, + displayHeaderFooter: false, + headerTemplate: '', + footerTemplate: '', + printBackground: false, + scale: 1, + paperWidth: 8.5, + paperHeight: 11, + marginTop: 0, + marginBottom: 0, + marginLeft: 0, + marginRight: 0, + pageRanges: '', + preferCSSPageSize: false }; if (options.landscape !== undefined) { if (typeof options.landscape !== 'boolean') { - const error = new Error('landscape must be a Boolean'); - return Promise.reject(error); + return Promise.reject(new Error('landscape must be a Boolean')); } printSettings.landscape = options.landscape; } - if (options.scaleFactor !== undefined) { - if (typeof options.scaleFactor !== 'number') { - const error = new Error('scaleFactor must be a Number'); - return Promise.reject(error); + if (options.displayHeaderFooter !== undefined) { + if (typeof options.displayHeaderFooter !== 'boolean') { + return Promise.reject(new Error('displayHeaderFooter must be a Boolean')); } - printSettings.scaleFactor = options.scaleFactor; + printSettings.displayHeaderFooter = options.displayHeaderFooter; } - if (options.marginsType !== undefined) { - if (typeof options.marginsType !== 'number') { - const error = new Error('marginsType must be a Number'); - return Promise.reject(error); + if (options.printBackground !== undefined) { + if (typeof options.printBackground !== 'boolean') { + return Promise.reject(new Error('printBackground must be a Boolean')); } - printSettings.marginsType = options.marginsType; + printSettings.shouldPrintBackgrounds = options.printBackground; } - if (options.printSelectionOnly !== undefined) { - if (typeof options.printSelectionOnly !== 'boolean') { - const error = new Error('printSelectionOnly must be a Boolean'); - return Promise.reject(error); + if (options.scale !== undefined) { + if (typeof options.scale !== 'number') { + return Promise.reject(new Error('scale must be a Number')); } - printSettings.shouldPrintSelectionOnly = options.printSelectionOnly; + printSettings.scaleFactor = options.scale; } - if (options.printBackground !== undefined) { - if (typeof options.printBackground !== 'boolean') { - const error = new Error('printBackground must be a Boolean'); - return Promise.reject(error); + const { pageSize } = options; + if (pageSize !== undefined) { + if (typeof pageSize === 'string') { + const format = paperFormats[pageSize.toLowerCase()]; + if (!format) { + return Promise.reject(new Error(`Invalid pageSize ${pageSize}`)); + } + + printSettings.paperWidth = format.width; + printSettings.paperHeight = format.height; + } else if (typeof options.pageSize === 'object') { + if (!pageSize.height || !pageSize.width) { + return Promise.reject(new Error('height and width properties are required for pageSize')); + } + + printSettings.paperWidth = pageSize.width; + printSettings.paperHeight = pageSize.height; + } else { + return Promise.reject(new Error('pageSize must be a String or Object')); } - printSettings.shouldPrintBackgrounds = options.printBackground; } - if (options.pageRanges !== undefined) { - const pageRanges = options.pageRanges; - if (!Object.prototype.hasOwnProperty.call(pageRanges, 'from') || !Object.prototype.hasOwnProperty.call(pageRanges, 'to')) { - const error = new Error('pageRanges must be an Object with \'from\' and \'to\' properties'); - return Promise.reject(error); + const { margins } = options; + if (margins !== undefined) { + if (typeof margins !== 'object') { + return Promise.reject(new Error('margins must be an Object')); } - if (typeof pageRanges.from !== 'number') { - const error = new Error('pageRanges.from must be a Number'); - return Promise.reject(error); + if (margins.top !== undefined) { + if (typeof margins.top !== 'number') { + return Promise.reject(new Error('margins.top must be a Number')); + } + printSettings.marginTop = margins.top; } - if (typeof pageRanges.to !== 'number') { - const error = new Error('pageRanges.to must be a Number'); - return Promise.reject(error); + if (margins.bottom !== undefined) { + if (typeof margins.bottom !== 'number') { + return Promise.reject(new Error('margins.bottom must be a Number')); + } + printSettings.marginBottom = margins.bottom; } - // Chromium uses 1-based page ranges, so increment each by 1. - printSettings.pageRange = [{ - from: pageRanges.from + 1, - to: pageRanges.to + 1 - }]; - } - - if (options.headerFooter !== undefined) { - const headerFooter = options.headerFooter; - printSettings.headerFooterEnabled = true; - if (typeof headerFooter === 'object') { - if (!headerFooter.url || !headerFooter.title) { - const error = new Error('url and title properties are required for headerFooter'); - return Promise.reject(error); - } - if (typeof headerFooter.title !== 'string') { - const error = new Error('headerFooter.title must be a String'); - return Promise.reject(error); + if (margins.left !== undefined) { + if (typeof margins.left !== 'number') { + return Promise.reject(new Error('margins.left must be a Number')); } - printSettings.title = headerFooter.title; + printSettings.marginLeft = margins.left; + } - if (typeof headerFooter.url !== 'string') { - const error = new Error('headerFooter.url must be a String'); - return Promise.reject(error); + if (margins.right !== undefined) { + if (typeof margins.right !== 'number') { + return Promise.reject(new Error('margins.right must be a Number')); } - printSettings.url = headerFooter.url; - } else { - const error = new Error('headerFooter must be an Object'); - return Promise.reject(error); + printSettings.marginRight = margins.right; } } - // Optionally set size for PDF. - if (options.pageSize !== undefined) { - const pageSize = options.pageSize; - if (typeof pageSize === 'object') { - if (!pageSize.height || !pageSize.width) { - const error = new Error('height and width properties are required for pageSize'); - return Promise.reject(error); - } + if (options.pageRanges !== undefined) { + if (typeof options.pageRanges !== 'string') { + return Promise.reject(new Error('printBackground must be a String')); + } + printSettings.pageRanges = options.pageRanges; + } - // Dimensions in Microns - 1 meter = 10^6 microns - const height = Math.ceil(pageSize.height); - const width = Math.ceil(pageSize.width); - if (!isValidCustomPageSize(width, height)) { - const error = new Error('height and width properties must be minimum 352 microns.'); - return Promise.reject(error); - } + if (options.headerTemplate !== undefined) { + if (typeof options.headerTemplate !== 'string') { + return Promise.reject(new Error('headerTemplate must be a String')); + } + printSettings.headerTemplate = options.headerTemplate; + } - printSettings.mediaSize = { - name: 'CUSTOM', - custom_display_name: 'Custom', - height_microns: height, - width_microns: width - }; - } else if (Object.prototype.hasOwnProperty.call(PDFPageSizes, pageSize)) { - printSettings.mediaSize = PDFPageSizes[pageSize]; - } else { - const error = new Error(`Unsupported pageSize: ${pageSize}`); - return Promise.reject(error); + if (options.footerTemplate !== undefined) { + if (typeof options.footerTemplate !== 'string') { + return Promise.reject(new Error('footerTemplate must be a String')); } - } else { - printSettings.mediaSize = PDFPageSizes.A4; + printSettings.footerTemplate = options.footerTemplate; + } + + if (options.preferCSSPageSize !== undefined) { + if (typeof options.preferCSSPageSize !== 'boolean') { + return Promise.reject(new Error('footerTemplate must be a String')); + } + printSettings.preferCSSPageSize = options.preferCSSPageSize; } - // Chromium expects this in a 0-100 range number, not as float - printSettings.scaleFactor = Math.ceil(printSettings.scaleFactor) % 100; - // PrinterType enum from //printing/print_job_constants.h - printSettings.printerType = 2; if (this._printToPDF) { if (pendingPromise) { pendingPromise = pendingPromise.then(() => this._printToPDF(printSettings)); diff --git a/patches/chromium/printing.patch b/patches/chromium/printing.patch index 2b9df64a7bf5e..edeed181bef81 100644 --- a/patches/chromium/printing.patch +++ b/patches/chromium/printing.patch @@ -113,31 +113,19 @@ index dd27bbf387718d6abda5080e7d2c609cd0eaff17..8837cf2aeaa2f87d51be8d00aa356c8a void PrintJobWorkerOop::UnregisterServiceManagerClient() { diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc -index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc9c122ae3 100644 +index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..203ca9b0c4bf048016023fc3d260df6588392418 100644 --- a/chrome/browser/printing/print_view_manager_base.cc +++ b/chrome/browser/printing/print_view_manager_base.cc -@@ -30,10 +30,10 @@ +@@ -30,8 +30,6 @@ #include "chrome/browser/printing/print_view_manager_common.h" #include "chrome/browser/printing/printer_query.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/simple_message_box.h" -#include "chrome/browser/ui/webui/print_preview/printer_handler.h" #include "chrome/common/pref_names.h" -+#if 0 #include "chrome/grit/generated_resources.h" -+#endif #include "components/prefs/pref_service.h" - #include "components/printing/browser/print_composite_client.h" - #include "components/printing/browser/print_manager_utils.h" -@@ -48,6 +48,7 @@ - #include "content/public/browser/render_frame_host.h" - #include "content/public/browser/render_process_host.h" - #include "content/public/browser/web_contents.h" -+#include "chrome/grit/generated_resources.h" - #include "mojo/public/cpp/system/buffer.h" - #include "printing/buildflags/buildflags.h" - #include "printing/metafile_skia.h" -@@ -87,6 +88,8 @@ using PrintSettingsCallback = +@@ -87,6 +85,8 @@ using PrintSettingsCallback = base::OnceCallback)>; void ShowWarningMessageBox(const std::u16string& message) { @@ -146,7 +134,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc // Runs always on the UI thread. static bool is_dialog_shown = false; if (is_dialog_shown) -@@ -95,6 +98,7 @@ void ShowWarningMessageBox(const std::u16string& message) { +@@ -95,6 +95,7 @@ void ShowWarningMessageBox(const std::u16string& message) { base::AutoReset auto_reset(&is_dialog_shown, true); chrome::ShowWarningMessageBox(nullptr, std::u16string(), message); @@ -154,7 +142,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc } #if BUILDFLAG(ENABLE_PRINT_PREVIEW) -@@ -192,7 +196,9 @@ void UpdatePrintSettingsReplyOnIO( +@@ -192,7 +193,9 @@ void UpdatePrintSettingsReplyOnIO( DCHECK_CURRENTLY_ON(content::BrowserThread::IO); DCHECK(printer_query); mojom::PrintPagesParamsPtr params = CreateEmptyPrintPagesParamsPtr(); @@ -165,7 +153,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc RenderParamsFromPrintSettings(printer_query->settings(), params->params.get()); params->params->document_cookie = printer_query->cookie(); -@@ -245,6 +251,7 @@ void ScriptedPrintReplyOnIO( +@@ -245,6 +248,7 @@ void ScriptedPrintReplyOnIO( mojom::PrintManagerHost::ScriptedPrintCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); mojom::PrintPagesParamsPtr params = CreateEmptyPrintPagesParamsPtr(); @@ -173,7 +161,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc if (printer_query->last_status() == mojom::ResultCode::kSuccess && printer_query->settings().dpi()) { RenderParamsFromPrintSettings(printer_query->settings(), -@@ -254,8 +261,9 @@ void ScriptedPrintReplyOnIO( +@@ -254,8 +258,9 @@ void ScriptedPrintReplyOnIO( } bool has_valid_cookie = params->params->document_cookie; bool has_dpi = !params->params->dpi.IsEmpty(); @@ -184,7 +172,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc if (has_dpi && has_valid_cookie) { queue->QueuePrinterQuery(std::move(printer_query)); -@@ -293,12 +301,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents) +@@ -293,12 +298,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents) : PrintManager(web_contents), queue_(g_browser_process->print_job_manager()->queue()) { DCHECK(queue_); @@ -199,7 +187,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc } PrintViewManagerBase::~PrintViewManagerBase() { -@@ -306,7 +316,10 @@ PrintViewManagerBase::~PrintViewManagerBase() { +@@ -306,7 +313,10 @@ PrintViewManagerBase::~PrintViewManagerBase() { DisconnectFromCurrentPrintJob(); } @@ -211,7 +199,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc // Remember the ID for `rfh`, to enable checking that the `RenderFrameHost` // is still valid after a possible inner message loop runs in // `DisconnectFromCurrentPrintJob()`. -@@ -332,6 +345,9 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) { +@@ -332,6 +342,9 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) { #endif SetPrintingRFH(rfh); @@ -221,7 +209,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc #if BUILDFLAG(ENABLE_PRINT_CONTENT_ANALYSIS) enterprise_connectors::ContentAnalysisDelegate::Data scanning_data; -@@ -500,7 +516,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply( +@@ -500,7 +513,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply( void PrintViewManagerBase::ScriptedPrintReply( ScriptedPrintCallback callback, int process_id, @@ -231,7 +219,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc DCHECK_CURRENTLY_ON(content::BrowserThread::UI); #if BUILDFLAG(ENABLE_OOP_PRINTING) -@@ -513,16 +530,19 @@ void PrintViewManagerBase::ScriptedPrintReply( +@@ -513,16 +527,19 @@ void PrintViewManagerBase::ScriptedPrintReply( return; } @@ -255,7 +243,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc } void PrintViewManagerBase::NavigationStopped() { -@@ -638,11 +658,14 @@ void PrintViewManagerBase::DidPrintDocument( +@@ -638,11 +655,14 @@ void PrintViewManagerBase::DidPrintDocument( void PrintViewManagerBase::GetDefaultPrintSettings( GetDefaultPrintSettingsCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -270,7 +258,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc #if BUILDFLAG(ENABLE_OOP_PRINTING) if (printing::features::kEnableOopPrintDriversJobPrint.Get() && !service_manager_client_id_.has_value()) { -@@ -672,18 +695,20 @@ void PrintViewManagerBase::UpdatePrintSettings( +@@ -672,18 +692,20 @@ void PrintViewManagerBase::UpdatePrintSettings( base::Value::Dict job_settings, UpdatePrintSettingsCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -292,7 +280,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc content::BrowserContext* context = web_contents() ? web_contents()->GetBrowserContext() : nullptr; PrefService* prefs = -@@ -693,6 +718,7 @@ void PrintViewManagerBase::UpdatePrintSettings( +@@ -693,6 +715,7 @@ void PrintViewManagerBase::UpdatePrintSettings( if (value > 0) job_settings.Set(kSettingRasterizePdfDpi, value); } @@ -300,7 +288,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc auto callback_wrapper = base::BindOnce(&PrintViewManagerBase::UpdatePrintSettingsReply, -@@ -718,14 +744,14 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params, +@@ -718,14 +741,14 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params, // didn't happen for some reason. bad_message::ReceivedBadMessage( render_process_host, bad_message::PVMB_SCRIPTED_PRINT_FENCED_FRAME); @@ -317,7 +305,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc return; } #endif -@@ -763,7 +789,6 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie, +@@ -763,7 +786,6 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie, PrintManager::PrintingFailed(cookie, reason); #if !BUILDFLAG(IS_ANDROID) // Android does not implement this function. @@ -325,7 +313,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc #endif ReleasePrinterQuery(); -@@ -778,6 +803,11 @@ void PrintViewManagerBase::RemoveObserver(Observer& observer) { +@@ -778,6 +800,11 @@ void PrintViewManagerBase::RemoveObserver(Observer& observer) { } void PrintViewManagerBase::ShowInvalidPrinterSettingsError() { @@ -337,7 +325,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&ShowWarningMessageBox, l10n_util::GetStringUTF16( -@@ -788,10 +818,12 @@ void PrintViewManagerBase::RenderFrameHostStateChanged( +@@ -788,10 +815,12 @@ void PrintViewManagerBase::RenderFrameHostStateChanged( content::RenderFrameHost* render_frame_host, content::RenderFrameHost::LifecycleState /*old_state*/, content::RenderFrameHost::LifecycleState new_state) { @@ -350,7 +338,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc } void PrintViewManagerBase::DidStartLoading() { -@@ -851,6 +883,11 @@ void PrintViewManagerBase::OnJobDone() { +@@ -851,6 +880,11 @@ void PrintViewManagerBase::OnJobDone() { ReleasePrintJob(); } @@ -362,7 +350,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc void PrintViewManagerBase::OnFailed() { TerminatePrintJob(true); } -@@ -908,7 +945,10 @@ bool PrintViewManagerBase::CreateNewPrintJob( +@@ -908,7 +942,10 @@ bool PrintViewManagerBase::CreateNewPrintJob( // Disconnect the current |print_job_|. auto weak_this = weak_ptr_factory_.GetWeakPtr(); @@ -374,7 +362,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc if (!weak_this) return false; -@@ -987,6 +1027,13 @@ void PrintViewManagerBase::ReleasePrintJob() { +@@ -987,6 +1024,13 @@ void PrintViewManagerBase::ReleasePrintJob() { UnregisterSystemPrintClient(); #endif @@ -388,7 +376,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc if (!print_job_) return; -@@ -1036,7 +1083,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() { +@@ -1036,7 +1080,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() { } bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) { @@ -397,7 +385,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..973666a1315c8cbba0a2cefbe9195fdc return true; if (!cookie) { -@@ -1144,7 +1191,7 @@ void PrintViewManagerBase::SendPrintingEnabled(bool enabled, +@@ -1144,7 +1188,7 @@ void PrintViewManagerBase::SendPrintingEnabled(bool enabled, } void PrintViewManagerBase::CompletePrintNow(content::RenderFrameHost* rfh) { @@ -491,29 +479,6 @@ index 5f4d6e314b21351e3e5912e3a43ef87774343085..8627c8305686654dca7cd9c26433592e void PrintWithParams(mojom::PrintPagesParamsPtr params) override; void PrintForSystemDialog() override; void SetPrintPreviewUI( -diff --git a/components/printing/browser/print_to_pdf/pdf_print_manager.cc b/components/printing/browser/print_to_pdf/pdf_print_manager.cc -index 82591f8c2abbc1a180ef62f7264a68ca279e9b9c..ad27a15ba3028af1046482192dec789df5dda7b2 100644 ---- a/components/printing/browser/print_to_pdf/pdf_print_manager.cc -+++ b/components/printing/browser/print_to_pdf/pdf_print_manager.cc -@@ -132,7 +132,8 @@ void PdfPrintManager::PrintToPdf( - set_cookie(print_pages_params->params->document_cookie); - callback_ = std::move(callback); - -- GetPrintRenderFrame(rfh)->PrintWithParams(std::move(print_pages_params)); -+ // TODO(electron-maintainers): do something with job_settings here? -+ GetPrintRenderFrame(rfh)->PrintRequestedPages(true/*silent*/, base::Value{}/*job_settings*/); - } - - void PdfPrintManager::GetDefaultPrintSettings( -@@ -147,7 +148,7 @@ void PdfPrintManager::ScriptedPrint( - auto default_param = printing::mojom::PrintPagesParams::New(); - default_param->params = printing::mojom::PrintParams::New(); - DLOG(ERROR) << "Scripted print is not supported"; -- std::move(callback).Run(std::move(default_param)); -+ std::move(callback).Run(std::move(default_param), true/*canceled*/); - } - - void PdfPrintManager::ShowInvalidPrinterSettingsError() { diff --git a/components/printing/common/print.mojom b/components/printing/common/print.mojom index 8e5c441b3d0a2d35fc5c6f9d43b4a4ca167e09ca..2cfcd810c9507c434e673064b63e8fbc95172537 100644 --- a/components/printing/common/print.mojom @@ -537,7 +502,7 @@ index 8e5c441b3d0a2d35fc5c6f9d43b4a4ca167e09ca..2cfcd810c9507c434e673064b63e8fbc // Tells the browser that there are invalid printer settings. ShowInvalidPrinterSettingsError(); diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc -index db8913ae41d46d14fd15c6127e126e4b129dc4b8..ddbc3b0d5a00af9de84e1b0aadc44adb6ff84495 100644 +index db8913ae41d46d14fd15c6127e126e4b129dc4b8..eaddc1bbc59bad9cc885fb8532d4f8c1df2f1a86 100644 --- a/components/printing/renderer/print_render_frame_helper.cc +++ b/components/printing/renderer/print_render_frame_helper.cc @@ -42,6 +42,7 @@ @@ -716,26 +681,6 @@ index db8913ae41d46d14fd15c6127e126e4b129dc4b8..ddbc3b0d5a00af9de84e1b0aadc44adb *output = std::move(input); std::move(quit_closure).Run(); }, -@@ -2725,18 +2756,7 @@ void PrintRenderFrameHelper::RequestPrintPreview(PrintPreviewRequestType type, - } - - bool PrintRenderFrameHelper::CheckForCancel() { -- const mojom::PrintParams& print_params = *print_pages_params_->params; -- bool cancel = false; -- -- if (!GetPrintManagerHost()->CheckForCancel(print_params.preview_ui_id, -- print_params.preview_request_id, -- &cancel)) { -- cancel = true; -- } -- -- if (cancel) -- notify_browser_of_print_failure_ = false; -- return cancel; -+ return false; - } - - bool PrintRenderFrameHelper::PreviewPageRendered( diff --git a/components/printing/renderer/print_render_frame_helper.h b/components/printing/renderer/print_render_frame_helper.h index 220b28a7e63625fe8b76290f0d2f40dd32cae255..cff9e35fab9df680c3c39467c50ddb033c2e6cba 100644 --- a/components/printing/renderer/print_render_frame_helper.h diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index b48a45bb8bcc2..1422083e5d511 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -25,6 +25,7 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/values.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/printing/print_view_manager_base.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/views/eye_dropper/eye_dropper.h" #include "chrome/common/pref_names.h" @@ -165,9 +166,10 @@ #if BUILDFLAG(ENABLE_PRINTING) #include "components/printing/browser/print_manager_utils.h" +#include "components/printing/browser/print_to_pdf/pdf_print_utils.h" #include "printing/backend/print_backend.h" // nogncheck #include "printing/mojom/print.mojom.h" // nogncheck -#include "shell/browser/printing/print_preview_message_handler.h" +#include "printing/page_range.h" #include "shell/browser/printing/print_view_manager_electron.h" #if BUILDFLAG(IS_WIN) @@ -919,10 +921,7 @@ void WebContents::InitWithWebContents( web_contents->SetDelegate(this); #if BUILDFLAG(ENABLE_PRINTING) - PrintPreviewMessageHandler::CreateForWebContents(web_contents.get()); PrintViewManagerElectron::CreateForWebContents(web_contents.get()); - printing::CreateCompositeClientIfNeeded(web_contents.get(), - browser_context->GetUserAgent()); #endif #if BUILDFLAG(ENABLE_PDF_VIEWER) @@ -2807,14 +2806,87 @@ void WebContents::Print(gin::Arguments* args) { std::move(callback), device_name, silent)); } -v8::Local WebContents::PrintToPDF(base::DictionaryValue settings) { +// Partially duplicated and modified from +// headless/lib/browser/protocol/page_handler.cc;l=41 +v8::Local WebContents::PrintToPDF(const base::Value& settings) { v8::Isolate* isolate = JavascriptEnvironment::GetIsolate(); gin_helper::Promise> promise(isolate); v8::Local handle = promise.GetHandle(); - PrintPreviewMessageHandler::FromWebContents(web_contents()) - ->PrintToPDF(std::move(settings), std::move(promise)); + + // This allows us to track headless printing calls. + auto unique_id = settings.GetDict().FindInt(printing::kPreviewRequestID); + auto landscape = settings.GetDict().FindBool("landscape"); + auto display_header_footer = + settings.GetDict().FindBool("displayHeaderFooter"); + auto print_background = settings.GetDict().FindBool("shouldPrintBackgrounds"); + auto scale = settings.GetDict().FindDouble("scale"); + auto paper_width = settings.GetDict().FindInt("paperWidth"); + auto paper_height = settings.GetDict().FindInt("paperHeight"); + auto margin_top = settings.GetDict().FindIntByDottedPath("margins.top"); + auto margin_bottom = settings.GetDict().FindIntByDottedPath("margins.bottom"); + auto margin_left = settings.GetDict().FindIntByDottedPath("margins.left"); + auto margin_right = settings.GetDict().FindIntByDottedPath("margins.right"); + auto page_ranges = *settings.GetDict().FindString("pageRanges"); + auto header_template = *settings.GetDict().FindString("headerTemplate"); + auto footer_template = *settings.GetDict().FindString("footerTemplate"); + auto prefer_css_page_size = settings.GetDict().FindBool("preferCSSPageSize"); + + absl::variant + print_pages_params = print_to_pdf::GetPrintPagesParams( + web_contents()->GetMainFrame()->GetLastCommittedURL(), landscape, + display_header_footer, print_background, scale, paper_width, + paper_height, margin_top, margin_bottom, margin_left, margin_right, + absl::make_optional(header_template), + absl::make_optional(footer_template), prefer_css_page_size); + + if (absl::holds_alternative(print_pages_params)) { + auto error = absl::get(print_pages_params); + promise.RejectWithErrorMessage("Invalid print parameters: " + error); + return handle; + } + + auto* manager = PrintViewManagerElectron::FromWebContents(web_contents()); + if (!manager) { + promise.RejectWithErrorMessage("Failed to find print manager"); + return handle; + } + + auto params = std::move( + absl::get(print_pages_params)); + params->params->document_cookie = unique_id.value_or(0); + + manager->PrintToPdf(web_contents()->GetMainFrame(), page_ranges, + std::move(params), + base::BindOnce(&WebContents::OnPDFCreated, GetWeakPtr(), + std::move(promise))); + return handle; } + +void WebContents::OnPDFCreated( + gin_helper::Promise> promise, + PrintViewManagerElectron::PrintResult print_result, + scoped_refptr data) { + if (print_result != PrintViewManagerElectron::PrintResult::PRINT_SUCCESS) { + promise.RejectWithErrorMessage( + "Failed to generate PDF: " + + PrintViewManagerElectron::PrintResultToString(print_result)); + return; + } + + v8::Isolate* isolate = promise.isolate(); + gin_helper::Locker locker(isolate); + v8::HandleScope handle_scope(isolate); + v8::Context::Scope context_scope( + v8::Local::New(isolate, promise.GetContext())); + + v8::Local buffer = + node::Buffer::Copy(isolate, reinterpret_cast(data->front()), + data->size()) + .ToLocalChecked(); + + promise.Resolve(buffer); +} #endif void WebContents::AddWorkSpace(gin::Arguments* args, diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h index 8925e14db4f5c..c85708f45cd16 100644 --- a/shell/browser/api/electron_api_web_contents.h +++ b/shell/browser/api/electron_api_web_contents.h @@ -47,7 +47,6 @@ #include "ui/gfx/image/image.h" #if BUILDFLAG(ENABLE_PRINTING) -#include "shell/browser/printing/print_preview_message_handler.h" #include "shell/browser/printing/print_view_manager_electron.h" #endif @@ -231,7 +230,10 @@ class WebContents : public ExclusiveAccessContext, std::pair info); void Print(gin::Arguments* args); // Print current page as PDF. - v8::Local PrintToPDF(base::DictionaryValue settings); + v8::Local PrintToPDF(const base::Value& settings); + void OnPDFCreated(gin_helper::Promise> promise, + PrintViewManagerElectron::PrintResult print_result, + scoped_refptr data); #endif void SetNextChildWebPreferences(const gin_helper::Dictionary); diff --git a/shell/browser/extensions/electron_extensions_api_client.cc b/shell/browser/extensions/electron_extensions_api_client.cc index b8ac568e10722..1a4c24700b9fc 100644 --- a/shell/browser/extensions/electron_extensions_api_client.cc +++ b/shell/browser/extensions/electron_extensions_api_client.cc @@ -19,7 +19,6 @@ #if BUILDFLAG(ENABLE_PRINTING) #include "components/printing/browser/print_manager_utils.h" -#include "shell/browser/printing/print_preview_message_handler.h" #include "shell/browser/printing/print_view_manager_electron.h" #endif @@ -86,7 +85,6 @@ MessagingDelegate* ElectronExtensionsAPIClient::GetMessagingDelegate() { void ElectronExtensionsAPIClient::AttachWebContentsHelpers( content::WebContents* web_contents) const { #if BUILDFLAG(ENABLE_PRINTING) - electron::PrintPreviewMessageHandler::CreateForWebContents(web_contents); electron::PrintViewManagerElectron::CreateForWebContents(web_contents); #endif diff --git a/shell/browser/printing/print_preview_message_handler.h b/shell/browser/printing/print_preview_message_handler.h deleted file mode 100644 index 57d84767d7759..0000000000000 --- a/shell/browser/printing/print_preview_message_handler.h +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) 2018 GitHub, Inc. -// Use of this source code is governed by the MIT license that can be -// found in the LICENSE file. - -#ifndef ELECTRON_SHELL_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_ -#define ELECTRON_SHELL_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_ - -#include - -#include "base/memory/ref_counted_memory.h" -#include "base/memory/weak_ptr.h" -#include "components/printing/common/print.mojom.h" -#include "components/services/print_compositor/public/mojom/print_compositor.mojom.h" -#include "content/public/browser/web_contents_user_data.h" -#include "mojo/public/cpp/bindings/associated_receiver.h" -#include "mojo/public/cpp/bindings/associated_remote.h" -#include "printing/mojom/print.mojom.h" -#include "shell/common/gin_helper/promise.h" -#include "v8/include/v8.h" - -namespace content { -class RenderFrameHost; -} - -namespace electron { - -// Manages the print preview handling for a WebContents. -class PrintPreviewMessageHandler - : public printing::mojom::PrintPreviewUI, - public content::WebContentsUserData { - public: - ~PrintPreviewMessageHandler() override; - - // disable copy - PrintPreviewMessageHandler(const PrintPreviewMessageHandler&) = delete; - PrintPreviewMessageHandler& operator=(const PrintPreviewMessageHandler&) = - delete; - - void PrintToPDF(base::DictionaryValue options, - gin_helper::Promise> promise); - - private: - friend class content::WebContentsUserData; - - explicit PrintPreviewMessageHandler(content::WebContents* web_contents); - - void OnCompositeDocumentToPdfDone( - int32_t request_id, - printing::mojom::PrintCompositor::Status status, - base::ReadOnlySharedMemoryRegion region); - void OnPrepareForDocumentToPdfDone( - int32_t request_id, - printing::mojom::PrintCompositor::Status status); - void OnCompositePdfPageDone(int page_number, - int document_cookie, - int32_t request_id, - printing::mojom::PrintCompositor::Status status, - base::ReadOnlySharedMemoryRegion region); - - // printing::mojo::PrintPreviewUI: - void SetOptionsFromDocument( - const printing::mojom::OptionsFromDocumentParamsPtr params, - int32_t request_id) override {} - void PrintPreviewFailed(int32_t document_cookie, int32_t request_id) override; - void PrintPreviewCancelled(int32_t document_cookie, - int32_t request_id) override; - void PrinterSettingsInvalid(int32_t document_cookie, - int32_t request_id) override {} - void DidPrepareDocumentForPreview(int32_t document_cookie, - int32_t request_id) override; - void DidPreviewPage(printing::mojom::DidPreviewPageParamsPtr params, - int32_t request_id) override; - void MetafileReadyForPrinting( - printing::mojom::DidPreviewDocumentParamsPtr params, - int32_t request_id) override; - void DidGetDefaultPageLayout( - printing::mojom::PageSizeMarginsPtr page_layout_in_points, - const gfx::Rect& printable_area_in_points, - bool has_custom_page_size_style, - int32_t request_id) override {} - void DidStartPreview(printing::mojom::DidStartPreviewParamsPtr params, - int32_t request_id) override {} - - gin_helper::Promise> GetPromise(int request_id); - - void ResolvePromise(int request_id, - scoped_refptr data_bytes); - void RejectPromise(int request_id); - - using PromiseMap = std::map>>; - PromiseMap promise_map_; - - // TODO(clavin): refactor to use the WebContents provided by the - // WebContentsUserData base class instead of storing a duplicate ref - content::WebContents* web_contents_ = nullptr; - - mojo::AssociatedRemote print_render_frame_; - - mojo::AssociatedReceiver receiver_{this}; - - base::WeakPtrFactory weak_ptr_factory_{this}; - - WEB_CONTENTS_USER_DATA_KEY_DECL(); -}; - -} // namespace electron - -#endif // ELECTRON_SHELL_BROWSER_PRINTING_PRINT_PREVIEW_MESSAGE_HANDLER_H_ diff --git a/shell/browser/printing/print_view_manager_electron.cc b/shell/browser/printing/print_view_manager_electron.cc index 505073093a7ca..866f439f5aec4 100644 --- a/shell/browser/printing/print_view_manager_electron.cc +++ b/shell/browser/printing/print_view_manager_electron.cc @@ -7,13 +7,39 @@ #include #include "build/build_config.h" -#include "content/public/browser/web_contents_user_data.h" +#include "components/printing/browser/print_to_pdf/pdf_print_utils.h" +#include "printing/mojom/print.mojom.h" +#include "printing/page_range.h" +#include "third_party/abseil-cpp/absl/types/variant.h" + +#if BUILDFLAG(ENABLE_PRINT_PREVIEW) +#include "mojo/public/cpp/bindings/message.h" +#endif namespace electron { +namespace { + +#if BUILDFLAG(ENABLE_PRINT_PREVIEW) +constexpr char kInvalidUpdatePrintSettingsCall[] = + "Invalid UpdatePrintSettings Call"; +constexpr char kInvalidSetupScriptedPrintPreviewCall[] = + "Invalid SetupScriptedPrintPreview Call"; +constexpr char kInvalidShowScriptedPrintPreviewCall[] = + "Invalid ShowScriptedPrintPreview Call"; +constexpr char kInvalidRequestPrintPreviewCall[] = + "Invalid RequestPrintPreview Call"; +#endif + +} // namespace + +// This file subclasses printing::PrintViewManagerBase +// but the implementations are duplicated from +// components/printing/browser/print_to_pdf/pdf_print_manager.cc. + PrintViewManagerElectron::PrintViewManagerElectron( content::WebContents* web_contents) - : PrintViewManagerBase(web_contents), + : printing::PrintViewManagerBase(web_contents), content::WebContentsUserData(*web_contents) {} PrintViewManagerElectron::~PrintViewManagerElectron() = default; @@ -25,26 +51,237 @@ void PrintViewManagerElectron::BindPrintManagerHost( auto* web_contents = content::WebContents::FromRenderFrameHost(rfh); if (!web_contents) return; + auto* print_manager = PrintViewManagerElectron::FromWebContents(web_contents); if (!print_manager) return; + print_manager->BindReceiver(std::move(receiver), rfh); } +// static +std::string PrintViewManagerElectron::PrintResultToString(PrintResult result) { + switch (result) { + case PRINT_SUCCESS: + return std::string(); // no error message + case PRINTING_FAILED: + return "Printing failed"; + case INVALID_PRINTER_SETTINGS: + return "Show invalid printer settings error"; + case INVALID_MEMORY_HANDLE: + return "Invalid memory handle"; + case METAFILE_MAP_ERROR: + return "Map to shared memory error"; + case METAFILE_INVALID_HEADER: + return "Invalid metafile header"; + case METAFILE_GET_DATA_ERROR: + return "Get data from metafile error"; + case SIMULTANEOUS_PRINT_ACTIVE: + return "The previous printing job hasn't finished"; + case PAGE_RANGE_SYNTAX_ERROR: + return "Page range syntax error"; + case PAGE_RANGE_INVALID_RANGE: + return "Page range is invalid (start > end)"; + case PAGE_COUNT_EXCEEDED: + return "Page range exceeds page count"; + default: + NOTREACHED(); + return "Unknown PrintResult"; + } +} + +void PrintViewManagerElectron::PrintToPdf( + content::RenderFrameHost* rfh, + const std::string& page_ranges, + printing::mojom::PrintPagesParamsPtr print_pages_params, + PrintToPDFCallback callback) { + DCHECK(callback); + + if (callback_) { + std::move(callback).Run(SIMULTANEOUS_PRINT_ACTIVE, + base::MakeRefCounted()); + return; + } + + if (!rfh->IsRenderFrameLive()) { + std::move(callback).Run(PRINTING_FAILED, + base::MakeRefCounted()); + return; + } + + absl::variant + parsed_ranges = print_to_pdf::TextPageRangesToPageRanges(page_ranges); + if (absl::holds_alternative(parsed_ranges)) { + PrintResult print_result; + switch (absl::get(parsed_ranges)) { + case print_to_pdf::PageRangeError::kSyntaxError: + print_result = PAGE_RANGE_SYNTAX_ERROR; + break; + case print_to_pdf::PageRangeError::kInvalidRange: + print_result = PAGE_RANGE_INVALID_RANGE; + break; + } + std::move(callback).Run(print_result, + base::MakeRefCounted()); + return; + } + + printing_rfh_ = rfh; + print_pages_params->pages = absl::get(parsed_ranges); + auto cookie = print_pages_params->params->document_cookie; + set_cookie(cookie); + headless_jobs_.emplace_back(cookie); + callback_ = std::move(callback); + + GetPrintRenderFrame(rfh)->PrintWithParams(std::move(print_pages_params)); +} + +void PrintViewManagerElectron::GetDefaultPrintSettings( + GetDefaultPrintSettingsCallback callback) { + if (printing_rfh_) { + LOG(ERROR) << "Scripted print is not supported"; + std::move(callback).Run(printing::mojom::PrintParams::New()); + } else { + PrintViewManagerBase::GetDefaultPrintSettings(std::move(callback)); + } +} + +void PrintViewManagerElectron::ScriptedPrint( + printing::mojom::ScriptedPrintParamsPtr params, + ScriptedPrintCallback callback) { + auto entry = + std::find(headless_jobs_.begin(), headless_jobs_.end(), params->cookie); + if (entry == headless_jobs_.end()) { + PrintViewManagerBase::ScriptedPrint(std::move(params), std::move(callback)); + return; + } + + auto default_param = printing::mojom::PrintPagesParams::New(); + default_param->params = printing::mojom::PrintParams::New(); + LOG(ERROR) << "Scripted print is not supported"; + std::move(callback).Run(std::move(default_param), /*cancelled*/ false); +} + +void PrintViewManagerElectron::ShowInvalidPrinterSettingsError() { + ReleaseJob(INVALID_PRINTER_SETTINGS); +} + +void PrintViewManagerElectron::PrintingFailed( + int32_t cookie, + printing::mojom::PrintFailureReason reason) { + ReleaseJob(reason == printing::mojom::PrintFailureReason::kInvalidPageRange + ? PAGE_COUNT_EXCEEDED + : PRINTING_FAILED); +} + +#if BUILDFLAG(ENABLE_PRINT_PREVIEW) +void PrintViewManagerElectron::UpdatePrintSettings( + int32_t cookie, + base::Value::Dict job_settings, + UpdatePrintSettingsCallback callback) { + auto entry = std::find(headless_jobs_.begin(), headless_jobs_.end(), cookie); + if (entry == headless_jobs_.end()) { + PrintViewManagerBase::UpdatePrintSettings(cookie, std::move(job_settings), + std::move(callback)); + return; + } + + mojo::ReportBadMessage(kInvalidUpdatePrintSettingsCall); +} + void PrintViewManagerElectron::SetupScriptedPrintPreview( SetupScriptedPrintPreviewCallback callback) { - std::move(callback).Run(); + mojo::ReportBadMessage(kInvalidSetupScriptedPrintPreviewCall); } void PrintViewManagerElectron::ShowScriptedPrintPreview( - bool source_is_modifiable) {} + bool source_is_modifiable) { + mojo::ReportBadMessage(kInvalidShowScriptedPrintPreviewCall); +} void PrintViewManagerElectron::RequestPrintPreview( - printing::mojom::RequestPrintPreviewParamsPtr params) {} + printing::mojom::RequestPrintPreviewParamsPtr params) { + mojo::ReportBadMessage(kInvalidRequestPrintPreviewCall); +} void PrintViewManagerElectron::CheckForCancel(int32_t preview_ui_id, int32_t request_id, CheckForCancelCallback callback) { + std::move(callback).Run(false); +} +#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) + +void PrintViewManagerElectron::RenderFrameDeleted( + content::RenderFrameHost* render_frame_host) { + PrintViewManagerBase::RenderFrameDeleted(render_frame_host); + + if (printing_rfh_ != render_frame_host) + return; + + if (callback_) { + std::move(callback_).Run(PRINTING_FAILED, + base::MakeRefCounted()); + } + + Reset(); +} + +void PrintViewManagerElectron::DidGetPrintedPagesCount(int32_t cookie, + uint32_t number_pages) { + auto entry = std::find(headless_jobs_.begin(), headless_jobs_.end(), cookie); + if (entry == headless_jobs_.end()) { + PrintViewManagerBase::DidGetPrintedPagesCount(cookie, number_pages); + } +} + +void PrintViewManagerElectron::DidPrintDocument( + printing::mojom::DidPrintDocumentParamsPtr params, + DidPrintDocumentCallback callback) { + auto entry = std::find(headless_jobs_.begin(), headless_jobs_.end(), + params->document_cookie); + if (entry == headless_jobs_.end()) { + PrintViewManagerBase::DidPrintDocument(std::move(params), + std::move(callback)); + return; + } + + auto& content = *params->content; + if (!content.metafile_data_region.IsValid()) { + ReleaseJob(INVALID_MEMORY_HANDLE); + std::move(callback).Run(false); + return; + } + + base::ReadOnlySharedMemoryMapping map = content.metafile_data_region.Map(); + if (!map.IsValid()) { + ReleaseJob(METAFILE_MAP_ERROR); + std::move(callback).Run(false); + return; + } + + data_ = std::string(static_cast(map.memory()), map.size()); + headless_jobs_.erase(entry); + std::move(callback).Run(true); + ReleaseJob(PRINT_SUCCESS); +} + +void PrintViewManagerElectron::Reset() { + printing_rfh_ = nullptr; + callback_.Reset(); + data_.clear(); +} + +void PrintViewManagerElectron::ReleaseJob(PrintResult result) { + if (callback_) { + DCHECK(result == PRINT_SUCCESS || data_.empty()); + std::move(callback_).Run(result, + base::RefCountedString::TakeString(&data_)); + if (printing_rfh_ && printing_rfh_->IsRenderFrameLive()) { + GetPrintRenderFrame(printing_rfh_)->PrintingDone(result == PRINT_SUCCESS); + } + + Reset(); + } } WEB_CONTENTS_USER_DATA_KEY_IMPL(PrintViewManagerElectron); diff --git a/shell/browser/printing/print_view_manager_electron.h b/shell/browser/printing/print_view_manager_electron.h index 2127219f953ce..197b3c77adfa4 100644 --- a/shell/browser/printing/print_view_manager_electron.h +++ b/shell/browser/printing/print_view_manager_electron.h @@ -5,9 +5,19 @@ #ifndef ELECTRON_SHELL_BROWSER_PRINTING_PRINT_VIEW_MANAGER_ELECTRON_H_ #define ELECTRON_SHELL_BROWSER_PRINTING_PRINT_VIEW_MANAGER_ELECTRON_H_ +#include +#include +#include + +#include "base/memory/raw_ptr.h" +#include "base/memory/ref_counted_memory.h" #include "build/build_config.h" #include "chrome/browser/printing/print_view_manager_base.h" +#include "components/printing/common/print.mojom.h" +#include "content/public/browser/render_frame_host.h" +#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" +#include "printing/print_settings.h" namespace electron { @@ -15,9 +25,26 @@ class PrintViewManagerElectron : public printing::PrintViewManagerBase, public content::WebContentsUserData { public: + enum PrintResult { + PRINT_SUCCESS, + PRINTING_FAILED, + INVALID_PRINTER_SETTINGS, + INVALID_MEMORY_HANDLE, + METAFILE_MAP_ERROR, + METAFILE_INVALID_HEADER, + METAFILE_GET_DATA_ERROR, + SIMULTANEOUS_PRINT_ACTIVE, + PAGE_RANGE_SYNTAX_ERROR, + PAGE_RANGE_INVALID_RANGE, + PAGE_COUNT_EXCEEDED, + }; + + using PrintToPDFCallback = + base::OnceCallback)>; + ~PrintViewManagerElectron() override; - // disable copy PrintViewManagerElectron(const PrintViewManagerElectron&) = delete; PrintViewManagerElectron& operator=(const PrintViewManagerElectron&) = delete; @@ -26,6 +53,35 @@ class PrintViewManagerElectron receiver, content::RenderFrameHost* rfh); + static std::string PrintResultToString(PrintResult result); + + void PrintToPdf(content::RenderFrameHost* rfh, + const std::string& page_ranges, + printing::mojom::PrintPagesParamsPtr print_page_params, + PrintToPDFCallback callback); + + private: + explicit PrintViewManagerElectron(content::WebContents* web_contents); + friend class content::WebContentsUserData; + + // WebContentsObserver overrides (via PrintManager): + void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; + + // printing::mojom::PrintManagerHost: + void DidPrintDocument(printing::mojom::DidPrintDocumentParamsPtr params, + DidPrintDocumentCallback callback) override; + void DidGetPrintedPagesCount(int32_t cookie, uint32_t number_pages) override; + void GetDefaultPrintSettings( + GetDefaultPrintSettingsCallback callback) override; + void ScriptedPrint(printing::mojom::ScriptedPrintParamsPtr params, + ScriptedPrintCallback callback) override; + void ShowInvalidPrinterSettingsError() override; + void PrintingFailed(int32_t cookie, + printing::mojom::PrintFailureReason reason) override; +#if BUILDFLAG(ENABLE_PRINT_PREVIEW) + void UpdatePrintSettings(int32_t cookie, + base::Value::Dict job_settings, + UpdatePrintSettingsCallback callback) override; void SetupScriptedPrintPreview( SetupScriptedPrintPreviewCallback callback) override; void ShowScriptedPrintPreview(bool source_is_modifiable) override; @@ -34,10 +90,15 @@ class PrintViewManagerElectron void CheckForCancel(int32_t preview_ui_id, int32_t request_id, CheckForCancelCallback callback) override; +#endif - private: - friend class content::WebContentsUserData; - explicit PrintViewManagerElectron(content::WebContents* web_contents); + void Reset(); + void ReleaseJob(PrintResult result); + + raw_ptr printing_rfh_ = nullptr; + PrintToPDFCallback callback_; + std::string data_; + std::vector headless_jobs_; WEB_CONTENTS_USER_DATA_KEY_DECL(); }; diff --git a/spec-main/api-web-contents-spec.ts b/spec-main/api-web-contents-spec.ts index 29ff9e5f60996..c340d309c83ac 100644 --- a/spec-main/api-web-contents-spec.ts +++ b/spec-main/api-web-contents-spec.ts @@ -1813,14 +1813,16 @@ describe('webContents module', () => { it('rejects on incorrectly typed parameters', async () => { const badTypes = { - marginsType: 'terrible', - scaleFactor: 'not-a-number', landscape: [], - pageRanges: { oops: 'im-not-the-right-key' }, - headerFooter: '123', - printSelectionOnly: 1, + displayHeaderFooter: '123', printBackground: 2, - pageSize: 'IAmAPageSize' + scale: 'not-a-number', + pageSize: 'IAmAPageSize', + margins: 'terrible', + pageRanges: { oops: 'im-not-the-right-key' }, + headerTemplate: [1, 2, 3], + footerTemplate: [4, 5, 6], + preferCSSPageSize: 'no' }; // These will hard crash in Chromium unless we type-check @@ -1869,10 +1871,7 @@ describe('webContents module', () => { it('respects custom settings', async () => { const data = await w.webContents.printToPDF({ - pageRanges: { - from: 0, - to: 2 - }, + pageRanges: '1-3', landscape: true }); diff --git a/spec/ts-smoke/electron/main.ts b/spec/ts-smoke/electron/main.ts index 6992f92e8b2f8..5d1b6dd6b66a3 100644 --- a/spec/ts-smoke/electron/main.ts +++ b/spec/ts-smoke/electron/main.ts @@ -86,10 +86,11 @@ app.whenReady().then(() => { mainWindow.webContents.print() mainWindow.webContents.printToPDF({ - marginsType: 1, - pageSize: 'A3', + margins: { + top: 1 + }, printBackground: true, - printSelectionOnly: true, + pageRanges: '1-3', landscape: true }).then((data: Buffer) => console.log(data)) diff --git a/spec/webview-spec.js b/spec/webview-spec.js index f4af0158f2c85..377d96b396660 100644 --- a/spec/webview-spec.js +++ b/spec/webview-spec.js @@ -1110,14 +1110,16 @@ describe(' tag', function () { ifdescribe(features.isPrintingEnabled())('.printToPDF()', () => { it('rejects on incorrectly typed parameters', async () => { const badTypes = { - marginsType: 'terrible', - scaleFactor: 'not-a-number', landscape: [], - pageRanges: { oops: 'im-not-the-right-key' }, - headerFooter: '123', - printSelectionOnly: 1, + displayHeaderFooter: '123', printBackground: 2, - pageSize: 'IAmAPageSize' + scale: 'not-a-number', + pageSize: 'IAmAPageSize', + margins: 'terrible', + pageRanges: { oops: 'im-not-the-right-key' }, + headerTemplate: [1, 2, 3], + footerTemplate: [4, 5, 6], + preferCSSPageSize: 'no' }; // These will hard crash in Chromium unless we type-check diff --git a/typings/internal-electron.d.ts b/typings/internal-electron.d.ts index 49568925fa80b..891966d8e3e44 100644 --- a/typings/internal-electron.d.ts +++ b/typings/internal-electron.d.ts @@ -264,6 +264,11 @@ declare namespace ElectronInternal { is_default?: 'true', } + type PageSize = { + width: number, + height: number, + } + type ModuleLoader = () => any; interface ModuleEntry { From 2cb53c5db1751170816959d6d89db58dc638b155 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 31 May 2022 10:43:42 +0200 Subject: [PATCH 05/14] fix: zombie windows when fullscreening and closing (#34378) --- shell/browser/native_window_mac.h | 10 +++++++++ shell/browser/native_window_mac.mm | 14 +++++++++++++ .../ui/cocoa/electron_ns_window_delegate.mm | 6 ++++++ spec-main/webview-spec.ts | 21 ++++++++++++++----- 4 files changed, 46 insertions(+), 5 deletions(-) diff --git a/shell/browser/native_window_mac.h b/shell/browser/native_window_mac.h index ae1e845c8a182..9b6fcb14dda59 100644 --- a/shell/browser/native_window_mac.h +++ b/shell/browser/native_window_mac.h @@ -176,6 +176,10 @@ class NativeWindowMac : public NativeWindow, // Handle fullscreen transitions. void SetFullScreenTransitionState(FullScreenTransitionState state); void HandlePendingFullscreenTransitions(); + bool HandleDeferredClose(); + void SetHasDeferredWindowClose(bool defer_close) { + has_deferred_window_close_ = defer_close; + } enum class VisualEffectState { kFollowWindow, @@ -249,6 +253,12 @@ class NativeWindowMac : public NativeWindow, FullScreenTransitionState fullscreen_transition_state_ = FullScreenTransitionState::NONE; + // Trying to close an NSWindow during a fullscreen transition will cause the + // window to lock up. Use this to track if CloseWindow was called during a + // fullscreen transition, to defer the -[NSWindow close] call until the + // transition is complete. + bool has_deferred_window_close_ = false; + NSInteger attention_request_id_ = 0; // identifier from requestUserAttention // The presentation options before entering kiosk mode. diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index c23cb268b66d2..d236ca72aa1a5 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -474,6 +474,11 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) { return; } + if (fullscreen_transition_state() != FullScreenTransitionState::NONE) { + SetHasDeferredWindowClose(true); + return; + } + // If a sheet is attached to the window when we call // [window_ performClose:nil], the window won't close properly // even after the user has ended the sheet. @@ -678,6 +683,15 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) { SetFullScreen(next_transition); } +bool NativeWindowMac::HandleDeferredClose() { + if (has_deferred_window_close_) { + SetHasDeferredWindowClose(false); + Close(); + return true; + } + return false; +} + void NativeWindowMac::SetFullScreen(bool fullscreen) { // [NSWindow -toggleFullScreen] is an asynchronous operation, which means // that it's possible to call it while a fullscreen transition is currently diff --git a/shell/browser/ui/cocoa/electron_ns_window_delegate.mm b/shell/browser/ui/cocoa/electron_ns_window_delegate.mm index f9b7a1170d1de..9d5633a0f95b8 100644 --- a/shell/browser/ui/cocoa/electron_ns_window_delegate.mm +++ b/shell/browser/ui/cocoa/electron_ns_window_delegate.mm @@ -248,6 +248,9 @@ - (void)windowDidEnterFullScreen:(NSNotification*)notification { shell_->NotifyWindowEnterFullScreen(); + if (shell_->HandleDeferredClose()) + return; + shell_->HandlePendingFullscreenTransitions(); } @@ -263,6 +266,9 @@ - (void)windowDidExitFullScreen:(NSNotification*)notification { shell_->SetResizable(is_resizable_); shell_->NotifyWindowLeaveFullScreen(); + if (shell_->HandleDeferredClose()) + return; + shell_->HandlePendingFullscreenTransitions(); } diff --git a/spec-main/webview-spec.ts b/spec-main/webview-spec.ts index 7c7315eca85b6..ce5a64ef4754f 100644 --- a/spec-main/webview-spec.ts +++ b/spec-main/webview-spec.ts @@ -434,15 +434,15 @@ describe(' tag', function () { return [w, webview]; }; - afterEach(closeAllWindows); afterEach(async () => { // The leaving animation is un-observable but can interfere with future tests // Specifically this is async on macOS but can be on other platforms too await delay(1000); + + closeAllWindows(); }); - // TODO(jkleinsc) fix this test on arm64 macOS. It causes the tests following it to fail/be flaky - ifit(process.platform !== 'darwin' || process.arch !== 'arm64')('should make parent frame element fullscreen too', async () => { + it('should make parent frame element fullscreen too', async () => { const [w, webview] = await loadWebViewWindow(); expect(await w.webContents.executeJavaScript('isIframeFullscreen()')).to.be.false(); @@ -450,11 +450,13 @@ describe(' tag', function () { await webview.executeJavaScript('document.getElementById("div").requestFullscreen()', true); await parentFullscreen; expect(await w.webContents.executeJavaScript('isIframeFullscreen()')).to.be.true(); + + w.close(); + await emittedOnce(w, 'closed'); }); // FIXME(zcbenz): Fullscreen events do not work on Linux. - // This test is flaky on arm64 macOS. - ifit(process.platform !== 'linux' && process.arch !== 'arm64')('exiting fullscreen should unfullscreen window', async () => { + ifit(process.platform !== 'linux')('exiting fullscreen should unfullscreen window', async () => { const [w, webview] = await loadWebViewWindow(); const enterFullScreen = emittedOnce(w, 'enter-full-screen'); await webview.executeJavaScript('document.getElementById("div").requestFullscreen()', true); @@ -465,6 +467,9 @@ describe(' tag', function () { await leaveFullScreen; await delay(0); expect(w.isFullScreen()).to.be.false(); + + w.close(); + await emittedOnce(w, 'closed'); }); // Sending ESC via sendInputEvent only works on Windows. @@ -479,6 +484,9 @@ describe(' tag', function () { await leaveFullScreen; await delay(0); expect(w.isFullScreen()).to.be.false(); + + w.close(); + await emittedOnce(w, 'closed'); }); it('pressing ESC should emit the leave-html-full-screen event', async () => { @@ -507,6 +515,9 @@ describe(' tag', function () { webContents.sendInputEvent({ type: 'keyDown', keyCode: 'Escape' }); await leaveFSWindow; await leaveFSWebview; + + w.close(); + await emittedOnce(w, 'closed'); }); }); From 3849d19e1476764d175587c88c8fbc6ffa9e224a Mon Sep 17 00:00:00 2001 From: Sudowoodo Release Bot <88427002+sudowoodo-release-bot[bot]@users.noreply.github.com> Date: Tue, 31 May 2022 06:01:31 -0700 Subject: [PATCH 06/14] Bump v21.0.0-nightly.20220531 --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index d26213de57bfa..7085745b647a1 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -21.0.0-nightly.20220530 \ No newline at end of file +21.0.0-nightly.20220531 \ No newline at end of file diff --git a/package.json b/package.json index 1abee71072b9f..23f3239067292 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "21.0.0-nightly.20220530", + "version": "21.0.0-nightly.20220531", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index 41ec4c7402d4c..2ab0cf4c6a7f6 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 21,0,0,20220530 - PRODUCTVERSION 21,0,0,20220530 + FILEVERSION 21,0,0,20220531 + PRODUCTVERSION 21,0,0,20220531 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From 470396d6aceb53817f003e7a0a8cf21eb673bb99 Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <84116207+electron-roller[bot]@users.noreply.github.com> Date: Wed, 1 Jun 2022 08:12:47 +0200 Subject: [PATCH 07/14] chore: bump chromium to 104.0.5073.0 (main) (#34272) --- BUILD.gn | 2 +- DEPS | 2 +- build/args/all.gn | 2 + docs/api/browser-window.md | 2 +- electron_paks.gni | 2 - patches/chromium/accelerator.patch | 6 +- .../add_didinstallconditionalfeatures.patch | 24 +++--- ..._scheduler_throttling_per_renderview.patch | 22 ++--- ...leges_in_unsandboxed_child_processes.patch | 4 +- patches/chromium/blink_local_frame.patch | 4 +- patches/chromium/boringssl_build_gn.patch | 2 +- .../build_add_electron_tracing_category.patch | 2 +- ..._depend_on_packed_resource_integrity.patch | 18 ++-- patches/chromium/can_create_window.patch | 52 +++++------ ..._v8_initialization_isolate_callbacks.patch | 2 +- ...screationoverridden_with_full_params.patch | 36 ++++---- patches/chromium/chrome_key_systems.patch | 14 +-- patches/chromium/command-ismediakey.patch | 4 +- .../crash_allow_setting_more_options.patch | 8 +- patches/chromium/disable-redraw-lock.patch | 18 ++-- .../disable_color_correct_rendering.patch | 46 +++++----- .../disable_compositor_recycling.patch | 14 +-- patches/chromium/disable_hidden.patch | 8 +- ...ythreadcreated_if_pcscan_is_disabled.patch | 2 +- ...ll_getwebframe_-_view_when_get_blink.patch | 4 +- .../chromium/enable_reset_aspect_ratio.patch | 6 +- ...xpose_setuseragent_on_networkcontext.patch | 2 +- .../extend_apply_webpreferences.patch | 6 +- ...d_data_parameter_to_processsingleton.patch | 16 ++-- ..._raw_response_headers_from_urlloader.patch | 2 +- .../fix_aspect_ratio_with_max_size.patch | 4 +- ...x_crash_when_saving_edited_pdf_files.patch | 6 +- .../chromium/fix_export_zlib_symbols.patch | 4 +- ...ntcapturercount_in_web_contents_impl.patch | 4 +- ..._properly_honor_printing_page_ranges.patch | 2 +- patches/chromium/frame_host_manager.patch | 8 +- .../gin_enable_disable_v8_platform.patch | 6 +- .../chromium/gritsettings_resource_ids.patch | 4 +- ...nse_interceptor_to_point_to_electron.patch | 2 +- ...sync_with_host_os_mac_on_linux_in_ci.patch | 4 +- .../load_v8_snapshot_in_browser_process.patch | 4 +- .../mas-cgdisplayusesforcetogray.patch | 4 +- ...as_avoid_usage_of_private_macos_apis.patch | 57 ++++++------ .../mas_disable_custom_window_frame.patch | 8 +- .../mas_disable_remote_accessibility.patch | 30 +++---- .../chromium/mas_disable_remote_layer.patch | 51 +++++++++-- patches/chromium/mas_no_private_api.patch | 14 +-- ...determine_if_a_font_is_a_system_font.patch | 4 +- ...emote_certificate_verification_logic.patch | 4 +- .../chromium/notification_provenance.patch | 8 +- patches/chromium/picture-in-picture.patch | 2 +- patches/chromium/printing.patch | 68 +++++++-------- patches/chromium/process_singleton.patch | 20 ++--- ...r_changes_to_the_webcontentsobserver.patch | 10 +-- .../render_widget_host_view_base.patch | 10 +-- .../render_widget_host_view_mac.patch | 18 ++-- patches/chromium/resource_file_conflict.patch | 6 +- .../support_mixed_sandbox_with_zygote.patch | 16 ++-- patches/chromium/web_contents.patch | 8 +- patches/chromium/webview_cross_drag.patch | 4 +- patches/chromium/webview_fullscreen.patch | 4 +- patches/node/.patches | 1 + ...json_parse_errors_made_user-friendly.patch | 39 +++++++++ .../squirrel.mac/build_add_gn_config.patch | 9 +- patches/v8/.patches | 2 + ...w_disabling_of_v8_sandboxed_pointers.patch | 32 +++++++ patches/v8/build_gn.patch | 8 +- ...able_is_execution_terminating_dcheck.patch | 22 +++++ patches/v8/dcheck.patch | 8 +- ...export_private_v8_symbols_on_windows.patch | 8 +- ...ort_symbols_needed_for_windows_build.patch | 2 +- patches/v8/expose_mksnapshot.patch | 4 +- ...ed_attribute_for_older_msvc_versions.patch | 2 +- ..._terminating_exception_in_microtasks.patch | 4 +- ...workaround_an_undefined_symbol_error.patch | 4 +- .../zip_manifests/dist_zip.mac.arm64.manifest | 4 +- .../zip_manifests/dist_zip.mac.x64.manifest | 4 +- .../dist_zip.mac_mas.arm64.manifest | 4 +- .../dist_zip.mac_mas.x64.manifest | 4 +- .../api/electron_api_data_pipe_holder.cc | 13 +++ .../api/electron_api_global_shortcut.cc | 2 +- .../api/electron_api_web_contents_mac.mm | 2 +- shell/browser/electron_browser_main_parts.cc | 3 - shell/browser/electron_permission_manager.cc | 30 +++---- shell/browser/electron_permission_manager.h | 13 +-- .../electron_extensions_browser_client.cc | 10 ++- .../electron_extensions_browser_client.h | 2 +- shell/browser/javascript_environment.cc | 86 ++----------------- .../media/media_capture_devices_dispatcher.cc | 6 +- .../media/media_capture_devices_dispatcher.h | 8 +- .../media/media_stream_devices_controller.cc | 47 +++++----- shell/browser/native_window_mac.mm | 15 ++-- shell/browser/net/asar/asar_url_loader.cc | 4 +- .../net/electron_url_loader_factory.cc | 18 ++-- shell/browser/net/node_stream_loader.cc | 4 +- .../net/proxying_url_loader_factory.cc | 5 -- .../browser/net/proxying_url_loader_factory.h | 2 - shell/browser/net/url_pipe_loader.cc | 4 +- .../osr/osr_render_widget_host_view.cc | 10 +-- .../browser/osr/osr_web_contents_view_mac.mm | 2 +- .../printing/print_preview_message_handler.cc | 2 +- .../electron_inspectable_web_contents_view.mm | 5 +- .../ui/cocoa/electron_ns_window_delegate.mm | 2 +- .../ui/cocoa/event_dispatching_window.mm | 4 +- shell/browser/ui/drag_util_mac.mm | 7 +- shell/browser/ui/file_dialog_mac.mm | 10 +-- shell/browser/ui/message_box_mac.mm | 10 +-- .../ui/views/client_frame_view_linux.cc | 19 ++-- .../ui/views/client_frame_view_linux.h | 4 +- shell/common/api/electron_api_native_image.cc | 9 ++ spec-main/api-session-spec.ts | 3 +- spec/fixtures/api/cookie-app/main.js | 2 +- 112 files changed, 662 insertions(+), 588 deletions(-) create mode 100644 patches/node/json_parse_errors_made_user-friendly.patch create mode 100644 patches/v8/allow_disabling_of_v8_sandboxed_pointers.patch create mode 100644 patches/v8/chore_disable_is_execution_terminating_dcheck.patch diff --git a/BUILD.gn b/BUILD.gn index 5c5f4d27e01e6..9b62fb12029d4 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -37,7 +37,7 @@ if (is_mac) { import("build/rules.gni") assert( - mac_deployment_target == "10.11.0", + mac_deployment_target == "10.13", "Chromium has updated the mac_deployment_target, please update this assert, update the supported versions documentation (docs/tutorial/support.md) and flag this as a breaking change") } diff --git a/DEPS b/DEPS index 8d2532547f4fd..bc96d86bcb6cd 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '103.0.5044.0', + '104.0.5073.0', 'node_version': 'v16.15.0', 'nan_version': diff --git a/build/args/all.gn b/build/args/all.gn index f1de439d833fc..e12aca35a29b1 100644 --- a/build/args/all.gn +++ b/build/args/all.gn @@ -45,3 +45,5 @@ enable_cet_shadow_stack = false # V8 in the browser process. # Ref: https://source.chromium.org/chromium/chromium/src/+/45fba672185aae233e75d6ddc81ea1e0b30db050:v8/BUILD.gn;l=281 is_cfi = false + +v8_enable_sandboxed_pointers = false diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 4adb22ec0e6ea..2f00cd1f5feb7 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -427,7 +427,7 @@ Possible values are: `notification`. * On macOS, possible types are `desktop`, `textured`. * The `textured` type adds metal gradient appearance - (`NSTexturedBackgroundWindowMask`). + (`NSWindowStyleMaskTexturedBackground`). * The `desktop` type places the window at the desktop background window level (`kCGDesktopWindowLevel - 1`). Note that desktop window will not receive focus, keyboard or mouse events, but you can use `globalShortcut` to receive diff --git a/electron_paks.gni b/electron_paks.gni index 2c5ae0b0c8c10..107feff5a86d5 100644 --- a/electron_paks.gni +++ b/electron_paks.gni @@ -19,14 +19,12 @@ template("electron_repack_percent") { # All sources should also have deps for completeness. sources = [ "$root_gen_dir/components/components_resources_${percent}_percent.pak", - "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak", "$root_gen_dir/third_party/blink/public/resources/blink_scaled_resources_${percent}_percent.pak", "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak", ] deps = [ "//components/resources", - "//content/app/resources", "//third_party/blink/public:scaled_resources_${percent}_percent", "//ui/resources", ] diff --git a/patches/chromium/accelerator.patch b/patches/chromium/accelerator.patch index 58c927f03d6bb..2582196629449 100644 --- a/patches/chromium/accelerator.patch +++ b/patches/chromium/accelerator.patch @@ -10,7 +10,7 @@ This patch makes three changes to Accelerator::GetShortcutText to improve shortc 3. Ctrl-Shift-= and Ctrl-Plus show up as such diff --git a/ui/base/accelerators/accelerator.cc b/ui/base/accelerators/accelerator.cc -index 783202623cc15168c726180fe232751551c43798..7cf5449a61a31bebbaffd920129daf1866211d7c 100644 +index 9fca6ff3e62204095ff0edc6fafce3a61cd2ff5c..089f8b818018a600cc8c90811f09374a1f702d8b 100644 --- a/ui/base/accelerators/accelerator.cc +++ b/ui/base/accelerators/accelerator.cc @@ -11,6 +11,7 @@ @@ -44,7 +44,7 @@ index 783202623cc15168c726180fe232751551c43798..7cf5449a61a31bebbaffd920129daf18 } #if BUILDFLAG(IS_MAC) -@@ -451,7 +461,7 @@ std::u16string Accelerator::ApplyLongFormModifiers( +@@ -447,7 +457,7 @@ std::u16string Accelerator::ApplyLongFormModifiers( const std::u16string& shortcut) const { std::u16string result = shortcut; @@ -53,7 +53,7 @@ index 783202623cc15168c726180fe232751551c43798..7cf5449a61a31bebbaffd920129daf18 result = ApplyModifierToAcceleratorString(result, IDS_APP_SHIFT_KEY); // Note that we use 'else-if' in order to avoid using Ctrl+Alt as a shortcut. -@@ -459,7 +469,7 @@ std::u16string Accelerator::ApplyLongFormModifiers( +@@ -455,7 +465,7 @@ std::u16string Accelerator::ApplyLongFormModifiers( // more information. if (IsCtrlDown()) result = ApplyModifierToAcceleratorString(result, IDS_APP_CTRL_KEY); diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index 52a2c7249d7d4..bd92d7ecb804e 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -10,10 +10,10 @@ DidCreateScriptContext is called, not all JS APIs are available in the context, which can cause some preload scripts to trip. diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h -index eb6f4c87c4479d5f4fb8e3f85a231fb9cc744a63..11298b413021b4d438195482db253a93356b2862 100644 +index d921125d153742dd09e34418c19195a3d61bef1f..5348c3289a94c86bbbc9bb07be26cc56b4986788 100644 --- a/content/public/renderer/render_frame_observer.h +++ b/content/public/renderer/render_frame_observer.h -@@ -132,6 +132,8 @@ class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener, +@@ -136,6 +136,8 @@ class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener, virtual void DidHandleOnloadEvents() {} virtual void DidCreateScriptContext(v8::Local context, int32_t world_id) {} @@ -23,10 +23,10 @@ index eb6f4c87c4479d5f4fb8e3f85a231fb9cc744a63..11298b413021b4d438195482db253a93 int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index abcd95ad39d8d66e1a7149e89bc6bfe2a8197d19..1b021461f214287c94fb22b17d980c19e3f07dde 100644 +index 831db39365764d4001b8d602b225f157d3562ca8..4aabe0781d9e4150dddce76a50b993d0b8da8068 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4489,6 +4489,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local context, +@@ -4502,6 +4502,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local context, observer.DidCreateScriptContext(context, world_id); } @@ -40,10 +40,10 @@ index abcd95ad39d8d66e1a7149e89bc6bfe2a8197d19..1b021461f214287c94fb22b17d980c19 int world_id) { for (auto& observer : observers_) diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index d8ffccc148622d4eb0388e03c78ff1def4290701..5a3162cc88e5a48b04fbbb74a5c2ba4b7dd8a5d3 100644 +index e903ba9ec4f8d32c5d3a6795f0a20f2addf95743..bb9755b981cf96e131e6545f778f73607fabdd02 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h -@@ -599,6 +599,8 @@ class CONTENT_EXPORT RenderFrameImpl +@@ -604,6 +604,8 @@ class CONTENT_EXPORT RenderFrameImpl uint32_t ng_call_count) override; void DidCreateScriptContext(v8::Local context, int world_id) override; @@ -53,10 +53,10 @@ index d8ffccc148622d4eb0388e03c78ff1def4290701..5a3162cc88e5a48b04fbbb74a5c2ba4b int world_id) override; void DidChangeScrollOffset() override; diff --git a/third_party/blink/public/web/web_local_frame_client.h b/third_party/blink/public/web/web_local_frame_client.h -index 5adee94f81c0e98db976ac1c6c55fb5eab8c2e65..9d3e43f4394ad9a4377b47a001c4baf4027cbe7c 100644 +index 595441198b5253e5f36f97303e952e642998be39..1b17db7b9285cb874e74abdd896888c12b288565 100644 --- a/third_party/blink/public/web/web_local_frame_client.h +++ b/third_party/blink/public/web/web_local_frame_client.h -@@ -584,6 +584,9 @@ class BLINK_EXPORT WebLocalFrameClient { +@@ -598,6 +598,9 @@ class BLINK_EXPORT WebLocalFrameClient { virtual void DidCreateScriptContext(v8::Local, int32_t world_id) {} @@ -79,7 +79,7 @@ index a6ba8411384855c82712960375bc949c5c2bd522..fc86ca807c9c1bda9236160580b09415 if (World().IsMainWorld()) { GetFrame()->Loader().DispatchDidClearWindowObjectInMainWorld(); diff --git a/third_party/blink/renderer/core/frame/local_frame_client.h b/third_party/blink/renderer/core/frame/local_frame_client.h -index 810726792cba326f66df5a8d0d833eaee4975594..635fb45b0a9d1716bd45d8b6c5dbc5f9fbf0ffa8 100644 +index 6fb24096d3a5415f59cba2a8a5a6f36fe838dcc1..a4089fb3989ecd37d5b01baeb03c2ac1f4f05b53 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client.h +++ b/third_party/blink/renderer/core/frame/local_frame_client.h @@ -298,6 +298,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient { @@ -92,7 +92,7 @@ index 810726792cba326f66df5a8d0d833eaee4975594..635fb45b0a9d1716bd45d8b6c5dbc5f9 int32_t world_id) = 0; virtual bool AllowScriptExtensions() = 0; diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -index 772748673a5854349ba2be28abe21b7ff3f8541f..b3ebd622a61187f718ca16ac8cfeb189d35584d2 100644 +index 40042e1fa2622a871d0ed512f1f6fda1cdda56a6..a377548b36712bd4971bae6b4c0afdc5c8fdbdfc 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc +++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc @@ -273,6 +273,13 @@ void LocalFrameClientImpl::DidCreateScriptContext( @@ -110,7 +110,7 @@ index 772748673a5854349ba2be28abe21b7ff3f8541f..b3ebd622a61187f718ca16ac8cfeb189 v8::Local context, int32_t world_id) { diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.h b/third_party/blink/renderer/core/frame/local_frame_client_impl.h -index 200f0c57df1f15428b45a228adfee8fd5465ecbf..ec8cad0a94b31561096fdaba1a75fb54c96d3f7e 100644 +index 1f929d9535ca19a2c443e13f2bafce179f5870df..fe7605585501fcc1fd515f1d94fda7e27d5ba632 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client_impl.h +++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.h @@ -80,6 +80,8 @@ class CORE_EXPORT LocalFrameClientImpl final : public LocalFrameClient { @@ -123,7 +123,7 @@ index 200f0c57df1f15428b45a228adfee8fd5465ecbf..ec8cad0a94b31561096fdaba1a75fb54 int32_t world_id) override; diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h -index acd3b33c64f1534555c14047e29c18f31a1e8f92..63a9e0695efb0f357c0c3298175da9bbdc78a41c 100644 +index a9bd5283d3c65728dd3293abe88ffd02d3eee4fc..f5e4a927f2f5114e62d76fec86d6a5d2d2321166 100644 --- a/third_party/blink/renderer/core/loader/empty_clients.h +++ b/third_party/blink/renderer/core/loader/empty_clients.h @@ -352,6 +352,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient { diff --git a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch index 5d2aae9b16dfa..785bc29c679d7 100644 --- a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -6,10 +6,10 @@ Subject: allow disabling blink scheduler throttling per RenderView This allows us to disable throttling for hidden windows. diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc -index f19a15f85afe2d754833667d8c272c75da3de0b2..18de1a2533b479a6090ed412987f0b5c3922c711 100644 +index 1f6d9be10432416f591a616805494b5d78975df1..e73f70c62ac2e69c918bdf39bd53f74a47066f4e 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc -@@ -661,6 +661,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) { +@@ -665,6 +665,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) { GetWidget()->GetAssociatedFrameWidget()->SetBackgroundOpaque(opaque); } @@ -22,10 +22,10 @@ index f19a15f85afe2d754833667d8c272c75da3de0b2..18de1a2533b479a6090ed412987f0b5c return is_active(); } diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h -index 64f6ebe2a86a659da70f32cdbdb961384adca43f..2fc1062eb798a233f0eede6dd945f25d633e5f8f 100644 +index 3ccc771a82992ae70c770fa6d2dde92904aa17db..505091e9006f7d41fa8d02e603afef1d10b35bf4 100644 --- a/content/browser/renderer_host/render_view_host_impl.h +++ b/content/browser/renderer_host/render_view_host_impl.h -@@ -136,6 +136,7 @@ class CONTENT_EXPORT RenderViewHostImpl +@@ -138,6 +138,7 @@ class CONTENT_EXPORT RenderViewHostImpl void EnablePreferredSizeMode() override; void WriteIntoTrace(perfetto::TracedProto context) const override; @@ -48,7 +48,7 @@ index 4d2a4c6746e1dbfc619faf2e16eaa4948d74e372..6c9f190ff595234eca18ff20ca0655da // This interface should only be implemented inside content. friend class RenderViewHostImpl; diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h -index fd145f0aa562d6b63fb1d3a8a9241ae1aa1ce7a0..54d30fb9db8b48b94abdb815c487f618f9bb6525 100644 +index 99978b33c294ebe37192baccb29f0a34a25aed17..ef6e9ae24979538b8746aca898d1f302827491d8 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -151,6 +151,8 @@ class CONTENT_EXPORT RenderViewImpl : public blink::WebViewClient, @@ -85,10 +85,10 @@ index 5e4032ccf916f969cd669af7d983becddb57c72b..a858c9f2fa609ae756a2e70d0362f2de // Visibility ----------------------------------------------------------- diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index 9704d8d8a4ee9e36c1a61c6723ce1039320014b6..cd14dd54e3c7bb56e82cbd6c566c11018b4deb94 100644 +index 229d9f2112e70f3bbff6e6986ab01c67483a1ae9..0529b4399959a2a2b9b0131dd8736a87fb973b0b 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -3698,6 +3698,13 @@ PageScheduler* WebViewImpl::Scheduler() const { +@@ -3711,6 +3711,13 @@ PageScheduler* WebViewImpl::Scheduler() const { return GetPage()->GetPageScheduler(); } @@ -102,7 +102,7 @@ index 9704d8d8a4ee9e36c1a61c6723ce1039320014b6..cd14dd54e3c7bb56e82cbd6c566c1101 void WebViewImpl::SetVisibilityState( mojom::blink::PageVisibilityState visibility_state, bool is_initial_state) { -@@ -3709,7 +3716,8 @@ void WebViewImpl::SetVisibilityState( +@@ -3722,7 +3729,8 @@ void WebViewImpl::SetVisibilityState( } GetPage()->SetVisibilityState(visibility_state, is_initial_state); GetPage()->GetPageScheduler()->SetPageVisible( @@ -113,10 +113,10 @@ index 9704d8d8a4ee9e36c1a61c6723ce1039320014b6..cd14dd54e3c7bb56e82cbd6c566c1101 mojom::blink::PageVisibilityState WebViewImpl::GetVisibilityState() { diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h -index 51ab4f029e467fa5ea2663af38445d9565e19fe4..18005ca7a272d7731a4b8eeeac92ce163c2a262e 100644 +index 2f8e971ab224b36c6e464eb7524dd3d4c6b76f8c..4a9664d0ce5de431d9638e4145a21091cea78fd1 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h -@@ -419,6 +419,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, +@@ -418,6 +418,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, LocalDOMWindow* PagePopupWindow() const; PageScheduler* Scheduler() const override; @@ -124,7 +124,7 @@ index 51ab4f029e467fa5ea2663af38445d9565e19fe4..18005ca7a272d7731a4b8eeeac92ce16 void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state, bool is_initial_state) override; mojom::blink::PageVisibilityState GetVisibilityState() override; -@@ -854,6 +855,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, +@@ -865,6 +866,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, // If true, we send IPC messages when |preferred_size_| changes. bool send_preferred_size_changes_ = false; diff --git a/patches/chromium/allow_new_privileges_in_unsandboxed_child_processes.patch b/patches/chromium/allow_new_privileges_in_unsandboxed_child_processes.patch index 233e57bce4f26..31c19ddc9a29f 100644 --- a/patches/chromium/allow_new_privileges_in_unsandboxed_child_processes.patch +++ b/patches/chromium/allow_new_privileges_in_unsandboxed_child_processes.patch @@ -6,7 +6,7 @@ Subject: allow new privileges in unsandboxed child processes This allows unsandboxed renderers to launch setuid processes on Linux. diff --git a/content/browser/child_process_launcher_helper_linux.cc b/content/browser/child_process_launcher_helper_linux.cc -index 80db4cb5941ee84db1534c070c4daefef76d0faf..cf40ac56a9ce4bd4a28eb511b5f37d148e4be6ac 100644 +index b2b29e715d6e5ea427faf6829e935e91dd87d471..138b5da2e5ae85760faaeeff92168d1070b6f562 100644 --- a/content/browser/child_process_launcher_helper_linux.cc +++ b/content/browser/child_process_launcher_helper_linux.cc @@ -54,6 +54,18 @@ bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread( @@ -27,4 +27,4 @@ index 80db4cb5941ee84db1534c070c4daefef76d0faf..cf40ac56a9ce4bd4a28eb511b5f37d14 + } } - options->environment = delegate_->GetEnvironment(); + for (const auto& remapped_fd : file_data_->additional_remapped_fds) { diff --git a/patches/chromium/blink_local_frame.patch b/patches/chromium/blink_local_frame.patch index b682f15b7e390..931e0185041f2 100644 --- a/patches/chromium/blink_local_frame.patch +++ b/patches/chromium/blink_local_frame.patch @@ -15,7 +15,7 @@ Refs changes in: This patch reverts the changes to fix associated crashes in Electron. diff --git a/third_party/blink/renderer/core/frame/frame.cc b/third_party/blink/renderer/core/frame/frame.cc -index c136ea03ea961ce419d42c60efc646e4ddfe5693..4e635c3775df0f1b3b3d7551fba8f8d59d1b541b 100644 +index f370d230361c3ab524c0fc74facf8954840aa29f..0e62d29e44a971d49d70e485509d0b59f5cb31c7 100644 --- a/third_party/blink/renderer/core/frame/frame.cc +++ b/third_party/blink/renderer/core/frame/frame.cc @@ -123,14 +123,6 @@ bool Frame::Detach(FrameDetachType type) { @@ -49,7 +49,7 @@ index c136ea03ea961ce419d42c60efc646e4ddfe5693..4e635c3775df0f1b3b3d7551fba8f8d5 // 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 019b87a77fb7306bacdcda20e388cdfb8d3a6be8..f972ae236566248d3179d147e9692322153e326d 100644 +index d5ef00cb9870c2dc767d80595a39af4302c3e3c3..f3a2a9527f97902f357782eb445cf63777c77398 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc @@ -544,10 +544,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { diff --git a/patches/chromium/boringssl_build_gn.patch b/patches/chromium/boringssl_build_gn.patch index 05fde5454844e..ff94bf807a8e2 100644 --- a/patches/chromium/boringssl_build_gn.patch +++ b/patches/chromium/boringssl_build_gn.patch @@ -6,7 +6,7 @@ Subject: boringssl BUILD.gn Build BoringSSL with some extra functions that nodejs needs. diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn -index f222ae94a5a10ced84e41ef84560af46a910577f..c18d26de9a63befca3c77fe5ecd93975a016797f 100644 +index efcbdf378b61af0a4b0f2cd784160d95439e84e1..fc6bba3fdd71ee40bb38f7d95a2f4dccd82d3e17 100644 --- a/third_party/boringssl/BUILD.gn +++ b/third_party/boringssl/BUILD.gn @@ -44,6 +44,20 @@ config("no_asm_config") { diff --git a/patches/chromium/build_add_electron_tracing_category.patch b/patches/chromium/build_add_electron_tracing_category.patch index ff503b7c6cb89..f650856864da7 100644 --- a/patches/chromium/build_add_electron_tracing_category.patch +++ b/patches/chromium/build_add_electron_tracing_category.patch @@ -8,7 +8,7 @@ categories in use are known / declared. This patch is required for us to introduce a new Electron category for Electron-specific tracing. diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h -index 7528d88c5d40571f1dcbd02201128ba2eed0cf08..ae50430c441539eb6152a926d382fb0552f3c358 100644 +index a1a93418b0b0d56f92647aa1087bb4485c354201..191bfe2d3922d2e65f0be10d6436c50efc3b0880 100644 --- a/base/trace_event/builtin_categories.h +++ b/base/trace_event/builtin_categories.h @@ -80,6 +80,7 @@ diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index cfbf7076545a7..93c0696100b5a 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -11,10 +11,10 @@ if we ever align our .pak file generation with Chrome we can remove this patch. diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn -index 99ab95668a7d3a31339b576b4a3a6038f39c2795..92f43eac6d654ff8ebe57d291c4f77aa1b029895 100644 +index dc59a88bc930d4d7b8e606434d940cac5b834bd0..6a583029436f033dc2736b9d7407f26637936add 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn -@@ -173,11 +173,16 @@ if (!is_android && !is_mac) { +@@ -175,11 +175,16 @@ if (!is_android && !is_mac) { "common/crash_keys.h", ] @@ -33,10 +33,10 @@ index 99ab95668a7d3a31339b576b4a3a6038f39c2795..92f43eac6d654ff8ebe57d291c4f77aa "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index cb28e691fb863fe7739a7ca536170e6c7a76a315..eacc853e2b9fc3c9e448f419e02d7378da310e9e 100644 +index 79aa50fbb9944052163bfdf958c5add60a0151f8..9fce5f07a79f801253c6bd8658ed7dba902856ad 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4588,7 +4588,7 @@ static_library("browser") { +@@ -4479,7 +4479,7 @@ static_library("browser") { # On Windows, the hashes are embedded in //chrome:chrome_initial rather # than here in :chrome_dll. @@ -46,10 +46,10 @@ index cb28e691fb863fe7739a7ca536170e6c7a76a315..eacc853e2b9fc3c9e448f419e02d7378 sources += [ "certificate_viewer_stub.cc" ] } diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index 24a27fb4a47678be448d597c7e430ce28d23be11..664e9b0378d5b7c09fa66b7a10c7f938da14aab9 100644 +index 65bee9c9d02c6f95cce6ba60d69e2a1b879a1c2f..e26897337f8c96a493936ab1342eb6b7c2c63ffe 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -5841,7 +5841,6 @@ test("unit_tests") { +@@ -5870,7 +5870,6 @@ test("unit_tests") { deps += [ "//chrome:other_version", @@ -57,7 +57,7 @@ index 24a27fb4a47678be448d597c7e430ce28d23be11..664e9b0378d5b7c09fa66b7a10c7f938 "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/browser:chrome_process_finder", -@@ -5864,6 +5863,10 @@ test("unit_tests") { +@@ -5893,6 +5892,10 @@ test("unit_tests") { "//ui/resources", ] @@ -68,7 +68,7 @@ index 24a27fb4a47678be448d597c7e430ce28d23be11..664e9b0378d5b7c09fa66b7a10c7f938 ldflags = [ "/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll", "/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll", -@@ -6757,7 +6760,6 @@ test("unit_tests") { +@@ -6786,7 +6789,6 @@ test("unit_tests") { } deps += [ @@ -76,7 +76,7 @@ index 24a27fb4a47678be448d597c7e430ce28d23be11..664e9b0378d5b7c09fa66b7a10c7f938 "//chrome/browser:cart_db_content_proto", "//chrome/browser:coupon_db_content_proto", "//chrome/browser/media/router:test_support", -@@ -6856,6 +6858,10 @@ test("unit_tests") { +@@ -6887,6 +6889,10 @@ test("unit_tests") { } } diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 7844ee1c891a6..7f3714ced8c89 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -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 aa0be995df8c2f9fa0d84922d30c7e1cdf9025c8..e588b460aa32b4c984d593ed54e10310b59ace9b 100644 +index c983b5f4c20acba8a7d779a634cd1593ef69b1ae..e612764997277da3411d8040850756eb38996cca 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -6840,6 +6840,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -6922,6 +6922,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To(), params->frame_name, params->disposition, *params->features, @@ -21,10 +21,10 @@ index aa0be995df8c2f9fa0d84922d30c7e1cdf9025c8..e588b460aa32b4c984d593ed54e10310 &no_javascript_access); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 6da28755d61f8957b0e6b6d0f1e669c2dbb347fa..a96bb634eb5c5405abb62b88d576e5e3ed354caa 100644 +index b94e87b6f90c986f115a87baf8214baeb8103826..987e437641b7978290aa2633755b67f9099e1d04 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -3951,6 +3951,14 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -3912,6 +3912,14 @@ FrameTree* WebContentsImpl::CreateNewWindow( } auto* new_contents_impl = new_contents.get(); @@ -39,7 +39,7 @@ index 6da28755d61f8957b0e6b6d0f1e669c2dbb347fa..a96bb634eb5c5405abb62b88d576e5e3 new_contents_impl->GetController().SetSessionStorageNamespace( partition_config, session_storage_namespace); -@@ -3995,12 +4003,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -3956,12 +3964,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( AddWebContentsDestructionObserver(new_contents_impl); } @@ -53,7 +53,7 @@ index 6da28755d61f8957b0e6b6d0f1e669c2dbb347fa..a96bb634eb5c5405abb62b88d576e5e3 new_contents_impl, opener, params.target_url, params.referrer.To(), params.disposition, diff --git a/content/common/frame.mojom b/content/common/frame.mojom -index a7f36529608011013dab96a803ad3187c940fc81..2bbcea3efede2fda4ff2c5b270e1db0135c54290 100644 +index 5aca51ea4154941512e989048295c7de0475c14c..278accd8c6f14a4d91cc2ff4e336e365279c7b9b 100644 --- a/content/common/frame.mojom +++ b/content/common/frame.mojom @@ -569,6 +569,10 @@ struct CreateNewWindowParams { @@ -68,10 +68,10 @@ index a7f36529608011013dab96a803ad3187c940fc81..2bbcea3efede2fda4ff2c5b270e1db01 // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index 984205b3d1bb4acfde6c5d106118a88f866af341..e33a5c9c6d493cd4ac2664ea10390193e3e53fcc 100644 +index 82d33875526759dda05a1818543c0605382597f4..ec89c920f0e0ad3638749b1468bcd54f74b3cce5 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -581,6 +581,8 @@ bool ContentBrowserClient::CanCreateWindow( +@@ -594,6 +594,8 @@ bool ContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -81,10 +81,10 @@ index 984205b3d1bb4acfde6c5d106118a88f866af341..e33a5c9c6d493cd4ac2664ea10390193 bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 7e22f3e0b84f3e6b1ef7b1c5176665b38bd53629..f6d98708c436447ee6c93acb5d476719c238ca9c 100644 +index e2c88a7e692406c9774a0e9783df612cbc38d7cd..4e069af9256eb106b50e84d1243c92353daf2015 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -168,6 +168,7 @@ class NetworkService; +@@ -165,6 +165,7 @@ class NetworkService; class TrustedURLLoaderHeaderClient; } // namespace mojom struct ResourceRequest; @@ -92,7 +92,7 @@ index 7e22f3e0b84f3e6b1ef7b1c5176665b38bd53629..f6d98708c436447ee6c93acb5d476719 } // namespace network namespace sandbox { -@@ -959,6 +960,8 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -968,6 +969,8 @@ class CONTENT_EXPORT ContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -102,7 +102,7 @@ index 7e22f3e0b84f3e6b1ef7b1c5176665b38bd53629..f6d98708c436447ee6c93acb5d476719 bool opener_suppressed, bool* no_javascript_access); diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index 9bbc7cf6d9542a3f013313e0c497839da2beb9d1..c01e06b08b1cca7a663e30476a551904ce9c6db8 100644 +index daf9b4566396c6d681760329cf4ba6869bbb55e4..321d5cfc36e40f2a649e8ea5910f4082b71b62e1 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc @@ -26,6 +26,17 @@ namespace content { @@ -150,28 +150,28 @@ index 04aa4d993b331396ee20464f6e1d2da10c91c834..2556c044b6e28501a5fac9b0040e623b // typically happens when popups are created. virtual void WebContentsCreated(WebContents* source_contents, diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc -index 89b07508aef80680a847c106fea0e2fa58ff964b..6630af3583a6bac6135d46644280d6444fe981b8 100644 +index 03b637c4d3a68a2bff5a4e06f421f23f97f40911..6235fd626a377643851dbb98d4d089e5a59366db 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc -@@ -33,6 +33,7 @@ - #include "third_party/blink/public/platform/impression_conversions.h" +@@ -32,6 +32,7 @@ + #include "third_party/blink/public/mojom/page/page.mojom.h" #include "third_party/blink/public/platform/modules/video_capture/web_video_capture_impl_manager.h" #include "third_party/blink/public/platform/url_conversion.h" +#include "third_party/blink/public/platform/web_url_request_util.h" #include "third_party/blink/public/web/modules/mediastream/web_media_stream_device_observer.h" #include "third_party/blink/public/web/web_frame_widget.h" #include "third_party/blink/public/web/web_local_frame.h" -@@ -295,6 +296,10 @@ WebView* RenderViewImpl::CreateView( - params->impression = blink::ConvertWebImpressionToImpression(*impression); - } +@@ -302,6 +303,10 @@ WebView* RenderViewImpl::CreateView( + /*openee_can_access_opener_origin=*/true, !creator->IsAllowedToDownload(), + creator->IsAdSubframe()); + params->raw_features = features.raw_features.Utf8( + WTF::UTF8ConversionMode::kStrictUTF8ConversionReplacingUnpairedSurrogatesWithFFFD); + params->body = GetRequestBodyForWebURLRequest(request); + - params->download_policy.ApplyDownloadFramePolicy( - /*is_opener_navigation=*/false, request.HasUserGesture(), - // `openee_can_access_opener_origin` only matters for opener navigations, + // We preserve this information before sending the message since |params| is + // moved on send. + bool is_background_tab = diff --git a/content/web_test/browser/web_test_content_browser_client.cc b/content/web_test/browser/web_test_content_browser_client.cc index 2e7c332565ebe33b00ab7fff96a6a8dfc61422a6..0ab061f51d1d0c93f23bfcf5ba051172cea37eb8 100644 --- a/content/web_test/browser/web_test_content_browser_client.cc @@ -199,13 +199,13 @@ index 00e2a8c21d4f0ef00c942498251fa44065da63c0..0fc4b092fa276063e05f990bf920fecd bool opener_suppressed, bool* no_javascript_access) override; diff --git a/third_party/blink/public/web/web_window_features.h b/third_party/blink/public/web/web_window_features.h -index 84d32491a56528a84b4395fba1d54cdbb38d522b..09998a83c449ef8cd9f360fbcdcf7edc0bbfa4a9 100644 +index 34570168ccb123f5102dcf8fa6bbf98e7c373ec6..192701e56d258da41b3724292853885e4daf3420 100644 --- a/third_party/blink/public/web/web_window_features.h +++ b/third_party/blink/public/web/web_window_features.h @@ -34,6 +34,7 @@ #include "third_party/abseil-cpp/absl/types/optional.h" - #include "third_party/blink/public/platform/web_impression.h" + #include "third_party/blink/public/common/navigation/impression.h" +#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink { @@ -213,17 +213,17 @@ index 84d32491a56528a84b4395fba1d54cdbb38d522b..09998a83c449ef8cd9f360fbcdcf7edc @@ -68,6 +69,8 @@ struct WebWindowFeatures { // Represents the attribution source declared by Attribution Reporting related // window features, if any. - absl::optional impression; + absl::optional impression; + + String raw_features; }; } // 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 ea47699384318126fef1a8c4cc3cb881cdc8e624..22d63b9f89913878518294f19afc85550196ca3e 100644 +index a25203186cc2df437fe3f9fe309599d86284aefb..b288472c5a00d76077859f02c0e1abca826aa8be 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc -@@ -2088,6 +2088,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, +@@ -2093,6 +2093,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, WebWindowFeatures window_features = GetWindowFeaturesFromString(features, incumbent_window); diff --git a/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch b/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch index dfbf2c9b770cd..e44f77536c7f9 100644 --- a/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch +++ b/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch @@ -9,7 +9,7 @@ we're running with contextIsolation enabled, we should be falling back to Blink's logic. This will be upstreamed in some form. diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -index 90d3a635eec331130b738d0839cc9fdfa60ce451..9eb900ff4449f277f8c5ab3ccc29b0aa725be356 100644 +index f417dca0103ddfd8ce6e3b3a4d033ea42133604e..d0ee37d147243858d997be230c12ea3e41e6c873 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc @@ -448,8 +448,9 @@ CodeGenerationCheckCallbackInMainThread(v8::Local context, diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index 492d73768b2f9..a72ce1e616d02 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -35,7 +35,7 @@ index 5b4d70991e19edcdfee731c56251932bf43e535f..4d996e3821410b2325ef85499f8c307c #endif // CHROME_BROWSER_ANDROID_DOCUMENT_DOCUMENT_WEB_CONTENTS_DELEGATE_H_ diff --git a/chrome/browser/media/offscreen_tab.cc b/chrome/browser/media/offscreen_tab.cc -index 27452df45433e4aeb7b9008f8e5b91dd4b5f50db..5c6f9936e6d3d2647d7efbc70efda8551c5516c7 100644 +index 370a2eaf18f86e16d4198a4f0001f96abfebad07..72f7032a8fe2011a0bd80d557e661fc487c3b876 100644 --- a/chrome/browser/media/offscreen_tab.cc +++ b/chrome/browser/media/offscreen_tab.cc @@ -285,8 +285,7 @@ bool OffscreenTab::IsWebContentsCreationOverridden( @@ -63,10 +63,10 @@ index faa684c429e8cd5817c043db48dcbea33c6c8782..8b5991bc8279585cc0749f6816aa8a03 content::RenderFrameHost* requesting_frame, const blink::mojom::FullscreenOptions& options) final; diff --git a/chrome/browser/ui/ash/ash_web_view_impl.cc b/chrome/browser/ui/ash/ash_web_view_impl.cc -index 46e5ec4d834e9478db523a5a078218104c161a57..e584921a6d575740fc0331a8bac05904558efc15 100644 +index 2c877ddbb8c1448a73c0f0e0af27c7fecb1b7848..e1dfc70c951dd004dd8b37607dc8840b804a1e54 100644 --- a/chrome/browser/ui/ash/ash_web_view_impl.cc +++ b/chrome/browser/ui/ash/ash_web_view_impl.cc -@@ -83,10 +83,9 @@ bool AshWebViewImpl::IsWebContentsCreationOverridden( +@@ -84,10 +84,9 @@ bool AshWebViewImpl::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -94,7 +94,7 @@ index f0333177f885000fb22818ffa30a0c4ad520a161..03e82957f9d7bf009dcbf5fcd43718c9 content::WebContents* source, const content::OpenURLParams& params) override; diff --git a/chrome/browser/ui/ash/keyboard/chrome_keyboard_web_contents.cc b/chrome/browser/ui/ash/keyboard/chrome_keyboard_web_contents.cc -index 6688ba8ba2fb7d930773144cdbc43f1f6fa2b685..22015c7b9b50e1264551ce226757f90e29191d8f 100644 +index caa6c2dbc6dbf87081da9a2e5c42e9ac2e60c77f..ac0b7dbee8195be8c165444a141629475e97a107 100644 --- a/chrome/browser/ui/ash/keyboard/chrome_keyboard_web_contents.cc +++ b/chrome/browser/ui/ash/keyboard/chrome_keyboard_web_contents.cc @@ -71,8 +71,7 @@ class ChromeKeyboardContentsDelegate : public content::WebContentsDelegate, @@ -108,10 +108,10 @@ index 6688ba8ba2fb7d930773144cdbc43f1f6fa2b685..22015c7b9b50e1264551ce226757f90e } diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc -index 1837aac53e6e13aebb0eee00249b305e0c7192c9..cf0b500239f635decc718fb9cfceb3f3f5be23c6 100644 +index 706684de51b047abf2a355416a6361b7ed8542c9..5ccbde951b833bd9413a5c3506da5d982fb3b58e 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc -@@ -1798,12 +1798,11 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -1795,12 +1795,11 @@ bool Browser::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -127,10 +127,10 @@ index 1837aac53e6e13aebb0eee00249b305e0c7192c9..cf0b500239f635decc718fb9cfceb3f3 WebContents* Browser::CreateCustomWebContents( diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h -index 631c30c8f153e72cd92de457d8ba6f44574edbe6..a24181efacd35c3d7b9b0bcdc066dd0a0f7bc43a 100644 +index 1f02e2e3d3f510b52089fbc835c6401ed693f1b9..6116970cb65bb7699759fad4351497ab057e25c0 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h -@@ -828,8 +828,7 @@ class Browser : public TabStripModelObserver, +@@ -836,8 +836,7 @@ class Browser : public TabStripModelObserver, content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -218,10 +218,10 @@ index 2930898b03d7b7ef86d13733cec3cbe84105c166..76625339f42a867c8b68840253e91648 void SetContentsBounds(content::WebContents* source, const gfx::Rect& bounds) override; diff --git a/components/offline_pages/content/background_loader/background_loader_contents.cc b/components/offline_pages/content/background_loader/background_loader_contents.cc -index 2834e3ee5778185741779a473cf5157788a76cc5..64fcddc952065e574a84edd99e5b1b80febd3d26 100644 +index 9f46f0b26a0ea42d6bd36e7ec7459a1b2d9c789e..874b7c8d779f471214507417e35449c66b70c97d 100644 --- a/components/offline_pages/content/background_loader/background_loader_contents.cc +++ b/components/offline_pages/content/background_loader/background_loader_contents.cc -@@ -81,8 +81,7 @@ bool BackgroundLoaderContents::IsWebContentsCreationOverridden( +@@ -83,8 +83,7 @@ bool BackgroundLoaderContents::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -246,10 +246,10 @@ index c6bd5c19f8a7ceec17c9e32af5296a9617f3a619..02199b439fba7fdc617b7f7980d958b7 void AddNewContents(content::WebContents* source, std::unique_ptr new_contents, diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 1b616ba52d9c77c64c7f24a0d204ce36641dce38..0303ae1c4d8681bc1bf56eb9ff1fc13afd678706 100644 +index 6f09c04cc612d2ac58b62d44516eefa1b66d145c..407f734b77d1ed4876f01327df958847d60e9128 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -3899,8 +3899,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -3860,8 +3860,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( if (delegate_ && delegate_->IsWebContentsCreationOverridden( source_site_instance, params.window_container_type, @@ -260,7 +260,7 @@ index 1b616ba52d9c77c64c7f24a0d204ce36641dce38..0303ae1c4d8681bc1bf56eb9ff1fc13a static_cast(delegate_->CreateCustomWebContents( opener, source_site_instance, is_new_browsing_instance, diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index c01e06b08b1cca7a663e30476a551904ce9c6db8..9f50a8721560f734270308776f2f37ad49a8cb91 100644 +index 321d5cfc36e40f2a649e8ea5910f4082b71b62e1..e78e2aad4f13d7810027b65f321691091611fd2d 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc @@ -134,8 +134,7 @@ bool WebContentsDelegate::IsWebContentsCreationOverridden( @@ -344,10 +344,10 @@ index ef6faf317dd4168adf6fd530a7da0b80f9166dec..f401659a81d4aeaf71039d71eb8fec48 content::RenderFrameHost* opener, content::SiteInstance* source_site_instance, diff --git a/fuchsia/engine/browser/frame_impl.cc b/fuchsia/engine/browser/frame_impl.cc -index d2497be79bb5d7943589bb928e2fbe13f76aa3e3..54adf30432cf178f2d00630420e45cfa95551b54 100644 +index d815a972b079676e900be8e312909832ae81bde8..ae28b864fcc2f10007ce33774d2d787c91d65f41 100644 --- a/fuchsia/engine/browser/frame_impl.cc +++ b/fuchsia/engine/browser/frame_impl.cc -@@ -404,8 +404,7 @@ bool FrameImpl::IsWebContentsCreationOverridden( +@@ -406,8 +406,7 @@ bool FrameImpl::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -358,10 +358,10 @@ index d2497be79bb5d7943589bb928e2fbe13f76aa3e3..54adf30432cf178f2d00630420e45cfa // can catch bad client behavior while not interfering with normal operation. constexpr size_t kMaxPendingWebContentsCount = 10; diff --git a/fuchsia/engine/browser/frame_impl.h b/fuchsia/engine/browser/frame_impl.h -index f2054bca778784c223beb02de150cfeb31c52907..53bf6bc205e9c631597bfbda46f4a0b5b4bb72ed 100644 +index 50631a4db62448699e7701f7b4e950e8058896ae..13ba38e1cae39ea46e64313c6a9312e504603bbb 100644 --- a/fuchsia/engine/browser/frame_impl.h +++ b/fuchsia/engine/browser/frame_impl.h -@@ -307,8 +307,7 @@ class FrameImpl : public fuchsia::web::Frame, +@@ -309,8 +309,7 @@ class WEB_ENGINE_EXPORT FrameImpl : public fuchsia::web::Frame, content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -386,7 +386,7 @@ index 899b8beabdf1131a08583470ace5b468576eeab6..21ab4ae22c54846af78518e897dc23eb ->options() ->block_new_web_contents(); diff --git a/ui/views/controls/webview/web_dialog_view.cc b/ui/views/controls/webview/web_dialog_view.cc -index 749200efec166e0c29402a3d5e079f2e94460363..2cbc96e911291fb0b31c3f4a1444ded0be4521f5 100644 +index fb5239100bdc35d2d5cf47765c1bf1b285b20cf5..b4b2609ddbe0a0adfccffb4f4a0a56849579dd2d 100644 --- a/ui/views/controls/webview/web_dialog_view.cc +++ b/ui/views/controls/webview/web_dialog_view.cc @@ -427,8 +427,7 @@ bool WebDialogView::IsWebContentsCreationOverridden( diff --git a/patches/chromium/chrome_key_systems.patch b/patches/chromium/chrome_key_systems.patch index 62e2ef85c1b9f..831959365e6b5 100644 --- a/patches/chromium/chrome_key_systems.patch +++ b/patches/chromium/chrome_key_systems.patch @@ -7,7 +7,7 @@ Disable persiste licence support check for widevine cdm, as its not supported in the current version of chrome. diff --git a/chrome/renderer/media/chrome_key_systems.cc b/chrome/renderer/media/chrome_key_systems.cc -index 587144562fffda66cee9cbd23b16fb4e8607d208..a41bb82f8dcf292cf23aa8781bd5a5c52f11e578 100644 +index f3cf8498493526d125eb42a7c42f7ad85dbc1fc2..35ec5dc4d87ecc61bd0f48be4c5d5867e9f75cce 100644 --- a/chrome/renderer/media/chrome_key_systems.cc +++ b/chrome/renderer/media/chrome_key_systems.cc @@ -17,7 +17,9 @@ @@ -20,18 +20,18 @@ index 587144562fffda66cee9cbd23b16fb4e8607d208..a41bb82f8dcf292cf23aa8781bd5a5c5 #include "components/cdm/renderer/external_clear_key_key_system_properties.h" #include "components/cdm/renderer/widevine_key_system_properties.h" #include "content/public/renderer/render_thread.h" -@@ -183,12 +185,14 @@ SupportedCodecs GetSupportedCodecs(const media::CdmCapability& capability) { +@@ -184,12 +186,14 @@ SupportedCodecs GetSupportedCodecs(const media::CdmCapability& capability) { - // Returns persistent-license session support. - EmeSessionTypeSupport GetPersistentLicenseSupport(bool supported_by_the_cdm) { + // Returns whether persistent-license session can be supported. + bool CanSupportPersistentLicense() { +#if 0 // Do not support persistent-license if the process cannot persist data. // TODO(crbug.com/457487): Have a better plan on this. See bug for details. if (ChromeRenderThreadObserver::is_incognito_process()) { DVLOG(2) << __func__ << ": Not supported in incognito process."; - return EmeSessionTypeSupport::NOT_SUPPORTED; + return false; } +#endif - if (!supported_by_the_cdm) { - DVLOG(2) << __func__ << ": Not supported by the CDM."; + // On ChromeOS, platform verification is similar to CDM host verification. + #if BUILDFLAG(ENABLE_CDM_HOST_VERIFICATION) || BUILDFLAG(IS_CHROMEOS) diff --git a/patches/chromium/command-ismediakey.patch b/patches/chromium/command-ismediakey.patch index ab63b9153c409..275b2e7299f2c 100644 --- a/patches/chromium/command-ismediakey.patch +++ b/patches/chromium/command-ismediakey.patch @@ -66,7 +66,7 @@ index eb3f3431a3774c3a05afd4c7350f3801e9c8c684..b8970ef9ddb69d6a9fc6d106293e7605 bool is_listening_ = false; diff --git a/chrome/browser/extensions/global_shortcut_listener_win.cc b/chrome/browser/extensions/global_shortcut_listener_win.cc -index 0f344ee352a48497e77a72bb298146c61e7fcf2a..3bad4263ea552fc63445bf5613f8add746a3a374 100644 +index 2778a18b6c28f3342c6b43d1de71fbbd46c72f06..85af551f87b8b0f9aed7a2a395ecf79f81f5a0a1 100644 --- a/chrome/browser/extensions/global_shortcut_listener_win.cc +++ b/chrome/browser/extensions/global_shortcut_listener_win.cc @@ -62,6 +62,8 @@ void GlobalShortcutListenerWin::OnWndProc(HWND hwnd, @@ -117,7 +117,7 @@ index 1145e1f3d79482b5bb468c3128431ac674310e5f..e9f595045e0c076e0735f27dfc38bfbc } // namespace ui diff --git a/ui/base/accelerators/media_keys_listener_mac.mm b/ui/base/accelerators/media_keys_listener_mac.mm -index ada705fb42e88d4bfa05b212c84111be9057a50e..a866b975687dd08ad88031a63f161b3164e82455 100644 +index 0bed8d1e2e2ed4a8cfc9d51ec3d68ac75bd9ff82..6914758849ca485f0f882d0b4a9ded9b02b197a8 100644 --- a/ui/base/accelerators/media_keys_listener_mac.mm +++ b/ui/base/accelerators/media_keys_listener_mac.mm @@ -32,6 +32,12 @@ KeyboardCode MediaKeyCodeToKeyboardCode(int key_code) { diff --git a/patches/chromium/crash_allow_setting_more_options.patch b/patches/chromium/crash_allow_setting_more_options.patch index fb4565d06bf81..0a049f6b24aad 100644 --- a/patches/chromium/crash_allow_setting_more_options.patch +++ b/patches/chromium/crash_allow_setting_more_options.patch @@ -75,7 +75,7 @@ index 24e53fa62c2c4a11494ad3d43f0c5a806930fcdd..9b691baa6cc90cc3f9ada307c43f44c4 // Used by WebView to sample crashes without generating the unwanted dumps. If // the returned value is less than 100, crash dumping will be sampled to that diff --git a/components/crash/core/app/crashpad_linux.cc b/components/crash/core/app/crashpad_linux.cc -index 32e2038e15adae14aa218a353f074cd6654bdc16..72bec9c08d7ec50257a86b0ee7173864d879d7d9 100644 +index 39fb479eba509f7ba1528cafecd1c6b21f3b0e76..a28b88d078560f05fa295f29dcf8b1865839285c 100644 --- a/components/crash/core/app/crashpad_linux.cc +++ b/components/crash/core/app/crashpad_linux.cc @@ -170,6 +170,7 @@ bool PlatformCrashpadInitialization( @@ -128,10 +128,10 @@ index dc041c43371fd58e3121ef6bc423aadb644bb8d0..a1fa566775724b4a1662a939fda3f0a5 arguments.push_back("--monitor-self"); } diff --git a/components/crash/core/app/crashpad_win.cc b/components/crash/core/app/crashpad_win.cc -index d2354b84f3a184ad53571518198055a0a91cbc25..c05529257dda2acf0fa588d49e2b902736d9b02f 100644 +index 80f33dc5e2f2ed330e0726a5735b247ea8e99fd7..b96bf703f6b691886d6e4d5cd6d775945a8995e1 100644 --- a/components/crash/core/app/crashpad_win.cc +++ b/components/crash/core/app/crashpad_win.cc -@@ -88,6 +88,7 @@ bool PlatformCrashpadInitialization( +@@ -90,6 +90,7 @@ bool PlatformCrashpadInitialization( std::map process_annotations; GetPlatformCrashpadAnnotations(&process_annotations); @@ -139,7 +139,7 @@ index d2354b84f3a184ad53571518198055a0a91cbc25..c05529257dda2acf0fa588d49e2b9027 std::string url = crash_reporter_client->GetUploadUrl(); -@@ -126,6 +127,13 @@ bool PlatformCrashpadInitialization( +@@ -128,6 +129,13 @@ bool PlatformCrashpadInitialization( std::vector arguments(start_arguments); diff --git a/patches/chromium/disable-redraw-lock.patch b/patches/chromium/disable-redraw-lock.patch index a102ba88e4f8d..5944ac0d05cdc 100644 --- a/patches/chromium/disable-redraw-lock.patch +++ b/patches/chromium/disable-redraw-lock.patch @@ -15,7 +15,7 @@ the redraw locking mechanism, which fixes these issues. The electron issue can be found at https://github.com/electron/electron/issues/1821 diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 2b69f4767e9073ea5f12acddf842c7f1dc82e2c1..a2f053c3e2588451458682aa6e86da52a591e1e7 100644 +index 15e33123f633b29db9937b76374ef9c03853defa..c24f24d7f53a8ed1c5614244a938f972706bdc61 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -308,6 +308,10 @@ constexpr int kSynthesizedMouseMessagesTimeDifference = 500; @@ -29,15 +29,17 @@ index 2b69f4767e9073ea5f12acddf842c7f1dc82e2c1..a2f053c3e2588451458682aa6e86da52 // A scoping class that prevents a window from being able to redraw in response // to invalidations that may occur within it for the lifetime of the object. // -@@ -359,6 +363,7 @@ class HWNDMessageHandler::ScopedRedrawLock { +@@ -358,7 +362,8 @@ class HWNDMessageHandler::ScopedRedrawLock { + hwnd_(owner_->hwnd()), cancel_unlock_(false), should_lock_(owner_->IsVisible() && !owner->HasChildRenderingWindow() && - ::IsWindow(hwnd_) && -+ !owner_->HasNativeFrame() && +- ::IsWindow(hwnd_) && !owner_->IsHeadless() && ++ ::IsWindow(hwnd_) && !owner_->HasNativeFrame() && ++ !owner_->IsHeadless() && (!(GetWindowLong(hwnd_, GWL_STYLE) & WS_CAPTION) || !ui::win::IsAeroGlassEnabled())) { if (should_lock_) -@@ -986,6 +991,10 @@ HWNDMessageHandler::RegisterUnadjustedMouseEvent() { +@@ -1015,6 +1020,10 @@ HWNDMessageHandler::RegisterUnadjustedMouseEvent() { return scoped_enable; } @@ -49,10 +51,10 @@ index 2b69f4767e9073ea5f12acddf842c7f1dc82e2c1..a2f053c3e2588451458682aa6e86da52 // HWNDMessageHandler, gfx::WindowImpl overrides: diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h -index f4efdc7174b90e57fb332f031530545e493a2e0d..9d45f97b930831a703efab2bbdf10afb61140c7f 100644 +index 3779c5028db164c70432d042876692822c7dd75c..98d4b486f978ba6e8c1641c759dc9002cea7c345 100644 --- a/ui/views/win/hwnd_message_handler.h +++ b/ui/views/win/hwnd_message_handler.h -@@ -205,6 +205,8 @@ class VIEWS_EXPORT HWNDMessageHandler : public gfx::WindowImpl, +@@ -206,6 +206,8 @@ class VIEWS_EXPORT HWNDMessageHandler : public gfx::WindowImpl, using TouchIDs = std::set; enum class DwmFrameState { kOff, kOn }; @@ -62,7 +64,7 @@ index f4efdc7174b90e57fb332f031530545e493a2e0d..9d45f97b930831a703efab2bbdf10afb HICON GetDefaultWindowIcon() const override; HICON GetSmallWindowIcon() const override; diff --git a/ui/views/win/hwnd_message_handler_delegate.h b/ui/views/win/hwnd_message_handler_delegate.h -index d8e0f1d3131aef80c9fcb6069df7d7f986af6605..5dbb192d0840ca0ded61397c399b774a8cb05cce 100644 +index caff85f683b7a67f14f4e66b588e40b9704c2bc3..210f39f68b839684c4ba0a4c57a76df44ddad7dc 100644 --- a/ui/views/win/hwnd_message_handler_delegate.h +++ b/ui/views/win/hwnd_message_handler_delegate.h @@ -46,6 +46,8 @@ class VIEWS_EXPORT HWNDMessageHandlerDelegate { diff --git a/patches/chromium/disable_color_correct_rendering.patch b/patches/chromium/disable_color_correct_rendering.patch index f5a01a7b3ca69..6c05f861afee5 100644 --- a/patches/chromium/disable_color_correct_rendering.patch +++ b/patches/chromium/disable_color_correct_rendering.patch @@ -20,10 +20,10 @@ to deal with color spaces. That is being tracked at https://crbug.com/634542 and https://crbug.com/711107. diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc -index f3f1d19619717f0f0493ab1ec90f47fd16bdd574..10bdf83528295d50cde496ade386a3546aa7bfc2 100644 +index bae9dd70c7657bf2bf66ab237d35440c14e7f6fb..796c3101103465bac8a7c177185c570dcc757fc1 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc -@@ -1880,6 +1880,9 @@ void LayerTreeHostImpl::SetIsLikelyToRequireADraw( +@@ -1863,6 +1863,9 @@ void LayerTreeHostImpl::SetIsLikelyToRequireADraw( TargetColorParams LayerTreeHostImpl::GetTargetColorParams( gfx::ContentColorUsage content_color_usage) const { TargetColorParams params; @@ -34,7 +34,7 @@ index f3f1d19619717f0f0493ab1ec90f47fd16bdd574..10bdf83528295d50cde496ade386a354 // If we are likely to software composite the resource, we use sRGB because // software compositing is unable to perform color conversion. diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h -index f6094a5defe12c34564020b0779626b3e5bff99e..a068a9ba33d3f8c8cdc74ae63ab5e16caa0b90c3 100644 +index 14a2e02d9a6edc3a7002ca43bc82c8ef98eb32b5..10abba0f0610719cc4be0ce792ce64aba43bbe04 100644 --- a/cc/trees/layer_tree_settings.h +++ b/cc/trees/layer_tree_settings.h @@ -93,6 +93,8 @@ class CC_EXPORT LayerTreeSettings { @@ -80,7 +80,7 @@ index 6a830ec9f29b9764cd425f0681dafbb18d90b457..a7a095ceb9e626c79db21e0d16c8ef47 !command_line->HasSwitch(switches::kUIDisablePartialSwap); diff --git a/components/viz/service/display/gl_renderer.cc b/components/viz/service/display/gl_renderer.cc -index 7fb664525ba696626544c8b09597105bff874c05..b987d649ef84451a9d3e5c2f87da3eb06c19c4d6 100644 +index e0a8510a9e1d1475bfe92153db8cf860fbba74b5..5c01d58b3121ecf81d0971179ada834ca37d54a1 100644 --- a/components/viz/service/display/gl_renderer.cc +++ b/components/viz/service/display/gl_renderer.cc @@ -87,6 +87,9 @@ @@ -194,9 +194,9 @@ index 7fb664525ba696626544c8b09597105bff874c05..b987d649ef84451a9d3e5c2f87da3eb0 + DCHECK(dst_color_space.IsValid()); + } gfx::ColorSpace adjusted_src_color_space = src_color_space; - if (adjust_src_white_level && src_color_space.IsHDR()) { - // TODO(b/183236148): consider using the destination's HDR static metadata -@@ -4084,9 +4096,9 @@ void GLRenderer::CopyRenderPassDrawQuadToOverlayResource( + + ProgramKey program_key = program_key_no_color; +@@ -4075,9 +4087,9 @@ void GLRenderer::CopyRenderPassDrawQuadToOverlayResource( cc::MathUtil::CheckedRoundUp(iosurface_height, iosurface_multiple); } @@ -209,7 +209,7 @@ index 7fb664525ba696626544c8b09597105bff874c05..b987d649ef84451a9d3e5c2f87da3eb0 *new_bounds = gfx::RectF(updated_dst_rect.origin(), gfx::SizeF((*overlay_texture)->texture.size())); -@@ -4305,8 +4317,9 @@ void GLRenderer::FlushOverdrawFeedback(const gfx::Rect& output_rect) { +@@ -4296,8 +4308,9 @@ void GLRenderer::FlushOverdrawFeedback(const gfx::Rect& output_rect) { PrepareGeometry(SHARED_BINDING); @@ -221,17 +221,17 @@ index 7fb664525ba696626544c8b09597105bff874c05..b987d649ef84451a9d3e5c2f87da3eb0 gfx::Transform render_matrix; render_matrix.Translate(0.5 * output_rect.width() + output_rect.x(), -@@ -4512,3 +4525,5 @@ bool GLRenderer::ColorTransformKey::operator<( +@@ -4503,3 +4516,5 @@ bool GLRenderer::ColorTransformKey::operator<( } } // namespace viz + +#undef PATCH_CS diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc -index 11e2a00aaffeba9379c0f2c41e6300d3020c7a88..9cfd058861a506bc3d6f72e5ed4a37b60ff4454b 100644 +index e0df775b22507336c249ed10fc0251dbbca088b8..2ba12303c28c39aa2e8f88b4a0e14a60e65b9df8 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc -@@ -227,6 +227,7 @@ GpuTerminationStatus ConvertToGpuTerminationStatus( +@@ -229,6 +229,7 @@ GpuTerminationStatus ConvertToGpuTerminationStatus( // Command-line switches to propagate to the GPU process. static const char* const kSwitchNames[] = { @@ -240,10 +240,10 @@ index 11e2a00aaffeba9379c0f2c41e6300d3020c7a88..9cfd058861a506bc3d6f72e5ed4a37b6 sandbox::policy::switches::kGpuSandboxAllowSysVShm, sandbox::policy::switches::kGpuSandboxFailuresFatal, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 0c8d0735523d388d0e68d2ad0b20a1c2525502ed..089b8e85776874938cfdafad0c3576562a78c1b0 100644 +index 8aa14d7cdb7edc5d53736fb959e3f9992d4fd896..da4830ccc3c3a160754dd9c89fc6292d7333ac67 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -198,6 +198,7 @@ +@@ -199,6 +199,7 @@ #include "ui/accessibility/accessibility_switches.h" #include "ui/base/ui_base_switches.h" #include "ui/display/display_switches.h" @@ -251,7 +251,7 @@ index 0c8d0735523d388d0e68d2ad0b20a1c2525502ed..089b8e85776874938cfdafad0c357656 #include "ui/gl/gl_switches.h" #include "url/gurl.h" #include "url/origin.h" -@@ -3217,6 +3218,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( +@@ -3175,6 +3176,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( // Propagate the following switches to the renderer command line (along // with any associated values) if present in the browser command line. static const char* const kSwitchNames[] = { @@ -260,7 +260,7 @@ index 0c8d0735523d388d0e68d2ad0b20a1c2525502ed..089b8e85776874938cfdafad0c357656 sandbox::policy::switches::kDisableSeccompFilterSandbox, sandbox::policy::switches::kNoSandbox, diff --git a/third_party/blink/renderer/platform/graphics/canvas_color_params.cc b/third_party/blink/renderer/platform/graphics/canvas_color_params.cc -index 648f25d99884b99f49e26cd9f280a8a6ae63e1c7..0f87961ecd8c24e3ba82c6bae187a12c9b112bd4 100644 +index 75d7af9a79d4e7f2cd39e45496ab5fff66407638..b4ddafdd126edd16172f00448bbbd56eaf509b1f 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_color_params.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_color_params.cc @@ -4,6 +4,7 @@ @@ -292,7 +292,7 @@ index 648f25d99884b99f49e26cd9f280a8a6ae63e1c7..0f87961ecd8c24e3ba82c6bae187a12c } diff --git a/third_party/blink/renderer/platform/widget/compositing/layer_tree_settings.cc b/third_party/blink/renderer/platform/widget/compositing/layer_tree_settings.cc -index 4187a703f62f36ff14d3a95f4b116febd5242c09..8d3b82e802bbd011380df21915427aba26193952 100644 +index 9a5903820308299a1a480ecaaa1cbca9655f4093..705f1fce4d05694b92b4eb6de1044ae2232bb8ed 100644 --- a/third_party/blink/renderer/platform/widget/compositing/layer_tree_settings.cc +++ b/third_party/blink/renderer/platform/widget/compositing/layer_tree_settings.cc @@ -24,6 +24,7 @@ @@ -303,7 +303,7 @@ index 4187a703f62f36ff14d3a95f4b116febd5242c09..8d3b82e802bbd011380df21915427aba #include "ui/native_theme/native_theme_features.h" #include "ui/native_theme/overlay_scrollbar_constants_aura.h" -@@ -183,6 +184,9 @@ cc::LayerTreeSettings GenerateLayerTreeSettings( +@@ -185,6 +186,9 @@ cc::LayerTreeSettings GenerateLayerTreeSettings( settings.main_frame_before_activation_enabled = cmd.HasSwitch(cc::switches::kEnableMainFrameBeforeActivation); @@ -314,7 +314,7 @@ index 4187a703f62f36ff14d3a95f4b116febd5242c09..8d3b82e802bbd011380df21915427aba // is what the renderer uses if its not threaded. settings.enable_checker_imaging = diff --git a/ui/gfx/mac/io_surface.cc b/ui/gfx/mac/io_surface.cc -index e36187917ecec5d9e40009d1c394a07e72281919..de9698d577ab48358d06362fc78575fd0ad98d30 100644 +index e030f01e72d18ef08d04ffbc72a5abb9a7b485c5..25155263bede8a465eb3f3bc2960f173c8f14935 100644 --- a/ui/gfx/mac/io_surface.cc +++ b/ui/gfx/mac/io_surface.cc @@ -20,6 +20,7 @@ @@ -332,7 +332,7 @@ index e36187917ecec5d9e40009d1c394a07e72281919..de9698d577ab48358d06362fc78575fd + auto* cmd_line = base::CommandLine::ForCurrentProcess(); + if (cmd_line->HasSwitch(switches::kDisableColorCorrectRendering)) { + base::ScopedCFTypeRef system_icc( -+ CGColorSpaceCopyICCProfile(base::mac::GetSystemColorSpace())); ++ CGColorSpaceCopyICCData(base::mac::GetSystemColorSpace())); + IOSurfaceSetValue(io_surface, CFSTR("IOSurfaceColorSpace"), system_icc); + return true; + } @@ -340,7 +340,7 @@ index e36187917ecec5d9e40009d1c394a07e72281919..de9698d577ab48358d06362fc78575fd // Allow but ignore invalid color spaces. if (!color_space.IsValid()) return true; -@@ -312,6 +321,15 @@ IOSurfaceRef CreateIOSurface(const gfx::Size& size, +@@ -311,6 +320,15 @@ IOSurfaceRef CreateIOSurface(const gfx::Size& size, DCHECK_EQ(kIOReturnSuccess, r); } @@ -348,14 +348,14 @@ index e36187917ecec5d9e40009d1c394a07e72281919..de9698d577ab48358d06362fc78575fd + if (cmd_line->HasSwitch(switches::kDisableColorCorrectRendering)) { + CGColorSpaceRef color_space = base::mac::GetSystemColorSpace(); + base::ScopedCFTypeRef color_space_icc( -+ CGColorSpaceCopyICCProfile(color_space)); ++ CGColorSpaceCopyICCData(color_space)); + IOSurfaceSetValue(surface, CFSTR("IOSurfaceColorSpace"), color_space_icc); + return surface; + } + // Ensure that all IOSurfaces start as sRGB. - if (__builtin_available(macos 10.12, *)) { - IOSurfaceSetValue(surface, CFSTR("IOSurfaceColorSpace"), kCGColorSpaceSRGB); + IOSurfaceSetValue(surface, CFSTR("IOSurfaceColorSpace"), kCGColorSpaceSRGB); + diff --git a/ui/gfx/switches.cc b/ui/gfx/switches.cc index 0e8044c6d87008c51fd165c6ef8bdc3687d6cc29..78015868927602b5225f252f0a9182f61b8431dc 100644 --- a/ui/gfx/switches.cc diff --git a/patches/chromium/disable_compositor_recycling.patch b/patches/chromium/disable_compositor_recycling.patch index 522db3317eff0..ecc594be91742 100644 --- a/patches/chromium/disable_compositor_recycling.patch +++ b/patches/chromium/disable_compositor_recycling.patch @@ -6,19 +6,19 @@ Subject: fix: disabling compositor recycling Compositor recycling is useful for Chrome because there can be many tabs and spinning up a compositor for each one would be costly. In practice, Chrome uses the parent compositor code path of browser_compositor_view_mac.mm; the NSView of each tab is detached when it's hidden and attached when it's shown. For Electron, there is no parent compositor, so we're forced into the "own compositor" code path, which seems to be non-optimal and pretty ruthless in terms of the release of resources. Electron has no real concept of multiple tabs per window, so it should be okay to disable this ruthless recycling altogether in Electron. diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index c37193c2207fb4f20993a35e2ac6fde8f0727a45..8e81312b1424d37c756bbb93cb4020a693c9b380 100644 +index f36e046b2879c3cd24eac04b1cf5f5c62338a11f..06ca0f25bc575fa8508934fe498d599964a7f05d 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm -@@ -531,7 +531,11 @@ - browser_compositor_->GetDelegatedFrameHost()->HasSavedFrame(); - if (has_saved_frame) - TRACE_EVENT_BEGIN("cc", "RWHVMac::WasOccluded with saved frame"); +@@ -513,7 +513,11 @@ + return; + + host()->WasHidden(); - browser_compositor_->SetRenderWidgetHostIsHidden(true); + // Consider the RWHV occluded only if it is not attached to a window + // (e.g. unattached BrowserView). Otherwise we treat it as visible to + // prevent unnecessary compositor recycling. + const bool unattached = ![GetInProcessNSView() window]; + browser_compositor_->SetRenderWidgetHostIsHidden(unattached); - if (has_saved_frame) - TRACE_EVENT_END("cc"); } + + void RenderWidgetHostViewMac::SetSize(const gfx::Size& size) { diff --git a/patches/chromium/disable_hidden.patch b/patches/chromium/disable_hidden.patch index 5073b1291fd86..7b943409e321a 100644 --- a/patches/chromium/disable_hidden.patch +++ b/patches/chromium/disable_hidden.patch @@ -6,7 +6,7 @@ Subject: disable_hidden.patch Electron uses this to disable background throttling for hidden windows. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 730ac0aaf36da1842c7add66fbaea58baadf2e74..fcc45c987cfce94f5378d4aeee1cfe703178e133 100644 +index 18133ca75853394e616c3a816c1eb74b7da23fd9..273750752cdef18ccd7d54b9b28c524375bb3e8d 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -809,6 +809,9 @@ void RenderWidgetHostImpl::WasHidden() { @@ -20,7 +20,7 @@ index 730ac0aaf36da1842c7add66fbaea58baadf2e74..fcc45c987cfce94f5378d4aeee1cfe70 blink::mojom::PointerLockResult::kWrongDocument); diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h -index 2ae96b816427148f4f0adf39c549d37fe3d02619..0288d36642629d7ec1846cd977f378ff9c0afd40 100644 +index 65297e78ee11fb3e7f662408f65a263f9ae8c550..62d3bef655580b1bad1077de797cdadc04721f8e 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -879,6 +879,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl @@ -34,10 +34,10 @@ index 2ae96b816427148f4f0adf39c549d37fe3d02619..0288d36642629d7ec1846cd977f378ff // |routing_id| must not be MSG_ROUTING_NONE. // If this object outlives |delegate|, DetachDelegate() must be called when diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index a3eb86299d8d34262347ee093940e61af6eab348..cb99fd2eb69bba9b133664fb68076eeeb9576818 100644 +index dc52cc54d2a6078bef1cf9f09e8063011b4f5191..d9b9f49ea7fe9b0b6dec4ad49c112af4fc832691 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -605,7 +605,7 @@ void RenderWidgetHostViewAura::HideImpl() { +@@ -592,7 +592,7 @@ void RenderWidgetHostViewAura::HideImpl() { DCHECK(visibility_ == Visibility::HIDDEN || visibility_ == Visibility::OCCLUDED); diff --git a/patches/chromium/don_t_run_pcscan_notifythreadcreated_if_pcscan_is_disabled.patch b/patches/chromium/don_t_run_pcscan_notifythreadcreated_if_pcscan_is_disabled.patch index c5f653eb03980..75b2567794e49 100644 --- a/patches/chromium/don_t_run_pcscan_notifythreadcreated_if_pcscan_is_disabled.patch +++ b/patches/chromium/don_t_run_pcscan_notifythreadcreated_if_pcscan_is_disabled.patch @@ -49,7 +49,7 @@ index d51b37c8a2df11f71fa6056193100d00883db43d..b44002788cf4d4f5d754dd35dd193be2 #endif diff --git a/base/threading/platform_thread_win.cc b/base/threading/platform_thread_win.cc -index 5b179a2d15cfc4997410d9467bf9484f5cae0b9f..98296aa4e8d75e94b141694c592dfa83627861ff 100644 +index 5d01f8802e2144b9bb94d05b154bc5f5fa378b40..a872defd1c92f2ea590e5da1ecf34a6800dd4484 100644 --- a/base/threading/platform_thread_win.cc +++ b/base/threading/platform_thread_win.cc @@ -30,6 +30,7 @@ diff --git a/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch b/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch index ca244bbc8639c..7893453256944 100644 --- a/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch +++ b/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch @@ -11,10 +11,10 @@ This regressed in https://chromium-review.googlesource.com/c/chromium/src/+/2572 Upstream: https://chromium-review.googlesource.com/c/chromium/src/+/2598393 diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 1b021461f214287c94fb22b17d980c19e3f07dde..76691715d09a62a1edc0306dcac1d3e7e312fb1d 100644 +index 4aabe0781d9e4150dddce76a50b993d0b8da8068..4961f2db5bf80ad2b926617fe933bca4db5c82b7 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -2398,7 +2398,7 @@ const blink::WebView* RenderFrameImpl::GetWebView() const { +@@ -2400,7 +2400,7 @@ const blink::WebView* RenderFrameImpl::GetWebView() const { } const blink::web_pref::WebPreferences& RenderFrameImpl::GetBlinkPreferences() { diff --git a/patches/chromium/enable_reset_aspect_ratio.patch b/patches/chromium/enable_reset_aspect_ratio.patch index b69182027c9db..6f0014385b6f9 100644 --- a/patches/chromium/enable_reset_aspect_ratio.patch +++ b/patches/chromium/enable_reset_aspect_ratio.patch @@ -6,7 +6,7 @@ Subject: feat: enable setting aspect ratio to 0 Make SetAspectRatio accept 0 as valid input, which would reset to null. diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index ece3dfbee04cf941689e4f21f5176db010fda564..9fd052c00a484cd1acd2031fda79e6307fd01b60 100644 +index 28d01a952a31bc7df63dd70df167421c453a581c..172e250660d30d703c0c104c73f627d13797e2f4 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -530,7 +530,7 @@ void DesktopWindowTreeHostWin::SetOpacity(float opacity) { @@ -19,10 +19,10 @@ index ece3dfbee04cf941689e4f21f5176db010fda564..9fd052c00a484cd1acd2031fda79e630 aspect_ratio.height()); } diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index a2f053c3e2588451458682aa6e86da52a591e1e7..9e38d55d7156986e48ed6dcb3522d77358bfdb75 100644 +index c24f24d7f53a8ed1c5614244a938f972706bdc61..ee465b298240a21929abd438d930b9ce8afa6ffe 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -936,8 +936,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen) { +@@ -965,8 +965,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen) { } void HWNDMessageHandler::SetAspectRatio(float aspect_ratio) { diff --git a/patches/chromium/expose_setuseragent_on_networkcontext.patch b/patches/chromium/expose_setuseragent_on_networkcontext.patch index 714a99251bbb5..e2256f4f742e5 100644 --- a/patches/chromium/expose_setuseragent_on_networkcontext.patch +++ b/patches/chromium/expose_setuseragent_on_networkcontext.patch @@ -33,7 +33,7 @@ index 14c71cc69388da46f62d9835e2a06fef0870da02..9481ea08401ae29ae9c1d960491b05b3 } // namespace net diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index 6a331146e6fbf23e4177176f67fe534141579eb7..7f6974b8fbfe052902e6c0a55d386fb3a8b26558 100644 +index e351c6625fac1037040f639e55e0a2e48abf2538..1bb2e5b1d6d061961933b49bdcbe689efaeaa8f7 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc @@ -1407,6 +1407,13 @@ void NetworkContext::SetNetworkConditions( diff --git a/patches/chromium/extend_apply_webpreferences.patch b/patches/chromium/extend_apply_webpreferences.patch index c6d16910db2d2..216c2d3cb749a 100644 --- a/patches/chromium/extend_apply_webpreferences.patch +++ b/patches/chromium/extend_apply_webpreferences.patch @@ -12,10 +12,10 @@ Ideally we could add an embedder observer pattern here but that can be done in future work. diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index cd14dd54e3c7bb56e82cbd6c566c11018b4deb94..0b0b3a03a64ae6a321eeb27619f4f0ae5ee388cc 100644 +index 0529b4399959a2a2b9b0131dd8736a87fb973b0b..6870692202c40179870d7f00e20c7ce19bdb85ce 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -159,6 +159,7 @@ +@@ -161,6 +161,7 @@ #include "third_party/blink/renderer/core/timing/window_performance.h" #include "third_party/blink/renderer/platform/fonts/font_cache.h" #include "third_party/blink/renderer/platform/fonts/generic_font_family_settings.h" @@ -23,7 +23,7 @@ index cd14dd54e3c7bb56e82cbd6c566c11018b4deb94..0b0b3a03a64ae6a321eeb27619f4f0ae #include "third_party/blink/renderer/platform/graphics/image.h" #include "third_party/blink/renderer/platform/graphics/paint/cull_rect.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_record_builder.h" -@@ -1785,6 +1786,7 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, +@@ -1776,6 +1777,7 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, #if BUILDFLAG(IS_MAC) web_view_impl->SetMaximumLegibleScale( prefs.default_maximum_page_scale_factor); diff --git a/patches/chromium/feat_add_data_parameter_to_processsingleton.patch b/patches/chromium/feat_add_data_parameter_to_processsingleton.patch index 8a8f913281124..ae14136ebb6ad 100644 --- a/patches/chromium/feat_add_data_parameter_to_processsingleton.patch +++ b/patches/chromium/feat_add_data_parameter_to_processsingleton.patch @@ -65,10 +65,10 @@ index 5a64220aaf1309832dc0ad543e353de67fe0a779..55a2a78ce166a65cd11b26e0aa31968f #if BUILDFLAG(IS_WIN) bool EscapeVirtualization(const base::FilePath& user_data_dir); diff --git a/chrome/browser/process_singleton_posix.cc b/chrome/browser/process_singleton_posix.cc -index 9bb12894da06fc7d281daced754b240afa9bedeb..5762d0778c2f368019b75364e81b66fc4e2f5751 100644 +index 9d6ef0e143bdaf4a5043ebbb57d282d72d847433..fbc571666232742c9941ea07fea81508263d4ed3 100644 --- a/chrome/browser/process_singleton_posix.cc +++ b/chrome/browser/process_singleton_posix.cc -@@ -611,6 +611,7 @@ class ProcessSingleton::LinuxWatcher +@@ -606,6 +606,7 @@ class ProcessSingleton::LinuxWatcher // |reader| is for sending back ACK message. void HandleMessage(const std::string& current_dir, const std::vector& argv, @@ -76,7 +76,7 @@ index 9bb12894da06fc7d281daced754b240afa9bedeb..5762d0778c2f368019b75364e81b66fc SocketReader* reader); private: -@@ -665,13 +666,16 @@ void ProcessSingleton::LinuxWatcher::StartListening(int socket) { +@@ -660,13 +661,16 @@ void ProcessSingleton::LinuxWatcher::StartListening(int socket) { } void ProcessSingleton::LinuxWatcher::HandleMessage( @@ -95,7 +95,7 @@ index 9bb12894da06fc7d281daced754b240afa9bedeb..5762d0778c2f368019b75364e81b66fc // Send back "ACK" message to prevent the client process from starting up. reader->FinishWithACK(kACKToken, std::size(kACKToken) - 1); } else { -@@ -719,7 +723,8 @@ void ProcessSingleton::LinuxWatcher::SocketReader:: +@@ -714,7 +718,8 @@ void ProcessSingleton::LinuxWatcher::SocketReader:: } } @@ -105,7 +105,7 @@ index 9bb12894da06fc7d281daced754b240afa9bedeb..5762d0778c2f368019b75364e81b66fc const size_t kMinMessageLength = std::size(kStartToken) + 4; if (bytes_read_ < kMinMessageLength) { buf_[bytes_read_] = 0; -@@ -749,10 +754,28 @@ void ProcessSingleton::LinuxWatcher::SocketReader:: +@@ -744,10 +749,28 @@ void ProcessSingleton::LinuxWatcher::SocketReader:: tokens.erase(tokens.begin()); tokens.erase(tokens.begin()); @@ -135,7 +135,7 @@ index 9bb12894da06fc7d281daced754b240afa9bedeb..5762d0778c2f368019b75364e81b66fc fd_watch_controller_.reset(); // LinuxWatcher::HandleMessage() is in charge of destroying this SocketReader -@@ -781,8 +804,10 @@ void ProcessSingleton::LinuxWatcher::SocketReader::FinishWithACK( +@@ -776,8 +799,10 @@ void ProcessSingleton::LinuxWatcher::SocketReader::FinishWithACK( // ProcessSingleton::ProcessSingleton( const base::FilePath& user_data_dir, @@ -146,7 +146,7 @@ index 9bb12894da06fc7d281daced754b240afa9bedeb..5762d0778c2f368019b75364e81b66fc current_pid_(base::GetCurrentProcId()), watcher_(new LinuxWatcher(this)) { socket_path_ = user_data_dir.Append(chrome::kSingletonSocketFilename); -@@ -901,7 +926,8 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout( +@@ -896,7 +921,8 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout( sizeof(socket_timeout)); // Found another process, prepare our command line @@ -156,7 +156,7 @@ index 9bb12894da06fc7d281daced754b240afa9bedeb..5762d0778c2f368019b75364e81b66fc std::string to_send(kStartToken); to_send.push_back(kTokenDelimiter); -@@ -911,11 +937,21 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout( +@@ -906,11 +932,21 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout( to_send.append(current_dir.value()); const std::vector& argv = cmd_line.argv(); diff --git a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch index d48c35ad8194c..10e839cd9d536 100644 --- a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch +++ b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch @@ -103,7 +103,7 @@ index 4c4cc16db82d7434573f7740855fbe72d68815e6..f71290800b6bb51a39b1f86be36f02d6 string mime_type; diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc -index 44ea9794a42eb9d2f0bcff722a05e530dbfff10c..318da554d3326b376898689c80b576979c564c5e 100644 +index 8137159de740809e44bc3a3dc18c842455a6795d..7292a40382fffcc96998b04696f4a2934a2da9ee 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc @@ -468,6 +468,7 @@ URLLoader::URLLoader( diff --git a/patches/chromium/fix_aspect_ratio_with_max_size.patch b/patches/chromium/fix_aspect_ratio_with_max_size.patch index a562bd5cd3b15..fb9b97974a5f3 100644 --- a/patches/chromium/fix_aspect_ratio_with_max_size.patch +++ b/patches/chromium/fix_aspect_ratio_with_max_size.patch @@ -11,10 +11,10 @@ enlarge window above dimensions set during creation of the BrowserWindow. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 9e38d55d7156986e48ed6dcb3522d77358bfdb75..01ff95be00b3911749f66a136b2b5a6c02156bd3 100644 +index ee465b298240a21929abd438d930b9ce8afa6ffe..83702d83078b68047f4464613033bc25cee21791 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -3596,6 +3596,21 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param, +@@ -3625,6 +3625,21 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param, delegate_->GetMinMaxSize(&min_window_size, &max_window_size); min_window_size = delegate_->DIPToScreenSize(min_window_size); max_window_size = delegate_->DIPToScreenSize(max_window_size); diff --git a/patches/chromium/fix_crash_when_saving_edited_pdf_files.patch b/patches/chromium/fix_crash_when_saving_edited_pdf_files.patch index 832bba5787c3e..022773554260c 100644 --- a/patches/chromium/fix_crash_when_saving_edited_pdf_files.patch +++ b/patches/chromium/fix_crash_when_saving_edited_pdf_files.patch @@ -13,10 +13,10 @@ This patch can be removed should we choose to support chrome.fileSystem or support it enough to fix the crash. diff --git a/chrome/browser/resources/pdf/pdf_viewer.ts b/chrome/browser/resources/pdf/pdf_viewer.ts -index 22f7a86817fe4a2dc39913db349e81d93eef4874..c9509d84e25fd88d6ef13933099d582561fe5660 100644 +index 41e9cb083e2abfc48976f21e4ca45d175671f69f..90cd537d117894cb73af61787d7085fcedeaebbd 100644 --- a/chrome/browser/resources/pdf/pdf_viewer.ts +++ b/chrome/browser/resources/pdf/pdf_viewer.ts -@@ -858,26 +858,12 @@ export class PDFViewerElement extends PDFViewerBaseElement { +@@ -859,26 +859,12 @@ export class PDFViewerElement extends PDFViewerBaseElement { dataArray = [result.dataToSave]; } @@ -48,7 +48,7 @@ index 22f7a86817fe4a2dc39913db349e81d93eef4874..c9509d84e25fd88d6ef13933099d5825 } /** -@@ -985,30 +971,12 @@ export class PDFViewerElement extends PDFViewerBaseElement { +@@ -986,30 +972,12 @@ export class PDFViewerElement extends PDFViewerBaseElement { fileName = fileName + '.pdf'; } diff --git a/patches/chromium/fix_export_zlib_symbols.patch b/patches/chromium/fix_export_zlib_symbols.patch index 154bc672224a3..5effa32d57758 100644 --- a/patches/chromium/fix_export_zlib_symbols.patch +++ b/patches/chromium/fix_export_zlib_symbols.patch @@ -6,10 +6,10 @@ Subject: fix: export zlib symbols This patch sets ZLIB_DLL so that we properly export zlib symbols. diff --git a/third_party/zlib/BUILD.gn b/third_party/zlib/BUILD.gn -index 999b1de1b2ba1fff5dd92173300dc22b9aa5a865..2132d8ef92acd39bffe3bebddb80b4317e1f52b8 100644 +index ca58b86f7b5b760b8088eddfb2ab923290771e4d..5c786bccae90cfb6263cae2148a6d00c8e618b3f 100644 --- a/third_party/zlib/BUILD.gn +++ b/third_party/zlib/BUILD.gn -@@ -313,6 +313,10 @@ component("zlib") { +@@ -314,6 +314,10 @@ component("zlib") { defines = [] deps = [] diff --git a/patches/chromium/fix_expose_decrementcapturercount_in_web_contents_impl.patch b/patches/chromium/fix_expose_decrementcapturercount_in_web_contents_impl.patch index 6fa77fb4b861a..4180c938c9330 100644 --- a/patches/chromium/fix_expose_decrementcapturercount_in_web_contents_impl.patch +++ b/patches/chromium/fix_expose_decrementcapturercount_in_web_contents_impl.patch @@ -8,7 +8,7 @@ we invoke it in order to expose contents.decrementCapturerCount([stayHidden, sta to users. We should try to upstream this. diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index df1633d59070e19592a52f02a76bdd9006d7c6f0..e599e866d2f5e72259e5b34b65510a06b3209784 100644 +index 13253163b54c86b37c7b5654b674c5f920c81272..82c4963605707a0fa56b01b572c0ef9b0d093565 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h @@ -1820,7 +1820,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents, @@ -21,7 +21,7 @@ index df1633d59070e19592a52f02a76bdd9006d7c6f0..e599e866d2f5e72259e5b34b65510a06 // Calculates the PageVisibilityState for |visibility|, taking the capturing // state into account. diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index 2f14f906b51ce73a69cd780d70ad6264285138ac..b14695646fe75d213b4affa60a6d775ce2474238 100644 +index d5c2a922bba0ff0d5a4a22d9cd25be46fd09d4e1..86eefb4d6e2d571965be9f40269b7f4fc633d26e 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h @@ -673,6 +673,10 @@ class WebContents : public PageNavigator, diff --git a/patches/chromium/fix_properly_honor_printing_page_ranges.patch b/patches/chromium/fix_properly_honor_printing_page_ranges.patch index d174f13c97b6c..6d21c86fbadcf 100644 --- a/patches/chromium/fix_properly_honor_printing_page_ranges.patch +++ b/patches/chromium/fix_properly_honor_printing_page_ranges.patch @@ -100,7 +100,7 @@ index b7ba6ba4446963b08bce9fe416379169bd880378..7c621ea7a60725d08ee9ade68b65fd5b } else { // No need to bother, we don't know how many pages are available. diff --git a/ui/gtk/printing/print_dialog_gtk.cc b/ui/gtk/printing/print_dialog_gtk.cc -index d0143dc64f818ee662694576ce2aa9488114f1c7..e3cbaa1b9c91805f8a4f81e110c8a85591b5f380 100644 +index 8ff9cf6dec605d5f56f0325fb3a03826b425970c..20d06930e81ad4b2b1ee789599ba84c6ff83682d 100644 --- a/ui/gtk/printing/print_dialog_gtk.cc +++ b/ui/gtk/printing/print_dialog_gtk.cc @@ -242,6 +242,24 @@ void PrintDialogGtk::UpdateSettings( diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index ab8887f56ccd2..76157c2e242da 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -6,10 +6,10 @@ Subject: frame_host_manager.patch Allows embedder to intercept site instances created by chromium. diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc -index 2b8e23df6545ca438c4af8434120cc40c70e09ec..049350bc63d627e85b239d23b976c3a62381fd57 100644 +index c8f2abaf2991b415b117604d37e8fb8abded00a3..41b09cb5c3a73f72178db9efcf883bd04fe68d6d 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc -@@ -3206,6 +3206,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( +@@ -3217,6 +3217,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( request->ResetStateForSiteInstanceChange(); } @@ -20,10 +20,10 @@ index 2b8e23df6545ca438c4af8434120cc40c70e09ec..049350bc63d627e85b239d23b976c3a6 } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index f6d98708c436447ee6c93acb5d476719c238ca9c..505279149690d469fa979010435373e40a5c8c43 100644 +index 4e069af9256eb106b50e84d1243c92353daf2015..8e8ba0a946c3382045691b788566885fb0e41ce5 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -274,6 +274,11 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -271,6 +271,11 @@ class CONTENT_EXPORT ContentBrowserClient { virtual ~ContentBrowserClient() = default; diff --git a/patches/chromium/gin_enable_disable_v8_platform.patch b/patches/chromium/gin_enable_disable_v8_platform.patch index cf2e47b7c03da..3de96009621ac 100644 --- a/patches/chromium/gin_enable_disable_v8_platform.patch +++ b/patches/chromium/gin_enable_disable_v8_platform.patch @@ -38,10 +38,10 @@ index 20cfc2257e9ba25ec3f39f19db952ba6b6036c72..4efc13c79ae742fa1925d06431862745 // Returns whether `Initialize` has already been invoked in the process. // Initialization is a one-way operation (i.e., this method cannot return diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc -index 072387786cc70f7d0b7d3d31cebf86af69f98a30..9df4d0aa257e7b4ecacd8c7a4ad392c4a33ff177 100644 +index ec8de596ca5028e9d8c722cda082f0df668359ed..899ebbb1c2ba8d57532a1af43fcd5d44ac3a2de0 100644 --- a/gin/v8_initializer.cc +++ b/gin/v8_initializer.cc -@@ -352,7 +352,8 @@ void SetFlags(IsolateHolder::ScriptMode mode, +@@ -353,7 +353,8 @@ void SetFlags(IsolateHolder::ScriptMode mode, // static void V8Initializer::Initialize(IsolateHolder::ScriptMode mode, const std::string js_command_line_flags, @@ -51,7 +51,7 @@ index 072387786cc70f7d0b7d3d31cebf86af69f98a30..9df4d0aa257e7b4ecacd8c7a4ad392c4 static bool v8_is_initialized = false; if (v8_is_initialized) return; -@@ -362,7 +363,8 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode, +@@ -363,7 +364,8 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode, // See https://crbug.com/v8/11043 SetFlags(mode, js_command_line_flags); diff --git a/patches/chromium/gritsettings_resource_ids.patch b/patches/chromium/gritsettings_resource_ids.patch index 9ac43a88997b6..b9b2c2bd509dd 100644 --- a/patches/chromium/gritsettings_resource_ids.patch +++ b/patches/chromium/gritsettings_resource_ids.patch @@ -6,10 +6,10 @@ Subject: gritsettings_resource_ids.patch Add electron resources file to the list of resource ids generation. diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec -index 6cda63d5c6a0b7b2b41d01382b73dbdeea3651de..174e6a5265ec4186934a0bd0619ecf02073f4fe1 100644 +index 4ab466ef86340e97707bc5b14e0f0e67997c52a6..03d0b2f126c69df7af42095725a4f89880f0d634 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec -@@ -962,6 +962,11 @@ +@@ -955,6 +955,11 @@ "includes": [4960], }, diff --git a/patches/chromium/hack_plugin_response_interceptor_to_point_to_electron.patch b/patches/chromium/hack_plugin_response_interceptor_to_point_to_electron.patch index af8133b783c0f..392a9b6b9be46 100644 --- a/patches/chromium/hack_plugin_response_interceptor_to_point_to_electron.patch +++ b/patches/chromium/hack_plugin_response_interceptor_to_point_to_electron.patch @@ -8,7 +8,7 @@ require a largeish patch to get working, so just redirect it to our implementation instead. diff --git a/chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.cc b/chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.cc -index 9d7479bff662ca3c482e4672a9129e1f83100ebd..cfcc14087d9d5d9ab08ff9a5349a096ec75f4b6a 100644 +index 570359f62ce2ae59f2fe24cd56edf7e222b3d0bd..1d1fa2e2222435c88448b2577bbbd9c697196394 100644 --- a/chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.cc +++ b/chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.cc @@ -10,8 +10,8 @@ diff --git a/patches/chromium/hack_to_allow_gclient_sync_with_host_os_mac_on_linux_in_ci.patch b/patches/chromium/hack_to_allow_gclient_sync_with_host_os_mac_on_linux_in_ci.patch index 78f43d3d3642d..44ac6e99b22d1 100644 --- a/patches/chromium/hack_to_allow_gclient_sync_with_host_os_mac_on_linux_in_ci.patch +++ b/patches/chromium/hack_to_allow_gclient_sync_with_host_os_mac_on_linux_in_ci.patch @@ -11,10 +11,10 @@ If removing this patch causes no sync failures, it's safe to delete :+1: Ref https://chromium-review.googlesource.com/c/chromium/src/+/2953903 diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py -index 36786064cd26faf4968e8ee90fb382e95247e4de..ce9f4b6a0d4f3350f89e9ba4f02a5cbb064524c4 100755 +index 3a4bbeb6233f2735d5354c3faaeaef71c0f892a1..2a6891fb0af06d418fd3dc9ff7595f4b898c55df 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py -@@ -298,6 +298,8 @@ def GetDefaultHostOs(): +@@ -302,6 +302,8 @@ def GetDefaultHostOs(): 'win32': 'win', } default_host_os = _PLATFORM_HOST_OS_MAP.get(sys.platform, sys.platform) diff --git a/patches/chromium/load_v8_snapshot_in_browser_process.patch b/patches/chromium/load_v8_snapshot_in_browser_process.patch index a068b1a12a451..280c955d156f0 100644 --- a/patches/chromium/load_v8_snapshot_in_browser_process.patch +++ b/patches/chromium/load_v8_snapshot_in_browser_process.patch @@ -9,10 +9,10 @@ but due to the nature of electron, we need to load the v8 snapshot in the browser process. diff --git a/content/app/content_main_runner_impl.cc b/content/app/content_main_runner_impl.cc -index 0a0c6eb9567a96f569c25bad8ea98b4cd165b04a..0ce83c22636fce72e613893df30ca52b142077fd 100644 +index 4ea2ad7697bd4531f9538c16778b76ed7b439d74..bdc2e97e41705abe0f7b259635842c4f2e122b41 100644 --- a/content/app/content_main_runner_impl.cc +++ b/content/app/content_main_runner_impl.cc -@@ -252,11 +252,8 @@ void LoadV8SnapshotFile(const base::CommandLine& command_line) { +@@ -251,11 +251,8 @@ void LoadV8SnapshotFile(const base::CommandLine& command_line) { bool ShouldLoadV8Snapshot(const base::CommandLine& command_line, const std::string& process_type) { diff --git a/patches/chromium/mas-cgdisplayusesforcetogray.patch b/patches/chromium/mas-cgdisplayusesforcetogray.patch index 2793f24611e78..8f74c3cf1c77e 100644 --- a/patches/chromium/mas-cgdisplayusesforcetogray.patch +++ b/patches/chromium/mas-cgdisplayusesforcetogray.patch @@ -6,10 +6,10 @@ Subject: mas: avoid usage of CGDisplayUsesForceToGray Removes usage of the CGDisplayUsesForceToGray private API. diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm -index 335e8a576f9a66a20b5720dfd083708bf490587e..0abf4ae5c58bd841c013775f6df0b6065d6d77b1 100644 +index 596084265973b955a02c87babdefd43c7a1fc8e3..747718d5a0f58911e3f5f6e7a04a0a8d22238627 100644 --- a/ui/display/mac/screen_mac.mm +++ b/ui/display/mac/screen_mac.mm -@@ -156,7 +156,17 @@ DisplayMac BuildDisplayForScreen(NSScreen* screen) { +@@ -159,7 +159,17 @@ DisplayMac BuildDisplayForScreen(NSScreen* screen) { display.set_color_depth(Display::kDefaultBitsPerPixel); display.set_depth_per_component(Display::kDefaultBitsPerComponent); } diff --git a/patches/chromium/mas_avoid_usage_of_private_macos_apis.patch b/patches/chromium/mas_avoid_usage_of_private_macos_apis.patch index 825fccf47cfa2..39aae9ea0f7b5 100644 --- a/patches/chromium/mas_avoid_usage_of_private_macos_apis.patch +++ b/patches/chromium/mas_avoid_usage_of_private_macos_apis.patch @@ -76,10 +76,19 @@ index 61641e1ad8a47a4910918ff61523a23854745b81..d4a3e2282256f5a43235b40b4c9f46ca if ([ns_val isKindOfClass:[NSFont class]]) { return (CTFontRef)(cf_val); diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc -index 184cfa25dbc6cfa2a32be3f8d964ea359254f807..c9bfc4d8ca1408206244305d7634dcd51e99377c 100644 +index e12c36384ddc05554ed362bba2c0a8b418634f0a..1c740410de70ee5a888ee7cf406dfa3bccc28c9b 100644 --- a/base/process/launch_mac.cc +++ b/base/process/launch_mac.cc -@@ -26,8 +26,10 @@ extern "C" { +@@ -19,14 +19,19 @@ + #include "base/threading/scoped_blocking_call.h" + #include "base/threading/thread_restrictions.h" + #include "base/trace_event/base_tracing.h" ++#if defined(MAS_BUILD) ++#include ++#endif + + extern "C" { + // Changes the current thread's directory to a path or directory file // descriptor. libpthread only exposes a syscall wrapper starting in // macOS 10.12, but the system call dates back to macOS 10.5. On older OSes, // the syscall is issued directly. @@ -90,37 +99,35 @@ index 184cfa25dbc6cfa2a32be3f8d964ea359254f807..c9bfc4d8ca1408206244305d7634dcd5 int responsibility_spawnattrs_setdisclaim(posix_spawnattr_t attrs, int disclaim) API_AVAILABLE(macosx(10.14)); -@@ -96,21 +98,29 @@ class PosixSpawnFileActions { +@@ -95,13 +100,27 @@ class PosixSpawnFileActions { }; int ChangeCurrentThreadDirectory(const char* path) { -+ #if defined(MAS_BUILD) ++#if defined(MAS_BUILD) ++ #pragma clang diagnostic push ++ #pragma clang diagnostic ignored "-Wdeprecated-declarations" + return syscall(SYS___pthread_chdir, path); -+ #else - if (__builtin_available(macOS 10.12, *)) { - return pthread_chdir_np(path); - } else { - return syscall(SYS___pthread_chdir, path); - } -+ #endif ++ #pragma clang diagnostic pop ++#else + return pthread_chdir_np(path); ++#endif } // The recommended way to unset a per-thread cwd is to set a new value to an // invalid file descriptor, per libpthread-218.1.3/private/private.h. int ResetCurrentThreadDirectory() { -+ #if defined(MAS_BUILD) ++#if defined(MAS_BUILD) ++ #pragma clang diagnostic push ++ #pragma clang diagnostic ignored "-Wdeprecated-declarations" + return syscall(SYS___pthread_fchdir, -1); -+ #else - if (__builtin_available(macOS 10.12, *)) { - return pthread_fchdir_np(-1); - } else { - return syscall(SYS___pthread_fchdir, -1); - } -+ #endif ++ #pragma clang diagnostic pop ++#else + return pthread_fchdir_np(-1); ++#endif } struct GetAppOutputOptions { -@@ -230,11 +240,13 @@ Process LaunchProcess(const std::vector& argv, +@@ -221,11 +240,13 @@ Process LaunchProcess(const std::vector& argv, file_actions.Inherit(STDERR_FILENO); } @@ -163,7 +170,7 @@ index 0e842caf7b6487d94978c7b68fb5b222e330581f..5eafcd163ee1a05203a5eb76592a449f } // namespace diff --git a/sandbox/mac/sandbox_logging.cc b/sandbox/mac/sandbox_logging.cc -index 702224dce1871c07b07f6882e46d14fe532d6ed2..797cb6646171486797a5e5fbbb1b187e3a9f81d4 100644 +index f071b192208fdfb1b9da932fcbbf64f0712d8f8b..7481ec29aaaa7b9f40af4a1180dd779e60131ea5 100644 --- a/sandbox/mac/sandbox_logging.cc +++ b/sandbox/mac/sandbox_logging.cc @@ -32,9 +32,11 @@ @@ -176,11 +183,11 @@ index 702224dce1871c07b07f6882e46d14fe532d6ed2..797cb6646171486797a5e5fbbb1b187e } +#endif - namespace sandbox { + namespace sandbox::logging { + +@@ -71,9 +73,11 @@ void SendOsLog(Level level, const char* message) { -@@ -104,9 +106,11 @@ void SendAslLog(Level level, const char* message) { - asl_set(asl_message.get(), ASL_KEY_MSG, message); - asl_send(asl_client.get(), asl_message.get()); + os_log_with_type(log.get(), os_log_type, "%{public}s", message); +#if !defined(MAS_BUILD) if (level == Level::FATAL) { diff --git a/patches/chromium/mas_disable_custom_window_frame.patch b/patches/chromium/mas_disable_custom_window_frame.patch index 7579f306131a4..06cd665d2e11d 100644 --- a/patches/chromium/mas_disable_custom_window_frame.patch +++ b/patches/chromium/mas_disable_custom_window_frame.patch @@ -7,7 +7,7 @@ Disable private window frame APIs (NSNextStepFrame and NSThemeFrame) for MAS build. diff --git a/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm b/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm -index cf88f696a46ff0ac84bcf466b44d1080438426c1..7672eee30a811001a0149edfa4eed9dc6a4b11f6 100644 +index 4d8f9f89f03653221fc0b509aa0e15ff20e73574..7bd5094db9b1a8e9af4ecc118fed7b78178e1e58 100644 --- a/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm +++ b/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm @@ -9,6 +9,7 @@ @@ -18,7 +18,7 @@ index cf88f696a46ff0ac84bcf466b44d1080438426c1..7672eee30a811001a0149edfa4eed9dc @interface NSWindow (PrivateBrowserNativeWidgetAPI) + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle; @end -@@ -63,10 +64,13 @@ - (NSRect)_draggableFrame NS_DEPRECATED_MAC(10_10, 10_11) { +@@ -55,10 +56,13 @@ - (BOOL)_shouldCenterTrafficLights { @end @@ -32,7 +32,7 @@ index cf88f696a46ff0ac84bcf466b44d1080438426c1..7672eee30a811001a0149edfa4eed9dc + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle { // - NSThemeFrame and its subclasses will be nil if it's missing at runtime. if ([BrowserWindowFrame class]) -@@ -81,6 +85,8 @@ - (BOOL)_usesCustomDrawing { +@@ -73,6 +77,8 @@ - (BOOL)_usesCustomDrawing { return NO; } @@ -95,7 +95,7 @@ index 67ebc56bd7ee267c03a5543e10a6a41042fcaa38..af3ed27dea51c22ab32ce14686dd7807 // The NSWindow used by BridgedNativeWidget. Provides hooks into AppKit that // can only be accomplished by overriding methods. diff --git a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm -index 622b25c637ba14f287cbcdb4781967564d7e9eff..a21fe0aa19069a748b41e7d0781e20031c40fbfc 100644 +index 773158df97f36f69d2226c9ae748aa5eaade0c0b..ee17b53daf9e9c5b53f42704efbb565aeb8bfb01 100644 --- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm +++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm @@ -16,7 +16,9 @@ diff --git a/patches/chromium/mas_disable_remote_accessibility.patch b/patches/chromium/mas_disable_remote_accessibility.patch index 426b8591f4b1c..1d607671a6b66 100644 --- a/patches/chromium/mas_disable_remote_accessibility.patch +++ b/patches/chromium/mas_disable_remote_accessibility.patch @@ -44,10 +44,10 @@ index 306db835fe203f663b1d84dd3490b619eb3f60b2..7a41d7afe6197e0a78934206782b1063 } // namespace diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm -index 26a2fa4c0f39ea0254bee322f355d92a55ba3b4e..e42de9720456161c187d41d39487ee3272fa1cf9 100644 +index 4c76aafff03b76d78ab8c84e962cf96f8fefc091..32ac66e9ac5a643f5e4ddea979bf4239d441d23f 100644 --- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm +++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm -@@ -583,10 +583,12 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) { +@@ -579,10 +579,12 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) { // this should be treated as an error and caught early. CHECK(bridged_view_); @@ -114,10 +114,10 @@ index 0048862cb89d519b8c1c111f923e6dd960c855d6..c7b9124462b0779ed4d1b27fe167e653 // Used to force the NSApplication's focused accessibility element to be the // content::BrowserAccessibilityCocoa accessibility tree when the NSView for diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index 3fbe8be5b94817d48622590cb3acd271bf07db31..c37193c2207fb4f20993a35e2ac6fde8f0727a45 100644 +index b72b540492abd9d9060bb06996d2d849ac580aa2..f36e046b2879c3cd24eac04b1cf5f5c62338a11f 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm -@@ -255,8 +255,10 @@ +@@ -254,8 +254,10 @@ void RenderWidgetHostViewMac::MigrateNSViewBridge( remote_cocoa::mojom::Application* remote_cocoa_application, uint64_t parent_ns_view_id) { @@ -128,7 +128,7 @@ index 3fbe8be5b94817d48622590cb3acd271bf07db31..c37193c2207fb4f20993a35e2ac6fde8 // Disconnect from the previous bridge (this will have the effect of // destroying the associated bridge), and close the receiver (to allow it -@@ -1541,8 +1543,10 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1521,8 +1523,10 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, gfx::NativeViewAccessible RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() { @@ -139,7 +139,7 @@ index 3fbe8be5b94817d48622590cb3acd271bf07db31..c37193c2207fb4f20993a35e2ac6fde8 return [GetInProcessNSView() window]; } -@@ -1586,9 +1590,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1566,9 +1570,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, } void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) { @@ -151,7 +151,7 @@ index 3fbe8be5b94817d48622590cb3acd271bf07db31..c37193c2207fb4f20993a35e2ac6fde8 } bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame( -@@ -2083,12 +2089,14 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -2063,12 +2069,14 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, void RenderWidgetHostViewMac::SetRemoteAccessibilityWindowToken( const std::vector& window_token) { @@ -167,10 +167,10 @@ index 3fbe8be5b94817d48622590cb3acd271bf07db31..c37193c2207fb4f20993a35e2ac6fde8 /////////////////////////////////////////////////////////////////////////////// diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn -index 2e39255bdb26664e8bc2d0abb26c2359c9b84bd3..1425e9935b599b01fd53f43d0415a77002c92f00 100644 +index 4c996a80ae71aee8c2d259a7eb294fe3257ad9ac..5e897496539a365a5de15073f1dccb16db3987dd 100644 --- a/ui/base/BUILD.gn +++ b/ui/base/BUILD.gn -@@ -329,6 +329,13 @@ component("base") { +@@ -337,6 +337,13 @@ component("base") { sources += [ "resource/resource_bundle_lacros.cc" ] } @@ -205,7 +205,7 @@ index e7adfee3210ec723c687adfcc4bee8827ef643e7..25a924a47eeb30d783ef83dbb4896c4b + #endif // UI_BASE_COCOA_REMOTE_ACCESSIBILITY_API_H_ diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.h b/ui/views/cocoa/native_widget_mac_ns_window_host.h -index c93aedbce83c398a55c478df60d5ba6dd5324a0b..dfa1983e5605d14e44efae3c1418b4e53c392333 100644 +index 1ca8dab6cec9f4160f557d034deda9f3b98b9459..e6d3656c0a66d94cdbdb0141e7e44439e84aa8dd 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.h +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h @@ -31,7 +31,9 @@ @@ -218,7 +218,7 @@ index c93aedbce83c398a55c478df60d5ba6dd5324a0b..dfa1983e5605d14e44efae3c1418b4e5 @class NSView; namespace remote_cocoa { -@@ -452,11 +454,13 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost +@@ -445,11 +447,13 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost mojo::AssociatedRemote remote_ns_window_remote_; @@ -233,10 +233,10 @@ index c93aedbce83c398a55c478df60d5ba6dd5324a0b..dfa1983e5605d14e44efae3c1418b4e5 // 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 1c4c4a774e4d5e199ae50e8df4499a497d3b0674..b2265079021d10e2944b9474fafe32ccca95d3de 100644 +index e0a337647572929882c8dc4fdb6c1bcad54071df..2a18cbed5933419e2f8c830376bfee6ab1db9a9f 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -@@ -296,14 +296,22 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -294,14 +294,22 @@ void HandleAccelerator(const ui::Accelerator& accelerator, NativeWidgetMacNSWindowHost::GetNativeViewAccessibleForNSView() const { if (in_process_ns_window_bridge_) return in_process_ns_window_bridge_->ns_view(); @@ -259,7 +259,7 @@ index 1c4c4a774e4d5e199ae50e8df4499a497d3b0674..b2265079021d10e2944b9474fafe32cc } remote_cocoa::mojom::NativeWidgetNSWindow* -@@ -1287,6 +1295,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -1257,6 +1265,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens( const std::vector& window_token, const std::vector& view_token) { @@ -267,7 +267,7 @@ index 1c4c4a774e4d5e199ae50e8df4499a497d3b0674..b2265079021d10e2944b9474fafe32cc remote_window_accessible_ = ui::RemoteAccessibility::GetRemoteElementFromToken(window_token); remote_view_accessible_ = -@@ -1294,14 +1303,17 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -1264,14 +1273,17 @@ void HandleAccelerator(const ui::Accelerator& accelerator, [remote_view_accessible_ setWindowUIElement:remote_window_accessible_.get()]; [remote_view_accessible_ setTopLevelUIElement:remote_window_accessible_.get()]; diff --git a/patches/chromium/mas_disable_remote_layer.patch b/patches/chromium/mas_disable_remote_layer.patch index d9abef548d026..093c692d94b8f 100644 --- a/patches/chromium/mas_disable_remote_layer.patch +++ b/patches/chromium/mas_disable_remote_layer.patch @@ -16,7 +16,7 @@ cases where performance improves when disabling remote CoreAnimation (remote CoreAnimation is really only about battery usage). diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.h b/gpu/ipc/service/image_transport_surface_overlay_mac.h -index 1b84c9df5990d0905d068ca822d5173313a74edd..89a90a5c8e0c3ede1b0fe63d45c5768b42394474 100644 +index 7fc76ecb3292a892e2aa8c117cd6302f9ce63fa6..efd5da9daf8fbe80264b8b55eafc717317ba48e6 100644 --- a/gpu/ipc/service/image_transport_surface_overlay_mac.h +++ b/gpu/ipc/service/image_transport_surface_overlay_mac.h @@ -21,7 +21,9 @@ @@ -29,7 +29,17 @@ index 1b84c9df5990d0905d068ca822d5173313a74edd..89a90a5c8e0c3ede1b0fe63d45c5768b @class CALayer; namespace ui { -@@ -116,7 +118,9 @@ class ImageTransportSurfaceOverlayMacBase : public BaseClass, +@@ -115,7 +117,9 @@ class ImageTransportSurfaceOverlayMac : public gl::GLSurface, + base::WeakPtr delegate_; + + bool use_remote_layer_api_; ++#ifndef MAS_BUILD + base::scoped_nsobject ca_context_; ++#endif + std::unique_ptr ca_layer_tree_coordinator_; + + gfx::Size pixel_size_; +@@ -210,7 +214,9 @@ class ImageTransportSurfaceOverlayMacEGL : public gl::GLSurfaceEGL, base::WeakPtr delegate_; bool use_remote_layer_api_; @@ -40,27 +50,52 @@ index 1b84c9df5990d0905d068ca822d5173313a74edd..89a90a5c8e0c3ede1b0fe63d45c5768b gfx::Size pixel_size_; diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.mm b/gpu/ipc/service/image_transport_surface_overlay_mac.mm -index 547a5c4260b28d651d470e06c4c4e6bfa77ef966..01fee4e6b104aad68d52f30c9af3e9072f078e0c 100644 +index 43be379adb3df7dc31e59319c921cd89654db57a..bc495df301751628117356c8e68b5d121828ce85 100644 --- a/gpu/ipc/service/image_transport_surface_overlay_mac.mm +++ b/gpu/ipc/service/image_transport_surface_overlay_mac.mm -@@ -60,7 +60,7 @@ +@@ -59,6 +59,7 @@ + ca_layer_tree_coordinator_ = std::make_unique( + use_remote_layer_api_, allow_av_sample_buffer_display_layer); ++#ifndef MAS_BUILD + // Create the CAContext to send this to the GPU process, and the layer for + // the context. + if (use_remote_layer_api_) { +@@ -67,6 +68,7 @@ + options:@{}] retain]); + [ca_context_ setLayer:ca_layer_tree_coordinator_->GetCALayerForDisplay()]; + } ++#endif + } + + ImageTransportSurfaceOverlayMac::~ImageTransportSurfaceOverlayMac() { +@@ -146,7 +148,9 @@ + "GLImpl", static_cast(gl::GetGLImplementation()), + "width", pixel_size_.width()); + if (use_remote_layer_api_) { ++#ifndef MAS_BUILD + params.ca_layer_params.ca_context_id = [ca_context_ contextId]; ++#endif + } else { + IOSurfaceRef io_surface = + ca_layer_tree_coordinator_->GetIOSurfaceForDisplay(); +@@ -408,6 +412,7 @@ ca_layer_tree_coordinator_ = std::make_unique( use_remote_layer_api_, allow_av_sample_buffer_display_layer); -- + +#ifndef MAS_BUILD // Create the CAContext to send this to the GPU process, and the layer for // the context. if (use_remote_layer_api_) { -@@ -69,6 +69,7 @@ +@@ -416,6 +421,7 @@ options:@{}] retain]); [ca_context_ setLayer:ca_layer_tree_coordinator_->GetCALayerForDisplay()]; } +#endif } - template -@@ -160,7 +161,9 @@ + ImageTransportSurfaceOverlayMacEGL::~ImageTransportSurfaceOverlayMacEGL() { +@@ -496,7 +502,9 @@ "GLImpl", static_cast(gl::GetGLImplementation()), "width", pixel_size_.width()); if (use_remote_layer_api_) { diff --git a/patches/chromium/mas_no_private_api.patch b/patches/chromium/mas_no_private_api.patch index b28e29487b800..124bb9afbc651 100644 --- a/patches/chromium/mas_no_private_api.patch +++ b/patches/chromium/mas_no_private_api.patch @@ -122,7 +122,7 @@ index c15f3a631292b538698625328fb429ee3c9964f5..37e038753ecf1b82ec92c06b2c0729b5 } diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm -index d342eb4e9fc94de4365d86c2d1af4b85a8bf63a3..012f9ce97d9ed6b00deb718a88f432e053cb3bd1 100644 +index 69e60d498941c34cfac9e79c7517765bf93849f5..b998ad7cf01c21e93c57e1283cfdcb1e02ac49cf 100644 --- a/device/bluetooth/bluetooth_adapter_mac.mm +++ b/device/bluetooth/bluetooth_adapter_mac.mm @@ -42,6 +42,7 @@ @@ -141,8 +141,8 @@ index d342eb4e9fc94de4365d86c2d1af4b85a8bf63a3..012f9ce97d9ed6b00deb718a88f432e0 namespace { -@@ -123,8 +125,10 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) { - controller_state_function_( +@@ -114,8 +116,10 @@ bool IsDeviceSystemPaired(const std::string& device_address) { + : controller_state_function_( base::BindRepeating(&BluetoothAdapterMac::GetHostControllerState, base::Unretained(this))), +#ifndef MAS_BUILD @@ -152,7 +152,7 @@ index d342eb4e9fc94de4365d86c2d1af4b85a8bf63a3..012f9ce97d9ed6b00deb718a88f432e0 classic_discovery_manager_( BluetoothDiscoveryManagerMac::CreateClassic(this)), low_energy_discovery_manager_( -@@ -365,8 +369,12 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) { +@@ -356,8 +360,12 @@ bool IsDeviceSystemPaired(const std::string& device_address) { } bool BluetoothAdapterMac::SetPoweredImpl(bool powered) { @@ -166,7 +166,7 @@ index d342eb4e9fc94de4365d86c2d1af4b85a8bf63a3..012f9ce97d9ed6b00deb718a88f432e0 void BluetoothAdapterMac::RemovePairingDelegateInternal( diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn -index ebe37172d254e8441fe2b8c290bd5a59af38d754..6a131f5c41f3e43a1467efeec2ce63f6903691b7 100644 +index 1b849df0ee4c40a765a14bfaa75720f5570d4846..1f7a4fe36a96d076ddcfd9c9f092f95132d579dc 100644 --- a/media/audio/BUILD.gn +++ b/media/audio/BUILD.gn @@ -173,6 +173,12 @@ source_set("audio") { @@ -183,10 +183,10 @@ index ebe37172d254e8441fe2b8c290bd5a59af38d754..6a131f5c41f3e43a1467efeec2ce63f6 "AudioToolbox.framework", "AudioUnit.framework", diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc -index b8805f9174818ac086a5d6542c9962050f00aee8..5491b62a2e180b2f6e48e243e2ac78c3b1a16892 100644 +index eb0aff29b2f4fd2b035ef96186fd58d976876b05..8a68a8885ec42715c9b9dab0f04d1b90eb9baa6e 100644 --- a/media/audio/mac/audio_manager_mac.cc +++ b/media/audio/mac/audio_manager_mac.cc -@@ -887,7 +887,7 @@ AudioParameters AudioManagerMac::GetPreferredOutputStreamParameters( +@@ -885,7 +885,7 @@ AudioParameters AudioManagerMac::GetPreferredOutputStreamParameters( void AudioManagerMac::InitializeOnAudioThread() { DCHECK(GetTaskRunner()->BelongsToCurrentThread()); diff --git a/patches/chromium/mas_use_public_apis_to_determine_if_a_font_is_a_system_font.patch b/patches/chromium/mas_use_public_apis_to_determine_if_a_font_is_a_system_font.patch index 4a2895266232f..6ba1e0d11fdad 100644 --- a/patches/chromium/mas_use_public_apis_to_determine_if_a_font_is_a_system_font.patch +++ b/patches/chromium/mas_use_public_apis_to_determine_if_a_font_is_a_system_font.patch @@ -9,7 +9,7 @@ system font by checking if it's kCTFontPriorityAttribute is set to system priority. diff --git a/ui/gfx/platform_font_mac.mm b/ui/gfx/platform_font_mac.mm -index 99b4dffbd41dd5d53e4f8e7e0bfbbf3ecc6fcb43..db57e78efa22a26b71426d2960aeb7919ae6cf47 100644 +index 88262d4dd82b3a954ed09492c508ad83dece0256..81fad8ca63479737885f09be7cf05b8eada1f104 100644 --- a/ui/gfx/platform_font_mac.mm +++ b/ui/gfx/platform_font_mac.mm @@ -25,9 +25,11 @@ @@ -24,7 +24,7 @@ index 99b4dffbd41dd5d53e4f8e7e0bfbbf3ecc6fcb43..db57e78efa22a26b71426d2960aeb791 namespace { -@@ -232,7 +234,13 @@ NSInteger ToNSFontManagerWeight(Weight weight) { +@@ -220,7 +222,13 @@ NSInteger ToNSFontManagerWeight(Weight weight) { // TODO(avi, etienneb): Figure out this font stuff. base::ScopedCFTypeRef descriptor( CTFontCopyFontDescriptor(font)); diff --git a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch index 0bfd677514878..af9c65ee153b1 100644 --- a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch +++ b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch @@ -7,7 +7,7 @@ This adds a callback from the network service that's used to implement session.setCertificateVerifyCallback. diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index 12d74d8751802b06198952682bfc99f18e5f8df8..6a331146e6fbf23e4177176f67fe534141579eb7 100644 +index 812cfebfbe4f95cf38ce2fcd115a5a363f51363e..e351c6625fac1037040f639e55e0a2e48abf2538 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc @@ -128,6 +128,11 @@ @@ -128,7 +128,7 @@ index 12d74d8751802b06198952682bfc99f18e5f8df8..6a331146e6fbf23e4177176f67fe5341 void NetworkContext::CreateURLLoaderFactory( mojo::PendingReceiver receiver, mojom::URLLoaderFactoryParamsPtr params) { -@@ -2301,6 +2398,9 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( +@@ -2302,6 +2399,9 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( std::move(cert_verifier)); cert_verifier = base::WrapUnique(cert_verifier_with_trust_anchors_); #endif // BUILDFLAG(IS_CHROMEOS) diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch index 5df86e0449e32..4f582c7187ca0 100644 --- a/patches/chromium/notification_provenance.patch +++ b/patches/chromium/notification_provenance.patch @@ -7,10 +7,10 @@ Pass RenderFrameHost through to PlatformNotificationService so Electron can identify which renderer a notification came from. diff --git a/chrome/browser/notifications/platform_notification_service_impl.cc b/chrome/browser/notifications/platform_notification_service_impl.cc -index 362fedd0a0b654db546a73ff84c7e0676097e824..f1f6e2a36a6764ef12827fdab16818061b007959 100644 +index 17b9ed63bd839632a5eed5bcbaa3e990472761ef..09c266f1a99e42d6c417c294d7db1d6621ec0365 100644 --- a/chrome/browser/notifications/platform_notification_service_impl.cc +++ b/chrome/browser/notifications/platform_notification_service_impl.cc -@@ -195,6 +195,7 @@ bool PlatformNotificationServiceImpl::WasClosedProgrammatically( +@@ -197,6 +197,7 @@ bool PlatformNotificationServiceImpl::WasClosedProgrammatically( // TODO(awdf): Rename to DisplayNonPersistentNotification (Similar for Close) void PlatformNotificationServiceImpl::DisplayNotification( @@ -130,10 +130,10 @@ index 69f000e5cd25c6d89c88238873f638923bafdf0e..4f0068a92a0e99e2b34f105954689c7b const GURL& document_url, mojo::PendingReceiver receiver); diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 36830abdfa49fed9b8294ca33065816faa672e18..36b4e75828436df4274b522bdf75e88e1112aab6 100644 +index b661376d97f515574385dde451ed21fb3f3e4f7b..733931cf9f2b55b63c0611cca673250696f1300d 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -2085,7 +2085,8 @@ void RenderProcessHostImpl::CreateNotificationService( +@@ -2051,7 +2051,8 @@ void RenderProcessHostImpl::CreateNotificationService( document_url = rfh->GetLastCommittedURL(); storage_partition_impl_->GetPlatformNotificationContext()->CreateService( diff --git a/patches/chromium/picture-in-picture.patch b/patches/chromium/picture-in-picture.patch index c7f550e631fc7..57f571ce58cc4 100644 --- a/patches/chromium/picture-in-picture.patch +++ b/patches/chromium/picture-in-picture.patch @@ -138,7 +138,7 @@ index 55b53039e4db6afa197fbb61c40d0a21095c5bf9..9dfdd0288391aac31556c716d24c66d1 #include "ui/aura/window.h" #include "ui/aura/window_tree_host.h" diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc -index c1d2614f3ae3e7256db95a2cd3c5253ab6b25bd0..cabe6f261c863c35882deb8f850194e27f78a4f9 100644 +index 0d5857b5f3afa823a7a2aff68f833623ec2e7b1c..fb6217f28c306921a86afc9b854a60b4e38e1584 100644 --- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc @@ -15,9 +15,11 @@ diff --git a/patches/chromium/printing.patch b/patches/chromium/printing.patch index edeed181bef81..a3d13a71f28b9 100644 --- a/patches/chromium/printing.patch +++ b/patches/chromium/printing.patch @@ -100,10 +100,10 @@ index ee713c5686d4ea8a5d73cebf74e67381b685cff6..375ce3294727b84bf0071681c7bc35c7 #if BUILDFLAG(IS_CHROMEOS) diff --git a/chrome/browser/printing/print_job_worker_oop.cc b/chrome/browser/printing/print_job_worker_oop.cc -index dd27bbf387718d6abda5080e7d2c609cd0eaff17..8837cf2aeaa2f87d51be8d00aa356c8a2c5e15c7 100644 +index 1e158ecd686e775f656d5a05a9d916ce8f075fa8..20613012d1e6f435c3211d78ec311cf06d4852f5 100644 --- a/chrome/browser/printing/print_job_worker_oop.cc +++ b/chrome/browser/printing/print_job_worker_oop.cc -@@ -345,7 +345,7 @@ void PrintJobWorkerOop::OnFailure() { +@@ -362,7 +362,7 @@ void PrintJobWorkerOop::OnFailure() { } void PrintJobWorkerOop::ShowErrorDialog() { @@ -113,7 +113,7 @@ index dd27bbf387718d6abda5080e7d2c609cd0eaff17..8837cf2aeaa2f87d51be8d00aa356c8a void PrintJobWorkerOop::UnregisterServiceManagerClient() { diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc -index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..203ca9b0c4bf048016023fc3d260df6588392418 100644 +index e74a2d0858c187b11ac322033b122e046a45967e..09f6d4a575225ac5df9994fd0620e0adb5365a94 100644 --- a/chrome/browser/printing/print_view_manager_base.cc +++ b/chrome/browser/printing/print_view_manager_base.cc @@ -30,8 +30,6 @@ @@ -199,7 +199,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..203ca9b0c4bf048016023fc3d260df65 // Remember the ID for `rfh`, to enable checking that the `RenderFrameHost` // is still valid after a possible inner message loop runs in // `DisconnectFromCurrentPrintJob()`. -@@ -332,6 +342,9 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) { +@@ -334,6 +344,9 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) { #endif SetPrintingRFH(rfh); @@ -209,7 +209,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..203ca9b0c4bf048016023fc3d260df65 #if BUILDFLAG(ENABLE_PRINT_CONTENT_ANALYSIS) enterprise_connectors::ContentAnalysisDelegate::Data scanning_data; -@@ -500,7 +513,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply( +@@ -502,7 +515,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply( void PrintViewManagerBase::ScriptedPrintReply( ScriptedPrintCallback callback, int process_id, @@ -219,7 +219,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..203ca9b0c4bf048016023fc3d260df65 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); #if BUILDFLAG(ENABLE_OOP_PRINTING) -@@ -513,16 +527,19 @@ void PrintViewManagerBase::ScriptedPrintReply( +@@ -517,16 +531,19 @@ void PrintViewManagerBase::ScriptedPrintReply( return; } @@ -243,7 +243,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..203ca9b0c4bf048016023fc3d260df65 } void PrintViewManagerBase::NavigationStopped() { -@@ -638,11 +655,14 @@ void PrintViewManagerBase::DidPrintDocument( +@@ -642,11 +659,14 @@ void PrintViewManagerBase::DidPrintDocument( void PrintViewManagerBase::GetDefaultPrintSettings( GetDefaultPrintSettingsCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -258,7 +258,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..203ca9b0c4bf048016023fc3d260df65 #if BUILDFLAG(ENABLE_OOP_PRINTING) if (printing::features::kEnableOopPrintDriversJobPrint.Get() && !service_manager_client_id_.has_value()) { -@@ -672,18 +692,20 @@ void PrintViewManagerBase::UpdatePrintSettings( +@@ -676,18 +696,20 @@ void PrintViewManagerBase::UpdatePrintSettings( base::Value::Dict job_settings, UpdatePrintSettingsCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -280,7 +280,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..203ca9b0c4bf048016023fc3d260df65 content::BrowserContext* context = web_contents() ? web_contents()->GetBrowserContext() : nullptr; PrefService* prefs = -@@ -693,6 +715,7 @@ void PrintViewManagerBase::UpdatePrintSettings( +@@ -697,6 +719,7 @@ void PrintViewManagerBase::UpdatePrintSettings( if (value > 0) job_settings.Set(kSettingRasterizePdfDpi, value); } @@ -288,7 +288,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..203ca9b0c4bf048016023fc3d260df65 auto callback_wrapper = base::BindOnce(&PrintViewManagerBase::UpdatePrintSettingsReply, -@@ -718,14 +741,14 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params, +@@ -722,14 +745,14 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params, // didn't happen for some reason. bad_message::ReceivedBadMessage( render_process_host, bad_message::PVMB_SCRIPTED_PRINT_FENCED_FRAME); @@ -305,7 +305,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..203ca9b0c4bf048016023fc3d260df65 return; } #endif -@@ -763,7 +786,6 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie, +@@ -767,7 +790,6 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie, PrintManager::PrintingFailed(cookie, reason); #if !BUILDFLAG(IS_ANDROID) // Android does not implement this function. @@ -313,7 +313,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..203ca9b0c4bf048016023fc3d260df65 #endif ReleasePrinterQuery(); -@@ -778,6 +800,11 @@ void PrintViewManagerBase::RemoveObserver(Observer& observer) { +@@ -782,6 +804,11 @@ void PrintViewManagerBase::RemoveObserver(Observer& observer) { } void PrintViewManagerBase::ShowInvalidPrinterSettingsError() { @@ -325,7 +325,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..203ca9b0c4bf048016023fc3d260df65 base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&ShowWarningMessageBox, l10n_util::GetStringUTF16( -@@ -788,10 +815,12 @@ void PrintViewManagerBase::RenderFrameHostStateChanged( +@@ -792,10 +819,12 @@ void PrintViewManagerBase::RenderFrameHostStateChanged( content::RenderFrameHost* render_frame_host, content::RenderFrameHost::LifecycleState /*old_state*/, content::RenderFrameHost::LifecycleState new_state) { @@ -338,7 +338,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..203ca9b0c4bf048016023fc3d260df65 } void PrintViewManagerBase::DidStartLoading() { -@@ -851,6 +880,11 @@ void PrintViewManagerBase::OnJobDone() { +@@ -855,6 +884,11 @@ void PrintViewManagerBase::OnJobDone() { ReleasePrintJob(); } @@ -350,7 +350,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..203ca9b0c4bf048016023fc3d260df65 void PrintViewManagerBase::OnFailed() { TerminatePrintJob(true); } -@@ -908,7 +942,10 @@ bool PrintViewManagerBase::CreateNewPrintJob( +@@ -912,7 +946,10 @@ bool PrintViewManagerBase::CreateNewPrintJob( // Disconnect the current |print_job_|. auto weak_this = weak_ptr_factory_.GetWeakPtr(); @@ -362,8 +362,8 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..203ca9b0c4bf048016023fc3d260df65 if (!weak_this) return false; -@@ -987,6 +1024,13 @@ void PrintViewManagerBase::ReleasePrintJob() { - UnregisterSystemPrintClient(); +@@ -993,6 +1030,13 @@ void PrintViewManagerBase::ReleasePrintJob() { + } #endif + if (!callback_.is_null()) { @@ -376,7 +376,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..203ca9b0c4bf048016023fc3d260df65 if (!print_job_) return; -@@ -1036,7 +1080,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() { +@@ -1042,7 +1086,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() { } bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) { @@ -385,7 +385,7 @@ index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..203ca9b0c4bf048016023fc3d260df65 return true; if (!cookie) { -@@ -1144,7 +1188,7 @@ void PrintViewManagerBase::SendPrintingEnabled(bool enabled, +@@ -1150,7 +1194,7 @@ void PrintViewManagerBase::SendPrintingEnabled(bool enabled, } void PrintViewManagerBase::CompletePrintNow(content::RenderFrameHost* rfh) { @@ -454,7 +454,7 @@ index 746df417a23f7760818ba265d4a7d589dec8bf34..0027387d4717c59f2df3f279caf7aa0d // This means we are _blocking_ until all the necessary pages have been // rendered or the print settings are being loaded. diff --git a/chrome/browser/ui/webui/print_preview/fake_print_render_frame.cc b/chrome/browser/ui/webui/print_preview/fake_print_render_frame.cc -index aa727261738698610fab5abd3618d0d0f0d29792..2793fbc33e66cf9d7e3fc5e10f0d01730f3b935d 100644 +index b2bd74f28f70bc601ec47820030ad965b19cf068..027e4c0b78d44b69504d248755bf7f25ff423361 100644 --- a/chrome/browser/ui/webui/print_preview/fake_print_render_frame.cc +++ b/chrome/browser/ui/webui/print_preview/fake_print_render_frame.cc @@ -21,7 +21,7 @@ FakePrintRenderFrame::FakePrintRenderFrame( @@ -467,7 +467,7 @@ index aa727261738698610fab5abd3618d0d0f0d29792..2793fbc33e66cf9d7e3fc5e10f0d0173 void FakePrintRenderFrame::PrintWithParams(mojom::PrintPagesParamsPtr params) { NOTREACHED(); diff --git a/chrome/browser/ui/webui/print_preview/fake_print_render_frame.h b/chrome/browser/ui/webui/print_preview/fake_print_render_frame.h -index 5f4d6e314b21351e3e5912e3a43ef87774343085..8627c8305686654dca7cd9c26433592e934d4eb0 100644 +index 42f9f296e6ef65a934167c2d4773e504020378bc..3ac69d39e4eb380f97cb779be1e9ad8706ce8243 100644 --- a/chrome/browser/ui/webui/print_preview/fake_print_render_frame.h +++ b/chrome/browser/ui/webui/print_preview/fake_print_render_frame.h @@ -25,7 +25,7 @@ class FakePrintRenderFrame : public mojom::PrintRenderFrame { @@ -480,7 +480,7 @@ index 5f4d6e314b21351e3e5912e3a43ef87774343085..8627c8305686654dca7cd9c26433592e void PrintForSystemDialog() override; void SetPrintPreviewUI( diff --git a/components/printing/common/print.mojom b/components/printing/common/print.mojom -index 8e5c441b3d0a2d35fc5c6f9d43b4a4ca167e09ca..2cfcd810c9507c434e673064b63e8fbc95172537 100644 +index f2c17a8fecc36ea18de71598b582e206661763c5..599b34690da042b57fcd78d0c0557d183ce10c0f 100644 --- a/components/printing/common/print.mojom +++ b/components/printing/common/print.mojom @@ -280,7 +280,7 @@ enum PrintFailureReason { @@ -502,7 +502,7 @@ index 8e5c441b3d0a2d35fc5c6f9d43b4a4ca167e09ca..2cfcd810c9507c434e673064b63e8fbc // Tells the browser that there are invalid printer settings. ShowInvalidPrinterSettingsError(); diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc -index db8913ae41d46d14fd15c6127e126e4b129dc4b8..eaddc1bbc59bad9cc885fb8532d4f8c1df2f1a86 100644 +index 1664ac8233e74cadcf19ebc53e41cef37d13019c..aa341dd9a6f2b6e2ebb6e8048d2d9a3e5c3e89ea 100644 --- a/components/printing/renderer/print_render_frame_helper.cc +++ b/components/printing/renderer/print_render_frame_helper.cc @@ -42,6 +42,7 @@ @@ -513,7 +513,7 @@ index db8913ae41d46d14fd15c6127e126e4b129dc4b8..eaddc1bbc59bad9cc885fb8532d4f8c1 #include "printing/units.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" -@@ -1277,7 +1278,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { +@@ -1279,7 +1280,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { if (!weak_this) return; @@ -523,7 +523,7 @@ index db8913ae41d46d14fd15c6127e126e4b129dc4b8..eaddc1bbc59bad9cc885fb8532d4f8c1 if (!weak_this) return; -@@ -1308,7 +1310,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver( +@@ -1310,7 +1312,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver( receivers_.Add(this, std::move(receiver)); } @@ -532,7 +532,7 @@ index db8913ae41d46d14fd15c6127e126e4b129dc4b8..eaddc1bbc59bad9cc885fb8532d4f8c1 ScopedIPC scoped_ipc(weak_ptr_factory_.GetWeakPtr()); if (ipc_nesting_level_ > kAllowedIpcDepthForPrint) return; -@@ -1323,7 +1325,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() { +@@ -1325,7 +1327,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() { // plugin node and print that instead. auto plugin = delegate_->GetPdfElement(frame); @@ -541,7 +541,7 @@ index db8913ae41d46d14fd15c6127e126e4b129dc4b8..eaddc1bbc59bad9cc885fb8532d4f8c1 if (!render_frame_gone_) frame->DispatchAfterPrintEvent(); -@@ -1389,7 +1391,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() { +@@ -1391,7 +1393,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() { } Print(frame, print_preview_context_.source_node(), @@ -551,7 +551,7 @@ index db8913ae41d46d14fd15c6127e126e4b129dc4b8..eaddc1bbc59bad9cc885fb8532d4f8c1 if (!render_frame_gone_) print_preview_context_.DispatchAfterPrintEvent(); // WARNING: |this| may be gone at this point. Do not do any more work here and -@@ -1438,6 +1441,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value settings) { +@@ -1440,6 +1443,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) { if (ipc_nesting_level_ > kAllowedIpcDepthForPrint) return; @@ -682,7 +682,7 @@ index db8913ae41d46d14fd15c6127e126e4b129dc4b8..eaddc1bbc59bad9cc885fb8532d4f8c1 std::move(quit_closure).Run(); }, diff --git a/components/printing/renderer/print_render_frame_helper.h b/components/printing/renderer/print_render_frame_helper.h -index 220b28a7e63625fe8b76290f0d2f40dd32cae255..cff9e35fab9df680c3c39467c50ddb033c2e6cba 100644 +index f118cae62de1cebb78c8193365bafcaba3b863a8..6c8bb35f6ea00b8366134a3f00d1a43fa22d81b5 100644 --- a/components/printing/renderer/print_render_frame_helper.h +++ b/components/printing/renderer/print_render_frame_helper.h @@ -255,7 +255,7 @@ class PrintRenderFrameHelper @@ -723,10 +723,10 @@ index 220b28a7e63625fe8b76290f0d2f40dd32cae255..cff9e35fab9df680c3c39467c50ddb03 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) // Set options for print preset from source PDF document. diff --git a/printing/printing_context.cc b/printing/printing_context.cc -index 8a8fcefa9da92a044f5bdf6a2f242048b325d442..6dae33514675d6843736b2c9a767a4b72cb103fa 100644 +index 93db1a80a360702a36f2d3113c9a83105bf7fffe..c3e012ec8d9a1c19434240d27553e486c0729d43 100644 --- a/printing/printing_context.cc +++ b/printing/printing_context.cc -@@ -117,7 +117,6 @@ mojom::ResultCode PrintingContext::UsePdfSettings() { +@@ -128,7 +128,6 @@ void PrintingContext::UsePdfSettings() { mojom::ResultCode PrintingContext::UpdatePrintSettings( base::Value::Dict job_settings) { @@ -735,10 +735,10 @@ index 8a8fcefa9da92a044f5bdf6a2f242048b325d442..6dae33514675d6843736b2c9a767a4b7 std::unique_ptr settings = PrintSettingsFromJobSettings(job_settings); diff --git a/printing/printing_context.h b/printing/printing_context.h -index 2c8ef23f7cb75a743fa18e3c613f7c719988028c..265005d6d51f861aa7ccd7e0eba7809b3c652dae 100644 +index 58fcf619add5093bd99fd9c561e8686b060a01c6..76db2a2438cef84fcb6dfd4a67d2e171428e4be0 100644 --- a/printing/printing_context.h +++ b/printing/printing_context.h -@@ -170,6 +170,9 @@ class COMPONENT_EXPORT(PRINTING) PrintingContext { +@@ -171,6 +171,9 @@ class COMPONENT_EXPORT(PRINTING) PrintingContext { bool PrintingAborted() const { return abort_printing_; } @@ -748,7 +748,7 @@ index 2c8ef23f7cb75a743fa18e3c613f7c719988028c..265005d6d51f861aa7ccd7e0eba7809b int job_id() const { return job_id_; } protected: -@@ -180,9 +183,6 @@ class COMPONENT_EXPORT(PRINTING) PrintingContext { +@@ -181,9 +184,6 @@ class COMPONENT_EXPORT(PRINTING) PrintingContext { static std::unique_ptr CreateImpl(Delegate* delegate, bool skip_system_calls); diff --git a/patches/chromium/process_singleton.patch b/patches/chromium/process_singleton.patch index 0d6d8328df700..a44f1930965f3 100644 --- a/patches/chromium/process_singleton.patch +++ b/patches/chromium/process_singleton.patch @@ -75,7 +75,7 @@ index 16bb3aa15a5378e8319f75f4b6b72b39177828f4..5a64220aaf1309832dc0ad543e353de6 #if BUILDFLAG(IS_MAC) diff --git a/chrome/browser/process_singleton_posix.cc b/chrome/browser/process_singleton_posix.cc -index 22331cd6985b2aa2347fe9d4211f51634e94d0a6..9bb12894da06fc7d281daced754b240afa9bedeb 100644 +index 3bf385781635bf6e7ccf97abdca43befd29e8e95..9d6ef0e143bdaf4a5043ebbb57d282d72d847433 100644 --- a/chrome/browser/process_singleton_posix.cc +++ b/chrome/browser/process_singleton_posix.cc @@ -54,6 +54,7 @@ @@ -96,9 +96,9 @@ index 22331cd6985b2aa2347fe9d4211f51634e94d0a6..9bb12894da06fc7d281daced754b240a #endif +#endif - #if defined(TOOLKIT_VIEWS) && \ - (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) -@@ -347,6 +350,9 @@ bool SymlinkPath(const base::FilePath& target, const base::FilePath& path) { + using content::BrowserThread; + +@@ -342,6 +345,9 @@ bool SymlinkPath(const base::FilePath& target, const base::FilePath& path) { bool DisplayProfileInUseError(const base::FilePath& lock_path, const std::string& hostname, int pid) { @@ -108,7 +108,7 @@ index 22331cd6985b2aa2347fe9d4211f51634e94d0a6..9bb12894da06fc7d281daced754b240a std::u16string error = l10n_util::GetStringFUTF16( IDS_PROFILE_IN_USE_POSIX, base::NumberToString16(pid), base::ASCIIToUTF16(hostname)); -@@ -366,6 +372,7 @@ bool DisplayProfileInUseError(const base::FilePath& lock_path, +@@ -361,6 +367,7 @@ bool DisplayProfileInUseError(const base::FilePath& lock_path, NOTREACHED(); return false; @@ -116,7 +116,7 @@ index 22331cd6985b2aa2347fe9d4211f51634e94d0a6..9bb12894da06fc7d281daced754b240a } bool IsChromeProcess(pid_t pid) { -@@ -406,6 +413,21 @@ bool CheckCookie(const base::FilePath& path, const base::FilePath& cookie) { +@@ -401,6 +408,21 @@ bool CheckCookie(const base::FilePath& path, const base::FilePath& cookie) { return (cookie == ReadLink(path)); } @@ -138,7 +138,7 @@ index 22331cd6985b2aa2347fe9d4211f51634e94d0a6..9bb12894da06fc7d281daced754b240a bool ConnectSocket(ScopedSocket* socket, const base::FilePath& socket_path, const base::FilePath& cookie_path) { -@@ -773,6 +795,10 @@ ProcessSingleton::ProcessSingleton( +@@ -768,6 +790,10 @@ ProcessSingleton::ProcessSingleton( ProcessSingleton::~ProcessSingleton() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -149,7 +149,7 @@ index 22331cd6985b2aa2347fe9d4211f51634e94d0a6..9bb12894da06fc7d281daced754b240a } ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() { -@@ -945,6 +971,20 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessOrCreate() { +@@ -932,6 +958,20 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessOrCreate() { base::Seconds(kTimeoutInSeconds)); } @@ -170,7 +170,7 @@ index 22331cd6985b2aa2347fe9d4211f51634e94d0a6..9bb12894da06fc7d281daced754b240a ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeoutOrCreate( const base::CommandLine& command_line, -@@ -1044,14 +1084,32 @@ bool ProcessSingleton::Create() { +@@ -1031,14 +1071,32 @@ bool ProcessSingleton::Create() { #endif } @@ -208,7 +208,7 @@ index 22331cd6985b2aa2347fe9d4211f51634e94d0a6..9bb12894da06fc7d281daced754b240a // Check that the directory was created with the correct permissions. int dir_mode = 0; CHECK(base::GetPosixFilePermissions(socket_dir_.GetPath(), &dir_mode) && -@@ -1094,10 +1152,13 @@ bool ProcessSingleton::Create() { +@@ -1081,10 +1139,13 @@ bool ProcessSingleton::Create() { if (listen(sock, 5) < 0) NOTREACHED() << "listen failed: " << base::safe_strerror(errno); diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch index 576ccc34bd1d6..288bb9200db53 100644 --- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch +++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch @@ -30,10 +30,10 @@ index bdad25cd2c823fa2125fc523c400479882735ae6..bf2ddb136274eb3e4e597ed3060aabca // RenderWidgetHost on the primary main frame, and false otherwise. virtual bool IsWidgetForPrimaryMainFrame(RenderWidgetHostImpl*); diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index fcc45c987cfce94f5378d4aeee1cfe703178e133..d78ca15f4d589b6789908168c00d9e403e62d6f4 100644 +index 273750752cdef18ccd7d54b9b28c524375bb3e8d..3eec2e5c14186b39a67ca8ad410a3268841e5f4e 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -2081,6 +2081,8 @@ void RenderWidgetHostImpl::FilterDropData(DropData* drop_data) { +@@ -2075,6 +2075,8 @@ void RenderWidgetHostImpl::FilterDropData(DropData* drop_data) { void RenderWidgetHostImpl::SetCursor(const ui::Cursor& cursor) { if (view_) view_->UpdateCursor(WebCursor(cursor)); @@ -43,10 +43,10 @@ index fcc45c987cfce94f5378d4aeee1cfe703178e133..d78ca15f4d589b6789908168c00d9e40 void RenderWidgetHostImpl::ShowContextMenuAtPoint( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index a96bb634eb5c5405abb62b88d576e5e3ed354caa..1b616ba52d9c77c64c7f24a0d204ce36641dce38 100644 +index 987e437641b7978290aa2633755b67f9099e1d04..6f09c04cc612d2ac58b62d44516eefa1b66d145c 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4527,6 +4527,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { +@@ -4491,6 +4491,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { return text_input_manager_.get(); } @@ -59,7 +59,7 @@ index a96bb634eb5c5405abb62b88d576e5e3ed354caa..1b616ba52d9c77c64c7f24a0d204ce36 RenderWidgetHostImpl* render_widget_host) { return render_widget_host == GetMainFrame()->GetRenderWidgetHost(); diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index 6b6fc6881c88b72c164d786c036b2e56ccd43ac8..df1633d59070e19592a52f02a76bdd9006d7c6f0 100644 +index 36888689fe38e7873f09b1bc64a901f0771cbd5b..13253163b54c86b37c7b5654b674c5f920c81272 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h @@ -954,6 +954,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents, diff --git a/patches/chromium/render_widget_host_view_base.patch b/patches/chromium/render_widget_host_view_base.patch index ad382863c801c..579052a1a0d70 100644 --- a/patches/chromium/render_widget_host_view_base.patch +++ b/patches/chromium/render_widget_host_view_base.patch @@ -6,10 +6,10 @@ Subject: render_widget_host_view_base.patch ... something to do with OSR? and maybe as well? terrifying. diff --git a/content/browser/renderer_host/render_widget_host_view_base.cc b/content/browser/renderer_host/render_widget_host_view_base.cc -index 1bdeb27db614d3ab535e536e7e433d9ee27fd9da..e478228a5729a2a2fa0a816e25a4f1a6fe996bac 100644 +index bdaae69dbeac280dcc83baa217d6c4ab0039ba35..14e7b4386d8d8bf020abf5a1037761eac1068223 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.cc +++ b/content/browser/renderer_host/render_widget_host_view_base.cc -@@ -668,6 +668,13 @@ bool RenderWidgetHostViewBase::ScreenRectIsUnstableFor( +@@ -691,6 +691,13 @@ bool RenderWidgetHostViewBase::ScreenRectIsUnstableFor( return false; } @@ -24,7 +24,7 @@ index 1bdeb27db614d3ab535e536e7e433d9ee27fd9da..e478228a5729a2a2fa0a816e25a4f1a6 const blink::WebMouseEvent& event, const ui::LatencyInfo& latency) { diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h -index 5f2abc1943e2f25aa31c499ed7fd870a49ba5732..d3d6800e0920380bc9efe8dba35e03efe10e6a50 100644 +index 8f76edf316a075bddb2963ff1baf3ba0481b5fa7..2604d55c46e4ef3e512554a645d3db4b5670995c 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.h +++ b/content/browser/renderer_host/render_widget_host_view_base.h @@ -26,8 +26,10 @@ @@ -50,7 +50,7 @@ index 5f2abc1943e2f25aa31c499ed7fd870a49ba5732..d3d6800e0920380bc9efe8dba35e03ef class WebCursor; class WebContentsAccessibility; class DelegatedFrameHost; -@@ -139,6 +143,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { +@@ -144,6 +148,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { const gfx::Rect& keyboard_rect) override {} bool IsHTMLFormPopup() const override; @@ -60,7 +60,7 @@ index 5f2abc1943e2f25aa31c499ed7fd870a49ba5732..d3d6800e0920380bc9efe8dba35e03ef // This only needs to be overridden by RenderWidgetHostViewBase subclasses // that handle content embedded within other RenderWidgetHostViews. gfx::PointF TransformPointToRootCoordSpaceF( -@@ -290,6 +297,11 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { +@@ -295,6 +302,11 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { virtual void ProcessGestureEvent(const blink::WebGestureEvent& event, const ui::LatencyInfo& latency); diff --git a/patches/chromium/render_widget_host_view_mac.patch b/patches/chromium/render_widget_host_view_mac.patch index 4742a2456d48e..c70ffd75bc488 100644 --- a/patches/chromium/render_widget_host_view_mac.patch +++ b/patches/chromium/render_widget_host_view_mac.patch @@ -10,7 +10,7 @@ kinds of utility windows. Similarly for `disableAutoHideCursor`. Additionally, disables usage of some private APIs in MAS builds. 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 aa0802116eaffaac58800a1b9e08367c489adacd..9eb0014c0aff821814ed83eb83059ba4087ce4ff 100644 +index 0282cf6bb6674b10e6a92897ec8c5b2bb9c4a4a0..6ce9f338bb92390b355a7cc124e8fa869a3cb4ac 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 @@ -155,6 +155,15 @@ void ExtractUnderlines(NSAttributedString* string, @@ -29,7 +29,7 @@ index aa0802116eaffaac58800a1b9e08367c489adacd..9eb0014c0aff821814ed83eb83059ba4 // These are not documented, so use only after checking -respondsToSelector:. @interface NSApplication (UndocumentedSpeechMethods) - (void)speakString:(NSString*)string; -@@ -611,6 +620,9 @@ - (BOOL)acceptsMouseEventsWhenInactive { +@@ -602,6 +611,9 @@ - (BOOL)acceptsMouseEventsWhenInactive { } - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent { @@ -39,7 +39,7 @@ index aa0802116eaffaac58800a1b9e08367c489adacd..9eb0014c0aff821814ed83eb83059ba4 return [self acceptsMouseEventsWhenInactive]; } -@@ -687,6 +699,10 @@ - (BOOL)shouldIgnoreMouseEvent:(NSEvent*)theEvent { +@@ -678,6 +690,10 @@ - (BOOL)shouldIgnoreMouseEvent:(NSEvent*)theEvent { // its parent view. BOOL hitSelf = NO; while (view) { @@ -50,18 +50,18 @@ index aa0802116eaffaac58800a1b9e08367c489adacd..9eb0014c0aff821814ed83eb83059ba4 if (view == self) hitSelf = YES; if ([view isKindOfClass:[self class]] && ![view isEqual:self] && -@@ -1006,6 +1022,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv { - eventType == NSKeyDown && - !(modifierFlags & NSCommandKeyMask); +@@ -997,6 +1013,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv { + eventType == NSEventTypeKeyDown && + !(modifierFlags & NSEventModifierFlagCommand); + if ([theEvent.window respondsToSelector:@selector(disableAutoHideCursor)] && + [theEvent.window disableAutoHideCursor]) + shouldAutohideCursor = NO; + // We only handle key down events and just simply forward other events. - if (eventType != NSKeyDown) { + if (eventType != NSEventTypeKeyDown) { _hostHelper->ForwardKeyboardEvent(event, latency_info); -@@ -1769,9 +1789,11 @@ - (NSAccessibilityRole)accessibilityRole { +@@ -1761,9 +1781,11 @@ - (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 // @@ -73,7 +73,7 @@ index aa0802116eaffaac58800a1b9e08367c489adacd..9eb0014c0aff821814ed83eb83059ba4 - (NSArray*)validAttributesForMarkedText { // This code is just copied from WebKit except renaming variables. -@@ -1780,7 +1802,10 @@ - (NSArray*)validAttributesForMarkedText { +@@ -1772,7 +1794,10 @@ - (NSArray*)validAttributesForMarkedText { initWithObjects:NSUnderlineStyleAttributeName, NSUnderlineColorAttributeName, NSMarkedClauseSegmentAttributeName, diff --git a/patches/chromium/resource_file_conflict.patch b/patches/chromium/resource_file_conflict.patch index ad3734548752a..64adbef1380b8 100644 --- a/patches/chromium/resource_file_conflict.patch +++ b/patches/chromium/resource_file_conflict.patch @@ -52,10 +52,10 @@ Some alternatives to this patch: None of these options seems like a substantial maintainability win over this patch to me (@nornagon). diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn -index 5c564fe889ca6621ff33d31d8d2fff93563093eb..99ab95668a7d3a31339b576b4a3a6038f39c2795 100644 +index b1c9b0c7e7d6d8694f123d057e415676cab607c7..dc59a88bc930d4d7b8e606434d940cac5b834bd0 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn -@@ -1534,7 +1534,7 @@ if (is_chrome_branded && !is_android) { +@@ -1538,7 +1538,7 @@ if (is_chrome_branded && !is_android) { } } @@ -64,7 +64,7 @@ index 5c564fe889ca6621ff33d31d8d2fff93563093eb..99ab95668a7d3a31339b576b4a3a6038 chrome_paks("packed_resources") { if (is_mac) { output_dir = "$root_gen_dir/repack" -@@ -1563,6 +1563,12 @@ if (!is_android) { +@@ -1567,6 +1567,12 @@ if (!is_android) { } } diff --git a/patches/chromium/support_mixed_sandbox_with_zygote.patch b/patches/chromium/support_mixed_sandbox_with_zygote.patch index c60a1ac2733bb..c0ca856c45100 100644 --- a/patches/chromium/support_mixed_sandbox_with_zygote.patch +++ b/patches/chromium/support_mixed_sandbox_with_zygote.patch @@ -22,10 +22,10 @@ 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 36b4e75828436df4274b522bdf75e88e1112aab6..0c8d0735523d388d0e68d2ad0b20a1c2525502ed 100644 +index 733931cf9f2b55b63c0611cca673250696f1300d..8aa14d7cdb7edc5d53736fb959e3f9992d4fd896 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -1791,9 +1791,15 @@ bool RenderProcessHostImpl::Init() { +@@ -1750,9 +1750,15 @@ bool RenderProcessHostImpl::Init() { std::unique_ptr sandbox_delegate = std::make_unique( cmd_line.get(), IsJitDisabled()); @@ -39,13 +39,13 @@ index 36b4e75828436df4274b522bdf75e88e1112aab6..0c8d0735523d388d0e68d2ad0b20a1c2 std::make_unique(); +#endif #endif - // Spawn the child process asynchronously to avoid blocking the UI thread. - // As long as there's no renderer prefix, we can use the zygote process + + auto file_data = std::make_unique(); diff --git a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc -index e8d6ef94664bb37996871c0cc0db7c815783b786..0d56fa0aebee80883019a100900119972bf02edd 100644 +index 2c4bd947eca08223c541de53390a18d19208397e..6ef28fe7ebfd3dfa60995184772e3e2dd6f7f0d8 100644 --- a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc +++ b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc -@@ -25,6 +25,9 @@ namespace content { +@@ -31,6 +31,9 @@ namespace content { #if BUILDFLAG(USE_ZYGOTE_HANDLE) ZygoteHandle RendererSandboxedProcessLauncherDelegate::GetZygote() { @@ -55,7 +55,7 @@ index e8d6ef94664bb37996871c0cc0db7c815783b786..0d56fa0aebee80883019a10090011997 const base::CommandLine& browser_command_line = *base::CommandLine::ForCurrentProcess(); base::CommandLine::StringType renderer_prefix = -@@ -52,6 +55,9 @@ RendererSandboxedProcessLauncherDelegateWin:: +@@ -58,6 +61,9 @@ RendererSandboxedProcessLauncherDelegateWin:: bool is_jit_disabled) : renderer_code_integrity_enabled_( GetContentClient()->browser()->IsRendererCodeIntegrityEnabled()) { @@ -66,7 +66,7 @@ index e8d6ef94664bb37996871c0cc0db7c815783b786..0d56fa0aebee80883019a10090011997 dynamic_code_can_be_disabled_ = true; return; diff --git a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h -index 463df70c55df932427c761a67dbc89d7657f9703..d6d8094e31129eb7ca1f0bf36523d48204281795 100644 +index 576a2c0782bf49cb57c973434b5d1f2ec9fdcbc5..24d1854c261372353c9bf69a6cb0cf2d24e9ebef 100644 --- a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h +++ b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h @@ -18,6 +18,11 @@ class CONTENT_EXPORT RendererSandboxedProcessLauncherDelegate diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch index a01f4031ad26c..9239a84e8dd6a 100644 --- a/patches/chromium/web_contents.patch +++ b/patches/chromium/web_contents.patch @@ -9,10 +9,10 @@ is needed for OSR. Originally landed in https://github.com/electron/libchromiumcontent/pull/226. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 0303ae1c4d8681bc1bf56eb9ff1fc13afd678706..7a38e596eededae649e8380ab99c6ce7f472aa77 100644 +index 407f734b77d1ed4876f01327df958847d60e9128..ddfa7cf439244a6d58ab73dea014b341912f503f 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -3065,6 +3065,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -3026,6 +3026,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, site_instance.get(), params.renderer_initiated_creation, params.main_frame_name, GetOpener(), primary_main_frame_policy); @@ -26,7 +26,7 @@ index 0303ae1c4d8681bc1bf56eb9ff1fc13afd678706..7a38e596eededae649e8380ab99c6ce7 std::unique_ptr delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -3075,6 +3082,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -3036,6 +3043,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, view_ = CreateWebContentsView(this, std::move(delegate), &render_view_host_delegate_view_); } @@ -35,7 +35,7 @@ index 0303ae1c4d8681bc1bf56eb9ff1fc13afd678706..7a38e596eededae649e8380ab99c6ce7 CHECK(view_.get()); diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index c062c66f596f513e46da04fc9ea5f5969e7ee632..2f14f906b51ce73a69cd780d70ad6264285138ac 100644 +index e82a5b71eb8a6ee2df8478ccd3432b4afbb096aa..d5c2a922bba0ff0d5a4a22d9cd25be46fd09d4e1 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h @@ -93,10 +93,13 @@ class BrowserContext; diff --git a/patches/chromium/webview_cross_drag.patch b/patches/chromium/webview_cross_drag.patch index 064c5466aee67..913a437ac1e98 100644 --- a/patches/chromium/webview_cross_drag.patch +++ b/patches/chromium/webview_cross_drag.patch @@ -8,10 +8,10 @@ This allows dragging and dropping between s. Originally landed in https://github.com/electron/libchromiumcontent/pull/267 diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc -index c842bf34f1510071875220c7d81d60300d459b82..18f26143d5b8f6d1aeb4b21ffecd4cdf50081159 100644 +index bb9b9d0ce53ce427075fd92ab1da119c08f6e591..6792e64b2f0f4a5080beb57804f861d8297524d2 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc -@@ -900,10 +900,7 @@ bool WebContentsViewAura::IsValidDragTarget( +@@ -899,10 +899,7 @@ bool WebContentsViewAura::IsValidDragTarget( // for the outermost view. Inner `WebContents` will have a // `WebContentsViewChildFrame` so when dragging between an inner // `WebContents` and its embedder the view IDs will be the same. diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index f6c4cbc526fed..1653f6c8f33ce 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -14,10 +14,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 e588b460aa32b4c984d593ed54e10310b59ace9b..2dd0997bc183685cbb0b6f34b4a254af0a09bdd5 100644 +index e612764997277da3411d8040850756eb38996cca..f0341511d7d00f03a52bdead457f1f9d60ac5486 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -6223,6 +6223,15 @@ void RenderFrameHostImpl::EnterFullscreen( +@@ -6284,6 +6284,15 @@ void RenderFrameHostImpl::EnterFullscreen( notified_instances.insert(parent_site_instance); } diff --git a/patches/node/.patches b/patches/node/.patches index 52db7b54f608f..2c31d38101c8a 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -42,3 +42,4 @@ fix_preserve_proper_method_names_as-is_in_error_stack.patch macos_avoid_posix_spawnp_cwd_bug_3597.patch src_update_importmoduledynamically.patch fix_add_v8_enable_reverse_jsargs_defines_in_common_gypi.patch +json_parse_errors_made_user-friendly.patch diff --git a/patches/node/json_parse_errors_made_user-friendly.patch b/patches/node/json_parse_errors_made_user-friendly.patch new file mode 100644 index 0000000000000..5fe3fdf8ff49b --- /dev/null +++ b/patches/node/json_parse_errors_made_user-friendly.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: John Kleinschmidt +Date: Thu, 26 May 2022 17:08:33 -0400 +Subject: JSON.parse errors made user-friendly + +Update tests for https://chromium-review.googlesource.com/c/v8/v8/+/3513684 + +diff --git a/test/es-module/test-esm-data-urls.js b/test/es-module/test-esm-data-urls.js +index 9d0deb70a1568c93ccdecbef59327ecb2a17ae5e..2ab8f2bdcf7cca1437df33668c4177a76b4dc3ca 100644 +--- a/test/es-module/test-esm-data-urls.js ++++ b/test/es-module/test-esm-data-urls.js +@@ -75,7 +75,7 @@ function createBase64URL(mime, body) { + import('data:application/json;foo="test,",0', + { assert: { type: 'json' } }), { + name: 'SyntaxError', +- message: /Unexpected end of JSON input/ ++ message: 'data:application/json;foo="test,",0: Unterminated string in JSON at position 3' + }); + } + { +diff --git a/test/es-module/test-esm-invalid-pjson.js b/test/es-module/test-esm-invalid-pjson.js +index cdbebb17b4bb34421a2f98c384650d495908885c..12247f15dbaddc0e06f1e6aff09faf7a035cf43a 100644 +--- a/test/es-module/test-esm-invalid-pjson.js ++++ b/test/es-module/test-esm-invalid-pjson.js +@@ -17,11 +17,13 @@ child.stderr.on('data', (data) => { + child.on('close', mustCall((code, signal) => { + strictEqual(code, 1); + strictEqual(signal, null); ++ console.log('STDERR is: ', stderr); ++ console.log('DONE STDERR'); + ok( + stderr.includes( + `[ERR_INVALID_PACKAGE_CONFIG]: Invalid package config ${invalidJson} ` + + `while importing "invalid-pjson" from ${entry}. ` + +- `Unexpected token } in JSON at position ${12 + checkoutEOL.length * 2}` ++ `Expected ':' after property name in JSON at position ${12 + checkoutEOL.length * 2}` + ), + stderr); + })); diff --git a/patches/squirrel.mac/build_add_gn_config.patch b/patches/squirrel.mac/build_add_gn_config.patch index 4f6e3a0db339a..d2c9ef6b4d975 100644 --- a/patches/squirrel.mac/build_add_gn_config.patch +++ b/patches/squirrel.mac/build_add_gn_config.patch @@ -23,10 +23,10 @@ index 89c499e451ecb48655cfd42b01ffa1da56998c2e..98f80aad43a87ed75ca1660ad6a178db +vendor diff --git a/BUILD.gn b/BUILD.gn new file mode 100644 -index 0000000000000000000000000000000000000000..d43e6d6be5c8e2b3a5f715721e61589be493718d +index 0000000000000000000000000000000000000000..68beb3d10580cdb747a78407c7f5bbb205825c4b --- /dev/null +++ b/BUILD.gn -@@ -0,0 +1,239 @@ +@@ -0,0 +1,242 @@ +assert(is_mac) + +import("//build/config/mac/rules.gni") @@ -148,7 +148,10 @@ index 0000000000000000000000000000000000000000..d43e6d6be5c8e2b3a5f715721e61589b + "$dtrace_header_dir", + ] + -+ cflags_objc = [ "-fobjc-arc" ] ++ cflags_objc = [ ++ "-fobjc-arc", ++ "-Wno-deprecated-declarations", ++ ] + + ldflags = [ "-Wl,-install_name,@rpath/$output_name.framework/$output_name" ] +} diff --git a/patches/v8/.patches b/patches/v8/.patches index 4e14f3e14ced3..aa4ed2c39d565 100644 --- a/patches/v8/.patches +++ b/patches/v8/.patches @@ -8,3 +8,5 @@ fix_build_deprecated_attribute_for_older_msvc_versions.patch fix_disable_implies_dcheck_for_node_stream_array_buffers.patch revert_fix_cppgc_removed_deleted_cstors_in_cppheapcreateparams.patch revert_runtime_dhceck_terminating_exception_in_microtasks.patch +allow_disabling_of_v8_sandboxed_pointers.patch +chore_disable_is_execution_terminating_dcheck.patch diff --git a/patches/v8/allow_disabling_of_v8_sandboxed_pointers.patch b/patches/v8/allow_disabling_of_v8_sandboxed_pointers.patch new file mode 100644 index 0000000000000..2c98e2ad7c6d2 --- /dev/null +++ b/patches/v8/allow_disabling_of_v8_sandboxed_pointers.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: John Kleinschmidt +Date: Thu, 26 May 2022 10:45:49 -0400 +Subject: allow disabling of v8 sandboxed pointers + +V8 sandboxed pointers are incompatible with Node due to changes like +https://chromium-review.googlesource.com/c/v8/v8/+/3114136, so for +now we need a way to disable v8 sandboxed pointers. + +diff --git a/BUILD.gn b/BUILD.gn +index 114cfd757b60c14cfb7a6bc9f9f69765363c9c6c..5e8a6bb2c26c3e5701e628cbf4bfcf9b2eb6b82f 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -501,18 +501,6 @@ if (v8_enable_sandbox == "") { + v8_enable_external_code_space + } + +-# Enable sandboxed pointers on desktop when the sandbox is enabled. +-if (v8_enable_sandbox) { +- # When sanitizers are enabled, PartitionAlloc forwards allocations to malloc +- # instead of allocating from its Pools and so isn't compatible with the +- # sandbox. As such, disable the sandbox there. See https://crbug.com/1323174 +- if (!is_asan && !is_hwasan && !is_lsan && !is_tsan && !is_msan) { +- v8_enable_sandboxed_pointers = +- target_os != "fuchsia" && target_os != "android" && +- target_os != "chromeos" +- } +-} +- + # Enable all available sandbox features if sandbox future is enabled. + if (v8_enable_sandbox_future) { + v8_enable_sandboxed_pointers = true diff --git a/patches/v8/build_gn.patch b/patches/v8/build_gn.patch index 8ee43c0a6de39..aec7148bcd45c 100644 --- a/patches/v8/build_gn.patch +++ b/patches/v8/build_gn.patch @@ -9,10 +9,10 @@ necessary for native modules to load. Also, some fixes relating to mksnapshot on ARM. diff --git a/BUILD.gn b/BUILD.gn -index 44b4f154b416eb9b145d2abe89f3e92d507cea77..8e8e20fcbda71ec98e949d3e5c582b30dfe67e06 100644 +index 744ae6a11ffff47872da4141b3f0e4af5130fff9..31dfdf8a3facd470c3f92c58a5a12566af96521a 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -608,7 +608,7 @@ config("internal_config") { +@@ -620,7 +620,7 @@ config("internal_config") { ":cppgc_header_features", ] @@ -21,7 +21,7 @@ index 44b4f154b416eb9b145d2abe89f3e92d507cea77..8e8e20fcbda71ec98e949d3e5c582b30 defines += [ "BUILDING_V8_SHARED" ] } -@@ -5876,7 +5876,7 @@ if (current_toolchain == v8_generator_toolchain) { +@@ -5905,7 +5905,7 @@ if (current_toolchain == v8_generator_toolchain) { "src/interpreter/bytecodes.h", ] @@ -30,7 +30,7 @@ index 44b4f154b416eb9b145d2abe89f3e92d507cea77..8e8e20fcbda71ec98e949d3e5c582b30 deps = [ ":v8_libbase", -@@ -5914,6 +5914,8 @@ if (current_toolchain == v8_snapshot_toolchain) { +@@ -5943,6 +5943,8 @@ if (current_toolchain == v8_snapshot_toolchain) { configs = [ ":internal_config" ] diff --git a/patches/v8/chore_disable_is_execution_terminating_dcheck.patch b/patches/v8/chore_disable_is_execution_terminating_dcheck.patch new file mode 100644 index 0000000000000..dc3e18c332412 --- /dev/null +++ b/patches/v8/chore_disable_is_execution_terminating_dcheck.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Tue, 31 May 2022 19:58:01 +0200 +Subject: chore: disable is_execution_terminating DCHECK + +This causes a slew of crashes in Node.js. + +Upstream issue opened at https://github.com/nodejs/node-v8/issues/227. + +diff --git a/src/api/api-macros.h b/src/api/api-macros.h +index 149dd0555a69be576fd1eb97aa79b8aedafcac04..233e6d2ac511c4a7fa45d47bb7448beead52faf1 100644 +--- a/src/api/api-macros.h ++++ b/src/api/api-macros.h +@@ -97,8 +97,6 @@ + + // Lightweight version for APIs that don't require an active context. + #define DCHECK_NO_SCRIPT_NO_EXCEPTION(i_isolate) \ +- /* Embedders should never enter V8 after terminating it */ \ +- DCHECK(!i_isolate->is_execution_terminating()); \ + DCHECK_NO_SCRIPT_NO_EXCEPTION_MAYBE_TEARDOWN(i_isolate) + + #define ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate) \ diff --git a/patches/v8/dcheck.patch b/patches/v8/dcheck.patch index 0e23dc675bcc3..156ab2298be93 100644 --- a/patches/v8/dcheck.patch +++ b/patches/v8/dcheck.patch @@ -6,10 +6,10 @@ Subject: dcheck.patch https://github.com/auchenberg/volkswagen diff --git a/src/api/api.cc b/src/api/api.cc -index 6d478369375952e5af9bef922dba900067a79774..4c8bfb25e9fb2f9f9afcc57a61aff003f9db8e77 100644 +index 03bb3f062c5510292c2c983508d284f8cfde5b41..6d0622863ae436dfae6413126884e0f941a3f0b6 100644 --- a/src/api/api.cc +++ b/src/api/api.cc -@@ -9123,7 +9123,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { +@@ -9168,7 +9168,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { } void Isolate::PerformMicrotaskCheckpoint() { @@ -19,10 +19,10 @@ index 6d478369375952e5af9bef922dba900067a79774..4c8bfb25e9fb2f9f9afcc57a61aff003 i_isolate->default_microtask_queue()->PerformCheckpoint(this); } diff --git a/src/heap/heap.cc b/src/heap/heap.cc -index a1d4680b02e9d22a3804f88b4249b10986044ade..74369f2e9fc3ecc4cc41a989ecc04cd554417b0b 100644 +index a2a22674d1d50926fefac037f837d0e33d9b5220..214c0ac8d83fc74d40eb00d4d2641f329500e33c 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc -@@ -6230,9 +6230,9 @@ void Heap::TearDown() { +@@ -6208,9 +6208,9 @@ void Heap::TearDown() { void Heap::AddGCPrologueCallback(v8::Isolate::GCCallbackWithData callback, GCType gc_type, void* data) { DCHECK_NOT_NULL(callback); diff --git a/patches/v8/do_not_export_private_v8_symbols_on_windows.patch b/patches/v8/do_not_export_private_v8_symbols_on_windows.patch index ef5e00434e88e..70f4cab7eb7fe 100644 --- a/patches/v8/do_not_export_private_v8_symbols_on_windows.patch +++ b/patches/v8/do_not_export_private_v8_symbols_on_windows.patch @@ -12,10 +12,10 @@ This patch can be safely removed if, when it is removed, `node.lib` does not contain any standard C++ library exports (e.g. `std::ostringstream`). diff --git a/BUILD.gn b/BUILD.gn -index bf50ab9cf353f67cba37266a8d3ae298afb5a87c..cc2f9cca18e9229ef949183dd876db91e3021318 100644 +index 29ce9b289eb33526abd6a430428b82e9dc8c7027..114cfd757b60c14cfb7a6bc9f9f69765363c9c6c 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -608,6 +608,10 @@ config("internal_config") { +@@ -620,6 +620,10 @@ config("internal_config") { ":cppgc_header_features", ] @@ -27,10 +27,10 @@ index bf50ab9cf353f67cba37266a8d3ae298afb5a87c..cc2f9cca18e9229ef949183dd876db91 defines += [ "BUILDING_V8_SHARED" ] } diff --git a/src/base/macros.h b/src/base/macros.h -index 61644ffe0582787578dc3848f87cc8c2a0e88bb7..cd3e11e4ff77a388d2325a015e1a71641a4924a0 100644 +index 3a94093a14b0b3eabfff7063dd87049da56d62bc..641fb6a8d3dd80a23143e7f25bebe03e50681112 100644 --- a/src/base/macros.h +++ b/src/base/macros.h -@@ -387,13 +387,17 @@ bool is_inbounds(float_t v) { +@@ -389,13 +389,17 @@ bool is_inbounds(float_t v) { #ifdef V8_OS_WIN // Setup for Windows shared library export. diff --git a/patches/v8/export_symbols_needed_for_windows_build.patch b/patches/v8/export_symbols_needed_for_windows_build.patch index a38ff09275019..c9836854ec41a 100644 --- a/patches/v8/export_symbols_needed_for_windows_build.patch +++ b/patches/v8/export_symbols_needed_for_windows_build.patch @@ -19,7 +19,7 @@ index 316f870e31f33c990793fdfe7ecb69bb120bb024..5db324b2bf0169657fc6e9dc3b15fa3c explicit inline Relocatable(Isolate* isolate); inline virtual ~Relocatable(); diff --git a/src/objects/ordered-hash-table.h b/src/objects/ordered-hash-table.h -index ec304170542f8a6053c60cbebb22c536cb56ac6c..be8f33d5e8bc2ff388f199dacebd408ccd32dda5 100644 +index 60a6343bb0698902074741c860f3af0f398a85a5..5699fd042e8e3fa19d155de5162a18e24b87f90c 100644 --- a/src/objects/ordered-hash-table.h +++ b/src/objects/ordered-hash-table.h @@ -64,7 +64,7 @@ namespace internal { diff --git a/patches/v8/expose_mksnapshot.patch b/patches/v8/expose_mksnapshot.patch index 2a2002ed82572..f69f6226168e5 100644 --- a/patches/v8/expose_mksnapshot.patch +++ b/patches/v8/expose_mksnapshot.patch @@ -6,10 +6,10 @@ Subject: expose_mksnapshot.patch Needed in order to target mksnapshot for mksnapshot zip. diff --git a/BUILD.gn b/BUILD.gn -index 8e8e20fcbda71ec98e949d3e5c582b30dfe67e06..bf50ab9cf353f67cba37266a8d3ae298afb5a87c 100644 +index 31dfdf8a3facd470c3f92c58a5a12566af96521a..29ce9b289eb33526abd6a430428b82e9dc8c7027 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -5888,7 +5888,6 @@ if (current_toolchain == v8_generator_toolchain) { +@@ -5917,7 +5917,6 @@ if (current_toolchain == v8_generator_toolchain) { if (current_toolchain == v8_snapshot_toolchain) { v8_executable("mksnapshot") { diff --git a/patches/v8/fix_build_deprecated_attribute_for_older_msvc_versions.patch b/patches/v8/fix_build_deprecated_attribute_for_older_msvc_versions.patch index 1bd502768257c..b3c635d8135de 100644 --- a/patches/v8/fix_build_deprecated_attribute_for_older_msvc_versions.patch +++ b/patches/v8/fix_build_deprecated_attribute_for_older_msvc_versions.patch @@ -6,7 +6,7 @@ Subject: fix: usage of c++ [[deprecated]] attribute for older msvc versions This attribute can only be used in all contexts in Visual Studio 2019 diff --git a/include/v8config.h b/include/v8config.h -index 77fd65c6c5b7d8c0a7fe7a37c40e17ce66f49ce6..644f921f970d214b4d93b1e4c384e7475740b485 100644 +index 0e5bb1558d096d152fd9388f081c5c9d150a3c7a..6aa16106c088c0a7e590c62eb3d06e0418cb5ebc 100644 --- a/include/v8config.h +++ b/include/v8config.h @@ -454,10 +454,13 @@ path. Add it with -I to the command line diff --git a/patches/v8/revert_runtime_dhceck_terminating_exception_in_microtasks.patch b/patches/v8/revert_runtime_dhceck_terminating_exception_in_microtasks.patch index ee43f87b0374f..04f2010a887b9 100644 --- a/patches/v8/revert_runtime_dhceck_terminating_exception_in_microtasks.patch +++ b/patches/v8/revert_runtime_dhceck_terminating_exception_in_microtasks.patch @@ -18,7 +18,7 @@ index ca4b1dc557f573bfcde200201cbd2f05e3c6b530..9edc8ce00c524a63cb23911a474f1904 StoreRoot(RootIndex::kCurrentMicrotask, microtask); TNode saved_entered_context_count = GetEnteredContextCount(); diff --git a/src/codegen/code-stub-assembler.cc b/src/codegen/code-stub-assembler.cc -index d1f275afcc7f8c6adcb4c8abf9aea04b6492f38f..2b82b08a6f7cf1b7023bbdb897bfdab6bd48da5e 100644 +index 400d8cb85ea3b45448e79903b05936998b1941b3..2405b99a5badd2ee266459d17d2ec352b4ef71c5 100644 --- a/src/codegen/code-stub-assembler.cc +++ b/src/codegen/code-stub-assembler.cc @@ -6170,12 +6170,6 @@ void CodeStubAssembler::SetPendingMessage(TNode message) { @@ -35,7 +35,7 @@ index d1f275afcc7f8c6adcb4c8abf9aea04b6492f38f..2b82b08a6f7cf1b7023bbdb897bfdab6 int type) { return Word32Equal(instance_type, Int32Constant(type)); diff --git a/src/codegen/code-stub-assembler.h b/src/codegen/code-stub-assembler.h -index 123795af961c81278b947c9e8f012158d61c49df..7ac8af40f442025735498651931ab97904af6ecb 100644 +index d49403e9326b85ae4e52e7bc3e232834038fbe09..64f554332b1241aa22f1e292ebf9d0bc667a647a 100644 --- a/src/codegen/code-stub-assembler.h +++ b/src/codegen/code-stub-assembler.h @@ -2522,7 +2522,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler diff --git a/patches/v8/workaround_an_undefined_symbol_error.patch b/patches/v8/workaround_an_undefined_symbol_error.patch index 5ced839d89dbf..ee905e4f0f881 100644 --- a/patches/v8/workaround_an_undefined_symbol_error.patch +++ b/patches/v8/workaround_an_undefined_symbol_error.patch @@ -12,7 +12,7 @@ By moving some functions out of the the arm64-assembler header file, this error no longer seems to happen. diff --git a/src/codegen/arm64/assembler-arm64.cc b/src/codegen/arm64/assembler-arm64.cc -index 1edc2bd6cb05ec1000c0cc651ad10ee40a71e1ec..87b7ed6862c8bfa25b63ac0dbd9e97028bbeb17d 100644 +index 2511a0752037939562e861a8f492f6c9496453c6..8762c4dfa25dd17d7f36962410aeb9846593073e 100644 --- a/src/codegen/arm64/assembler-arm64.cc +++ b/src/codegen/arm64/assembler-arm64.cc @@ -3629,6 +3629,22 @@ void Assembler::MoveWide(const Register& rd, uint64_t imm, int shift, @@ -39,7 +39,7 @@ index 1edc2bd6cb05ec1000c0cc651ad10ee40a71e1ec..87b7ed6862c8bfa25b63ac0dbd9e9702 const Operand& operand, FlagsUpdate S, AddSubOp op) { DCHECK_EQ(rd.SizeInBits(), rn.SizeInBits()); diff --git a/src/codegen/arm64/assembler-arm64.h b/src/codegen/arm64/assembler-arm64.h -index f9e991a57b3294b0ed786b8a0b3f540d9ab5cd49..3352d8d5f3f1e4971498aafd45b9dbac447a1b4b 100644 +index f12e1ef130451afa1cb334a4ba07bdb2588ccc24..703e4bba9381c57849882e7cb2cdeb751064dd2a 100644 --- a/src/codegen/arm64/assembler-arm64.h +++ b/src/codegen/arm64/assembler-arm64.h @@ -2119,11 +2119,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase { diff --git a/script/zip_manifests/dist_zip.mac.arm64.manifest b/script/zip_manifests/dist_zip.mac.arm64.manifest index d09ff34e0e259..26e7b9b957c3c 100644 --- a/script/zip_manifests/dist_zip.mac.arm64.manifest +++ b/script/zip_manifests/dist_zip.mac.arm64.manifest @@ -19,9 +19,7 @@ Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Librari Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/vk_swiftshader_icd.json Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/ Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/Info.plist -Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib/ -Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib/keyedobjects-101300.nib -Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib/keyedobjects.nib +Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/af.lproj/ Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/af.lproj/locale.pak Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/am.lproj/ diff --git a/script/zip_manifests/dist_zip.mac.x64.manifest b/script/zip_manifests/dist_zip.mac.x64.manifest index a72fbeb79ea64..3e42bf0f614ec 100644 --- a/script/zip_manifests/dist_zip.mac.x64.manifest +++ b/script/zip_manifests/dist_zip.mac.x64.manifest @@ -19,9 +19,7 @@ Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Librari Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/vk_swiftshader_icd.json Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/ Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/Info.plist -Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib/ -Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib/keyedobjects-101300.nib -Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib/keyedobjects.nib +Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/af.lproj/ Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/af.lproj/locale.pak Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/am.lproj/ diff --git a/script/zip_manifests/dist_zip.mac_mas.arm64.manifest b/script/zip_manifests/dist_zip.mac_mas.arm64.manifest index ba4303603e46d..eb63a730528bb 100644 --- a/script/zip_manifests/dist_zip.mac_mas.arm64.manifest +++ b/script/zip_manifests/dist_zip.mac_mas.arm64.manifest @@ -16,9 +16,7 @@ Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Librari Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/vk_swiftshader_icd.json Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/ Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/Info.plist -Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib/ -Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib/keyedobjects-101300.nib -Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib/keyedobjects.nib +Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/af.lproj/ Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/af.lproj/locale.pak Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/am.lproj/ diff --git a/script/zip_manifests/dist_zip.mac_mas.x64.manifest b/script/zip_manifests/dist_zip.mac_mas.x64.manifest index a62f594edae6f..29c698600badb 100644 --- a/script/zip_manifests/dist_zip.mac_mas.x64.manifest +++ b/script/zip_manifests/dist_zip.mac_mas.x64.manifest @@ -16,9 +16,7 @@ Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Librari Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/vk_swiftshader_icd.json Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/ Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/Info.plist -Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib/ -Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib/keyedobjects-101300.nib -Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib/keyedobjects.nib +Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/MainMenu.nib Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/af.lproj/ Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/af.lproj/locale.pak Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/am.lproj/ diff --git a/shell/browser/api/electron_api_data_pipe_holder.cc b/shell/browser/api/electron_api_data_pipe_holder.cc index ebe585b88bd46..1c74cee891155 100644 --- a/shell/browser/api/electron_api_data_pipe_holder.cc +++ b/shell/browser/api/electron_api_data_pipe_holder.cc @@ -108,21 +108,34 @@ class DataPipeReader { // Note that the lifetime of the native buffer belongs to us, and we will // free memory when JS buffer gets garbage collected. v8::HandleScope handle_scope(promise_.isolate()); +#if defined(V8_SANDBOX) + v8::Local buffer = + node::Buffer::Copy(promise_.isolate(), &buffer_.front(), buffer_.size()) + .ToLocalChecked(); + promise_.Resolve(buffer); +#else v8::Local buffer = node::Buffer::New(promise_.isolate(), &buffer_.front(), buffer_.size(), &DataPipeReader::FreeBuffer, this) .ToLocalChecked(); promise_.Resolve(buffer); +#endif // Destroy data pipe. handle_watcher_.Cancel(); +#if defined(V8_SANDBOX) + delete this; +#else data_pipe_.reset(); data_pipe_getter_.reset(); +#endif } +#if !defined(V8_SANDBOX) static void FreeBuffer(char* data, void* self) { delete static_cast(self); } +#endif gin_helper::Promise> promise_; diff --git a/shell/browser/api/electron_api_global_shortcut.cc b/shell/browser/api/electron_api_global_shortcut.cc index e3daf615a6172..28a2b8413479e 100644 --- a/shell/browser/api/electron_api_global_shortcut.cc +++ b/shell/browser/api/electron_api_global_shortcut.cc @@ -9,7 +9,7 @@ #include "base/containers/contains.h" #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/common/extensions/command.h" +#include "extensions/common/command.h" #include "gin/dictionary.h" #include "gin/object_template_builder.h" #include "shell/browser/api/electron_api_system_preferences.h" diff --git a/shell/browser/api/electron_api_web_contents_mac.mm b/shell/browser/api/electron_api_web_contents_mac.mm index b31c1f79b130f..8aa071e9b4335 100644 --- a/shell/browser/api/electron_api_web_contents_mac.mm +++ b/shell/browser/api/electron_api_web_contents_mac.mm @@ -54,7 +54,7 @@ - (void)redispatchKeyEvent:(NSEvent*)event; return false; // Send the event to the menu before sending it to the window - if (event.os_event.type == NSKeyDown && + if (event.os_event.type == NSEventTypeKeyDown && [[NSApp mainMenu] performKeyEquivalent:event.os_event]) return true; diff --git a/shell/browser/electron_browser_main_parts.cc b/shell/browser/electron_browser_main_parts.cc index 2cbd8065807fd..151fc8d17a758 100644 --- a/shell/browser/electron_browser_main_parts.cc +++ b/shell/browser/electron_browser_main_parts.cc @@ -277,9 +277,6 @@ int ElectronBrowserMainParts::PreCreateThreads() { #if defined(USE_AURA) screen_ = views::CreateDesktopScreen(); display::Screen::SetScreenInstance(screen_.get()); -#if BUILDFLAG(IS_LINUX) - views::LinuxUI::instance()->UpdateDeviceScaleFactor(); -#endif #endif if (!views::LayoutProvider::Get()) diff --git a/shell/browser/electron_permission_manager.cc b/shell/browser/electron_permission_manager.cc index a4b27a0fee7fd..f41683704d651 100644 --- a/shell/browser/electron_permission_manager.cc +++ b/shell/browser/electron_permission_manager.cc @@ -150,7 +150,7 @@ void ElectronPermissionManager::RequestPermissionWithDetails( StatusCallback response_callback) { RequestPermissionsWithDetails( std::vector(1, permission), render_frame_host, - requesting_origin, user_gesture, details, + user_gesture, details, base::BindOnce(PermissionRequestResponseCallbackWrapper, std::move(response_callback))); } @@ -161,15 +161,13 @@ void ElectronPermissionManager::RequestPermissions( const GURL& requesting_origin, bool user_gesture, StatusesCallback response_callback) { - RequestPermissionsWithDetails(permissions, render_frame_host, - requesting_origin, user_gesture, nullptr, - std::move(response_callback)); + RequestPermissionsWithDetails(permissions, render_frame_host, user_gesture, + nullptr, std::move(response_callback)); } void ElectronPermissionManager::RequestPermissionsWithDetails( const std::vector& permissions, content::RenderFrameHost* render_frame_host, - const GURL& requesting_origin, bool user_gesture, const base::DictionaryValue* details, StatusesCallback response_callback) { @@ -236,6 +234,16 @@ void ElectronPermissionManager::ResetPermission( const GURL& requesting_origin, const GURL& embedding_origin) {} +void ElectronPermissionManager::RequestPermissionsFromCurrentDocument( + const std::vector& permissions, + content::RenderFrameHost* render_frame_host, + bool user_gesture, + base::OnceCallback&)> + callback) { + RequestPermissionsWithDetails(permissions, render_frame_host, user_gesture, + nullptr, std::move(callback)); +} + blink::mojom::PermissionStatus ElectronPermissionManager::GetPermissionStatus( blink::PermissionType permission, const GURL& requesting_origin, @@ -351,18 +359,6 @@ void ElectronPermissionManager::RevokeDevicePermission( render_frame_host); } -blink::mojom::PermissionStatus -ElectronPermissionManager::GetPermissionStatusForFrame( - blink::PermissionType permission, - content::RenderFrameHost* render_frame_host, - const GURL& requesting_origin) { - base::DictionaryValue details; - bool granted = CheckPermissionWithDetails(permission, render_frame_host, - requesting_origin, &details); - return granted ? blink::mojom::PermissionStatus::GRANTED - : blink::mojom::PermissionStatus::DENIED; -} - blink::mojom::PermissionStatus ElectronPermissionManager::GetPermissionStatusForCurrentDocument( blink::PermissionType permission, diff --git a/shell/browser/electron_permission_manager.h b/shell/browser/electron_permission_manager.h index 10b9b820b0609..e2cd6655b8819 100644 --- a/shell/browser/electron_permission_manager.h +++ b/shell/browser/electron_permission_manager.h @@ -76,14 +76,10 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate { void RequestPermissionsWithDetails( const std::vector& permissions, content::RenderFrameHost* render_frame_host, - const GURL& requesting_origin, bool user_gesture, const base::DictionaryValue* details, StatusesCallback callback); - blink::mojom::PermissionStatus GetPermissionStatusForFrame( - blink::PermissionType permission, - content::RenderFrameHost* render_frame_host, - const GURL& requesting_origin) override; + blink::mojom::PermissionStatus GetPermissionStatusForCurrentDocument( blink::PermissionType permission, content::RenderFrameHost* render_frame_host) override; @@ -122,6 +118,13 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate { blink::PermissionType permission, const GURL& requesting_origin, const GURL& embedding_origin) override; + void RequestPermissionsFromCurrentDocument( + const std::vector& permissions, + content::RenderFrameHost* render_frame_host, + bool user_gesture, + base::OnceCallback< + void(const std::vector&)> callback) + override; blink::mojom::PermissionStatus GetPermissionStatusForWorker( blink::PermissionType permission, content::RenderProcessHost* render_process_host, diff --git a/shell/browser/extensions/electron_extensions_browser_client.cc b/shell/browser/extensions/electron_extensions_browser_client.cc index 30a0935db736b..f286f25a9a5f6 100644 --- a/shell/browser/extensions/electron_extensions_browser_client.cc +++ b/shell/browser/extensions/electron_extensions_browser_client.cc @@ -4,6 +4,7 @@ #include "shell/browser/extensions/electron_extensions_browser_client.h" +#include #include #include "base/bind.h" @@ -297,7 +298,7 @@ ElectronExtensionsBrowserClient::GetComponentExtensionResourceManager() { void ElectronExtensionsBrowserClient::BroadcastEventToRenderers( extensions::events::HistogramValue histogram_value, const std::string& event_name, - std::unique_ptr args, + base::Value::List args, bool dispatch_to_off_the_record_profiles) { if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { content::GetUIThreadTaskRunner({})->PostTask( @@ -309,8 +310,11 @@ void ElectronExtensionsBrowserClient::BroadcastEventToRenderers( return; } - auto event = std::make_unique( - histogram_value, event_name, std::move(*args).TakeListDeprecated()); + std::vector event_args(args.size()); + std::transform(args.begin(), args.end(), event_args.begin(), + [](const base::Value& arg) { return arg.Clone(); }); + auto event = std::make_unique(histogram_value, event_name, + std::move(event_args)); auto& context_map = ElectronBrowserContext::browser_context_map(); for (auto const& entry : context_map) { if (entry.second) { diff --git a/shell/browser/extensions/electron_extensions_browser_client.h b/shell/browser/extensions/electron_extensions_browser_client.h index aaee2bd9845ef..7681112a75d7a 100644 --- a/shell/browser/extensions/electron_extensions_browser_client.h +++ b/shell/browser/extensions/electron_extensions_browser_client.h @@ -109,7 +109,7 @@ class ElectronExtensionsBrowserClient void BroadcastEventToRenderers( extensions::events::HistogramValue histogram_value, const std::string& event_name, - std::unique_ptr args, + base::Value::List args, bool dispatch_to_off_the_record_profiles) override; extensions::ExtensionCache* GetExtensionCache() override; bool IsBackgroundUpdateAllowed() override; diff --git a/shell/browser/javascript_environment.cc b/shell/browser/javascript_environment.cc index 8b9c46c8d509a..02fe3d272567f 100644 --- a/shell/browser/javascript_environment.cc +++ b/shell/browser/javascript_environment.cc @@ -73,81 +73,6 @@ struct base::trace_event::TraceValue::Helper< namespace electron { -class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { - public: - enum InitializationPolicy { kZeroInitialize, kDontInitialize }; - - ArrayBufferAllocator() { - // Ref. - // https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/platform/wtf/allocator/partitions.cc;l=94;drc=062c315a858a87f834e16a144c2c8e9591af2beb - allocator_->init({base::PartitionOptions::AlignedAlloc::kDisallowed, - base::PartitionOptions::ThreadCache::kDisabled, - base::PartitionOptions::Quarantine::kAllowed, - base::PartitionOptions::Cookie::kAllowed, - base::PartitionOptions::BackupRefPtr::kDisabled, - base::PartitionOptions::UseConfigurablePool::kNo}); - } - - // Allocate() methods return null to signal allocation failure to V8, which - // should respond by throwing a RangeError, per - // http://www.ecma-international.org/ecma-262/6.0/#sec-createbytedatablock. - void* Allocate(size_t size) override { - void* result = AllocateMemoryOrNull(size, kZeroInitialize); - return result; - } - - void* AllocateUninitialized(size_t size) override { - void* result = AllocateMemoryOrNull(size, kDontInitialize); - return result; - } - - void Free(void* data, size_t size) override { - allocator_->root()->Free(data); - } - - private: - static void* AllocateMemoryOrNull(size_t size, InitializationPolicy policy) { - return AllocateMemoryWithFlags(size, policy, - partition_alloc::AllocFlags::kReturnNull); - } - - static void* AllocateMemoryWithFlags(size_t size, - InitializationPolicy policy, - int flags) { - // The array buffer contents are sometimes expected to be 16-byte aligned in - // order to get the best optimization of SSE, especially in case of audio - // and video buffers. Hence, align the given size up to 16-byte boundary. - // Technically speaking, 16-byte aligned size doesn't mean 16-byte aligned - // address, but this heuristics works with the current implementation of - // PartitionAlloc (and PartitionAlloc doesn't support a better way for now). - if (base::kAlignment < - 16) { // base::kAlignment is a compile-time constant. - size_t aligned_size = base::bits::AlignUp(size, 16); - if (size == 0) { - aligned_size = 16; - } - if (aligned_size >= size) { // Only when no overflow - size = aligned_size; - } - } - - if (policy == kZeroInitialize) { - flags |= partition_alloc::AllocFlags::kZeroFill; - } - void* data = allocator_->root()->AllocWithFlags(flags, size, "Electron"); - if (base::kAlignment < 16) { - char* ptr = reinterpret_cast(data); - DCHECK_EQ(base::bits::AlignUp(ptr, 16), ptr) - << "Pointer " << ptr << " not 16B aligned for size " << size; - } - return data; - } - - static base::NoDestructor allocator_; -}; - -base::NoDestructor ArrayBufferAllocator::allocator_{}; - JavascriptEnvironment::JavascriptEnvironment(uv_loop_t* event_loop) : isolate_(Initialize(event_loop)), isolate_holder_(base::ThreadTaskRunnerHandle::Get(), @@ -341,11 +266,12 @@ v8::Isolate* JavascriptEnvironment::Initialize(uv_loop_t* event_loop) { tracing_controller, gin::V8Platform::PageAllocator()); v8::V8::InitializePlatform(platform_); - gin::IsolateHolder::Initialize( - gin::IsolateHolder::kNonStrictMode, new ArrayBufferAllocator(), - nullptr /* external_reference_table */, js_flags, - nullptr /* fatal_error_callback */, nullptr /* oom_error_callback */, - false /* create_v8_platform */); + gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, + gin::ArrayBufferAllocator::SharedInstance(), + nullptr /* external_reference_table */, + js_flags, nullptr /* fatal_error_callback */, + nullptr /* oom_error_callback */, + false /* create_v8_platform */); v8::Isolate* isolate = v8::Isolate::Allocate(); platform_->RegisterIsolate(isolate, event_loop); diff --git a/shell/browser/media/media_capture_devices_dispatcher.cc b/shell/browser/media/media_capture_devices_dispatcher.cc index 84a2ad677551c..33ad8ebe0d6b1 100644 --- a/shell/browser/media/media_capture_devices_dispatcher.cc +++ b/shell/browser/media/media_capture_devices_dispatcher.cc @@ -60,20 +60,20 @@ MediaCaptureDevicesDispatcher::GetVideoCaptureDevices() { void MediaCaptureDevicesDispatcher::GetDefaultDevices( bool audio, bool video, - blink::MediaStreamDevices* devices) { + blink::mojom::StreamDevices& devices) { // NOLINT(runtime/references) DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(audio || video); if (audio) { const blink::MediaStreamDevice* device = GetFirstAvailableAudioDevice(); if (device) - devices->push_back(*device); + devices.audio_device = *device; } if (video) { const blink::MediaStreamDevice* device = GetFirstAvailableVideoDevice(); if (device) - devices->push_back(*device); + devices.video_device = *device; } } diff --git a/shell/browser/media/media_capture_devices_dispatcher.h b/shell/browser/media/media_capture_devices_dispatcher.h index d7b0957e09f40..6b9dd746c633e 100644 --- a/shell/browser/media/media_capture_devices_dispatcher.h +++ b/shell/browser/media/media_capture_devices_dispatcher.h @@ -11,6 +11,7 @@ #include "content/public/browser/media_observer.h" #include "content/public/browser/media_stream_request.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h" namespace electron { @@ -29,9 +30,10 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver { // If the return list is empty, it means there is no available device on the // OS. // Called on the UI thread. - void GetDefaultDevices(bool audio, - bool video, - blink::MediaStreamDevices* devices); + void GetDefaultDevices( + bool audio, + bool video, + blink::mojom::StreamDevices& devices); // NOLINT(runtime/references) // Helpers for picking particular requested devices, identified by raw id. // If the device requested is not available it will return NULL. diff --git a/shell/browser/media/media_stream_devices_controller.cc b/shell/browser/media/media_stream_devices_controller.cc index 38a4e03153b80..c74f0c9ccfb61 100644 --- a/shell/browser/media/media_stream_devices_controller.cc +++ b/shell/browser/media/media_stream_devices_controller.cc @@ -45,7 +45,7 @@ MediaStreamDevicesController::MediaStreamDevicesController( MediaStreamDevicesController::~MediaStreamDevicesController() { if (!callback_.is_null()) { std::move(callback_).Run( - blink::MediaStreamDevices(), + blink::mojom::StreamDevices(), blink::mojom::MediaStreamRequestResult::FAILED_DUE_TO_SHUTDOWN, std::unique_ptr()); } @@ -77,7 +77,7 @@ bool MediaStreamDevicesController::TakeAction() { void MediaStreamDevicesController::Accept() { // Get the default devices for the request. - blink::MediaStreamDevices devices; + blink::mojom::StreamDevices stream_devices; if (microphone_requested_ || webcam_requested_) { switch (request_.request_type) { case blink::MEDIA_OPEN_DEVICE_PEPPER_ONLY: { @@ -94,6 +94,8 @@ void MediaStreamDevicesController::Accept() { device = MediaCaptureDevicesDispatcher::GetInstance() ->GetFirstAvailableAudioDevice(); } + if (device) + stream_devices.audio_device = *device; } else if (request_.video_type == blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE) { // Pepper API opens only one device at a time. @@ -105,9 +107,9 @@ void MediaStreamDevicesController::Accept() { device = MediaCaptureDevicesDispatcher::GetInstance() ->GetFirstAvailableVideoDevice(); } + if (device) + stream_devices.video_device = *device; } - if (device) - devices.push_back(*device); break; } case blink::MEDIA_GENERATE_STREAM: { @@ -120,7 +122,7 @@ void MediaStreamDevicesController::Accept() { MediaCaptureDevicesDispatcher::GetInstance() ->GetRequestedAudioDevice(request_.requested_audio_device_id); if (audio_device) { - devices.push_back(*audio_device); + stream_devices.audio_device = *audio_device; needs_audio_device = false; } } @@ -129,7 +131,7 @@ void MediaStreamDevicesController::Accept() { MediaCaptureDevicesDispatcher::GetInstance() ->GetRequestedVideoDevice(request_.requested_video_device_id); if (video_device) { - devices.push_back(*video_device); + stream_devices.video_device = *video_device; needs_video_device = false; } } @@ -138,14 +140,14 @@ void MediaStreamDevicesController::Accept() { // specified by id, get the default devices. if (needs_audio_device || needs_video_device) { MediaCaptureDevicesDispatcher::GetInstance()->GetDefaultDevices( - needs_audio_device, needs_video_device, &devices); + needs_audio_device, needs_video_device, stream_devices); } break; } case blink::MEDIA_DEVICE_ACCESS: { // Get the default devices for the request. MediaCaptureDevicesDispatcher::GetInstance()->GetDefaultDevices( - microphone_requested_, webcam_requested_, &devices); + microphone_requested_, webcam_requested_, stream_devices); break; } case blink::MEDIA_DEVICE_UPDATE: { @@ -154,40 +156,41 @@ void MediaStreamDevicesController::Accept() { } case blink::MEDIA_GET_OPEN_DEVICE: { // Transferred tracks, that use blink::MEDIA_GET_OPEN_DEVICE type, do - // not need to get permissions for MediaStreamDevice as those are - // controlled by the original context. + // not need to get permissions for blink::mojom::StreamDevices as those + // are controlled by the original context. NOTREACHED(); break; } } } - std::move(callback_).Run(devices, blink::mojom::MediaStreamRequestResult::OK, + std::move(callback_).Run(stream_devices, + blink::mojom::MediaStreamRequestResult::OK, std::unique_ptr()); } void MediaStreamDevicesController::Deny( blink::mojom::MediaStreamRequestResult result) { - std::move(callback_).Run(blink::MediaStreamDevices(), result, + std::move(callback_).Run(blink::mojom::StreamDevices(), result, std::unique_ptr()); } void MediaStreamDevicesController::HandleUserMediaRequest() { - blink::MediaStreamDevices devices; + blink::mojom::StreamDevices devices; if (request_.audio_type == blink::mojom::MediaStreamType::GUM_TAB_AUDIO_CAPTURE) { - devices.emplace_back(blink::mojom::MediaStreamType::GUM_TAB_AUDIO_CAPTURE, - "", ""); + devices.audio_device = blink::MediaStreamDevice( + blink::mojom::MediaStreamType::GUM_TAB_AUDIO_CAPTURE, "", ""); } if (request_.video_type == blink::mojom::MediaStreamType::GUM_TAB_VIDEO_CAPTURE) { - devices.emplace_back(blink::mojom::MediaStreamType::GUM_TAB_VIDEO_CAPTURE, - "", ""); + devices.video_device = blink::MediaStreamDevice( + blink::mojom::MediaStreamType::GUM_TAB_VIDEO_CAPTURE, "", ""); } if (request_.audio_type == blink::mojom::MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE) { - devices.emplace_back( + devices.audio_device = blink::MediaStreamDevice( blink::mojom::MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE, "loopback", "System Audio"); } @@ -204,15 +207,17 @@ void MediaStreamDevicesController::HandleUserMediaRequest() { content::DesktopMediaID::Parse(request_.requested_video_device_id); } - devices.emplace_back( + devices.video_device = blink::MediaStreamDevice( blink::mojom::MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE, screen_id.ToString(), "Screen"); } + bool empty = + !devices.audio_device.has_value() && !devices.video_device.has_value(); std::move(callback_).Run( devices, - devices.empty() ? blink::mojom::MediaStreamRequestResult::NO_HARDWARE - : blink::mojom::MediaStreamRequestResult::OK, + empty ? blink::mojom::MediaStreamRequestResult::NO_HARDWARE + : blink::mojom::MediaStreamRequestResult::OK, std::unique_ptr()); } diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index d236ca72aa1a5..1563a7b2cf09c 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -302,13 +302,13 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) { styleMask = 0; if (minimizable) - styleMask |= NSMiniaturizableWindowMask; + styleMask |= NSWindowStyleMaskMiniaturizable; if (closable) styleMask |= NSWindowStyleMaskClosable; if (resizable) - styleMask |= NSResizableWindowMask; + styleMask |= NSWindowStyleMaskResizable; if (!useStandardWindow || transparent() || !has_frame()) - styleMask |= NSTexturedBackgroundWindowMask; + styleMask |= NSWindowStyleMaskTexturedBackground; // Create views::Widget and assign window_ with it. // TODO(zcbenz): Get rid of the window_ in future. @@ -841,11 +841,11 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) { } void NativeWindowMac::SetMinimizable(bool minimizable) { - SetStyleMask(minimizable, NSMiniaturizableWindowMask); + SetStyleMask(minimizable, NSWindowStyleMaskMiniaturizable); } bool NativeWindowMac::IsMinimizable() { - return [window_ styleMask] & NSMiniaturizableWindowMask; + return [window_ styleMask] & NSWindowStyleMaskMiniaturizable; } void NativeWindowMac::SetMaximizable(bool maximizable) { @@ -901,9 +901,6 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) { level = NSPopUpMenuWindowLevel; } else if (level_name == "screen-saver") { level = NSScreenSaverWindowLevel; - } else if (level_name == "dock") { - // Deprecated by macOS, but kept for backwards compatibility - level = NSDockWindowLevel; } SetWindowLevel(level + relative_level); @@ -927,8 +924,6 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) { level_name = "pop-up-menu"; } else if (level == NSScreenSaverWindowLevel) { level_name = "screen-saver"; - } else if (level == NSDockWindowLevel) { - level_name = "dock"; } return level_name; diff --git a/shell/browser/net/asar/asar_url_loader.cc b/shell/browser/net/asar/asar_url_loader.cc index 684aadc0897fc..eadfc5af789a7 100644 --- a/shell/browser/net/asar/asar_url_loader.cc +++ b/shell/browser/net/asar/asar_url_loader.cc @@ -269,9 +269,7 @@ class AsarURLLoader : public network::mojom::URLLoader { head->headers->AddHeader(net::HttpRequestHeaders::kContentType, head->mime_type.c_str()); } - client_->OnReceiveResponse(std::move(head), - mojo::ScopedDataPipeConsumerHandle()); - client_->OnStartLoadingResponseBody(std::move(consumer_handle)); + client_->OnReceiveResponse(std::move(head), std::move(consumer_handle)); if (total_bytes_to_send == 0) { // There's definitely no more data, so we're already done. diff --git a/shell/browser/net/electron_url_loader_factory.cc b/shell/browser/net/electron_url_loader_factory.cc index eb7b97952fcd0..02a93aae14bcb 100644 --- a/shell/browser/net/electron_url_loader_factory.cc +++ b/shell/browser/net/electron_url_loader_factory.cc @@ -554,13 +554,6 @@ void ElectronURLLoaderFactory::StartLoadingStream( } else if (stream->IsNullOrUndefined()) { mojo::Remote client_remote( std::move(client)); - // "data" was explicitly passed as null or undefined, assume the user wants - // to send an empty body. - // - // Note that We must submit a empty body otherwise NetworkService would - // crash. - client_remote->OnReceiveResponse(std::move(head), - mojo::ScopedDataPipeConsumerHandle()); mojo::ScopedDataPipeProducerHandle producer; mojo::ScopedDataPipeConsumerHandle consumer; if (mojo::CreateDataPipe(nullptr, producer, consumer) != MOJO_RESULT_OK) { @@ -568,8 +561,13 @@ void ElectronURLLoaderFactory::StartLoadingStream( network::URLLoaderCompletionStatus(net::ERR_INSUFFICIENT_RESOURCES)); return; } + // "data" was explicitly passed as null or undefined, assume the user wants + // to send an empty body. + // + // Note that We must submit a empty body otherwise NetworkService would + // crash. + client_remote->OnReceiveResponse(std::move(head), std::move(consumer)); producer.reset(); // The data pipe is empty. - client_remote->OnStartLoadingResponseBody(std::move(consumer)); client_remote->OnComplete(network::URLLoaderCompletionStatus(net::OK)); return; } else if (!stream->IsObject()) { @@ -605,8 +603,6 @@ void ElectronURLLoaderFactory::SendContents( // Add header to ignore CORS. head->headers->AddHeader("Access-Control-Allow-Origin", "*"); - client_remote->OnReceiveResponse(std::move(head), - mojo::ScopedDataPipeConsumerHandle()); // Code below follows the pattern of data_url_loader_factory.cc. mojo::ScopedDataPipeProducerHandle producer; @@ -617,7 +613,7 @@ void ElectronURLLoaderFactory::SendContents( return; } - client_remote->OnStartLoadingResponseBody(std::move(consumer)); + client_remote->OnReceiveResponse(std::move(head), std::move(consumer)); auto write_data = std::make_unique(); write_data->client = std::move(client_remote); diff --git a/shell/browser/net/node_stream_loader.cc b/shell/browser/net/node_stream_loader.cc index 74ec0e0f295f7..2cd93a2d63d1d 100644 --- a/shell/browser/net/node_stream_loader.cc +++ b/shell/browser/net/node_stream_loader.cc @@ -58,9 +58,7 @@ void NodeStreamLoader::Start(network::mojom::URLResponseHeadPtr head) { } producer_ = std::make_unique(std::move(producer)); - client_->OnReceiveResponse(std::move(head), - mojo::ScopedDataPipeConsumerHandle()); - client_->OnStartLoadingResponseBody(std::move(consumer)); + client_->OnReceiveResponse(std::move(head), std::move(consumer)); auto weak = weak_factory_.GetWeakPtr(); On("end", diff --git a/shell/browser/net/proxying_url_loader_factory.cc b/shell/browser/net/proxying_url_loader_factory.cc index 3cb8a384fdad4..49b728631a059 100644 --- a/shell/browser/net/proxying_url_loader_factory.cc +++ b/shell/browser/net/proxying_url_loader_factory.cc @@ -300,11 +300,6 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnTransferSizeUpdated( target_client_->OnTransferSizeUpdated(transfer_size_diff); } -void ProxyingURLLoaderFactory::InProgressRequest::OnStartLoadingResponseBody( - mojo::ScopedDataPipeConsumerHandle body) { - target_client_->OnStartLoadingResponseBody(std::move(body)); -} - void ProxyingURLLoaderFactory::InProgressRequest::OnComplete( const network::URLLoaderCompletionStatus& status) { if (status.error_code != net::OK) { diff --git a/shell/browser/net/proxying_url_loader_factory.h b/shell/browser/net/proxying_url_loader_factory.h index f4456a0ee0f67..edee0a3ee31a1 100644 --- a/shell/browser/net/proxying_url_loader_factory.h +++ b/shell/browser/net/proxying_url_loader_factory.h @@ -97,8 +97,6 @@ class ProxyingURLLoaderFactory OnUploadProgressCallback callback) override; void OnReceiveCachedMetadata(mojo_base::BigBuffer data) override; void OnTransferSizeUpdated(int32_t transfer_size_diff) override; - void OnStartLoadingResponseBody( - mojo::ScopedDataPipeConsumerHandle body) override; void OnComplete(const network::URLLoaderCompletionStatus& status) override; void OnLoaderCreated( diff --git a/shell/browser/net/url_pipe_loader.cc b/shell/browser/net/url_pipe_loader.cc index b55dc3963dcfb..63895e6e3d03d 100644 --- a/shell/browser/net/url_pipe_loader.cc +++ b/shell/browser/net/url_pipe_loader.cc @@ -70,9 +70,7 @@ void URLPipeLoader::OnResponseStarted( producer_ = std::make_unique(std::move(producer)); - client_->OnReceiveResponse(response_head.Clone(), - mojo::ScopedDataPipeConsumerHandle()); - client_->OnStartLoadingResponseBody(std::move(consumer)); + client_->OnReceiveResponse(response_head.Clone(), std::move(consumer)); } void URLPipeLoader::OnWrite(base::OnceClosure resume, MojoResult result) { diff --git a/shell/browser/osr/osr_render_widget_host_view.cc b/shell/browser/osr/osr_render_widget_host_view.cc index 82ff89a30dbf5..fbf72675bb5a8 100644 --- a/shell/browser/osr/osr_render_widget_host_view.cc +++ b/shell/browser/osr/osr_render_widget_host_view.cc @@ -82,19 +82,19 @@ ui::MouseEvent UiMouseEventFromWebMouseEvent(blink::WebMouseEvent event) { int button_flags = 0; switch (event.button) { case blink::WebMouseEvent::Button::kBack: - button_flags |= ui::EventFlags::EF_BACK_MOUSE_BUTTON; + button_flags |= ui::EF_BACK_MOUSE_BUTTON; break; case blink::WebMouseEvent::Button::kForward: - button_flags |= ui::EventFlags::EF_FORWARD_MOUSE_BUTTON; + button_flags |= ui::EF_FORWARD_MOUSE_BUTTON; break; case blink::WebMouseEvent::Button::kLeft: - button_flags |= ui::EventFlags::EF_LEFT_MOUSE_BUTTON; + button_flags |= ui::EF_LEFT_MOUSE_BUTTON; break; case blink::WebMouseEvent::Button::kMiddle: - button_flags |= ui::EventFlags::EF_MIDDLE_MOUSE_BUTTON; + button_flags |= ui::EF_MIDDLE_MOUSE_BUTTON; break; case blink::WebMouseEvent::Button::kRight: - button_flags |= ui::EventFlags::EF_RIGHT_MOUSE_BUTTON; + button_flags |= ui::EF_RIGHT_MOUSE_BUTTON; break; default: button_flags = 0; diff --git a/shell/browser/osr/osr_web_contents_view_mac.mm b/shell/browser/osr/osr_web_contents_view_mac.mm index 691b1d52e427b..919bec712feb3 100644 --- a/shell/browser/osr/osr_web_contents_view_mac.mm +++ b/shell/browser/osr/osr_web_contents_view_mac.mm @@ -15,7 +15,7 @@ - (void)drawRect:(NSRect)dirtyRect { NSString* str = @"No content under offscreen mode"; NSMutableParagraphStyle* paragraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease]; - [paragraphStyle setAlignment:NSCenterTextAlignment]; + [paragraphStyle setAlignment:NSTextAlignmentCenter]; NSDictionary* attributes = [NSDictionary dictionaryWithObject:paragraphStyle forKey:NSParagraphStyleAttributeName]; diff --git a/shell/browser/printing/print_preview_message_handler.cc b/shell/browser/printing/print_preview_message_handler.cc index d1ba8734d368b..57a169a5f39bb 100644 --- a/shell/browser/printing/print_preview_message_handler.cc +++ b/shell/browser/printing/print_preview_message_handler.cc @@ -226,7 +226,7 @@ void PrintPreviewMessageHandler::PrintToPDF( print_render_frame_->SetPrintPreviewUI( receiver_.BindNewEndpointAndPassRemote()); } - print_render_frame_->PrintPreview(options.Clone()); + print_render_frame_->PrintPreview(options.GetDict().Clone()); } gin_helper::Promise> diff --git a/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.mm b/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.mm index 3f86dca5158e5..d223c823ca297 100644 --- a/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.mm +++ b/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.mm @@ -176,8 +176,9 @@ - (void)setIsDocked:(BOOL)docked activate:(BOOL)activate { auto devToolsView = devToolsWebContents->GetNativeView().GetNativeNSView(); if (!docked) { auto styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | - NSMiniaturizableWindowMask | NSWindowStyleMaskResizable | - NSTexturedBackgroundWindowMask | + NSWindowStyleMaskMiniaturizable | + NSWindowStyleMaskResizable | + NSWindowStyleMaskTexturedBackground | NSWindowStyleMaskUnifiedTitleAndToolbar; devtools_window_.reset([[EventDispatchingWindow alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600) diff --git a/shell/browser/ui/cocoa/electron_ns_window_delegate.mm b/shell/browser/ui/cocoa/electron_ns_window_delegate.mm index 9d5633a0f95b8..2467be47424f4 100644 --- a/shell/browser/ui/cocoa/electron_ns_window_delegate.mm +++ b/shell/browser/ui/cocoa/electron_ns_window_delegate.mm @@ -70,7 +70,7 @@ - (NSRect)windowWillUseStandardFrame:(NSWindow*)window } // If the shift key is down, maximize. - if ([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask) + if ([[NSApp currentEvent] modifierFlags] & NSEventModifierFlagShift) return frame; // Get preferred width from observers. Usually the page width. diff --git a/shell/browser/ui/cocoa/event_dispatching_window.mm b/shell/browser/ui/cocoa/event_dispatching_window.mm index b98e547730473..16273b6c4a3a0 100644 --- a/shell/browser/ui/cocoa/event_dispatching_window.mm +++ b/shell/browser/ui/cocoa/event_dispatching_window.mm @@ -20,8 +20,8 @@ - (BOOL)performKeyEquivalent:(NSEvent*)event { - (void)redispatchKeyEvent:(NSEvent*)event { NSEventType eventType = [event type]; - if (eventType != NSKeyDown && eventType != NSKeyUp && - eventType != NSFlagsChanged) { + if (eventType != NSEventTypeKeyDown && eventType != NSEventTypeKeyUp && + eventType != NSEventTypeFlagsChanged) { return; } diff --git a/shell/browser/ui/drag_util_mac.mm b/shell/browser/ui/drag_util_mac.mm index 811a0c8d103b1..85dc09d64dc67 100644 --- a/shell/browser/ui/drag_util_mac.mm +++ b/shell/browser/ui/drag_util_mac.mm @@ -30,7 +30,8 @@ void AddFilesToPasteboard(NSPasteboard* pasteboard, void DragFileItems(const std::vector& files, const gfx::Image& icon, gfx::NativeView view) { - NSPasteboard* pasteboard = [NSPasteboard pasteboardWithName:NSDragPboard]; + NSPasteboard* pasteboard = + [NSPasteboard pasteboardWithName:NSPasteboardNameDrag]; AddFilesToPasteboard(pasteboard, files); // Synthesize a drag event, since we don't have access to the actual event @@ -38,9 +39,9 @@ void DragFileItems(const std::vector& files, NSWindow* window = [view.GetNativeNSView() window]; NSPoint position = [window mouseLocationOutsideOfEventStream]; NSTimeInterval eventTime = [[NSApp currentEvent] timestamp]; - NSEvent* dragEvent = [NSEvent mouseEventWithType:NSLeftMouseDragged + NSEvent* dragEvent = [NSEvent mouseEventWithType:NSEventTypeLeftMouseDragged location:position - modifierFlags:NSLeftMouseDraggedMask + modifierFlags:NSEventMaskLeftMouseDragged timestamp:eventTime windowNumber:[window windowNumber] context:nil diff --git a/shell/browser/ui/file_dialog_mac.mm b/shell/browser/ui/file_dialog_mac.mm index 00c88c9bfe84a..fa7cfa424ef07 100644 --- a/shell/browser/ui/file_dialog_mac.mm +++ b/shell/browser/ui/file_dialog_mac.mm @@ -232,7 +232,7 @@ void SetupSaveDialogForProperties(NSSavePanel* dialog, int properties) { // Run modal dialog with parent window and return user's choice. int RunModalDialog(NSSavePanel* dialog, const DialogSettings& settings) { - __block int chosen = NSFileHandlingPanelCancelButton; + __block int chosen = NSModalResponseCancel; if (!settings.parent_window || !settings.parent_window->GetNativeWindow() || settings.force_detached) { chosen = [dialog runModal]; @@ -324,7 +324,7 @@ bool ShowOpenDialogSync(const DialogSettings& settings, SetupOpenDialogForProperties(dialog, settings.properties); int chosen = RunModalDialog(dialog, settings); - if (chosen == NSFileHandlingPanelCancelButton) + if (chosen == NSModalResponseCancel) return false; ReadDialogPaths(dialog, paths); @@ -337,7 +337,7 @@ void OpenDialogCompletion(int chosen, gin_helper::Promise promise) { v8::HandleScope scope(promise.isolate()); gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(promise.isolate()); - if (chosen == NSFileHandlingPanelCancelButton) { + if (chosen == NSModalResponseCancel) { dict.Set("canceled", true); dict.Set("filePaths", std::vector()); #if defined(MAS_BUILD) @@ -402,7 +402,7 @@ bool ShowSaveDialogSync(const DialogSettings& settings, base::FilePath* path) { SetupSaveDialogForProperties(dialog, settings.properties); int chosen = RunModalDialog(dialog, settings); - if (chosen == NSFileHandlingPanelCancelButton || ![[dialog URL] isFileURL]) + if (chosen == NSModalResponseCancel || ![[dialog URL] isFileURL]) return false; *path = base::FilePath(base::SysNSStringToUTF8([[dialog URL] path])); @@ -415,7 +415,7 @@ void SaveDialogCompletion(int chosen, gin_helper::Promise promise) { v8::HandleScope scope(promise.isolate()); gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(promise.isolate()); - if (chosen == NSFileHandlingPanelCancelButton) { + if (chosen == NSModalResponseCancel) { dict.Set("canceled", true); dict.Set("filePath", base::FilePath()); #if defined(MAS_BUILD) diff --git a/shell/browser/ui/message_box_mac.mm b/shell/browser/ui/message_box_mac.mm index 7af541819db5d..9ab03a0472eae 100644 --- a/shell/browser/ui/message_box_mac.mm +++ b/shell/browser/ui/message_box_mac.mm @@ -45,14 +45,14 @@ switch (settings.type) { case MessageBoxType::kInformation: - alert.alertStyle = NSInformationalAlertStyle; + alert.alertStyle = NSAlertStyleInformational; break; case MessageBoxType::kWarning: case MessageBoxType::kError: - // NSWarningAlertStyle shows the app icon while NSCriticalAlertStyle + // NSWarningAlertStyle shows the app icon while NSAlertStyleCritical // shows a warning icon with an app icon badge. Since there is no - // error variant, lets just use NSCriticalAlertStyle. - alert.alertStyle = NSCriticalAlertStyle; + // error variant, lets just use NSAlertStyleCritical. + alert.alertStyle = NSAlertStyleCritical; break; default: break; @@ -198,7 +198,7 @@ void ShowErrorBox(const std::u16string& title, const std::u16string& content) { NSAlert* alert = [[NSAlert alloc] init]; [alert setMessageText:base::SysUTF16ToNSString(title)]; [alert setInformativeText:base::SysUTF16ToNSString(content)]; - [alert setAlertStyle:NSCriticalAlertStyle]; + [alert setAlertStyle:NSAlertStyleCritical]; [alert runModal]; [alert release]; } diff --git a/shell/browser/ui/views/client_frame_view_linux.cc b/shell/browser/ui/views/client_frame_view_linux.cc index a5e8067968583..2a085d04d6af5 100644 --- a/shell/browser/ui/views/client_frame_view_linux.cc +++ b/shell/browser/ui/views/client_frame_view_linux.cc @@ -31,6 +31,7 @@ #include "ui/views/style/typography.h" #include "ui/views/widget/widget.h" #include "ui/views/window/frame_buttons.h" +#include "ui/views/window/window_button_order_provider.h" namespace electron { @@ -83,11 +84,16 @@ ClientFrameViewLinux::ClientFrameViewLinux() AddChildView(title_); native_theme_observer_.Observe(theme_); - window_button_order_observer_.Observe(views::LinuxUI::instance()); + + if (views::LinuxUI* ui = views::LinuxUI::instance()) { + ui->AddWindowButtonOrderObserver(this); + OnWindowButtonOrderingChange(); + } } ClientFrameViewLinux::~ClientFrameViewLinux() { - views::LinuxUI::instance()->RemoveWindowButtonOrderObserver(this); + if (views::LinuxUI* ui = views::LinuxUI::instance()) + ui->RemoveWindowButtonOrderObserver(this); theme_->RemoveObserver(this); } @@ -159,11 +165,10 @@ void ClientFrameViewLinux::OnNativeThemeUpdated( UpdateThemeValues(); } -void ClientFrameViewLinux::OnWindowButtonOrderingChange( - const std::vector& leading_buttons, - const std::vector& trailing_buttons) { - leading_frame_buttons_ = leading_buttons; - trailing_frame_buttons_ = trailing_buttons; +void ClientFrameViewLinux::OnWindowButtonOrderingChange() { + auto* provider = views::WindowButtonOrderProvider::GetInstance(); + leading_frame_buttons_ = provider->leading_buttons(); + trailing_frame_buttons_ = provider->trailing_buttons(); InvalidateLayout(); } diff --git a/shell/browser/ui/views/client_frame_view_linux.h b/shell/browser/ui/views/client_frame_view_linux.h index 404c0e6b7db91..360b11b3ed163 100644 --- a/shell/browser/ui/views/client_frame_view_linux.h +++ b/shell/browser/ui/views/client_frame_view_linux.h @@ -45,9 +45,7 @@ class ClientFrameViewLinux : public FramelessView, void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) override; // views::WindowButtonOrderObserver: - void OnWindowButtonOrderingChange( - const std::vector& leading_buttons, - const std::vector& trailing_buttons) override; + void OnWindowButtonOrderingChange() override; // Overriden from FramelessView: int ResizingBorderHitTest(const gfx::Point& point) override; diff --git a/shell/common/api/electron_api_native_image.cc b/shell/common/api/electron_api_native_image.cc index 0dbda357a755c..7fffb3c08a0a1 100644 --- a/shell/common/api/electron_api_native_image.cc +++ b/shell/common/api/electron_api_native_image.cc @@ -271,9 +271,11 @@ std::string NativeImage::ToDataURL(gin::Arguments* args) { image_.AsImageSkia().GetRepresentation(scale_factor).GetBitmap()); } +#if !defined(V8_SANDBOX) void SkUnref(char* data, void* hint) { reinterpret_cast(hint)->unref(); } +#endif v8::Local NativeImage::GetBitmap(gin::Arguments* args) { float scale_factor = GetScaleFactorFromOptions(args); @@ -283,11 +285,18 @@ v8::Local NativeImage::GetBitmap(gin::Arguments* args) { SkPixelRef* ref = bitmap.pixelRef(); if (!ref) return node::Buffer::New(args->isolate(), 0).ToLocalChecked(); +#if defined(V8_SANDBOX) + return node::Buffer::Copy(args->isolate(), + reinterpret_cast(ref->pixels()), + bitmap.computeByteSize()) + .ToLocalChecked(); +#else ref->ref(); return node::Buffer::New(args->isolate(), reinterpret_cast(ref->pixels()), bitmap.computeByteSize(), &SkUnref, ref) .ToLocalChecked(); +#endif } v8::Local NativeImage::GetNativeHandle( diff --git a/spec-main/api-session-spec.ts b/spec-main/api-session-spec.ts index 53a637bf86f60..15c3cf8206031 100644 --- a/spec-main/api-session-spec.ts +++ b/spec-main/api-session-spec.ts @@ -216,7 +216,8 @@ describe('session module', () => { }); }); - it('should survive an app restart for persistent partition', async () => { + it('should survive an app restart for persistent partition', async function () { + this.timeout(60000); const appPath = path.join(fixtures, 'api', 'cookie-app'); const runAppWithPhase = (phase: string) => { diff --git a/spec/fixtures/api/cookie-app/main.js b/spec/fixtures/api/cookie-app/main.js index dc10bb8c5dcb4..db762f632257e 100644 --- a/spec/fixtures/api/cookie-app/main.js +++ b/spec/fixtures/api/cookie-app/main.js @@ -10,7 +10,7 @@ app.whenReady().then(async function () { url, name, value, - expirationDate: Date.now() + 60000, + expirationDate: Math.floor((Date.now() + 60000) / 1000), sameSite: 'strict' }); From df91dd6d2b9ec3fafdf3dbe83ecbd5c663984b45 Mon Sep 17 00:00:00 2001 From: Sudowoodo Release Bot <88427002+sudowoodo-release-bot[bot]@users.noreply.github.com> Date: Wed, 1 Jun 2022 06:02:01 -0700 Subject: [PATCH 08/14] Bump v21.0.0-nightly.20220601 --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index 7085745b647a1..f732489a7a489 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -21.0.0-nightly.20220531 \ No newline at end of file +21.0.0-nightly.20220601 \ No newline at end of file diff --git a/package.json b/package.json index 23f3239067292..ea8b5047517ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "21.0.0-nightly.20220531", + "version": "21.0.0-nightly.20220601", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index 2ab0cf4c6a7f6..11975cee4f07e 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 21,0,0,20220531 - PRODUCTVERSION 21,0,0,20220531 + FILEVERSION 21,0,0,20220601 + PRODUCTVERSION 21,0,0,20220601 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From cda8f3c15cac770142025cc3818ab8f069468aa1 Mon Sep 17 00:00:00 2001 From: Sudowoodo Release Bot <88427002+sudowoodo-release-bot[bot]@users.noreply.github.com> Date: Wed, 1 Jun 2022 08:28:12 -0700 Subject: [PATCH 09/14] Revert "Bump v21.0.0-nightly.20220601" This reverts commit df91dd6d2b9ec3fafdf3dbe83ecbd5c663984b45. --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index f732489a7a489..7085745b647a1 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -21.0.0-nightly.20220601 \ No newline at end of file +21.0.0-nightly.20220531 \ No newline at end of file diff --git a/package.json b/package.json index ea8b5047517ee..23f3239067292 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "21.0.0-nightly.20220601", + "version": "21.0.0-nightly.20220531", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index 11975cee4f07e..2ab0cf4c6a7f6 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 21,0,0,20220601 - PRODUCTVERSION 21,0,0,20220601 + FILEVERSION 21,0,0,20220531 + PRODUCTVERSION 21,0,0,20220531 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From a38e5d20ff0ffa9cd2875e95755b1ce4be0ebb83 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Wed, 1 Jun 2022 12:59:26 -0400 Subject: [PATCH 10/14] ci: cache python install to better deal with download errors. (#34360) * ci: cache python install to better deal with download errors. * chore: use our CDN to download python2 * build: DRY up the python install steps Co-authored-by: Samuel Attard --- .circleci/config/base.yml | 40 +++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/.circleci/config/base.yml b/.circleci/config/base.yml index a579069c96e93..c37b1ecd67a0a 100644 --- a/.circleci/config/base.yml +++ b/.circleci/config/base.yml @@ -527,15 +527,6 @@ step-install-gnutar-on-mac: &step-install-gnutar-on-mac ln -fs /usr/local/bin/gtar /usr/local/bin/tar fi -step-install-python2-on-mac: &step-install-python2-on-mac - run: - name: Install python2 on macos - command: | - if [ "`uname`" == "Darwin" ]; then - curl -O https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg - sudo installer -pkg python-2.7.18-macosx10.9.pkg -target / - fi - step-gn-gen-default: &step-gn-gen-default run: name: Default GN gen @@ -1011,7 +1002,7 @@ steps-electron-gn-check: &steps-electron-gn-check - *step-checkout-electron - *step-depot-tools-get - *step-depot-tools-add-to-path - - *step-install-python2-on-mac + - install-python2-mac - *step-setup-env-for-build - *step-setup-goma-for-build - *step-generate-deps-hash @@ -1130,6 +1121,31 @@ steps-test-node: &steps-test-node # Command Aliases commands: + install-python2-mac: + steps: + - restore_cache: + keys: + - v2.7.18-python-cache-{{ arch }} + name: Restore python cache + - run: + name: Install python2 on macos + command: | + if [ "`uname`" == "Darwin" ]; then + if [ ! -f "python-downloads/python-2.7.18-macosx10.9.pkg" ]; then + mkdir python-downloads + echo 'Downloading Python 2.7.18' + curl -O https://dev-cdn.electronjs.org/python/python-2.7.18-macosx10.9.pkg + mv python-2.7.18-macosx10.9.pkg python-downloads + else + echo 'Using Python install from cache' + fi + sudo installer -pkg python-downloads/python-2.7.18-macosx10.9.pkg -target / + fi + - save_cache: + paths: + - python-downloads + key: v2.7.18-python-cache-{{ arch }} + name: Persisting python cache maybe-restore-portaled-src-cache: parameters: halt-if-successful: @@ -1296,7 +1312,7 @@ commands: - run: rm -rf src/electron - *step-restore-brew-cache - *step-install-gnutar-on-mac - - *step-install-python2-on-mac + - install-python2-mac - *step-save-brew-cache - when: condition: << parameters.build >> @@ -1488,7 +1504,7 @@ commands: - *step-depot-tools-get - *step-depot-tools-add-to-path - *step-restore-brew-cache - - *step-install-python2-on-mac + - install-python2-mac - *step-get-more-space-on-mac - when: condition: << parameters.checkout >> From 561be723736c6e677ebd20bbf582f797f09b8d92 Mon Sep 17 00:00:00 2001 From: Naoki Maeda <33103552+Maeda-Naoki@users.noreply.github.com> Date: Thu, 2 Jun 2022 02:00:48 +0900 Subject: [PATCH 11/14] chore: update husky to v8.0.1 (#34343) * chore: update husky v8.0.1 * chore: remove unnecessary .husky/.gitignore ref : https://github.com/typicode/husky/releases/tag/v7.0.0 * chore: add ^ prefix for husky version * chore: update yarn.lock Co-authored-by: Cheng Zhao --- .husky/.gitignore | 1 - package.json | 2 +- yarn.lock | 8 ++++---- 3 files changed, 5 insertions(+), 6 deletions(-) delete mode 100644 .husky/.gitignore diff --git a/.husky/.gitignore b/.husky/.gitignore deleted file mode 100644 index 31354ec138999..0000000000000 --- a/.husky/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_ diff --git a/package.json b/package.json index 23f3239067292..8bc6babe6fe0f 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "folder-hash": "^2.1.1", "fs-extra": "^9.0.1", "got": "^6.3.0", - "husky": "^6.0.0", + "husky": "^8.0.1", "klaw": "^3.0.0", "lint": "^1.1.2", "lint-staged": "^10.2.11", diff --git a/yarn.lock b/yarn.lock index 226aae6f5b92c..2cf78d42fb160 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3598,10 +3598,10 @@ human-signals@^1.1.1: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== -husky@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/husky/-/husky-6.0.0.tgz#810f11869adf51604c32ea577edbc377d7f9319e" - integrity sha512-SQS2gDTB7tBN486QSoKPKQItZw97BMOd+Kdb6ghfpBc0yXyzrddI0oDV5MkDAbuB4X2mO3/nj60TRMcYxwzZeQ== +husky@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.1.tgz#511cb3e57de3e3190514ae49ed50f6bc3f50b3e9" + integrity sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw== iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4: version "0.4.24" From 5057cbf418c8d1c32ff228c80b5222873970b010 Mon Sep 17 00:00:00 2001 From: Sudowoodo Release Bot <88427002+sudowoodo-release-bot[bot]@users.noreply.github.com> Date: Wed, 1 Jun 2022 10:32:32 -0700 Subject: [PATCH 12/14] Bump v21.0.0-nightly.20220601 --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index 7085745b647a1..f732489a7a489 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -21.0.0-nightly.20220531 \ No newline at end of file +21.0.0-nightly.20220601 \ No newline at end of file diff --git a/package.json b/package.json index 8bc6babe6fe0f..c49e9fdbc588d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "21.0.0-nightly.20220531", + "version": "21.0.0-nightly.20220601", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index 2ab0cf4c6a7f6..11975cee4f07e 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 21,0,0,20220531 - PRODUCTVERSION 21,0,0,20220531 + FILEVERSION 21,0,0,20220601 + PRODUCTVERSION 21,0,0,20220601 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From f306fbc01056256864d49be4ddff882245662cdf Mon Sep 17 00:00:00 2001 From: Sudowoodo Release Bot <88427002+sudowoodo-release-bot[bot]@users.noreply.github.com> Date: Wed, 1 Jun 2022 14:31:30 -0700 Subject: [PATCH 13/14] Revert "Bump v21.0.0-nightly.20220601" This reverts commit 5057cbf418c8d1c32ff228c80b5222873970b010. --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index f732489a7a489..7085745b647a1 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -21.0.0-nightly.20220601 \ No newline at end of file +21.0.0-nightly.20220531 \ No newline at end of file diff --git a/package.json b/package.json index c49e9fdbc588d..8bc6babe6fe0f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "21.0.0-nightly.20220601", + "version": "21.0.0-nightly.20220531", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index 11975cee4f07e..2ab0cf4c6a7f6 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 21,0,0,20220601 - PRODUCTVERSION 21,0,0,20220601 + FILEVERSION 21,0,0,20220531 + PRODUCTVERSION 21,0,0,20220531 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From 1cd07c565a87ced6a923ade76eda380367e5ce1f Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Wed, 1 Jun 2022 16:03:04 -0700 Subject: [PATCH 14/14] fix: crash in WebFrameMain mojo connection when RenderFrameHost is nullptr (#34411) * fix: crash when RenderFrameHost is nullptr * chore: lint fix Co-authored-by: samuelmaddock --- shell/browser/api/electron_api_web_frame_main.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shell/browser/api/electron_api_web_frame_main.cc b/shell/browser/api/electron_api_web_frame_main.cc index f8bc7c9efcd11..065150fbf3e82 100644 --- a/shell/browser/api/electron_api_web_frame_main.cc +++ b/shell/browser/api/electron_api_web_frame_main.cc @@ -193,8 +193,13 @@ void WebFrameMain::MaybeSetupMojoConnection() { renderer_api_.set_disconnect_handler(base::BindOnce( &WebFrameMain::OnRendererConnectionError, weak_factory_.GetWeakPtr())); } + + // Render frame should exist when this method is called. + DCHECK(render_frame_); + // Wait for RenderFrame to be created in renderer before accessing remote. - if (pending_receiver_ && render_frame_->IsRenderFrameCreated()) { + if (pending_receiver_ && render_frame_ && + render_frame_->IsRenderFrameCreated()) { render_frame_->GetRemoteInterfaces()->GetInterface( std::move(pending_receiver_)); }