Fix single quotes in CEF events (#2)
This commit is contained in:
parent
7ccb10630a
commit
a1299c25b4
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
.idea/
|
.idea/
|
||||||
|
node_modules/
|
14
src/index.ts
14
src/index.ts
@ -66,16 +66,8 @@ if(!glob[PROCESS_EVENT]){
|
|||||||
|
|
||||||
if(environment === "client"){
|
if(environment === "client"){
|
||||||
// set up internal pass-through events
|
// set up internal pass-through events
|
||||||
register('__rpc:callServer', ([name, args], info) => {
|
register('__rpc:callServer', ([name, args], info) => _callServer(name, args, { fenv: info.environment }));
|
||||||
return _callServer(name, args, {
|
register('__rpc:callBrowsers', ([name, args], info) => _callBrowsers(null, name, args, { fenv: info.environment }));
|
||||||
fenv: info.environment
|
|
||||||
});
|
|
||||||
});
|
|
||||||
register('__rpc:callBrowsers', ([name, args], info) => {
|
|
||||||
return _callBrowsers(null, name, args, {
|
|
||||||
fenv: info.environment
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// set up browser identifiers
|
// set up browser identifiers
|
||||||
glob.__rpcBrowsers = {};
|
glob.__rpcBrowsers = {};
|
||||||
@ -112,7 +104,7 @@ if(!glob[PROCESS_EVENT]){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function passEventToBrowser(browser: Browser, data: Event, ignoreNotFound: boolean): void {
|
function passEventToBrowser(browser: Browser, data: Event, ignoreNotFound: boolean): void {
|
||||||
const raw = util.stringifyData(data);
|
const raw = util.stringifyData(data).replace(/'/g, "\\'");
|
||||||
browser.execute(`var process = window["${PROCESS_EVENT}"]; if(process){ process('${raw}'); }else{ ${ignoreNotFound ? '' : `mp.trigger("${PROCESS_EVENT}", '{"ret":1,"id":"${data.id}","err":"${ERR_NOT_FOUND}","env":"cef"}');`} }`);
|
browser.execute(`var process = window["${PROCESS_EVENT}"]; if(process){ process('${raw}'); }else{ ${ignoreNotFound ? '' : `mp.trigger("${PROCESS_EVENT}", '{"ret":1,"id":"${data.id}","err":"${ERR_NOT_FOUND}","env":"cef"}');`} }`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user