Index: source/gui/ObjectBases/IGUIObject.cpp =================================================================== --- source/gui/ObjectBases/IGUIObject.cpp +++ source/gui/ObjectBases/IGUIObject.cpp @@ -453,16 +453,12 @@ { ScriptRequest rq(m_pGUI.GetScriptInterface()); - // TODO SM60: actually use this when we can use GetProxyPrivate JS::RootedValue priv(rq.cx); - //priv.get().setPrivate(this); -> need to use a virtual func. + priv.get().setPrivate(this); js::ProxyOptions options; options.setClass(&JSI_GUIProxy::ClassDefinition()); m_JSObject.init(rq.cx, js::NewProxyObject(rq.cx, &JSI_GUIProxy::Singleton(), priv, nullptr, options)); - - // TODO: remove this when we can use GetProxyPrivate - JS_SetPrivate(m_JSObject.get(), this); } JSObject* IGUIObject::GetJSObject() Index: source/gui/ObjectTypes/CText.cpp =================================================================== --- source/gui/ObjectTypes/CText.cpp +++ source/gui/ObjectTypes/CText.cpp @@ -258,16 +258,12 @@ { ScriptRequest rq(m_pGUI.GetScriptInterface()); - // TODO SM60: actually use this when we can use GetProxyPrivate JS::RootedValue priv(rq.cx); - //priv.get().setPrivate(this); -> need to use a virtual func. + priv.get().setPrivate(this); js::ProxyOptions options; options.setClass(&JSI_GUIProxy::ClassDefinition()); m_JSObject.init(rq.cx, js::NewProxyObject(rq.cx, &JSI_GUIProxy::Singleton(), priv, nullptr, options)); - - // TODO: remove this when we can use GetProxyPrivate - JS_SetPrivate(m_JSObject.get(), this); } bool CText::getTextSize(ScriptInterface& scriptInterface, JS::MutableHandleValue ret) Index: source/gui/Scripting/JSInterface_GUIProxy.h =================================================================== --- source/gui/Scripting/JSInterface_GUIProxy.h +++ source/gui/Scripting/JSInterface_GUIProxy.h @@ -84,9 +84,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; } @@ -37,7 +37,7 @@ inline bool apply_to(JSContext* cx, uint argc, JS::Value* vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - OG* e = static_cast(JS_GetPrivate(args.thisv().toObjectOrNull())); + OG* e = static_cast(js::GetProxyPrivate(args.thisv().toObjectOrNull()).toPrivate()); if (!e) return false; 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 @@ -219,7 +219,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 +249,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 +262,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/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;