From 17b28e85c12309d60e3c45acb096b9989a7834ff Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 21 Mar 2020 18:30:41 +0000 Subject: JS: Split concept of JS context into heap and thread In preparation for proper splitting of Javascript support into heaps and threads, this renames the types and corrects the no-js builds to still work. At this time no substantive change in semantics exists, and the duktape build won't work. Signed-off-by: Daniel Silverstone --- desktop/browser_window.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'desktop/browser_window.c') diff --git a/desktop/browser_window.c b/desktop/browser_window.c index 3d1a19f60..bd446a072 100644 --- a/desktop/browser_window.c +++ b/desktop/browser_window.c @@ -1485,15 +1485,19 @@ browser_window_callback(hlcache_handle *c, const hlcache_event *event, void *pw) } break; - case CONTENT_MSG_GETCTX: - /* only the content object created by the browser - * window requires a new global compartment object - */ - assert(bw->loading_content == c); - if (js_newcompartment(bw->jsctx, - bw, - hlcache_handle_get_content(c)) != NULL) { - *(event->data.jscontext) = bw->jsctx; + case CONTENT_MSG_GETTHREAD: + { + /* only the content object created by the browser + * window requires a new global compartment object + */ + jsthread *thread; + assert(bw->loading_content == c); + if (js_newthread(bw->jsheap, + bw, + hlcache_handle_get_content(c), + &thread) == NSERROR_OK) { + *(event->data.jsthread) = thread; + } } break; @@ -1760,8 +1764,8 @@ static void browser_window_destroy_internal(struct browser_window *bw) bw->box = NULL; } - if (bw->jsctx != NULL) { - js_destroycontext(bw->jsctx); + if (bw->jsheap != NULL) { + js_destroyheap(bw->jsheap); } /* These simply free memory, so are safe here */ @@ -3085,7 +3089,7 @@ browser_window_initialise_common(enum browser_window_create_flags flags, assert(bw); /* new javascript context for each window/(i)frame */ - err = js_newcontext(nsoption_int(script_timeout), &bw->jsctx); + err = js_newheap(nsoption_int(script_timeout), &bw->jsheap); if (err != NSERROR_OK) return err; -- cgit v1.2.3