v8 context

This commit is contained in:
杨红岩 2023-02-23 14:34:23 +08:00
parent 70832401ac
commit 9d79342e8c
11 changed files with 693 additions and 46 deletions

View File

@ -281,10 +281,26 @@ func init() {
}
v8ctx := (*iCefV8ContextPtr)(getPtr(2))
ctx := &ICefV8Context{
Browser: browser,
Frame: frame,
Global: &V8Value{instance: v8ctx.Global, ptr: unsafe.Pointer(v8ctx.Global)},
instance: unsafe.Pointer(v8ctx.V8Context),
Browser: browser,
Frame: frame,
Global: &ICefV8Value{instance: unsafe.Pointer(v8ctx.Global)},
}
fmt.Println("iCefV8ContextPtr", v8ctx, "Global.IsValid:", ctx.Global.IsValid(), ctx.Global.IsUndefined(), ctx.Global.GetDateValue())
fmt.Println("iCefV8ContextPtr GetStringValuer", ctx.Global.GetStringValue())
fmt.Println("iCefV8ContextPtr GetValueByIndex", ctx.Global.GetValueByIndex(0).IsValid())
fmt.Println("iCefV8ContextPtr GetValueByIndex", ctx.Global.GetValueByIndex(1).IsValid())
fmt.Println("iCefV8ContextPtr GetValueByKey", ctx.Global.GetValueByKey("name").IsValid())
fmt.Println("iCefV8ContextPtr SetValueByAccessor", ctx.Global.SetValueByAccessor("nametest", V8_ACCESS_CONTROL_DEFAULT, V8_PROPERTY_ATTRIBUTE_NONE))
fmt.Println("iCefV8ContextPtr GetExternallyAllocatedMemory", ctx.Global.GetExternallyAllocatedMemory())
fmt.Println("iCefV8ContextPtr AdjustExternallyAllocatedMemory", ctx.Global.AdjustExternallyAllocatedMemory(0))
fmt.Println("iCefV8ContextPtr GetExternallyAllocatedMemory.GetValueByKey", ctx.Global.GetValueByKey("name").GetExternallyAllocatedMemory())
fmt.Println("iCefV8ContextPtr GetFunctionName", ctx.Global.GetFunctionName())
fmt.Println("V8ValueRef IsValid", V8ValueRef.NewUndefined().IsValid())
object := V8ValueRef.NewObject(nil, nil)
fmt.Println("V8ValueRef NewObject", object, object.IsValid())
fmt.Println("Global.SetValueByKey", ctx.Global.SetValueByKey("testset", object, V8_PROPERTY_ATTRIBUTE_READONLY))
var status = (*bool)(getPtr(3))
//用户定义返回 false 创建 render IPC 及 变量绑定
var result = fn.(GlobalCEFAppEventOnContextCreated)(browser, frame, ctx)

View File

@ -562,6 +562,75 @@ func init() {
dllimports.NewEnergyImport("ICEFWindow_SetAccelerator", 0),
dllimports.NewEnergyImport("ICEFWindow_RemoveAccelerator", 0),
dllimports.NewEnergyImport("ICEFWindow_RemoveAllAccelerators", 0),
//ICefV8Value
dllimports.NewEnergyImport("CefV8Value_IsValid", 0),
dllimports.NewEnergyImport("CefV8Value_IsUndefined", 0),
dllimports.NewEnergyImport("CefV8Value_IsNull", 0),
dllimports.NewEnergyImport("CefV8Value_IsBool", 0),
dllimports.NewEnergyImport("CefV8Value_IsInt", 0),
dllimports.NewEnergyImport("CefV8Value_IsUInt", 0),
dllimports.NewEnergyImport("CefV8Value_IsDouble", 0),
dllimports.NewEnergyImport("CefV8Value_IsDate", 0),
dllimports.NewEnergyImport("CefV8Value_IsString", 0),
dllimports.NewEnergyImport("CefV8Value_IsObject", 0),
dllimports.NewEnergyImport("CefV8Value_IsArray", 0),
dllimports.NewEnergyImport("CefV8Value_IsArrayBuffer", 0),
dllimports.NewEnergyImport("CefV8Value_IsFunction", 0),
dllimports.NewEnergyImport("CefV8Value_IsPromise", 0),
dllimports.NewEnergyImport("CefV8Value_IsSame", 0),
dllimports.NewEnergyImport("CefV8Value_GetBoolValue", 0),
dllimports.NewEnergyImport("CefV8Value_GetIntValue", 0),
dllimports.NewEnergyImport("CefV8Value_GetUIntValue", 0),
dllimports.NewEnergyImport("CefV8Value_GetDoubleValue", 0),
dllimports.NewEnergyImport("CefV8Value_GetDateValue", 0),
dllimports.NewEnergyImport("CefV8Value_GetStringValue", 0),
dllimports.NewEnergyImport("CefV8Value_IsUserCreated", 0),
dllimports.NewEnergyImport("CefV8Value_HasException", 0),
dllimports.NewEnergyImport("CefV8Value_GetException", 0),
dllimports.NewEnergyImport("CefV8Value_ClearException", 0),
dllimports.NewEnergyImport("CefV8Value_WillRethrowExceptions", 0),
dllimports.NewEnergyImport("CefV8Value_SetRethrowExceptions", 0),
dllimports.NewEnergyImport("CefV8Value_HasValueByKey", 0),
dllimports.NewEnergyImport("CefV8Value_HasValueByIndex", 0),
dllimports.NewEnergyImport("CefV8Value_DeleteValueByKey", 0),
dllimports.NewEnergyImport("CefV8Value_DeleteValueByIndex", 0),
dllimports.NewEnergyImport("CefV8Value_GetValueByKey", 0),
dllimports.NewEnergyImport("CefV8Value_GetValueByIndex", 0),
dllimports.NewEnergyImport("CefV8Value_SetValueByKey", 0),
dllimports.NewEnergyImport("CefV8Value_SetValueByIndex", 0),
dllimports.NewEnergyImport("CefV8Value_SetValueByAccessor", 0),
dllimports.NewEnergyImport("CefV8Value_GetKeys", 0),
dllimports.NewEnergyImport("CefV8Value_SetUserData", 0),
dllimports.NewEnergyImport("CefV8Value_GetUserData", 0),
dllimports.NewEnergyImport("CefV8Value_GetExternallyAllocatedMemory", 0),
dllimports.NewEnergyImport("CefV8Value_AdjustExternallyAllocatedMemory", 0),
dllimports.NewEnergyImport("CefV8Value_GetArrayLength", 0),
dllimports.NewEnergyImport("CefV8Value_GetArrayBufferReleaseCallback", 0),
dllimports.NewEnergyImport("CefV8Value_NeuterArrayBuffer", 0),
dllimports.NewEnergyImport("CefV8Value_GetFunctionName", 0),
dllimports.NewEnergyImport("CefV8Value_GetFunctionHandler", 0),
dllimports.NewEnergyImport("CefV8Value_ExecuteFunction", 0),
dllimports.NewEnergyImport("CefV8Value_ExecuteFunctionWithContext", 0),
dllimports.NewEnergyImport("CefV8Value_ResolvePromise", 0),
dllimports.NewEnergyImport("CefV8Value_RejectPromise", 0),
//TCefV8ValueRef
dllimports.NewEnergyImport("CefV8ValueRef_NewUndefined", 0),
dllimports.NewEnergyImport("CefV8ValueRef_NewNull", 0),
dllimports.NewEnergyImport("CefV8ValueRef_NewBool", 0),
dllimports.NewEnergyImport("CefV8ValueRef_NewInt", 0),
dllimports.NewEnergyImport("CefV8ValueRef_NewUInt", 0),
dllimports.NewEnergyImport("CefV8ValueRef_NewDouble", 0),
dllimports.NewEnergyImport("CefV8ValueRef_NewDate", 0),
dllimports.NewEnergyImport("CefV8ValueRef_NewString", 0),
dllimports.NewEnergyImport("CefV8ValueRef_NewObject", 0),
dllimports.NewEnergyImport("CefV8ValueRef_NewArray", 0),
dllimports.NewEnergyImport("CefV8ValueRef_NewArrayBuffer", 0),
dllimports.NewEnergyImport("CefV8ValueRef_NewFunction", 0),
dllimports.NewEnergyImport("CefV8ValueRef_NewPromise", 0),
//ICefV8Accessor
dllimports.NewEnergyImport("CefV8Accessor_Create", 0),
dllimports.NewEnergyImport("CefV8Accessor_Get", 0),
dllimports.NewEnergyImport("CefV8Accessor_Set", 0),
}
imports.SetEnergyImportDefs(energyImportDefs)
}
@ -1112,4 +1181,73 @@ const (
internale_ICEFWindow_SetAccelerator
internale_ICEFWindow_RemoveAccelerator
internale_ICEFWindow_RemoveAllAccelerators
//ICefV8Value
internale_CefV8Value_IsValid
internale_CefV8Value_IsUndefined
internale_CefV8Value_IsNull
internale_CefV8Value_IsBool
internale_CefV8Value_IsInt
internale_CefV8Value_IsUInt
internale_CefV8Value_IsDouble
internale_CefV8Value_IsDate
internale_CefV8Value_IsString
internale_CefV8Value_IsObject
internale_CefV8Value_IsArray
internale_CefV8Value_IsArrayBuffer
internale_CefV8Value_IsFunction
internale_CefV8Value_IsPromise
internale_CefV8Value_IsSame
internale_CefV8Value_GetBoolValue
internale_CefV8Value_GetIntValue
internale_CefV8Value_GetUIntValue
internale_CefV8Value_GetDoubleValue
internale_CefV8Value_GetDateValue
internale_CefV8Value_GetStringValue
internale_CefV8Value_IsUserCreated
internale_CefV8Value_HasException
internale_CefV8Value_GetException
internale_CefV8Value_ClearException
internale_CefV8Value_WillRethrowExceptions
internale_CefV8Value_SetRethrowExceptions
internale_CefV8Value_HasValueByKey
internale_CefV8Value_HasValueByIndex
internale_CefV8Value_DeleteValueByKey
internale_CefV8Value_DeleteValueByIndex
internale_CefV8Value_GetValueByKey
internale_CefV8Value_GetValueByIndex
internale_CefV8Value_SetValueByKey
internale_CefV8Value_SetValueByIndex
internale_CefV8Value_SetValueByAccessor
internale_CefV8Value_GetKeys
internale_CefV8Value_SetUserData
internale_CefV8Value_GetUserData
internale_CefV8Value_GetExternallyAllocatedMemory
internale_CefV8Value_AdjustExternallyAllocatedMemory
internale_CefV8Value_GetArrayLength
internale_CefV8Value_GetArrayBufferReleaseCallback
internale_CefV8Value_NeuterArrayBuffer
internale_CefV8Value_GetFunctionName
internale_CefV8Value_GetFunctionHandler
internale_CefV8Value_ExecuteFunction
internale_CefV8Value_ExecuteFunctionWithContext
internale_CefV8Value_ResolvePromise
internale_CefV8Value_RejectPromise
//TCefV8ValueRef
internale_CefV8ValueRef_NewUndefined
internale_CefV8ValueRef_NewNull
internale_CefV8ValueRef_NewBool
internale_CefV8ValueRef_NewInt
internale_CefV8ValueRef_NewUInt
internale_CefV8ValueRef_NewDouble
internale_CefV8ValueRef_NewDate
internale_CefV8ValueRef_NewString
internale_CefV8ValueRef_NewObject
internale_CefV8ValueRef_NewArray
internale_CefV8ValueRef_NewArrayBuffer
internale_CefV8ValueRef_NewFunction
internale_CefV8ValueRef_NewPromise
//ICefV8Accessor
internale_CefV8Accessor_Create
internale_CefV8Accessor_Get
internale_CefV8Accessor_Set
)

View File

@ -18,9 +18,10 @@ import (
)
type iCefV8ContextPtr struct {
Browse uintptr //ptr
Frame uintptr //ptr
Global uintptr //ptr
V8Context uintptr //ptr
Browse uintptr //ptr
Frame uintptr //ptr
Global uintptr //ptr
}
type iCefCookiePtr struct {

View File

@ -0,0 +1,53 @@
package cef
import (
"fmt"
"github.com/energye/energy/common/imports"
"github.com/energye/golcl/lcl"
"github.com/energye/golcl/lcl/api"
"unsafe"
)
type V8AccessorGet func(name string, object, retVal ICefV8Value, exception string) bool
type V8AccessorSet func(name string, object, value ICefV8Value, exception string) bool
func CreateCefV8Accessor() *ICefV8Accessor {
var result uintptr
imports.Proc(internale_CefV8Accessor_Create).Call(uintptr(unsafe.Pointer(&result)))
return &ICefV8Accessor{
instance: unsafe.Pointer(result),
}
}
// Instance 实例
func (m *ICefV8Accessor) Instance() uintptr {
if m == nil {
return 0
}
return uintptr(m.instance)
}
func (m *ICefV8Accessor) Get(fn V8AccessorGet) {
imports.Proc(internale_CefV8Accessor_Get).Call(m.Instance(), api.MakeEventDataPtr(fn))
}
func (m *ICefV8Accessor) Set(fn V8AccessorSet) {
imports.Proc(internale_CefV8Accessor_Set).Call(m.Instance(), api.MakeEventDataPtr(fn))
}
func init() {
lcl.RegisterExtEventCallback(func(fn interface{}, getVal func(idx int) uintptr) bool {
getPtr := func(i int) unsafe.Pointer {
return unsafe.Pointer(getVal(i))
}
switch fn.(type) {
case V8AccessorGet:
fmt.Println("----V8AccessorGet", getPtr)
case V8AccessorSet:
fmt.Println("----V8AccessorSet", getPtr)
default:
return false
}
return true
})
}

View File

@ -11,14 +11,7 @@
// CEF V8 上下文
package cef
import "unsafe"
// ICefV8Context
// 渲染进程创建时对V8Value创建
type ICefV8Context struct {
instance uintptr
ptr unsafe.Pointer
Browser *ICefBrowser
Frame *ICefFrame
Global *V8Value
// Instance 实例
func (m *ICefV8Context) Instance() uintptr {
return uintptr(m.instance)
}

View File

@ -0,0 +1,9 @@
package cef
// Instance 实例
func (m *ICefV8Handler) Instance() uintptr {
if m == nil {
return 0
}
return uintptr(m.instance)
}

View File

@ -0,0 +1,9 @@
package cef
// Instance 实例
func (m *ICefV8Interceptor) Instance() uintptr {
if m == nil {
return 0
}
return uintptr(m.instance)
}

385
cef/cef-types-v8-value.go Normal file
View File

@ -0,0 +1,385 @@
package cef
import (
"github.com/energye/energy/common"
"github.com/energye/energy/common/imports"
"github.com/energye/energy/consts"
"github.com/energye/golcl/lcl/api"
"time"
"unsafe"
)
func (m *ICefV8Value) Instance() uintptr {
if m == nil {
return 0
}
return uintptr(m.instance)
}
func (m *ICefV8Value) IsValid() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_IsValid).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) IsUndefined() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_IsUndefined).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) IsNull() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_IsNull).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) IsBool() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_IsBool).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) IsInt() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_IsInt).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) IsUInt() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_IsUInt).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) IsDouble() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_IsDouble).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) IsDate() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_IsDate).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) IsString() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_IsString).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) IsObject() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_IsObject).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) IsArray() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_IsArray).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) IsArrayBuffer() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_IsArrayBuffer).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) IsFunction() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_IsFunction).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) IsPromise() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_IsPromise).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) IsSame() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_IsSame).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) GetBoolValue() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_GetBoolValue).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) GetIntValue() int32 {
r1, _, _ := imports.Proc(internale_CefV8Value_GetIntValue).Call(m.Instance())
return int32(r1)
}
func (m *ICefV8Value) GetUIntValue() uint32 {
r1, _, _ := imports.Proc(internale_CefV8Value_GetIntValue).Call(m.Instance())
return uint32(r1)
}
func (m *ICefV8Value) GetDoubleValue() (result float64) {
imports.Proc(internale_CefV8Value_GetDoubleValue).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return result
}
func (m *ICefV8Value) GetDateValue() time.Time {
var result float64
imports.Proc(internale_CefV8Value_GetDateValue).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return common.DDateTimeToGoDateTime(result)
}
func (m *ICefV8Value) GetStringValue() string {
r1, _, _ := imports.Proc(internale_CefV8Value_GetStringValue).Call(m.Instance())
return api.GoStr(r1)
}
func (m *ICefV8Value) IsUserCreated() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_IsUserCreated).Call(m.Instance())
return api.GoBool(r1)
}
//func (m *ICefV8Value) HasException() bool {
// r1, _, _ := imports.Proc(internale_CefV8Value_HasException).Call(m.Instance())
// return api.GoBool(r1)
//}
//func (m *ICefV8Value) GetException() {
//
//}
func (m *ICefV8Value) ClearException() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_ClearException).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) WillRethrowExceptions() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_WillRethrowExceptions).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) SetRethrowExceptions(reThrow bool) bool {
r1, _, _ := imports.Proc(internale_CefV8Value_SetRethrowExceptions).Call(m.Instance(), api.PascalBool(reThrow))
return api.GoBool(r1)
}
func (m *ICefV8Value) HasValueByKey(key string) bool {
r1, _, _ := imports.Proc(internale_CefV8Value_HasValueByKey).Call(m.Instance(), api.PascalStr(key))
return api.GoBool(r1)
}
func (m *ICefV8Value) HasValueByIndex(index int32) bool {
r1, _, _ := imports.Proc(internale_CefV8Value_HasValueByIndex).Call(m.Instance(), uintptr(index))
return api.GoBool(r1)
}
func (m *ICefV8Value) DeleteValueByKey(key string) bool {
r1, _, _ := imports.Proc(internale_CefV8Value_DeleteValueByKey).Call(m.Instance(), api.PascalStr(key))
return api.GoBool(r1)
}
func (m *ICefV8Value) DeleteValueByIndex(index int32) bool {
r1, _, _ := imports.Proc(internale_CefV8Value_DeleteValueByIndex).Call(m.Instance(), uintptr(index))
return api.GoBool(r1)
}
func (m *ICefV8Value) GetValueByKey(key string) *ICefV8Value {
var result uintptr
imports.Proc(internale_CefV8Value_GetValueByKey).Call(m.Instance(), api.PascalStr(key), uintptr(unsafe.Pointer(&result)))
return &ICefV8Value{
instance: unsafe.Pointer(result),
}
}
func (m *ICefV8Value) GetValueByIndex(index int32) *ICefV8Value {
var result uintptr
imports.Proc(internale_CefV8Value_GetValueByIndex).Call(m.Instance(), uintptr(index), uintptr(unsafe.Pointer(&result)))
return &ICefV8Value{
instance: unsafe.Pointer(result),
}
}
func (m *ICefV8Value) SetValueByKey(key string, value *ICefV8Value, attribute consts.TCefV8PropertyAttributes) bool {
r1, _, _ := imports.Proc(internale_CefV8Value_SetValueByKey).Call(m.Instance(), api.PascalStr(key), value.Instance(), attribute.ToPtr())
return api.GoBool(r1)
}
func (m *ICefV8Value) SetValueByIndex(index int32, value *ICefV8Value) bool {
r1, _, _ := imports.Proc(internale_CefV8Value_SetValueByIndex).Call(m.Instance(), uintptr(index), value.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) SetValueByAccessor(key string, settings consts.TCefV8AccessControls, attribute consts.TCefV8PropertyAttributes) bool {
r1, _, _ := imports.Proc(internale_CefV8Value_SetValueByAccessor).Call(m.Instance(), api.PascalStr(key), settings.ToPtr(), attribute.ToPtr())
return api.GoBool(r1)
}
//func (m *ICefV8Value) GetKeys(keys *lcl.TStrings) int32 {
// r1, _, _ := imports.Proc(internale_CefV8Value_GetKeys).Call(m.Instance(), keys.Instance())
// return int32(r1)
//}
func (m *ICefV8Value) SetUserData(data *ICefV8Value) bool {
r1, _, _ := imports.Proc(internale_CefV8Value_SetUserData).Call(m.Instance(), data.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) GetUserData() *ICefV8Value {
var result uintptr
imports.Proc(internale_CefV8Value_GetUserData).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return &ICefV8Value{
instance: unsafe.Pointer(result),
}
}
func (m *ICefV8Value) GetExternallyAllocatedMemory() int32 {
r1, _, _ := imports.Proc(internale_CefV8Value_GetExternallyAllocatedMemory).Call(m.Instance())
return int32(r1)
}
func (m *ICefV8Value) AdjustExternallyAllocatedMemory(changeInBytes int32) int32 {
r1, _, _ := imports.Proc(internale_CefV8Value_AdjustExternallyAllocatedMemory).Call(m.Instance(), uintptr(changeInBytes))
return int32(r1)
}
func (m *ICefV8Value) GetArrayLength() int32 {
r1, _, _ := imports.Proc(internale_CefV8Value_GetArrayLength).Call(m.Instance())
return int32(r1)
}
//func (m *ICefV8Value) GetArrayBufferReleaseCallback() {
//
//}
func (m *ICefV8Value) NeuterArrayBuffer() bool {
r1, _, _ := imports.Proc(internale_CefV8Value_NeuterArrayBuffer).Call(m.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) GetFunctionName() string {
r1, _, _ := imports.Proc(internale_CefV8Value_GetFunctionName).Call(m.Instance())
return api.GoStr(r1)
}
func (m *ICefV8Value) GetFunctionHandler() *ICefV8Handler {
var result uintptr
imports.Proc(internale_CefV8Value_GetFunctionName).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
return &ICefV8Handler{
instance: unsafe.Pointer(result),
}
}
func (m *ICefV8Value) ExecuteFunction(obj *ICefV8Value, arguments []*ICefV8Value) *ICefV8Value {
var result uintptr
imports.Proc(internale_CefV8Value_ExecuteFunction).Call(m.Instance(), obj.Instance(), uintptr(unsafe.Pointer(&result)), uintptr(unsafe.Pointer(arguments[0])), uintptr(int32(len(arguments))))
return &ICefV8Value{
instance: unsafe.Pointer(result),
}
}
func (m *ICefV8Value) ExecuteFunctionWithContext(v8Context *ICefV8Context, obj *ICefV8Value, arguments []*ICefV8Value) *ICefV8Value {
var result uintptr
imports.Proc(internale_CefV8Value_ExecuteFunctionWithContext).Call(m.Instance(), v8Context.Instance(), obj.Instance(), uintptr(unsafe.Pointer(&result)), uintptr(unsafe.Pointer(arguments[0])), uintptr(int32(len(arguments))))
return &ICefV8Value{
instance: unsafe.Pointer(result),
}
}
func (m *ICefV8Value) ResolvePromise(arg *ICefV8Value) bool {
r1, _, _ := imports.Proc(internale_CefV8Value_ResolvePromise).Call(m.Instance(), arg.Instance())
return api.GoBool(r1)
}
func (m *ICefV8Value) RejectPromise(errorMsg string) bool {
r1, _, _ := imports.Proc(internale_CefV8Value_RejectPromise).Call(m.Instance(), api.PascalStr(errorMsg))
return api.GoBool(r1)
}
// TCefV8ValueRef
type TCefV8ValueRef uintptr
var V8ValueRef TCefV8ValueRef
func (m *TCefV8ValueRef) NewUndefined() *ICefV8Value {
var result uintptr
imports.Proc(internale_CefV8ValueRef_NewUndefined).Call(uintptr(unsafe.Pointer(&result)))
return &ICefV8Value{
instance: unsafe.Pointer(result),
}
}
func (m *TCefV8ValueRef) NewNull() *ICefV8Value {
var result uintptr
imports.Proc(internale_CefV8ValueRef_NewNull).Call(uintptr(unsafe.Pointer(&result)))
return &ICefV8Value{
instance: unsafe.Pointer(result),
}
}
func (m *TCefV8ValueRef) NewBool(value bool) *ICefV8Value {
var result uintptr
imports.Proc(internale_CefV8ValueRef_NewBool).Call(api.PascalBool(value), uintptr(unsafe.Pointer(&result)))
return &ICefV8Value{
instance: unsafe.Pointer(result),
}
}
func (m *TCefV8ValueRef) NewInt(value int32) *ICefV8Value {
var result uintptr
imports.Proc(internale_CefV8ValueRef_NewInt).Call(uintptr(value), uintptr(unsafe.Pointer(&result)))
return &ICefV8Value{
instance: unsafe.Pointer(result),
}
}
func (m *TCefV8ValueRef) NewUInt(value uint32) *ICefV8Value {
var result uintptr
imports.Proc(internale_CefV8ValueRef_NewUInt).Call(uintptr(value), uintptr(unsafe.Pointer(&result)))
return &ICefV8Value{
instance: unsafe.Pointer(result),
}
}
func (m *TCefV8ValueRef) NewDouble(value float64) *ICefV8Value {
var result uintptr
imports.Proc(internale_CefV8ValueRef_NewDouble).Call(uintptr(unsafe.Pointer(&value)), uintptr(unsafe.Pointer(&result)))
return &ICefV8Value{
instance: unsafe.Pointer(result),
}
}
func (m *TCefV8ValueRef) NewDate(value time.Time) *ICefV8Value {
var result uintptr
val := common.GoDateTimeToDDateTime(value)
imports.Proc(internale_CefV8ValueRef_NewDate).Call(uintptr(unsafe.Pointer(&val)), uintptr(unsafe.Pointer(&result)))
return &ICefV8Value{
instance: unsafe.Pointer(result),
}
}
func (m *TCefV8ValueRef) NewString(value string) *ICefV8Value {
var result uintptr
imports.Proc(internale_CefV8ValueRef_NewString).Call(api.PascalStr(value), uintptr(unsafe.Pointer(&result)))
return &ICefV8Value{
instance: unsafe.Pointer(result),
}
}
func (m *TCefV8ValueRef) NewObject(accessor *ICefV8Accessor, interceptor *ICefV8Interceptor) *ICefV8Value {
var result uintptr
imports.Proc(internale_CefV8ValueRef_NewObject).Call(accessor.Instance(), interceptor.Instance(), uintptr(unsafe.Pointer(&result)))
return &ICefV8Value{
instance: unsafe.Pointer(result),
}
}
//func (m *TCefV8ValueRef) NewArray(len int32) *ICefV8Value{
//
//}
//func (m *TCefV8ValueRef) NewArrayBuffer(buffer Pointer; length NativeUInt; const callback *ICefv8ArrayBufferReleaseCallback) *ICefV8Value{
//
//}
func (m *TCefV8ValueRef) NewFunction(name string, handler *ICefV8Handler) *ICefV8Value {
var result uintptr
imports.Proc(internale_CefV8ValueRef_NewFunction).Call(api.PascalStr(name), handler.Instance(), uintptr(unsafe.Pointer(&result)))
return &ICefV8Value{
instance: unsafe.Pointer(result),
}
}
func (m *TCefV8ValueRef) NewPromise() *ICefV8Value {
var result uintptr
imports.Proc(internale_CefV8ValueRef_NewPromise).Call(uintptr(unsafe.Pointer(&result)))
return &ICefV8Value{
instance: unsafe.Pointer(result),
}
}

View File

@ -211,6 +211,39 @@ type ICefDragData struct {
instance unsafe.Pointer
}
// ICefV8Context
type ICefV8Context struct {
instance unsafe.Pointer
Browser *ICefBrowser
Frame *ICefFrame
Global *ICefV8Value
}
// ICefV8Value
type ICefV8Value struct {
instance unsafe.Pointer
}
// ICefV8Handler
type ICefV8Handler struct {
instance unsafe.Pointer
}
//ICefV8Interceptor
type ICefV8Interceptor struct {
instance unsafe.Pointer
}
//ICefV8Accessor
type ICefV8Accessor struct {
instance unsafe.Pointer
}
//ICefV8ArrayBufferReleaseCallback
type ICefV8ArrayBufferReleaseCallback struct {
instance unsafe.Pointer
}
// NewCefRect
func NewCefRect(x, y, width, height int32) *TCefRect {
return &TCefRect{

View File

@ -240,16 +240,6 @@ const (
GO_VALUE_DICTVALUE //dictValue
)
// JS属性
type V8_PROPERTY_ATTRIBUTE = types.Int32
const (
V8_PROPERTY_ATTRIBUTE_NONE V8_PROPERTY_ATTRIBUTE = 0
V8_PROPERTY_ATTRIBUTE_READONLY V8_PROPERTY_ATTRIBUTE = 1 << 0
V8_PROPERTY_ATTRIBUTE_DONTENUM V8_PROPERTY_ATTRIBUTE = 1 << 1
V8_PROPERTY_ATTRIBUTE_DONTDELETE V8_PROPERTY_ATTRIBUTE = 1 << 2
)
// JS交互绑定的事件类型
type BIND_EVENT = types.Int32
@ -701,23 +691,43 @@ type ZoomStep = byte
const (
ZOOM_STEP_25 ZoomStep = 0
ZOOM_STEP_33 = 1
ZOOM_STEP_50 = 2
ZOOM_STEP_67 = 3
ZOOM_STEP_75 = 4
ZOOM_STEP_90 = 5
ZOOM_STEP_100 = 6
ZOOM_STEP_110 = 7
ZOOM_STEP_125 = 8
ZOOM_STEP_150 = 9
ZOOM_STEP_175 = 10
ZOOM_STEP_200 = 11
ZOOM_STEP_250 = 12
ZOOM_STEP_300 = 13
ZOOM_STEP_400 = 14
ZOOM_STEP_500 = 15
ZOOM_STEP_UNK = 16
ZOOM_STEP_MIN = ZOOM_STEP_25
ZOOM_STEP_MAX = ZOOM_STEP_500
ZOOM_STEP_DEF = ZOOM_STEP_100
ZOOM_STEP_33 ZoomStep = 1
ZOOM_STEP_50 ZoomStep = 2
ZOOM_STEP_67 ZoomStep = 3
ZOOM_STEP_75 ZoomStep = 4
ZOOM_STEP_90 ZoomStep = 5
ZOOM_STEP_100 ZoomStep = 6
ZOOM_STEP_110 ZoomStep = 7
ZOOM_STEP_125 ZoomStep = 8
ZOOM_STEP_150 ZoomStep = 9
ZOOM_STEP_175 ZoomStep = 10
ZOOM_STEP_200 ZoomStep = 11
ZOOM_STEP_250 ZoomStep = 12
ZOOM_STEP_300 ZoomStep = 13
ZOOM_STEP_400 ZoomStep = 14
ZOOM_STEP_500 ZoomStep = 15
ZOOM_STEP_UNK ZoomStep = 16
ZOOM_STEP_MIN ZoomStep = ZOOM_STEP_25
ZOOM_STEP_MAX ZoomStep = ZOOM_STEP_500
ZOOM_STEP_DEF ZoomStep = ZOOM_STEP_100
)
// /include/internal/cef_types.h (cef_v8_accesscontrol_t)
type TCefV8AccessControls = types.Cardinal
const (
V8_ACCESS_CONTROL_DEFAULT TCefV8AccessControls = 0
V8_ACCESS_CONTROL_ALL_CAN_READ TCefV8AccessControls = 1 << 0
V8_ACCESS_CONTROL_ALL_CAN_WRITE TCefV8AccessControls = 1 << 1
V8_ACCESS_CONTROL_PROHIBITS_OVERWRITING TCefV8AccessControls = 1 << 2
)
// /include/internal/cef_types.h (cef_v8_propertyattribute_t)
type TCefV8PropertyAttributes = types.Cardinal
const (
V8_PROPERTY_ATTRIBUTE_NONE TCefV8PropertyAttributes = 0
V8_PROPERTY_ATTRIBUTE_READONLY TCefV8PropertyAttributes = 1 << 0
V8_PROPERTY_ATTRIBUTE_DONTENUM TCefV8PropertyAttributes = 1 << 1
V8_PROPERTY_ATTRIBUTE_DONTDELETE TCefV8PropertyAttributes = 1 << 2
)

View File

@ -31,7 +31,7 @@
} catch (e) {
test(e)
}
test("testset", window.testset)
}
</script>
</head>