Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@electron/remote

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@electron/remote - npm Package Compare versions

Comparing version 1.2.2 to 2.0.0

2

dist/src/main/index.d.ts

@@ -1,1 +0,1 @@

export { initialize } from './server';
export { initialize, enable } from "./server";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initialize = void 0;
exports.enable = exports.initialize = void 0;
var server_1 = require("./server");
Object.defineProperty(exports, "initialize", { enumerable: true, get: function () { return server_1.initialize; } });
Object.defineProperty(exports, "enable", { enumerable: true, get: function () { return server_1.enable; } });
import { WebContents } from 'electron';
export declare const isRemoteModuleEnabled: (contents: WebContents) => any;
export declare const isRemoteModuleEnabled: (contents: WebContents) => boolean | undefined;
export declare function enable(contents: WebContents): void;
export declare function initialize(): void;

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.initialize = exports.isRemoteModuleEnabled = void 0;
exports.initialize = exports.enable = exports.isRemoteModuleEnabled = void 0;
const events_1 = require("events");

@@ -14,2 +14,7 @@ const objects_registry_1 = __importDefault(require("./objects-registry"));

const v8Util = get_electron_binding_1.getElectronBinding('v8_util');
const hasWebPrefsRemoteModuleAPI = (() => {
var _a, _b;
const electronVersion = Number((_b = (_a = process.versions.electron) === null || _a === void 0 ? void 0 : _a.split(".")) === null || _b === void 0 ? void 0 : _b[0]);
return Number.isNaN(electronVersion) || electronVersion < 14;
})();
// The internal properties of Function.

@@ -298,3 +303,3 @@ const FUNCTION_PROPERTIES = [

const isRemoteModuleEnabled = function (contents) {
if (!isRemoteModuleEnabledCache.has(contents)) {
if (hasWebPrefsRemoteModuleAPI && !isRemoteModuleEnabledCache.has(contents)) {
isRemoteModuleEnabledCache.set(contents, isRemoteModuleEnabledImpl(contents));

@@ -305,2 +310,6 @@ }

exports.isRemoteModuleEnabled = isRemoteModuleEnabled;
function enable(contents) {
isRemoteModuleEnabledCache.set(contents, true);
}
exports.enable = enable;
const handleRemoteCommand = function (channel, handler) {

@@ -312,3 +321,3 @@ electron_1.ipcMain.on(channel, (event, contextId, ...args) => {

type: 'exception',
value: valueToMeta(event.sender, contextId, new Error('@electron/remote is disabled for this WebContents. Set {enableRemoteModule: true} in WebPreferences to enable it.'))
value: valueToMeta(event.sender, contextId, new Error('@electron/remote is disabled for this WebContents. Call require("@electron/remote/main").enable(webContents) to enable it.'))
};

@@ -315,0 +324,0 @@ return;

{
"name": "@electron/remote",
"version": "1.2.2",
"version": "2.0.0",
"main": "renderer/index.js",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -55,3 +55,5 @@ # @electron/remote

**Note:** `@electron/remote` respects the `enableRemoteModule` WebPreferences
**Note:** In `electron >= 14.0.0`, you must use the new `enable` API to enable the remote module for each desired `WebContents` separately: `require("@electron/remote/main").enable(webContents)`.
In `electron < 14.0.0`, `@electron/remote` respects the `enableRemoteModule` WebPreferences
value. You must pass `{ webPreferences: { enableRemoteModule: true } }` to

@@ -61,3 +63,2 @@ the constructor of `BrowserWindow`s that should be granted permission to use

# API Reference

@@ -90,3 +91,5 @@

**Note:** The remote module can be disabled for security reasons in the following contexts:
**Note:** In `electron >= 14.0.0` the remote module is disabled by default for any `WebContents` instance and is only enabled for specified `WebContents` after explicitly calling `require("@electron/remote/main").enable(webContents)`.
In `electron < 14.0.0` the remote module can be disabled for security reasons in the following contexts:
- [`BrowserWindow`](browser-window.md) - by setting the `enableRemoteModule` option to `false`.

@@ -220,4 +223,4 @@ - [`<webview>`](webview-tag.md) - by setting the `enableremotemodule` attribute to `false`.

├── main
│   ├── foo.js
│   └── index.js
│ ├── foo.js
│ └── index.js
├── package.json

@@ -346,2 +349,2 @@ └── renderer

[enumerable-properties]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties
[remote-considered-harmful]: https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31
[remote-considered-harmful]: https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc