Fix single quotes in CEF events (#2)

This commit is contained in:
micah 2019-03-06 11:34:05 -05:00
parent 7ccb10630a
commit a1299c25b4
2 changed files with 5 additions and 12 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.idea/ .idea/
node_modules/

View File

@ -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"}');`} }`);
} }