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>
58 return static_cast<AttachFlags>(
static_cast<unsigned>(a) |
static_cast<unsigned>(b));
82 "js::AttachFlags must mirror ULJSAPIAttachFlags");
211 constexpr explicit Param(
const char* declared_name)
212 :
name(declared_name ? declared_name :
"") {}
236 constexpr explicit Doc(
const char* doc_text) :
text(doc_text) {}
244concept Annotation = std::is_same_v<std::remove_cvref_t<A>, Param>
245 || std::is_same_v<std::remove_cvref_t<A>, Doc>;
247template <
typename... Anns>
248inline constexpr size_t kArgAnnotationCount
249 = ((std::is_same_v<std::remove_cvref_t<Anns>, Param> ?
size_t { 1 } :
size_t { 0 }) + ...
252template <
typename... Anns>
253inline constexpr size_t kDocAnnotationCount
254 = ((std::is_same_v<std::remove_cvref_t<Anns>, Doc> ?
size_t { 1 } :
size_t { 0 }) + ...
257inline void CollectAnnotation(AnnotationSet& set,
const Param& annotation) {
258 if (set.name_count < AnnotationSet::kMaxNames)
259 set.names[set.name_count++] = annotation.name;
262inline void CollectAnnotation(AnnotationSet& set,
const Doc& annotation) {
263 set.doc = annotation.text;
266template <
typename... Anns>
267AnnotationSet CollectAnnotations(
const Anns&... annotations) {
269 (CollectAnnotation(set, annotations), ...);
414 : root_(root_path ? root_path :
""), api_(ulCreateJSAPI(root_path)) {
415 if (api_ && options.diagnostics != Diagnostics::Auto)
416 ulJSAPISetDiagnostics(api_,
static_cast<ULJSDiagnosticsLevel
>(options.diagnostics));
425 ~API() { ulDestroyJSAPI(api_); }
430 API(
API&& other) noexcept : root_(std::move(other.root_)), api_(other.api_) {
431 other.api_ =
nullptr;
438 if (
this != &other) {
439 ulDestroyJSAPI(api_);
440 root_ = std::move(other.root_);
442 other.api_ =
nullptr;
483 explicit operator bool()
const {
return api_ !=
nullptr; }
506 template <
typename T>
508 using U = std::decay_t<T>;
509 if constexpr (detail::IsIntrospectableCallable<U>::value) {
510 api_->Bind(path_.c_str(), std::forward<T>(rhs));
515 "an exclusive holder cannot back a live instance binding (every page "
516 "read needs its own stake): bind a shared holder such as RefPtr<T>, "
517 "std::shared_ptr<T>, or js::Eternal<T>");
519 "bind the class first: include <Ultralight/js/Class.h> and call "
520 "DefineClass<T>() before exposing an instance of it");
521 api_->BindProperty(path_.c_str(), [value = U(std::forward<T>(rhs))] {
return value; });
523 static_assert(detail::kAlwaysFalse<U>,
524 "a weak holder cannot back a live instance binding (every page read "
525 "needs a strong ownership stake): bind a shared holder such as "
526 "RefPtr<T>, or bind a method with js::Bind(weak, &T::Method)");
527 }
else if constexpr (std::is_null_pointer_v<U>) {
528 static_assert(detail::kAlwaysFalse<U>,
529 "nullptr is not a JavaScript value: use js::null for a JavaScript null");
530 }
else if constexpr (detail::kIsJsonConstant<U>
531 || std::is_convertible_v<U, std::string_view>) {
532 api_->SetConstant(path_.c_str(), std::forward<T>(rhs));
534 static_assert(detail::kAlwaysFalse<U>,
535 "this type cannot be a constant: constants are serialized to JSON "
536 "once at registration (no live context exists yet), and JSON cannot "
537 "represent it. Bind a function or property instead (js::undefined "
538 "has no JSON form; use js::null)");
540 static_assert(detail::kAlwaysFalse<U>,
541 "this value can be neither bound nor stored as a constant. Callables "
542 "must have exactly one non-template operator() (generic lambdas with "
543 "'auto' parameters cannot be introspected); constants must be one of "
544 "the JSON-serializable types (see API::SetConstant())");
557 return Binder(api_, path_ +
"." + (segment ? segment :
""));
575 template <
typename Getter,
typename Setter = std::
nullptr_t>
577 api_->BindProperty(path_.c_str(), std::forward<Getter>(get),
578 std::forward<Setter>(set));
583 Binder(
API* api, std::string path) : api_(api), path_(
std::move(path)) {}
612 template <
typename Fn,
typename... Anns>
613 requires(detail::Annotation<Anns> && ...)
614 void
Bind(const
char* path, Fn&& fn, const Anns&... annotations) {
615 using F = std::decay_t<Fn>;
616 using Traits = detail::CallableTraits<F>;
617 using Shape = detail::ParamShape<typename Traits::Params>;
618 using R =
typename Traits::Return;
620 [&]<
size_t... Is>(std::index_sequence<Is...>) {
621 (detail::ValidateParam<std::tuple_element_t<Is, typename Shape::Converted>>(), ...);
622 }(std::make_index_sequence<Shape::kCount> {});
623 constexpr size_t kNames = detail::kArgAnnotationCount<Anns...>;
624 static_assert(kNames == 0 || kNames == Shape::kCount,
625 "js::Param annotations must name every payload parameter or none (one "
626 "Param per converted parameter; CallInfo and Resolver take no name)");
627 static_assert(detail::kDocAnnotationCount<Anns...> <= 1,
628 "at most one js::Doc annotation per registration");
630 detail::AnnotationSet set = detail::CollectAnnotations(annotations...);
632 =
new detail::BoundCallable<F> { std::forward<Fn>(fn), FullPath(path), {}, {} };
634 = bound->path + detail::RenderSignature<typename Shape::Converted>(set);
635 bound->names.assign(set.names, set.names + set.name_count);
636 if constexpr (detail::HasSettableBoundPath<F>)
637 bound->fn.SetBoundPath(bound->path);
639 if constexpr (Shape::kHasResolver || detail::kIsAsyncReturn<R>) {
640 bound_ok = ulJSAPIBindAsyncFunction(api_, path, &detail::AsyncTrampoline<F>, bound,
641 &detail::DestroyBoundCallable<F>);
643 bound_ok = ulJSAPIBindFunction(api_, path, &detail::SyncTrampoline<F>, bound,
644 &detail::DestroyBoundCallable<F>);
649 detail::SchemaShapes shapes;
651 = detail::BuildCallableFragment<typename Shape::Converted, R, Shape::kHasResolver>(
653 ulJSAPISetMetadata(api_, path, fragment.c_str());
654 detail::EmitSchemaShapes(api_, shapes);
678 template <
typename T,
typename M,
typename... Anns>
679 requires(std::is_member_function_pointer_v<M> && (detail::Annotation<Anns> && ...))
680 void
Bind(const
char* path, T* receiver, M method, const Anns&... annotations) {
681 Bind(path, detail::MakeBoundMethod(receiver, method, detail::MemberFnTraits<M> {}),
713 template <
typename T>
715 using U = std::decay_t<T>;
716 if constexpr (std::is_same_v<U, const char*> || std::is_same_v<U, char*>) {
718 ulJSAPISetConstantJSON(api_, path,
"null");
719 if (ulJSAPIGetDiagnostics(api_) >= kULJSDiagnostics_Warn) {
720 std::string message = FullPath(path)
721 +
": the constant's string is a null pointer, so it was bound as null.";
722 ulJSAPIEmitDiagnostic(
nullptr, message.c_str());
727 if constexpr (std::is_null_pointer_v<U>) {
728 static_assert(detail::kAlwaysFalse<U>,
729 "nullptr is not a JavaScript value: use js::null for a JavaScript null");
730 }
else if constexpr (std::is_same_v<U, bool>) {
731 ulJSAPISetConstantBoolean(api_, path, value);
732 }
else if constexpr (std::is_arithmetic_v<U>) {
733 bool set = ulJSAPISetConstantNumber(api_, path,
static_cast<double>(value));
735 if constexpr (std::is_integral_v<U>) {
737 ulJSAPISetMetadata(api_, path,
"{\"type\":\"integer\"}");
739 }
else if constexpr (std::is_convertible_v<U, std::string_view>) {
740 std::string text { std::string_view(value) };
741 ulJSAPISetConstantString(api_, path, text.c_str());
744 detail::WriteJson(json, value);
745 bool set = ulJSAPISetConstantJSON(api_, path, json.c_str());
748 if constexpr (!std::is_same_v<U, NullType>) {
751 detail::SchemaShapes shapes;
752 std::string fragment = detail::BuildTypeFragment<U>(shapes);
753 ulJSAPISetMetadata(api_, path, fragment.c_str());
754 detail::EmitSchemaShapes(api_, shapes);
782 template <
typename T>
811 template <
typename Getter,
typename Setter = std::
nullptr_t>
812 void BindProperty(
const char* path, Getter&& get, Setter&& set =
nullptr) {
813 using G = std::decay_t<Getter>;
814 using GTraits = detail::CallableTraits<G>;
815 static_assert(std::tuple_size_v<typename GTraits::Params> == 0,
816 "a property getter takes no parameters");
817 static_assert(!std::is_void_v<typename GTraits::Return>,
818 "a property getter must return a value (a Marshalable type or "
820 if constexpr (std::is_same_v<std::decay_t<Setter>, std::nullptr_t>) {
822 void operator()()
const {}
824 using Bound = detail::BoundProperty<G, ReadOnly>;
825 auto* bound =
new Bound { std::forward<Getter>(get),
ReadOnly {}, FullPath(path) };
826 if constexpr (detail::HasSettableBoundPath<G>)
827 bound->get.SetBoundPath(bound->path);
828 if (!ulJSAPIBindProperty(api_, path, &detail::PropertyGetterThunk<Bound>,
nullptr, bound,
829 &detail::DestroyBoundProperty<Bound>))
832 using S = std::decay_t<Setter>;
833 using Bound = detail::BoundProperty<G, S>;
834 auto* bound =
new Bound { std::forward<Getter>(get), std::forward<Setter>(set),
836 if constexpr (detail::HasSettableBoundPath<G>)
837 bound->get.SetBoundPath(bound->path);
838 if constexpr (detail::HasSettableBoundPath<S>)
839 bound->set.SetBoundPath(bound->path);
840 if (!ulJSAPIBindProperty(api_, path, &detail::PropertyGetterThunk<Bound>,
841 &detail::PropertySetterThunk<Bound>, bound,
842 &detail::DestroyBoundProperty<Bound>))
846 detail::SchemaShapes shapes;
847 std::string fragment = detail::BuildTypeFragment<typename GTraits::Return>(shapes);
848 ulJSAPISetMetadata(api_, path, fragment.c_str());
849 detail::EmitSchemaShapes(api_, shapes);
881 template <
typename... Args>
883 void
Emit(const
char* event_path, Args&&... args) {
884 static_assert(
sizeof...(Args) <= 16,
"events support at most 16 arguments");
885 static_assert((!detail::kIsClassInstancePointer<Args> && ...),
886 "a raw instance pointer cannot cross a deferred boundary (delivery "
887 "happens later, on the Renderer's thread): capture an owning holder (the "
888 "class's canonical holder) or js::Eternal<T> instead");
889 static_assert((!detail::IsCallScopedView<std::decay_t<Args>>::value && ...),
890 "a std::span cannot cross a deferred boundary (delivery happens later; "
891 "the view would dangle): copy into a std::vector<E> or RefPtr<Buffer>");
892 static_assert((!std::is_base_of_v<Value, std::decay_t<Args>> && ...),
893 "a js::Value cannot be emitted (Emit delivers to every attached page, and "
894 "a value belongs to one page): emit native values instead, such as "
895 "numbers, strings, containers, or structs. A js::ArrayBuffer or "
896 "js::TypedArray from the page can't be emitted either: emit a "
897 "RefPtr<Buffer> or the bytes (eg, a std::vector<uint8_t>)");
898 using Payload = std::tuple<detail::CapturedArg<Args>...>;
899 auto* payload =
new Payload(detail::CaptureArg(std::forward<Args>(args))...);
900 ulJSAPIEmitEvent(api_, event_path, &detail::EmitArgsThunk<Payload>, payload,
901 &detail::DeleteEmitPayload<Payload>);
936 template <
typename... Args,
typename... Anns>
937 requires(detail::Annotation<Anns> && ...)
938 void
DefineEvent(const
char* event_path, const Anns&... annotations) {
939 static_assert(
sizeof...(Args) <= 16,
"events support at most 16 arguments");
941 "an event payload type has no js::TypeTraits: use a supported built-in, "
942 "make it a plain aggregate struct, or specialize js::TypeTraits for it");
943 constexpr size_t kNames = detail::kArgAnnotationCount<Anns...>;
944 static_assert(kNames == 0 || kNames ==
sizeof...(Args),
945 "js::Param annotations must name every event parameter or none");
946 static_assert(detail::kDocAnnotationCount<Anns...> <= 1,
947 "at most one js::Doc annotation per registration");
948 detail::AnnotationSet set = detail::CollectAnnotations(annotations...);
949 detail::SchemaShapes shapes;
950 std::string fragment = detail::BuildEventFragment<Args...>(shapes, set, event_path);
951 ulJSAPISetMetadata(api_,
"", fragment.c_str());
952 detail::EmitSchemaShapes(api_, shapes);
985 bool Unbind(
const char* path) {
return ulJSAPIUnbind(api_, path); }
1002 ULString text = ulJSAPIGetSchema(api_);
1004 = text ? std::string(ulStringGetData(text), ulStringGetLength(text)) : std::string();
1005 ulDestroyString(text);
1023 bool DumpSchema(
const char* utf8_path) {
return ulJSAPIDumpSchema(api_, utf8_path); }
1047 ulJSAPISetMetadata(api_, path, metadata_json);
1076 ulJSAPISetDiagnostics(api_,
static_cast<ULJSDiagnosticsLevel
>(level));
1087 return static_cast<Diagnostics>(ulJSAPIGetDiagnostics(api_));
1126 && view->
AttachJSAPI(api_,
static_cast<unsigned>(options.flags),
1127 options.origin_rules.data(), options.origin_rules.size());
1166 explicit API(
ULJSAPI adopted) : api_(adopted) {
1169 ULString root = ulJSAPIGetRootPath(api_);
1171 root_.assign(ulStringGetData(root), ulStringGetLength(root));
1172 ulDestroyString(root);
1176 std::string FullPath(
const char* path)
const {
1177 std::string full = root_;
1179 full += path ? path :
"";
1230 : api_(ulCreateJSAPIBorrowedRef(api.raw())), path_(path ? path :
"") {}
1237 ulJSAPIUnbind(api_, path_.c_str());
1238 ulDestroyJSAPI(api_);
1246 : api_(other.api_), path_(std::move(other.path_)) {
1247 other.api_ =
nullptr;
1254 if (
this != &other) {
1256 ulJSAPIUnbind(api_, path_.c_str());
1257 ulDestroyJSAPI(api_);
1260 path_ = std::move(other.path_);
1261 other.api_ =
nullptr;
1276 ulDestroyJSAPI(api_);
1285 explicit operator bool()
const {
return api_ !=
nullptr; }
1333 return { view, request.api, request.origin, request.is_main_frame, request.rules_allow };
1335 static void ReportException(
const char* what) {
1336 std::string message =
"js::SetInjectionFilter: the filter threw a C++ exception, so the "
1337 "JavaScript API was withheld from the page";
1342 ulJSAPIEmitDiagnostic(
nullptr, message.c_str());
1390template <
typename F>
1392 using Fn = std::decay_t<F>;
1393 static_assert(std::is_invocable_r_v<bool, Fn&, const InjectionRequest&>,
1394 "js::SetInjectionFilter takes a callable invocable as "
1395 "bool(const js::InjectionRequest&)");
1398 using Adapter = ultralight::detail::InjectionFilterAdapter<Fn, ULJSAPIInjectionRequest>;
1438template <
typename T,
typename M>
1439 requires std::is_member_function_pointer_v<M>
1441 return detail::MakeBoundMethod(instance, method, detail::MemberFnTraits<M> {});
1476template <
typename H,
typename M>
1477 requires((Holder<H> || LockableHolder<H>) && std::is_member_function_pointer_v<M>)
1480 static_assert(std::is_base_of_v<typename detail::MemberFnTraits<M>::Class, T>,
1481 "the member pointer must belong to the holder's element type (or a base "
1485 "js::Bind does not take exclusive holders: passing a unique_ptr would "
1486 "silently move ownership into the binding. Keep ownership and borrow "
1487 "with js::Bind(ptr.get(), &T::Method), or bind a shared holder");
1489 return detail::MakeHolderBoundMethod<H, T>(std::move(holder), method,
1490 detail::MemberFnTraits<M> {});
1496#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:493
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:507
friend class API
Definition API.h:582
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:556
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:576
A global JavaScript namespace for native functions and data.
Definition API.h:399
void BindProperty(const char *path, Getter &&get, Setter &&set=nullptr)
Bind a property with a getter and an optional setter.
Definition API.h:812
void DefineEvent(const char *event_path, const Anns &... annotations)
Declare an event and its payload types.
Definition API.h:938
Diagnostics diagnostics() const
Get the effective diagnostics level.
Definition API.h:1086
API & operator=(API &&other) noexcept
Move assignment (releases the current handle, and other becomes empty).
Definition API.h:437
bool Unbind(const char *path)
Remove the binding at a path, along with its metadata.
Definition API.h:985
API(const char *root_path, const APIOptions &options={})
Create an API rooted at a global namespace path.
Definition API.h:413
void set_diagnostics(Diagnostics level)
Set the diagnostics level (see Diagnostics).
Definition API.h:1075
ULJSAPI raw() const
Get the underlying handle, for calls into the C API.
Definition API.h:1150
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:461
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:614
~API()
Destructor (releases this handle).
Definition API.h:425
bool AttachTo(View *view, const AttachOptions &options={})
Attach this API to a View.
Definition API.h:1124
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:883
API(API &&other) noexcept
Move constructor (other becomes empty).
Definition API.h:430
API & operator=(const API &)=delete
bool DumpSchema(const char *utf8_path)
Write the JSON from schema() to a file.
Definition API.h:1023
Binder operator[](const char *path)
Get the Binder for a path relative to the root (see Binder).
Definition API.h:595
void SetConstant(const char *path, T &&value)
Set a constant at a path (the explicit form of api[path] = value).
Definition API.h:714
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:477
void DetachFrom(View *view)
Detach this API from a View.
Definition API.h:1140
ULJSAPI LeakRef()
Give up ownership of the underlying handle without releasing it (this API becomes empty).
Definition API.h:1157
void SetMetadata(const char *path, const char *metadata_json)
Add schema metadata (eg, documentation) to the entry at a path.
Definition API.h:1046
std::string schema() const
Get the API's schema as JSON.
Definition API.h:1001
BindingGuard(const BindingGuard &)=delete
BindingGuard()=default
Create an unarmed guard (removes nothing).
BindingGuard(BindingGuard &&other) noexcept
Move constructor (other becomes unarmed).
Definition API.h:1245
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:1274
BindingGuard(const API &api, const char *path)
Create an armed guard that removes the binding at path when destroyed.
Definition API.h:1229
~BindingGuard()
Destructor (removes the binding if the guard is armed).
Definition API.h:1235
BindingGuard & operator=(BindingGuard &&other) noexcept
Move assignment (removes the current binding first if armed, and other becomes unarmed).
Definition API.h:1253
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:279
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:151
auto Bind(T *instance, M method)
Bind a member function to an instance without writing a lambda.
Definition API.h:1440
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:1391
constexpr AttachFlags operator|(AttachFlags a, AttachFlags b)
Combine attach flags.
Definition API.h:57
@ ReadOnly
Script can't change its value.
Definition Value.h:76
void ClearInjectionFilter(View *view)
Remove a View's API filter, so the origin rules alone decide which pages get the bindings.
Definition API.h:1410
constexpr AttachFlags & operator|=(AttachFlags &a, AttachFlags b)
Add attach flags to a.
Definition API.h:66
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, so page script (or Value::DeleteProperty()) can change or delete ...
Definition API.h:47
constexpr AttachFlags AllFrames
Shorthand for AttachFlags::AllFrames.
Definition API.h:73
constexpr AttachFlags Mutable
Shorthand for AttachFlags::Mutable.
Definition API.h:78
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:160
Diagnostics diagnostics
The diagnostics level.
Definition API.h:167
Options for API::AttachTo().
Definition API.h:92
OriginRules origin_rules
The origin rules for the pages that get the bindings.
Definition API.h:102
AttachFlags flags
The attach flags (see AttachFlags).
Definition API.h:96
const char * text
The documentation text.
Definition API.h:229
constexpr Doc(const char *doc_text)
Create a documentation annotation.
Definition API.h:236
The details an API injection filter decides on (see SetInjectionFilter()).
Definition API.h:1297
const char * origin
The page's security origin, serialized (eg, "https://example.com", or "null" for an opaque origin).
Definition API.h:1313
bool rules_allow
Whether or not the origin rules allow the page.
Definition API.h:1323
bool is_main_frame
Whether or not the page is in the View's main frame.
Definition API.h:1318
ULJSAPI api
The API being decided on.
Definition API.h:1307
View * view
The View loading the page (the View you set the filter on).
Definition API.h:1301
constexpr Param(const char *declared_name)
Create a parameter name annotation.
Definition API.h:211
const char * name
The parameter name.
Definition API.h:204