mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-04 03:59:59 +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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"html/template"
|
||||||
"log"
|
"log"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
@ -310,7 +311,7 @@ func (f *Frontend) Notify(name string, data ...interface{}) {
|
|||||||
f.logger.Error(err.Error())
|
f.logger.Error(err.Error())
|
||||||
return
|
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) {
|
//func (f *Frontend) processRequest(req *edge.ICoreWebView2WebResourceRequest, args *edge.ICoreWebView2WebResourceRequestedEventArgs) {
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"text/template"
|
||||||
|
|
||||||
"github.com/leaanthony/slicer"
|
"github.com/leaanthony/slicer"
|
||||||
|
|
||||||
@ -337,7 +338,7 @@ func (f *Frontend) Notify(name string, data ...interface{}) {
|
|||||||
f.logger.Error(err.Error())
|
f.logger.Error(err.Error())
|
||||||
return
|
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) {
|
func (f *Frontend) processRequest(req *edge.ICoreWebView2WebResourceRequest, args *edge.ICoreWebView2WebResourceRequestedEventArgs) {
|
||||||
|
Loading…
Reference in New Issue
Block a user