mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Store the ScriptInterface& in ModuleLoader::Result
During hotloading the `ScriptRequest` was constructed from a `JSContext*`. That requires that already an other `ScriptRequest` is active. Which isn't always the case. Now The `ScriptRequest` is constructed from a `ScriptInterface&`. Storing a `ScriptInterface&` in the `ModuleLoader::Result` allows to remove the `m_Result` as it is retrieved from the `ScriptInterface`.
This commit is contained in:
@@ -686,10 +686,18 @@ public:
|
||||
TS_ASSERT_STR_NOT_CONTAINS(logger.GetOutput(), "blah blah blah");
|
||||
}
|
||||
|
||||
void test_ResultDestructionAfterScriptRequestDestruction()
|
||||
void test_HotloadAfterScriptRequestDestruction()
|
||||
{
|
||||
ScriptInterface script{"Test", "Test", g_ScriptContext, AllowAllPredicate};
|
||||
auto _ = script.GetModuleLoader().LoadModule(ScriptRequest{script}, "empty.js");
|
||||
auto result = script.GetModuleLoader().LoadModule(ScriptRequest{script}, "empty.js");
|
||||
g_ScriptContext->RunJobs();
|
||||
auto iter = result.begin();
|
||||
TS_ASSERT(iter->IsDone());
|
||||
|
||||
++iter;
|
||||
ClearFromCache("empty.js");
|
||||
g_ScriptContext->RunJobs();
|
||||
TS_ASSERT(iter->IsDone());
|
||||
}
|
||||
|
||||
void test_RestrictionNoPredicate()
|
||||
|
||||
Reference in New Issue
Block a user