diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2020-03-21 18:30:41 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2020-03-21 18:30:41 +0000 |
commit | 17b28e85c12309d60e3c45acb096b9989a7834ff (patch) | |
tree | d10a03b425d22b1c48be7356466b0420bfb36402 /desktop/browser_window.c | |
parent | 313dc9b099a172914f312120f0f9d0260a3588cf (diff) | |
download | netsurf-17b28e85c12309d60e3c45acb096b9989a7834ff.tar.gz netsurf-17b28e85c12309d60e3c45acb096b9989a7834ff.tar.bz2 |
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 <dsilvers@digital-scurf.org>
Diffstat (limited to 'desktop/browser_window.c')
-rw-r--r-- | desktop/browser_window.c | 28 |
1 files changed, 16 insertions, 12 deletions
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; |