mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 02:50:36 +08:00
Merge pull request #849 from marktohark/filter-execjs-json
add template.JSEscapeString to ensure ExecJs normal execution
This commit is contained in:
commit
ef362a746a
@ -5,6 +5,7 @@ package darwin
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"html/template"
|
||||
"log"
|
||||
"runtime"
|
||||
|
||||
@ -310,7 +311,7 @@ func (f *Frontend) Notify(name string, data ...interface{}) {
|
||||
f.logger.Error(err.Error())
|
||||
return
|
||||
}
|
||||
f.ExecJS(`window.wails.EventsNotify('` + string(payload) + `');`)
|
||||
f.ExecJS(`window.wails.EventsNotify('` + template.JSEscapeString(string(payload)) + `');`)
|
||||
}
|
||||
|
||||
//func (f *Frontend) processRequest(req *edge.ICoreWebView2WebResourceRequest, args *edge.ICoreWebView2WebResourceRequestedEventArgs) {
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
"github.com/leaanthony/slicer"
|
||||
|
||||
@ -337,7 +338,7 @@ func (f *Frontend) Notify(name string, data ...interface{}) {
|
||||
f.logger.Error(err.Error())
|
||||
return
|
||||
}
|
||||
f.ExecJS(`window.wails.EventsNotify('` + string(payload) + `');`)
|
||||
f.ExecJS(`window.wails.EventsNotify('` + template.JSEscapeString(string(payload)) + `');`)
|
||||
}
|
||||
|
||||
func (f *Frontend) processRequest(req *edge.ICoreWebView2WebResourceRequest, args *edge.ICoreWebView2WebResourceRequestedEventArgs) {
|
||||
|
Loading…
Reference in New Issue
Block a user