Open question: do we even need to clobber a symbol, or would
cordova.require('org.apache.cordova.iab').open() suffice?

Could we leave compatibility by default, but support opting-in to the
switch now?  Perhaps a <runs/> flag in the plugin and clobber window.open
from javascript only if a <preference name="IABShouldNotClobberWindowOpen">
is not set, instead of using unconditional <clobbers/> from plugin.xml?
That may have a slight implication about when the clobber happens during
startup, but is unlikely to be an issue in practice.

-Michal

On Thu, Feb 12, 2015 at 5:19 PM, Jason Chase <[email protected]> wrote:

> For CB-8444, I'm proposing to eventually remove the clobber of
> 'window.open' that is done by the InAppBrowser plugin.
>
> The problem I'm trying to solve is unintended changes to the behaviour of
> window.open calls in an app.  An example of untended change is an app that
> adds a plugin which provides an external web-based authentication flow.
> The plugin has a dependency on InAppBrowser, in order to provide the
> web-based login.  The app developer would likely be unaware that the
> InAppBrowser plugin clobbers window.open.  As a result, window.open calls
> that would open the system browser, will show the pages in the InAppBrowser
> instead.
>
> The first step is to add a new API to access the InAppBrowser, instead of
> window.open.  The behaviour of the plugin is unchanged, it's just accessed
> via a different symbol.  This is covered by the referenced pull request
> [1].
>
> In a future major release, the second step is to remove the clobber of
> window.open.  If an app wishes all window.open calls to be handled by the
> InAppBrowser, the app can explicitly implement the clobber.  Conversely,
> other apps are no longer forced to work around the clobber of window.open.
>
> I'd welcome any comments on this proposal.  This includes any example use
> cases that want the clobber of window.open by the plugin.
>
> Thanks,
> Jason
> Google Cordova Team
>
> [1] https://github.com/apache/cordova-plugin-inappbrowser/pull/80
>

Reply via email to