chore: add types for electron_renderer_web_frame binding (#28455)
* chore: add types for electron_renderer_web_frame binding * chore: use keyof for getWebPreference type Co-authored-by: Samuel Attard <sattard@slack-corp.com>
This commit is contained in:
parent
9904438118
commit
55c66e3e92
2 changed files with 36 additions and 8 deletions
|
@ -11,16 +11,16 @@ class WebFrame extends EventEmitter {
|
|||
this.setMaxListeners(0);
|
||||
}
|
||||
|
||||
findFrameByRoutingId (...args: Array<any>) {
|
||||
return getWebFrame(binding._findFrameByRoutingId(this.context, ...args));
|
||||
findFrameByRoutingId (routingId: number) {
|
||||
return getWebFrame(binding._findFrameByRoutingId(this.context, routingId));
|
||||
}
|
||||
|
||||
getFrameForSelector (...args: Array<any>) {
|
||||
return getWebFrame(binding._getFrameForSelector(this.context, ...args));
|
||||
getFrameForSelector (selector: string) {
|
||||
return getWebFrame(binding._getFrameForSelector(this.context, selector));
|
||||
}
|
||||
|
||||
findFrameByName (...args: Array<any>) {
|
||||
return getWebFrame(binding._findFrameByName(this.context, ...args));
|
||||
findFrameByName (name: string) {
|
||||
return getWebFrame(binding._findFrameByName(this.context, name));
|
||||
}
|
||||
|
||||
get opener () {
|
||||
|
@ -62,12 +62,12 @@ for (const name in binding) {
|
|||
if (!worldSafeJS && name.startsWith('executeJavaScript')) {
|
||||
deprecate.log(`Security Warning: webFrame.${name} was called without worldSafeExecuteJavaScript enabled. This is considered unsafe. worldSafeExecuteJavaScript will be enabled by default in Electron 12.`);
|
||||
}
|
||||
return binding[name](this.context, ...args);
|
||||
return (binding as any)[name](this.context, ...args);
|
||||
};
|
||||
// TODO(MarshallOfSound): Remove once the above deprecation is removed
|
||||
if (name.startsWith('executeJavaScript')) {
|
||||
(WebFrame as any).prototype[`_${name}`] = function (...args: Array<any>) {
|
||||
return binding[name](this.context, ...args);
|
||||
return (binding as any)[name](this.context, ...args);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue