github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/declarativenetrequest/apis_js_wasm.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 4 package declarativenetrequest 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/declarativenetrequest/bindings" 11 "github.com/primecitizens/pcz/std/plat/js/webext/extensiontypes" 12 ) 13 14 type Ruleset struct { 15 // Id is "Ruleset.id" 16 // 17 // Optional 18 Id js.String 19 // Path is "Ruleset.path" 20 // 21 // Optional 22 Path js.String 23 // Enabled is "Ruleset.enabled" 24 // 25 // Optional 26 // 27 // NOTE: FFI_USE_Enabled MUST be set to true to make this field effective. 28 Enabled bool 29 30 FFI_USE_Enabled bool // for Enabled. 31 32 FFI_USE bool 33 } 34 35 // FromRef calls UpdateFrom and returns a Ruleset with all fields set. 36 func (p Ruleset) FromRef(ref js.Ref) Ruleset { 37 p.UpdateFrom(ref) 38 return p 39 } 40 41 // New creates a new Ruleset in the application heap. 42 func (p Ruleset) New() js.Ref { 43 return bindings.RulesetJSLoad( 44 js.Pointer(&p), js.True, 0, 45 ) 46 } 47 48 // UpdateFrom copies value of all fields of the heap object to p. 49 func (p *Ruleset) UpdateFrom(ref js.Ref) { 50 bindings.RulesetJSStore( 51 js.Pointer(p), ref, 52 ) 53 } 54 55 // Update writes all fields of the p to the heap object referenced by ref. 56 func (p *Ruleset) Update(ref js.Ref) { 57 bindings.RulesetJSLoad( 58 js.Pointer(p), js.False, ref, 59 ) 60 } 61 62 // FreeMembers frees fields with heap reference, if recursive is true 63 // free all heap references reachable from p. 64 func (p *Ruleset) FreeMembers(recursive bool) { 65 js.Free( 66 p.Id.Ref(), 67 p.Path.Ref(), 68 ) 69 p.Id = p.Id.FromRef(js.Undefined) 70 p.Path = p.Path.FromRef(js.Undefined) 71 } 72 73 type DNRInfo struct { 74 // RuleResources is "DNRInfo.rule_resources" 75 // 76 // Optional 77 RuleResources js.Array[Ruleset] 78 79 FFI_USE bool 80 } 81 82 // FromRef calls UpdateFrom and returns a DNRInfo with all fields set. 83 func (p DNRInfo) FromRef(ref js.Ref) DNRInfo { 84 p.UpdateFrom(ref) 85 return p 86 } 87 88 // New creates a new DNRInfo in the application heap. 89 func (p DNRInfo) New() js.Ref { 90 return bindings.DNRInfoJSLoad( 91 js.Pointer(&p), js.True, 0, 92 ) 93 } 94 95 // UpdateFrom copies value of all fields of the heap object to p. 96 func (p *DNRInfo) UpdateFrom(ref js.Ref) { 97 bindings.DNRInfoJSStore( 98 js.Pointer(p), ref, 99 ) 100 } 101 102 // Update writes all fields of the p to the heap object referenced by ref. 103 func (p *DNRInfo) Update(ref js.Ref) { 104 bindings.DNRInfoJSLoad( 105 js.Pointer(p), js.False, ref, 106 ) 107 } 108 109 // FreeMembers frees fields with heap reference, if recursive is true 110 // free all heap references reachable from p. 111 func (p *DNRInfo) FreeMembers(recursive bool) { 112 js.Free( 113 p.RuleResources.Ref(), 114 ) 115 p.RuleResources = p.RuleResources.FromRef(js.Undefined) 116 } 117 118 type DomainType uint32 119 120 const ( 121 _ DomainType = iota 122 123 DomainType_FIRST_PARTY 124 DomainType_THIRD_PARTY 125 ) 126 127 func (DomainType) FromRef(str js.Ref) DomainType { 128 return DomainType(bindings.ConstOfDomainType(str)) 129 } 130 131 func (x DomainType) String() (string, bool) { 132 switch x { 133 case DomainType_FIRST_PARTY: 134 return "firstParty", true 135 case DomainType_THIRD_PARTY: 136 return "thirdParty", true 137 default: 138 return "", false 139 } 140 } 141 142 type EmptyCallbackFunc func(this js.Ref) js.Ref 143 144 func (fn EmptyCallbackFunc) Register() js.Func[func()] { 145 return js.RegisterCallback[func()]( 146 fn, abi.FuncPCABIInternal(fn), 147 ) 148 } 149 150 func (fn EmptyCallbackFunc) DispatchCallback( 151 targetPC uintptr, ctx *js.CallbackContext, 152 ) { 153 args := ctx.Args() 154 if len(args) != 0+1 /* js this */ || 155 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 156 js.ThrowInvalidCallbackInvocation() 157 } 158 159 if ctx.Return(fn( 160 args[0], 161 )) { 162 return 163 } 164 165 js.ThrowCallbackValueNotReturned() 166 } 167 168 type EmptyCallback[T any] struct { 169 Fn func(arg T, this js.Ref) js.Ref 170 Arg T 171 } 172 173 func (cb *EmptyCallback[T]) Register() js.Func[func()] { 174 return js.RegisterCallback[func()]( 175 cb, abi.FuncPCABIInternal(cb.Fn), 176 ) 177 } 178 179 func (cb *EmptyCallback[T]) DispatchCallback( 180 targetPC uintptr, ctx *js.CallbackContext, 181 ) { 182 args := ctx.Args() 183 if len(args) != 0+1 /* js this */ || 184 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 185 js.ThrowInvalidCallbackInvocation() 186 } 187 188 if ctx.Return(cb.Fn( 189 cb.Arg, 190 args[0], 191 )) { 192 return 193 } 194 195 js.ThrowCallbackValueNotReturned() 196 } 197 198 type TabActionCountUpdate struct { 199 // TabId is "TabActionCountUpdate.tabId" 200 // 201 // Optional 202 // 203 // NOTE: FFI_USE_TabId MUST be set to true to make this field effective. 204 TabId int32 205 // Increment is "TabActionCountUpdate.increment" 206 // 207 // Optional 208 // 209 // NOTE: FFI_USE_Increment MUST be set to true to make this field effective. 210 Increment int32 211 212 FFI_USE_TabId bool // for TabId. 213 FFI_USE_Increment bool // for Increment. 214 215 FFI_USE bool 216 } 217 218 // FromRef calls UpdateFrom and returns a TabActionCountUpdate with all fields set. 219 func (p TabActionCountUpdate) FromRef(ref js.Ref) TabActionCountUpdate { 220 p.UpdateFrom(ref) 221 return p 222 } 223 224 // New creates a new TabActionCountUpdate in the application heap. 225 func (p TabActionCountUpdate) New() js.Ref { 226 return bindings.TabActionCountUpdateJSLoad( 227 js.Pointer(&p), js.True, 0, 228 ) 229 } 230 231 // UpdateFrom copies value of all fields of the heap object to p. 232 func (p *TabActionCountUpdate) UpdateFrom(ref js.Ref) { 233 bindings.TabActionCountUpdateJSStore( 234 js.Pointer(p), ref, 235 ) 236 } 237 238 // Update writes all fields of the p to the heap object referenced by ref. 239 func (p *TabActionCountUpdate) Update(ref js.Ref) { 240 bindings.TabActionCountUpdateJSLoad( 241 js.Pointer(p), js.False, ref, 242 ) 243 } 244 245 // FreeMembers frees fields with heap reference, if recursive is true 246 // free all heap references reachable from p. 247 func (p *TabActionCountUpdate) FreeMembers(recursive bool) { 248 } 249 250 type ExtensionActionOptions struct { 251 // DisplayActionCountAsBadgeText is "ExtensionActionOptions.displayActionCountAsBadgeText" 252 // 253 // Optional 254 // 255 // NOTE: FFI_USE_DisplayActionCountAsBadgeText MUST be set to true to make this field effective. 256 DisplayActionCountAsBadgeText bool 257 // TabUpdate is "ExtensionActionOptions.tabUpdate" 258 // 259 // Optional 260 // 261 // NOTE: TabUpdate.FFI_USE MUST be set to true to get TabUpdate used. 262 TabUpdate TabActionCountUpdate 263 264 FFI_USE_DisplayActionCountAsBadgeText bool // for DisplayActionCountAsBadgeText. 265 266 FFI_USE bool 267 } 268 269 // FromRef calls UpdateFrom and returns a ExtensionActionOptions with all fields set. 270 func (p ExtensionActionOptions) FromRef(ref js.Ref) ExtensionActionOptions { 271 p.UpdateFrom(ref) 272 return p 273 } 274 275 // New creates a new ExtensionActionOptions in the application heap. 276 func (p ExtensionActionOptions) New() js.Ref { 277 return bindings.ExtensionActionOptionsJSLoad( 278 js.Pointer(&p), js.True, 0, 279 ) 280 } 281 282 // UpdateFrom copies value of all fields of the heap object to p. 283 func (p *ExtensionActionOptions) UpdateFrom(ref js.Ref) { 284 bindings.ExtensionActionOptionsJSStore( 285 js.Pointer(p), ref, 286 ) 287 } 288 289 // Update writes all fields of the p to the heap object referenced by ref. 290 func (p *ExtensionActionOptions) Update(ref js.Ref) { 291 bindings.ExtensionActionOptionsJSLoad( 292 js.Pointer(p), js.False, ref, 293 ) 294 } 295 296 // FreeMembers frees fields with heap reference, if recursive is true 297 // free all heap references reachable from p. 298 func (p *ExtensionActionOptions) FreeMembers(recursive bool) { 299 if recursive { 300 p.TabUpdate.FreeMembers(true) 301 } 302 } 303 304 type GetAllowedPagesCallbackFunc func(this js.Ref, result js.Array[js.String]) js.Ref 305 306 func (fn GetAllowedPagesCallbackFunc) Register() js.Func[func(result js.Array[js.String])] { 307 return js.RegisterCallback[func(result js.Array[js.String])]( 308 fn, abi.FuncPCABIInternal(fn), 309 ) 310 } 311 312 func (fn GetAllowedPagesCallbackFunc) DispatchCallback( 313 targetPC uintptr, ctx *js.CallbackContext, 314 ) { 315 args := ctx.Args() 316 if len(args) != 1+1 /* js this */ || 317 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 318 js.ThrowInvalidCallbackInvocation() 319 } 320 321 if ctx.Return(fn( 322 args[0], 323 324 js.Array[js.String]{}.FromRef(args[0+1]), 325 )) { 326 return 327 } 328 329 js.ThrowCallbackValueNotReturned() 330 } 331 332 type GetAllowedPagesCallback[T any] struct { 333 Fn func(arg T, this js.Ref, result js.Array[js.String]) js.Ref 334 Arg T 335 } 336 337 func (cb *GetAllowedPagesCallback[T]) Register() js.Func[func(result js.Array[js.String])] { 338 return js.RegisterCallback[func(result js.Array[js.String])]( 339 cb, abi.FuncPCABIInternal(cb.Fn), 340 ) 341 } 342 343 func (cb *GetAllowedPagesCallback[T]) DispatchCallback( 344 targetPC uintptr, ctx *js.CallbackContext, 345 ) { 346 args := ctx.Args() 347 if len(args) != 1+1 /* js this */ || 348 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 349 js.ThrowInvalidCallbackInvocation() 350 } 351 352 if ctx.Return(cb.Fn( 353 cb.Arg, 354 args[0], 355 356 js.Array[js.String]{}.FromRef(args[0+1]), 357 )) { 358 return 359 } 360 361 js.ThrowCallbackValueNotReturned() 362 } 363 364 type GetAvailableStaticRuleCountCallbackFunc func(this js.Ref, count int32) js.Ref 365 366 func (fn GetAvailableStaticRuleCountCallbackFunc) Register() js.Func[func(count int32)] { 367 return js.RegisterCallback[func(count int32)]( 368 fn, abi.FuncPCABIInternal(fn), 369 ) 370 } 371 372 func (fn GetAvailableStaticRuleCountCallbackFunc) DispatchCallback( 373 targetPC uintptr, ctx *js.CallbackContext, 374 ) { 375 args := ctx.Args() 376 if len(args) != 1+1 /* js this */ || 377 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 378 js.ThrowInvalidCallbackInvocation() 379 } 380 381 if ctx.Return(fn( 382 args[0], 383 384 js.Number[int32]{}.FromRef(args[0+1]).Get(), 385 )) { 386 return 387 } 388 389 js.ThrowCallbackValueNotReturned() 390 } 391 392 type GetAvailableStaticRuleCountCallback[T any] struct { 393 Fn func(arg T, this js.Ref, count int32) js.Ref 394 Arg T 395 } 396 397 func (cb *GetAvailableStaticRuleCountCallback[T]) Register() js.Func[func(count int32)] { 398 return js.RegisterCallback[func(count int32)]( 399 cb, abi.FuncPCABIInternal(cb.Fn), 400 ) 401 } 402 403 func (cb *GetAvailableStaticRuleCountCallback[T]) DispatchCallback( 404 targetPC uintptr, ctx *js.CallbackContext, 405 ) { 406 args := ctx.Args() 407 if len(args) != 1+1 /* js this */ || 408 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 409 js.ThrowInvalidCallbackInvocation() 410 } 411 412 if ctx.Return(cb.Fn( 413 cb.Arg, 414 args[0], 415 416 js.Number[int32]{}.FromRef(args[0+1]).Get(), 417 )) { 418 return 419 } 420 421 js.ThrowCallbackValueNotReturned() 422 } 423 424 type GetDisabledRuleIdsCallbackFunc func(this js.Ref, disabledRuleIds js.Array[int32]) js.Ref 425 426 func (fn GetDisabledRuleIdsCallbackFunc) Register() js.Func[func(disabledRuleIds js.Array[int32])] { 427 return js.RegisterCallback[func(disabledRuleIds js.Array[int32])]( 428 fn, abi.FuncPCABIInternal(fn), 429 ) 430 } 431 432 func (fn GetDisabledRuleIdsCallbackFunc) DispatchCallback( 433 targetPC uintptr, ctx *js.CallbackContext, 434 ) { 435 args := ctx.Args() 436 if len(args) != 1+1 /* js this */ || 437 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 438 js.ThrowInvalidCallbackInvocation() 439 } 440 441 if ctx.Return(fn( 442 args[0], 443 444 js.Array[int32]{}.FromRef(args[0+1]), 445 )) { 446 return 447 } 448 449 js.ThrowCallbackValueNotReturned() 450 } 451 452 type GetDisabledRuleIdsCallback[T any] struct { 453 Fn func(arg T, this js.Ref, disabledRuleIds js.Array[int32]) js.Ref 454 Arg T 455 } 456 457 func (cb *GetDisabledRuleIdsCallback[T]) Register() js.Func[func(disabledRuleIds js.Array[int32])] { 458 return js.RegisterCallback[func(disabledRuleIds js.Array[int32])]( 459 cb, abi.FuncPCABIInternal(cb.Fn), 460 ) 461 } 462 463 func (cb *GetDisabledRuleIdsCallback[T]) DispatchCallback( 464 targetPC uintptr, ctx *js.CallbackContext, 465 ) { 466 args := ctx.Args() 467 if len(args) != 1+1 /* js this */ || 468 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 469 js.ThrowInvalidCallbackInvocation() 470 } 471 472 if ctx.Return(cb.Fn( 473 cb.Arg, 474 args[0], 475 476 js.Array[int32]{}.FromRef(args[0+1]), 477 )) { 478 return 479 } 480 481 js.ThrowCallbackValueNotReturned() 482 } 483 484 type GetDisabledRuleIdsOptions struct { 485 // RulesetId is "GetDisabledRuleIdsOptions.rulesetId" 486 // 487 // Optional 488 RulesetId js.String 489 490 FFI_USE bool 491 } 492 493 // FromRef calls UpdateFrom and returns a GetDisabledRuleIdsOptions with all fields set. 494 func (p GetDisabledRuleIdsOptions) FromRef(ref js.Ref) GetDisabledRuleIdsOptions { 495 p.UpdateFrom(ref) 496 return p 497 } 498 499 // New creates a new GetDisabledRuleIdsOptions in the application heap. 500 func (p GetDisabledRuleIdsOptions) New() js.Ref { 501 return bindings.GetDisabledRuleIdsOptionsJSLoad( 502 js.Pointer(&p), js.True, 0, 503 ) 504 } 505 506 // UpdateFrom copies value of all fields of the heap object to p. 507 func (p *GetDisabledRuleIdsOptions) UpdateFrom(ref js.Ref) { 508 bindings.GetDisabledRuleIdsOptionsJSStore( 509 js.Pointer(p), ref, 510 ) 511 } 512 513 // Update writes all fields of the p to the heap object referenced by ref. 514 func (p *GetDisabledRuleIdsOptions) Update(ref js.Ref) { 515 bindings.GetDisabledRuleIdsOptionsJSLoad( 516 js.Pointer(p), js.False, ref, 517 ) 518 } 519 520 // FreeMembers frees fields with heap reference, if recursive is true 521 // free all heap references reachable from p. 522 func (p *GetDisabledRuleIdsOptions) FreeMembers(recursive bool) { 523 js.Free( 524 p.RulesetId.Ref(), 525 ) 526 p.RulesetId = p.RulesetId.FromRef(js.Undefined) 527 } 528 529 type GetEnabledRulesetsCallbackFunc func(this js.Ref, rulesetIds js.Array[js.String]) js.Ref 530 531 func (fn GetEnabledRulesetsCallbackFunc) Register() js.Func[func(rulesetIds js.Array[js.String])] { 532 return js.RegisterCallback[func(rulesetIds js.Array[js.String])]( 533 fn, abi.FuncPCABIInternal(fn), 534 ) 535 } 536 537 func (fn GetEnabledRulesetsCallbackFunc) DispatchCallback( 538 targetPC uintptr, ctx *js.CallbackContext, 539 ) { 540 args := ctx.Args() 541 if len(args) != 1+1 /* js this */ || 542 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 543 js.ThrowInvalidCallbackInvocation() 544 } 545 546 if ctx.Return(fn( 547 args[0], 548 549 js.Array[js.String]{}.FromRef(args[0+1]), 550 )) { 551 return 552 } 553 554 js.ThrowCallbackValueNotReturned() 555 } 556 557 type GetEnabledRulesetsCallback[T any] struct { 558 Fn func(arg T, this js.Ref, rulesetIds js.Array[js.String]) js.Ref 559 Arg T 560 } 561 562 func (cb *GetEnabledRulesetsCallback[T]) Register() js.Func[func(rulesetIds js.Array[js.String])] { 563 return js.RegisterCallback[func(rulesetIds js.Array[js.String])]( 564 cb, abi.FuncPCABIInternal(cb.Fn), 565 ) 566 } 567 568 func (cb *GetEnabledRulesetsCallback[T]) DispatchCallback( 569 targetPC uintptr, ctx *js.CallbackContext, 570 ) { 571 args := ctx.Args() 572 if len(args) != 1+1 /* js this */ || 573 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 574 js.ThrowInvalidCallbackInvocation() 575 } 576 577 if ctx.Return(cb.Fn( 578 cb.Arg, 579 args[0], 580 581 js.Array[js.String]{}.FromRef(args[0+1]), 582 )) { 583 return 584 } 585 586 js.ThrowCallbackValueNotReturned() 587 } 588 589 type GetMatchedRulesCallbackFunc func(this js.Ref, details *RulesMatchedDetails) js.Ref 590 591 func (fn GetMatchedRulesCallbackFunc) Register() js.Func[func(details *RulesMatchedDetails)] { 592 return js.RegisterCallback[func(details *RulesMatchedDetails)]( 593 fn, abi.FuncPCABIInternal(fn), 594 ) 595 } 596 597 func (fn GetMatchedRulesCallbackFunc) DispatchCallback( 598 targetPC uintptr, ctx *js.CallbackContext, 599 ) { 600 args := ctx.Args() 601 if len(args) != 1+1 /* js this */ || 602 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 603 js.ThrowInvalidCallbackInvocation() 604 } 605 var arg0 RulesMatchedDetails 606 arg0.UpdateFrom(args[0+1]) 607 defer arg0.FreeMembers(true) 608 609 if ctx.Return(fn( 610 args[0], 611 612 mark.NoEscape(&arg0), 613 )) { 614 return 615 } 616 617 js.ThrowCallbackValueNotReturned() 618 } 619 620 type GetMatchedRulesCallback[T any] struct { 621 Fn func(arg T, this js.Ref, details *RulesMatchedDetails) js.Ref 622 Arg T 623 } 624 625 func (cb *GetMatchedRulesCallback[T]) Register() js.Func[func(details *RulesMatchedDetails)] { 626 return js.RegisterCallback[func(details *RulesMatchedDetails)]( 627 cb, abi.FuncPCABIInternal(cb.Fn), 628 ) 629 } 630 631 func (cb *GetMatchedRulesCallback[T]) DispatchCallback( 632 targetPC uintptr, ctx *js.CallbackContext, 633 ) { 634 args := ctx.Args() 635 if len(args) != 1+1 /* js this */ || 636 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 637 js.ThrowInvalidCallbackInvocation() 638 } 639 var arg0 RulesMatchedDetails 640 arg0.UpdateFrom(args[0+1]) 641 defer arg0.FreeMembers(true) 642 643 if ctx.Return(cb.Fn( 644 cb.Arg, 645 args[0], 646 647 mark.NoEscape(&arg0), 648 )) { 649 return 650 } 651 652 js.ThrowCallbackValueNotReturned() 653 } 654 655 type MatchedRule struct { 656 // RuleId is "MatchedRule.ruleId" 657 // 658 // Optional 659 // 660 // NOTE: FFI_USE_RuleId MUST be set to true to make this field effective. 661 RuleId int32 662 // RulesetId is "MatchedRule.rulesetId" 663 // 664 // Optional 665 RulesetId js.String 666 667 FFI_USE_RuleId bool // for RuleId. 668 669 FFI_USE bool 670 } 671 672 // FromRef calls UpdateFrom and returns a MatchedRule with all fields set. 673 func (p MatchedRule) FromRef(ref js.Ref) MatchedRule { 674 p.UpdateFrom(ref) 675 return p 676 } 677 678 // New creates a new MatchedRule in the application heap. 679 func (p MatchedRule) New() js.Ref { 680 return bindings.MatchedRuleJSLoad( 681 js.Pointer(&p), js.True, 0, 682 ) 683 } 684 685 // UpdateFrom copies value of all fields of the heap object to p. 686 func (p *MatchedRule) UpdateFrom(ref js.Ref) { 687 bindings.MatchedRuleJSStore( 688 js.Pointer(p), ref, 689 ) 690 } 691 692 // Update writes all fields of the p to the heap object referenced by ref. 693 func (p *MatchedRule) Update(ref js.Ref) { 694 bindings.MatchedRuleJSLoad( 695 js.Pointer(p), js.False, ref, 696 ) 697 } 698 699 // FreeMembers frees fields with heap reference, if recursive is true 700 // free all heap references reachable from p. 701 func (p *MatchedRule) FreeMembers(recursive bool) { 702 js.Free( 703 p.RulesetId.Ref(), 704 ) 705 p.RulesetId = p.RulesetId.FromRef(js.Undefined) 706 } 707 708 type MatchedRuleInfo struct { 709 // Rule is "MatchedRuleInfo.rule" 710 // 711 // Optional 712 // 713 // NOTE: Rule.FFI_USE MUST be set to true to get Rule used. 714 Rule MatchedRule 715 // TimeStamp is "MatchedRuleInfo.timeStamp" 716 // 717 // Optional 718 // 719 // NOTE: FFI_USE_TimeStamp MUST be set to true to make this field effective. 720 TimeStamp float64 721 // TabId is "MatchedRuleInfo.tabId" 722 // 723 // Optional 724 // 725 // NOTE: FFI_USE_TabId MUST be set to true to make this field effective. 726 TabId int32 727 728 FFI_USE_TimeStamp bool // for TimeStamp. 729 FFI_USE_TabId bool // for TabId. 730 731 FFI_USE bool 732 } 733 734 // FromRef calls UpdateFrom and returns a MatchedRuleInfo with all fields set. 735 func (p MatchedRuleInfo) FromRef(ref js.Ref) MatchedRuleInfo { 736 p.UpdateFrom(ref) 737 return p 738 } 739 740 // New creates a new MatchedRuleInfo in the application heap. 741 func (p MatchedRuleInfo) New() js.Ref { 742 return bindings.MatchedRuleInfoJSLoad( 743 js.Pointer(&p), js.True, 0, 744 ) 745 } 746 747 // UpdateFrom copies value of all fields of the heap object to p. 748 func (p *MatchedRuleInfo) UpdateFrom(ref js.Ref) { 749 bindings.MatchedRuleInfoJSStore( 750 js.Pointer(p), ref, 751 ) 752 } 753 754 // Update writes all fields of the p to the heap object referenced by ref. 755 func (p *MatchedRuleInfo) Update(ref js.Ref) { 756 bindings.MatchedRuleInfoJSLoad( 757 js.Pointer(p), js.False, ref, 758 ) 759 } 760 761 // FreeMembers frees fields with heap reference, if recursive is true 762 // free all heap references reachable from p. 763 func (p *MatchedRuleInfo) FreeMembers(recursive bool) { 764 if recursive { 765 p.Rule.FreeMembers(true) 766 } 767 } 768 769 type RulesMatchedDetails struct { 770 // RulesMatchedInfo is "RulesMatchedDetails.rulesMatchedInfo" 771 // 772 // Optional 773 RulesMatchedInfo js.Array[MatchedRuleInfo] 774 775 FFI_USE bool 776 } 777 778 // FromRef calls UpdateFrom and returns a RulesMatchedDetails with all fields set. 779 func (p RulesMatchedDetails) FromRef(ref js.Ref) RulesMatchedDetails { 780 p.UpdateFrom(ref) 781 return p 782 } 783 784 // New creates a new RulesMatchedDetails in the application heap. 785 func (p RulesMatchedDetails) New() js.Ref { 786 return bindings.RulesMatchedDetailsJSLoad( 787 js.Pointer(&p), js.True, 0, 788 ) 789 } 790 791 // UpdateFrom copies value of all fields of the heap object to p. 792 func (p *RulesMatchedDetails) UpdateFrom(ref js.Ref) { 793 bindings.RulesMatchedDetailsJSStore( 794 js.Pointer(p), ref, 795 ) 796 } 797 798 // Update writes all fields of the p to the heap object referenced by ref. 799 func (p *RulesMatchedDetails) Update(ref js.Ref) { 800 bindings.RulesMatchedDetailsJSLoad( 801 js.Pointer(p), js.False, ref, 802 ) 803 } 804 805 // FreeMembers frees fields with heap reference, if recursive is true 806 // free all heap references reachable from p. 807 func (p *RulesMatchedDetails) FreeMembers(recursive bool) { 808 js.Free( 809 p.RulesMatchedInfo.Ref(), 810 ) 811 p.RulesMatchedInfo = p.RulesMatchedInfo.FromRef(js.Undefined) 812 } 813 814 type GetRulesCallbackFunc func(this js.Ref, rules js.Array[Rule]) js.Ref 815 816 func (fn GetRulesCallbackFunc) Register() js.Func[func(rules js.Array[Rule])] { 817 return js.RegisterCallback[func(rules js.Array[Rule])]( 818 fn, abi.FuncPCABIInternal(fn), 819 ) 820 } 821 822 func (fn GetRulesCallbackFunc) DispatchCallback( 823 targetPC uintptr, ctx *js.CallbackContext, 824 ) { 825 args := ctx.Args() 826 if len(args) != 1+1 /* js this */ || 827 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 828 js.ThrowInvalidCallbackInvocation() 829 } 830 831 if ctx.Return(fn( 832 args[0], 833 834 js.Array[Rule]{}.FromRef(args[0+1]), 835 )) { 836 return 837 } 838 839 js.ThrowCallbackValueNotReturned() 840 } 841 842 type GetRulesCallback[T any] struct { 843 Fn func(arg T, this js.Ref, rules js.Array[Rule]) js.Ref 844 Arg T 845 } 846 847 func (cb *GetRulesCallback[T]) Register() js.Func[func(rules js.Array[Rule])] { 848 return js.RegisterCallback[func(rules js.Array[Rule])]( 849 cb, abi.FuncPCABIInternal(cb.Fn), 850 ) 851 } 852 853 func (cb *GetRulesCallback[T]) DispatchCallback( 854 targetPC uintptr, ctx *js.CallbackContext, 855 ) { 856 args := ctx.Args() 857 if len(args) != 1+1 /* js this */ || 858 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 859 js.ThrowInvalidCallbackInvocation() 860 } 861 862 if ctx.Return(cb.Fn( 863 cb.Arg, 864 args[0], 865 866 js.Array[Rule]{}.FromRef(args[0+1]), 867 )) { 868 return 869 } 870 871 js.ThrowCallbackValueNotReturned() 872 } 873 874 type ResourceType uint32 875 876 const ( 877 _ ResourceType = iota 878 879 ResourceType_MAIN_FRAME 880 ResourceType_SUB_FRAME 881 ResourceType_STYLESHEET 882 ResourceType_SCRIPT 883 ResourceType_IMAGE 884 ResourceType_FONT 885 ResourceType_OBJECT 886 ResourceType_XMLHTTPREQUEST 887 ResourceType_PING 888 ResourceType_CSP_REPORT 889 ResourceType_MEDIA 890 ResourceType_WEBSOCKET 891 ResourceType_WEBTRANSPORT 892 ResourceType_WEBBUNDLE 893 ResourceType_OTHER 894 ) 895 896 func (ResourceType) FromRef(str js.Ref) ResourceType { 897 return ResourceType(bindings.ConstOfResourceType(str)) 898 } 899 900 func (x ResourceType) String() (string, bool) { 901 switch x { 902 case ResourceType_MAIN_FRAME: 903 return "main_frame", true 904 case ResourceType_SUB_FRAME: 905 return "sub_frame", true 906 case ResourceType_STYLESHEET: 907 return "stylesheet", true 908 case ResourceType_SCRIPT: 909 return "script", true 910 case ResourceType_IMAGE: 911 return "image", true 912 case ResourceType_FONT: 913 return "font", true 914 case ResourceType_OBJECT: 915 return "object", true 916 case ResourceType_XMLHTTPREQUEST: 917 return "xmlhttprequest", true 918 case ResourceType_PING: 919 return "ping", true 920 case ResourceType_CSP_REPORT: 921 return "csp_report", true 922 case ResourceType_MEDIA: 923 return "media", true 924 case ResourceType_WEBSOCKET: 925 return "websocket", true 926 case ResourceType_WEBTRANSPORT: 927 return "webtransport", true 928 case ResourceType_WEBBUNDLE: 929 return "webbundle", true 930 case ResourceType_OTHER: 931 return "other", true 932 default: 933 return "", false 934 } 935 } 936 937 type RequestMethod uint32 938 939 const ( 940 _ RequestMethod = iota 941 942 RequestMethod_CONNECT 943 RequestMethod_DELETE 944 RequestMethod_GET 945 RequestMethod_HEAD 946 RequestMethod_OPTIONS 947 RequestMethod_PATCH 948 RequestMethod_POST 949 RequestMethod_PUT 950 RequestMethod_OTHER 951 ) 952 953 func (RequestMethod) FromRef(str js.Ref) RequestMethod { 954 return RequestMethod(bindings.ConstOfRequestMethod(str)) 955 } 956 957 func (x RequestMethod) String() (string, bool) { 958 switch x { 959 case RequestMethod_CONNECT: 960 return "connect", true 961 case RequestMethod_DELETE: 962 return "delete", true 963 case RequestMethod_GET: 964 return "get", true 965 case RequestMethod_HEAD: 966 return "head", true 967 case RequestMethod_OPTIONS: 968 return "options", true 969 case RequestMethod_PATCH: 970 return "patch", true 971 case RequestMethod_POST: 972 return "post", true 973 case RequestMethod_PUT: 974 return "put", true 975 case RequestMethod_OTHER: 976 return "other", true 977 default: 978 return "", false 979 } 980 } 981 982 type RuleCondition struct { 983 // UrlFilter is "RuleCondition.urlFilter" 984 // 985 // Optional 986 UrlFilter js.String 987 // RegexFilter is "RuleCondition.regexFilter" 988 // 989 // Optional 990 RegexFilter js.String 991 // IsUrlFilterCaseSensitive is "RuleCondition.isUrlFilterCaseSensitive" 992 // 993 // Optional 994 // 995 // NOTE: FFI_USE_IsUrlFilterCaseSensitive MUST be set to true to make this field effective. 996 IsUrlFilterCaseSensitive bool 997 // InitiatorDomains is "RuleCondition.initiatorDomains" 998 // 999 // Optional 1000 InitiatorDomains js.Array[js.String] 1001 // ExcludedInitiatorDomains is "RuleCondition.excludedInitiatorDomains" 1002 // 1003 // Optional 1004 ExcludedInitiatorDomains js.Array[js.String] 1005 // RequestDomains is "RuleCondition.requestDomains" 1006 // 1007 // Optional 1008 RequestDomains js.Array[js.String] 1009 // ExcludedRequestDomains is "RuleCondition.excludedRequestDomains" 1010 // 1011 // Optional 1012 ExcludedRequestDomains js.Array[js.String] 1013 // Domains is "RuleCondition.domains" 1014 // 1015 // Optional 1016 Domains js.Array[js.String] 1017 // ExcludedDomains is "RuleCondition.excludedDomains" 1018 // 1019 // Optional 1020 ExcludedDomains js.Array[js.String] 1021 // ResourceTypes is "RuleCondition.resourceTypes" 1022 // 1023 // Optional 1024 ResourceTypes js.Array[ResourceType] 1025 // ExcludedResourceTypes is "RuleCondition.excludedResourceTypes" 1026 // 1027 // Optional 1028 ExcludedResourceTypes js.Array[ResourceType] 1029 // RequestMethods is "RuleCondition.requestMethods" 1030 // 1031 // Optional 1032 RequestMethods js.Array[RequestMethod] 1033 // ExcludedRequestMethods is "RuleCondition.excludedRequestMethods" 1034 // 1035 // Optional 1036 ExcludedRequestMethods js.Array[RequestMethod] 1037 // DomainType is "RuleCondition.domainType" 1038 // 1039 // Optional 1040 DomainType DomainType 1041 // TabIds is "RuleCondition.tabIds" 1042 // 1043 // Optional 1044 TabIds js.Array[int32] 1045 // ExcludedTabIds is "RuleCondition.excludedTabIds" 1046 // 1047 // Optional 1048 ExcludedTabIds js.Array[int32] 1049 1050 FFI_USE_IsUrlFilterCaseSensitive bool // for IsUrlFilterCaseSensitive. 1051 1052 FFI_USE bool 1053 } 1054 1055 // FromRef calls UpdateFrom and returns a RuleCondition with all fields set. 1056 func (p RuleCondition) FromRef(ref js.Ref) RuleCondition { 1057 p.UpdateFrom(ref) 1058 return p 1059 } 1060 1061 // New creates a new RuleCondition in the application heap. 1062 func (p RuleCondition) New() js.Ref { 1063 return bindings.RuleConditionJSLoad( 1064 js.Pointer(&p), js.True, 0, 1065 ) 1066 } 1067 1068 // UpdateFrom copies value of all fields of the heap object to p. 1069 func (p *RuleCondition) UpdateFrom(ref js.Ref) { 1070 bindings.RuleConditionJSStore( 1071 js.Pointer(p), ref, 1072 ) 1073 } 1074 1075 // Update writes all fields of the p to the heap object referenced by ref. 1076 func (p *RuleCondition) Update(ref js.Ref) { 1077 bindings.RuleConditionJSLoad( 1078 js.Pointer(p), js.False, ref, 1079 ) 1080 } 1081 1082 // FreeMembers frees fields with heap reference, if recursive is true 1083 // free all heap references reachable from p. 1084 func (p *RuleCondition) FreeMembers(recursive bool) { 1085 js.Free( 1086 p.UrlFilter.Ref(), 1087 p.RegexFilter.Ref(), 1088 p.InitiatorDomains.Ref(), 1089 p.ExcludedInitiatorDomains.Ref(), 1090 p.RequestDomains.Ref(), 1091 p.ExcludedRequestDomains.Ref(), 1092 p.Domains.Ref(), 1093 p.ExcludedDomains.Ref(), 1094 p.ResourceTypes.Ref(), 1095 p.ExcludedResourceTypes.Ref(), 1096 p.RequestMethods.Ref(), 1097 p.ExcludedRequestMethods.Ref(), 1098 p.TabIds.Ref(), 1099 p.ExcludedTabIds.Ref(), 1100 ) 1101 p.UrlFilter = p.UrlFilter.FromRef(js.Undefined) 1102 p.RegexFilter = p.RegexFilter.FromRef(js.Undefined) 1103 p.InitiatorDomains = p.InitiatorDomains.FromRef(js.Undefined) 1104 p.ExcludedInitiatorDomains = p.ExcludedInitiatorDomains.FromRef(js.Undefined) 1105 p.RequestDomains = p.RequestDomains.FromRef(js.Undefined) 1106 p.ExcludedRequestDomains = p.ExcludedRequestDomains.FromRef(js.Undefined) 1107 p.Domains = p.Domains.FromRef(js.Undefined) 1108 p.ExcludedDomains = p.ExcludedDomains.FromRef(js.Undefined) 1109 p.ResourceTypes = p.ResourceTypes.FromRef(js.Undefined) 1110 p.ExcludedResourceTypes = p.ExcludedResourceTypes.FromRef(js.Undefined) 1111 p.RequestMethods = p.RequestMethods.FromRef(js.Undefined) 1112 p.ExcludedRequestMethods = p.ExcludedRequestMethods.FromRef(js.Undefined) 1113 p.TabIds = p.TabIds.FromRef(js.Undefined) 1114 p.ExcludedTabIds = p.ExcludedTabIds.FromRef(js.Undefined) 1115 } 1116 1117 type RuleActionType uint32 1118 1119 const ( 1120 _ RuleActionType = iota 1121 1122 RuleActionType_BLOCK 1123 RuleActionType_REDIRECT 1124 RuleActionType_ALLOW 1125 RuleActionType_UPGRADE_SCHEME 1126 RuleActionType_MODIFY_HEADERS 1127 RuleActionType_ALLOW_ALL_REQUESTS 1128 ) 1129 1130 func (RuleActionType) FromRef(str js.Ref) RuleActionType { 1131 return RuleActionType(bindings.ConstOfRuleActionType(str)) 1132 } 1133 1134 func (x RuleActionType) String() (string, bool) { 1135 switch x { 1136 case RuleActionType_BLOCK: 1137 return "block", true 1138 case RuleActionType_REDIRECT: 1139 return "redirect", true 1140 case RuleActionType_ALLOW: 1141 return "allow", true 1142 case RuleActionType_UPGRADE_SCHEME: 1143 return "upgradeScheme", true 1144 case RuleActionType_MODIFY_HEADERS: 1145 return "modifyHeaders", true 1146 case RuleActionType_ALLOW_ALL_REQUESTS: 1147 return "allowAllRequests", true 1148 default: 1149 return "", false 1150 } 1151 } 1152 1153 type QueryKeyValue struct { 1154 // Key is "QueryKeyValue.key" 1155 // 1156 // Optional 1157 Key js.String 1158 // Value is "QueryKeyValue.value" 1159 // 1160 // Optional 1161 Value js.String 1162 // ReplaceOnly is "QueryKeyValue.replaceOnly" 1163 // 1164 // Optional 1165 // 1166 // NOTE: FFI_USE_ReplaceOnly MUST be set to true to make this field effective. 1167 ReplaceOnly bool 1168 1169 FFI_USE_ReplaceOnly bool // for ReplaceOnly. 1170 1171 FFI_USE bool 1172 } 1173 1174 // FromRef calls UpdateFrom and returns a QueryKeyValue with all fields set. 1175 func (p QueryKeyValue) FromRef(ref js.Ref) QueryKeyValue { 1176 p.UpdateFrom(ref) 1177 return p 1178 } 1179 1180 // New creates a new QueryKeyValue in the application heap. 1181 func (p QueryKeyValue) New() js.Ref { 1182 return bindings.QueryKeyValueJSLoad( 1183 js.Pointer(&p), js.True, 0, 1184 ) 1185 } 1186 1187 // UpdateFrom copies value of all fields of the heap object to p. 1188 func (p *QueryKeyValue) UpdateFrom(ref js.Ref) { 1189 bindings.QueryKeyValueJSStore( 1190 js.Pointer(p), ref, 1191 ) 1192 } 1193 1194 // Update writes all fields of the p to the heap object referenced by ref. 1195 func (p *QueryKeyValue) Update(ref js.Ref) { 1196 bindings.QueryKeyValueJSLoad( 1197 js.Pointer(p), js.False, ref, 1198 ) 1199 } 1200 1201 // FreeMembers frees fields with heap reference, if recursive is true 1202 // free all heap references reachable from p. 1203 func (p *QueryKeyValue) FreeMembers(recursive bool) { 1204 js.Free( 1205 p.Key.Ref(), 1206 p.Value.Ref(), 1207 ) 1208 p.Key = p.Key.FromRef(js.Undefined) 1209 p.Value = p.Value.FromRef(js.Undefined) 1210 } 1211 1212 type QueryTransform struct { 1213 // RemoveParams is "QueryTransform.removeParams" 1214 // 1215 // Optional 1216 RemoveParams js.Array[js.String] 1217 // AddOrReplaceParams is "QueryTransform.addOrReplaceParams" 1218 // 1219 // Optional 1220 AddOrReplaceParams js.Array[QueryKeyValue] 1221 1222 FFI_USE bool 1223 } 1224 1225 // FromRef calls UpdateFrom and returns a QueryTransform with all fields set. 1226 func (p QueryTransform) FromRef(ref js.Ref) QueryTransform { 1227 p.UpdateFrom(ref) 1228 return p 1229 } 1230 1231 // New creates a new QueryTransform in the application heap. 1232 func (p QueryTransform) New() js.Ref { 1233 return bindings.QueryTransformJSLoad( 1234 js.Pointer(&p), js.True, 0, 1235 ) 1236 } 1237 1238 // UpdateFrom copies value of all fields of the heap object to p. 1239 func (p *QueryTransform) UpdateFrom(ref js.Ref) { 1240 bindings.QueryTransformJSStore( 1241 js.Pointer(p), ref, 1242 ) 1243 } 1244 1245 // Update writes all fields of the p to the heap object referenced by ref. 1246 func (p *QueryTransform) Update(ref js.Ref) { 1247 bindings.QueryTransformJSLoad( 1248 js.Pointer(p), js.False, ref, 1249 ) 1250 } 1251 1252 // FreeMembers frees fields with heap reference, if recursive is true 1253 // free all heap references reachable from p. 1254 func (p *QueryTransform) FreeMembers(recursive bool) { 1255 js.Free( 1256 p.RemoveParams.Ref(), 1257 p.AddOrReplaceParams.Ref(), 1258 ) 1259 p.RemoveParams = p.RemoveParams.FromRef(js.Undefined) 1260 p.AddOrReplaceParams = p.AddOrReplaceParams.FromRef(js.Undefined) 1261 } 1262 1263 type URLTransform struct { 1264 // Scheme is "URLTransform.scheme" 1265 // 1266 // Optional 1267 Scheme js.String 1268 // Host is "URLTransform.host" 1269 // 1270 // Optional 1271 Host js.String 1272 // Port is "URLTransform.port" 1273 // 1274 // Optional 1275 Port js.String 1276 // Path is "URLTransform.path" 1277 // 1278 // Optional 1279 Path js.String 1280 // Query is "URLTransform.query" 1281 // 1282 // Optional 1283 Query js.String 1284 // QueryTransform is "URLTransform.queryTransform" 1285 // 1286 // Optional 1287 // 1288 // NOTE: QueryTransform.FFI_USE MUST be set to true to get QueryTransform used. 1289 QueryTransform QueryTransform 1290 // Fragment is "URLTransform.fragment" 1291 // 1292 // Optional 1293 Fragment js.String 1294 // Username is "URLTransform.username" 1295 // 1296 // Optional 1297 Username js.String 1298 // Password is "URLTransform.password" 1299 // 1300 // Optional 1301 Password js.String 1302 1303 FFI_USE bool 1304 } 1305 1306 // FromRef calls UpdateFrom and returns a URLTransform with all fields set. 1307 func (p URLTransform) FromRef(ref js.Ref) URLTransform { 1308 p.UpdateFrom(ref) 1309 return p 1310 } 1311 1312 // New creates a new URLTransform in the application heap. 1313 func (p URLTransform) New() js.Ref { 1314 return bindings.URLTransformJSLoad( 1315 js.Pointer(&p), js.True, 0, 1316 ) 1317 } 1318 1319 // UpdateFrom copies value of all fields of the heap object to p. 1320 func (p *URLTransform) UpdateFrom(ref js.Ref) { 1321 bindings.URLTransformJSStore( 1322 js.Pointer(p), ref, 1323 ) 1324 } 1325 1326 // Update writes all fields of the p to the heap object referenced by ref. 1327 func (p *URLTransform) Update(ref js.Ref) { 1328 bindings.URLTransformJSLoad( 1329 js.Pointer(p), js.False, ref, 1330 ) 1331 } 1332 1333 // FreeMembers frees fields with heap reference, if recursive is true 1334 // free all heap references reachable from p. 1335 func (p *URLTransform) FreeMembers(recursive bool) { 1336 js.Free( 1337 p.Scheme.Ref(), 1338 p.Host.Ref(), 1339 p.Port.Ref(), 1340 p.Path.Ref(), 1341 p.Query.Ref(), 1342 p.Fragment.Ref(), 1343 p.Username.Ref(), 1344 p.Password.Ref(), 1345 ) 1346 p.Scheme = p.Scheme.FromRef(js.Undefined) 1347 p.Host = p.Host.FromRef(js.Undefined) 1348 p.Port = p.Port.FromRef(js.Undefined) 1349 p.Path = p.Path.FromRef(js.Undefined) 1350 p.Query = p.Query.FromRef(js.Undefined) 1351 p.Fragment = p.Fragment.FromRef(js.Undefined) 1352 p.Username = p.Username.FromRef(js.Undefined) 1353 p.Password = p.Password.FromRef(js.Undefined) 1354 if recursive { 1355 p.QueryTransform.FreeMembers(true) 1356 } 1357 } 1358 1359 type Redirect struct { 1360 // ExtensionPath is "Redirect.extensionPath" 1361 // 1362 // Optional 1363 ExtensionPath js.String 1364 // Transform is "Redirect.transform" 1365 // 1366 // Optional 1367 // 1368 // NOTE: Transform.FFI_USE MUST be set to true to get Transform used. 1369 Transform URLTransform 1370 // Url is "Redirect.url" 1371 // 1372 // Optional 1373 Url js.String 1374 // RegexSubstitution is "Redirect.regexSubstitution" 1375 // 1376 // Optional 1377 RegexSubstitution js.String 1378 1379 FFI_USE bool 1380 } 1381 1382 // FromRef calls UpdateFrom and returns a Redirect with all fields set. 1383 func (p Redirect) FromRef(ref js.Ref) Redirect { 1384 p.UpdateFrom(ref) 1385 return p 1386 } 1387 1388 // New creates a new Redirect in the application heap. 1389 func (p Redirect) New() js.Ref { 1390 return bindings.RedirectJSLoad( 1391 js.Pointer(&p), js.True, 0, 1392 ) 1393 } 1394 1395 // UpdateFrom copies value of all fields of the heap object to p. 1396 func (p *Redirect) UpdateFrom(ref js.Ref) { 1397 bindings.RedirectJSStore( 1398 js.Pointer(p), ref, 1399 ) 1400 } 1401 1402 // Update writes all fields of the p to the heap object referenced by ref. 1403 func (p *Redirect) Update(ref js.Ref) { 1404 bindings.RedirectJSLoad( 1405 js.Pointer(p), js.False, ref, 1406 ) 1407 } 1408 1409 // FreeMembers frees fields with heap reference, if recursive is true 1410 // free all heap references reachable from p. 1411 func (p *Redirect) FreeMembers(recursive bool) { 1412 js.Free( 1413 p.ExtensionPath.Ref(), 1414 p.Url.Ref(), 1415 p.RegexSubstitution.Ref(), 1416 ) 1417 p.ExtensionPath = p.ExtensionPath.FromRef(js.Undefined) 1418 p.Url = p.Url.FromRef(js.Undefined) 1419 p.RegexSubstitution = p.RegexSubstitution.FromRef(js.Undefined) 1420 if recursive { 1421 p.Transform.FreeMembers(true) 1422 } 1423 } 1424 1425 type HeaderOperation uint32 1426 1427 const ( 1428 _ HeaderOperation = iota 1429 1430 HeaderOperation_APPEND 1431 HeaderOperation_SET 1432 HeaderOperation_REMOVE 1433 ) 1434 1435 func (HeaderOperation) FromRef(str js.Ref) HeaderOperation { 1436 return HeaderOperation(bindings.ConstOfHeaderOperation(str)) 1437 } 1438 1439 func (x HeaderOperation) String() (string, bool) { 1440 switch x { 1441 case HeaderOperation_APPEND: 1442 return "append", true 1443 case HeaderOperation_SET: 1444 return "set", true 1445 case HeaderOperation_REMOVE: 1446 return "remove", true 1447 default: 1448 return "", false 1449 } 1450 } 1451 1452 type ModifyHeaderInfo struct { 1453 // Header is "ModifyHeaderInfo.header" 1454 // 1455 // Optional 1456 Header js.String 1457 // Operation is "ModifyHeaderInfo.operation" 1458 // 1459 // Optional 1460 Operation HeaderOperation 1461 // Value is "ModifyHeaderInfo.value" 1462 // 1463 // Optional 1464 Value js.String 1465 1466 FFI_USE bool 1467 } 1468 1469 // FromRef calls UpdateFrom and returns a ModifyHeaderInfo with all fields set. 1470 func (p ModifyHeaderInfo) FromRef(ref js.Ref) ModifyHeaderInfo { 1471 p.UpdateFrom(ref) 1472 return p 1473 } 1474 1475 // New creates a new ModifyHeaderInfo in the application heap. 1476 func (p ModifyHeaderInfo) New() js.Ref { 1477 return bindings.ModifyHeaderInfoJSLoad( 1478 js.Pointer(&p), js.True, 0, 1479 ) 1480 } 1481 1482 // UpdateFrom copies value of all fields of the heap object to p. 1483 func (p *ModifyHeaderInfo) UpdateFrom(ref js.Ref) { 1484 bindings.ModifyHeaderInfoJSStore( 1485 js.Pointer(p), ref, 1486 ) 1487 } 1488 1489 // Update writes all fields of the p to the heap object referenced by ref. 1490 func (p *ModifyHeaderInfo) Update(ref js.Ref) { 1491 bindings.ModifyHeaderInfoJSLoad( 1492 js.Pointer(p), js.False, ref, 1493 ) 1494 } 1495 1496 // FreeMembers frees fields with heap reference, if recursive is true 1497 // free all heap references reachable from p. 1498 func (p *ModifyHeaderInfo) FreeMembers(recursive bool) { 1499 js.Free( 1500 p.Header.Ref(), 1501 p.Value.Ref(), 1502 ) 1503 p.Header = p.Header.FromRef(js.Undefined) 1504 p.Value = p.Value.FromRef(js.Undefined) 1505 } 1506 1507 type RuleAction struct { 1508 // Type is "RuleAction.type" 1509 // 1510 // Optional 1511 Type RuleActionType 1512 // Redirect is "RuleAction.redirect" 1513 // 1514 // Optional 1515 // 1516 // NOTE: Redirect.FFI_USE MUST be set to true to get Redirect used. 1517 Redirect Redirect 1518 // RequestHeaders is "RuleAction.requestHeaders" 1519 // 1520 // Optional 1521 RequestHeaders js.Array[ModifyHeaderInfo] 1522 // ResponseHeaders is "RuleAction.responseHeaders" 1523 // 1524 // Optional 1525 ResponseHeaders js.Array[ModifyHeaderInfo] 1526 1527 FFI_USE bool 1528 } 1529 1530 // FromRef calls UpdateFrom and returns a RuleAction with all fields set. 1531 func (p RuleAction) FromRef(ref js.Ref) RuleAction { 1532 p.UpdateFrom(ref) 1533 return p 1534 } 1535 1536 // New creates a new RuleAction in the application heap. 1537 func (p RuleAction) New() js.Ref { 1538 return bindings.RuleActionJSLoad( 1539 js.Pointer(&p), js.True, 0, 1540 ) 1541 } 1542 1543 // UpdateFrom copies value of all fields of the heap object to p. 1544 func (p *RuleAction) UpdateFrom(ref js.Ref) { 1545 bindings.RuleActionJSStore( 1546 js.Pointer(p), ref, 1547 ) 1548 } 1549 1550 // Update writes all fields of the p to the heap object referenced by ref. 1551 func (p *RuleAction) Update(ref js.Ref) { 1552 bindings.RuleActionJSLoad( 1553 js.Pointer(p), js.False, ref, 1554 ) 1555 } 1556 1557 // FreeMembers frees fields with heap reference, if recursive is true 1558 // free all heap references reachable from p. 1559 func (p *RuleAction) FreeMembers(recursive bool) { 1560 js.Free( 1561 p.RequestHeaders.Ref(), 1562 p.ResponseHeaders.Ref(), 1563 ) 1564 p.RequestHeaders = p.RequestHeaders.FromRef(js.Undefined) 1565 p.ResponseHeaders = p.ResponseHeaders.FromRef(js.Undefined) 1566 if recursive { 1567 p.Redirect.FreeMembers(true) 1568 } 1569 } 1570 1571 type Rule struct { 1572 // Id is "Rule.id" 1573 // 1574 // Optional 1575 // 1576 // NOTE: FFI_USE_Id MUST be set to true to make this field effective. 1577 Id int32 1578 // Priority is "Rule.priority" 1579 // 1580 // Optional 1581 // 1582 // NOTE: FFI_USE_Priority MUST be set to true to make this field effective. 1583 Priority int32 1584 // Condition is "Rule.condition" 1585 // 1586 // Optional 1587 // 1588 // NOTE: Condition.FFI_USE MUST be set to true to get Condition used. 1589 Condition RuleCondition 1590 // Action is "Rule.action" 1591 // 1592 // Optional 1593 // 1594 // NOTE: Action.FFI_USE MUST be set to true to get Action used. 1595 Action RuleAction 1596 1597 FFI_USE_Id bool // for Id. 1598 FFI_USE_Priority bool // for Priority. 1599 1600 FFI_USE bool 1601 } 1602 1603 // FromRef calls UpdateFrom and returns a Rule with all fields set. 1604 func (p Rule) FromRef(ref js.Ref) Rule { 1605 p.UpdateFrom(ref) 1606 return p 1607 } 1608 1609 // New creates a new Rule in the application heap. 1610 func (p Rule) New() js.Ref { 1611 return bindings.RuleJSLoad( 1612 js.Pointer(&p), js.True, 0, 1613 ) 1614 } 1615 1616 // UpdateFrom copies value of all fields of the heap object to p. 1617 func (p *Rule) UpdateFrom(ref js.Ref) { 1618 bindings.RuleJSStore( 1619 js.Pointer(p), ref, 1620 ) 1621 } 1622 1623 // Update writes all fields of the p to the heap object referenced by ref. 1624 func (p *Rule) Update(ref js.Ref) { 1625 bindings.RuleJSLoad( 1626 js.Pointer(p), js.False, ref, 1627 ) 1628 } 1629 1630 // FreeMembers frees fields with heap reference, if recursive is true 1631 // free all heap references reachable from p. 1632 func (p *Rule) FreeMembers(recursive bool) { 1633 if recursive { 1634 p.Condition.FreeMembers(true) 1635 p.Action.FreeMembers(true) 1636 } 1637 } 1638 1639 type GetRulesFilter struct { 1640 // RuleIds is "GetRulesFilter.ruleIds" 1641 // 1642 // Optional 1643 RuleIds js.Array[int32] 1644 1645 FFI_USE bool 1646 } 1647 1648 // FromRef calls UpdateFrom and returns a GetRulesFilter with all fields set. 1649 func (p GetRulesFilter) FromRef(ref js.Ref) GetRulesFilter { 1650 p.UpdateFrom(ref) 1651 return p 1652 } 1653 1654 // New creates a new GetRulesFilter in the application heap. 1655 func (p GetRulesFilter) New() js.Ref { 1656 return bindings.GetRulesFilterJSLoad( 1657 js.Pointer(&p), js.True, 0, 1658 ) 1659 } 1660 1661 // UpdateFrom copies value of all fields of the heap object to p. 1662 func (p *GetRulesFilter) UpdateFrom(ref js.Ref) { 1663 bindings.GetRulesFilterJSStore( 1664 js.Pointer(p), ref, 1665 ) 1666 } 1667 1668 // Update writes all fields of the p to the heap object referenced by ref. 1669 func (p *GetRulesFilter) Update(ref js.Ref) { 1670 bindings.GetRulesFilterJSLoad( 1671 js.Pointer(p), js.False, ref, 1672 ) 1673 } 1674 1675 // FreeMembers frees fields with heap reference, if recursive is true 1676 // free all heap references reachable from p. 1677 func (p *GetRulesFilter) FreeMembers(recursive bool) { 1678 js.Free( 1679 p.RuleIds.Ref(), 1680 ) 1681 p.RuleIds = p.RuleIds.FromRef(js.Undefined) 1682 } 1683 1684 type IsRegexSupportedCallbackFunc func(this js.Ref, result *IsRegexSupportedResult) js.Ref 1685 1686 func (fn IsRegexSupportedCallbackFunc) Register() js.Func[func(result *IsRegexSupportedResult)] { 1687 return js.RegisterCallback[func(result *IsRegexSupportedResult)]( 1688 fn, abi.FuncPCABIInternal(fn), 1689 ) 1690 } 1691 1692 func (fn IsRegexSupportedCallbackFunc) DispatchCallback( 1693 targetPC uintptr, ctx *js.CallbackContext, 1694 ) { 1695 args := ctx.Args() 1696 if len(args) != 1+1 /* js this */ || 1697 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 1698 js.ThrowInvalidCallbackInvocation() 1699 } 1700 var arg0 IsRegexSupportedResult 1701 arg0.UpdateFrom(args[0+1]) 1702 defer arg0.FreeMembers(true) 1703 1704 if ctx.Return(fn( 1705 args[0], 1706 1707 mark.NoEscape(&arg0), 1708 )) { 1709 return 1710 } 1711 1712 js.ThrowCallbackValueNotReturned() 1713 } 1714 1715 type IsRegexSupportedCallback[T any] struct { 1716 Fn func(arg T, this js.Ref, result *IsRegexSupportedResult) js.Ref 1717 Arg T 1718 } 1719 1720 func (cb *IsRegexSupportedCallback[T]) Register() js.Func[func(result *IsRegexSupportedResult)] { 1721 return js.RegisterCallback[func(result *IsRegexSupportedResult)]( 1722 cb, abi.FuncPCABIInternal(cb.Fn), 1723 ) 1724 } 1725 1726 func (cb *IsRegexSupportedCallback[T]) DispatchCallback( 1727 targetPC uintptr, ctx *js.CallbackContext, 1728 ) { 1729 args := ctx.Args() 1730 if len(args) != 1+1 /* js this */ || 1731 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 1732 js.ThrowInvalidCallbackInvocation() 1733 } 1734 var arg0 IsRegexSupportedResult 1735 arg0.UpdateFrom(args[0+1]) 1736 defer arg0.FreeMembers(true) 1737 1738 if ctx.Return(cb.Fn( 1739 cb.Arg, 1740 args[0], 1741 1742 mark.NoEscape(&arg0), 1743 )) { 1744 return 1745 } 1746 1747 js.ThrowCallbackValueNotReturned() 1748 } 1749 1750 type UnsupportedRegexReason uint32 1751 1752 const ( 1753 _ UnsupportedRegexReason = iota 1754 1755 UnsupportedRegexReason_SYNTAX_ERROR 1756 UnsupportedRegexReason_MEMORY_LIMIT_EXCEEDED 1757 ) 1758 1759 func (UnsupportedRegexReason) FromRef(str js.Ref) UnsupportedRegexReason { 1760 return UnsupportedRegexReason(bindings.ConstOfUnsupportedRegexReason(str)) 1761 } 1762 1763 func (x UnsupportedRegexReason) String() (string, bool) { 1764 switch x { 1765 case UnsupportedRegexReason_SYNTAX_ERROR: 1766 return "syntaxError", true 1767 case UnsupportedRegexReason_MEMORY_LIMIT_EXCEEDED: 1768 return "memoryLimitExceeded", true 1769 default: 1770 return "", false 1771 } 1772 } 1773 1774 type IsRegexSupportedResult struct { 1775 // IsSupported is "IsRegexSupportedResult.isSupported" 1776 // 1777 // Optional 1778 // 1779 // NOTE: FFI_USE_IsSupported MUST be set to true to make this field effective. 1780 IsSupported bool 1781 // Reason is "IsRegexSupportedResult.reason" 1782 // 1783 // Optional 1784 Reason UnsupportedRegexReason 1785 1786 FFI_USE_IsSupported bool // for IsSupported. 1787 1788 FFI_USE bool 1789 } 1790 1791 // FromRef calls UpdateFrom and returns a IsRegexSupportedResult with all fields set. 1792 func (p IsRegexSupportedResult) FromRef(ref js.Ref) IsRegexSupportedResult { 1793 p.UpdateFrom(ref) 1794 return p 1795 } 1796 1797 // New creates a new IsRegexSupportedResult in the application heap. 1798 func (p IsRegexSupportedResult) New() js.Ref { 1799 return bindings.IsRegexSupportedResultJSLoad( 1800 js.Pointer(&p), js.True, 0, 1801 ) 1802 } 1803 1804 // UpdateFrom copies value of all fields of the heap object to p. 1805 func (p *IsRegexSupportedResult) UpdateFrom(ref js.Ref) { 1806 bindings.IsRegexSupportedResultJSStore( 1807 js.Pointer(p), ref, 1808 ) 1809 } 1810 1811 // Update writes all fields of the p to the heap object referenced by ref. 1812 func (p *IsRegexSupportedResult) Update(ref js.Ref) { 1813 bindings.IsRegexSupportedResultJSLoad( 1814 js.Pointer(p), js.False, ref, 1815 ) 1816 } 1817 1818 // FreeMembers frees fields with heap reference, if recursive is true 1819 // free all heap references reachable from p. 1820 func (p *IsRegexSupportedResult) FreeMembers(recursive bool) { 1821 } 1822 1823 type ManifestKeys struct { 1824 // DeclarativeNetRequest is "ManifestKeys.declarative_net_request" 1825 // 1826 // Optional 1827 // 1828 // NOTE: DeclarativeNetRequest.FFI_USE MUST be set to true to get DeclarativeNetRequest used. 1829 DeclarativeNetRequest DNRInfo 1830 1831 FFI_USE bool 1832 } 1833 1834 // FromRef calls UpdateFrom and returns a ManifestKeys with all fields set. 1835 func (p ManifestKeys) FromRef(ref js.Ref) ManifestKeys { 1836 p.UpdateFrom(ref) 1837 return p 1838 } 1839 1840 // New creates a new ManifestKeys in the application heap. 1841 func (p ManifestKeys) New() js.Ref { 1842 return bindings.ManifestKeysJSLoad( 1843 js.Pointer(&p), js.True, 0, 1844 ) 1845 } 1846 1847 // UpdateFrom copies value of all fields of the heap object to p. 1848 func (p *ManifestKeys) UpdateFrom(ref js.Ref) { 1849 bindings.ManifestKeysJSStore( 1850 js.Pointer(p), ref, 1851 ) 1852 } 1853 1854 // Update writes all fields of the p to the heap object referenced by ref. 1855 func (p *ManifestKeys) Update(ref js.Ref) { 1856 bindings.ManifestKeysJSLoad( 1857 js.Pointer(p), js.False, ref, 1858 ) 1859 } 1860 1861 // FreeMembers frees fields with heap reference, if recursive is true 1862 // free all heap references reachable from p. 1863 func (p *ManifestKeys) FreeMembers(recursive bool) { 1864 if recursive { 1865 p.DeclarativeNetRequest.FreeMembers(true) 1866 } 1867 } 1868 1869 type RequestDetails struct { 1870 // RequestId is "RequestDetails.requestId" 1871 // 1872 // Optional 1873 RequestId js.String 1874 // Url is "RequestDetails.url" 1875 // 1876 // Optional 1877 Url js.String 1878 // Initiator is "RequestDetails.initiator" 1879 // 1880 // Optional 1881 Initiator js.String 1882 // Method is "RequestDetails.method" 1883 // 1884 // Optional 1885 Method js.String 1886 // FrameId is "RequestDetails.frameId" 1887 // 1888 // Optional 1889 // 1890 // NOTE: FFI_USE_FrameId MUST be set to true to make this field effective. 1891 FrameId int32 1892 // DocumentId is "RequestDetails.documentId" 1893 // 1894 // Optional 1895 DocumentId js.String 1896 // FrameType is "RequestDetails.frameType" 1897 // 1898 // Optional 1899 FrameType extensiontypes.FrameType 1900 // DocumentLifecycle is "RequestDetails.documentLifecycle" 1901 // 1902 // Optional 1903 DocumentLifecycle extensiontypes.DocumentLifecycle 1904 // ParentFrameId is "RequestDetails.parentFrameId" 1905 // 1906 // Optional 1907 // 1908 // NOTE: FFI_USE_ParentFrameId MUST be set to true to make this field effective. 1909 ParentFrameId int32 1910 // ParentDocumentId is "RequestDetails.parentDocumentId" 1911 // 1912 // Optional 1913 ParentDocumentId js.String 1914 // TabId is "RequestDetails.tabId" 1915 // 1916 // Optional 1917 // 1918 // NOTE: FFI_USE_TabId MUST be set to true to make this field effective. 1919 TabId int32 1920 // Type is "RequestDetails.type" 1921 // 1922 // Optional 1923 Type ResourceType 1924 1925 FFI_USE_FrameId bool // for FrameId. 1926 FFI_USE_ParentFrameId bool // for ParentFrameId. 1927 FFI_USE_TabId bool // for TabId. 1928 1929 FFI_USE bool 1930 } 1931 1932 // FromRef calls UpdateFrom and returns a RequestDetails with all fields set. 1933 func (p RequestDetails) FromRef(ref js.Ref) RequestDetails { 1934 p.UpdateFrom(ref) 1935 return p 1936 } 1937 1938 // New creates a new RequestDetails in the application heap. 1939 func (p RequestDetails) New() js.Ref { 1940 return bindings.RequestDetailsJSLoad( 1941 js.Pointer(&p), js.True, 0, 1942 ) 1943 } 1944 1945 // UpdateFrom copies value of all fields of the heap object to p. 1946 func (p *RequestDetails) UpdateFrom(ref js.Ref) { 1947 bindings.RequestDetailsJSStore( 1948 js.Pointer(p), ref, 1949 ) 1950 } 1951 1952 // Update writes all fields of the p to the heap object referenced by ref. 1953 func (p *RequestDetails) Update(ref js.Ref) { 1954 bindings.RequestDetailsJSLoad( 1955 js.Pointer(p), js.False, ref, 1956 ) 1957 } 1958 1959 // FreeMembers frees fields with heap reference, if recursive is true 1960 // free all heap references reachable from p. 1961 func (p *RequestDetails) FreeMembers(recursive bool) { 1962 js.Free( 1963 p.RequestId.Ref(), 1964 p.Url.Ref(), 1965 p.Initiator.Ref(), 1966 p.Method.Ref(), 1967 p.DocumentId.Ref(), 1968 p.ParentDocumentId.Ref(), 1969 ) 1970 p.RequestId = p.RequestId.FromRef(js.Undefined) 1971 p.Url = p.Url.FromRef(js.Undefined) 1972 p.Initiator = p.Initiator.FromRef(js.Undefined) 1973 p.Method = p.Method.FromRef(js.Undefined) 1974 p.DocumentId = p.DocumentId.FromRef(js.Undefined) 1975 p.ParentDocumentId = p.ParentDocumentId.FromRef(js.Undefined) 1976 } 1977 1978 type MatchedRuleInfoDebug struct { 1979 // Rule is "MatchedRuleInfoDebug.rule" 1980 // 1981 // Optional 1982 // 1983 // NOTE: Rule.FFI_USE MUST be set to true to get Rule used. 1984 Rule MatchedRule 1985 // Request is "MatchedRuleInfoDebug.request" 1986 // 1987 // Optional 1988 // 1989 // NOTE: Request.FFI_USE MUST be set to true to get Request used. 1990 Request RequestDetails 1991 1992 FFI_USE bool 1993 } 1994 1995 // FromRef calls UpdateFrom and returns a MatchedRuleInfoDebug with all fields set. 1996 func (p MatchedRuleInfoDebug) FromRef(ref js.Ref) MatchedRuleInfoDebug { 1997 p.UpdateFrom(ref) 1998 return p 1999 } 2000 2001 // New creates a new MatchedRuleInfoDebug in the application heap. 2002 func (p MatchedRuleInfoDebug) New() js.Ref { 2003 return bindings.MatchedRuleInfoDebugJSLoad( 2004 js.Pointer(&p), js.True, 0, 2005 ) 2006 } 2007 2008 // UpdateFrom copies value of all fields of the heap object to p. 2009 func (p *MatchedRuleInfoDebug) UpdateFrom(ref js.Ref) { 2010 bindings.MatchedRuleInfoDebugJSStore( 2011 js.Pointer(p), ref, 2012 ) 2013 } 2014 2015 // Update writes all fields of the p to the heap object referenced by ref. 2016 func (p *MatchedRuleInfoDebug) Update(ref js.Ref) { 2017 bindings.MatchedRuleInfoDebugJSLoad( 2018 js.Pointer(p), js.False, ref, 2019 ) 2020 } 2021 2022 // FreeMembers frees fields with heap reference, if recursive is true 2023 // free all heap references reachable from p. 2024 func (p *MatchedRuleInfoDebug) FreeMembers(recursive bool) { 2025 if recursive { 2026 p.Rule.FreeMembers(true) 2027 p.Request.FreeMembers(true) 2028 } 2029 } 2030 2031 type MatchedRulesFilter struct { 2032 // TabId is "MatchedRulesFilter.tabId" 2033 // 2034 // Optional 2035 // 2036 // NOTE: FFI_USE_TabId MUST be set to true to make this field effective. 2037 TabId int32 2038 // MinTimeStamp is "MatchedRulesFilter.minTimeStamp" 2039 // 2040 // Optional 2041 // 2042 // NOTE: FFI_USE_MinTimeStamp MUST be set to true to make this field effective. 2043 MinTimeStamp float64 2044 2045 FFI_USE_TabId bool // for TabId. 2046 FFI_USE_MinTimeStamp bool // for MinTimeStamp. 2047 2048 FFI_USE bool 2049 } 2050 2051 // FromRef calls UpdateFrom and returns a MatchedRulesFilter with all fields set. 2052 func (p MatchedRulesFilter) FromRef(ref js.Ref) MatchedRulesFilter { 2053 p.UpdateFrom(ref) 2054 return p 2055 } 2056 2057 // New creates a new MatchedRulesFilter in the application heap. 2058 func (p MatchedRulesFilter) New() js.Ref { 2059 return bindings.MatchedRulesFilterJSLoad( 2060 js.Pointer(&p), js.True, 0, 2061 ) 2062 } 2063 2064 // UpdateFrom copies value of all fields of the heap object to p. 2065 func (p *MatchedRulesFilter) UpdateFrom(ref js.Ref) { 2066 bindings.MatchedRulesFilterJSStore( 2067 js.Pointer(p), ref, 2068 ) 2069 } 2070 2071 // Update writes all fields of the p to the heap object referenced by ref. 2072 func (p *MatchedRulesFilter) Update(ref js.Ref) { 2073 bindings.MatchedRulesFilterJSLoad( 2074 js.Pointer(p), js.False, ref, 2075 ) 2076 } 2077 2078 // FreeMembers frees fields with heap reference, if recursive is true 2079 // free all heap references reachable from p. 2080 func (p *MatchedRulesFilter) FreeMembers(recursive bool) { 2081 } 2082 2083 type Properties struct { 2084 ref js.Ref 2085 } 2086 2087 func (this Properties) Once() Properties { 2088 this.ref.Once() 2089 return this 2090 } 2091 2092 func (this Properties) Ref() js.Ref { 2093 return this.ref 2094 } 2095 2096 func (this Properties) FromRef(ref js.Ref) Properties { 2097 this.ref = ref 2098 return this 2099 } 2100 2101 func (this Properties) Free() { 2102 this.ref.Free() 2103 } 2104 2105 // HasFuncGUARANTEED_MINIMUM_STATIC_RULES returns true if the static method "Properties.GUARANTEED_MINIMUM_STATIC_RULES" exists. 2106 func (this Properties) HasFuncGUARANTEED_MINIMUM_STATIC_RULES() bool { 2107 return js.True == bindings.HasFuncPropertiesGUARANTEED_MINIMUM_STATIC_RULES( 2108 this.ref, 2109 ) 2110 } 2111 2112 // FuncGUARANTEED_MINIMUM_STATIC_RULES returns the static method "Properties.GUARANTEED_MINIMUM_STATIC_RULES". 2113 func (this Properties) FuncGUARANTEED_MINIMUM_STATIC_RULES() (fn js.Func[func() int32]) { 2114 bindings.FuncPropertiesGUARANTEED_MINIMUM_STATIC_RULES( 2115 this.ref, js.Pointer(&fn), 2116 ) 2117 return 2118 } 2119 2120 // GUARANTEED_MINIMUM_STATIC_RULES calls the static method "Properties.GUARANTEED_MINIMUM_STATIC_RULES". 2121 func (this Properties) GUARANTEED_MINIMUM_STATIC_RULES() (ret int32) { 2122 bindings.CallPropertiesGUARANTEED_MINIMUM_STATIC_RULES( 2123 this.ref, js.Pointer(&ret), 2124 ) 2125 2126 return 2127 } 2128 2129 // TryGUARANTEED_MINIMUM_STATIC_RULES calls the static method "Properties.GUARANTEED_MINIMUM_STATIC_RULES" 2130 // in a try/catch block and returns (_, err, ok = false) when it went through 2131 // the catch clause. 2132 func (this Properties) TryGUARANTEED_MINIMUM_STATIC_RULES() (ret int32, exception js.Any, ok bool) { 2133 ok = js.True == bindings.TryPropertiesGUARANTEED_MINIMUM_STATIC_RULES( 2134 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2135 ) 2136 2137 return 2138 } 2139 2140 // HasFuncMAX_NUMBER_OF_DYNAMIC_RULES returns true if the static method "Properties.MAX_NUMBER_OF_DYNAMIC_RULES" exists. 2141 func (this Properties) HasFuncMAX_NUMBER_OF_DYNAMIC_RULES() bool { 2142 return js.True == bindings.HasFuncPropertiesMAX_NUMBER_OF_DYNAMIC_RULES( 2143 this.ref, 2144 ) 2145 } 2146 2147 // FuncMAX_NUMBER_OF_DYNAMIC_RULES returns the static method "Properties.MAX_NUMBER_OF_DYNAMIC_RULES". 2148 func (this Properties) FuncMAX_NUMBER_OF_DYNAMIC_RULES() (fn js.Func[func() int32]) { 2149 bindings.FuncPropertiesMAX_NUMBER_OF_DYNAMIC_RULES( 2150 this.ref, js.Pointer(&fn), 2151 ) 2152 return 2153 } 2154 2155 // MAX_NUMBER_OF_DYNAMIC_RULES calls the static method "Properties.MAX_NUMBER_OF_DYNAMIC_RULES". 2156 func (this Properties) MAX_NUMBER_OF_DYNAMIC_RULES() (ret int32) { 2157 bindings.CallPropertiesMAX_NUMBER_OF_DYNAMIC_RULES( 2158 this.ref, js.Pointer(&ret), 2159 ) 2160 2161 return 2162 } 2163 2164 // TryMAX_NUMBER_OF_DYNAMIC_RULES calls the static method "Properties.MAX_NUMBER_OF_DYNAMIC_RULES" 2165 // in a try/catch block and returns (_, err, ok = false) when it went through 2166 // the catch clause. 2167 func (this Properties) TryMAX_NUMBER_OF_DYNAMIC_RULES() (ret int32, exception js.Any, ok bool) { 2168 ok = js.True == bindings.TryPropertiesMAX_NUMBER_OF_DYNAMIC_RULES( 2169 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2170 ) 2171 2172 return 2173 } 2174 2175 // HasFuncMAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES returns true if the static method "Properties.MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES" exists. 2176 func (this Properties) HasFuncMAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES() bool { 2177 return js.True == bindings.HasFuncPropertiesMAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES( 2178 this.ref, 2179 ) 2180 } 2181 2182 // FuncMAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES returns the static method "Properties.MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES". 2183 func (this Properties) FuncMAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES() (fn js.Func[func() int32]) { 2184 bindings.FuncPropertiesMAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES( 2185 this.ref, js.Pointer(&fn), 2186 ) 2187 return 2188 } 2189 2190 // MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES calls the static method "Properties.MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES". 2191 func (this Properties) MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES() (ret int32) { 2192 bindings.CallPropertiesMAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES( 2193 this.ref, js.Pointer(&ret), 2194 ) 2195 2196 return 2197 } 2198 2199 // TryMAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES calls the static method "Properties.MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES" 2200 // in a try/catch block and returns (_, err, ok = false) when it went through 2201 // the catch clause. 2202 func (this Properties) TryMAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES() (ret int32, exception js.Any, ok bool) { 2203 ok = js.True == bindings.TryPropertiesMAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES( 2204 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2205 ) 2206 2207 return 2208 } 2209 2210 // HasFuncGETMATCHEDRULES_QUOTA_INTERVAL returns true if the static method "Properties.GETMATCHEDRULES_QUOTA_INTERVAL" exists. 2211 func (this Properties) HasFuncGETMATCHEDRULES_QUOTA_INTERVAL() bool { 2212 return js.True == bindings.HasFuncPropertiesGETMATCHEDRULES_QUOTA_INTERVAL( 2213 this.ref, 2214 ) 2215 } 2216 2217 // FuncGETMATCHEDRULES_QUOTA_INTERVAL returns the static method "Properties.GETMATCHEDRULES_QUOTA_INTERVAL". 2218 func (this Properties) FuncGETMATCHEDRULES_QUOTA_INTERVAL() (fn js.Func[func() int32]) { 2219 bindings.FuncPropertiesGETMATCHEDRULES_QUOTA_INTERVAL( 2220 this.ref, js.Pointer(&fn), 2221 ) 2222 return 2223 } 2224 2225 // GETMATCHEDRULES_QUOTA_INTERVAL calls the static method "Properties.GETMATCHEDRULES_QUOTA_INTERVAL". 2226 func (this Properties) GETMATCHEDRULES_QUOTA_INTERVAL() (ret int32) { 2227 bindings.CallPropertiesGETMATCHEDRULES_QUOTA_INTERVAL( 2228 this.ref, js.Pointer(&ret), 2229 ) 2230 2231 return 2232 } 2233 2234 // TryGETMATCHEDRULES_QUOTA_INTERVAL calls the static method "Properties.GETMATCHEDRULES_QUOTA_INTERVAL" 2235 // in a try/catch block and returns (_, err, ok = false) when it went through 2236 // the catch clause. 2237 func (this Properties) TryGETMATCHEDRULES_QUOTA_INTERVAL() (ret int32, exception js.Any, ok bool) { 2238 ok = js.True == bindings.TryPropertiesGETMATCHEDRULES_QUOTA_INTERVAL( 2239 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2240 ) 2241 2242 return 2243 } 2244 2245 // HasFuncMAX_GETMATCHEDRULES_CALLS_PER_INTERVAL returns true if the static method "Properties.MAX_GETMATCHEDRULES_CALLS_PER_INTERVAL" exists. 2246 func (this Properties) HasFuncMAX_GETMATCHEDRULES_CALLS_PER_INTERVAL() bool { 2247 return js.True == bindings.HasFuncPropertiesMAX_GETMATCHEDRULES_CALLS_PER_INTERVAL( 2248 this.ref, 2249 ) 2250 } 2251 2252 // FuncMAX_GETMATCHEDRULES_CALLS_PER_INTERVAL returns the static method "Properties.MAX_GETMATCHEDRULES_CALLS_PER_INTERVAL". 2253 func (this Properties) FuncMAX_GETMATCHEDRULES_CALLS_PER_INTERVAL() (fn js.Func[func() int32]) { 2254 bindings.FuncPropertiesMAX_GETMATCHEDRULES_CALLS_PER_INTERVAL( 2255 this.ref, js.Pointer(&fn), 2256 ) 2257 return 2258 } 2259 2260 // MAX_GETMATCHEDRULES_CALLS_PER_INTERVAL calls the static method "Properties.MAX_GETMATCHEDRULES_CALLS_PER_INTERVAL". 2261 func (this Properties) MAX_GETMATCHEDRULES_CALLS_PER_INTERVAL() (ret int32) { 2262 bindings.CallPropertiesMAX_GETMATCHEDRULES_CALLS_PER_INTERVAL( 2263 this.ref, js.Pointer(&ret), 2264 ) 2265 2266 return 2267 } 2268 2269 // TryMAX_GETMATCHEDRULES_CALLS_PER_INTERVAL calls the static method "Properties.MAX_GETMATCHEDRULES_CALLS_PER_INTERVAL" 2270 // in a try/catch block and returns (_, err, ok = false) when it went through 2271 // the catch clause. 2272 func (this Properties) TryMAX_GETMATCHEDRULES_CALLS_PER_INTERVAL() (ret int32, exception js.Any, ok bool) { 2273 ok = js.True == bindings.TryPropertiesMAX_GETMATCHEDRULES_CALLS_PER_INTERVAL( 2274 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2275 ) 2276 2277 return 2278 } 2279 2280 // HasFuncMAX_NUMBER_OF_REGEX_RULES returns true if the static method "Properties.MAX_NUMBER_OF_REGEX_RULES" exists. 2281 func (this Properties) HasFuncMAX_NUMBER_OF_REGEX_RULES() bool { 2282 return js.True == bindings.HasFuncPropertiesMAX_NUMBER_OF_REGEX_RULES( 2283 this.ref, 2284 ) 2285 } 2286 2287 // FuncMAX_NUMBER_OF_REGEX_RULES returns the static method "Properties.MAX_NUMBER_OF_REGEX_RULES". 2288 func (this Properties) FuncMAX_NUMBER_OF_REGEX_RULES() (fn js.Func[func() int32]) { 2289 bindings.FuncPropertiesMAX_NUMBER_OF_REGEX_RULES( 2290 this.ref, js.Pointer(&fn), 2291 ) 2292 return 2293 } 2294 2295 // MAX_NUMBER_OF_REGEX_RULES calls the static method "Properties.MAX_NUMBER_OF_REGEX_RULES". 2296 func (this Properties) MAX_NUMBER_OF_REGEX_RULES() (ret int32) { 2297 bindings.CallPropertiesMAX_NUMBER_OF_REGEX_RULES( 2298 this.ref, js.Pointer(&ret), 2299 ) 2300 2301 return 2302 } 2303 2304 // TryMAX_NUMBER_OF_REGEX_RULES calls the static method "Properties.MAX_NUMBER_OF_REGEX_RULES" 2305 // in a try/catch block and returns (_, err, ok = false) when it went through 2306 // the catch clause. 2307 func (this Properties) TryMAX_NUMBER_OF_REGEX_RULES() (ret int32, exception js.Any, ok bool) { 2308 ok = js.True == bindings.TryPropertiesMAX_NUMBER_OF_REGEX_RULES( 2309 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2310 ) 2311 2312 return 2313 } 2314 2315 // HasFuncMAX_NUMBER_OF_STATIC_RULESETS returns true if the static method "Properties.MAX_NUMBER_OF_STATIC_RULESETS" exists. 2316 func (this Properties) HasFuncMAX_NUMBER_OF_STATIC_RULESETS() bool { 2317 return js.True == bindings.HasFuncPropertiesMAX_NUMBER_OF_STATIC_RULESETS( 2318 this.ref, 2319 ) 2320 } 2321 2322 // FuncMAX_NUMBER_OF_STATIC_RULESETS returns the static method "Properties.MAX_NUMBER_OF_STATIC_RULESETS". 2323 func (this Properties) FuncMAX_NUMBER_OF_STATIC_RULESETS() (fn js.Func[func() int32]) { 2324 bindings.FuncPropertiesMAX_NUMBER_OF_STATIC_RULESETS( 2325 this.ref, js.Pointer(&fn), 2326 ) 2327 return 2328 } 2329 2330 // MAX_NUMBER_OF_STATIC_RULESETS calls the static method "Properties.MAX_NUMBER_OF_STATIC_RULESETS". 2331 func (this Properties) MAX_NUMBER_OF_STATIC_RULESETS() (ret int32) { 2332 bindings.CallPropertiesMAX_NUMBER_OF_STATIC_RULESETS( 2333 this.ref, js.Pointer(&ret), 2334 ) 2335 2336 return 2337 } 2338 2339 // TryMAX_NUMBER_OF_STATIC_RULESETS calls the static method "Properties.MAX_NUMBER_OF_STATIC_RULESETS" 2340 // in a try/catch block and returns (_, err, ok = false) when it went through 2341 // the catch clause. 2342 func (this Properties) TryMAX_NUMBER_OF_STATIC_RULESETS() (ret int32, exception js.Any, ok bool) { 2343 ok = js.True == bindings.TryPropertiesMAX_NUMBER_OF_STATIC_RULESETS( 2344 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2345 ) 2346 2347 return 2348 } 2349 2350 // HasFuncMAX_NUMBER_OF_ENABLED_STATIC_RULESETS returns true if the static method "Properties.MAX_NUMBER_OF_ENABLED_STATIC_RULESETS" exists. 2351 func (this Properties) HasFuncMAX_NUMBER_OF_ENABLED_STATIC_RULESETS() bool { 2352 return js.True == bindings.HasFuncPropertiesMAX_NUMBER_OF_ENABLED_STATIC_RULESETS( 2353 this.ref, 2354 ) 2355 } 2356 2357 // FuncMAX_NUMBER_OF_ENABLED_STATIC_RULESETS returns the static method "Properties.MAX_NUMBER_OF_ENABLED_STATIC_RULESETS". 2358 func (this Properties) FuncMAX_NUMBER_OF_ENABLED_STATIC_RULESETS() (fn js.Func[func() int32]) { 2359 bindings.FuncPropertiesMAX_NUMBER_OF_ENABLED_STATIC_RULESETS( 2360 this.ref, js.Pointer(&fn), 2361 ) 2362 return 2363 } 2364 2365 // MAX_NUMBER_OF_ENABLED_STATIC_RULESETS calls the static method "Properties.MAX_NUMBER_OF_ENABLED_STATIC_RULESETS". 2366 func (this Properties) MAX_NUMBER_OF_ENABLED_STATIC_RULESETS() (ret int32) { 2367 bindings.CallPropertiesMAX_NUMBER_OF_ENABLED_STATIC_RULESETS( 2368 this.ref, js.Pointer(&ret), 2369 ) 2370 2371 return 2372 } 2373 2374 // TryMAX_NUMBER_OF_ENABLED_STATIC_RULESETS calls the static method "Properties.MAX_NUMBER_OF_ENABLED_STATIC_RULESETS" 2375 // in a try/catch block and returns (_, err, ok = false) when it went through 2376 // the catch clause. 2377 func (this Properties) TryMAX_NUMBER_OF_ENABLED_STATIC_RULESETS() (ret int32, exception js.Any, ok bool) { 2378 ok = js.True == bindings.TryPropertiesMAX_NUMBER_OF_ENABLED_STATIC_RULESETS( 2379 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2380 ) 2381 2382 return 2383 } 2384 2385 // HasFuncDYNAMIC_RULESET_ID returns true if the static method "Properties.DYNAMIC_RULESET_ID" exists. 2386 func (this Properties) HasFuncDYNAMIC_RULESET_ID() bool { 2387 return js.True == bindings.HasFuncPropertiesDYNAMIC_RULESET_ID( 2388 this.ref, 2389 ) 2390 } 2391 2392 // FuncDYNAMIC_RULESET_ID returns the static method "Properties.DYNAMIC_RULESET_ID". 2393 func (this Properties) FuncDYNAMIC_RULESET_ID() (fn js.Func[func() js.String]) { 2394 bindings.FuncPropertiesDYNAMIC_RULESET_ID( 2395 this.ref, js.Pointer(&fn), 2396 ) 2397 return 2398 } 2399 2400 // DYNAMIC_RULESET_ID calls the static method "Properties.DYNAMIC_RULESET_ID". 2401 func (this Properties) DYNAMIC_RULESET_ID() (ret js.String) { 2402 bindings.CallPropertiesDYNAMIC_RULESET_ID( 2403 this.ref, js.Pointer(&ret), 2404 ) 2405 2406 return 2407 } 2408 2409 // TryDYNAMIC_RULESET_ID calls the static method "Properties.DYNAMIC_RULESET_ID" 2410 // in a try/catch block and returns (_, err, ok = false) when it went through 2411 // the catch clause. 2412 func (this Properties) TryDYNAMIC_RULESET_ID() (ret js.String, exception js.Any, ok bool) { 2413 ok = js.True == bindings.TryPropertiesDYNAMIC_RULESET_ID( 2414 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2415 ) 2416 2417 return 2418 } 2419 2420 // HasFuncSESSION_RULESET_ID returns true if the static method "Properties.SESSION_RULESET_ID" exists. 2421 func (this Properties) HasFuncSESSION_RULESET_ID() bool { 2422 return js.True == bindings.HasFuncPropertiesSESSION_RULESET_ID( 2423 this.ref, 2424 ) 2425 } 2426 2427 // FuncSESSION_RULESET_ID returns the static method "Properties.SESSION_RULESET_ID". 2428 func (this Properties) FuncSESSION_RULESET_ID() (fn js.Func[func() js.String]) { 2429 bindings.FuncPropertiesSESSION_RULESET_ID( 2430 this.ref, js.Pointer(&fn), 2431 ) 2432 return 2433 } 2434 2435 // SESSION_RULESET_ID calls the static method "Properties.SESSION_RULESET_ID". 2436 func (this Properties) SESSION_RULESET_ID() (ret js.String) { 2437 bindings.CallPropertiesSESSION_RULESET_ID( 2438 this.ref, js.Pointer(&ret), 2439 ) 2440 2441 return 2442 } 2443 2444 // TrySESSION_RULESET_ID calls the static method "Properties.SESSION_RULESET_ID" 2445 // in a try/catch block and returns (_, err, ok = false) when it went through 2446 // the catch clause. 2447 func (this Properties) TrySESSION_RULESET_ID() (ret js.String, exception js.Any, ok bool) { 2448 ok = js.True == bindings.TryPropertiesSESSION_RULESET_ID( 2449 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2450 ) 2451 2452 return 2453 } 2454 2455 type RegexOptions struct { 2456 // Regex is "RegexOptions.regex" 2457 // 2458 // Optional 2459 Regex js.String 2460 // IsCaseSensitive is "RegexOptions.isCaseSensitive" 2461 // 2462 // Optional 2463 // 2464 // NOTE: FFI_USE_IsCaseSensitive MUST be set to true to make this field effective. 2465 IsCaseSensitive bool 2466 // RequireCapturing is "RegexOptions.requireCapturing" 2467 // 2468 // Optional 2469 // 2470 // NOTE: FFI_USE_RequireCapturing MUST be set to true to make this field effective. 2471 RequireCapturing bool 2472 2473 FFI_USE_IsCaseSensitive bool // for IsCaseSensitive. 2474 FFI_USE_RequireCapturing bool // for RequireCapturing. 2475 2476 FFI_USE bool 2477 } 2478 2479 // FromRef calls UpdateFrom and returns a RegexOptions with all fields set. 2480 func (p RegexOptions) FromRef(ref js.Ref) RegexOptions { 2481 p.UpdateFrom(ref) 2482 return p 2483 } 2484 2485 // New creates a new RegexOptions in the application heap. 2486 func (p RegexOptions) New() js.Ref { 2487 return bindings.RegexOptionsJSLoad( 2488 js.Pointer(&p), js.True, 0, 2489 ) 2490 } 2491 2492 // UpdateFrom copies value of all fields of the heap object to p. 2493 func (p *RegexOptions) UpdateFrom(ref js.Ref) { 2494 bindings.RegexOptionsJSStore( 2495 js.Pointer(p), ref, 2496 ) 2497 } 2498 2499 // Update writes all fields of the p to the heap object referenced by ref. 2500 func (p *RegexOptions) Update(ref js.Ref) { 2501 bindings.RegexOptionsJSLoad( 2502 js.Pointer(p), js.False, ref, 2503 ) 2504 } 2505 2506 // FreeMembers frees fields with heap reference, if recursive is true 2507 // free all heap references reachable from p. 2508 func (p *RegexOptions) FreeMembers(recursive bool) { 2509 js.Free( 2510 p.Regex.Ref(), 2511 ) 2512 p.Regex = p.Regex.FromRef(js.Undefined) 2513 } 2514 2515 type TestMatchOutcomeCallbackFunc func(this js.Ref, result *TestMatchOutcomeResult) js.Ref 2516 2517 func (fn TestMatchOutcomeCallbackFunc) Register() js.Func[func(result *TestMatchOutcomeResult)] { 2518 return js.RegisterCallback[func(result *TestMatchOutcomeResult)]( 2519 fn, abi.FuncPCABIInternal(fn), 2520 ) 2521 } 2522 2523 func (fn TestMatchOutcomeCallbackFunc) DispatchCallback( 2524 targetPC uintptr, ctx *js.CallbackContext, 2525 ) { 2526 args := ctx.Args() 2527 if len(args) != 1+1 /* js this */ || 2528 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 2529 js.ThrowInvalidCallbackInvocation() 2530 } 2531 var arg0 TestMatchOutcomeResult 2532 arg0.UpdateFrom(args[0+1]) 2533 defer arg0.FreeMembers(true) 2534 2535 if ctx.Return(fn( 2536 args[0], 2537 2538 mark.NoEscape(&arg0), 2539 )) { 2540 return 2541 } 2542 2543 js.ThrowCallbackValueNotReturned() 2544 } 2545 2546 type TestMatchOutcomeCallback[T any] struct { 2547 Fn func(arg T, this js.Ref, result *TestMatchOutcomeResult) js.Ref 2548 Arg T 2549 } 2550 2551 func (cb *TestMatchOutcomeCallback[T]) Register() js.Func[func(result *TestMatchOutcomeResult)] { 2552 return js.RegisterCallback[func(result *TestMatchOutcomeResult)]( 2553 cb, abi.FuncPCABIInternal(cb.Fn), 2554 ) 2555 } 2556 2557 func (cb *TestMatchOutcomeCallback[T]) DispatchCallback( 2558 targetPC uintptr, ctx *js.CallbackContext, 2559 ) { 2560 args := ctx.Args() 2561 if len(args) != 1+1 /* js this */ || 2562 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 2563 js.ThrowInvalidCallbackInvocation() 2564 } 2565 var arg0 TestMatchOutcomeResult 2566 arg0.UpdateFrom(args[0+1]) 2567 defer arg0.FreeMembers(true) 2568 2569 if ctx.Return(cb.Fn( 2570 cb.Arg, 2571 args[0], 2572 2573 mark.NoEscape(&arg0), 2574 )) { 2575 return 2576 } 2577 2578 js.ThrowCallbackValueNotReturned() 2579 } 2580 2581 type TestMatchOutcomeResult struct { 2582 // MatchedRules is "TestMatchOutcomeResult.matchedRules" 2583 // 2584 // Optional 2585 MatchedRules js.Array[MatchedRule] 2586 2587 FFI_USE bool 2588 } 2589 2590 // FromRef calls UpdateFrom and returns a TestMatchOutcomeResult with all fields set. 2591 func (p TestMatchOutcomeResult) FromRef(ref js.Ref) TestMatchOutcomeResult { 2592 p.UpdateFrom(ref) 2593 return p 2594 } 2595 2596 // New creates a new TestMatchOutcomeResult in the application heap. 2597 func (p TestMatchOutcomeResult) New() js.Ref { 2598 return bindings.TestMatchOutcomeResultJSLoad( 2599 js.Pointer(&p), js.True, 0, 2600 ) 2601 } 2602 2603 // UpdateFrom copies value of all fields of the heap object to p. 2604 func (p *TestMatchOutcomeResult) UpdateFrom(ref js.Ref) { 2605 bindings.TestMatchOutcomeResultJSStore( 2606 js.Pointer(p), ref, 2607 ) 2608 } 2609 2610 // Update writes all fields of the p to the heap object referenced by ref. 2611 func (p *TestMatchOutcomeResult) Update(ref js.Ref) { 2612 bindings.TestMatchOutcomeResultJSLoad( 2613 js.Pointer(p), js.False, ref, 2614 ) 2615 } 2616 2617 // FreeMembers frees fields with heap reference, if recursive is true 2618 // free all heap references reachable from p. 2619 func (p *TestMatchOutcomeResult) FreeMembers(recursive bool) { 2620 js.Free( 2621 p.MatchedRules.Ref(), 2622 ) 2623 p.MatchedRules = p.MatchedRules.FromRef(js.Undefined) 2624 } 2625 2626 type TestMatchRequestDetails struct { 2627 // Url is "TestMatchRequestDetails.url" 2628 // 2629 // Optional 2630 Url js.String 2631 // Initiator is "TestMatchRequestDetails.initiator" 2632 // 2633 // Optional 2634 Initiator js.String 2635 // Method is "TestMatchRequestDetails.method" 2636 // 2637 // Optional 2638 Method RequestMethod 2639 // Type is "TestMatchRequestDetails.type" 2640 // 2641 // Optional 2642 Type ResourceType 2643 // TabId is "TestMatchRequestDetails.tabId" 2644 // 2645 // Optional 2646 // 2647 // NOTE: FFI_USE_TabId MUST be set to true to make this field effective. 2648 TabId int32 2649 2650 FFI_USE_TabId bool // for TabId. 2651 2652 FFI_USE bool 2653 } 2654 2655 // FromRef calls UpdateFrom and returns a TestMatchRequestDetails with all fields set. 2656 func (p TestMatchRequestDetails) FromRef(ref js.Ref) TestMatchRequestDetails { 2657 p.UpdateFrom(ref) 2658 return p 2659 } 2660 2661 // New creates a new TestMatchRequestDetails in the application heap. 2662 func (p TestMatchRequestDetails) New() js.Ref { 2663 return bindings.TestMatchRequestDetailsJSLoad( 2664 js.Pointer(&p), js.True, 0, 2665 ) 2666 } 2667 2668 // UpdateFrom copies value of all fields of the heap object to p. 2669 func (p *TestMatchRequestDetails) UpdateFrom(ref js.Ref) { 2670 bindings.TestMatchRequestDetailsJSStore( 2671 js.Pointer(p), ref, 2672 ) 2673 } 2674 2675 // Update writes all fields of the p to the heap object referenced by ref. 2676 func (p *TestMatchRequestDetails) Update(ref js.Ref) { 2677 bindings.TestMatchRequestDetailsJSLoad( 2678 js.Pointer(p), js.False, ref, 2679 ) 2680 } 2681 2682 // FreeMembers frees fields with heap reference, if recursive is true 2683 // free all heap references reachable from p. 2684 func (p *TestMatchRequestDetails) FreeMembers(recursive bool) { 2685 js.Free( 2686 p.Url.Ref(), 2687 p.Initiator.Ref(), 2688 ) 2689 p.Url = p.Url.FromRef(js.Undefined) 2690 p.Initiator = p.Initiator.FromRef(js.Undefined) 2691 } 2692 2693 type UpdateRuleOptions struct { 2694 // RemoveRuleIds is "UpdateRuleOptions.removeRuleIds" 2695 // 2696 // Optional 2697 RemoveRuleIds js.Array[int32] 2698 // AddRules is "UpdateRuleOptions.addRules" 2699 // 2700 // Optional 2701 AddRules js.Array[Rule] 2702 2703 FFI_USE bool 2704 } 2705 2706 // FromRef calls UpdateFrom and returns a UpdateRuleOptions with all fields set. 2707 func (p UpdateRuleOptions) FromRef(ref js.Ref) UpdateRuleOptions { 2708 p.UpdateFrom(ref) 2709 return p 2710 } 2711 2712 // New creates a new UpdateRuleOptions in the application heap. 2713 func (p UpdateRuleOptions) New() js.Ref { 2714 return bindings.UpdateRuleOptionsJSLoad( 2715 js.Pointer(&p), js.True, 0, 2716 ) 2717 } 2718 2719 // UpdateFrom copies value of all fields of the heap object to p. 2720 func (p *UpdateRuleOptions) UpdateFrom(ref js.Ref) { 2721 bindings.UpdateRuleOptionsJSStore( 2722 js.Pointer(p), ref, 2723 ) 2724 } 2725 2726 // Update writes all fields of the p to the heap object referenced by ref. 2727 func (p *UpdateRuleOptions) Update(ref js.Ref) { 2728 bindings.UpdateRuleOptionsJSLoad( 2729 js.Pointer(p), js.False, ref, 2730 ) 2731 } 2732 2733 // FreeMembers frees fields with heap reference, if recursive is true 2734 // free all heap references reachable from p. 2735 func (p *UpdateRuleOptions) FreeMembers(recursive bool) { 2736 js.Free( 2737 p.RemoveRuleIds.Ref(), 2738 p.AddRules.Ref(), 2739 ) 2740 p.RemoveRuleIds = p.RemoveRuleIds.FromRef(js.Undefined) 2741 p.AddRules = p.AddRules.FromRef(js.Undefined) 2742 } 2743 2744 type UpdateRulesetOptions struct { 2745 // DisableRulesetIds is "UpdateRulesetOptions.disableRulesetIds" 2746 // 2747 // Optional 2748 DisableRulesetIds js.Array[js.String] 2749 // EnableRulesetIds is "UpdateRulesetOptions.enableRulesetIds" 2750 // 2751 // Optional 2752 EnableRulesetIds js.Array[js.String] 2753 2754 FFI_USE bool 2755 } 2756 2757 // FromRef calls UpdateFrom and returns a UpdateRulesetOptions with all fields set. 2758 func (p UpdateRulesetOptions) FromRef(ref js.Ref) UpdateRulesetOptions { 2759 p.UpdateFrom(ref) 2760 return p 2761 } 2762 2763 // New creates a new UpdateRulesetOptions in the application heap. 2764 func (p UpdateRulesetOptions) New() js.Ref { 2765 return bindings.UpdateRulesetOptionsJSLoad( 2766 js.Pointer(&p), js.True, 0, 2767 ) 2768 } 2769 2770 // UpdateFrom copies value of all fields of the heap object to p. 2771 func (p *UpdateRulesetOptions) UpdateFrom(ref js.Ref) { 2772 bindings.UpdateRulesetOptionsJSStore( 2773 js.Pointer(p), ref, 2774 ) 2775 } 2776 2777 // Update writes all fields of the p to the heap object referenced by ref. 2778 func (p *UpdateRulesetOptions) Update(ref js.Ref) { 2779 bindings.UpdateRulesetOptionsJSLoad( 2780 js.Pointer(p), js.False, ref, 2781 ) 2782 } 2783 2784 // FreeMembers frees fields with heap reference, if recursive is true 2785 // free all heap references reachable from p. 2786 func (p *UpdateRulesetOptions) FreeMembers(recursive bool) { 2787 js.Free( 2788 p.DisableRulesetIds.Ref(), 2789 p.EnableRulesetIds.Ref(), 2790 ) 2791 p.DisableRulesetIds = p.DisableRulesetIds.FromRef(js.Undefined) 2792 p.EnableRulesetIds = p.EnableRulesetIds.FromRef(js.Undefined) 2793 } 2794 2795 type UpdateStaticRulesOptions struct { 2796 // RulesetId is "UpdateStaticRulesOptions.rulesetId" 2797 // 2798 // Optional 2799 RulesetId js.String 2800 // DisableRuleIds is "UpdateStaticRulesOptions.disableRuleIds" 2801 // 2802 // Optional 2803 DisableRuleIds js.Array[int32] 2804 // EnableRuleIds is "UpdateStaticRulesOptions.enableRuleIds" 2805 // 2806 // Optional 2807 EnableRuleIds js.Array[int32] 2808 2809 FFI_USE bool 2810 } 2811 2812 // FromRef calls UpdateFrom and returns a UpdateStaticRulesOptions with all fields set. 2813 func (p UpdateStaticRulesOptions) FromRef(ref js.Ref) UpdateStaticRulesOptions { 2814 p.UpdateFrom(ref) 2815 return p 2816 } 2817 2818 // New creates a new UpdateStaticRulesOptions in the application heap. 2819 func (p UpdateStaticRulesOptions) New() js.Ref { 2820 return bindings.UpdateStaticRulesOptionsJSLoad( 2821 js.Pointer(&p), js.True, 0, 2822 ) 2823 } 2824 2825 // UpdateFrom copies value of all fields of the heap object to p. 2826 func (p *UpdateStaticRulesOptions) UpdateFrom(ref js.Ref) { 2827 bindings.UpdateStaticRulesOptionsJSStore( 2828 js.Pointer(p), ref, 2829 ) 2830 } 2831 2832 // Update writes all fields of the p to the heap object referenced by ref. 2833 func (p *UpdateStaticRulesOptions) Update(ref js.Ref) { 2834 bindings.UpdateStaticRulesOptionsJSLoad( 2835 js.Pointer(p), js.False, ref, 2836 ) 2837 } 2838 2839 // FreeMembers frees fields with heap reference, if recursive is true 2840 // free all heap references reachable from p. 2841 func (p *UpdateStaticRulesOptions) FreeMembers(recursive bool) { 2842 js.Free( 2843 p.RulesetId.Ref(), 2844 p.DisableRuleIds.Ref(), 2845 p.EnableRuleIds.Ref(), 2846 ) 2847 p.RulesetId = p.RulesetId.FromRef(js.Undefined) 2848 p.DisableRuleIds = p.DisableRuleIds.FromRef(js.Undefined) 2849 p.EnableRuleIds = p.EnableRuleIds.FromRef(js.Undefined) 2850 } 2851 2852 // HasFuncGetAvailableStaticRuleCount returns true if the function "WEBEXT.declarativeNetRequest.getAvailableStaticRuleCount" exists. 2853 func HasFuncGetAvailableStaticRuleCount() bool { 2854 return js.True == bindings.HasFuncGetAvailableStaticRuleCount() 2855 } 2856 2857 // FuncGetAvailableStaticRuleCount returns the function "WEBEXT.declarativeNetRequest.getAvailableStaticRuleCount". 2858 func FuncGetAvailableStaticRuleCount() (fn js.Func[func() js.Promise[js.Number[int32]]]) { 2859 bindings.FuncGetAvailableStaticRuleCount( 2860 js.Pointer(&fn), 2861 ) 2862 return 2863 } 2864 2865 // GetAvailableStaticRuleCount calls the function "WEBEXT.declarativeNetRequest.getAvailableStaticRuleCount" directly. 2866 func GetAvailableStaticRuleCount() (ret js.Promise[js.Number[int32]]) { 2867 bindings.CallGetAvailableStaticRuleCount( 2868 js.Pointer(&ret), 2869 ) 2870 2871 return 2872 } 2873 2874 // TryGetAvailableStaticRuleCount calls the function "WEBEXT.declarativeNetRequest.getAvailableStaticRuleCount" 2875 // in a try/catch block and returns (_, err, ok = false) when it went through 2876 // the catch clause. 2877 func TryGetAvailableStaticRuleCount() (ret js.Promise[js.Number[int32]], exception js.Any, ok bool) { 2878 ok = js.True == bindings.TryGetAvailableStaticRuleCount( 2879 js.Pointer(&ret), js.Pointer(&exception), 2880 ) 2881 2882 return 2883 } 2884 2885 // HasFuncGetDisabledRuleIds returns true if the function "WEBEXT.declarativeNetRequest.getDisabledRuleIds" exists. 2886 func HasFuncGetDisabledRuleIds() bool { 2887 return js.True == bindings.HasFuncGetDisabledRuleIds() 2888 } 2889 2890 // FuncGetDisabledRuleIds returns the function "WEBEXT.declarativeNetRequest.getDisabledRuleIds". 2891 func FuncGetDisabledRuleIds() (fn js.Func[func(options GetDisabledRuleIdsOptions) js.Promise[js.Array[int32]]]) { 2892 bindings.FuncGetDisabledRuleIds( 2893 js.Pointer(&fn), 2894 ) 2895 return 2896 } 2897 2898 // GetDisabledRuleIds calls the function "WEBEXT.declarativeNetRequest.getDisabledRuleIds" directly. 2899 func GetDisabledRuleIds(options GetDisabledRuleIdsOptions) (ret js.Promise[js.Array[int32]]) { 2900 bindings.CallGetDisabledRuleIds( 2901 js.Pointer(&ret), 2902 js.Pointer(&options), 2903 ) 2904 2905 return 2906 } 2907 2908 // TryGetDisabledRuleIds calls the function "WEBEXT.declarativeNetRequest.getDisabledRuleIds" 2909 // in a try/catch block and returns (_, err, ok = false) when it went through 2910 // the catch clause. 2911 func TryGetDisabledRuleIds(options GetDisabledRuleIdsOptions) (ret js.Promise[js.Array[int32]], exception js.Any, ok bool) { 2912 ok = js.True == bindings.TryGetDisabledRuleIds( 2913 js.Pointer(&ret), js.Pointer(&exception), 2914 js.Pointer(&options), 2915 ) 2916 2917 return 2918 } 2919 2920 // HasFuncGetDynamicRules returns true if the function "WEBEXT.declarativeNetRequest.getDynamicRules" exists. 2921 func HasFuncGetDynamicRules() bool { 2922 return js.True == bindings.HasFuncGetDynamicRules() 2923 } 2924 2925 // FuncGetDynamicRules returns the function "WEBEXT.declarativeNetRequest.getDynamicRules". 2926 func FuncGetDynamicRules() (fn js.Func[func(filter GetRulesFilter) js.Promise[js.Array[Rule]]]) { 2927 bindings.FuncGetDynamicRules( 2928 js.Pointer(&fn), 2929 ) 2930 return 2931 } 2932 2933 // GetDynamicRules calls the function "WEBEXT.declarativeNetRequest.getDynamicRules" directly. 2934 func GetDynamicRules(filter GetRulesFilter) (ret js.Promise[js.Array[Rule]]) { 2935 bindings.CallGetDynamicRules( 2936 js.Pointer(&ret), 2937 js.Pointer(&filter), 2938 ) 2939 2940 return 2941 } 2942 2943 // TryGetDynamicRules calls the function "WEBEXT.declarativeNetRequest.getDynamicRules" 2944 // in a try/catch block and returns (_, err, ok = false) when it went through 2945 // the catch clause. 2946 func TryGetDynamicRules(filter GetRulesFilter) (ret js.Promise[js.Array[Rule]], exception js.Any, ok bool) { 2947 ok = js.True == bindings.TryGetDynamicRules( 2948 js.Pointer(&ret), js.Pointer(&exception), 2949 js.Pointer(&filter), 2950 ) 2951 2952 return 2953 } 2954 2955 // HasFuncGetEnabledRulesets returns true if the function "WEBEXT.declarativeNetRequest.getEnabledRulesets" exists. 2956 func HasFuncGetEnabledRulesets() bool { 2957 return js.True == bindings.HasFuncGetEnabledRulesets() 2958 } 2959 2960 // FuncGetEnabledRulesets returns the function "WEBEXT.declarativeNetRequest.getEnabledRulesets". 2961 func FuncGetEnabledRulesets() (fn js.Func[func() js.Promise[js.Array[js.String]]]) { 2962 bindings.FuncGetEnabledRulesets( 2963 js.Pointer(&fn), 2964 ) 2965 return 2966 } 2967 2968 // GetEnabledRulesets calls the function "WEBEXT.declarativeNetRequest.getEnabledRulesets" directly. 2969 func GetEnabledRulesets() (ret js.Promise[js.Array[js.String]]) { 2970 bindings.CallGetEnabledRulesets( 2971 js.Pointer(&ret), 2972 ) 2973 2974 return 2975 } 2976 2977 // TryGetEnabledRulesets calls the function "WEBEXT.declarativeNetRequest.getEnabledRulesets" 2978 // in a try/catch block and returns (_, err, ok = false) when it went through 2979 // the catch clause. 2980 func TryGetEnabledRulesets() (ret js.Promise[js.Array[js.String]], exception js.Any, ok bool) { 2981 ok = js.True == bindings.TryGetEnabledRulesets( 2982 js.Pointer(&ret), js.Pointer(&exception), 2983 ) 2984 2985 return 2986 } 2987 2988 // HasFuncGetMatchedRules returns true if the function "WEBEXT.declarativeNetRequest.getMatchedRules" exists. 2989 func HasFuncGetMatchedRules() bool { 2990 return js.True == bindings.HasFuncGetMatchedRules() 2991 } 2992 2993 // FuncGetMatchedRules returns the function "WEBEXT.declarativeNetRequest.getMatchedRules". 2994 func FuncGetMatchedRules() (fn js.Func[func(filter MatchedRulesFilter) js.Promise[RulesMatchedDetails]]) { 2995 bindings.FuncGetMatchedRules( 2996 js.Pointer(&fn), 2997 ) 2998 return 2999 } 3000 3001 // GetMatchedRules calls the function "WEBEXT.declarativeNetRequest.getMatchedRules" directly. 3002 func GetMatchedRules(filter MatchedRulesFilter) (ret js.Promise[RulesMatchedDetails]) { 3003 bindings.CallGetMatchedRules( 3004 js.Pointer(&ret), 3005 js.Pointer(&filter), 3006 ) 3007 3008 return 3009 } 3010 3011 // TryGetMatchedRules calls the function "WEBEXT.declarativeNetRequest.getMatchedRules" 3012 // in a try/catch block and returns (_, err, ok = false) when it went through 3013 // the catch clause. 3014 func TryGetMatchedRules(filter MatchedRulesFilter) (ret js.Promise[RulesMatchedDetails], exception js.Any, ok bool) { 3015 ok = js.True == bindings.TryGetMatchedRules( 3016 js.Pointer(&ret), js.Pointer(&exception), 3017 js.Pointer(&filter), 3018 ) 3019 3020 return 3021 } 3022 3023 // HasFuncGetSessionRules returns true if the function "WEBEXT.declarativeNetRequest.getSessionRules" exists. 3024 func HasFuncGetSessionRules() bool { 3025 return js.True == bindings.HasFuncGetSessionRules() 3026 } 3027 3028 // FuncGetSessionRules returns the function "WEBEXT.declarativeNetRequest.getSessionRules". 3029 func FuncGetSessionRules() (fn js.Func[func(filter GetRulesFilter) js.Promise[js.Array[Rule]]]) { 3030 bindings.FuncGetSessionRules( 3031 js.Pointer(&fn), 3032 ) 3033 return 3034 } 3035 3036 // GetSessionRules calls the function "WEBEXT.declarativeNetRequest.getSessionRules" directly. 3037 func GetSessionRules(filter GetRulesFilter) (ret js.Promise[js.Array[Rule]]) { 3038 bindings.CallGetSessionRules( 3039 js.Pointer(&ret), 3040 js.Pointer(&filter), 3041 ) 3042 3043 return 3044 } 3045 3046 // TryGetSessionRules calls the function "WEBEXT.declarativeNetRequest.getSessionRules" 3047 // in a try/catch block and returns (_, err, ok = false) when it went through 3048 // the catch clause. 3049 func TryGetSessionRules(filter GetRulesFilter) (ret js.Promise[js.Array[Rule]], exception js.Any, ok bool) { 3050 ok = js.True == bindings.TryGetSessionRules( 3051 js.Pointer(&ret), js.Pointer(&exception), 3052 js.Pointer(&filter), 3053 ) 3054 3055 return 3056 } 3057 3058 // HasFuncIsRegexSupported returns true if the function "WEBEXT.declarativeNetRequest.isRegexSupported" exists. 3059 func HasFuncIsRegexSupported() bool { 3060 return js.True == bindings.HasFuncIsRegexSupported() 3061 } 3062 3063 // FuncIsRegexSupported returns the function "WEBEXT.declarativeNetRequest.isRegexSupported". 3064 func FuncIsRegexSupported() (fn js.Func[func(regexOptions RegexOptions) js.Promise[IsRegexSupportedResult]]) { 3065 bindings.FuncIsRegexSupported( 3066 js.Pointer(&fn), 3067 ) 3068 return 3069 } 3070 3071 // IsRegexSupported calls the function "WEBEXT.declarativeNetRequest.isRegexSupported" directly. 3072 func IsRegexSupported(regexOptions RegexOptions) (ret js.Promise[IsRegexSupportedResult]) { 3073 bindings.CallIsRegexSupported( 3074 js.Pointer(&ret), 3075 js.Pointer(®exOptions), 3076 ) 3077 3078 return 3079 } 3080 3081 // TryIsRegexSupported calls the function "WEBEXT.declarativeNetRequest.isRegexSupported" 3082 // in a try/catch block and returns (_, err, ok = false) when it went through 3083 // the catch clause. 3084 func TryIsRegexSupported(regexOptions RegexOptions) (ret js.Promise[IsRegexSupportedResult], exception js.Any, ok bool) { 3085 ok = js.True == bindings.TryIsRegexSupported( 3086 js.Pointer(&ret), js.Pointer(&exception), 3087 js.Pointer(®exOptions), 3088 ) 3089 3090 return 3091 } 3092 3093 type OnRuleMatchedDebugEventCallbackFunc func(this js.Ref, info *MatchedRuleInfoDebug) js.Ref 3094 3095 func (fn OnRuleMatchedDebugEventCallbackFunc) Register() js.Func[func(info *MatchedRuleInfoDebug)] { 3096 return js.RegisterCallback[func(info *MatchedRuleInfoDebug)]( 3097 fn, abi.FuncPCABIInternal(fn), 3098 ) 3099 } 3100 3101 func (fn OnRuleMatchedDebugEventCallbackFunc) DispatchCallback( 3102 targetPC uintptr, ctx *js.CallbackContext, 3103 ) { 3104 args := ctx.Args() 3105 if len(args) != 1+1 /* js this */ || 3106 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 3107 js.ThrowInvalidCallbackInvocation() 3108 } 3109 var arg0 MatchedRuleInfoDebug 3110 arg0.UpdateFrom(args[0+1]) 3111 defer arg0.FreeMembers(true) 3112 3113 if ctx.Return(fn( 3114 args[0], 3115 3116 mark.NoEscape(&arg0), 3117 )) { 3118 return 3119 } 3120 3121 js.ThrowCallbackValueNotReturned() 3122 } 3123 3124 type OnRuleMatchedDebugEventCallback[T any] struct { 3125 Fn func(arg T, this js.Ref, info *MatchedRuleInfoDebug) js.Ref 3126 Arg T 3127 } 3128 3129 func (cb *OnRuleMatchedDebugEventCallback[T]) Register() js.Func[func(info *MatchedRuleInfoDebug)] { 3130 return js.RegisterCallback[func(info *MatchedRuleInfoDebug)]( 3131 cb, abi.FuncPCABIInternal(cb.Fn), 3132 ) 3133 } 3134 3135 func (cb *OnRuleMatchedDebugEventCallback[T]) DispatchCallback( 3136 targetPC uintptr, ctx *js.CallbackContext, 3137 ) { 3138 args := ctx.Args() 3139 if len(args) != 1+1 /* js this */ || 3140 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 3141 js.ThrowInvalidCallbackInvocation() 3142 } 3143 var arg0 MatchedRuleInfoDebug 3144 arg0.UpdateFrom(args[0+1]) 3145 defer arg0.FreeMembers(true) 3146 3147 if ctx.Return(cb.Fn( 3148 cb.Arg, 3149 args[0], 3150 3151 mark.NoEscape(&arg0), 3152 )) { 3153 return 3154 } 3155 3156 js.ThrowCallbackValueNotReturned() 3157 } 3158 3159 // HasFuncOnRuleMatchedDebug returns true if the function "WEBEXT.declarativeNetRequest.onRuleMatchedDebug.addListener" exists. 3160 func HasFuncOnRuleMatchedDebug() bool { 3161 return js.True == bindings.HasFuncOnRuleMatchedDebug() 3162 } 3163 3164 // FuncOnRuleMatchedDebug returns the function "WEBEXT.declarativeNetRequest.onRuleMatchedDebug.addListener". 3165 func FuncOnRuleMatchedDebug() (fn js.Func[func(callback js.Func[func(info *MatchedRuleInfoDebug)])]) { 3166 bindings.FuncOnRuleMatchedDebug( 3167 js.Pointer(&fn), 3168 ) 3169 return 3170 } 3171 3172 // OnRuleMatchedDebug calls the function "WEBEXT.declarativeNetRequest.onRuleMatchedDebug.addListener" directly. 3173 func OnRuleMatchedDebug(callback js.Func[func(info *MatchedRuleInfoDebug)]) (ret js.Void) { 3174 bindings.CallOnRuleMatchedDebug( 3175 js.Pointer(&ret), 3176 callback.Ref(), 3177 ) 3178 3179 return 3180 } 3181 3182 // TryOnRuleMatchedDebug calls the function "WEBEXT.declarativeNetRequest.onRuleMatchedDebug.addListener" 3183 // in a try/catch block and returns (_, err, ok = false) when it went through 3184 // the catch clause. 3185 func TryOnRuleMatchedDebug(callback js.Func[func(info *MatchedRuleInfoDebug)]) (ret js.Void, exception js.Any, ok bool) { 3186 ok = js.True == bindings.TryOnRuleMatchedDebug( 3187 js.Pointer(&ret), js.Pointer(&exception), 3188 callback.Ref(), 3189 ) 3190 3191 return 3192 } 3193 3194 // HasFuncOffRuleMatchedDebug returns true if the function "WEBEXT.declarativeNetRequest.onRuleMatchedDebug.removeListener" exists. 3195 func HasFuncOffRuleMatchedDebug() bool { 3196 return js.True == bindings.HasFuncOffRuleMatchedDebug() 3197 } 3198 3199 // FuncOffRuleMatchedDebug returns the function "WEBEXT.declarativeNetRequest.onRuleMatchedDebug.removeListener". 3200 func FuncOffRuleMatchedDebug() (fn js.Func[func(callback js.Func[func(info *MatchedRuleInfoDebug)])]) { 3201 bindings.FuncOffRuleMatchedDebug( 3202 js.Pointer(&fn), 3203 ) 3204 return 3205 } 3206 3207 // OffRuleMatchedDebug calls the function "WEBEXT.declarativeNetRequest.onRuleMatchedDebug.removeListener" directly. 3208 func OffRuleMatchedDebug(callback js.Func[func(info *MatchedRuleInfoDebug)]) (ret js.Void) { 3209 bindings.CallOffRuleMatchedDebug( 3210 js.Pointer(&ret), 3211 callback.Ref(), 3212 ) 3213 3214 return 3215 } 3216 3217 // TryOffRuleMatchedDebug calls the function "WEBEXT.declarativeNetRequest.onRuleMatchedDebug.removeListener" 3218 // in a try/catch block and returns (_, err, ok = false) when it went through 3219 // the catch clause. 3220 func TryOffRuleMatchedDebug(callback js.Func[func(info *MatchedRuleInfoDebug)]) (ret js.Void, exception js.Any, ok bool) { 3221 ok = js.True == bindings.TryOffRuleMatchedDebug( 3222 js.Pointer(&ret), js.Pointer(&exception), 3223 callback.Ref(), 3224 ) 3225 3226 return 3227 } 3228 3229 // HasFuncHasOnRuleMatchedDebug returns true if the function "WEBEXT.declarativeNetRequest.onRuleMatchedDebug.hasListener" exists. 3230 func HasFuncHasOnRuleMatchedDebug() bool { 3231 return js.True == bindings.HasFuncHasOnRuleMatchedDebug() 3232 } 3233 3234 // FuncHasOnRuleMatchedDebug returns the function "WEBEXT.declarativeNetRequest.onRuleMatchedDebug.hasListener". 3235 func FuncHasOnRuleMatchedDebug() (fn js.Func[func(callback js.Func[func(info *MatchedRuleInfoDebug)]) bool]) { 3236 bindings.FuncHasOnRuleMatchedDebug( 3237 js.Pointer(&fn), 3238 ) 3239 return 3240 } 3241 3242 // HasOnRuleMatchedDebug calls the function "WEBEXT.declarativeNetRequest.onRuleMatchedDebug.hasListener" directly. 3243 func HasOnRuleMatchedDebug(callback js.Func[func(info *MatchedRuleInfoDebug)]) (ret bool) { 3244 bindings.CallHasOnRuleMatchedDebug( 3245 js.Pointer(&ret), 3246 callback.Ref(), 3247 ) 3248 3249 return 3250 } 3251 3252 // TryHasOnRuleMatchedDebug calls the function "WEBEXT.declarativeNetRequest.onRuleMatchedDebug.hasListener" 3253 // in a try/catch block and returns (_, err, ok = false) when it went through 3254 // the catch clause. 3255 func TryHasOnRuleMatchedDebug(callback js.Func[func(info *MatchedRuleInfoDebug)]) (ret bool, exception js.Any, ok bool) { 3256 ok = js.True == bindings.TryHasOnRuleMatchedDebug( 3257 js.Pointer(&ret), js.Pointer(&exception), 3258 callback.Ref(), 3259 ) 3260 3261 return 3262 } 3263 3264 // HasFuncSetExtensionActionOptions returns true if the function "WEBEXT.declarativeNetRequest.setExtensionActionOptions" exists. 3265 func HasFuncSetExtensionActionOptions() bool { 3266 return js.True == bindings.HasFuncSetExtensionActionOptions() 3267 } 3268 3269 // FuncSetExtensionActionOptions returns the function "WEBEXT.declarativeNetRequest.setExtensionActionOptions". 3270 func FuncSetExtensionActionOptions() (fn js.Func[func(options ExtensionActionOptions) js.Promise[js.Void]]) { 3271 bindings.FuncSetExtensionActionOptions( 3272 js.Pointer(&fn), 3273 ) 3274 return 3275 } 3276 3277 // SetExtensionActionOptions calls the function "WEBEXT.declarativeNetRequest.setExtensionActionOptions" directly. 3278 func SetExtensionActionOptions(options ExtensionActionOptions) (ret js.Promise[js.Void]) { 3279 bindings.CallSetExtensionActionOptions( 3280 js.Pointer(&ret), 3281 js.Pointer(&options), 3282 ) 3283 3284 return 3285 } 3286 3287 // TrySetExtensionActionOptions calls the function "WEBEXT.declarativeNetRequest.setExtensionActionOptions" 3288 // in a try/catch block and returns (_, err, ok = false) when it went through 3289 // the catch clause. 3290 func TrySetExtensionActionOptions(options ExtensionActionOptions) (ret js.Promise[js.Void], exception js.Any, ok bool) { 3291 ok = js.True == bindings.TrySetExtensionActionOptions( 3292 js.Pointer(&ret), js.Pointer(&exception), 3293 js.Pointer(&options), 3294 ) 3295 3296 return 3297 } 3298 3299 // HasFuncTestMatchOutcome returns true if the function "WEBEXT.declarativeNetRequest.testMatchOutcome" exists. 3300 func HasFuncTestMatchOutcome() bool { 3301 return js.True == bindings.HasFuncTestMatchOutcome() 3302 } 3303 3304 // FuncTestMatchOutcome returns the function "WEBEXT.declarativeNetRequest.testMatchOutcome". 3305 func FuncTestMatchOutcome() (fn js.Func[func(request TestMatchRequestDetails) js.Promise[TestMatchOutcomeResult]]) { 3306 bindings.FuncTestMatchOutcome( 3307 js.Pointer(&fn), 3308 ) 3309 return 3310 } 3311 3312 // TestMatchOutcome calls the function "WEBEXT.declarativeNetRequest.testMatchOutcome" directly. 3313 func TestMatchOutcome(request TestMatchRequestDetails) (ret js.Promise[TestMatchOutcomeResult]) { 3314 bindings.CallTestMatchOutcome( 3315 js.Pointer(&ret), 3316 js.Pointer(&request), 3317 ) 3318 3319 return 3320 } 3321 3322 // TryTestMatchOutcome calls the function "WEBEXT.declarativeNetRequest.testMatchOutcome" 3323 // in a try/catch block and returns (_, err, ok = false) when it went through 3324 // the catch clause. 3325 func TryTestMatchOutcome(request TestMatchRequestDetails) (ret js.Promise[TestMatchOutcomeResult], exception js.Any, ok bool) { 3326 ok = js.True == bindings.TryTestMatchOutcome( 3327 js.Pointer(&ret), js.Pointer(&exception), 3328 js.Pointer(&request), 3329 ) 3330 3331 return 3332 } 3333 3334 // HasFuncUpdateDynamicRules returns true if the function "WEBEXT.declarativeNetRequest.updateDynamicRules" exists. 3335 func HasFuncUpdateDynamicRules() bool { 3336 return js.True == bindings.HasFuncUpdateDynamicRules() 3337 } 3338 3339 // FuncUpdateDynamicRules returns the function "WEBEXT.declarativeNetRequest.updateDynamicRules". 3340 func FuncUpdateDynamicRules() (fn js.Func[func(options UpdateRuleOptions) js.Promise[js.Void]]) { 3341 bindings.FuncUpdateDynamicRules( 3342 js.Pointer(&fn), 3343 ) 3344 return 3345 } 3346 3347 // UpdateDynamicRules calls the function "WEBEXT.declarativeNetRequest.updateDynamicRules" directly. 3348 func UpdateDynamicRules(options UpdateRuleOptions) (ret js.Promise[js.Void]) { 3349 bindings.CallUpdateDynamicRules( 3350 js.Pointer(&ret), 3351 js.Pointer(&options), 3352 ) 3353 3354 return 3355 } 3356 3357 // TryUpdateDynamicRules calls the function "WEBEXT.declarativeNetRequest.updateDynamicRules" 3358 // in a try/catch block and returns (_, err, ok = false) when it went through 3359 // the catch clause. 3360 func TryUpdateDynamicRules(options UpdateRuleOptions) (ret js.Promise[js.Void], exception js.Any, ok bool) { 3361 ok = js.True == bindings.TryUpdateDynamicRules( 3362 js.Pointer(&ret), js.Pointer(&exception), 3363 js.Pointer(&options), 3364 ) 3365 3366 return 3367 } 3368 3369 // HasFuncUpdateEnabledRulesets returns true if the function "WEBEXT.declarativeNetRequest.updateEnabledRulesets" exists. 3370 func HasFuncUpdateEnabledRulesets() bool { 3371 return js.True == bindings.HasFuncUpdateEnabledRulesets() 3372 } 3373 3374 // FuncUpdateEnabledRulesets returns the function "WEBEXT.declarativeNetRequest.updateEnabledRulesets". 3375 func FuncUpdateEnabledRulesets() (fn js.Func[func(options UpdateRulesetOptions) js.Promise[js.Void]]) { 3376 bindings.FuncUpdateEnabledRulesets( 3377 js.Pointer(&fn), 3378 ) 3379 return 3380 } 3381 3382 // UpdateEnabledRulesets calls the function "WEBEXT.declarativeNetRequest.updateEnabledRulesets" directly. 3383 func UpdateEnabledRulesets(options UpdateRulesetOptions) (ret js.Promise[js.Void]) { 3384 bindings.CallUpdateEnabledRulesets( 3385 js.Pointer(&ret), 3386 js.Pointer(&options), 3387 ) 3388 3389 return 3390 } 3391 3392 // TryUpdateEnabledRulesets calls the function "WEBEXT.declarativeNetRequest.updateEnabledRulesets" 3393 // in a try/catch block and returns (_, err, ok = false) when it went through 3394 // the catch clause. 3395 func TryUpdateEnabledRulesets(options UpdateRulesetOptions) (ret js.Promise[js.Void], exception js.Any, ok bool) { 3396 ok = js.True == bindings.TryUpdateEnabledRulesets( 3397 js.Pointer(&ret), js.Pointer(&exception), 3398 js.Pointer(&options), 3399 ) 3400 3401 return 3402 } 3403 3404 // HasFuncUpdateSessionRules returns true if the function "WEBEXT.declarativeNetRequest.updateSessionRules" exists. 3405 func HasFuncUpdateSessionRules() bool { 3406 return js.True == bindings.HasFuncUpdateSessionRules() 3407 } 3408 3409 // FuncUpdateSessionRules returns the function "WEBEXT.declarativeNetRequest.updateSessionRules". 3410 func FuncUpdateSessionRules() (fn js.Func[func(options UpdateRuleOptions) js.Promise[js.Void]]) { 3411 bindings.FuncUpdateSessionRules( 3412 js.Pointer(&fn), 3413 ) 3414 return 3415 } 3416 3417 // UpdateSessionRules calls the function "WEBEXT.declarativeNetRequest.updateSessionRules" directly. 3418 func UpdateSessionRules(options UpdateRuleOptions) (ret js.Promise[js.Void]) { 3419 bindings.CallUpdateSessionRules( 3420 js.Pointer(&ret), 3421 js.Pointer(&options), 3422 ) 3423 3424 return 3425 } 3426 3427 // TryUpdateSessionRules calls the function "WEBEXT.declarativeNetRequest.updateSessionRules" 3428 // in a try/catch block and returns (_, err, ok = false) when it went through 3429 // the catch clause. 3430 func TryUpdateSessionRules(options UpdateRuleOptions) (ret js.Promise[js.Void], exception js.Any, ok bool) { 3431 ok = js.True == bindings.TryUpdateSessionRules( 3432 js.Pointer(&ret), js.Pointer(&exception), 3433 js.Pointer(&options), 3434 ) 3435 3436 return 3437 } 3438 3439 // HasFuncUpdateStaticRules returns true if the function "WEBEXT.declarativeNetRequest.updateStaticRules" exists. 3440 func HasFuncUpdateStaticRules() bool { 3441 return js.True == bindings.HasFuncUpdateStaticRules() 3442 } 3443 3444 // FuncUpdateStaticRules returns the function "WEBEXT.declarativeNetRequest.updateStaticRules". 3445 func FuncUpdateStaticRules() (fn js.Func[func(options UpdateStaticRulesOptions) js.Promise[js.Void]]) { 3446 bindings.FuncUpdateStaticRules( 3447 js.Pointer(&fn), 3448 ) 3449 return 3450 } 3451 3452 // UpdateStaticRules calls the function "WEBEXT.declarativeNetRequest.updateStaticRules" directly. 3453 func UpdateStaticRules(options UpdateStaticRulesOptions) (ret js.Promise[js.Void]) { 3454 bindings.CallUpdateStaticRules( 3455 js.Pointer(&ret), 3456 js.Pointer(&options), 3457 ) 3458 3459 return 3460 } 3461 3462 // TryUpdateStaticRules calls the function "WEBEXT.declarativeNetRequest.updateStaticRules" 3463 // in a try/catch block and returns (_, err, ok = false) when it went through 3464 // the catch clause. 3465 func TryUpdateStaticRules(options UpdateStaticRulesOptions) (ret js.Promise[js.Void], exception js.Any, ok bool) { 3466 ok = js.True == bindings.TryUpdateStaticRules( 3467 js.Pointer(&ret), js.Pointer(&exception), 3468 js.Pointer(&options), 3469 ) 3470 3471 return 3472 }