Skip to content
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

ExtensionInfo.isLoaded is inconsistent #2972

Open
marchbold opened this issue Dec 18, 2023 · 2 comments
Open

ExtensionInfo.isLoaded is inconsistent #2972

marchbold opened this issue Dec 18, 2023 · 2 comments

Comments

@marchbold
Copy link
Collaborator

I'm attempting to ascertain whether an extension has been loaded at runtime after specifying the extension is to be "delay load".

Problem Description

  • AIR SDK v50.2.4.1

Firstly I flag the extension as delay load:

    <extensionID delayLoad="true">com.distriqt.Core</extensionID>

I'm attempting to get the extension loaded state at runtime (without knowing/specifying a class contained in the extension) :

var info:ExtensionInfo = ExtensionContext.getExtensionInfo( "com.distriqt.Core" );

At this point the info.isLoaded is false as expected.

Then I attempt to load the extension:

ExtensionContext.loadExtension( "com.distriqt.Core", null );

Following this I attempt to check the load state by getting the info again:

var info:ExtensionInfo = ExtensionContext.getExtensionInfo( "com.distriqt.Core" );

I'm finding that info.isLoaded is inconsistent, especially when loading multiple extensions. Generally it seems to always be false.

One thing I have noted is that it seems to vary based on the supported platforms for an extension. eg on macOS I get:

[trace] androidx.work loaded=false
[trace] androidx.core loaded=false
[trace] com.distriqt.playservices.AppSet loaded=false
[trace] androidx.room loaded=false
[trace] androidx.browser loaded=false
[trace] com.distriqt.playservices.Base loaded=false
[trace] com.google.code.gson loaded=false
[trace] com.distriqt.playservices.Ads loaded=false
[trace] com.distriqt.Adverts loaded=false
[trace] androidx.vectordrawable loaded=false
[trace] com.distriqt.Core loaded=true
[trace] androidx.constraintlayout loaded=false
[trace] com.distriqt.Exceptions loaded=false
[trace] androidx.appcompat loaded=false
[trace] com.jetbrains.kotlin loaded=false

Here com.distriqt.Core is the only extension with a valid macOS implementation. After the load however I can still access the default lib from Exceptions eg Exceptions.service.version returns correctly so something is loaded?

However on Android:

[trace] androidx.work loaded=false
[trace] androidx.core loaded=false
[trace] com.distriqt.playservices.AppSet loaded=false
[trace] androidx.room loaded=false
[trace] androidx.browser loaded=false
[trace] com.distriqt.playservices.Base loaded=false
[trace] com.google.code.gson loaded=false
[trace] com.distriqt.playservices.Ads loaded=false
[trace] com.distriqt.Adverts loaded=true
[trace] androidx.vectordrawable loaded=false
[trace] com.distriqt.Core loaded=true
[trace] androidx.constraintlayout loaded=false
[trace] com.distriqt.Exceptions loaded=true
[trace] androidx.appcompat loaded=false
[trace] com.jetbrains.kotlin loaded=false

I get com.distriqt.Exceptions, com.distriqt.Core and com.distriqt.Adverts loading but the others not.

Is this state tied to the supported platforms for an extension? Or does the isLoaded flag mean something different than documented? (https://airsdk.dev/reference/actionscript/3.0/flash/external/ExtensionInfo.html#isLoaded)

@ajwfrost
Copy link
Collaborator

Hi

It seems like we may have caused some issues when trying to ensure that the extensions' swf definitions were available from worker threads.. the mechanism we added there involved tracking the 'toplevel' object that was used when creating the initial reference to the extension (i.e. when we parse the XML descriptor file at start-up). So a worker that's then coming later with its own toplevel shouldn't be able to load extensions, but should be able to get at the swf definitions.

The issue though is caused by the fact that during start-up, it's an "internal" toplevel object that's being used when the extensions are first registered, but when you access things from your SWF code it's then a "content" toplevel object... so the loading of the SWF data did probably work, but the state was not being set to "loaded".

The thing I can't quite work out is how come some of them ended up with a loaded state of "true"..! if they are mentioned in the app descriptor with 'delayLoad' set, then the loaded state should be incorrect the whole time...

We have a fix for this though - just need to ensure it doesn't then break the Worker scenarios..!

thanks

@marchbold
Copy link
Collaborator Author

Great to hear, let me know if you want me to test anything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants