@electron/remote
Advanced tools
Comparing version 1.0.4 to 1.1.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getElectronBinding = void 0; | ||
exports.getElectronBinding = process.electronBinding | ||
? (name) => process.electronBinding(name) | ||
: (name) => process._linkedBinding('electron_common_' + name); | ||
const getElectronBinding = (name) => { | ||
if (process._linkedBinding) { | ||
return process._linkedBinding('electron_common_' + name); | ||
} | ||
else if (process.electronBinding) { | ||
return process.electronBinding(name); | ||
} | ||
else { | ||
return null; | ||
} | ||
}; | ||
exports.getElectronBinding = getElectronBinding; |
@@ -45,7 +45,7 @@ "use strict"; | ||
const features = get_electron_binding_1.getElectronBinding('features'); | ||
if (features.isDesktopCapturerEnabled()) { | ||
if (!features || features.isDesktopCapturerEnabled()) { | ||
exports.browserModuleNames.push('desktopCapturer'); | ||
} | ||
if (features.isViewApiEnabled()) { | ||
if (!features || features.isViewApiEnabled()) { | ||
exports.browserModuleNames.push('ImageView'); | ||
} |
@@ -11,7 +11,7 @@ import { WebContents } from 'electron'; | ||
clear(webContents: WebContents, contextId: string): void; | ||
saveToStorage(object: any): number; | ||
dereference(id: number): void; | ||
registerDeleteListener(webContents: WebContents, contextId: string): void; | ||
private saveToStorage; | ||
private dereference; | ||
private registerDeleteListener; | ||
} | ||
declare const _default: ObjectsRegistry; | ||
export default _default; |
@@ -74,3 +74,3 @@ "use strict"; | ||
} | ||
// Private: Saves the object into storage and assigns an ID for it. | ||
// Saves the object into storage and assigns an ID for it. | ||
saveToStorage(object) { | ||
@@ -88,3 +88,3 @@ let id = this.electronIds.get(object); | ||
} | ||
// Private: Dereference the object from store. | ||
// Dereference the object from store. | ||
dereference(id) { | ||
@@ -101,3 +101,3 @@ const pointer = this.storage[id]; | ||
} | ||
// Private: Clear the storage when renderer process is destroyed. | ||
// Clear the storage when renderer process is destroyed. | ||
registerDeleteListener(webContents, contextId) { | ||
@@ -104,0 +104,0 @@ // contextId => ${processHostId}-${contextCount} |
@@ -6,3 +6,3 @@ export declare class CallbacksRegistry { | ||
private locationInfo; | ||
add(callback: Function): number | undefined; | ||
add(callback: Function): number; | ||
get(id: number): Function; | ||
@@ -9,0 +9,0 @@ getLocation(callback: Function): string | undefined; |
@@ -17,2 +17,4 @@ "use strict"; | ||
id = this.nextId += 1; | ||
this.callbacks[id] = callback; | ||
this.callbackIds.set(callback, id); | ||
// Capture the location of the function and put it in the ID string, | ||
@@ -23,3 +25,3 @@ // so that release errors can be tracked down easily. | ||
if (!stackString) | ||
return; | ||
return id; | ||
let filenameAndLine; | ||
@@ -44,4 +46,2 @@ let match; | ||
} | ||
this.callbacks[id] = callback; | ||
this.callbackIds.set(callback, id); | ||
this.locationInfo.set(callback, filenameAndLine); | ||
@@ -48,0 +48,0 @@ return id; |
@@ -9,4 +9,2 @@ "use strict"; | ||
const get_electron_binding_1 = require("../common/get-electron-binding"); | ||
const v8Util = get_electron_binding_1.getElectronBinding('v8_util'); | ||
const { hasSwitch } = get_electron_binding_1.getElectronBinding('command_line'); | ||
const callbacksRegistry = new callbacks_registry_1.CallbacksRegistry(); | ||
@@ -37,4 +35,13 @@ const remoteObjectCache = new Map(); | ||
} | ||
function getContextId() { | ||
const v8Util = get_electron_binding_1.getElectronBinding('v8_util'); | ||
if (v8Util) { | ||
return v8Util.getHiddenValue(global, 'contextId'); | ||
} | ||
else { | ||
throw new Error('Electron >=v13.0.0-beta.6 required to support sandboxed renderers'); | ||
} | ||
} | ||
// An unique ID that can represent current context. | ||
const contextId = v8Util.getHiddenValue(global, 'contextId'); | ||
const contextId = process.contextId || getContextId(); | ||
// Notify the main process when current context is going to be released. | ||
@@ -330,3 +337,3 @@ // Note that when the renderer process is destroyed, the message may not be | ||
} | ||
const enableStacks = hasSwitch('enable-api-filtering-logging'); | ||
const enableStacks = process.argv.includes('--enable-api-filtering-logging'); | ||
function getCurrentStack() { | ||
@@ -333,0 +340,0 @@ const target = { stack: undefined }; |
{ | ||
"name": "@electron/remote", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"main": "renderer/index.js", | ||
@@ -43,4 +43,6 @@ "license": "MIT", | ||
"renderer/index.js", | ||
"dist/src" | ||
] | ||
"dist/src", | ||
"index.d.ts" | ||
], | ||
"types": "index.d.ts" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66996
25
1352