Issue of too many recursion on setDesignResolutionSize

Version: Cocos2d-JS, v3.0~v3.6.1.
Error: script/jsb_boot.js:787:InternalError: too much recursion
The corresponding part of jsb_boot.js:

cc.view._setDesignResolutionSize = cc.view.setDesignResolutionSize;
cc.view.setDesignResolutionSize = function(width,height,resolutionPolicy){
cc.view._setDesignResolutionSize(width,height,resolutionPolicy);
cc.winSize = cc.director.getWinSize();
cc.visibleRect.init();
};

It’s quite obvious that there’s a nesting call of cc.view.setDesignResolutionSize. However, it happens, not always, but occasionally on some devices.