summaryrefslogtreecommitdiff
path: root/content/handlers/javascript/duktape
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2019-08-02 09:17:12 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2019-08-02 09:17:12 +0100
commitce7e6d91f50c3e204a2bb5521c616d1f94b63143 (patch)
treeff8ed0b38d52ae596bd07f96fe034c30a033c31d /content/handlers/javascript/duktape
parent955cf5f97b9a2d906a6052e0ad681f344afb9600 (diff)
downloadnetsurf-ce7e6d91f50c3e204a2bb5521c616d1f94b63143.tar.gz
netsurf-ce7e6d91f50c3e204a2bb5521c616d1f94b63143.tar.bz2
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>
Diffstat (limited to 'content/handlers/javascript/duktape')
-rw-r--r--content/handlers/javascript/duktape/Window.bnd96
1 files changed, 82 insertions, 14 deletions
diff --git a/content/handlers/javascript/duktape/Window.bnd b/content/handlers/javascript/duktape/Window.bnd
index 1a7686250..fc1ce244b 100644
--- a/content/handlers/javascript/duktape/Window.bnd
+++ b/content/handlers/javascript/duktape/Window.bnd
@@ -271,26 +271,94 @@ prototype Window()
#define EXPOSE(v) \
duk_get_global_string(ctx, #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(null);
+ EXPOSE(globalThis);
+
+ /* ** Function properties */
EXPOSE(eval);
- EXPOSE(Object);
- EXPOSE(parseInt);
+ /* EXPOSE(uneval); */ /* Not standard, maybe not available */
+ EXPOSE(isFinite);
+ EXPOSE(isNaN);
EXPOSE(parseFloat);
- EXPOSE(Array);
+ EXPOSE(parseInt);
+ EXPOSE(decodeURI);
+ EXPOSE(decodeURIComponent);
+ EXPOSE(encodeURI);
+ EXPOSE(encodeURIComponent);
+ EXPOSE(escape);
+ EXPOSE(unescape);
+
+ /* ** 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);
- EXPOSE(Math);
- EXPOSE(Function);
+
+ /* ** 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);
- EXPOSE(String);
- EXPOSE(Number);
- EXPOSE(Error);
- EXPOSE(encodeURI);
- EXPOSE(encodeURIComponent);
- EXPOSE(NaN);
- EXPOSE(isNaN);
- EXPOSE(isFinite);
+
+ /* ** Internationalisation */
+ /* Duktape lacks Intl - Maybe polyfill it? */
+
+ /* ** WebAssembly */
+ /* As yet, Duktape lacks WA */
#undef EXPOSE
/* Add s3kr1t method to close the compartment */
duk_dup(ctx, 0);