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.0.2 to 1.0.4

dist/src/common/get-electron-binding.d.ts

84

dist/src/common/module-names.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.browserModules = exports.commonModules = void 0;
exports.browserModuleNames = exports.commonModuleNames = void 0;
const get_electron_binding_1 = require("./get-electron-binding");
exports.commonModules = [
{ name: 'clipboard' },
{ name: 'nativeImage' },
{ name: 'shell' },
exports.commonModuleNames = [
'clipboard',
'nativeImage',
'shell',
];
exports.browserModules = [
{ name: 'app' },
{ name: 'autoUpdater' },
{ name: 'BaseWindow' },
{ name: 'BrowserView' },
{ name: 'BrowserWindow' },
{ name: 'contentTracing' },
{ name: 'crashReporter' },
{ name: 'desktopCapturer' },
{ name: 'dialog' },
{ name: 'globalShortcut' },
{ name: 'ipcMain' },
{ name: 'inAppPurchase' },
{ name: 'Menu' },
{ name: 'MenuItem' },
{ name: 'nativeTheme' },
{ name: 'net' },
{ name: 'netLog' },
{ name: 'MessageChannelMain' },
{ name: 'Notification' },
{ name: 'powerMonitor' },
{ name: 'powerSaveBlocker' },
{ name: 'protocol' },
{ name: 'screen' },
{ name: 'session' },
{ name: 'ShareMenu' },
{ name: 'systemPreferences' },
{ name: 'TopLevelWindow' },
{ name: 'TouchBar' },
{ name: 'Tray' },
{ name: 'View' },
{ name: 'webContents' },
{ name: 'WebContentsView' },
{ name: 'webFrameMain' },
].concat(exports.commonModules);
exports.browserModuleNames = [
'app',
'autoUpdater',
'BaseWindow',
'BrowserView',
'BrowserWindow',
'contentTracing',
'crashReporter',
'dialog',
'globalShortcut',
'ipcMain',
'inAppPurchase',
'Menu',
'MenuItem',
'nativeTheme',
'net',
'netLog',
'MessageChannelMain',
'Notification',
'powerMonitor',
'powerSaveBlocker',
'protocol',
'screen',
'session',
'ShareMenu',
'systemPreferences',
'TopLevelWindow',
'TouchBar',
'Tray',
'View',
'webContents',
'WebContentsView',
'webFrameMain',
].concat(exports.commonModuleNames);
const features = get_electron_binding_1.getElectronBinding('features');
if (features.isDesktopCapturerEnabled()) {
exports.browserModuleNames.push('desktopCapturer');
}
if (features.isViewApiEnabled()) {
exports.browserModules.push({ name: 'ImageView' });
exports.browserModuleNames.push('ImageView');
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deserialize = exports.serialize = exports.isSerializableObject = exports.isPromise = void 0;
const get_electron_binding_1 = require("./get-electron-binding");
const { nativeImage } = get_electron_binding_1.getElectronBinding('native_image');
const electron_1 = require("electron");
function isPromise(val) {

@@ -59,3 +58,3 @@ return (val &&

function deserializeNativeImage(value) {
const image = nativeImage.createEmpty();
const image = electron_1.nativeImage.createEmpty();
// Use Buffer when there's only one representation for better perf.

@@ -62,0 +61,0 @@ // This avoids compressing to/from PNG where it's not necessary to

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initialize = void 0;
var server_1 = require("./server");
Object.defineProperty(exports, "initialize", { enumerable: true, get: function () { return server_1.initialize; } });
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const get_electron_binding_1 = require("../common/get-electron-binding");
const v8Util = get_electron_binding_1.getElectronBinding('v8_util');
const getOwnerKey = (webContents, contextId) => {

@@ -17,2 +15,3 @@ return `${webContents.id}-${contextId}`;

this.owners = {};
this.electronIds = new WeakMap();
}

@@ -78,3 +77,3 @@ // Register a new object and return its assigned ID. If the object is already

saveToStorage(object) {
let id = v8Util.getHiddenValue(object, '@electronId');
let id = this.electronIds.get(object);
if (!id) {

@@ -86,3 +85,3 @@ id = ++this.nextId;

};
v8Util.setHiddenValue(object, '@electronId', id);
this.electronIds.set(object, id);
}

@@ -99,3 +98,3 @@ return id;

if (pointer.count === 0) {
v8Util.deleteHiddenValue(pointer.object, '@electronId');
this.electronIds.delete(pointer.object);
delete this.storage[id];

@@ -102,0 +101,0 @@ }

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

// eslint-disable-next-line no-undef
const finalizationRegistry = new globalThis.FinalizationRegistry((fi) => {
const finalizationRegistry = new FinalizationRegistry((fi) => {
const mapKey = fi.id[0] + '~' + fi.id[1];

@@ -27,3 +27,8 @@ const ref = rendererFunctionCache.get(mapKey);

if (!fi.webContents.isDestroyed()) {
fi.webContents.sendToFrame(fi.frameId, "REMOTE_RENDERER_RELEASE_CALLBACK" /* RENDERER_RELEASE_CALLBACK */, fi.id[0], fi.id[1]);
try {
fi.webContents.sendToFrame(fi.frameId, "REMOTE_RENDERER_RELEASE_CALLBACK" /* RENDERER_RELEASE_CALLBACK */, fi.id[0], fi.id[1]);
}
catch (error) {
console.warn(`sendToFrame() failed: ${error}`);
}
}

@@ -43,3 +48,3 @@ }

// eslint-disable-next-line no-undef
const wr = new globalThis.WeakRef(value);
const wr = new WeakRef(value);
const mapKey = id[0] + '~' + id[1];

@@ -54,2 +59,3 @@ rendererFunctionCache.set(mapKey, wr);

}
const locationInfo = new WeakMap();
// Return the description of object's members:

@@ -195,3 +201,3 @@ const getObjectMembers = function (object) {

const removeRemoteListenersAndLogWarning = (sender, callIntoRenderer) => {
const location = v8Util.getHiddenValue(callIntoRenderer, 'location');
const location = locationInfo.get(callIntoRenderer);
let message = 'Attempting to call a function in a renderer window that has been closed or released.' +

@@ -267,3 +273,8 @@ `\nFunction provided here: ${location}`;

if (!sender.isDestroyed()) {
succeed = sender.sendToFrame(frameId, "REMOTE_RENDERER_CALLBACK" /* RENDERER_CALLBACK */, contextId, meta.id, valueToMeta(sender, contextId, args));
try {
succeed = sender.sendToFrame(frameId, "REMOTE_RENDERER_CALLBACK" /* RENDERER_CALLBACK */, contextId, meta.id, valueToMeta(sender, contextId, args)) !== false;
}
catch (error) {
console.warn(`sendToFrame() failed: ${error}`);
}
}

@@ -274,3 +285,3 @@ if (!succeed) {

};
v8Util.setHiddenValue(callIntoRenderer, 'location', meta.location);
locationInfo.set(callIntoRenderer, meta.location);
Object.defineProperty(callIntoRenderer, 'length', { value: meta.length });

@@ -291,3 +302,3 @@ setCachedRendererFunction(objectId, sender, frameId, callIntoRenderer);

const isRemoteModuleEnabledCache = new WeakMap();
exports.isRemoteModuleEnabled = function (contents) {
const isRemoteModuleEnabled = function (contents) {
if (!isRemoteModuleEnabledCache.has(contents)) {

@@ -298,2 +309,3 @@ isRemoteModuleEnabledCache.set(contents, isRemoteModuleEnabledImpl(contents));

};
exports.isRemoteModuleEnabled = isRemoteModuleEnabled;
const handleRemoteCommand = function (channel, handler) {

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CallbacksRegistry = void 0;
const get_electron_binding_1 = require("../common/get-electron-binding");
const v8Util = get_electron_binding_1.getElectronBinding('v8_util');
class CallbacksRegistry {

@@ -10,6 +8,8 @@ constructor() {

this.callbacks = {};
this.callbackIds = new WeakMap();
this.locationInfo = new WeakMap();
}
add(callback) {
// The callback is already added.
let id = v8Util.getHiddenValue(callback, 'callbackId');
let id = this.callbackIds.get(callback);
if (id != null)

@@ -44,4 +44,4 @@ return id;

this.callbacks[id] = callback;
v8Util.setHiddenValue(callback, 'callbackId', id);
v8Util.setHiddenValue(callback, 'location', filenameAndLine);
this.callbackIds.set(callback, id);
this.locationInfo.set(callback, filenameAndLine);
return id;

@@ -52,2 +52,5 @@ }

}
getLocation(callback) {
return this.locationInfo.get(callback);
}
apply(id, ...args) {

@@ -59,3 +62,3 @@ return this.get(id).apply(global, ...args);

if (callback) {
v8Util.deleteHiddenValue(callback, 'callbackId');
this.callbackIds.delete(callback);
delete this.callbacks[id];

@@ -62,0 +65,0 @@ }

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

var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};

@@ -13,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

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

const remoteObjectCache = new Map();
const finalizationRegistry = new window.FinalizationRegistry((id) => {
const finalizationRegistry = new FinalizationRegistry((id) => {
const ref = remoteObjectCache.get(id);

@@ -21,2 +21,4 @@ if (ref !== undefined && ref.deref() === undefined) {

});
const electronIds = new WeakMap();
const isReturnValue = new WeakSet();
function getCachedRemoteObject(id) {

@@ -31,3 +33,3 @@ const ref = remoteObjectCache.get(id);

function setCachedRemoteObject(id, value) {
const wr = new window.WeakRef(value);
const wr = new WeakRef(value);
remoteObjectCache.set(id, wr);

@@ -91,6 +93,6 @@ finalizationRegistry.register(value, id);

}
else if (v8Util.getHiddenValue(value, '@electronId')) {
else if (electronIds.has(value)) {
return {
type: 'remote-object',
id: v8Util.getHiddenValue(value, '@electronId')
id: electronIds.get(value)
};

@@ -113,3 +115,3 @@ }

}
else if (typeof value === 'function' && v8Util.getHiddenValue(value, 'returnValue')) {
else if (typeof value === 'function' && isReturnValue.has(value)) {
return {

@@ -124,3 +126,3 @@ type: 'function-with-return-value',

id: callbacksRegistry.add(value),
location: v8Util.getHiddenValue(value, 'location'),
location: callbacksRegistry.getLocation(value),
length: value.length

@@ -305,3 +307,3 @@ };

// Track delegate obj's lifetime & tell browser to clean up when object is GCed.
v8Util.setHiddenValue(ret, '@electronId', meta.id);
electronIds.set(ret, meta.id);
setCachedRemoteObject(meta.id, ret);

@@ -389,3 +391,3 @@ return ret;

const func = () => returnValue;
v8Util.setHiddenValue(func, 'returnValue', true);
isReturnValue.add(func);
return func;

@@ -400,4 +402,3 @@ }

};
module_names_1.browserModules
.map((m) => m.name)
module_names_1.browserModuleNames
.forEach(addBuiltinProperty);
{
"name": "@electron/remote",
"version": "1.0.2",
"version": "1.0.4",
"main": "renderer/index.js",

@@ -29,3 +29,3 @@ "license": "MIT",

"ts-node": "^8.10.2",
"typescript": "^3.8.0",
"typescript": "^4.1.3",
"walkdir": "^0.4.1",

@@ -32,0 +32,0 @@ "yargs": "^15.3.1"

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