Merge pull request #4 from pavlov3317/fix/escape-quotes
Duh!! How did I overlook this?? I knew regex wasn't the way to do it haha! This looks great and passed all of my tests. Nice job!
This commit is contained in:
commit
7c9fe21a44
@ -104,8 +104,8 @@ 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).replace(/'/g, "\\'");
|
const raw = util.stringifyData(data)
|
||||||
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(${JSON.stringify(raw)}); }else{ ${ignoreNotFound ? '' : `mp.trigger("${PROCESS_EVENT}", '{"ret":1,"id":"${data.id}","err":"${ERR_NOT_FOUND}","env":"cef"}');`} }`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function callProcedure(name: string, args: any, info: ProcedureListenerInfo): Promise<any> {
|
function callProcedure(name: string, args: any, info: ProcedureListenerInfo): Promise<any> {
|
||||||
|
Reference in New Issue
Block a user