Skip to content

Commit

Permalink
[DevTools] Replace deprecated new-window with `webContents.setWindo…
Browse files Browse the repository at this point in the history
…wOpenHandler()` (#26559)

## Summary

The electron package was recently upgraded from ^11.1.0 to ^23.1.2
(#26337). However, the WebContents `new-window` event – that is used in
the react-devtools project – was deprecated in
[v12.0.0](https://releases.electronjs.org/release/v12.0.0) and removed
in [v22.2.0](https://releases.electronjs.org/release/v22.2.0). The event
was replaced by `webContents.setWindowOpenHandler()`. This PR replaces
the `new-window` event with `webContents.setWindowOpenHandler()`.

## How did you test this change?

I created a simple electron application with similar functionality:

```
const { app, BrowserWindow, shell } = require('electron')

const createWindow = () => {
  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600
  })

  mainWindow.webContents.setWindowOpenHandler(({ url }) => {
    shell.openExternal(url)
    return { action: 'deny' }
  })

  mainWindow.loadFile('index.html')
}

app.whenReady().then(() => {
  createWindow()
})
```

---------

Co-authored-by: root <[email protected]>

DiffTrain build for commit 60cfeee.
  • Loading branch information
mondaychen committed Apr 6, 2023
1 parent 8a0e037 commit 6a14212
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23864,7 +23864,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-next-9cfba0f6e-20230405";
var ReactVersion = "18.3.0-next-60cfeeebe-20230406";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8683,7 +8683,7 @@ var devToolsConfig$jscomp$inline_1028 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-next-9cfba0f6e-20230405",
version: "18.3.0-next-60cfeeebe-20230406",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1220 = {
Expand Down Expand Up @@ -8714,7 +8714,7 @@ var internals$jscomp$inline_1220 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-9cfba0f6e-20230405"
reconcilerVersion: "18.3.0-next-60cfeeebe-20230406"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1221 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9108,7 +9108,7 @@ var devToolsConfig$jscomp$inline_1070 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-next-9cfba0f6e-20230405",
version: "18.3.0-next-60cfeeebe-20230406",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1261 = {
Expand Down Expand Up @@ -9139,7 +9139,7 @@ var internals$jscomp$inline_1261 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-9cfba0f6e-20230405"
reconcilerVersion: "18.3.0-next-60cfeeebe-20230406"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1262 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-next-9cfba0f6e-20230405";
var ReactVersion = "18.3.0-next-60cfeeebe-20230406";

// ATTENTION
// When adding new symbols to this file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,4 +639,4 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-next-9cfba0f6e-20230405";
exports.version = "18.3.0-next-60cfeeebe-20230406";
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-next-9cfba0f6e-20230405";
exports.version = "18.3.0-next-60cfeeebe-20230406";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9cfba0f6ecc15a342ef184552742c5db6c7f2d3e
60cfeeebe3902f4f996973ce8189afcb7363a6be
Original file line number Diff line number Diff line change
Expand Up @@ -27160,7 +27160,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-next-9cfba0f6e-20230405";
var ReactVersion = "18.3.0-next-60cfeeebe-20230406";

function createPortal$1(
children,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9554,7 +9554,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1052 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "18.3.0-next-9cfba0f6e-20230405",
version: "18.3.0-next-60cfeeebe-20230406",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
Expand Down Expand Up @@ -9596,7 +9596,7 @@ var internals$jscomp$inline_1297 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-9cfba0f6e-20230405"
reconcilerVersion: "18.3.0-next-60cfeeebe-20230406"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1298 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10262,7 +10262,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1130 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "18.3.0-next-9cfba0f6e-20230405",
version: "18.3.0-next-60cfeeebe-20230406",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
Expand Down Expand Up @@ -10317,7 +10317,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-9cfba0f6e-20230405"
reconcilerVersion: "18.3.0-next-60cfeeebe-20230406"
});
exports.createPortal = function (children, containerTag) {
return createPortal$1(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27681,7 +27681,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-next-9cfba0f6e-20230405";
var ReactVersion = "18.3.0-next-60cfeeebe-20230406";

function createPortal$1(
children,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9810,7 +9810,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1107 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "18.3.0-next-9cfba0f6e-20230405",
version: "18.3.0-next-60cfeeebe-20230406",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
Expand Down Expand Up @@ -9852,7 +9852,7 @@ var internals$jscomp$inline_1359 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-9cfba0f6e-20230405"
reconcilerVersion: "18.3.0-next-60cfeeebe-20230406"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1360 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10518,7 +10518,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1185 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "18.3.0-next-9cfba0f6e-20230405",
version: "18.3.0-next-60cfeeebe-20230406",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForViewTag: function () {
Expand Down Expand Up @@ -10573,7 +10573,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-9cfba0f6e-20230405"
reconcilerVersion: "18.3.0-next-60cfeeebe-20230406"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
computeComponentStackForErrorReporting: function (reactTag) {
Expand Down

0 comments on commit 6a14212

Please sign in to comment.