github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/safebrowsingprivate/apis_js_wasm.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 4 package safebrowsingprivate 5 6 import ( 7 "github.com/primecitizens/pcz/std/core/abi" 8 "github.com/primecitizens/pcz/std/core/mark" 9 "github.com/primecitizens/pcz/std/ffi/js" 10 "github.com/primecitizens/pcz/std/plat/js/webext/safebrowsingprivate/bindings" 11 ) 12 13 type DangerousDownloadInfo struct { 14 // Url is "DangerousDownloadInfo.url" 15 // 16 // Optional 17 Url js.String 18 // FileName is "DangerousDownloadInfo.fileName" 19 // 20 // Optional 21 FileName js.String 22 // DownloadDigestSha256 is "DangerousDownloadInfo.downloadDigestSha256" 23 // 24 // Optional 25 DownloadDigestSha256 js.String 26 // UserName is "DangerousDownloadInfo.userName" 27 // 28 // Optional 29 UserName js.String 30 31 FFI_USE bool 32 } 33 34 // FromRef calls UpdateFrom and returns a DangerousDownloadInfo with all fields set. 35 func (p DangerousDownloadInfo) FromRef(ref js.Ref) DangerousDownloadInfo { 36 p.UpdateFrom(ref) 37 return p 38 } 39 40 // New creates a new DangerousDownloadInfo in the application heap. 41 func (p DangerousDownloadInfo) New() js.Ref { 42 return bindings.DangerousDownloadInfoJSLoad( 43 js.Pointer(&p), js.True, 0, 44 ) 45 } 46 47 // UpdateFrom copies value of all fields of the heap object to p. 48 func (p *DangerousDownloadInfo) UpdateFrom(ref js.Ref) { 49 bindings.DangerousDownloadInfoJSStore( 50 js.Pointer(p), ref, 51 ) 52 } 53 54 // Update writes all fields of the p to the heap object referenced by ref. 55 func (p *DangerousDownloadInfo) Update(ref js.Ref) { 56 bindings.DangerousDownloadInfoJSLoad( 57 js.Pointer(p), js.False, ref, 58 ) 59 } 60 61 // FreeMembers frees fields with heap reference, if recursive is true 62 // free all heap references reachable from p. 63 func (p *DangerousDownloadInfo) FreeMembers(recursive bool) { 64 js.Free( 65 p.Url.Ref(), 66 p.FileName.Ref(), 67 p.DownloadDigestSha256.Ref(), 68 p.UserName.Ref(), 69 ) 70 p.Url = p.Url.FromRef(js.Undefined) 71 p.FileName = p.FileName.FromRef(js.Undefined) 72 p.DownloadDigestSha256 = p.DownloadDigestSha256.FromRef(js.Undefined) 73 p.UserName = p.UserName.FromRef(js.Undefined) 74 } 75 76 type GetReferrerChainCallbackFunc func(this js.Ref, entries js.Array[ReferrerChainEntry]) js.Ref 77 78 func (fn GetReferrerChainCallbackFunc) Register() js.Func[func(entries js.Array[ReferrerChainEntry])] { 79 return js.RegisterCallback[func(entries js.Array[ReferrerChainEntry])]( 80 fn, abi.FuncPCABIInternal(fn), 81 ) 82 } 83 84 func (fn GetReferrerChainCallbackFunc) DispatchCallback( 85 targetPC uintptr, ctx *js.CallbackContext, 86 ) { 87 args := ctx.Args() 88 if len(args) != 1+1 /* js this */ || 89 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 90 js.ThrowInvalidCallbackInvocation() 91 } 92 93 if ctx.Return(fn( 94 args[0], 95 96 js.Array[ReferrerChainEntry]{}.FromRef(args[0+1]), 97 )) { 98 return 99 } 100 101 js.ThrowCallbackValueNotReturned() 102 } 103 104 type GetReferrerChainCallback[T any] struct { 105 Fn func(arg T, this js.Ref, entries js.Array[ReferrerChainEntry]) js.Ref 106 Arg T 107 } 108 109 func (cb *GetReferrerChainCallback[T]) Register() js.Func[func(entries js.Array[ReferrerChainEntry])] { 110 return js.RegisterCallback[func(entries js.Array[ReferrerChainEntry])]( 111 cb, abi.FuncPCABIInternal(cb.Fn), 112 ) 113 } 114 115 func (cb *GetReferrerChainCallback[T]) DispatchCallback( 116 targetPC uintptr, ctx *js.CallbackContext, 117 ) { 118 args := ctx.Args() 119 if len(args) != 1+1 /* js this */ || 120 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 121 js.ThrowInvalidCallbackInvocation() 122 } 123 124 if ctx.Return(cb.Fn( 125 cb.Arg, 126 args[0], 127 128 js.Array[ReferrerChainEntry]{}.FromRef(args[0+1]), 129 )) { 130 return 131 } 132 133 js.ThrowCallbackValueNotReturned() 134 } 135 136 type URLType uint32 137 138 const ( 139 _ URLType = iota 140 141 URLType_EVENT_URL 142 URLType_LANDING_PAGE 143 URLType_LANDING_REFERRER 144 URLType_CLIENT_REDIRECT 145 URLType_RECENT_NAVIGATION 146 URLType_REFERRER 147 ) 148 149 func (URLType) FromRef(str js.Ref) URLType { 150 return URLType(bindings.ConstOfURLType(str)) 151 } 152 153 func (x URLType) String() (string, bool) { 154 switch x { 155 case URLType_EVENT_URL: 156 return "EVENT_URL", true 157 case URLType_LANDING_PAGE: 158 return "LANDING_PAGE", true 159 case URLType_LANDING_REFERRER: 160 return "LANDING_REFERRER", true 161 case URLType_CLIENT_REDIRECT: 162 return "CLIENT_REDIRECT", true 163 case URLType_RECENT_NAVIGATION: 164 return "RECENT_NAVIGATION", true 165 case URLType_REFERRER: 166 return "REFERRER", true 167 default: 168 return "", false 169 } 170 } 171 172 type ServerRedirect struct { 173 // Url is "ServerRedirect.url" 174 // 175 // Optional 176 Url js.String 177 178 FFI_USE bool 179 } 180 181 // FromRef calls UpdateFrom and returns a ServerRedirect with all fields set. 182 func (p ServerRedirect) FromRef(ref js.Ref) ServerRedirect { 183 p.UpdateFrom(ref) 184 return p 185 } 186 187 // New creates a new ServerRedirect in the application heap. 188 func (p ServerRedirect) New() js.Ref { 189 return bindings.ServerRedirectJSLoad( 190 js.Pointer(&p), js.True, 0, 191 ) 192 } 193 194 // UpdateFrom copies value of all fields of the heap object to p. 195 func (p *ServerRedirect) UpdateFrom(ref js.Ref) { 196 bindings.ServerRedirectJSStore( 197 js.Pointer(p), ref, 198 ) 199 } 200 201 // Update writes all fields of the p to the heap object referenced by ref. 202 func (p *ServerRedirect) Update(ref js.Ref) { 203 bindings.ServerRedirectJSLoad( 204 js.Pointer(p), js.False, ref, 205 ) 206 } 207 208 // FreeMembers frees fields with heap reference, if recursive is true 209 // free all heap references reachable from p. 210 func (p *ServerRedirect) FreeMembers(recursive bool) { 211 js.Free( 212 p.Url.Ref(), 213 ) 214 p.Url = p.Url.FromRef(js.Undefined) 215 } 216 217 type NavigationInitiation uint32 218 219 const ( 220 _ NavigationInitiation = iota 221 222 NavigationInitiation_BROWSER_INITIATED 223 NavigationInitiation_RENDERER_INITIATED_WITHOUT_USER_GESTURE 224 NavigationInitiation_RENDERER_INITIATED_WITH_USER_GESTURE 225 NavigationInitiation_COPY_PASTE_USER_INITIATED 226 NavigationInitiation_NOTIFICATION_INITIATED 227 ) 228 229 func (NavigationInitiation) FromRef(str js.Ref) NavigationInitiation { 230 return NavigationInitiation(bindings.ConstOfNavigationInitiation(str)) 231 } 232 233 func (x NavigationInitiation) String() (string, bool) { 234 switch x { 235 case NavigationInitiation_BROWSER_INITIATED: 236 return "BROWSER_INITIATED", true 237 case NavigationInitiation_RENDERER_INITIATED_WITHOUT_USER_GESTURE: 238 return "RENDERER_INITIATED_WITHOUT_USER_GESTURE", true 239 case NavigationInitiation_RENDERER_INITIATED_WITH_USER_GESTURE: 240 return "RENDERER_INITIATED_WITH_USER_GESTURE", true 241 case NavigationInitiation_COPY_PASTE_USER_INITIATED: 242 return "COPY_PASTE_USER_INITIATED", true 243 case NavigationInitiation_NOTIFICATION_INITIATED: 244 return "NOTIFICATION_INITIATED", true 245 default: 246 return "", false 247 } 248 } 249 250 type ReferrerChainEntry struct { 251 // Url is "ReferrerChainEntry.url" 252 // 253 // Optional 254 Url js.String 255 // MainFrameUrl is "ReferrerChainEntry.mainFrameUrl" 256 // 257 // Optional 258 MainFrameUrl js.String 259 // UrlType is "ReferrerChainEntry.urlType" 260 // 261 // Optional 262 UrlType URLType 263 // IpAddresses is "ReferrerChainEntry.ipAddresses" 264 // 265 // Optional 266 IpAddresses js.Array[js.String] 267 // ReferrerUrl is "ReferrerChainEntry.referrerUrl" 268 // 269 // Optional 270 ReferrerUrl js.String 271 // ReferrerMainFrameUrl is "ReferrerChainEntry.referrerMainFrameUrl" 272 // 273 // Optional 274 ReferrerMainFrameUrl js.String 275 // IsRetargeting is "ReferrerChainEntry.isRetargeting" 276 // 277 // Optional 278 // 279 // NOTE: FFI_USE_IsRetargeting MUST be set to true to make this field effective. 280 IsRetargeting bool 281 // NavigationTimeMs is "ReferrerChainEntry.navigationTimeMs" 282 // 283 // Optional 284 // 285 // NOTE: FFI_USE_NavigationTimeMs MUST be set to true to make this field effective. 286 NavigationTimeMs float64 287 // ServerRedirectChain is "ReferrerChainEntry.serverRedirectChain" 288 // 289 // Optional 290 ServerRedirectChain js.Array[ServerRedirect] 291 // NavigationInitiation is "ReferrerChainEntry.navigationInitiation" 292 // 293 // Optional 294 NavigationInitiation NavigationInitiation 295 // MaybeLaunchedByExternalApp is "ReferrerChainEntry.maybeLaunchedByExternalApp" 296 // 297 // Optional 298 // 299 // NOTE: FFI_USE_MaybeLaunchedByExternalApp MUST be set to true to make this field effective. 300 MaybeLaunchedByExternalApp bool 301 // IsSubframeUrlRemoved is "ReferrerChainEntry.isSubframeUrlRemoved" 302 // 303 // Optional 304 // 305 // NOTE: FFI_USE_IsSubframeUrlRemoved MUST be set to true to make this field effective. 306 IsSubframeUrlRemoved bool 307 // IsSubframeReferrerUrlRemoved is "ReferrerChainEntry.isSubframeReferrerUrlRemoved" 308 // 309 // Optional 310 // 311 // NOTE: FFI_USE_IsSubframeReferrerUrlRemoved MUST be set to true to make this field effective. 312 IsSubframeReferrerUrlRemoved bool 313 // IsUrlRemovedByPolicy is "ReferrerChainEntry.isUrlRemovedByPolicy" 314 // 315 // Optional 316 // 317 // NOTE: FFI_USE_IsUrlRemovedByPolicy MUST be set to true to make this field effective. 318 IsUrlRemovedByPolicy bool 319 320 FFI_USE_IsRetargeting bool // for IsRetargeting. 321 FFI_USE_NavigationTimeMs bool // for NavigationTimeMs. 322 FFI_USE_MaybeLaunchedByExternalApp bool // for MaybeLaunchedByExternalApp. 323 FFI_USE_IsSubframeUrlRemoved bool // for IsSubframeUrlRemoved. 324 FFI_USE_IsSubframeReferrerUrlRemoved bool // for IsSubframeReferrerUrlRemoved. 325 FFI_USE_IsUrlRemovedByPolicy bool // for IsUrlRemovedByPolicy. 326 327 FFI_USE bool 328 } 329 330 // FromRef calls UpdateFrom and returns a ReferrerChainEntry with all fields set. 331 func (p ReferrerChainEntry) FromRef(ref js.Ref) ReferrerChainEntry { 332 p.UpdateFrom(ref) 333 return p 334 } 335 336 // New creates a new ReferrerChainEntry in the application heap. 337 func (p ReferrerChainEntry) New() js.Ref { 338 return bindings.ReferrerChainEntryJSLoad( 339 js.Pointer(&p), js.True, 0, 340 ) 341 } 342 343 // UpdateFrom copies value of all fields of the heap object to p. 344 func (p *ReferrerChainEntry) UpdateFrom(ref js.Ref) { 345 bindings.ReferrerChainEntryJSStore( 346 js.Pointer(p), ref, 347 ) 348 } 349 350 // Update writes all fields of the p to the heap object referenced by ref. 351 func (p *ReferrerChainEntry) Update(ref js.Ref) { 352 bindings.ReferrerChainEntryJSLoad( 353 js.Pointer(p), js.False, ref, 354 ) 355 } 356 357 // FreeMembers frees fields with heap reference, if recursive is true 358 // free all heap references reachable from p. 359 func (p *ReferrerChainEntry) FreeMembers(recursive bool) { 360 js.Free( 361 p.Url.Ref(), 362 p.MainFrameUrl.Ref(), 363 p.IpAddresses.Ref(), 364 p.ReferrerUrl.Ref(), 365 p.ReferrerMainFrameUrl.Ref(), 366 p.ServerRedirectChain.Ref(), 367 ) 368 p.Url = p.Url.FromRef(js.Undefined) 369 p.MainFrameUrl = p.MainFrameUrl.FromRef(js.Undefined) 370 p.IpAddresses = p.IpAddresses.FromRef(js.Undefined) 371 p.ReferrerUrl = p.ReferrerUrl.FromRef(js.Undefined) 372 p.ReferrerMainFrameUrl = p.ReferrerMainFrameUrl.FromRef(js.Undefined) 373 p.ServerRedirectChain = p.ServerRedirectChain.FromRef(js.Undefined) 374 } 375 376 type InterstitialInfo struct { 377 // Url is "InterstitialInfo.url" 378 // 379 // Optional 380 Url js.String 381 // Reason is "InterstitialInfo.reason" 382 // 383 // Optional 384 Reason js.String 385 // NetErrorCode is "InterstitialInfo.netErrorCode" 386 // 387 // Optional 388 NetErrorCode js.String 389 // UserName is "InterstitialInfo.userName" 390 // 391 // Optional 392 UserName js.String 393 394 FFI_USE bool 395 } 396 397 // FromRef calls UpdateFrom and returns a InterstitialInfo with all fields set. 398 func (p InterstitialInfo) FromRef(ref js.Ref) InterstitialInfo { 399 p.UpdateFrom(ref) 400 return p 401 } 402 403 // New creates a new InterstitialInfo in the application heap. 404 func (p InterstitialInfo) New() js.Ref { 405 return bindings.InterstitialInfoJSLoad( 406 js.Pointer(&p), js.True, 0, 407 ) 408 } 409 410 // UpdateFrom copies value of all fields of the heap object to p. 411 func (p *InterstitialInfo) UpdateFrom(ref js.Ref) { 412 bindings.InterstitialInfoJSStore( 413 js.Pointer(p), ref, 414 ) 415 } 416 417 // Update writes all fields of the p to the heap object referenced by ref. 418 func (p *InterstitialInfo) Update(ref js.Ref) { 419 bindings.InterstitialInfoJSLoad( 420 js.Pointer(p), js.False, ref, 421 ) 422 } 423 424 // FreeMembers frees fields with heap reference, if recursive is true 425 // free all heap references reachable from p. 426 func (p *InterstitialInfo) FreeMembers(recursive bool) { 427 js.Free( 428 p.Url.Ref(), 429 p.Reason.Ref(), 430 p.NetErrorCode.Ref(), 431 p.UserName.Ref(), 432 ) 433 p.Url = p.Url.FromRef(js.Undefined) 434 p.Reason = p.Reason.FromRef(js.Undefined) 435 p.NetErrorCode = p.NetErrorCode.FromRef(js.Undefined) 436 p.UserName = p.UserName.FromRef(js.Undefined) 437 } 438 439 type PolicySpecifiedPasswordReuse struct { 440 // Url is "PolicySpecifiedPasswordReuse.url" 441 // 442 // Optional 443 Url js.String 444 // UserName is "PolicySpecifiedPasswordReuse.userName" 445 // 446 // Optional 447 UserName js.String 448 // IsPhishingUrl is "PolicySpecifiedPasswordReuse.isPhishingUrl" 449 // 450 // Optional 451 // 452 // NOTE: FFI_USE_IsPhishingUrl MUST be set to true to make this field effective. 453 IsPhishingUrl bool 454 455 FFI_USE_IsPhishingUrl bool // for IsPhishingUrl. 456 457 FFI_USE bool 458 } 459 460 // FromRef calls UpdateFrom and returns a PolicySpecifiedPasswordReuse with all fields set. 461 func (p PolicySpecifiedPasswordReuse) FromRef(ref js.Ref) PolicySpecifiedPasswordReuse { 462 p.UpdateFrom(ref) 463 return p 464 } 465 466 // New creates a new PolicySpecifiedPasswordReuse in the application heap. 467 func (p PolicySpecifiedPasswordReuse) New() js.Ref { 468 return bindings.PolicySpecifiedPasswordReuseJSLoad( 469 js.Pointer(&p), js.True, 0, 470 ) 471 } 472 473 // UpdateFrom copies value of all fields of the heap object to p. 474 func (p *PolicySpecifiedPasswordReuse) UpdateFrom(ref js.Ref) { 475 bindings.PolicySpecifiedPasswordReuseJSStore( 476 js.Pointer(p), ref, 477 ) 478 } 479 480 // Update writes all fields of the p to the heap object referenced by ref. 481 func (p *PolicySpecifiedPasswordReuse) Update(ref js.Ref) { 482 bindings.PolicySpecifiedPasswordReuseJSLoad( 483 js.Pointer(p), js.False, ref, 484 ) 485 } 486 487 // FreeMembers frees fields with heap reference, if recursive is true 488 // free all heap references reachable from p. 489 func (p *PolicySpecifiedPasswordReuse) FreeMembers(recursive bool) { 490 js.Free( 491 p.Url.Ref(), 492 p.UserName.Ref(), 493 ) 494 p.Url = p.Url.FromRef(js.Undefined) 495 p.UserName = p.UserName.FromRef(js.Undefined) 496 } 497 498 // HasFuncGetReferrerChain returns true if the function "WEBEXT.safeBrowsingPrivate.getReferrerChain" exists. 499 func HasFuncGetReferrerChain() bool { 500 return js.True == bindings.HasFuncGetReferrerChain() 501 } 502 503 // FuncGetReferrerChain returns the function "WEBEXT.safeBrowsingPrivate.getReferrerChain". 504 func FuncGetReferrerChain() (fn js.Func[func(tabId int32) js.Promise[js.Array[ReferrerChainEntry]]]) { 505 bindings.FuncGetReferrerChain( 506 js.Pointer(&fn), 507 ) 508 return 509 } 510 511 // GetReferrerChain calls the function "WEBEXT.safeBrowsingPrivate.getReferrerChain" directly. 512 func GetReferrerChain(tabId int32) (ret js.Promise[js.Array[ReferrerChainEntry]]) { 513 bindings.CallGetReferrerChain( 514 js.Pointer(&ret), 515 int32(tabId), 516 ) 517 518 return 519 } 520 521 // TryGetReferrerChain calls the function "WEBEXT.safeBrowsingPrivate.getReferrerChain" 522 // in a try/catch block and returns (_, err, ok = false) when it went through 523 // the catch clause. 524 func TryGetReferrerChain(tabId int32) (ret js.Promise[js.Array[ReferrerChainEntry]], exception js.Any, ok bool) { 525 ok = js.True == bindings.TryGetReferrerChain( 526 js.Pointer(&ret), js.Pointer(&exception), 527 int32(tabId), 528 ) 529 530 return 531 } 532 533 type OnDangerousDownloadOpenedEventCallbackFunc func(this js.Ref, dict *DangerousDownloadInfo) js.Ref 534 535 func (fn OnDangerousDownloadOpenedEventCallbackFunc) Register() js.Func[func(dict *DangerousDownloadInfo)] { 536 return js.RegisterCallback[func(dict *DangerousDownloadInfo)]( 537 fn, abi.FuncPCABIInternal(fn), 538 ) 539 } 540 541 func (fn OnDangerousDownloadOpenedEventCallbackFunc) DispatchCallback( 542 targetPC uintptr, ctx *js.CallbackContext, 543 ) { 544 args := ctx.Args() 545 if len(args) != 1+1 /* js this */ || 546 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 547 js.ThrowInvalidCallbackInvocation() 548 } 549 var arg0 DangerousDownloadInfo 550 arg0.UpdateFrom(args[0+1]) 551 defer arg0.FreeMembers(true) 552 553 if ctx.Return(fn( 554 args[0], 555 556 mark.NoEscape(&arg0), 557 )) { 558 return 559 } 560 561 js.ThrowCallbackValueNotReturned() 562 } 563 564 type OnDangerousDownloadOpenedEventCallback[T any] struct { 565 Fn func(arg T, this js.Ref, dict *DangerousDownloadInfo) js.Ref 566 Arg T 567 } 568 569 func (cb *OnDangerousDownloadOpenedEventCallback[T]) Register() js.Func[func(dict *DangerousDownloadInfo)] { 570 return js.RegisterCallback[func(dict *DangerousDownloadInfo)]( 571 cb, abi.FuncPCABIInternal(cb.Fn), 572 ) 573 } 574 575 func (cb *OnDangerousDownloadOpenedEventCallback[T]) DispatchCallback( 576 targetPC uintptr, ctx *js.CallbackContext, 577 ) { 578 args := ctx.Args() 579 if len(args) != 1+1 /* js this */ || 580 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 581 js.ThrowInvalidCallbackInvocation() 582 } 583 var arg0 DangerousDownloadInfo 584 arg0.UpdateFrom(args[0+1]) 585 defer arg0.FreeMembers(true) 586 587 if ctx.Return(cb.Fn( 588 cb.Arg, 589 args[0], 590 591 mark.NoEscape(&arg0), 592 )) { 593 return 594 } 595 596 js.ThrowCallbackValueNotReturned() 597 } 598 599 // HasFuncOnDangerousDownloadOpened returns true if the function "WEBEXT.safeBrowsingPrivate.onDangerousDownloadOpened.addListener" exists. 600 func HasFuncOnDangerousDownloadOpened() bool { 601 return js.True == bindings.HasFuncOnDangerousDownloadOpened() 602 } 603 604 // FuncOnDangerousDownloadOpened returns the function "WEBEXT.safeBrowsingPrivate.onDangerousDownloadOpened.addListener". 605 func FuncOnDangerousDownloadOpened() (fn js.Func[func(callback js.Func[func(dict *DangerousDownloadInfo)])]) { 606 bindings.FuncOnDangerousDownloadOpened( 607 js.Pointer(&fn), 608 ) 609 return 610 } 611 612 // OnDangerousDownloadOpened calls the function "WEBEXT.safeBrowsingPrivate.onDangerousDownloadOpened.addListener" directly. 613 func OnDangerousDownloadOpened(callback js.Func[func(dict *DangerousDownloadInfo)]) (ret js.Void) { 614 bindings.CallOnDangerousDownloadOpened( 615 js.Pointer(&ret), 616 callback.Ref(), 617 ) 618 619 return 620 } 621 622 // TryOnDangerousDownloadOpened calls the function "WEBEXT.safeBrowsingPrivate.onDangerousDownloadOpened.addListener" 623 // in a try/catch block and returns (_, err, ok = false) when it went through 624 // the catch clause. 625 func TryOnDangerousDownloadOpened(callback js.Func[func(dict *DangerousDownloadInfo)]) (ret js.Void, exception js.Any, ok bool) { 626 ok = js.True == bindings.TryOnDangerousDownloadOpened( 627 js.Pointer(&ret), js.Pointer(&exception), 628 callback.Ref(), 629 ) 630 631 return 632 } 633 634 // HasFuncOffDangerousDownloadOpened returns true if the function "WEBEXT.safeBrowsingPrivate.onDangerousDownloadOpened.removeListener" exists. 635 func HasFuncOffDangerousDownloadOpened() bool { 636 return js.True == bindings.HasFuncOffDangerousDownloadOpened() 637 } 638 639 // FuncOffDangerousDownloadOpened returns the function "WEBEXT.safeBrowsingPrivate.onDangerousDownloadOpened.removeListener". 640 func FuncOffDangerousDownloadOpened() (fn js.Func[func(callback js.Func[func(dict *DangerousDownloadInfo)])]) { 641 bindings.FuncOffDangerousDownloadOpened( 642 js.Pointer(&fn), 643 ) 644 return 645 } 646 647 // OffDangerousDownloadOpened calls the function "WEBEXT.safeBrowsingPrivate.onDangerousDownloadOpened.removeListener" directly. 648 func OffDangerousDownloadOpened(callback js.Func[func(dict *DangerousDownloadInfo)]) (ret js.Void) { 649 bindings.CallOffDangerousDownloadOpened( 650 js.Pointer(&ret), 651 callback.Ref(), 652 ) 653 654 return 655 } 656 657 // TryOffDangerousDownloadOpened calls the function "WEBEXT.safeBrowsingPrivate.onDangerousDownloadOpened.removeListener" 658 // in a try/catch block and returns (_, err, ok = false) when it went through 659 // the catch clause. 660 func TryOffDangerousDownloadOpened(callback js.Func[func(dict *DangerousDownloadInfo)]) (ret js.Void, exception js.Any, ok bool) { 661 ok = js.True == bindings.TryOffDangerousDownloadOpened( 662 js.Pointer(&ret), js.Pointer(&exception), 663 callback.Ref(), 664 ) 665 666 return 667 } 668 669 // HasFuncHasOnDangerousDownloadOpened returns true if the function "WEBEXT.safeBrowsingPrivate.onDangerousDownloadOpened.hasListener" exists. 670 func HasFuncHasOnDangerousDownloadOpened() bool { 671 return js.True == bindings.HasFuncHasOnDangerousDownloadOpened() 672 } 673 674 // FuncHasOnDangerousDownloadOpened returns the function "WEBEXT.safeBrowsingPrivate.onDangerousDownloadOpened.hasListener". 675 func FuncHasOnDangerousDownloadOpened() (fn js.Func[func(callback js.Func[func(dict *DangerousDownloadInfo)]) bool]) { 676 bindings.FuncHasOnDangerousDownloadOpened( 677 js.Pointer(&fn), 678 ) 679 return 680 } 681 682 // HasOnDangerousDownloadOpened calls the function "WEBEXT.safeBrowsingPrivate.onDangerousDownloadOpened.hasListener" directly. 683 func HasOnDangerousDownloadOpened(callback js.Func[func(dict *DangerousDownloadInfo)]) (ret bool) { 684 bindings.CallHasOnDangerousDownloadOpened( 685 js.Pointer(&ret), 686 callback.Ref(), 687 ) 688 689 return 690 } 691 692 // TryHasOnDangerousDownloadOpened calls the function "WEBEXT.safeBrowsingPrivate.onDangerousDownloadOpened.hasListener" 693 // in a try/catch block and returns (_, err, ok = false) when it went through 694 // the catch clause. 695 func TryHasOnDangerousDownloadOpened(callback js.Func[func(dict *DangerousDownloadInfo)]) (ret bool, exception js.Any, ok bool) { 696 ok = js.True == bindings.TryHasOnDangerousDownloadOpened( 697 js.Pointer(&ret), js.Pointer(&exception), 698 callback.Ref(), 699 ) 700 701 return 702 } 703 704 type OnPolicySpecifiedPasswordChangedEventCallbackFunc func(this js.Ref, userName js.String) js.Ref 705 706 func (fn OnPolicySpecifiedPasswordChangedEventCallbackFunc) Register() js.Func[func(userName js.String)] { 707 return js.RegisterCallback[func(userName js.String)]( 708 fn, abi.FuncPCABIInternal(fn), 709 ) 710 } 711 712 func (fn OnPolicySpecifiedPasswordChangedEventCallbackFunc) DispatchCallback( 713 targetPC uintptr, ctx *js.CallbackContext, 714 ) { 715 args := ctx.Args() 716 if len(args) != 1+1 /* js this */ || 717 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 718 js.ThrowInvalidCallbackInvocation() 719 } 720 721 if ctx.Return(fn( 722 args[0], 723 724 js.String{}.FromRef(args[0+1]), 725 )) { 726 return 727 } 728 729 js.ThrowCallbackValueNotReturned() 730 } 731 732 type OnPolicySpecifiedPasswordChangedEventCallback[T any] struct { 733 Fn func(arg T, this js.Ref, userName js.String) js.Ref 734 Arg T 735 } 736 737 func (cb *OnPolicySpecifiedPasswordChangedEventCallback[T]) Register() js.Func[func(userName js.String)] { 738 return js.RegisterCallback[func(userName js.String)]( 739 cb, abi.FuncPCABIInternal(cb.Fn), 740 ) 741 } 742 743 func (cb *OnPolicySpecifiedPasswordChangedEventCallback[T]) DispatchCallback( 744 targetPC uintptr, ctx *js.CallbackContext, 745 ) { 746 args := ctx.Args() 747 if len(args) != 1+1 /* js this */ || 748 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 749 js.ThrowInvalidCallbackInvocation() 750 } 751 752 if ctx.Return(cb.Fn( 753 cb.Arg, 754 args[0], 755 756 js.String{}.FromRef(args[0+1]), 757 )) { 758 return 759 } 760 761 js.ThrowCallbackValueNotReturned() 762 } 763 764 // HasFuncOnPolicySpecifiedPasswordChanged returns true if the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordChanged.addListener" exists. 765 func HasFuncOnPolicySpecifiedPasswordChanged() bool { 766 return js.True == bindings.HasFuncOnPolicySpecifiedPasswordChanged() 767 } 768 769 // FuncOnPolicySpecifiedPasswordChanged returns the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordChanged.addListener". 770 func FuncOnPolicySpecifiedPasswordChanged() (fn js.Func[func(callback js.Func[func(userName js.String)])]) { 771 bindings.FuncOnPolicySpecifiedPasswordChanged( 772 js.Pointer(&fn), 773 ) 774 return 775 } 776 777 // OnPolicySpecifiedPasswordChanged calls the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordChanged.addListener" directly. 778 func OnPolicySpecifiedPasswordChanged(callback js.Func[func(userName js.String)]) (ret js.Void) { 779 bindings.CallOnPolicySpecifiedPasswordChanged( 780 js.Pointer(&ret), 781 callback.Ref(), 782 ) 783 784 return 785 } 786 787 // TryOnPolicySpecifiedPasswordChanged calls the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordChanged.addListener" 788 // in a try/catch block and returns (_, err, ok = false) when it went through 789 // the catch clause. 790 func TryOnPolicySpecifiedPasswordChanged(callback js.Func[func(userName js.String)]) (ret js.Void, exception js.Any, ok bool) { 791 ok = js.True == bindings.TryOnPolicySpecifiedPasswordChanged( 792 js.Pointer(&ret), js.Pointer(&exception), 793 callback.Ref(), 794 ) 795 796 return 797 } 798 799 // HasFuncOffPolicySpecifiedPasswordChanged returns true if the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordChanged.removeListener" exists. 800 func HasFuncOffPolicySpecifiedPasswordChanged() bool { 801 return js.True == bindings.HasFuncOffPolicySpecifiedPasswordChanged() 802 } 803 804 // FuncOffPolicySpecifiedPasswordChanged returns the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordChanged.removeListener". 805 func FuncOffPolicySpecifiedPasswordChanged() (fn js.Func[func(callback js.Func[func(userName js.String)])]) { 806 bindings.FuncOffPolicySpecifiedPasswordChanged( 807 js.Pointer(&fn), 808 ) 809 return 810 } 811 812 // OffPolicySpecifiedPasswordChanged calls the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordChanged.removeListener" directly. 813 func OffPolicySpecifiedPasswordChanged(callback js.Func[func(userName js.String)]) (ret js.Void) { 814 bindings.CallOffPolicySpecifiedPasswordChanged( 815 js.Pointer(&ret), 816 callback.Ref(), 817 ) 818 819 return 820 } 821 822 // TryOffPolicySpecifiedPasswordChanged calls the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordChanged.removeListener" 823 // in a try/catch block and returns (_, err, ok = false) when it went through 824 // the catch clause. 825 func TryOffPolicySpecifiedPasswordChanged(callback js.Func[func(userName js.String)]) (ret js.Void, exception js.Any, ok bool) { 826 ok = js.True == bindings.TryOffPolicySpecifiedPasswordChanged( 827 js.Pointer(&ret), js.Pointer(&exception), 828 callback.Ref(), 829 ) 830 831 return 832 } 833 834 // HasFuncHasOnPolicySpecifiedPasswordChanged returns true if the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordChanged.hasListener" exists. 835 func HasFuncHasOnPolicySpecifiedPasswordChanged() bool { 836 return js.True == bindings.HasFuncHasOnPolicySpecifiedPasswordChanged() 837 } 838 839 // FuncHasOnPolicySpecifiedPasswordChanged returns the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordChanged.hasListener". 840 func FuncHasOnPolicySpecifiedPasswordChanged() (fn js.Func[func(callback js.Func[func(userName js.String)]) bool]) { 841 bindings.FuncHasOnPolicySpecifiedPasswordChanged( 842 js.Pointer(&fn), 843 ) 844 return 845 } 846 847 // HasOnPolicySpecifiedPasswordChanged calls the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordChanged.hasListener" directly. 848 func HasOnPolicySpecifiedPasswordChanged(callback js.Func[func(userName js.String)]) (ret bool) { 849 bindings.CallHasOnPolicySpecifiedPasswordChanged( 850 js.Pointer(&ret), 851 callback.Ref(), 852 ) 853 854 return 855 } 856 857 // TryHasOnPolicySpecifiedPasswordChanged calls the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordChanged.hasListener" 858 // in a try/catch block and returns (_, err, ok = false) when it went through 859 // the catch clause. 860 func TryHasOnPolicySpecifiedPasswordChanged(callback js.Func[func(userName js.String)]) (ret bool, exception js.Any, ok bool) { 861 ok = js.True == bindings.TryHasOnPolicySpecifiedPasswordChanged( 862 js.Pointer(&ret), js.Pointer(&exception), 863 callback.Ref(), 864 ) 865 866 return 867 } 868 869 type OnPolicySpecifiedPasswordReuseDetectedEventCallbackFunc func(this js.Ref, reuseDetails *PolicySpecifiedPasswordReuse) js.Ref 870 871 func (fn OnPolicySpecifiedPasswordReuseDetectedEventCallbackFunc) Register() js.Func[func(reuseDetails *PolicySpecifiedPasswordReuse)] { 872 return js.RegisterCallback[func(reuseDetails *PolicySpecifiedPasswordReuse)]( 873 fn, abi.FuncPCABIInternal(fn), 874 ) 875 } 876 877 func (fn OnPolicySpecifiedPasswordReuseDetectedEventCallbackFunc) DispatchCallback( 878 targetPC uintptr, ctx *js.CallbackContext, 879 ) { 880 args := ctx.Args() 881 if len(args) != 1+1 /* js this */ || 882 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 883 js.ThrowInvalidCallbackInvocation() 884 } 885 var arg0 PolicySpecifiedPasswordReuse 886 arg0.UpdateFrom(args[0+1]) 887 defer arg0.FreeMembers(true) 888 889 if ctx.Return(fn( 890 args[0], 891 892 mark.NoEscape(&arg0), 893 )) { 894 return 895 } 896 897 js.ThrowCallbackValueNotReturned() 898 } 899 900 type OnPolicySpecifiedPasswordReuseDetectedEventCallback[T any] struct { 901 Fn func(arg T, this js.Ref, reuseDetails *PolicySpecifiedPasswordReuse) js.Ref 902 Arg T 903 } 904 905 func (cb *OnPolicySpecifiedPasswordReuseDetectedEventCallback[T]) Register() js.Func[func(reuseDetails *PolicySpecifiedPasswordReuse)] { 906 return js.RegisterCallback[func(reuseDetails *PolicySpecifiedPasswordReuse)]( 907 cb, abi.FuncPCABIInternal(cb.Fn), 908 ) 909 } 910 911 func (cb *OnPolicySpecifiedPasswordReuseDetectedEventCallback[T]) DispatchCallback( 912 targetPC uintptr, ctx *js.CallbackContext, 913 ) { 914 args := ctx.Args() 915 if len(args) != 1+1 /* js this */ || 916 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 917 js.ThrowInvalidCallbackInvocation() 918 } 919 var arg0 PolicySpecifiedPasswordReuse 920 arg0.UpdateFrom(args[0+1]) 921 defer arg0.FreeMembers(true) 922 923 if ctx.Return(cb.Fn( 924 cb.Arg, 925 args[0], 926 927 mark.NoEscape(&arg0), 928 )) { 929 return 930 } 931 932 js.ThrowCallbackValueNotReturned() 933 } 934 935 // HasFuncOnPolicySpecifiedPasswordReuseDetected returns true if the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordReuseDetected.addListener" exists. 936 func HasFuncOnPolicySpecifiedPasswordReuseDetected() bool { 937 return js.True == bindings.HasFuncOnPolicySpecifiedPasswordReuseDetected() 938 } 939 940 // FuncOnPolicySpecifiedPasswordReuseDetected returns the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordReuseDetected.addListener". 941 func FuncOnPolicySpecifiedPasswordReuseDetected() (fn js.Func[func(callback js.Func[func(reuseDetails *PolicySpecifiedPasswordReuse)])]) { 942 bindings.FuncOnPolicySpecifiedPasswordReuseDetected( 943 js.Pointer(&fn), 944 ) 945 return 946 } 947 948 // OnPolicySpecifiedPasswordReuseDetected calls the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordReuseDetected.addListener" directly. 949 func OnPolicySpecifiedPasswordReuseDetected(callback js.Func[func(reuseDetails *PolicySpecifiedPasswordReuse)]) (ret js.Void) { 950 bindings.CallOnPolicySpecifiedPasswordReuseDetected( 951 js.Pointer(&ret), 952 callback.Ref(), 953 ) 954 955 return 956 } 957 958 // TryOnPolicySpecifiedPasswordReuseDetected calls the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordReuseDetected.addListener" 959 // in a try/catch block and returns (_, err, ok = false) when it went through 960 // the catch clause. 961 func TryOnPolicySpecifiedPasswordReuseDetected(callback js.Func[func(reuseDetails *PolicySpecifiedPasswordReuse)]) (ret js.Void, exception js.Any, ok bool) { 962 ok = js.True == bindings.TryOnPolicySpecifiedPasswordReuseDetected( 963 js.Pointer(&ret), js.Pointer(&exception), 964 callback.Ref(), 965 ) 966 967 return 968 } 969 970 // HasFuncOffPolicySpecifiedPasswordReuseDetected returns true if the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordReuseDetected.removeListener" exists. 971 func HasFuncOffPolicySpecifiedPasswordReuseDetected() bool { 972 return js.True == bindings.HasFuncOffPolicySpecifiedPasswordReuseDetected() 973 } 974 975 // FuncOffPolicySpecifiedPasswordReuseDetected returns the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordReuseDetected.removeListener". 976 func FuncOffPolicySpecifiedPasswordReuseDetected() (fn js.Func[func(callback js.Func[func(reuseDetails *PolicySpecifiedPasswordReuse)])]) { 977 bindings.FuncOffPolicySpecifiedPasswordReuseDetected( 978 js.Pointer(&fn), 979 ) 980 return 981 } 982 983 // OffPolicySpecifiedPasswordReuseDetected calls the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordReuseDetected.removeListener" directly. 984 func OffPolicySpecifiedPasswordReuseDetected(callback js.Func[func(reuseDetails *PolicySpecifiedPasswordReuse)]) (ret js.Void) { 985 bindings.CallOffPolicySpecifiedPasswordReuseDetected( 986 js.Pointer(&ret), 987 callback.Ref(), 988 ) 989 990 return 991 } 992 993 // TryOffPolicySpecifiedPasswordReuseDetected calls the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordReuseDetected.removeListener" 994 // in a try/catch block and returns (_, err, ok = false) when it went through 995 // the catch clause. 996 func TryOffPolicySpecifiedPasswordReuseDetected(callback js.Func[func(reuseDetails *PolicySpecifiedPasswordReuse)]) (ret js.Void, exception js.Any, ok bool) { 997 ok = js.True == bindings.TryOffPolicySpecifiedPasswordReuseDetected( 998 js.Pointer(&ret), js.Pointer(&exception), 999 callback.Ref(), 1000 ) 1001 1002 return 1003 } 1004 1005 // HasFuncHasOnPolicySpecifiedPasswordReuseDetected returns true if the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordReuseDetected.hasListener" exists. 1006 func HasFuncHasOnPolicySpecifiedPasswordReuseDetected() bool { 1007 return js.True == bindings.HasFuncHasOnPolicySpecifiedPasswordReuseDetected() 1008 } 1009 1010 // FuncHasOnPolicySpecifiedPasswordReuseDetected returns the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordReuseDetected.hasListener". 1011 func FuncHasOnPolicySpecifiedPasswordReuseDetected() (fn js.Func[func(callback js.Func[func(reuseDetails *PolicySpecifiedPasswordReuse)]) bool]) { 1012 bindings.FuncHasOnPolicySpecifiedPasswordReuseDetected( 1013 js.Pointer(&fn), 1014 ) 1015 return 1016 } 1017 1018 // HasOnPolicySpecifiedPasswordReuseDetected calls the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordReuseDetected.hasListener" directly. 1019 func HasOnPolicySpecifiedPasswordReuseDetected(callback js.Func[func(reuseDetails *PolicySpecifiedPasswordReuse)]) (ret bool) { 1020 bindings.CallHasOnPolicySpecifiedPasswordReuseDetected( 1021 js.Pointer(&ret), 1022 callback.Ref(), 1023 ) 1024 1025 return 1026 } 1027 1028 // TryHasOnPolicySpecifiedPasswordReuseDetected calls the function "WEBEXT.safeBrowsingPrivate.onPolicySpecifiedPasswordReuseDetected.hasListener" 1029 // in a try/catch block and returns (_, err, ok = false) when it went through 1030 // the catch clause. 1031 func TryHasOnPolicySpecifiedPasswordReuseDetected(callback js.Func[func(reuseDetails *PolicySpecifiedPasswordReuse)]) (ret bool, exception js.Any, ok bool) { 1032 ok = js.True == bindings.TryHasOnPolicySpecifiedPasswordReuseDetected( 1033 js.Pointer(&ret), js.Pointer(&exception), 1034 callback.Ref(), 1035 ) 1036 1037 return 1038 } 1039 1040 type OnSecurityInterstitialProceededEventCallbackFunc func(this js.Ref, dict *InterstitialInfo) js.Ref 1041 1042 func (fn OnSecurityInterstitialProceededEventCallbackFunc) Register() js.Func[func(dict *InterstitialInfo)] { 1043 return js.RegisterCallback[func(dict *InterstitialInfo)]( 1044 fn, abi.FuncPCABIInternal(fn), 1045 ) 1046 } 1047 1048 func (fn OnSecurityInterstitialProceededEventCallbackFunc) DispatchCallback( 1049 targetPC uintptr, ctx *js.CallbackContext, 1050 ) { 1051 args := ctx.Args() 1052 if len(args) != 1+1 /* js this */ || 1053 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 1054 js.ThrowInvalidCallbackInvocation() 1055 } 1056 var arg0 InterstitialInfo 1057 arg0.UpdateFrom(args[0+1]) 1058 defer arg0.FreeMembers(true) 1059 1060 if ctx.Return(fn( 1061 args[0], 1062 1063 mark.NoEscape(&arg0), 1064 )) { 1065 return 1066 } 1067 1068 js.ThrowCallbackValueNotReturned() 1069 } 1070 1071 type OnSecurityInterstitialProceededEventCallback[T any] struct { 1072 Fn func(arg T, this js.Ref, dict *InterstitialInfo) js.Ref 1073 Arg T 1074 } 1075 1076 func (cb *OnSecurityInterstitialProceededEventCallback[T]) Register() js.Func[func(dict *InterstitialInfo)] { 1077 return js.RegisterCallback[func(dict *InterstitialInfo)]( 1078 cb, abi.FuncPCABIInternal(cb.Fn), 1079 ) 1080 } 1081 1082 func (cb *OnSecurityInterstitialProceededEventCallback[T]) DispatchCallback( 1083 targetPC uintptr, ctx *js.CallbackContext, 1084 ) { 1085 args := ctx.Args() 1086 if len(args) != 1+1 /* js this */ || 1087 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 1088 js.ThrowInvalidCallbackInvocation() 1089 } 1090 var arg0 InterstitialInfo 1091 arg0.UpdateFrom(args[0+1]) 1092 defer arg0.FreeMembers(true) 1093 1094 if ctx.Return(cb.Fn( 1095 cb.Arg, 1096 args[0], 1097 1098 mark.NoEscape(&arg0), 1099 )) { 1100 return 1101 } 1102 1103 js.ThrowCallbackValueNotReturned() 1104 } 1105 1106 // HasFuncOnSecurityInterstitialProceeded returns true if the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialProceeded.addListener" exists. 1107 func HasFuncOnSecurityInterstitialProceeded() bool { 1108 return js.True == bindings.HasFuncOnSecurityInterstitialProceeded() 1109 } 1110 1111 // FuncOnSecurityInterstitialProceeded returns the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialProceeded.addListener". 1112 func FuncOnSecurityInterstitialProceeded() (fn js.Func[func(callback js.Func[func(dict *InterstitialInfo)])]) { 1113 bindings.FuncOnSecurityInterstitialProceeded( 1114 js.Pointer(&fn), 1115 ) 1116 return 1117 } 1118 1119 // OnSecurityInterstitialProceeded calls the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialProceeded.addListener" directly. 1120 func OnSecurityInterstitialProceeded(callback js.Func[func(dict *InterstitialInfo)]) (ret js.Void) { 1121 bindings.CallOnSecurityInterstitialProceeded( 1122 js.Pointer(&ret), 1123 callback.Ref(), 1124 ) 1125 1126 return 1127 } 1128 1129 // TryOnSecurityInterstitialProceeded calls the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialProceeded.addListener" 1130 // in a try/catch block and returns (_, err, ok = false) when it went through 1131 // the catch clause. 1132 func TryOnSecurityInterstitialProceeded(callback js.Func[func(dict *InterstitialInfo)]) (ret js.Void, exception js.Any, ok bool) { 1133 ok = js.True == bindings.TryOnSecurityInterstitialProceeded( 1134 js.Pointer(&ret), js.Pointer(&exception), 1135 callback.Ref(), 1136 ) 1137 1138 return 1139 } 1140 1141 // HasFuncOffSecurityInterstitialProceeded returns true if the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialProceeded.removeListener" exists. 1142 func HasFuncOffSecurityInterstitialProceeded() bool { 1143 return js.True == bindings.HasFuncOffSecurityInterstitialProceeded() 1144 } 1145 1146 // FuncOffSecurityInterstitialProceeded returns the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialProceeded.removeListener". 1147 func FuncOffSecurityInterstitialProceeded() (fn js.Func[func(callback js.Func[func(dict *InterstitialInfo)])]) { 1148 bindings.FuncOffSecurityInterstitialProceeded( 1149 js.Pointer(&fn), 1150 ) 1151 return 1152 } 1153 1154 // OffSecurityInterstitialProceeded calls the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialProceeded.removeListener" directly. 1155 func OffSecurityInterstitialProceeded(callback js.Func[func(dict *InterstitialInfo)]) (ret js.Void) { 1156 bindings.CallOffSecurityInterstitialProceeded( 1157 js.Pointer(&ret), 1158 callback.Ref(), 1159 ) 1160 1161 return 1162 } 1163 1164 // TryOffSecurityInterstitialProceeded calls the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialProceeded.removeListener" 1165 // in a try/catch block and returns (_, err, ok = false) when it went through 1166 // the catch clause. 1167 func TryOffSecurityInterstitialProceeded(callback js.Func[func(dict *InterstitialInfo)]) (ret js.Void, exception js.Any, ok bool) { 1168 ok = js.True == bindings.TryOffSecurityInterstitialProceeded( 1169 js.Pointer(&ret), js.Pointer(&exception), 1170 callback.Ref(), 1171 ) 1172 1173 return 1174 } 1175 1176 // HasFuncHasOnSecurityInterstitialProceeded returns true if the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialProceeded.hasListener" exists. 1177 func HasFuncHasOnSecurityInterstitialProceeded() bool { 1178 return js.True == bindings.HasFuncHasOnSecurityInterstitialProceeded() 1179 } 1180 1181 // FuncHasOnSecurityInterstitialProceeded returns the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialProceeded.hasListener". 1182 func FuncHasOnSecurityInterstitialProceeded() (fn js.Func[func(callback js.Func[func(dict *InterstitialInfo)]) bool]) { 1183 bindings.FuncHasOnSecurityInterstitialProceeded( 1184 js.Pointer(&fn), 1185 ) 1186 return 1187 } 1188 1189 // HasOnSecurityInterstitialProceeded calls the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialProceeded.hasListener" directly. 1190 func HasOnSecurityInterstitialProceeded(callback js.Func[func(dict *InterstitialInfo)]) (ret bool) { 1191 bindings.CallHasOnSecurityInterstitialProceeded( 1192 js.Pointer(&ret), 1193 callback.Ref(), 1194 ) 1195 1196 return 1197 } 1198 1199 // TryHasOnSecurityInterstitialProceeded calls the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialProceeded.hasListener" 1200 // in a try/catch block and returns (_, err, ok = false) when it went through 1201 // the catch clause. 1202 func TryHasOnSecurityInterstitialProceeded(callback js.Func[func(dict *InterstitialInfo)]) (ret bool, exception js.Any, ok bool) { 1203 ok = js.True == bindings.TryHasOnSecurityInterstitialProceeded( 1204 js.Pointer(&ret), js.Pointer(&exception), 1205 callback.Ref(), 1206 ) 1207 1208 return 1209 } 1210 1211 type OnSecurityInterstitialShownEventCallbackFunc func(this js.Ref, dict *InterstitialInfo) js.Ref 1212 1213 func (fn OnSecurityInterstitialShownEventCallbackFunc) Register() js.Func[func(dict *InterstitialInfo)] { 1214 return js.RegisterCallback[func(dict *InterstitialInfo)]( 1215 fn, abi.FuncPCABIInternal(fn), 1216 ) 1217 } 1218 1219 func (fn OnSecurityInterstitialShownEventCallbackFunc) DispatchCallback( 1220 targetPC uintptr, ctx *js.CallbackContext, 1221 ) { 1222 args := ctx.Args() 1223 if len(args) != 1+1 /* js this */ || 1224 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 1225 js.ThrowInvalidCallbackInvocation() 1226 } 1227 var arg0 InterstitialInfo 1228 arg0.UpdateFrom(args[0+1]) 1229 defer arg0.FreeMembers(true) 1230 1231 if ctx.Return(fn( 1232 args[0], 1233 1234 mark.NoEscape(&arg0), 1235 )) { 1236 return 1237 } 1238 1239 js.ThrowCallbackValueNotReturned() 1240 } 1241 1242 type OnSecurityInterstitialShownEventCallback[T any] struct { 1243 Fn func(arg T, this js.Ref, dict *InterstitialInfo) js.Ref 1244 Arg T 1245 } 1246 1247 func (cb *OnSecurityInterstitialShownEventCallback[T]) Register() js.Func[func(dict *InterstitialInfo)] { 1248 return js.RegisterCallback[func(dict *InterstitialInfo)]( 1249 cb, abi.FuncPCABIInternal(cb.Fn), 1250 ) 1251 } 1252 1253 func (cb *OnSecurityInterstitialShownEventCallback[T]) DispatchCallback( 1254 targetPC uintptr, ctx *js.CallbackContext, 1255 ) { 1256 args := ctx.Args() 1257 if len(args) != 1+1 /* js this */ || 1258 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 1259 js.ThrowInvalidCallbackInvocation() 1260 } 1261 var arg0 InterstitialInfo 1262 arg0.UpdateFrom(args[0+1]) 1263 defer arg0.FreeMembers(true) 1264 1265 if ctx.Return(cb.Fn( 1266 cb.Arg, 1267 args[0], 1268 1269 mark.NoEscape(&arg0), 1270 )) { 1271 return 1272 } 1273 1274 js.ThrowCallbackValueNotReturned() 1275 } 1276 1277 // HasFuncOnSecurityInterstitialShown returns true if the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialShown.addListener" exists. 1278 func HasFuncOnSecurityInterstitialShown() bool { 1279 return js.True == bindings.HasFuncOnSecurityInterstitialShown() 1280 } 1281 1282 // FuncOnSecurityInterstitialShown returns the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialShown.addListener". 1283 func FuncOnSecurityInterstitialShown() (fn js.Func[func(callback js.Func[func(dict *InterstitialInfo)])]) { 1284 bindings.FuncOnSecurityInterstitialShown( 1285 js.Pointer(&fn), 1286 ) 1287 return 1288 } 1289 1290 // OnSecurityInterstitialShown calls the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialShown.addListener" directly. 1291 func OnSecurityInterstitialShown(callback js.Func[func(dict *InterstitialInfo)]) (ret js.Void) { 1292 bindings.CallOnSecurityInterstitialShown( 1293 js.Pointer(&ret), 1294 callback.Ref(), 1295 ) 1296 1297 return 1298 } 1299 1300 // TryOnSecurityInterstitialShown calls the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialShown.addListener" 1301 // in a try/catch block and returns (_, err, ok = false) when it went through 1302 // the catch clause. 1303 func TryOnSecurityInterstitialShown(callback js.Func[func(dict *InterstitialInfo)]) (ret js.Void, exception js.Any, ok bool) { 1304 ok = js.True == bindings.TryOnSecurityInterstitialShown( 1305 js.Pointer(&ret), js.Pointer(&exception), 1306 callback.Ref(), 1307 ) 1308 1309 return 1310 } 1311 1312 // HasFuncOffSecurityInterstitialShown returns true if the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialShown.removeListener" exists. 1313 func HasFuncOffSecurityInterstitialShown() bool { 1314 return js.True == bindings.HasFuncOffSecurityInterstitialShown() 1315 } 1316 1317 // FuncOffSecurityInterstitialShown returns the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialShown.removeListener". 1318 func FuncOffSecurityInterstitialShown() (fn js.Func[func(callback js.Func[func(dict *InterstitialInfo)])]) { 1319 bindings.FuncOffSecurityInterstitialShown( 1320 js.Pointer(&fn), 1321 ) 1322 return 1323 } 1324 1325 // OffSecurityInterstitialShown calls the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialShown.removeListener" directly. 1326 func OffSecurityInterstitialShown(callback js.Func[func(dict *InterstitialInfo)]) (ret js.Void) { 1327 bindings.CallOffSecurityInterstitialShown( 1328 js.Pointer(&ret), 1329 callback.Ref(), 1330 ) 1331 1332 return 1333 } 1334 1335 // TryOffSecurityInterstitialShown calls the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialShown.removeListener" 1336 // in a try/catch block and returns (_, err, ok = false) when it went through 1337 // the catch clause. 1338 func TryOffSecurityInterstitialShown(callback js.Func[func(dict *InterstitialInfo)]) (ret js.Void, exception js.Any, ok bool) { 1339 ok = js.True == bindings.TryOffSecurityInterstitialShown( 1340 js.Pointer(&ret), js.Pointer(&exception), 1341 callback.Ref(), 1342 ) 1343 1344 return 1345 } 1346 1347 // HasFuncHasOnSecurityInterstitialShown returns true if the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialShown.hasListener" exists. 1348 func HasFuncHasOnSecurityInterstitialShown() bool { 1349 return js.True == bindings.HasFuncHasOnSecurityInterstitialShown() 1350 } 1351 1352 // FuncHasOnSecurityInterstitialShown returns the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialShown.hasListener". 1353 func FuncHasOnSecurityInterstitialShown() (fn js.Func[func(callback js.Func[func(dict *InterstitialInfo)]) bool]) { 1354 bindings.FuncHasOnSecurityInterstitialShown( 1355 js.Pointer(&fn), 1356 ) 1357 return 1358 } 1359 1360 // HasOnSecurityInterstitialShown calls the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialShown.hasListener" directly. 1361 func HasOnSecurityInterstitialShown(callback js.Func[func(dict *InterstitialInfo)]) (ret bool) { 1362 bindings.CallHasOnSecurityInterstitialShown( 1363 js.Pointer(&ret), 1364 callback.Ref(), 1365 ) 1366 1367 return 1368 } 1369 1370 // TryHasOnSecurityInterstitialShown calls the function "WEBEXT.safeBrowsingPrivate.onSecurityInterstitialShown.hasListener" 1371 // in a try/catch block and returns (_, err, ok = false) when it went through 1372 // the catch clause. 1373 func TryHasOnSecurityInterstitialShown(callback js.Func[func(dict *InterstitialInfo)]) (ret bool, exception js.Any, ok bool) { 1374 ok = js.True == bindings.TryHasOnSecurityInterstitialShown( 1375 js.Pointer(&ret), js.Pointer(&exception), 1376 callback.Ref(), 1377 ) 1378 1379 return 1380 }