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
feat: support http w/ content src fix #1298
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1298 +/- ##
=======================================
Coverage 73.25% 73.25%
=======================================
Files 21 21
Lines 1645 1645
=======================================
Hits 1205 1205
Misses 440 440 Continue to review full report at Codecov.
|
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.
lgtm
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.
return scheme + "://" + hostname + '/'; | ||
} | ||
} | ||
|
||
private void setStartUrl(String src) { |
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.
Just for someone not familiar with this code, I would rename this to setLaunchUrl
.
this isn't needed now that it has been identified that the issue was apache/cordova-android#1298
Motivation and Context
fixes: #1296
fixes: #1289
fixes: #1299
Description
setStartUrl
was being called during the parsing of theconfig.xml
. This should not be called until after the parsing has been completed. The reason why this was an issue is becausesetStartUrl
was called when thecontent
tag was being parsed. Some or allpreference
tags may not have been already loaded, so therefore we do not have the information to best determin what the start url should be.This PR moves the
setStartUrl
in side thegetLaunchUrl
. The first call ofgetLaunchUrl
will trigger thesetStartUrl
method. Any calls there after will return immediately the launchUrl as it will be saved from the first call.With the changes described above, it resolved the reported issue in #1289.
Additionally, this PR allows users to set the scheme between
http
andhttps
. These are the only valid schemes for theWebViewAssetLoader
. If the user supplied anything that is not valid, it will default tohttps
Also to continue to maintain a best secure pratice, the default with no defined
scheme
will also behttps
.Testing
npm t
cordova build
scheme
+hostname
+content:src=<file>
Testhttp
,localhost
,index.html
http
,localhost
,test/index.html
http
,localhost
,page.html
https
,localhost
,index.html
https
,localhost
,test/index.html
https
,localhost
,page.html
http
,foobar
,index.html
http
,foobar
,test/index.html
http
,foobar
,page.html
https
,foobar
,index.html
https
,foobar
,test/index.html
https
,foobar
,page.html
AndroidInsecureFileModeEnabled=true
(file://) Testindex.html
test/index.html
page.html
content:src=<URL>
https://cordova.apache.org/
Checklist