File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -223,6 +223,11 @@ typedef unsigned short uint16_t;
223223 /// </summary>
224224 JsErrorModuleParsed ,
225225 /// <summary>
226+ /// Argument passed to JsCreateWeakReference is a primitive that is not managed by the GC.
227+ /// No weak reference is required, the value will never be collected.
228+ /// </summary>
229+ JsNoWeakRefRequired ,
230+ /// <summary>
226231 /// Category of errors that relates to errors occurring within the engine itself.
227232 /// </summary>
228233 JsErrorCategoryEngine = 0x20000 ,
Original file line number Diff line number Diff line change @@ -4612,6 +4612,15 @@ CHAKRA_API JsCreateWeakReference(
46124612 PARAM_NOT_NULL (weakRef);
46134613 *weakRef = nullptr ;
46144614
4615+ if (Js::TaggedNumber::Is (value))
4616+ {
4617+ return JsNoWeakRefRequired;
4618+ }
4619+ else if (!Js::RecyclableObject::Is (value))
4620+ {
4621+ return JsErrorInvalidArgument;
4622+ }
4623+
46154624 return GlobalAPIWrapper_NoRecord ([&]() -> JsErrorCode {
46164625 ThreadContext* threadContext = ThreadContext::GetContextForCurrentThread ();
46174626 if (threadContext == nullptr )
You can’t perform that action at this time.
0 commit comments