7#pragma push_macro("None")
10#include <Ultralight/CAPI/CAPI_JSAPI.h>
11#include <Ultralight/CAPI/CAPI_String.h>
16#include <Ultralight/detail/InjectionFilter.h>
22#include <Ultralight/js/detail/Binding.h>
23#include <Ultralight/js/detail/Json.h>
24#include <Ultralight/js/detail/Schema.h>
27#include <initializer_list>
57 return static_cast<AttachFlags>(
static_cast<unsigned>(a) |
static_cast<unsigned>(b));
81 "js::AttachFlags must mirror ULJSAPIAttachFlags");
210 constexpr explicit Param(
const char* declared_name)
211 :
name(declared_name ? declared_name :
"") {}
235 constexpr explicit Doc(
const char* doc_text) :
text(doc_text) {}
243concept Annotation = std::is_same_v<std::remove_cvref_t<A>, Param>
244 || std::is_same_v<std::remove_cvref_t<A>, Doc>;
246template <
typename... Anns>
247inline constexpr size_t kArgAnnotationCount
248 = ((std::is_same_v<std::remove_cvref_t<Anns>, Param> ?
size_t { 1 } :
size_t { 0 }) + ...
251template <
typename... Anns>
252inline constexpr size_t kDocAnnotationCount
253 = ((std::is_same_v<std::remove_cvref_t<Anns>, Doc> ?
size_t { 1 } :
size_t { 0 }) + ...
256inline void CollectAnnotation(AnnotationSet& set,
const Param& annotation) {
257 if (set.name_count < AnnotationSet::kMaxNames)
258 set.names[set.name_count++] = annotation.name;
261inline void CollectAnnotation(AnnotationSet& set,
const Doc& annotation) {
262 set.doc = annotation.text;
265template <
typename... Anns>
266AnnotationSet CollectAnnotations(
const Anns&... annotations) {
268 (CollectAnnotation(set, annotations), ...);
413 : root_(root_path ? root_path :
""), api_(ulCreateJSAPI(root_path)) {
414 if (api_ && options.diagnostics != Diagnostics::Auto)
415 ulJSAPISetDiagnostics(api_,
static_cast<ULJSDiagnosticsLevel
>(options.diagnostics));
424 ~API() { ulDestroyJSAPI(api_); }
429 API(
API&& other) noexcept : root_(std::move(other.root_)), api_(other.api_) {
430 other.api_ =
nullptr;
437 if (
this != &other) {
438 ulDestroyJSAPI(api_);
439 root_ = std::move(other.root_);
441 other.api_ =
nullptr;
482 explicit operator bool()
const {
return api_ !=
nullptr; }
505 template <
typename T>
507 using U = std::decay_t<T>;
508 if constexpr (detail::IsIntrospectableCallable<U>::value) {
509 api_->Bind(path_.c_str(), std::forward<T>(rhs));
514 "an exclusive holder cannot back a live instance binding (every page "
515 "read needs its own stake): bind a shared holder such as RefPtr<T>, "
516 "std::shared_ptr<T>, or js::Eternal<T>");
518 "bind the class first: include <Ultralight/js/Class.h> and call "
519 "DefineClass<T>() before exposing an instance of it");
520 api_->BindProperty(path_.c_str(), [value = U(std::forward<T>(rhs))] {
return value; });
522 static_assert(detail::kAlwaysFalse<U>,
523 "a weak holder cannot back a live instance binding (every page read "
524 "needs a strong ownership stake): bind a shared holder such as "
525 "RefPtr<T>, or bind a method with js::Bind(weak, &T::Method)");
526 }
else if constexpr (std::is_null_pointer_v<U>) {
527 static_assert(detail::kAlwaysFalse<U>,
528 "nullptr is not a JavaScript value: use js::null for a JavaScript null");
529 }
else if constexpr (detail::kIsJsonConstant<U>
530 || std::is_convertible_v<U, std::string_view>) {
531 api_->SetConstant(path_.c_str(), std::forward<T>(rhs));
533 static_assert(detail::kAlwaysFalse<U>,
534 "this type cannot be a constant: constants are serialized to JSON "
535 "once at registration (no live context exists yet), and JSON cannot "
536 "represent it. Bind a function or property instead (js::undefined "
537 "has no JSON form; use js::null)");
539 static_assert(detail::kAlwaysFalse<U>,
540 "this value can be neither bound nor stored as a constant. Callables "
541 "must have exactly one non-template operator() (generic lambdas with "
542 "'auto' parameters cannot be introspected); constants must be one of "
543 "the JSON-serializable types (see API::SetConstant())");
556 return Binder(api_, path_ +
"." + (segment ? segment :
""));
574 template <
typename Getter,
typename Setter = std::
nullptr_t>
576 api_->BindProperty(path_.c_str(), std::forward<Getter>(get),
577 std::forward<Setter>(set));
582 Binder(
API* api, std::string path) : api_(api), path_(
std::move(path)) {}
611 template <
typename Fn,
typename... Anns>
612 requires(detail::Annotation<Anns> && ...)
613 void
Bind(const
char* path, Fn&& fn, const Anns&... annotations) {
614 using F = std::decay_t<Fn>;
615 using Traits = detail::CallableTraits<F>;
616 using Shape = detail::ParamShape<typename Traits::Params>;
617 using R =
typename Traits::Return;
619 [&]<
size_t... Is>(std::index_sequence<Is...>) {
620 (detail::ValidateParam<std::tuple_element_t<Is, typename Shape::Converted>>(), ...);
621 }(std::make_index_sequence<Shape::kCount> {});
622 constexpr size_t kNames = detail::kArgAnnotationCount<Anns...>;
623 static_assert(kNames == 0 || kNames == Shape::kCount,
624 "js::Param annotations must name every payload parameter or none (one "
625 "Param per converted parameter; CallInfo and Resolver take no name)");
626 static_assert(detail::kDocAnnotationCount<Anns...> <= 1,
627 "at most one js::Doc annotation per registration");
629 detail::AnnotationSet set = detail::CollectAnnotations(annotations...);
631 =
new detail::BoundCallable<F> { std::forward<Fn>(fn), FullPath(path), {}, {} };
633 = bound->path + detail::RenderSignature<typename Shape::Converted>(set);
634 bound->names.assign(set.names, set.names + set.name_count);
635 if constexpr (detail::HasSettableBoundPath<F>)
636 bound->fn.SetBoundPath(bound->path);
638 if constexpr (Shape::kHasResolver || detail::kIsAsyncReturn<R>) {
639 bound_ok = ulJSAPIBindAsyncFunction(api_, path, &detail::AsyncTrampoline<F>, bound,
640 &detail::DestroyBoundCallable<F>);
642 bound_ok = ulJSAPIBindFunction(api_, path, &detail::SyncTrampoline<F>, bound,
643 &detail::DestroyBoundCallable<F>);
648 detail::SchemaShapes shapes;
650 = detail::BuildCallableFragment<typename Shape::Converted, R, Shape::kHasResolver>(
652 ulJSAPISetMetadata(api_, path, fragment.c_str());
653 detail::EmitSchemaShapes(api_, shapes);
677 template <
typename T,
typename M,
typename... Anns>
678 requires(std::is_member_function_pointer_v<M> && (detail::Annotation<Anns> && ...))
679 void
Bind(const
char* path, T* receiver, M method, const Anns&... annotations) {
680 Bind(path, detail::MakeBoundMethod(receiver, method, detail::MemberFnTraits<M> {}),
712 template <
typename T>
714 using U = std::decay_t<T>;
715 if constexpr (std::is_same_v<U, const char*> || std::is_same_v<U, char*>) {
717 ulJSAPISetConstantJSON(api_, path,
"null");
718 if (ulJSAPIGetDiagnostics(api_) >= kULJSDiagnostics_Warn) {
719 std::string message = FullPath(path)
720 +
": the constant's string is a null pointer, so it was bound as null.";
721 ulJSAPIEmitDiagnostic(
nullptr, message.c_str());
726 if constexpr (std::is_null_pointer_v<U>) {
727 static_assert(detail::kAlwaysFalse<U>,
728 "nullptr is not a JavaScript value: use js::null for a JavaScript null");
729 }
else if constexpr (std::is_same_v<U, bool>) {
730 ulJSAPISetConstantBoolean(api_, path, value);
731 }
else if constexpr (std::is_arithmetic_v<U>) {
732 bool set = ulJSAPISetConstantNumber(api_, path,
static_cast<double>(value));
734 if constexpr (std::is_integral_v<U>) {
736 ulJSAPISetMetadata(api_, path,
"{\"type\":\"integer\"}");
738 }
else if constexpr (std::is_convertible_v<U, std::string_view>) {
739 std::string text { std::string_view(value) };
740 ulJSAPISetConstantString(api_, path, text.c_str());
743 detail::WriteJson(json, value);
744 bool set = ulJSAPISetConstantJSON(api_, path, json.c_str());
747 if constexpr (!std::is_same_v<U, NullType>) {
750 detail::SchemaShapes shapes;
751 std::string fragment = detail::BuildTypeFragment<U>(shapes);
752 ulJSAPISetMetadata(api_, path, fragment.c_str());
753 detail::EmitSchemaShapes(api_, shapes);
781 template <
typename T>
810 template <
typename Getter,
typename Setter = std::
nullptr_t>
811 void BindProperty(
const char* path, Getter&& get, Setter&& set =
nullptr) {
812 using G = std::decay_t<Getter>;
813 using GTraits = detail::CallableTraits<G>;
814 static_assert(std::tuple_size_v<typename GTraits::Params> == 0,
815 "a property getter takes no parameters");
816 static_assert(!std::is_void_v<typename GTraits::Return>,
817 "a property getter must return a value (a Marshalable type or "
819 if constexpr (std::is_same_v<std::decay_t<Setter>, std::nullptr_t>) {
821 void operator()()
const {}
823 using Bound = detail::BoundProperty<G, ReadOnly>;
824 auto* bound =
new Bound { std::forward<Getter>(get),
ReadOnly {}, FullPath(path) };
825 if constexpr (detail::HasSettableBoundPath<G>)
826 bound->get.SetBoundPath(bound->path);
827 if (!ulJSAPIBindProperty(api_, path, &detail::PropertyGetterThunk<Bound>,
nullptr, bound,
828 &detail::DestroyBoundProperty<Bound>))
831 using S = std::decay_t<Setter>;
832 using Bound = detail::BoundProperty<G, S>;
833 auto* bound =
new Bound { std::forward<Getter>(get), std::forward<Setter>(set),
835 if constexpr (detail::HasSettableBoundPath<G>)
836 bound->get.SetBoundPath(bound->path);
837 if constexpr (detail::HasSettableBoundPath<S>)
838 bound->set.SetBoundPath(bound->path);
839 if (!ulJSAPIBindProperty(api_, path, &detail::PropertyGetterThunk<Bound>,
840 &detail::PropertySetterThunk<Bound>, bound,
841 &detail::DestroyBoundProperty<Bound>))
845 detail::SchemaShapes shapes;
846 std::string fragment = detail::BuildTypeFragment<typename GTraits::Return>(shapes);
847 ulJSAPISetMetadata(api_, path, fragment.c_str());
848 detail::EmitSchemaShapes(api_, shapes);
880 template <
typename... Args>
882 void
Emit(const
char* event_path, Args&&... args) {
883 static_assert(
sizeof...(Args) <= 16,
"events support at most 16 arguments");
884 static_assert((!detail::kIsClassInstancePointer<Args> && ...),
885 "a raw instance pointer cannot cross a deferred boundary (delivery "
886 "happens later, on the Renderer's thread): capture an owning holder (the "
887 "class's canonical holder) or js::Eternal<T> instead");
888 static_assert((!detail::IsCallScopedView<std::decay_t<Args>>::value && ...),
889 "a std::span cannot cross a deferred boundary (delivery happens later; "
890 "the view would dangle): copy into a std::vector<E> or RefPtr<Buffer>");
891 static_assert((!std::is_base_of_v<Value, std::decay_t<Args>> && ...),
892 "a js::Value cannot be emitted (Emit delivers to every attached page, and "
893 "a value belongs to one page): emit native values instead, such as "
894 "numbers, strings, containers, or structs. A js::ArrayBuffer or "
895 "js::TypedArray from the page can't be emitted either: emit a "
896 "RefPtr<Buffer> or the bytes (eg, a std::vector<uint8_t>)");
897 using Payload = std::tuple<detail::CapturedArg<Args>...>;
898 auto* payload =
new Payload(detail::CaptureArg(std::forward<Args>(args))...);
899 ulJSAPIEmitEvent(api_, event_path, &detail::EmitArgsThunk<Payload>, payload,
900 &detail::DeleteEmitPayload<Payload>);
935 template <
typename... Args,
typename... Anns>
936 requires(detail::Annotation<Anns> && ...)
937 void
DefineEvent(const
char* event_path, const Anns&... annotations) {
938 static_assert(
sizeof...(Args) <= 16,
"events support at most 16 arguments");
940 "an event payload type has no js::TypeTraits: use a supported built-in, "
941 "make it a plain aggregate struct, or specialize js::TypeTraits for it");
942 constexpr size_t kNames = detail::kArgAnnotationCount<Anns...>;
943 static_assert(kNames == 0 || kNames ==
sizeof...(Args),
944 "js::Param annotations must name every event parameter or none");
945 static_assert(detail::kDocAnnotationCount<Anns...> <= 1,
946 "at most one js::Doc annotation per registration");
947 detail::AnnotationSet set = detail::CollectAnnotations(annotations...);
948 detail::SchemaShapes shapes;
949 std::string fragment = detail::BuildEventFragment<Args...>(shapes, set, event_path);
950 ulJSAPISetMetadata(api_,
"", fragment.c_str());
951 detail::EmitSchemaShapes(api_, shapes);
980 bool Unbind(
const char* path) {
return ulJSAPIUnbind(api_, path); }
997 ULString text = ulJSAPIGetSchema(api_);
999 = text ? std::string(ulStringGetData(text), ulStringGetLength(text)) : std::string();
1000 ulDestroyString(text);
1018 bool DumpSchema(
const char* utf8_path) {
return ulJSAPIDumpSchema(api_, utf8_path); }
1042 ulJSAPISetMetadata(api_, path, metadata_json);
1071 ulJSAPISetDiagnostics(api_,
static_cast<ULJSDiagnosticsLevel
>(level));
1082 return static_cast<Diagnostics>(ulJSAPIGetDiagnostics(api_));
1121 && view->
AttachJSAPI(api_,
static_cast<unsigned>(options.flags),
1122 options.origin_rules.data(), options.origin_rules.size());
1161 explicit API(
ULJSAPI adopted) : api_(adopted) {
1164 ULString root = ulJSAPIGetRootPath(api_);
1166 root_.assign(ulStringGetData(root), ulStringGetLength(root));
1167 ulDestroyString(root);
1171 std::string FullPath(
const char* path)
const {
1172 std::string full = root_;
1174 full += path ? path :
"";
1225 : api_(ulCreateJSAPIBorrowedRef(api.raw())), path_(path ? path :
"") {}
1232 ulJSAPIUnbind(api_, path_.c_str());
1233 ulDestroyJSAPI(api_);
1241 : api_(other.api_), path_(std::move(other.path_)) {
1242 other.api_ =
nullptr;
1249 if (
this != &other) {
1251 ulJSAPIUnbind(api_, path_.c_str());
1252 ulDestroyJSAPI(api_);
1255 path_ = std::move(other.path_);
1256 other.api_ =
nullptr;
1271 ulDestroyJSAPI(api_);
1280 explicit operator bool()
const {
return api_ !=
nullptr; }
1328 return { view, request.api, request.origin, request.is_main_frame, request.rules_allow };
1330 static void ReportException(
const char* what) {
1331 std::string message =
"js::SetInjectionFilter: the filter threw a C++ exception, so the "
1332 "JavaScript API was withheld from the page";
1337 ulJSAPIEmitDiagnostic(
nullptr, message.c_str());
1385template <
typename F>
1387 using Fn = std::decay_t<F>;
1388 static_assert(std::is_invocable_r_v<bool, Fn&, const InjectionRequest&>,
1389 "js::SetInjectionFilter takes a callable invocable as "
1390 "bool(const js::InjectionRequest&)");
1393 using Adapter = ultralight::detail::InjectionFilterAdapter<Fn, ULJSAPIInjectionRequest>;
1433template <
typename T,
typename M>
1434 requires std::is_member_function_pointer_v<M>
1436 return detail::MakeBoundMethod(instance, method, detail::MemberFnTraits<M> {});
1471template <
typename H,
typename M>
1472 requires((Holder<H> || LockableHolder<H>) && std::is_member_function_pointer_v<M>)
1475 static_assert(std::is_base_of_v<typename detail::MemberFnTraits<M>::Class, T>,
1476 "the member pointer must belong to the holder's element type (or a base "
1480 "js::Bind does not take exclusive holders: passing a unique_ptr would "
1481 "silently move ownership into the binding. Keep ownership and borrow "
1482 "with js::Bind(ptr.get(), &T::Method), or bind a shared holder");
1484 return detail::MakeHolderBoundMethod<H, T>(std::move(holder), method,
1485 detail::MemberFnTraits<M> {});
1491#pragma pop_macro("None")
struct C_JSAPI * ULJSAPI
Opaque handle to a set of native JavaScript bindings.
Definition View.h:32
struct ULJSAPIInjectionRequest ULJSAPIInjectionRequest
The details an API injection filter decides on.
Definition View.h:60
A list of origin patterns that controls which pages get an attached API.
Definition OriginRules.h:90
Web-page container rendered to an offscreen surface.
Definition View.h:483
virtual bool AttachJSAPI(ULJSAPI api, unsigned flags=0, const char *const *origin_rules=nullptr, size_t num_origin_rules=0)=0
Attach a JavaScript API to this View.
virtual void DetachJSAPI(ULJSAPI api)=0
Detach a JavaScript API from this View.
virtual void SetJSAPIInjectionFilter(JSAPIInjectionFilter filter, void *user_data, void(*destroy_user_data)(void *))=0
Set a filter that decides whether an attached API's bindings are added to a page.
The assignable path that operator[] returns (see Binding Functions and Values in the class overview).
Definition API.h:492
Binder(const Binder &)=delete
Binder & operator=(T &&rhs) &&
Bind a callable or value at this path (the type of rhs decides what's bound, see Binding Functions an...
Definition API.h:506
friend class API
Definition API.h:581
Binder & operator=(const Binder &)=delete
Binder operator[](const char *segment) &&
Get the Binder for a child path (api["fs"]["readFile"] is api["fs.readFile"]).
Definition API.h:555
void BindProperty(Getter &&get, Setter &&set=nullptr) &&
Bind a property with a getter (and optional setter) at this path (see API::BindProperty()):
Definition API.h:575
A global JavaScript namespace for native functions and data.
Definition API.h:398
void BindProperty(const char *path, Getter &&get, Setter &&set=nullptr)
Bind a property with a getter and an optional setter.
Definition API.h:811
void DefineEvent(const char *event_path, const Anns &... annotations)
Declare an event and its payload types.
Definition API.h:937
Diagnostics diagnostics() const
Get the effective diagnostics level.
Definition API.h:1081
API & operator=(API &&other) noexcept
Move assignment (releases the current handle, and other becomes empty).
Definition API.h:436
bool Unbind(const char *path)
Remove the binding at a path, along with its metadata.
Definition API.h:980
API(const char *root_path, const APIOptions &options={})
Create an API rooted at a global namespace path.
Definition API.h:412
void set_diagnostics(Diagnostics level)
Set the diagnostics level (see Diagnostics).
Definition API.h:1070
ULJSAPI raw() const
Get the underlying handle, for calls into the C API.
Definition API.h:1145
static API Adopt(ULJSAPI api)
Wrap a handle you own from the C API, taking ownership of it (eg, the result of ulCreateJSAPI()).
Definition API.h:460
ClassBuilder< T > DefineClass(const char *path)
Define a native class at a path, so page script can call its methods, read its properties,...
Definition Class.h:683
void Bind(const char *path, Fn &&fn, const Anns &... annotations)
Bind a callable at a path (the explicit form of api[path] = fn, which also takes annotations).
Definition API.h:613
~API()
Destructor (releases this handle).
Definition API.h:424
bool AttachTo(View *view, const AttachOptions &options={})
Attach this API to a View.
Definition API.h:1119
void Emit(const char *event_path, Args &&... args)
Emit an event to the page listeners subscribed with on or once (see Emitting Events in the class over...
Definition API.h:882
API(API &&other) noexcept
Move constructor (other becomes empty).
Definition API.h:429
API & operator=(const API &)=delete
bool DumpSchema(const char *utf8_path)
Write the JSON from schema() to a file.
Definition API.h:1018
Binder operator[](const char *path)
Get the Binder for a path relative to the root (see Binder).
Definition API.h:594
void SetConstant(const char *path, T &&value)
Set a constant at a path (the explicit form of api[path] = value).
Definition API.h:713
static API FromBorrowed(ULJSAPI api)
Wrap a handle someone else owns, without owning the API (eg, the api member of a js::InjectionRequest...
Definition API.h:476
void DetachFrom(View *view)
Detach this API from a View.
Definition API.h:1135
ULJSAPI LeakRef()
Give up ownership of the underlying handle without releasing it (this API becomes empty).
Definition API.h:1152
void SetMetadata(const char *path, const char *metadata_json)
Add schema metadata (eg, documentation) to the entry at a path.
Definition API.h:1041
std::string schema() const
Get the API's schema as JSON.
Definition API.h:996
BindingGuard(const BindingGuard &)=delete
BindingGuard()=default
Create an unarmed guard (removes nothing).
BindingGuard(BindingGuard &&other) noexcept
Move constructor (other becomes unarmed).
Definition API.h:1240
BindingGuard & operator=(const BindingGuard &)=delete
void Release()
Disarm the guard without removing the binding (it stays until you unbind it or the API is destroyed).
Definition API.h:1269
BindingGuard(const API &api, const char *path)
Create an armed guard that removes the binding at path when destroyed.
Definition API.h:1224
~BindingGuard()
Destructor (removes the binding if the guard is armed).
Definition API.h:1230
BindingGuard & operator=(BindingGuard &&other) noexcept
Move assignment (removes the current binding first if armed, and other becomes unarmed).
Definition API.h:1248
Builder for exposing a C++ class to JavaScript.
Definition Class.h:277
Whether or not H (ignoring const and references) is an owning holder: its ultralight::HolderTraits de...
Definition Holder.h:102
Whether or not H (ignoring const and references) is a weak holder: its ultralight::HolderTraits decla...
Definition Holder.h:113
Whether or not js::TypeTraits can convert T (ignoring const, volatile, and references).
Definition TypeTraits.h:275
Definition StringSTL.h:166
Type-checked JavaScript bridge between C++ and web pages.
Definition JSInterop.h:141
DiagnosticsLevel Diagnostics
The diagnostics levels for an API.
Definition API.h:150
auto Bind(T *instance, M method)
Bind a member function to an instance without writing a lambda.
Definition API.h:1435
void SetInjectionFilter(View *view, F &&filter)
Set a View's API filter with a C++ callable (the typed form of View::SetJSAPIInjectionFilter()).
Definition API.h:1386
constexpr AttachFlags operator|(AttachFlags a, AttachFlags b)
Combine attach flags.
Definition API.h:56
@ ReadOnly
Script can't change its value.
Definition Value.h:74
void ClearInjectionFilter(View *view)
Remove a View's API filter, so the origin rules alone decide which pages get the bindings.
Definition API.h:1405
constexpr AttachFlags & operator|=(AttachFlags &a, AttachFlags b)
Add attach flags to a.
Definition API.h:65
AttachFlags
The flags for API::AttachTo() (the C++ form of ULJSAPIAttachFlags).
Definition API.h:44
@ AllFrames
Also add the bindings to subframes.
Definition API.h:46
@ None
Main frame only, with frozen namespace objects.
Definition API.h:45
@ Mutable
Don't freeze the namespace objects (page script can change or replace the bindings).
Definition API.h:47
constexpr AttachFlags AllFrames
Shorthand for AttachFlags::AllFrames.
Definition API.h:72
constexpr AttachFlags Mutable
Shorthand for AttachFlags::Mutable.
Definition API.h:77
Root namespace for every public Ultralight type, function, and enumeration.
DiagnosticsLevel
How much checking and warning the library does for mistakes made through one of its APIs.
Definition DiagnosticsLevel.h:18
@ None
Definition Anchor.h:36
@ Shared
Copies share ownership (eg, RefPtr), or the instance is never destroyed (js::Eternal).
Definition HolderTraits.h:20
Traits template that lets the library hold objects through custom smart pointers.
Definition HolderTraits.h:156
Options for creating an API.
Definition API.h:159
Diagnostics diagnostics
The diagnostics level.
Definition API.h:166
Options for API::AttachTo().
Definition API.h:91
OriginRules origin_rules
The origin rules for the pages that get the bindings.
Definition API.h:101
AttachFlags flags
The attach flags (see AttachFlags).
Definition API.h:95
const char * text
The documentation text.
Definition API.h:228
constexpr Doc(const char *doc_text)
Create a documentation annotation.
Definition API.h:235
The details an API injection filter decides on (see SetInjectionFilter()).
Definition API.h:1292
const char * origin
The page's security origin, serialized (eg, "https://example.com", or "null" for an opaque origin).
Definition API.h:1308
bool rules_allow
Whether or not the origin rules allow the page.
Definition API.h:1318
bool is_main_frame
Whether or not the page is in the View's main frame.
Definition API.h:1313
ULJSAPI api
The API being decided on.
Definition API.h:1302
View * view
The View loading the page (the View you set the filter on).
Definition API.h:1296
constexpr Param(const char *declared_name)
Create a parameter name annotation.
Definition API.h:210
const char * name
The parameter name.
Definition API.h:203