erisu opened a new pull request #1332:
URL: https://github.com/apache/cordova-android/pull/1332


   ### Motivation and Context
   
   fixes: #1328
   
   ### Description
   
   Update how the PluginManager handles the default policy.
   
   * If `AndroidInsecureFileModeEnabled` is `true`, then the default policy is 
`file://`
   * If `AndroidInsecureFileModeEnabled` is `false`, then the default policy is 
the combination of the `scheme` & `hostname`.
     * The default scheme is: `https`
     * The default hostname is: `localhost`
     * If the user changes any of these values, it will be used.
   
   ### Testing
   
   * Creating Project
   * Adding Platform
   * Adding Device Plugin
   * Changing `scheme` to `http`
   * Changing `hostname` to `apache.org`
   * Setting `AndroidInsecureFileModeEnabled` to `true`
   
   ### Additional Notes
   
   I also tested a solution that added the fix to the `AllowListPlugin` class. 
https://github.com/apache/cordova-android/commit/fa5b228bb9cefca36d92df3c80bb6bbc42672377
   
   This is where @NiklasMerz originally the code. The issue is that is was 
written in the config parser step. The config parser has not fully parse 
everything, e.g. the preferences, and therefore always picked the default 
values.
   
   If we wanted to keep the login inside the `AllowListPlugin` file, we would 
have to move it to the `pluginInitialize` method, after the config parser has 
been completed.
   
   The question really comes down to, where it should reside?
   
   * The `PluginManager`, is where the default policy is defined.
   * The `AllowListPlugin` is where we parse the user's custom-defined 
`allow-navigation`, `allow-intent`, `access`, and `content`.
   
   IMO the `PluginManager` sounded better. Previously the default policy was 
`file://` but since `WebViewAssetLoader` was added and default should now be 
`https://localhost`. But also, since users can change the launch URL to either 
file or default/custom scheme+hostname, it seems maybe the default policy 
should be a bit flexible.
   ### Checklist
   
   - [x] I've run the tests to see all new and existing tests pass
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to