Skip to content

Commit 3331d8c

Browse files
authored
Fix cookies and crashes on webview (#60)
* fix: [webviewer] update demo version * fix: [webviewer] use secure cookies when specified * fix: [webviewer] remove winloader to prevent crashes Fixes #59
1 parent 8f18aae commit 3331d8c

File tree

12 files changed

+84
-51
lines changed

12 files changed

+84
-51
lines changed

.gitattributes

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
* text eol=lf
1+
* text eol=lf
2+
*.dll binary
3+
*.jar binary
4+
*.aar binary
5+
*.so binary
6+
*.zip binary
7+
*.gz binary
8+
*.class binary

go.mod

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,22 @@ module github.com/gioui-plugins/gio-plugins
33
go 1.19
44

55
require (
6-
gioui.org v0.0.0-20220924144830-24eb1a4fc5fd
6+
gioui.org v0.1.1-0.20230801070910-edbf872b44af
77
git.wow.st/gmp/jni v0.0.0-20210610011705-34026c7e22d0
88
github.com/go-ole/go-ole v1.2.6
9+
github.com/inkeliz/giosvg v0.0.0-20230419135231-464df5851c6a
910
github.com/inkeliz/go_inkwasm v0.0.0-20220912074516-049d3472c98a
10-
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e
1111
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
12-
golang.org/x/exp/shiny v0.0.0-20220921164117-439092de6870
13-
golang.org/x/image v0.0.0-20220902085622-e7cb96979f69
1412
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8
1513
)
1614

1715
require (
18-
gioui.org/cmd v0.0.0-20230128024137-5c14d1ba6479 // indirect
1916
gioui.org/cpu v0.0.0-20220412190645-f1e9e8c3b1f7 // indirect
2017
gioui.org/shader v1.0.6 // indirect
21-
github.com/akavel/rsrc v0.10.1 // indirect
22-
github.com/benoitkugler/textlayout v0.3.0 // indirect
23-
github.com/go-text/typesetting v0.0.0-20221214153724-0399769901d5 // indirect
18+
github.com/go-text/typesetting v0.0.0-20230720191532-efc36025df80 // indirect
2419
golang.org/x/exp v0.0.0-20221012211006-4de253d81b95 // indirect
25-
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
26-
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
20+
golang.org/x/exp/shiny v0.0.0-20220921164117-439092de6870 // indirect
21+
golang.org/x/image v0.5.0 // indirect
22+
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
2723
golang.org/x/text v0.7.0 // indirect
28-
golang.org/x/tools v0.1.12 // indirect
2924
)

go.sum

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
eliasnaur.com/font v0.0.0-20220124212145-832bb8fc08c3 h1:djFprmHZgrSepsHAIRMp5UJn3PzsoTg9drI+BDmif5Q=
2-
gioui.org/cmd v0.0.0-20230128024137-5c14d1ba6479 h1:55KIi9Kx8rf8R9EnO9VGBQO2B6BoPgFbEn38uJO8aA4=
3-
gioui.org/cmd v0.0.0-20230128024137-5c14d1ba6479/go.mod h1:sOPHaz5lc8CQuJqPyX/YTFdcs5+XKNXXa03qxFIln6w=
1+
eliasnaur.com/font v0.0.0-20230308162249-dd43949cb42d h1:ARo7NCVvN2NdhLlJE9xAbKweuI9L6UgfTbYb0YwPacY=
2+
gioui.org v0.1.1-0.20230801070910-edbf872b44af h1:JyZldA0MGu2FjO8vCnLOhnFeL1HicOm3HVkbvoB4lJg=
3+
gioui.org v0.1.1-0.20230801070910-edbf872b44af/go.mod h1:klzDun/4xN9Z9DyIRVyNHU8b6lqbHIcJpnIhKOArpyY=
44
gioui.org/cpu v0.0.0-20210808092351-bfe733dd3334/go.mod h1:A8M0Cn5o+vY5LTMlnRoK3O5kG+rH0kWfJjeKd9QpBmQ=
55
gioui.org/cpu v0.0.0-20220412190645-f1e9e8c3b1f7 h1:tNJdnP5CgM39PRc+KWmBRRYX/zJ+rd5XaYxY5d5veqA=
66
gioui.org/cpu v0.0.0-20220412190645-f1e9e8c3b1f7/go.mod h1:A8M0Cn5o+vY5LTMlnRoK3O5kG+rH0kWfJjeKd9QpBmQ=
77
gioui.org/shader v1.0.6 h1:cvZmU+eODFR2545X+/8XucgZdTtEjR3QWW6W65b0q5Y=
88
gioui.org/shader v1.0.6/go.mod h1:mWdiME581d/kV7/iEhLmUgUK5iZ09XR5XpduXzbePVM=
99
git.wow.st/gmp/jni v0.0.0-20210610011705-34026c7e22d0 h1:bGG/g4ypjrCJoSvFrP5hafr9PPB5aw8SjcOWWila7ZI=
1010
git.wow.st/gmp/jni v0.0.0-20210610011705-34026c7e22d0/go.mod h1:+axXBRUTIDlCeE73IKeD/os7LoEnTKdkp8/gQOFjqyo=
11-
github.com/akavel/rsrc v0.10.1 h1:hCCPImjmFKVNGpeLZyTDRHEFC283DzyTXTo0cO0Rq9o=
12-
github.com/akavel/rsrc v0.10.1/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
13-
github.com/benoitkugler/pstokenizer v1.0.0/go.mod h1:l1G2Voirz0q/jj0TQfabNxVsa8HZXh/VMxFSRALWTiE=
14-
github.com/benoitkugler/textlayout v0.3.0 h1:2ehWXEkgb6RUokTjXh1LzdGwG4dRP6X3dqhYYDYhUVk=
15-
github.com/benoitkugler/textlayout v0.3.0/go.mod h1:o+1hFV+JSHBC9qNLIuwVoLedERU7sBPgEFcuSgfvi/w=
16-
github.com/benoitkugler/textlayout-testdata v0.1.1 h1:AvFxBxpfrQd8v55qH59mZOJOQjtD6K2SFe9/HvnIbJk=
17-
github.com/benoitkugler/textlayout-testdata v0.1.1/go.mod h1:i/qZl09BbUOtd7Bu/W1CAubRwTWrEXWq6JwMkw8wYxo=
1811
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
1912
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
20-
github.com/go-text/typesetting v0.0.0-20221214153724-0399769901d5 h1:iOA0HmtpANn48hX2nlDNMu0VVaNza35HJG0WeetBVzQ=
21-
github.com/go-text/typesetting v0.0.0-20221214153724-0399769901d5/go.mod h1:/cmOXaoTiO+lbCwkTZBgCvevJpbFsZ5reXIpEJVh5MI=
13+
github.com/go-text/typesetting v0.0.0-20230720191532-efc36025df80 h1:hyqXubLnpwyvrg5vRGTvxtJLmxyXLtcNtZRfm1XlPfM=
14+
github.com/go-text/typesetting v0.0.0-20230720191532-efc36025df80/go.mod h1:evDBbvNR/KaVFZ2ZlDSOWWXIUKq0wCOEtzLxRM8SG3k=
15+
github.com/go-text/typesetting-utils v0.0.0-20230616150549-2a7df14b6a22 h1:LBQTFxP2MfsyEDqSKmUBZaDuDHN1vpqDyOZjcqS7MYI=
16+
github.com/inkeliz/giosvg v0.0.0-20230419135231-464df5851c6a h1:sDqP2vCcqZrUPbEpjIenuQDXsEiT7q7djhd9qDI+nT4=
17+
github.com/inkeliz/giosvg v0.0.0-20230419135231-464df5851c6a/go.mod h1:9cMSIlqFpG0OLzPNsUf/l+j7Icbs5nbxln/Ez0q6S94=
2218
github.com/inkeliz/go_inkwasm v0.0.0-20220912074516-049d3472c98a h1:uZklbtdSPrDL/d1EUKd9s8a0Byla2TT01Wg/GZ4xj0w=
2319
github.com/inkeliz/go_inkwasm v0.0.0-20220912074516-049d3472c98a/go.mod h1:LPI3Qojj7OgTyc2R4RPB6BuMSgjoOXCObwnDzz1SOVk=
24-
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck=
25-
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
20+
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
21+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
2622
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
2723
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
2824
golang.org/x/exp v0.0.0-20221012211006-4de253d81b95 h1:sBdrWpxhGDdTAYNqbgBLAR+ULAPPhfgncLr1X0lyWtg=
2925
golang.org/x/exp v0.0.0-20221012211006-4de253d81b95/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
3026
golang.org/x/exp/shiny v0.0.0-20220921164117-439092de6870 h1:GjCs9zNN8fojJskeK7QiiVecCaMk0dfGTyL6IUcmp0o=
3127
golang.org/x/exp/shiny v0.0.0-20220921164117-439092de6870/go.mod h1:VjAR7z0ngyATZTELrBSkxOOHhhlnVUxDye4mcjx5h/8=
32-
golang.org/x/image v0.0.0-20210504121937-7319ad40d33e/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
33-
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
34-
golang.org/x/image v0.0.0-20220902085622-e7cb96979f69 h1:Lj6HJGCSn5AjxRAH2+r35Mir4icalbqku+CLUtjnvXY=
35-
golang.org/x/image v0.0.0-20220902085622-e7cb96979f69/go.mod h1:doUCurBvlfPMKfmIpRIywoHmhN3VyhnoFDbvIEWF4hY=
36-
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
28+
golang.org/x/image v0.5.0 h1:5JMiNunQeQw++mMOz48/ISeNu3Iweh/JaZU8ZLqHRrI=
29+
golang.org/x/image v0.5.0/go.mod h1:FVC7BI/5Ym8R25iw5OLsgshdUBbT1h5jZTpA+mvAdZ4=
3730
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
38-
golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
39-
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
31+
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
32+
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
33+
golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0=
34+
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
35+
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
4036
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
37+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
4138
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
42-
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
4339
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
44-
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
40+
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
41+
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
42+
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4543
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc=
4644
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4745
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
46+
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
4847
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
49-
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
48+
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
5049
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
5150
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
5251
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
5352
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
54-
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
53+
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
5554
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
55+
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

webviewer/demo/demo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
)
3030

3131
var (
32-
GlobalShaper = text.NewShaper(gofont.Collection())
32+
GlobalShaper = text.NewShaper(text.WithCollection(gofont.Collection()))
3333
DefaultURL = "https://google.com"
3434

3535
IconAdd, _ = widget.NewIcon(icons.ContentAdd)

webviewer/demo/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.19
55
replace github.com/gioui-plugins/gio-plugins => ../../
66

77
require (
8-
gioui.org v0.0.0-20230425023356-bba91263b077
8+
gioui.org v0.1.1-0.20230801070910-edbf872b44af
99
github.com/gioui-plugins/gio-plugins v0.0.0-00010101000000-000000000000
1010
golang.org/x/exp/shiny v0.0.0-20230425010034-47ecfdc1ba53
1111
)
@@ -16,7 +16,7 @@ require (
1616
gioui.org/shader v1.0.6 // indirect
1717
git.wow.st/gmp/jni v0.0.0-20210610011705-34026c7e22d0 // indirect
1818
github.com/akavel/rsrc v0.10.1 // indirect
19-
github.com/go-text/typesetting v0.0.0-20230413204129-b4f0492bf7ae // indirect
19+
github.com/go-text/typesetting v0.0.0-20230720191532-efc36025df80 // indirect
2020
github.com/inkeliz/go_inkwasm v0.0.0-20220912074516-049d3472c98a // indirect
2121
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
2222
golang.org/x/exp v0.0.0-20221012211006-4de253d81b95 // indirect

webviewer/demo/go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
eliasnaur.com/font v0.0.0-20230308162249-dd43949cb42d h1:ARo7NCVvN2NdhLlJE9xAbKweuI9L6UgfTbYb0YwPacY=
22
gioui.org v0.0.0-20230425023356-bba91263b077 h1:BfZ3LodNX41vEUJI2dWHkFsZe+NVEHSTv8TceMyVe0M=
33
gioui.org v0.0.0-20230425023356-bba91263b077/go.mod h1:8CFQM/4LurRd9G3NUYdacFb9j2pK0LrAyVO2mAZo4mw=
4+
gioui.org v0.1.1-0.20230801070910-edbf872b44af h1:JyZldA0MGu2FjO8vCnLOhnFeL1HicOm3HVkbvoB4lJg=
5+
gioui.org v0.1.1-0.20230801070910-edbf872b44af/go.mod h1:klzDun/4xN9Z9DyIRVyNHU8b6lqbHIcJpnIhKOArpyY=
46
gioui.org/cmd v0.0.0-20230502182008-0a86898b4184 h1:/vJ5Q9ZpawCIr1btGykwTHsrMQIkl/Vo1lCrhF8MENE=
57
gioui.org/cmd v0.0.0-20230502182008-0a86898b4184/go.mod h1:Ka3v7oyXel7Kmtuqwtlp05nEQzm9t4wskHnIEWojWNU=
68
gioui.org/cpu v0.0.0-20210808092351-bfe733dd3334/go.mod h1:A8M0Cn5o+vY5LTMlnRoK3O5kG+rH0kWfJjeKd9QpBmQ=
@@ -14,6 +16,8 @@ github.com/akavel/rsrc v0.10.1 h1:hCCPImjmFKVNGpeLZyTDRHEFC283DzyTXTo0cO0Rq9o=
1416
github.com/akavel/rsrc v0.10.1/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
1517
github.com/go-text/typesetting v0.0.0-20230413204129-b4f0492bf7ae h1:LCcaQgYrnS+sx9Tc3oGUvbRBRt+5oFnKWakaxeAvNVI=
1618
github.com/go-text/typesetting v0.0.0-20230413204129-b4f0492bf7ae/go.mod h1:KmrpWuSMFcO2yjmyhGpnBGQHSKAoEgMTSSzvLDzCuEA=
19+
github.com/go-text/typesetting v0.0.0-20230720191532-efc36025df80 h1:hyqXubLnpwyvrg5vRGTvxtJLmxyXLtcNtZRfm1XlPfM=
20+
github.com/go-text/typesetting v0.0.0-20230720191532-efc36025df80/go.mod h1:evDBbvNR/KaVFZ2ZlDSOWWXIUKq0wCOEtzLxRM8SG3k=
1721
github.com/go-text/typesetting-utils v0.0.0-20230412163830-89e4bcfa3ecc h1:9Kf84pnrmmjdRzZIkomfjowmGUhHs20jkrWYw/I6CYc=
1822
github.com/inkeliz/go_inkwasm v0.0.0-20220912074516-049d3472c98a h1:uZklbtdSPrDL/d1EUKd9s8a0Byla2TT01Wg/GZ4xj0w=
1923
github.com/inkeliz/go_inkwasm v0.0.0-20220912074516-049d3472c98a/go.mod h1:LPI3Qojj7OgTyc2R4RPB6BuMSgjoOXCObwnDzz1SOVk=

webviewer/webview/sys_darwin.m

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
@import WebKit;
1212

1313
@interface callbackHandler : NSObject<WKScriptMessageHandler>
14-
@property (nonatomic, assign) uintptr_t handler;
14+
@property (nonatomic, assign) uintptr_t webviewerHandler;
1515
@end
1616

1717
@implementation callbackHandler
18-
uintptr_t handler;
18+
uintptr_t webviewerHandler;
1919

2020
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {
21-
javascriptManagerCallback(_handler, (char *)[[message body] UTF8String]);
21+
javascriptManagerCallback(self.webviewerHandler, (char *)[[message body] UTF8String]);
2222
}
2323
@end
2424

@@ -114,7 +114,6 @@ void run(CFTypeRef web, CFTypeRef windowRef) {
114114
}
115115

116116
void getCookies(CFTypeRef config, uintptr_t handler, uintptr_t done) {
117-
NSISO8601DateFormatter *dateFormatting = [[NSISO8601DateFormatter alloc] init];
118117
WKWebViewConfiguration *configuration = (__bridge WKWebViewConfiguration *)config;
119118
[[[configuration websiteDataStore] httpCookieStore] getAllCookies: ^(NSArray<NSHTTPCookie *> * array) {
120119
int i = 0;
@@ -157,7 +156,7 @@ void addCookie(CFTypeRef config, uintptr_t done, char *name, char *value, char *
157156
NSHTTPCookieDomain: @(domain),
158157
NSHTTPCookiePath: @(path),
159158
NSHTTPCookieExpires: [NSDate dateWithTimeIntervalSince1970:expires],
160-
NSHTTPCookieSecure: ((features) == 2 ? @("true") : @("false")),
159+
NSHTTPCookieSecure: ((features & 2) == 2 ? @("true") : @("false")),
161160
}];
162161

163162
[[[configuration websiteDataStore] httpCookieStore] setCookie:cookie completionHandler: ^(void) {
@@ -221,7 +220,7 @@ void addCallbackJavascript(CFTypeRef config, char *name, uintptr_t handler) {
221220
WKUserContentController *controller = [configuration userContentController];
222221

223222
callbackHandler *scriptMessageHandler = [callbackHandler alloc];
224-
scriptMessageHandler.handler = handler;
223+
scriptMessageHandler.webviewerHandler = handler;
225224

226225
[controller addScriptMessageHandler:scriptMessageHandler name:@(name)];
227226
}

webviewer/webview/sys_windows.go

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,49 @@
33
package webview
44

55
import (
6+
"os"
7+
"path/filepath"
68
"unsafe"
79

8-
"github.com/jchv/go-winloader"
910
"golang.org/x/sys/windows"
1011
)
1112

1213
var (
13-
_CreateCoreWebView2EnvironmentWithOptions winloader.Proc
14+
_CreateCoreWebView2EnvironmentWithOptions *windows.Proc
1415
_Ole32 = windows.NewLazySystemDLL("ole32.dll")
1516
_Ole32CoTaskMemAlloc = _Ole32.NewProc("CoTaskMemAlloc")
1617
)
1718

1819
func init() {
19-
dll, _ := winloader.LoadFromMemory(dllFile)
20-
_CreateCoreWebView2EnvironmentWithOptions = dll.Proc("CreateCoreWebView2EnvironmentWithOptions")
20+
// current app name
21+
appName := "gio-webview2-"
22+
if len(os.Args) > 0 {
23+
appName = filepath.Base(os.Args[0])
24+
}
25+
26+
dllPath := filepath.Join(os.TempDir(), appName+"webview2loader.dll")
27+
dst, err := os.Create(dllPath)
28+
if err != nil {
29+
panic(err)
30+
}
31+
32+
if _, err := dst.Write(dllFile); err != nil {
33+
panic(err)
34+
}
35+
36+
if err := dst.Close(); err != nil {
37+
panic(err)
38+
}
39+
40+
dll, err := windows.LoadDLL(dllPath)
41+
if err != nil {
42+
panic(err)
43+
}
44+
45+
_CreateCoreWebView2EnvironmentWithOptions, err = dll.FindProc("CreateCoreWebView2EnvironmentWithOptions")
46+
if err != nil {
47+
panic(err)
48+
}
2149
}
2250

2351
var (

webviewer/webview/sys_windows_386.dll

1000 Bytes
Binary file not shown.
2.53 KB
Binary file not shown.

0 commit comments

Comments
 (0)