| 653 | } |
| 654 | |
| 655 | JSContext* ScriptEngine::CreateContext() const |
| 656 | { |
| 657 | JSContext* newCtx = JS_NewContext(_runtime); |
| 658 | if (!newCtx) |
| 659 | { |
| 660 | throw std::runtime_error("QuickJS: cannot allocate JS context\n"); |
| 661 | } |
| 662 | InitialiseContext(newCtx); |
| 663 | |
| 664 | for (const auto& ext : _extensions) |
| 665 | { |
| 666 | ext.newContext(newCtx); |
| 667 | } |
| 668 | return newCtx; |
| 669 | } |
| 670 | |
| 671 | void ScriptEngine::InitialiseContext(JSContext* ctx) const |
| 672 | { |
no test coverage detected