mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
6 Commits
try-remove
...
miniak/pre
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
484f368ee8 | ||
|
|
f6e8544ef6 | ||
|
|
029127a8b6 | ||
|
|
e71a56d11e | ||
|
|
65901f4c6a | ||
|
|
feb804cea8 |
2
DEPS
2
DEPS
@@ -2,7 +2,7 @@ gclient_gn_args_from = 'src'
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'118.0.5991.0',
|
||||
'118.0.5993.0',
|
||||
'node_version':
|
||||
'v18.17.1',
|
||||
'nan_version':
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
version: 1.0.{build}
|
||||
build_cloud: electronhq-16-core
|
||||
image: e-118.0.5949.0
|
||||
image: e-118.0.5991.0
|
||||
environment:
|
||||
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
||||
ELECTRON_OUT_DIR: Default
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
version: 1.0.{build}
|
||||
build_cloud: electronhq-16-core
|
||||
image: e-118.0.5949.0
|
||||
image: e-118.0.5991.0
|
||||
environment:
|
||||
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
||||
ELECTRON_OUT_DIR: Default
|
||||
|
||||
@@ -5,7 +5,7 @@ import type * as Crypto from 'crypto';
|
||||
|
||||
const asar = process._linkedBinding('electron_common_asar');
|
||||
|
||||
const Module = require('module');
|
||||
const Module = require('module') as NodeJS.ModuleInternal;
|
||||
|
||||
const Promise: PromiseConstructor = global.Promise;
|
||||
|
||||
|
||||
@@ -55,22 +55,29 @@ BrowserWindow.prototype._init = function (this: BWT) {
|
||||
|
||||
const warn = deprecate.warnOnceMessage('\'scroll-touch-{begin,end,edge}\' are deprecated and will be removed. Please use the WebContents \'input-event\' event instead.');
|
||||
this.webContents.on('input-event', (_, e) => {
|
||||
if (e.type === 'gestureScrollBegin') {
|
||||
if (this.listenerCount('scroll-touch-begin') !== 0) {
|
||||
warn();
|
||||
this.emit('scroll-touch-edge');
|
||||
this.emit('scroll-touch-begin');
|
||||
switch (e.type) {
|
||||
case 'gestureScrollBegin': {
|
||||
if (this.listenerCount('scroll-touch-begin') !== 0) {
|
||||
warn();
|
||||
this.emit('scroll-touch-edge');
|
||||
this.emit('scroll-touch-begin');
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (e.type === 'gestureScrollUpdate') {
|
||||
if (this.listenerCount('scroll-touch-edge') !== 0) {
|
||||
warn();
|
||||
this.emit('scroll-touch-edge');
|
||||
case 'gestureScrollUpdate': {
|
||||
if (this.listenerCount('scroll-touch-edge') !== 0) {
|
||||
warn();
|
||||
this.emit('scroll-touch-edge');
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (e.type === 'gestureScrollEnd') {
|
||||
if (this.listenerCount('scroll-touch-end') !== 0) {
|
||||
warn();
|
||||
this.emit('scroll-touch-edge');
|
||||
this.emit('scroll-touch-end');
|
||||
case 'gestureScrollEnd': {
|
||||
if (this.listenerCount('scroll-touch-end') !== 0) {
|
||||
warn();
|
||||
this.emit('scroll-touch-edge');
|
||||
this.emit('scroll-touch-end');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ const normalizeAccessKey = (text: string) => {
|
||||
// macOS does not have access keys so remove single ampersands
|
||||
// and replace double ampersands with a single ampersand
|
||||
if (process.platform === 'darwin') {
|
||||
return text.replace(/&(&?)/g, '$1');
|
||||
return text.replaceAll(/&(&?)/g, '$1');
|
||||
}
|
||||
|
||||
// Linux uses a single underscore as an access key prefix so escape
|
||||
@@ -41,7 +41,7 @@ const normalizeAccessKey = (text: string) => {
|
||||
// ampersands with a single ampersand, and replace a single ampersand with
|
||||
// a single underscore
|
||||
if (process.platform === 'linux') {
|
||||
return text.replace(/_/g, '__').replace(/&(.?)/g, (match, after) => {
|
||||
return text.replaceAll('_', '__').replaceAll(/&(.?)/g, (match, after) => {
|
||||
if (after === '&') return after;
|
||||
return `_${after}`;
|
||||
});
|
||||
|
||||
@@ -461,31 +461,39 @@ export class ClientRequest extends Writable implements Electron.ClientRequest {
|
||||
|
||||
this._urlLoader.on('redirect', (event, redirectInfo, headers) => {
|
||||
const { statusCode, newMethod, newUrl } = redirectInfo;
|
||||
if (this._redirectPolicy === 'error') {
|
||||
this._die(new Error('Attempted to redirect, but redirect policy was \'error\''));
|
||||
} else if (this._redirectPolicy === 'manual') {
|
||||
let _followRedirect = false;
|
||||
this._followRedirectCb = () => { _followRedirect = true; };
|
||||
try {
|
||||
this.emit('redirect', statusCode, newMethod, newUrl, headers);
|
||||
} finally {
|
||||
this._followRedirectCb = undefined;
|
||||
if (!_followRedirect && !this._aborted) {
|
||||
this._die(new Error('Redirect was cancelled'));
|
||||
}
|
||||
switch (this._redirectPolicy) {
|
||||
case 'error': {
|
||||
this._die(new Error('Attempted to redirect, but redirect policy was \'error\''));
|
||||
break;
|
||||
}
|
||||
} else if (this._redirectPolicy === 'follow') {
|
||||
case 'manual': {
|
||||
let _followRedirect = false;
|
||||
this._followRedirectCb = () => { _followRedirect = true; };
|
||||
try {
|
||||
this.emit('redirect', statusCode, newMethod, newUrl, headers);
|
||||
} finally {
|
||||
this._followRedirectCb = undefined;
|
||||
if (!_followRedirect && !this._aborted) {
|
||||
this._die(new Error('Redirect was cancelled'));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'follow': {
|
||||
// Calling followRedirect() when the redirect policy is 'follow' is
|
||||
// allowed but does nothing. (Perhaps it should throw an error
|
||||
// though...? Since the redirect will happen regardless.)
|
||||
try {
|
||||
this._followRedirectCb = () => {};
|
||||
this.emit('redirect', statusCode, newMethod, newUrl, headers);
|
||||
} finally {
|
||||
this._followRedirectCb = undefined;
|
||||
try {
|
||||
this._followRedirectCb = () => {};
|
||||
this.emit('redirect', statusCode, newMethod, newUrl, headers);
|
||||
} finally {
|
||||
this._followRedirectCb = undefined;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
this._die(new Error(`Unexpected redirect policy '${this._redirectPolicy}'`));
|
||||
}
|
||||
} else {
|
||||
this._die(new Error(`Unexpected redirect policy '${this._redirectPolicy}'`));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -48,12 +48,25 @@ function convertToRequestBody (uploadData: ProtocolRequest['uploadData']): Reque
|
||||
} else {
|
||||
if (!chunks.length) { return controller.close(); }
|
||||
const chunk = chunks.shift()!;
|
||||
if (chunk.type === 'rawData') { controller.enqueue(chunk.bytes); } else if (chunk.type === 'file') {
|
||||
current = Readable.toWeb(createReadStream(chunk.filePath, { start: chunk.offset ?? 0, end: chunk.length >= 0 ? chunk.offset + chunk.length : undefined })).getReader();
|
||||
this.pull!(controller);
|
||||
} else if (chunk.type === 'stream') {
|
||||
current = makeStreamFromPipe(chunk.body).getReader();
|
||||
this.pull!(controller);
|
||||
switch (chunk.type) {
|
||||
case 'rawData': {
|
||||
controller.enqueue(chunk.bytes);
|
||||
break;
|
||||
}
|
||||
case 'file': {
|
||||
const stream = createReadStream(chunk.filePath, {
|
||||
start: chunk.offset ?? 0,
|
||||
end: chunk.length >= 0 ? chunk.offset + chunk.length : undefined
|
||||
});
|
||||
current = Readable.toWeb(stream).getReader();
|
||||
this.pull!(controller);
|
||||
break;
|
||||
}
|
||||
case 'stream': {
|
||||
current = makeStreamFromPipe(chunk.body).getReader();
|
||||
this.pull!(controller);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as path from 'path';
|
||||
|
||||
import type * as defaultMenuModule from '@electron/internal/browser/default-menu';
|
||||
|
||||
const Module = require('module');
|
||||
const Module = require('module') as NodeJS.ModuleInternal;
|
||||
|
||||
// We modified the original process.argv to let node.js load the init.js,
|
||||
// we need to restore it here.
|
||||
@@ -63,8 +63,8 @@ if (process.platform === 'win32') {
|
||||
|
||||
if (fs.existsSync(updateDotExe)) {
|
||||
const packageDir = path.dirname(path.resolve(updateDotExe));
|
||||
const packageName = path.basename(packageDir).replace(/\s/g, '');
|
||||
const exeName = path.basename(process.execPath).replace(/\.exe$/i, '').replace(/\s/g, '');
|
||||
const packageName = path.basename(packageDir).replaceAll(/\s/g, '');
|
||||
const exeName = path.basename(process.execPath).replace(/\.exe$/i, '').replaceAll(/\s/g, '');
|
||||
|
||||
app.setAppUserModelId(`com.squirrel.${packageName}.${exeName}`);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as path from 'path';
|
||||
|
||||
const Module = require('module');
|
||||
const Module = require('module') as NodeJS.ModuleInternal;
|
||||
|
||||
// We do not want to allow use of the VM module in the renderer process as
|
||||
// it conflicts with Blink's V8::Context internal logic.
|
||||
@@ -10,7 +10,7 @@ if (process.type === 'renderer') {
|
||||
if (request === 'vm') {
|
||||
console.warn('The vm module of Node.js is deprecated in the renderer process and will be removed.');
|
||||
}
|
||||
return _load.apply(this, arguments);
|
||||
return _load.apply(this, arguments as any);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ const originalResolveFilename = Module._resolveFilename;
|
||||
// renderer process regardless of the names, they're superficial for TypeScript
|
||||
// only.
|
||||
const electronModuleNames = new Set(['electron', 'electron/main', 'electron/renderer', 'electron/common']);
|
||||
Module._resolveFilename = function (request: string, parent: NodeModule, isMain: boolean, options?: { paths: Array<string>}) {
|
||||
Module._resolveFilename = function (request, parent, isMain, options) {
|
||||
if (electronModuleNames.has(request)) {
|
||||
return 'electron';
|
||||
} else {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||
import type * as ipcRendererInternalModule from '@electron/internal/renderer/ipc-renderer-internal';
|
||||
import type * as ipcRendererUtilsModule from '@electron/internal/renderer/ipc-renderer-internal-utils';
|
||||
|
||||
const Module = require('module');
|
||||
const Module = require('module') as NodeJS.ModuleInternal;
|
||||
|
||||
// Make sure globals like "process" and "global" are always available in preload
|
||||
// scripts even after they are deleted in "loaded" script.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ParentPort } from '@electron/internal/utility/parent-port';
|
||||
const Module = require('module');
|
||||
const Module = require('module') as NodeJS.ModuleInternal;
|
||||
const v8Util = process._linkedBinding('electron_common_v8_util');
|
||||
|
||||
const entryScript: string = v8Util.getHiddenValue(process, '_serviceStartupScript');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as path from 'path';
|
||||
|
||||
const Module = require('module');
|
||||
const Module = require('module') as NodeJS.ModuleInternal;
|
||||
|
||||
// We modified the original process.argv to let node.js load the
|
||||
// init.js, we need to restore it here.
|
||||
|
||||
@@ -131,3 +131,4 @@ chore_add_buildflag_guard_around_new_include.patch
|
||||
fix_use_delegated_generic_capturer_when_available.patch
|
||||
build_remove_ent_content_analysis_assert.patch
|
||||
fix_move_autopipsettingshelper_behind_branding_buildflag.patch
|
||||
revert_remove_the_allowaggressivethrottlingwithwebsocket_feature.patch
|
||||
|
||||
@@ -33,7 +33,7 @@ index 41ce32113ec2679b76d5a4fd69a7109c832ac7a1..1cd35794bf78f3d92b42634d9494c85a
|
||||
"//base",
|
||||
"//build:branding_buildflags",
|
||||
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
|
||||
index 5cce9134fabf566ec968d5738242b3dc13f2f54c..0e8ca7b1762571f57372a937630004252f396ae7 100644
|
||||
index 1a9bff4a3efb7fd802db7ae9696027ee318eb7eb..85d2bc48117c7e41cfa49ea204d2c46f79a1c117 100644
|
||||
--- a/chrome/browser/BUILD.gn
|
||||
+++ b/chrome/browser/BUILD.gn
|
||||
@@ -4723,7 +4723,7 @@ static_library("browser") {
|
||||
@@ -46,10 +46,10 @@ index 5cce9134fabf566ec968d5738242b3dc13f2f54c..0e8ca7b1762571f57372a93763000425
|
||||
sources += [ "certificate_viewer_stub.cc" ]
|
||||
}
|
||||
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
|
||||
index 513932b71a19d8f0a8196faf2ef14c2a7a996229..0b16b410606d2dcb8f8013755f079a209c8ba3a4 100644
|
||||
index 6a2501dde4552c2b0d96dd54fc1b94ba1e610b0c..8d3cb67ae6d4fe65cfbb907309af734906b49949 100644
|
||||
--- a/chrome/test/BUILD.gn
|
||||
+++ b/chrome/test/BUILD.gn
|
||||
@@ -6833,7 +6833,6 @@ test("unit_tests") {
|
||||
@@ -6838,7 +6838,6 @@ test("unit_tests") {
|
||||
|
||||
deps += [
|
||||
"//chrome:other_version",
|
||||
@@ -57,7 +57,7 @@ index 513932b71a19d8f0a8196faf2ef14c2a7a996229..0b16b410606d2dcb8f8013755f079a20
|
||||
"//chrome//services/util_win:unit_tests",
|
||||
"//chrome/app:chrome_dll_resources",
|
||||
"//chrome/app:win_unit_tests",
|
||||
@@ -6859,6 +6858,10 @@ test("unit_tests") {
|
||||
@@ -6864,6 +6863,10 @@ test("unit_tests") {
|
||||
"//ui/resources",
|
||||
]
|
||||
|
||||
@@ -68,7 +68,7 @@ index 513932b71a19d8f0a8196faf2ef14c2a7a996229..0b16b410606d2dcb8f8013755f079a20
|
||||
ldflags = [
|
||||
"/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll",
|
||||
"/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
|
||||
@@ -7826,7 +7829,6 @@ test("unit_tests") {
|
||||
@@ -7831,7 +7834,6 @@ test("unit_tests") {
|
||||
}
|
||||
|
||||
deps += [
|
||||
@@ -76,7 +76,7 @@ index 513932b71a19d8f0a8196faf2ef14c2a7a996229..0b16b410606d2dcb8f8013755f079a20
|
||||
"//chrome/browser/apps:icon_standardizer",
|
||||
"//chrome/browser/apps/app_service",
|
||||
"//chrome/browser/apps/app_service:app_registry_cache_waiter",
|
||||
@@ -7913,6 +7915,10 @@ test("unit_tests") {
|
||||
@@ -7918,6 +7920,10 @@ test("unit_tests") {
|
||||
"//ui/webui/resources/js/browser_command:mojo_bindings",
|
||||
]
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ index 729753a72edd761ec831f79828742a26f9dd2417..45858456c9c8c82870c41b0edd1359d1
|
||||
|
||||
if (is_win) {
|
||||
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
|
||||
index e0d55a859061f029e5298599bf2d9345674ecb34..74f977ca68b566d4c2859d71fabbe112555d1d91 100644
|
||||
index 718ad3e088f6730bb00f1e3674effae6c429b9b6..77af941f2dd2d3074f5596cee24be47dc8175434 100644
|
||||
--- a/content/browser/BUILD.gn
|
||||
+++ b/content/browser/BUILD.gn
|
||||
@@ -56,6 +56,7 @@ source_set("browser") {
|
||||
@@ -86,10 +86,10 @@ index e0d55a859061f029e5298599bf2d9345674ecb34..74f977ca68b566d4c2859d71fabbe112
|
||||
libs = []
|
||||
frameworks = []
|
||||
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn
|
||||
index dce27cfa39b52e39a95cee658584ed80ab1953ef..366edd2e86edcdbb30ae4c0fa952b5d9aab38f8a 100644
|
||||
index 9c9f6d58a8e5c1ed14eb60c722667d1a24d2c6fa..34979dbbd84da86db079b423967ab8b775b47c52 100644
|
||||
--- a/content/common/BUILD.gn
|
||||
+++ b/content/common/BUILD.gn
|
||||
@@ -174,6 +174,7 @@ source_set("common") {
|
||||
@@ -176,6 +176,7 @@ source_set("common") {
|
||||
"//content:content_implementation",
|
||||
"//build/config:precompiled_headers",
|
||||
]
|
||||
@@ -110,7 +110,7 @@ index b16be8f9992b23ce93d174531f2debd7f18bb436..119038743dc222907cb74c2c3ea34d23
|
||||
|
||||
public_deps = [
|
||||
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn
|
||||
index 8fbd09e0305b22114c2cc2534a43622cf660bb23..39951971e29c374aa705eab8c921f73e56d428c8 100644
|
||||
index 581571b6bb1a655319b247d7cc85bb2a4dd7db1c..09779610326da207062a59ba572b2d7c13efd26f 100644
|
||||
--- a/content/test/BUILD.gn
|
||||
+++ b/content/test/BUILD.gn
|
||||
@@ -480,6 +480,7 @@ static_library("test_support") {
|
||||
|
||||
@@ -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 6646263a52601e5283d2a2bb924945acacfff702..e2303fbb80ccc7d76d6a949678608c6a55ea411d 100644
|
||||
index 50d873e238b04eb6d461dc929d98dfe171cc491c..586aa87098bd3db10440fe865a02c05e7b3be14f 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -8208,6 +8208,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
@@ -8206,6 +8206,7 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
last_committed_origin_, params->window_container_type,
|
||||
params->target_url, params->referrer.To<Referrer>(),
|
||||
params->frame_name, params->disposition, *params->features,
|
||||
@@ -66,10 +66,10 @@ index 3ddc93e18d353d5af31e28f8f8e682ea813db21c..2f1df452ce3617cf845409d01d804932
|
||||
|
||||
// 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 549fa60921444c60b3343fc381fb283ca73f7b6a..c76eb798967426772e8e673f93f223581d2fd00f 100644
|
||||
index a0d56a9a24f22b1fd7a7e7a7ac82adf23a1e27ca..b006271eb9d4eb28aa8342a58d579716ed369281 100644
|
||||
--- a/content/public/browser/content_browser_client.cc
|
||||
+++ b/content/public/browser/content_browser_client.cc
|
||||
@@ -683,6 +683,8 @@ bool ContentBrowserClient::CanCreateWindow(
|
||||
@@ -695,6 +695,8 @@ bool ContentBrowserClient::CanCreateWindow(
|
||||
const std::string& frame_name,
|
||||
WindowOpenDisposition disposition,
|
||||
const blink::mojom::WindowFeatures& features,
|
||||
@@ -79,7 +79,7 @@ index 549fa60921444c60b3343fc381fb283ca73f7b6a..c76eb798967426772e8e673f93f22358
|
||||
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 667ba54d54dfccb37540e3eb00c6d1d0a078ff2f..98582da50756470a233dcec6ebd5ad78a172a74c 100644
|
||||
index a6e922be7e68644ad1cfe64462712c0430c6749a..b3fb95c4bc6bfd5559c034ee5c946bd7d5a14050 100644
|
||||
--- a/content/public/browser/content_browser_client.h
|
||||
+++ b/content/public/browser/content_browser_client.h
|
||||
@@ -173,6 +173,7 @@ class NetworkService;
|
||||
@@ -90,7 +90,7 @@ index 667ba54d54dfccb37540e3eb00c6d1d0a078ff2f..98582da50756470a233dcec6ebd5ad78
|
||||
} // namespace network
|
||||
|
||||
namespace sandbox {
|
||||
@@ -1097,6 +1098,8 @@ class CONTENT_EXPORT ContentBrowserClient {
|
||||
@@ -1109,6 +1110,8 @@ class CONTENT_EXPORT ContentBrowserClient {
|
||||
const std::string& frame_name,
|
||||
WindowOpenDisposition disposition,
|
||||
const blink::mojom::WindowFeatures& features,
|
||||
|
||||
@@ -82,7 +82,7 @@ index 33ca7a53dfb6d2c9e3a33f0065a3acd806e82e01..9fdf2e8ff0056ff407015b914c6b03eb
|
||||
const Source& GetSource(int index) const override;
|
||||
DesktopMediaList::Type GetMediaListType() const override;
|
||||
diff --git a/chrome/browser/media/webrtc/native_desktop_media_list.cc b/chrome/browser/media/webrtc/native_desktop_media_list.cc
|
||||
index 9ce1d9acbf2fd4b521905f4e4c2d0bb0d63bb170..20be457034f0636486c0ca560628e554b5792445 100644
|
||||
index 81d4416e270e1a4548866a56222c47cb616385e3..22f55d22b0406f0d1aa642dcea44403ac1636057 100644
|
||||
--- a/chrome/browser/media/webrtc/native_desktop_media_list.cc
|
||||
+++ b/chrome/browser/media/webrtc/native_desktop_media_list.cc
|
||||
@@ -159,7 +159,7 @@ BOOL CALLBACK AllHwndCollector(HWND hwnd, LPARAM param) {
|
||||
|
||||
@@ -33,7 +33,7 @@ index 0ab8187b0db8ae6db46d81738f653a2bc4c566f6..de3d55e85c22317f7f9375eb94d0d5d4
|
||||
|
||||
} // namespace net
|
||||
diff --git a/services/network/network_context.cc b/services/network/network_context.cc
|
||||
index ad246393cbd3eedbd91495fe9d3c3f046ccfb553..e748386cdbeefec2acf2a6054b21eadc0f6a556f 100644
|
||||
index cb05975b622eee25217d9f2477c5e53ace017db8..e264713f4361a588e0ec8b4f6f37ab76ad642116 100644
|
||||
--- a/services/network/network_context.cc
|
||||
+++ b/services/network/network_context.cc
|
||||
@@ -1559,6 +1559,13 @@ void NetworkContext::SetNetworkConditions(
|
||||
@@ -51,7 +51,7 @@ index ad246393cbd3eedbd91495fe9d3c3f046ccfb553..e748386cdbeefec2acf2a6054b21eadc
|
||||
// This may only be called on NetworkContexts created with the constructor
|
||||
// that calls MakeURLRequestContext().
|
||||
diff --git a/services/network/network_context.h b/services/network/network_context.h
|
||||
index 4c0cb2e133d84329ab58eff4f30dc7615516b3ae..8790965cc2ac2f9e77dec85d152e5ce66766c3cd 100644
|
||||
index 25f9dab24b27ad2b3d6ca01690e9f5c3fea96d32..b230036559cdc44b97b3a5ca5f359a0b4512ccd7 100644
|
||||
--- a/services/network/network_context.h
|
||||
+++ b/services/network/network_context.h
|
||||
@@ -316,6 +316,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext
|
||||
@@ -63,10 +63,10 @@ index 4c0cb2e133d84329ab58eff4f30dc7615516b3ae..8790965cc2ac2f9e77dec85d152e5ce6
|
||||
void SetEnableReferrers(bool enable_referrers) override;
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom
|
||||
index 772577a0ed4aeb47bb13dcd27ea38b943a2c0952..d7601f0f1b699984577b0d84a8b60d3dbad0d4fb 100644
|
||||
index 6ebade992b628fee18d23e5e29d2d7d6190261a7..21039664d38fb228a9319d296276c33de7a0a265 100644
|
||||
--- a/services/network/public/mojom/network_context.mojom
|
||||
+++ b/services/network/public/mojom/network_context.mojom
|
||||
@@ -1227,6 +1227,9 @@ interface NetworkContext {
|
||||
@@ -1233,6 +1233,9 @@ interface NetworkContext {
|
||||
SetNetworkConditions(mojo_base.mojom.UnguessableToken throttling_profile_id,
|
||||
NetworkConditions? conditions);
|
||||
|
||||
@@ -77,7 +77,7 @@ index 772577a0ed4aeb47bb13dcd27ea38b943a2c0952..d7601f0f1b699984577b0d84a8b60d3d
|
||||
SetAcceptLanguage(string new_accept_language);
|
||||
|
||||
diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h
|
||||
index 73fe4ad8d0ff68fdb0d2e556e23284154aaf417b..a097e15a0dd47421bb8e20d1fc8b75967bdf2c6f 100644
|
||||
index 9845739908daada58d620cacf95c2b0fbe80ccfb..40dba78ea2dc740c6f0edd7c896bf8bf16abc51e 100644
|
||||
--- a/services/network/test/test_network_context.h
|
||||
+++ b/services/network/test/test_network_context.h
|
||||
@@ -144,6 +144,7 @@ class TestNetworkContext : public mojom::NetworkContext {
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: expose V8Initializer::CodeGenerationCheckCallbackInMainThread
|
||||
This is needed to blend Blink and Node's policy for code generation policy.
|
||||
|
||||
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 c652963d9861c9aa754563c9d282dd5cc72e4e34..3da7200c92ccaf8330d46280e26124c1ad558a76 100644
|
||||
index 9bb1917278452e5b9d00dbb39b44416558987255..20d188f57d5425c5f704b3b03cd27034efb25ea7 100644
|
||||
--- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
|
||||
+++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
|
||||
@@ -411,8 +411,9 @@ TrustedTypesCodeGenerationCheck(v8::Local<v8::Context> context,
|
||||
|
||||
@@ -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 b68423ffe09246ec7ba2935873774c7c452b5952..936ab4b4e12546ca93da27f264559c97f51509ae 100644
|
||||
index b9d1652cfc2628d1f9f98698e8fddbfbae62b4de..bc93b2d47c061538d30bc886709abcda5f2d6eb0 100644
|
||||
--- a/chrome/browser/resources/pdf/pdf_viewer.ts
|
||||
+++ b/chrome/browser/resources/pdf/pdf_viewer.ts
|
||||
@@ -895,26 +895,12 @@ export class PdfViewerElement extends PdfViewerBaseElement {
|
||||
@@ -898,26 +898,12 @@ export class PdfViewerElement extends PdfViewerBaseElement {
|
||||
dataArray = [result.dataToSave];
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ index b68423ffe09246ec7ba2935873774c7c452b5952..936ab4b4e12546ca93da27f264559c97
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1022,30 +1008,12 @@ export class PdfViewerElement extends PdfViewerBaseElement {
|
||||
@@ -1025,30 +1011,12 @@ export class PdfViewerElement extends PdfViewerBaseElement {
|
||||
fileName = fileName + '.pdf';
|
||||
}
|
||||
|
||||
|
||||
@@ -100,10 +100,10 @@ index 07847521e7217c78480205812a73cc89503c00d2..586e866ca7ec0eb0b573d23e3bd95792
|
||||
} 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 f3892e3f9ff2557bf604b48a8abc0fc4cbd3df1f..ba57bfc2dcef007dee536be0be6eb64d86532d09 100644
|
||||
index e270fa36d775333aaa30f1ff0104062c544d1058..e4a6213e19e4f23834802784a43db22c9d02d891 100644
|
||||
--- a/ui/gtk/printing/print_dialog_gtk.cc
|
||||
+++ b/ui/gtk/printing/print_dialog_gtk.cc
|
||||
@@ -258,6 +258,24 @@ void PrintDialogGtk::UpdateSettings(
|
||||
@@ -245,6 +245,24 @@ void PrintDialogGtk::UpdateSettings(
|
||||
|
||||
gtk_print_settings_set_n_copies(gtk_settings_, settings->copies());
|
||||
gtk_print_settings_set_collate(gtk_settings_, settings->collate());
|
||||
|
||||
@@ -20,7 +20,7 @@ index 802e0ab8073b0709bd723c4d08eafbefef575592..93a6e16a3fee99c9c9d8e85f2a8e43bf
|
||||
}
|
||||
|
||||
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
|
||||
index 98582da50756470a233dcec6ebd5ad78a172a74c..4179b3bd9825868245ea6431291166f377a6990d 100644
|
||||
index b3fb95c4bc6bfd5559c034ee5c946bd7d5a14050..36f3b03d11aada28be45a75e90054c8996ad0f33 100644
|
||||
--- a/content/public/browser/content_browser_client.h
|
||||
+++ b/content/public/browser/content_browser_client.h
|
||||
@@ -311,6 +311,11 @@ class CONTENT_EXPORT ContentBrowserClient {
|
||||
|
||||
@@ -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 65b1c1214ee4de50d43d88f880aa578ab45d30ae..ad246393cbd3eedbd91495fe9d3c3f046ccfb553 100644
|
||||
index f076c5dc62ca5975865e3966381257684503eeb8..cb05975b622eee25217d9f2477c5e53ace017db8 100644
|
||||
--- a/services/network/network_context.cc
|
||||
+++ b/services/network/network_context.cc
|
||||
@@ -146,6 +146,11 @@
|
||||
@@ -147,7 +147,7 @@ index 65b1c1214ee4de50d43d88f880aa578ab45d30ae..ad246393cbd3eedbd91495fe9d3c3f04
|
||||
|
||||
builder.SetCertVerifier(IgnoreErrorsCertVerifier::MaybeWrapCertVerifier(
|
||||
diff --git a/services/network/network_context.h b/services/network/network_context.h
|
||||
index ff73db2f2a269de96efb4c762c92e0d3f7514945..4c0cb2e133d84329ab58eff4f30dc7615516b3ae 100644
|
||||
index d046d6909a9e648ddc86cbed9cb118d29223155e..25f9dab24b27ad2b3d6ca01690e9f5c3fea96d32 100644
|
||||
--- a/services/network/network_context.h
|
||||
+++ b/services/network/network_context.h
|
||||
@@ -114,6 +114,7 @@ class URLMatcher;
|
||||
@@ -177,7 +177,7 @@ index ff73db2f2a269de96efb4c762c92e0d3f7514945..4c0cb2e133d84329ab58eff4f30dc761
|
||||
std::unique_ptr<HostResolver> internal_host_resolver_;
|
||||
// Map values set to non-null only if that HostResolver has its own private
|
||||
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom
|
||||
index 40dfb7fd2ad98b80a3f41c0e8e3d82674339cd9e..772577a0ed4aeb47bb13dcd27ea38b943a2c0952 100644
|
||||
index 039407080ba9b234b0472afd7d56d44802fd3c0e..6ebade992b628fee18d23e5e29d2d7d6190261a7 100644
|
||||
--- a/services/network/public/mojom/network_context.mojom
|
||||
+++ b/services/network/public/mojom/network_context.mojom
|
||||
@@ -317,6 +317,17 @@ struct NetworkContextFilePaths {
|
||||
@@ -198,7 +198,7 @@ index 40dfb7fd2ad98b80a3f41c0e8e3d82674339cd9e..772577a0ed4aeb47bb13dcd27ea38b94
|
||||
// Parameters for constructing a network context.
|
||||
struct NetworkContextParams {
|
||||
// The user agent string.
|
||||
@@ -936,6 +947,9 @@ interface NetworkContext {
|
||||
@@ -942,6 +953,9 @@ interface NetworkContext {
|
||||
// Sets a client for this network context.
|
||||
SetClient(pending_remote<NetworkContextClient> client);
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@ majority of changes originally come from these PRs:
|
||||
This patch also fixes callback for manual user cancellation and success.
|
||||
|
||||
diff --git a/BUILD.gn b/BUILD.gn
|
||||
index ce097109b6a199de57693481310bbf5fdd948c35..11e5c96c3379375bd320320fc684881013ef0e8f 100644
|
||||
index e8c8a8450ff8325905a76addc262a6fd68f037be..e703690f0f0952d7f97cde04e7c2c786ab1747ec 100644
|
||||
--- a/BUILD.gn
|
||||
+++ b/BUILD.gn
|
||||
@@ -969,7 +969,6 @@ if (is_win) {
|
||||
@@ -973,7 +973,6 @@ if (is_win) {
|
||||
"//media:media_unittests",
|
||||
"//media/midi:midi_unittests",
|
||||
"//net:net_unittests",
|
||||
@@ -22,7 +22,7 @@ index ce097109b6a199de57693481310bbf5fdd948c35..11e5c96c3379375bd320320fc6848810
|
||||
"//sql:sql_unittests",
|
||||
"//third_party/breakpad:symupload($host_toolchain)",
|
||||
"//ui/base:ui_base_unittests",
|
||||
@@ -978,6 +977,10 @@ if (is_win) {
|
||||
@@ -982,6 +981,10 @@ if (is_win) {
|
||||
"//ui/views:views_unittests",
|
||||
"//url:url_unittests",
|
||||
]
|
||||
@@ -927,10 +927,10 @@ index 8d65b7b6440c8e653eb1b3f9c50b40944b7ae61b..eb6b4a42d507ff216fc07328c1907815
|
||||
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
||||
// Set options for print preset from source PDF document.
|
||||
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
|
||||
index e861d5b7562cda69a7e113882d22087a2f6cdda9..e0d55a859061f029e5298599bf2d9345674ecb34 100644
|
||||
index 89b2e2bd7d6091501756b4d31726c49b00ffd0c7..718ad3e088f6730bb00f1e3674effae6c429b9b6 100644
|
||||
--- a/content/browser/BUILD.gn
|
||||
+++ b/content/browser/BUILD.gn
|
||||
@@ -2951,8 +2951,9 @@ source_set("browser") {
|
||||
@@ -2953,8 +2953,9 @@ source_set("browser") {
|
||||
"//ppapi/shared_impl",
|
||||
]
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Subject: refactor: expose HostImportModuleDynamically and
|
||||
This is so that Electron can blend Blink's and Node's implementations of these isolate handlers.
|
||||
|
||||
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 3da7200c92ccaf8330d46280e26124c1ad558a76..5ceecd071ca2efd2a7db214b65c4a997ef31d0b0 100644
|
||||
index 20d188f57d5425c5f704b3b03cd27034efb25ea7..ff8de70fe7638f1f4fb2f4839ccf54e22339ba8b 100644
|
||||
--- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
|
||||
+++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
|
||||
@@ -578,7 +578,9 @@ bool JavaScriptCompileHintsMagicEnabledCallback(
|
||||
@@ -21,7 +21,7 @@ index 3da7200c92ccaf8330d46280e26124c1ad558a76..5ceecd071ca2efd2a7db214b65c4a997
|
||||
v8::Local<v8::Context> context,
|
||||
v8::Local<v8::Data> v8_host_defined_options,
|
||||
v8::Local<v8::Value> v8_referrer_resource_url,
|
||||
@@ -644,7 +646,7 @@ v8::MaybeLocal<v8::Promise> HostImportModuleDynamically(
|
||||
@@ -653,7 +655,7 @@ v8::MaybeLocal<v8::Promise> HostImportModuleDynamically(
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/C/#hostgetimportmetaproperties
|
||||
@@ -30,7 +30,7 @@ index 3da7200c92ccaf8330d46280e26124c1ad558a76..5ceecd071ca2efd2a7db214b65c4a997
|
||||
v8::Local<v8::Module> module,
|
||||
v8::Local<v8::Object> meta) {
|
||||
ScriptState* script_state = ScriptState::From(context);
|
||||
@@ -671,6 +673,8 @@ void HostGetImportMetaProperties(v8::Local<v8::Context> context,
|
||||
@@ -680,6 +682,8 @@ void HostGetImportMetaProperties(v8::Local<v8::Context> context,
|
||||
meta->CreateDataProperty(context, resolve_key, resolve_value).ToChecked();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ index 3da7200c92ccaf8330d46280e26124c1ad558a76..5ceecd071ca2efd2a7db214b65c4a997
|
||||
void InitializeV8Common(v8::Isolate* isolate) {
|
||||
// Set up garbage collection before setting up anything else as V8 may trigger
|
||||
// GCs during Blink setup.
|
||||
@@ -690,9 +694,9 @@ void InitializeV8Common(v8::Isolate* isolate) {
|
||||
@@ -699,9 +703,9 @@ void InitializeV8Common(v8::Isolate* isolate) {
|
||||
SharedArrayBufferConstructorEnabledCallback);
|
||||
isolate->SetJavaScriptCompileHintsMagicEnabledCallback(
|
||||
JavaScriptCompileHintsMagicEnabledCallback);
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <samuel.r.attard@gmail.com>
|
||||
Date: Tue, 5 Sep 2023 13:22:31 -0700
|
||||
Subject: Revert "Remove the AllowAggressiveThrottlingWithWebSocket feature."
|
||||
|
||||
This reverts commit 615c1810a187840ffeb04096087efff86edb37de.
|
||||
|
||||
diff --git a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc
|
||||
index d566c1a209aa5b39692fe79dd8b5012a5e053574..90e97f739b3e7ede2fa4ceffb1be5130f651f60b 100644
|
||||
--- a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc
|
||||
+++ b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc
|
||||
@@ -95,6 +95,17 @@ enum WebSocketOpCode {
|
||||
kOpCodeBinary = 0x2,
|
||||
};
|
||||
|
||||
+// When enabled, a page can be aggressively throttled even if it uses a
|
||||
+// WebSocket. Aggressive throttling does not affect the execution of WebSocket
|
||||
+// event handlers, so there is little reason to disable it on pages using a
|
||||
+// WebSocket.
|
||||
+//
|
||||
+// TODO(crbug.com/1121725): Cleanup this feature in June 2021, when it becomes
|
||||
+// enabled by default on Stable.
|
||||
+BASE_FEATURE(kAllowAggressiveThrottlingWithWebSocket,
|
||||
+ "AllowAggressiveThrottlingWithWebSocket",
|
||||
+ base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
+
|
||||
} // namespace
|
||||
|
||||
void WebSocketChannelImpl::MessageDataDeleter::operator()(char* p) const {
|
||||
@@ -285,7 +296,10 @@ bool WebSocketChannelImpl::Connect(const KURL& url, const String& protocol) {
|
||||
// even if the `WebSocketChannel` is closed.
|
||||
feature_handle_for_scheduler_ = scheduler->RegisterFeature(
|
||||
SchedulingPolicy::Feature::kWebSocket,
|
||||
- SchedulingPolicy{SchedulingPolicy::DisableBackForwardCache()});
|
||||
+ base::FeatureList::IsEnabled(kAllowAggressiveThrottlingWithWebSocket)
|
||||
+ ? SchedulingPolicy{SchedulingPolicy::DisableBackForwardCache()}
|
||||
+ : SchedulingPolicy{SchedulingPolicy::DisableAggressiveThrottling(),
|
||||
+ SchedulingPolicy::DisableBackForwardCache()});
|
||||
scheduler->RegisterStickyFeature(
|
||||
SchedulingPolicy::Feature::kWebSocketSticky,
|
||||
SchedulingPolicy{SchedulingPolicy::DisableBackForwardCache()});
|
||||
@@ -15,7 +15,7 @@ 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 e2303fbb80ccc7d76d6a949678608c6a55ea411d..029c90e6f1ea240d2c4f87182351b6c587fbef4b 100644
|
||||
index 586aa87098bd3db10440fe865a02c05e7b3be14f..cb372df065f83614ff6c2954035795e67eb69d0c 100644
|
||||
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -7417,6 +7417,17 @@ void RenderFrameHostImpl::EnterFullscreen(
|
||||
|
||||
@@ -26,10 +26,10 @@ index a4130ad4dc8158f8256b55fdd87f577687135626..3139aa65807cee23f0e8dbc85243566e
|
||||
// An empty URL is returned if the URL is not overriden.
|
||||
virtual GURL OverrideFlashEmbedWithHTML(const GURL& url);
|
||||
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
|
||||
index 0371357fd074162b7569b2075acf0342b1fbd39b..f5cca7df8c6876ea777ee985d77e3a882b0b2776 100644
|
||||
index 3206463a734a864e98a2ccdec14fa1f9a8df776a..8bc668a443fb33cb560e4c9592f53920869166c4 100644
|
||||
--- a/content/renderer/renderer_blink_platform_impl.cc
|
||||
+++ b/content/renderer/renderer_blink_platform_impl.cc
|
||||
@@ -794,6 +794,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() {
|
||||
@@ -795,6 +795,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() {
|
||||
WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,10 +35,10 @@ index 3139aa65807cee23f0e8dbc85243566ef9de89b9..19707edb1283f2432f3c0059f80fabd5
|
||||
// from the worker thread.
|
||||
virtual void WillDestroyWorkerContextOnWorkerThread(
|
||||
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
|
||||
index f5cca7df8c6876ea777ee985d77e3a882b0b2776..104be40b57bed8ecdc7e81953810ba79355a6e44 100644
|
||||
index 8bc668a443fb33cb560e4c9592f53920869166c4..8dbadf5b2dc233ea1f298c5ad26d5bf1ed0acc64 100644
|
||||
--- a/content/renderer/renderer_blink_platform_impl.cc
|
||||
+++ b/content/renderer/renderer_blink_platform_impl.cc
|
||||
@@ -806,6 +806,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated(
|
||||
@@ -807,6 +807,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated(
|
||||
worker);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch
|
||||
chore_add_context_to_context_aware_module_prevention.patch
|
||||
fix_handle_boringssl_and_openssl_incompatibilities.patch
|
||||
fix_crypto_tests_to_run_with_bssl.patch
|
||||
fix_account_for_debugger_agent_race_condition.patch
|
||||
fix_readbarrier_undefined_symbol_error_on_woa_arm64.patch
|
||||
fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch
|
||||
fix_serdes_test.patch
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Thu, 10 Jun 2021 15:15:35 +0200
|
||||
Subject: fix: account for debugger agent race condition
|
||||
|
||||
In Electron the debugger agent hasn't necessarily been enabled by the
|
||||
time the inspect prompt displays, leading to "Debugger agent is not enabled"
|
||||
errors. This is remedied by adding a small timeout to the test.
|
||||
|
||||
We'll either upstream this or figure out a better solution.
|
||||
|
||||
diff --git a/test/parallel/test-debugger-address.mjs b/test/parallel/test-debugger-address.mjs
|
||||
index eab99c9b0e2fb387ef9a716396e41c7fc93e93bc..ef8b20a60df88a0a412c309f597e1b1f652fef07 100644
|
||||
--- a/test/parallel/test-debugger-address.mjs
|
||||
+++ b/test/parallel/test-debugger-address.mjs
|
||||
@@ -56,6 +56,7 @@ function launchTarget(...args) {
|
||||
const { childProc, host, port } = await launchTarget('--inspect=0', script);
|
||||
target = childProc;
|
||||
cli = startCLI([`${host || '127.0.0.1'}:${port}`]);
|
||||
+ await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
await cli.waitForPrompt();
|
||||
await cli.command('sb("alive.js", 3)');
|
||||
await cli.waitFor(/break/);
|
||||
diff --git a/test/parallel/test-debugger-random-port-with-inspect-port.js b/test/parallel/test-debugger-random-port-with-inspect-port.js
|
||||
index 3acc6bdd733eb002a2592960528bb04eebb2dc60..a9f2d29327464281c10d4c2210277eab47c9a262 100644
|
||||
--- a/test/parallel/test-debugger-random-port-with-inspect-port.js
|
||||
+++ b/test/parallel/test-debugger-random-port-with-inspect-port.js
|
||||
@@ -13,6 +13,7 @@ const script = fixtures.path('debugger', 'three-lines.js');
|
||||
const cli = startCLI(['--inspect-port=0', script]);
|
||||
|
||||
(async () => {
|
||||
+ await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
await cli.waitForInitialBreak();
|
||||
await cli.waitForPrompt();
|
||||
assert.match(cli.output, /debug>/, 'prints a prompt');
|
||||
diff --git a/test/sequential/test-debugger-pid.js b/test/sequential/test-debugger-pid.js
|
||||
index 99062149dfe3374b86439850e0655383e2bad662..78c173f5073818fae7d46413842cb7790130c3f5 100644
|
||||
--- a/test/sequential/test-debugger-pid.js
|
||||
+++ b/test/sequential/test-debugger-pid.js
|
||||
@@ -20,6 +20,7 @@ const runTest = async () => {
|
||||
await cli.command('sb("alive.js", 3)');
|
||||
await cli.waitFor(/break/);
|
||||
await cli.waitForPrompt();
|
||||
+ await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
assert.match(
|
||||
cli.output,
|
||||
/> 3 {3}\+\+x;/,
|
||||
@@ -591,22 +591,34 @@ describe('BrowserWindow module', () => {
|
||||
let url = null as unknown as string;
|
||||
before(async () => {
|
||||
server = http.createServer((req, res) => {
|
||||
if (req.url === '/navigate-top') {
|
||||
res.end('<a target=_top href="/">navigate _top</a>');
|
||||
} else if (req.url === '/navigate-iframe') {
|
||||
res.end('<a href="/test">navigate iframe</a>');
|
||||
} else if (req.url === '/navigate-iframe?navigated') {
|
||||
res.end('Successfully navigated');
|
||||
} else if (req.url === '/navigate-iframe-immediately') {
|
||||
res.end(`
|
||||
switch (req.url) {
|
||||
case '/navigate-top': {
|
||||
res.end('<a target=_top href="/">navigate _top</a>');
|
||||
break;
|
||||
}
|
||||
case '/navigate-iframe': {
|
||||
res.end('<a href="/test">navigate iframe</a>');
|
||||
break;
|
||||
}
|
||||
case '/navigate-iframe?navigated': {
|
||||
res.end('Successfully navigated');
|
||||
break;
|
||||
}
|
||||
case '/navigate-iframe-immediately': {
|
||||
res.end(`
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
location.href += '?navigated'
|
||||
</script>
|
||||
`);
|
||||
} else if (req.url === '/navigate-iframe-immediately?navigated') {
|
||||
res.end('Successfully navigated');
|
||||
} else {
|
||||
res.end('');
|
||||
break;
|
||||
}
|
||||
case '/navigate-iframe-immediately?navigated': {
|
||||
res.end('Successfully navigated');
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
res.end('');
|
||||
}
|
||||
}
|
||||
});
|
||||
url = (await listen(server)).url;
|
||||
@@ -882,18 +894,28 @@ describe('BrowserWindow module', () => {
|
||||
];
|
||||
before(async () => {
|
||||
server = http.createServer((req, res) => {
|
||||
if (req.url === '/navigate') {
|
||||
res.end('<a href="/">navigate</a>');
|
||||
} else if (req.url === '/redirect') {
|
||||
res.end('<a href="/redirect2">redirect</a>');
|
||||
} else if (req.url === '/redirect2') {
|
||||
res.statusCode = 302;
|
||||
res.setHeader('location', url);
|
||||
res.end();
|
||||
} else if (req.url === '/in-page') {
|
||||
res.end('<a href="#in-page">redirect</a><div id="in-page"></div>');
|
||||
} else {
|
||||
res.end('');
|
||||
switch (req.url) {
|
||||
case '/navigate': {
|
||||
res.end('<a href="/">navigate</a>');
|
||||
break;
|
||||
}
|
||||
case '/redirect': {
|
||||
res.end('<a href="/redirect2">redirect</a>');
|
||||
break;
|
||||
}
|
||||
case '/redirect2': {
|
||||
res.statusCode = 302;
|
||||
res.setHeader('location', url);
|
||||
res.end();
|
||||
break;
|
||||
}
|
||||
case '/in-page': {
|
||||
res.end('<a href="#in-page">redirect</a><div id="in-page"></div>');
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
res.end('');
|
||||
}
|
||||
}
|
||||
});
|
||||
url = (await listen(server)).url;
|
||||
@@ -3425,7 +3447,7 @@ describe('BrowserWindow module', () => {
|
||||
w.loadURL(pageUrl);
|
||||
const [, url] = await once(ipcMain, 'answer');
|
||||
const expectedUrl = process.platform === 'win32'
|
||||
? 'file:///' + htmlPath.replace(/\\/g, '/')
|
||||
? 'file:///' + htmlPath.replaceAll('\\', '/')
|
||||
: pageUrl;
|
||||
expect(url).to.equal(expectedUrl);
|
||||
});
|
||||
@@ -3475,7 +3497,7 @@ describe('BrowserWindow module', () => {
|
||||
w.loadURL(pageUrl);
|
||||
const [, { url, frameName, options }] = await once(w.webContents, 'did-create-window') as [BrowserWindow, Electron.DidCreateWindowDetails];
|
||||
const expectedUrl = process.platform === 'win32'
|
||||
? 'file:///' + htmlPath.replace(/\\/g, '/')
|
||||
? 'file:///' + htmlPath.replaceAll('\\', '/')
|
||||
: pageUrl;
|
||||
expect(url).to.equal(expectedUrl);
|
||||
expect(frameName).to.equal('popup!');
|
||||
|
||||
@@ -501,33 +501,38 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
|
||||
});
|
||||
|
||||
function crash (processType: string, remotely: Function) {
|
||||
if (processType === 'main') {
|
||||
return remotely(() => {
|
||||
setTimeout().then(() => { process.crash(); });
|
||||
});
|
||||
} else if (processType === 'renderer') {
|
||||
return remotely(() => {
|
||||
const { BrowserWindow } = require('electron');
|
||||
const bw = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, contextIsolation: false } });
|
||||
bw.loadURL('about:blank');
|
||||
bw.webContents.executeJavaScript('process.crash()');
|
||||
});
|
||||
} else if (processType === 'sandboxed-renderer') {
|
||||
const preloadPath = path.join(__dirname, 'fixtures', 'apps', 'crash', 'sandbox-preload.js');
|
||||
return remotely((preload: string) => {
|
||||
const { BrowserWindow } = require('electron');
|
||||
const bw = new BrowserWindow({ show: false, webPreferences: { sandbox: true, preload, contextIsolation: false } });
|
||||
bw.loadURL('about:blank');
|
||||
}, preloadPath);
|
||||
} else if (processType === 'node') {
|
||||
const crashScriptPath = path.join(__dirname, 'fixtures', 'apps', 'crash', 'node-crash.js');
|
||||
return remotely((crashScriptPath: string) => {
|
||||
const { app } = require('electron');
|
||||
const childProcess = require('node:child_process');
|
||||
const version = app.getVersion();
|
||||
const url = 'http://127.0.0.1';
|
||||
childProcess.fork(crashScriptPath, [url, version], { silent: true });
|
||||
}, crashScriptPath);
|
||||
switch (processType) {
|
||||
case 'main': {
|
||||
return remotely(() => {
|
||||
setTimeout().then(() => { process.crash(); });
|
||||
});
|
||||
}
|
||||
case 'renderer': {
|
||||
return remotely(() => {
|
||||
const { BrowserWindow } = require('electron');
|
||||
const bw = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, contextIsolation: false } });
|
||||
bw.loadURL('about:blank');
|
||||
bw.webContents.executeJavaScript('process.crash()');
|
||||
});
|
||||
}
|
||||
case 'sandboxed-renderer': {
|
||||
const preloadPath = path.join(__dirname, 'fixtures', 'apps', 'crash', 'sandbox-preload.js');
|
||||
return remotely((preload: string) => {
|
||||
const { BrowserWindow } = require('electron');
|
||||
const bw = new BrowserWindow({ show: false, webPreferences: { sandbox: true, preload, contextIsolation: false } });
|
||||
bw.loadURL('about:blank');
|
||||
}, preloadPath);
|
||||
}
|
||||
case 'node': {
|
||||
const crashScriptPath = path.join(__dirname, 'fixtures', 'apps', 'crash', 'node-crash.js');
|
||||
return remotely((crashScriptPath: string) => {
|
||||
const { app } = require('electron');
|
||||
const childProcess = require('node:child_process');
|
||||
const version = app.getVersion();
|
||||
const url = 'http://127.0.0.1';
|
||||
childProcess.fork(crashScriptPath, [url, version], { silent: true });
|
||||
}, crashScriptPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ describe('debugger module', () => {
|
||||
it('fires message event', async () => {
|
||||
const url = process.platform !== 'win32'
|
||||
? `file://${path.join(fixtures, 'pages', 'a.html')}`
|
||||
: `file:///${path.join(fixtures, 'pages', 'a.html').replace(/\\/g, '/')}`;
|
||||
: `file:///${path.join(fixtures, 'pages', 'a.html').replaceAll('\\', '/')}`;
|
||||
w.webContents.loadURL(url);
|
||||
w.webContents.debugger.attach();
|
||||
const message = emittedUntil(w.webContents.debugger, 'message',
|
||||
|
||||
@@ -1128,7 +1128,7 @@ describe('protocol module', () => {
|
||||
protocol.handle('file', (req) => {
|
||||
let file;
|
||||
if (process.platform === 'win32') {
|
||||
file = `file:///${filePath.replace(/\\/g, '/')}`;
|
||||
file = `file:///${filePath.replaceAll('\\', '/')}`;
|
||||
} else {
|
||||
file = `file://${filePath}`;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ describe('session module', () => {
|
||||
|
||||
appProcess.stdout.on('data', data => { output += data; });
|
||||
appProcess.on('exit', () => {
|
||||
resolve(output.replace(/(\r\n|\n|\r)/gm, ''));
|
||||
resolve(output.replaceAll(/(\r\n|\n|\r)/gm, ''));
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1415,18 +1415,28 @@ describe('webContents module', () => {
|
||||
before(async () => {
|
||||
server = http.createServer((req, res) => {
|
||||
const respond = () => {
|
||||
if (req.url === '/redirect-cross-site') {
|
||||
res.setHeader('Location', `${crossSiteUrl}/redirected`);
|
||||
res.statusCode = 302;
|
||||
res.end();
|
||||
} else if (req.url === '/redirected') {
|
||||
res.end('<html><script>window.localStorage</script></html>');
|
||||
} else if (req.url === '/first-window-open') {
|
||||
res.end(`<html><script>window.open('${serverUrl}/second-window-open', 'first child');</script></html>`);
|
||||
} else if (req.url === '/second-window-open') {
|
||||
res.end('<html><script>window.open(\'wrong://url\', \'second child\');</script></html>');
|
||||
} else {
|
||||
res.end();
|
||||
switch (req.url) {
|
||||
case '/redirect-cross-site': {
|
||||
res.setHeader('Location', `${crossSiteUrl}/redirected`);
|
||||
res.statusCode = 302;
|
||||
res.end();
|
||||
break;
|
||||
}
|
||||
case '/redirected': {
|
||||
res.end('<html><script>window.localStorage</script></html>');
|
||||
break;
|
||||
}
|
||||
case '/first-window-open': {
|
||||
res.end(`<html><script>window.open('${serverUrl}/second-window-open', 'first child');</script></html>`);
|
||||
break;
|
||||
}
|
||||
case '/second-window-open': {
|
||||
res.end('<html><script>window.open(\'wrong://url\', \'second child\');</script></html>');
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
res.end();
|
||||
}
|
||||
}
|
||||
};
|
||||
setTimeout().then(respond);
|
||||
|
||||
@@ -181,7 +181,7 @@ describe('webRequest module', () => {
|
||||
callback({ cancel: true });
|
||||
});
|
||||
const fileURL = url.format({
|
||||
pathname: path.join(fixturesPath, 'blank.html').replace(/\\/g, '/'),
|
||||
pathname: path.join(fixturesPath, 'blank.html').replaceAll('\\', '/'),
|
||||
protocol: 'file',
|
||||
slashes: true
|
||||
});
|
||||
@@ -395,7 +395,7 @@ describe('webRequest module', () => {
|
||||
onSendHeadersCalled = true;
|
||||
});
|
||||
await ajax(url.format({
|
||||
pathname: path.join(fixturesPath, 'blank.html').replace(/\\/g, '/'),
|
||||
pathname: path.join(fixturesPath, 'blank.html').replaceAll('\\', '/'),
|
||||
protocol: 'file',
|
||||
slashes: true
|
||||
}));
|
||||
|
||||
@@ -90,7 +90,7 @@ describe('asar package', () => {
|
||||
await w.loadFile(path.join(fixtures, 'workers', 'load_worker.html'));
|
||||
|
||||
const workerUrl = url.format({
|
||||
pathname: path.resolve(fixtures, 'workers', 'workers.asar', 'worker.js').replace(/\\/g, '/'),
|
||||
pathname: path.resolve(fixtures, 'workers', 'workers.asar', 'worker.js').replaceAll('\\', '/'),
|
||||
protocol: 'file',
|
||||
slashes: true
|
||||
});
|
||||
@@ -103,7 +103,7 @@ describe('asar package', () => {
|
||||
await w.loadFile(path.join(fixtures, 'workers', 'load_shared_worker.html'));
|
||||
|
||||
const workerUrl = url.format({
|
||||
pathname: path.resolve(fixtures, 'workers', 'workers.asar', 'shared_worker.js').replace(/\\/g, '/'),
|
||||
pathname: path.resolve(fixtures, 'workers', 'workers.asar', 'shared_worker.js').replaceAll('\\', '/'),
|
||||
protocol: 'file',
|
||||
slashes: true
|
||||
});
|
||||
@@ -1243,7 +1243,7 @@ describe('asar package', function () {
|
||||
const echo = path.join(asarDir, 'echo.asar', 'echo');
|
||||
|
||||
const stdout = await promisify(require(childProcess).exec)('echo ' + echo + ' foo bar');
|
||||
expect(stdout.toString().replace(/\r/g, '')).to.equal(echo + ' foo bar\n');
|
||||
expect(stdout.toString().replaceAll('\r', '')).to.equal(echo + ' foo bar\n');
|
||||
}, [childProcess]);
|
||||
});
|
||||
|
||||
@@ -1252,7 +1252,7 @@ describe('asar package', function () {
|
||||
const echo = path.join(asarDir, 'echo.asar', 'echo');
|
||||
|
||||
const stdout = require(childProcess).execSync('echo ' + echo + ' foo bar');
|
||||
expect(stdout.toString().replace(/\r/g, '')).to.equal(echo + ' foo bar\n');
|
||||
expect(stdout.toString().replaceAll('\r', '')).to.equal(echo + ' foo bar\n');
|
||||
}, [childProcess]);
|
||||
});
|
||||
|
||||
|
||||
@@ -284,7 +284,7 @@ describe('web security', () => {
|
||||
describe('accessing file://', () => {
|
||||
async function loadFile (w: BrowserWindow) {
|
||||
const thisFile = url.format({
|
||||
pathname: __filename.replace(/\\/g, '/'),
|
||||
pathname: __filename.replaceAll('\\', '/'),
|
||||
protocol: 'file',
|
||||
slashes: true
|
||||
});
|
||||
@@ -461,7 +461,7 @@ describe('command line switches', () => {
|
||||
throw new Error(`Process exited with code "${code}" signal "${signal}" output "${output}" stderr "${stderr}"`);
|
||||
}
|
||||
|
||||
output = output.replace(/(\r\n|\n|\r)/gm, '');
|
||||
output = output.replaceAll(/(\r\n|\n|\r)/gm, '');
|
||||
expect(output).to.equal(result);
|
||||
};
|
||||
|
||||
@@ -628,15 +628,22 @@ describe('chromium features', () => {
|
||||
}
|
||||
});
|
||||
w.webContents.on('ipc-message', (event, channel, message) => {
|
||||
if (channel === 'reload') {
|
||||
w.webContents.reload();
|
||||
} else if (channel === 'error') {
|
||||
done(message);
|
||||
} else if (channel === 'response') {
|
||||
expect(message).to.equal('Hello from serviceWorker!');
|
||||
session.fromPartition('sw-file-scheme-spec').clearStorageData({
|
||||
storages: ['serviceworkers']
|
||||
}).then(() => done());
|
||||
switch (channel) {
|
||||
case 'reload': {
|
||||
w.webContents.reload();
|
||||
break;
|
||||
}
|
||||
case 'error': {
|
||||
done(message);
|
||||
break;
|
||||
}
|
||||
case 'response': {
|
||||
expect(message).to.equal('Hello from serviceWorker!');
|
||||
session.fromPartition('sw-file-scheme-spec').clearStorageData({
|
||||
storages: ['serviceworkers']
|
||||
}).then(() => done());
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
w.webContents.on('render-process-gone', () => done(new Error('WebContents crashed.')));
|
||||
@@ -666,18 +673,25 @@ describe('chromium features', () => {
|
||||
}
|
||||
});
|
||||
w.webContents.on('ipc-message', (event, channel, message) => {
|
||||
if (channel === 'reload') {
|
||||
w.webContents.reload();
|
||||
} else if (channel === 'error') {
|
||||
done(`unexpected error : ${message}`);
|
||||
} else if (channel === 'response') {
|
||||
expect(message).to.equal('Hello from serviceWorker!');
|
||||
customSession.clearStorageData({
|
||||
storages: ['serviceworkers']
|
||||
}).then(() => {
|
||||
customSession.protocol.uninterceptProtocol('file');
|
||||
done();
|
||||
});
|
||||
switch (channel) {
|
||||
case 'reload': {
|
||||
w.webContents.reload();
|
||||
break;
|
||||
}
|
||||
case 'error': {
|
||||
done(`unexpected error : ${message}`);
|
||||
break;
|
||||
}
|
||||
case 'response': {
|
||||
expect(message).to.equal('Hello from serviceWorker!');
|
||||
customSession.clearStorageData({
|
||||
storages: ['serviceworkers']
|
||||
}).then(() => {
|
||||
customSession.protocol.uninterceptProtocol('file');
|
||||
done();
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
w.webContents.on('render-process-gone', () => done(new Error('WebContents crashed.')));
|
||||
@@ -702,18 +716,25 @@ describe('chromium features', () => {
|
||||
}
|
||||
});
|
||||
w.webContents.on('ipc-message', (event, channel, message) => {
|
||||
if (channel === 'reload') {
|
||||
w.webContents.reload();
|
||||
} else if (channel === 'error') {
|
||||
done(`unexpected error : ${message}`);
|
||||
} else if (channel === 'response') {
|
||||
expect(message).to.equal('Hello from serviceWorker!');
|
||||
customSession.clearStorageData({
|
||||
storages: ['serviceworkers']
|
||||
}).then(() => {
|
||||
customSession.protocol.uninterceptProtocol(serviceWorkerScheme);
|
||||
done();
|
||||
});
|
||||
switch (channel) {
|
||||
case 'reload': {
|
||||
w.webContents.reload();
|
||||
break;
|
||||
}
|
||||
case 'error': {
|
||||
done(`unexpected error : ${message}`);
|
||||
break;
|
||||
}
|
||||
case 'response': {
|
||||
expect(message).to.equal('Hello from serviceWorker!');
|
||||
customSession.clearStorageData({
|
||||
storages: ['serviceworkers']
|
||||
}).then(() => {
|
||||
customSession.protocol.uninterceptProtocol(serviceWorkerScheme);
|
||||
done();
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
w.webContents.on('render-process-gone', () => done(new Error('WebContents crashed.')));
|
||||
@@ -1050,7 +1071,7 @@ describe('chromium features', () => {
|
||||
it('defines a window.location getter', async () => {
|
||||
let targetURL: string;
|
||||
if (process.platform === 'win32') {
|
||||
targetURL = `file:///${fixturesPath.replace(/\\/g, '/')}/pages/base-page.html`;
|
||||
targetURL = `file:///${fixturesPath.replaceAll('\\', '/')}/pages/base-page.html`;
|
||||
} else {
|
||||
targetURL = `file://${fixturesPath}/pages/base-page.html`;
|
||||
}
|
||||
@@ -1977,7 +1998,7 @@ describe('chromium features', () => {
|
||||
|
||||
ifdescribe(features.isPDFViewerEnabled())('PDF Viewer', () => {
|
||||
const pdfSource = url.format({
|
||||
pathname: path.join(__dirname, 'fixtures', 'cat.pdf').replace(/\\/g, '/'),
|
||||
pathname: path.join(__dirname, 'fixtures', 'cat.pdf').replaceAll('\\', '/'),
|
||||
protocol: 'file',
|
||||
slashes: true
|
||||
});
|
||||
@@ -2431,12 +2452,19 @@ describe('font fallback', () => {
|
||||
const fonts = await getRenderedFonts(html);
|
||||
expect(fonts).to.be.an('array');
|
||||
expect(fonts).to.have.length(1);
|
||||
if (process.platform === 'win32') {
|
||||
expect(fonts[0].familyName).to.equal('Arial');
|
||||
} else if (process.platform === 'darwin') {
|
||||
expect(fonts[0].familyName).to.equal('Helvetica');
|
||||
} else if (process.platform === 'linux') {
|
||||
expect(fonts[0].familyName).to.equal('DejaVu Sans');
|
||||
switch (process.platform) {
|
||||
case 'win32': {
|
||||
expect(fonts[0].familyName).to.equal('Arial');
|
||||
break;
|
||||
}
|
||||
case 'darwin': {
|
||||
expect(fonts[0].familyName).to.equal('Helvetica');
|
||||
break;
|
||||
}
|
||||
case 'linux': {
|
||||
expect(fonts[0].familyName).to.equal('DejaVu Sans');
|
||||
break;
|
||||
}
|
||||
} // I think this depends on the distro? We don't specify a default.
|
||||
});
|
||||
|
||||
@@ -2909,16 +2937,23 @@ ifdescribe((process.platform !== 'linux' || app.isUnityRunning()))('navigator.se
|
||||
|
||||
it('setAppBadge can be called in a ServiceWorker', (done) => {
|
||||
w.webContents.on('ipc-message', (event, channel, message) => {
|
||||
if (channel === 'reload') {
|
||||
w.webContents.reload();
|
||||
} else if (channel === 'error') {
|
||||
done(message);
|
||||
} else if (channel === 'response') {
|
||||
expect(message).to.equal('SUCCESS setting app badge');
|
||||
expect(waitForBadgeCount(expectedBadgeCount)).to.eventually.equal(expectedBadgeCount);
|
||||
session.fromPartition('sw-file-scheme-spec').clearStorageData({
|
||||
storages: ['serviceworkers']
|
||||
}).then(() => done());
|
||||
switch (channel) {
|
||||
case 'reload': {
|
||||
w.webContents.reload();
|
||||
break;
|
||||
}
|
||||
case 'error': {
|
||||
done(message);
|
||||
break;
|
||||
}
|
||||
case 'response': {
|
||||
expect(message).to.equal('SUCCESS setting app badge');
|
||||
expect(waitForBadgeCount(expectedBadgeCount)).to.eventually.equal(expectedBadgeCount);
|
||||
session.fromPartition('sw-file-scheme-spec').clearStorageData({
|
||||
storages: ['serviceworkers']
|
||||
}).then(() => done());
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
w.webContents.on('render-process-gone', () => done(new Error('WebContents crashed.')));
|
||||
@@ -2927,19 +2962,28 @@ ifdescribe((process.platform !== 'linux' || app.isUnityRunning()))('navigator.se
|
||||
|
||||
it('clearAppBadge can be called in a ServiceWorker', (done) => {
|
||||
w.webContents.on('ipc-message', (event, channel, message) => {
|
||||
if (channel === 'reload') {
|
||||
w.webContents.reload();
|
||||
} else if (channel === 'setAppBadge') {
|
||||
expect(message).to.equal('SUCCESS setting app badge');
|
||||
expect(waitForBadgeCount(expectedBadgeCount)).to.eventually.equal(expectedBadgeCount);
|
||||
} else if (channel === 'error') {
|
||||
done(message);
|
||||
} else if (channel === 'response') {
|
||||
expect(message).to.equal('SUCCESS clearing app badge');
|
||||
expect(waitForBadgeCount(expectedBadgeCount)).to.eventually.equal(expectedBadgeCount);
|
||||
session.fromPartition('sw-file-scheme-spec').clearStorageData({
|
||||
storages: ['serviceworkers']
|
||||
}).then(() => done());
|
||||
switch (channel) {
|
||||
case 'reload': {
|
||||
w.webContents.reload();
|
||||
break;
|
||||
}
|
||||
case 'setAppBadge': {
|
||||
expect(message).to.equal('SUCCESS setting app badge');
|
||||
expect(waitForBadgeCount(expectedBadgeCount)).to.eventually.equal(expectedBadgeCount);
|
||||
break;
|
||||
}
|
||||
case 'error': {
|
||||
done(message);
|
||||
break;
|
||||
}
|
||||
case 'response': {
|
||||
expect(message).to.equal('SUCCESS clearing app badge');
|
||||
expect(waitForBadgeCount(expectedBadgeCount)).to.eventually.equal(expectedBadgeCount);
|
||||
session.fromPartition('sw-file-scheme-spec').clearStorageData({
|
||||
storages: ['serviceworkers']
|
||||
}).then(() => done());
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
w.webContents.on('render-process-gone', () => done(new Error('WebContents crashed.')));
|
||||
|
||||
94
spec/fixtures/apps/crash/main.js
vendored
94
spec/fixtures/apps/crash/main.js
vendored
@@ -25,51 +25,65 @@ crashReporter.start({
|
||||
app.whenReady().then(() => {
|
||||
const crashType = app.commandLine.getSwitchValue('crash-type');
|
||||
|
||||
if (crashType === 'main') {
|
||||
process.crash();
|
||||
} else if (crashType === 'renderer') {
|
||||
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, contextIsolation: false } });
|
||||
w.loadURL('about:blank');
|
||||
if (setExtraParameters) {
|
||||
w.webContents.executeJavaScript(`
|
||||
switch (crashType) {
|
||||
case 'main': {
|
||||
process.crash();
|
||||
break;
|
||||
}
|
||||
case 'renderer': {
|
||||
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, contextIsolation: false } });
|
||||
w.loadURL('about:blank');
|
||||
if (setExtraParameters) {
|
||||
w.webContents.executeJavaScript(`
|
||||
require('electron').crashReporter.addExtraParameter('rendererSpecific', 'rs');
|
||||
require('electron').crashReporter.addExtraParameter('addedThenRemoved', 'to-be-removed');
|
||||
require('electron').crashReporter.removeExtraParameter('addedThenRemoved');
|
||||
`);
|
||||
}
|
||||
w.webContents.executeJavaScript('process.crash()');
|
||||
w.webContents.on('render-process-gone', () => process.exit(0));
|
||||
} else if (crashType === 'sandboxed-renderer') {
|
||||
const w = new BrowserWindow({
|
||||
show: false,
|
||||
webPreferences: {
|
||||
sandbox: true,
|
||||
preload: path.resolve(__dirname, 'sandbox-preload.js'),
|
||||
contextIsolation: false
|
||||
}
|
||||
});
|
||||
w.loadURL(`about:blank?set_extra=${setExtraParameters ? 1 : 0}`);
|
||||
w.webContents.on('render-process-gone', () => process.exit(0));
|
||||
} else if (crashType === 'node') {
|
||||
const crashPath = path.join(__dirname, 'node-crash.js');
|
||||
const child = childProcess.fork(crashPath, { silent: true });
|
||||
child.on('exit', () => process.exit(0));
|
||||
} else if (crashType === 'node-fork') {
|
||||
const scriptPath = path.join(__dirname, 'fork.js');
|
||||
const child = childProcess.fork(scriptPath, { silent: true });
|
||||
child.on('exit', () => process.exit(0));
|
||||
} else if (crashType === 'node-extra-args') {
|
||||
let exitcode = -1;
|
||||
const crashPath = path.join(__dirname, 'node-extra-args.js');
|
||||
const child = childProcess.fork(crashPath, ['--enable-logging'], { silent: true });
|
||||
child.send('message');
|
||||
child.on('message', (forkedArgs) => {
|
||||
if (JSON.stringify(forkedArgs) !== JSON.stringify(child.spawnargs)) { exitcode = 1; } else { exitcode = 0; }
|
||||
process.exit(exitcode);
|
||||
});
|
||||
} else {
|
||||
console.error(`Unrecognized crash type: '${crashType}'`);
|
||||
process.exit(1);
|
||||
w.webContents.executeJavaScript('process.crash()');
|
||||
w.webContents.on('render-process-gone', () => process.exit(0));
|
||||
break;
|
||||
}
|
||||
case 'sandboxed-renderer': {
|
||||
const w = new BrowserWindow({
|
||||
show: false,
|
||||
webPreferences: {
|
||||
sandbox: true,
|
||||
preload: path.resolve(__dirname, 'sandbox-preload.js'),
|
||||
contextIsolation: false
|
||||
}
|
||||
});
|
||||
w.loadURL(`about:blank?set_extra=${setExtraParameters ? 1 : 0}`);
|
||||
w.webContents.on('render-process-gone', () => process.exit(0));
|
||||
break;
|
||||
}
|
||||
case 'node': {
|
||||
const crashPath = path.join(__dirname, 'node-crash.js');
|
||||
const child = childProcess.fork(crashPath, { silent: true });
|
||||
child.on('exit', () => process.exit(0));
|
||||
break;
|
||||
}
|
||||
case 'node-fork': {
|
||||
const scriptPath = path.join(__dirname, 'fork.js');
|
||||
const child = childProcess.fork(scriptPath, { silent: true });
|
||||
child.on('exit', () => process.exit(0));
|
||||
break;
|
||||
}
|
||||
case 'node-extra-args': {
|
||||
let exitcode = -1;
|
||||
const crashPath = path.join(__dirname, 'node-extra-args.js');
|
||||
const child = childProcess.fork(crashPath, ['--enable-logging'], { silent: true });
|
||||
child.send('message');
|
||||
child.on('message', (forkedArgs) => {
|
||||
if (JSON.stringify(forkedArgs) !== JSON.stringify(child.spawnargs)) { exitcode = 1; } else { exitcode = 0; }
|
||||
process.exit(exitcode);
|
||||
});
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
console.error(`Unrecognized crash type: '${crashType}'`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { closeAllWindows } from './lib/window-helpers';
|
||||
import * as childProcess from 'node:child_process';
|
||||
import { once } from 'node:events';
|
||||
|
||||
const Module = require('node:module');
|
||||
const Module = require('node:module') as NodeJS.ModuleInternal;
|
||||
|
||||
const nativeModulesEnabled = !process.env.ELECTRON_SKIP_NATIVE_MODULE_TESTS;
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ describe('<webview> tag', function () {
|
||||
});
|
||||
await w.loadURL('about:blank');
|
||||
const src = url.format({
|
||||
pathname: `${fixtures.replace(/\\/g, '/')}/pages/theme-color.html`,
|
||||
pathname: `${fixtures.replaceAll('\\', '/')}/pages/theme-color.html`,
|
||||
protocol: 'file',
|
||||
slashes: true
|
||||
});
|
||||
|
||||
11
typings/internal-ambient.d.ts
vendored
11
typings/internal-ambient.d.ts
vendored
@@ -3,6 +3,17 @@ declare const BUILDFLAG: (flag: boolean) => boolean;
|
||||
declare const ENABLE_VIEWS_API: boolean;
|
||||
|
||||
declare namespace NodeJS {
|
||||
interface ModuleInternal extends NodeJS.Module {
|
||||
new(id: string, parent?: NodeJS.Module | null): NodeJS.Module;
|
||||
_load(request: string, parent?: NodeJS.Module | null, isMain?: boolean): any;
|
||||
_resolveFilename(request: string, parent?: NodeJS.Module | null, isMain?: boolean, options?: { paths: string[] }): string;
|
||||
_preloadModules(requests: string[]): void;
|
||||
_nodeModulePaths(from: string): string[];
|
||||
_extensions: Record<string, (module: NodeJS.Module, filename: string) => any>;
|
||||
_cache: Record<string, NodeJS.Module>;
|
||||
wrapper: [string, string];
|
||||
}
|
||||
|
||||
interface FeaturesBinding {
|
||||
isBuiltinSpellCheckerEnabled(): boolean;
|
||||
isPDFViewerEnabled(): boolean;
|
||||
|
||||
Reference in New Issue
Block a user