-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Change the bridge URLs so that they can be used in a CSP #264
base: master
Are you sure you want to change the base?
Conversation
The previous URLs contained leading/middle/trailing underscores, which are illegal to use as 'host-char' in a Content-Security-Policy. Changing them to hyphens makes WebViewJavascriptBridge compatible with solutions requiring a CSP.
The previous URLs contained leading/middle/trailing underscores, which are illegal to use as 'host-char' in a Content-Security-Policy. Changing them to hyphens makes WebViewJavascriptBridge compatible with solutions requiring a CSP.
@@ -95,7 +95,7 @@ function setupWebViewJavascriptBridge(callback) { | |||
window.WVJBCallbacks = [callback]; | |||
var WVJBIframe = document.createElement('iframe'); | |||
WVJBIframe.style.display = 'none'; | |||
WVJBIframe.src = 'https://__bridge_loaded__'; | |||
WVJBIframe.src = 'https://wvjb-bridge_loaded'; |
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.
There's still an underscore in there. Are you sure this works as expected?
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.
I think there is a type error. It should be wvjb-bridge-loaded
, is that right? @nilswiersema
Man, this is tricky. On the one hand, this is clearly an improvement. On the other hand, it's significant to ask everyone to fix up their code after an upgrade. Is there any way to be automatically backwards compatible? |
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.
Type error
@@ -95,7 +95,7 @@ function setupWebViewJavascriptBridge(callback) { | |||
window.WVJBCallbacks = [callback]; | |||
var WVJBIframe = document.createElement('iframe'); | |||
WVJBIframe.style.display = 'none'; | |||
WVJBIframe.src = 'https://__bridge_loaded__'; | |||
WVJBIframe.src = 'https://wvjb-bridge_loaded'; |
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.
There is a type error. It should be wvjb-bridge-loaded
@nilswiersema
I do agree with @nilswiersema . Here is my test sample. Problem sample
Then it will lead to fail
Success sample
the difference is replace |
The previous URLs contained leading/middle/trailing underscores, which are illegal to use as 'host-char' in a Content-Security-Policy.
Changing them to hyphens makes WebViewJavascriptBridge compatible with solutions requiring a CSP.
This pull request fixes issue #263.