|
XenevaOS
|
#include "js.h"#include "css.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>#include <quickjs.h>#include <https.h>#include <_xeneva.h>#include <sys/_ketime.h>
Classes | |
| struct | NsJsConsoleEntry |
| struct | NsJsTimer |
| struct | JsEl |
Macros | |
| #define | NS_JS_TIMER_MAX 16 |
| #define | NS_JS_TIMER_MIN_MS 10 |
| #define | NS_JS_RAF_MS 16 |
| #define | NS_JS_CONSOLE_MAX 24 |
| #define | NS_JS_CONSOLE_LINE 512 |
| #define | NS_JS_TITLE_MAX 128 |
Typedefs | |
| typedef struct JsEl | JsEl |
Functions | |
| const char * | NsJsVersion (void) |
| void | NsJsFlushConsole (void) |
| int | NsJsTimerCount (void) |
| bool | NsJsTick (void) |
| int | NsJsConsumeNav (char *out, size_t outsz) |
| void | NsJsSetSink (NsJsSinkFn *fn) |
| void | NsJsSetDocument (NsCssNode *root) |
| int | NsJsConsumeDirty (void) |
| int | NsJsActive (void) |
| void | NsJsBegin (const char *url) |
| void | NsJsEnd (void) |
| void | NsJsScanTitle (const char *src, size_t len) |
| void | NsJsScriptSrcAttr (const char *attr) |
| void | NsJsScriptType (const char *type) |
| void | NsJsScriptChunk (char c) |
| int | NsJsDefined (const char *name) |
| void | NsJsRunPending (void) |
| #define NS_JS_CONSOLE_LINE 512 |
| #define NS_JS_CONSOLE_MAX 24 |
| #define NS_JS_RAF_MS 16 |
| #define NS_JS_TIMER_MAX 16 |
NetSurf QuickJS host implementation. See js.h.
One QuickJS runtime/context per page. Inline <script> bodies are fed to NsJsScriptChunk by the HTML pass and evaled at </script>, so document order and JS-side text injection line up with the rendered page. The context outlives the parse so setTimeout/setInterval callbacks keep firing from the GUI loop until the next page replaces it.
Host shell. getElementById returns a live node once NsJsSetDocument is called; setAttribute("style") updates that node's inline sheet. Lookups before the DOM exists, and every other DOM call, stay soft: console.log/info/warn/error/debug -> styled lines through the sink document.write/writeln -> inline text through the sink document.title -> get/set (title scan preloaded) location.href/replace/assign -> queued navigation (fetched by the caller) document.cookie -> the shared HTTP cookie jar navigator.userAgent -> same Chrome string the fetch sends alert(...) -> warning line setTimeout/setInterval/clear* -> timer slots driven by NsJsTick; callbacks may be functions or source strings requestAnimationFrame -> setTimeout(16ms) compat shim window -> alias of globalThis
| #define NS_JS_TIMER_MIN_MS 10 |
| #define NS_JS_TITLE_MAX 128 |
| int NsJsActive | ( | void | ) |
| void NsJsBegin | ( | const char * | url | ) |
| int NsJsConsumeDirty | ( | void | ) |
| int NsJsConsumeNav | ( | char * | out, |
| size_t | outsz | ||
| ) |
| int NsJsDefined | ( | const char * | name | ) |
| void NsJsEnd | ( | void | ) |
| void NsJsFlushConsole | ( | void | ) |
| void NsJsRunPending | ( | void | ) |
| void NsJsScanTitle | ( | const char * | src, |
| size_t | len | ||
| ) |
| void NsJsScriptChunk | ( | char | c | ) |
| void NsJsScriptSrcAttr | ( | const char * | attr | ) |
| void NsJsScriptType | ( | const char * | type | ) |
| void NsJsSetDocument | ( | NsCssNode * | root | ) |
| void NsJsSetSink | ( | NsJsSinkFn * | fn | ) |
| bool NsJsTick | ( | void | ) |
| int NsJsTimerCount | ( | void | ) |
| const char * NsJsVersion | ( | void | ) |