Skip to content
  • Owen W. Taylor's avatar
    Replace call context with a concept of "current context" · 346a4007
    Owen W. Taylor authored
    Using multiple nested contexts on the same thread isn't normal usage of
    Spidermonkey and triggers bugs in Spidermonkey that might not be caught
    in upstream testing. (It is theoretically supported, to at least some extent.)
    
    When calling a callback, the best context to use is the current context.
    If that's not available, then using the default context from the GjsContext
    is usually sensible.
    
    Add functions:
     gjs_runtime_push_context()
     gjs_runtime_pop_context()
     gjs_runtime_get_current_context()
    
    One potential concern here is the extensive use of GDataset to get data
    from a context, which involves locking overhead and hash table lookups and
    can be slow; since we can't use GJS with multiple JS_Runtimes in the same
    process due to the limitations of toggle references, perhaps we should enforce
    that and use global variables.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=622896
    346a4007