Javascript is mono-threaded, so this problem cannot show : either the callback was called or not when the cancelAF is called. If it was called, nothing is done. If it was not called, it won't get called later. Your question suggest that cancelAF would also cancel an ongoing callback, but the specification dooesn't say a word about that : MDN description is :
window.cancelAnimationFrame
Cancels an animation frame request previously scheduled through a
call to window.requestAnimationFrame().
( https://developer.mozilla.org/en-US/docs/Web/API/window.cancelAnimationFrame ).
It is a 'request' which gets cancelled, not the callback.
Maybe to be a little clearer : if you call cancelAF after ++GLOBAL_VAR_A and before ++GLOBAL_VAR_B;, then it means the callback was allready called and the cancelAF does just nothing.
cancelAF has no return value, so you cannot tell you "cancel(led) the frame successfully"