New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIMOB-26391] Protect js objects for proxies #10352
Conversation
This will protect js objects temporarily until they are passed back into the js context so they don't get CG'd during the small timeframe of their creation and actual usage.
Generated by 🚫 dangerJS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working good on my site! Approved if @sgtcoolguy agrees!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM.
I'm not 100% sure these are the exact right positions to be protecting/unprotecting the values. I was looking at HAL to see where it was done on Windows, and it's basically done right in the constructor for objects created on the native side, and unprotected in the destructor (Of the JSObject c++ type which wraps the JSObjectRef c type).
I think if we were to translate that sort of policy over, then it'd probably be done in the KrollObject initWithTarget:, and unprotected in dealloc? (Though there appear to be other places we call TiObjectMake to generate js objects, but I'm not sure if any of those are kept around long-term as fields - they look to be returned as values from a method or set as properties on some other object)
Just for reference, since we're dealing with the exact same JS engine in both cases, but in pretty different ways - but the concepts remain applicable to both. Generally speaking, the flow for Windows/HAL is:
|
* [TIMOB-26391] Protect js objects for proxies This will protect js objects temporarily until they are passed back into the js context so they don't get CG'd during the small timeframe of their creation and actual usage. * [TIMOB-26391] Only guard against GC in JSCore
* [TIMOB-26391] Protect js objects for proxies This will protect js objects temporarily until they are passed back into the js context so they don't get CG'd during the small timeframe of their creation and actual usage. * [TIMOB-26391] Only guard against GC in JSCore
* 7_4_X: [TIMOB-26399] (7_4_X) iOS: Fix notification update to trigger correct callback for default notification action (tidev#10355) [TIMOB-26391] Protect js objects for proxies (tidev#10352) # Conflicts: # iphone/Classes/TiApp.m
Please give permission to me to download SDK . |
JIRA: https://jira.appcelerator.org/browse/TIMOB-26391
Optional Description:
This will protect JS objects temporarily until they are passed back into the js context so they don't get CG'd during the small timeframe of their creation and until they are actually referenced in the JS object graph.