Repository navigation
fix(exports): keep callbacks that other resources pass through an export - #310
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A function handed to an export by another resource arrives as a function reference: a table with a
__callmetamethod, not a Lua function. #304 fixed this for Bluetooth devices. The sametype(x) == 'function'check sat on every other export that takes a callback, so the callback was dropped for exactly the callers those exports exist for:uploadMediareturnedfalsefor any outside caller and never answered.showLockscreenWidgetdroppedonAction, so the owning resource never heard a tap.addCustomAppdroppedonOpen/onUse/onClose/onDelete.SendMessageshim skipped its callback, and the qsregisterCallInterceptorshim refused the registration.Changes
shared/callable.luawithcallable.is(value): a Lua function, or a table whose metatable has__call.util.onCleanup,target.onReady,job.onChange,media.registerFeature) only ever see real functions and are unchanged.sd_phone_roadphonecompat), reported in NUI → server HTTP upload hangs ~60 s on FiveM for GTAV Enhanced before falling back #297.Testing
Live on a QBox dev server, calling from a second resource:
type = tablewith__call.uploadMedia: before, returnedfalseand the callback never ran. After, the callback receivesExpected a base64 data: URL. A plain table is still refused.onConnectandonDisconnect(reasonkicked) both fire.onOpen,onCloseandonDeletefire on their lifecycle actions.onActionreceives the action and its value.Not exercised: the two compat shim callbacks.
Lua suite: 597 passed, with the same two suite errors as
main(port_settings_test,port_photogram_test). The new callable cases fail when the helper is reverted to the function-only check.Breaking Changes
None. Plain Lua functions pass as before; anything that is neither a function nor callable is still ignored.