mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-03 17:54:33 +03:00
Window: Restructure EXPOSE()d globals
By reference to the MDN and to Duktape's CLI, expose everything we possibly can on the global object (Window). Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
This commit is contained in:
parent
955cf5f97b
commit
ce7e6d91f5
@ -271,26 +271,94 @@ prototype Window()
|
|||||||
#define EXPOSE(v) \
|
#define EXPOSE(v) \
|
||||||
duk_get_global_string(ctx, #v); \
|
duk_get_global_string(ctx, #v); \
|
||||||
duk_put_prop_string(ctx, 0, #v)
|
duk_put_prop_string(ctx, 0, #v)
|
||||||
/* steal undefined */
|
/* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects */
|
||||||
|
/* ** Value properties */
|
||||||
|
EXPOSE(infinity);
|
||||||
|
EXPOSE(NaN);
|
||||||
EXPOSE(undefined);
|
EXPOSE(undefined);
|
||||||
|
EXPOSE(null);
|
||||||
|
EXPOSE(globalThis);
|
||||||
|
|
||||||
|
/* ** Function properties */
|
||||||
EXPOSE(eval);
|
EXPOSE(eval);
|
||||||
EXPOSE(Object);
|
/* EXPOSE(uneval); */ /* Not standard, maybe not available */
|
||||||
EXPOSE(parseInt);
|
EXPOSE(isFinite);
|
||||||
|
EXPOSE(isNaN);
|
||||||
EXPOSE(parseFloat);
|
EXPOSE(parseFloat);
|
||||||
EXPOSE(Array);
|
EXPOSE(parseInt);
|
||||||
EXPOSE(Date);
|
EXPOSE(decodeURI);
|
||||||
EXPOSE(RegExp);
|
EXPOSE(decodeURIComponent);
|
||||||
EXPOSE(Math);
|
|
||||||
EXPOSE(Function);
|
|
||||||
EXPOSE(Proxy);
|
|
||||||
EXPOSE(String);
|
|
||||||
EXPOSE(Number);
|
|
||||||
EXPOSE(Error);
|
|
||||||
EXPOSE(encodeURI);
|
EXPOSE(encodeURI);
|
||||||
EXPOSE(encodeURIComponent);
|
EXPOSE(encodeURIComponent);
|
||||||
EXPOSE(NaN);
|
EXPOSE(escape);
|
||||||
EXPOSE(isNaN);
|
EXPOSE(unescape);
|
||||||
EXPOSE(isFinite);
|
|
||||||
|
/* ** Fundamental Objects */
|
||||||
|
EXPOSE(Object);
|
||||||
|
EXPOSE(Function);
|
||||||
|
EXPOSE(Boolean);
|
||||||
|
EXPOSE(Symbol);
|
||||||
|
EXPOSE(Error);
|
||||||
|
EXPOSE(EvalError);
|
||||||
|
EXPOSE(InternalError);
|
||||||
|
EXPOSE(RangeError);
|
||||||
|
EXPOSE(ReferenceError);
|
||||||
|
EXPOSE(SyntaxError);
|
||||||
|
EXPOSE(TypeError);
|
||||||
|
EXPOSE(URIError);
|
||||||
|
|
||||||
|
/* ** Numbers and Dates */
|
||||||
|
EXPOSE(Number);
|
||||||
|
EXPOSE(BigInt);
|
||||||
|
EXPOSE(Math);
|
||||||
|
EXPOSE(Date);
|
||||||
|
|
||||||
|
/* ** Text Processing */
|
||||||
|
EXPOSE(String);
|
||||||
|
EXPOSE(RegExp);
|
||||||
|
|
||||||
|
/* ** Indexed Collections */
|
||||||
|
EXPOSE(Array);
|
||||||
|
EXPOSE(Int8Array);
|
||||||
|
EXPOSE(Uint8Array);
|
||||||
|
EXPOSE(Uint8ClampedArray);
|
||||||
|
EXPOSE(Int16Array);
|
||||||
|
EXPOSE(Uint16Array);
|
||||||
|
EXPOSE(Int32Array);
|
||||||
|
EXPOSE(Uint32Array);
|
||||||
|
EXPOSE(Float32Array);
|
||||||
|
EXPOSE(Float64Array);
|
||||||
|
/* EXPOSE(BigInt64Array); */ /* Duktape seems to lack this */
|
||||||
|
/* EXPOSE(BigUint64Array); */ /* Duktape seems to lack this */
|
||||||
|
|
||||||
|
/* ** Keyed Collections */
|
||||||
|
/* EXPOSE(Map); */
|
||||||
|
/* EXPOSE(Set); */
|
||||||
|
/* EXPOSE(WeakMap); */
|
||||||
|
/* EXPOSE(WeakSet); */
|
||||||
|
|
||||||
|
/* Structured Data */
|
||||||
|
EXPOSE(ArrayBuffer);
|
||||||
|
/* EXPOSE(SharedArrayBuffer); */ /* Duktape lacks this - experimental API */
|
||||||
|
/* EXPOSE(Atomics); */ /* Duktape lacks this - experimental API */
|
||||||
|
EXPOSE(DataView);
|
||||||
|
EXPOSE(JSON);
|
||||||
|
|
||||||
|
/* ** Control abstraction properties */
|
||||||
|
/* EXPOSE(Promise); */ /* Probably ought to be one of ours? */
|
||||||
|
/* EXPOSE(Generator); */ /* Duktape and async? */
|
||||||
|
/* EXPOSE(GeneratorFunction); */ /* Duktape and async? */
|
||||||
|
/* EXPOSE(AsyncFunction); */ /* Duktape lacks this - experimental API */
|
||||||
|
|
||||||
|
/* Reflection */
|
||||||
|
EXPOSE(Reflect);
|
||||||
|
EXPOSE(Proxy);
|
||||||
|
|
||||||
|
/* ** Internationalisation */
|
||||||
|
/* Duktape lacks Intl - Maybe polyfill it? */
|
||||||
|
|
||||||
|
/* ** WebAssembly */
|
||||||
|
/* As yet, Duktape lacks WA */
|
||||||
#undef EXPOSE
|
#undef EXPOSE
|
||||||
/* Add s3kr1t method to close the compartment */
|
/* Add s3kr1t method to close the compartment */
|
||||||
duk_dup(ctx, 0);
|
duk_dup(ctx, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user