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

Doesn't work with plugins - whitelist and inAppBrowser #12

Open
eddieSullivan opened this issue Feb 24, 2016 · 7 comments
Open

Doesn't work with plugins - whitelist and inAppBrowser #12

eddieSullivan opened this issue Feb 24, 2016 · 7 comments

Comments

@eddieSullivan
Copy link

Both of these plugins fail to work in Ripple.
The whitelist plugin gives the following error message every ten seconds:

No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.

The InAppBrowser does not fire the loadstart event.

@TimBarham
Copy link
Member

Regarding the No Content-Security-Policy meta tag found message: Can you explain why you regard this as "failing to work? That message is output (to the console) by the plugin if your content doesn't have a Content-Security-Policy meta tag (and isn't displayed if your content does have the tag). That console message surfacing in Ripple seems to me to be expected behavior.

@eddieSullivan
Copy link
Author

Sorry, I should have been clear. The meta tag is indeed present in the source HTML file, and the warning does not appear when run on the Android emulator platform.

@TimBarham
Copy link
Member

Hmmm, that's weird. I can't repro (that is, I see the message if I don't have the CSP meta tag, and don't see it if I do). The plugin's logic that handles this is very basic, and it doesn't seem it is doing anything where Ripple have any impact.

Couple of questions:

  • What version of Ripple are you using (ripple version from a shell prompt will tell you that)?
  • Are you able to repro with a blank Cordova project (as in "cordova create foo")?

@TimBarham
Copy link
Member

Oh, and the InAppBrowser problem is because the plugin specifically bypasses Ripple here:

    // special patch to correctly work on Ripple emulator (CB-9760)
    if (window.parent && !!window.parent.ripple) { // https://gist.github.com/triceam/4658021
        module.exports = window.open.bind(window); // fallback to default window.open behaviour
        return;
    }

@TimBarham TimBarham added the bug label Feb 25, 2016
@eddieSullivan
Copy link
Author

I wonder why InAppBrowser has that "special patch"? I will try removing that check and see if it helps. If not, I'm sure I can find a workaround.

The Content-Security-Policy meta tag issue appears to have been user error. Apparently there's something wrong with my build setup, because clearing out the www directory and rebuilding caused the issue to go away. I'll keep an eye on the issue and update you if I can reproduce it more reliably.
Thanks for your help!

@TimBarham
Copy link
Member

Ok, thanks @eddieSullivan. Good news about the CSP.

I believe that code was added to InAppBrowser because some apps relied on a real window being opened (often hidden) to do stuff (where-as Ripple would just display a popup showing the URL that would have been opened, but didn't actually open it). The proper fix, I think, will be to modify Ripple in some fashion to actually open a window (then remove that code from InAppBrowser).

@eddieSullivan
Copy link
Author

Ah, I see. That seems about right, because when I remove that special patch, I see a faked-out page (although not in a popup) with a "InAppBrowser Emulation It is like a browser, only it is all up in your app" message.

Ok, thanks again. If I have some time I'll dig more into the proper fix you describe.

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