Index: source/gui/Scripting/JSInterface_GUIProxy.h =================================================================== --- source/gui/Scripting/JSInterface_GUIProxy.h +++ source/gui/Scripting/JSInterface_GUIProxy.h @@ -97,9 +97,9 @@ return true; } // Return nothing. - virtual bool enumerate(JSContext* UNUSED(cx), JS::HandleObject UNUSED(proxy), JS::MutableHandleObject UNUSED(objp)) const override + virtual JSObject* enumerate(JSContext* UNUSED(cx), JS::HandleObject UNUSED(proxy)) const override { - return true; + return nullptr; } // Throw an exception is JS attempts to query the prototype. virtual bool getPrototypeIfOrdinary(JSContext* UNUSED(cx), JS::HandleObject UNUSED(proxy), bool* UNUSED(isOrdinary), JS::MutableHandleObject UNUSED(protop)) const override Index: source/gui/Scripting/JSInterface_GUIProxy_impl.h =================================================================== --- source/gui/Scripting/JSInterface_GUIProxy_impl.h +++ source/gui/Scripting/JSInterface_GUIProxy_impl.h @@ -20,7 +20,7 @@ template js::Class& JSI_GUIProxy::ClassDefinition() { - static js::Class c = PROXY_CLASS_DEF("GUIObjectProxy", JSCLASS_HAS_PRIVATE | JSCLASS_HAS_CACHED_PROTO(JSProto_Proxy)); + static js::Class c = PROXY_CLASS_DEF("GUIObjectProxy", JSCLASS_HAS_PRIVATE | JSCLASS_HAS_CACHED_PROTO(JSProto_Proxy) | JSCLASS_HAS_RESERVED_SLOTS(1)); return c; } Index: source/gui/Scripting/JSInterface_GUISize.cpp =================================================================== --- source/gui/Scripting/JSInterface_GUISize.cpp +++ source/gui/Scripting/JSInterface_GUISize.cpp @@ -30,7 +30,7 @@ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, JSI_GUISize::construct, nullptr + nullptr, JSI_GUISize::construct, nullptr }; JSFunctionSpec JSI_GUISize::JSI_methods[] = Index: source/scriptinterface/ScriptContext.cpp =================================================================== --- source/scriptinterface/ScriptContext.cpp +++ source/scriptinterface/ScriptContext.cpp @@ -27,15 +27,13 @@ void GCSliceCallbackHook(JSContext* UNUSED(cx), JS::GCProgress progress, const JS::GCDescription& UNUSED(desc)) { - /* - * During non-incremental GC, the GC is bracketed by JSGC_CYCLE_BEGIN/END - * callbacks. During an incremental GC, the sequence of callbacks is as - * follows: - * JSGC_CYCLE_BEGIN, JSGC_SLICE_END (first slice) - * JSGC_SLICE_BEGIN, JSGC_SLICE_END (second slice) - * ... - * JSGC_SLICE_BEGIN, JSGC_CYCLE_END (last slice) - */ + /** + * From the GCAPI.h file: + * > During GC, the GC is bracketed by GC_CYCLE_BEGIN/END callbacks. Each + * > slice between those (whether an incremental or the sole non-incremental + * > slice) is bracketed by GC_SLICE_BEGIN/GC_SLICE_END. + * Thus, to safely monitor GCs, we need to profile SLICE_X calls. + */ if (progress == JS::GC_SLICE_BEGIN) @@ -48,19 +46,7 @@ { if (CProfileManager::IsInitialised() && ThreadUtil::IsMainThread()) g_Profiler.Stop(); - g_Profiler2.RecordRegionLeave(); - } - else if (progress == JS::GC_CYCLE_BEGIN) - { - if (CProfileManager::IsInitialised() && ThreadUtil::IsMainThread()) - g_Profiler.Start("GCSlice"); - g_Profiler2.RecordRegionEnter("GCSlice"); - } - else if (progress == JS::GC_CYCLE_END) - { - if (CProfileManager::IsInitialised() && ThreadUtil::IsMainThread()) - g_Profiler.Stop(); - g_Profiler2.RecordRegionLeave(); + g_Profiler2.RecordRegionLeave(); } // The following code can be used to print some information aobut garbage collection @@ -219,7 +205,7 @@ printf("Finishing incremental GC because gcBytes > m_ContextSize / 2. \n"); #endif PrepareCompartmentsForIncrementalGC(); - JS::FinishIncrementalGC(m_cx, JS::gcreason::REFRESH_FRAME); + JS::FinishIncrementalGC(m_cx, JS::gcreason::API); } else { @@ -249,9 +235,9 @@ #endif PrepareCompartmentsForIncrementalGC(); if (!JS::IsIncrementalGCInProgress(m_cx)) - JS::StartIncrementalGC(m_cx, GC_NORMAL, JS::gcreason::REFRESH_FRAME, GCSliceTimeBudget); + JS::StartIncrementalGC(m_cx, GC_NORMAL, JS::gcreason::API, GCSliceTimeBudget); else - JS::IncrementalGCSlice(m_cx, JS::gcreason::REFRESH_FRAME, GCSliceTimeBudget); + JS::IncrementalGCSlice(m_cx, JS::gcreason::API, GCSliceTimeBudget); } m_LastGCBytes = gcBytes; } @@ -262,7 +248,7 @@ { JS_SetGCParameter(m_cx, JSGC_MODE, JSGC_MODE_ZONE); JS::PrepareForFullGC(m_cx); - JS::GCForReason(m_cx, GC_SHRINK, JS::gcreason::REFRESH_FRAME); + JS::GCForReason(m_cx, GC_SHRINK, JS::gcreason::API); JS_SetGCParameter(m_cx, JSGC_MODE, JSGC_MODE_INCREMENTAL); } Index: source/scriptinterface/ScriptInterface.cpp =================================================================== --- source/scriptinterface/ScriptInterface.cpp +++ source/scriptinterface/ScriptInterface.cpp @@ -98,7 +98,7 @@ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, JS_GlobalObjectTraceHook }; @@ -327,10 +327,7 @@ JS::CompartmentCreationOptions creationOpt; // Keep JIT code during non-shrinking GCs. This brings a quite big performance improvement. creationOpt.setPreserveJitCode(true); - JS::CompartmentBehaviors behaviors; - behaviors.setVersion(JSVERSION_LATEST); - - JS::CompartmentOptions opt(creationOpt, behaviors); + JS::CompartmentOptions opt(creationOpt, JS::CompartmentBehaviors{}); JSAutoRequest rq(m_cx); m_glob = JS_NewGlobalObject(m_cx, &global_class, nullptr, JS::OnNewGlobalHookOption::FireOnNewGlobalHook, opt); @@ -494,7 +491,7 @@ ps, fs, // Properties, methods static_ps, static_fs)); // Constructor properties, methods - if (obj == NULL) + if (obj == nullptr) { ScriptException::CatchPending(rq); throw PSERROR_Scripting_DefineType_CreationFailed(); Index: source/scriptinterface/tests/test_ScriptInterface.h =================================================================== --- source/scriptinterface/tests/test_ScriptInterface.h +++ source/scriptinterface/tests/test_ScriptInterface.h @@ -40,7 +40,7 @@ ScriptInterface script("Test", "Test", g_ScriptContext); TestLogger logger; TS_ASSERT(!script.LoadScript(L"test.js", "1+")); - TS_ASSERT_STR_CONTAINS(logger.GetOutput(), "ERROR: JavaScript error: test.js line 1\nexpected expression, got end of script"); + TS_ASSERT_STR_CONTAINS(logger.GetOutput(), "ERROR: JavaScript error: test.js line 3\nexpected expression, got \'}\'"); } void test_loadscript_strict_warning() @@ -57,7 +57,7 @@ ScriptInterface script("Test", "Test", g_ScriptContext); TestLogger logger; TS_ASSERT(!script.LoadScript(L"test.js", "with(1){}")); - TS_ASSERT_STR_CONTAINS(logger.GetOutput(), "ERROR: JavaScript error: test.js line 1\nstrict mode code may not contain \'with\' statements"); + TS_ASSERT_STR_CONTAINS(logger.GetOutput(), "ERROR: JavaScript error: test.js line 2\nstrict mode code may not contain \'with\' statements"); } void test_clone_basic() Index: source/simulation2/serialization/BinarySerializer.cpp =================================================================== --- source/simulation2/serialization/BinarySerializer.cpp +++ source/simulation2/serialization/BinarySerializer.cpp @@ -68,7 +68,7 @@ switch (JS_TypeOfValue(rq.cx, val)) { - case JSTYPE_VOID: + case JSTYPE_UNDEFINED: { m_Serializer.NumberU8_Unbounded("type", SCRIPT_TYPE_VOID); break;