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

Set webView.inspectable to true for debug builds on iOS >= 16.4 #1300

Merged
merged 1 commit into from
Apr 7, 2023

Conversation

BBosman
Copy link
Contributor

@BBosman BBosman commented Mar 21, 2023

Platforms affected

iOS

Motivation and Context

With the introduction of iOS 16.4 WKWebView instances will no longer be inspectable by default.

Details: Enabling the Inspection of Web Content in Apps

Description

This PR honors that change for Release builds, but explicitly sets the inspectability to YES for Debug builds by default.
It also introduce an override option, so consumers can influence this decision in their own build.

Testing

Tested the code in one of our own apps.

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

Copy link
Member

@dpogue dpogue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The master branch is already targeting the next major version, so I think we want to default this to NO in release builds (and YES in debug builds).

Thanks for adding the preference too! We'll want to add that to the cordova-docs repo (and maybe file an issue on cordova-android to obey the preference for inspecting there too)

@breautek breautek added this to the 7.0.0 milestone Mar 21, 2023
@BBosman BBosman changed the title Set webView.inspectable to true on iOS >= 16.4 Set webView.inspectable to true for debug builds on iOS >= 16.4 Mar 22, 2023
@BBosman
Copy link
Contributor Author

BBosman commented Mar 22, 2023

@dpogue I've updated the code and PR description based on your feedback.

I had to remove the default value for the setting from defaults.xml, as that would always override the build based default setting in the code.

Copy link
Member

@dpogue dpogue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@BBosman
Copy link
Contributor Author

BBosman commented Mar 22, 2023

I can't explain the CI failure, but it looks unrelated to my changes?

@dpogue
Copy link
Member

dpogue commented Mar 22, 2023

I can't explain the CI failure, but it looks unrelated to my changes?

yeah, test failures are due to some URL parsing changes in Node 18, unrelated to these changes 😞

@breautek
Copy link
Contributor

I can't explain the CI failure, but it looks unrelated to my changes?

That issue is caused by #1290 for reference.

breautek
breautek previously approved these changes Mar 22, 2023
@breautek breautek dismissed their stale review March 24, 2023 14:40

Concerns about allowing inspectable webview in the CordovaWebview where it has access to native device APIs

Copy link
Contributor

@breautek breautek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclaimer: Non-lawyer analysis.

I revoked my previous approval out of concerns that allowing webview to be inspectable may be in a clear violation of Section 4.7.1 of the App Guidelines.

However I believe Section 4.7.1 only applies to code that isn't bundled with the App binary. And I didn't find anything else (In the Apple Developer Agreement and XCode terms of use) that says device APIs cannot be exposed to users outside the developer platform.

Therefore, at the core, I think Cordova is in the clear, for both the core platform & use in the in app browser plugin (should the plugin also obey this kind of flag, which I know there is a PR to introduce that functionality).

If the developer does import code from remote sources then they may be breaching the agreement with Apple, however that isn't the concern of Apache Cordova, it will be up to the end-users to ensure they comply with Apple's terms.

So I'm returning my approval.

@dpogue dpogue linked an issue Apr 6, 2023 that may be closed by this pull request
Copy link
Member

@NiklasMerz NiklasMerz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with an iPad and code looks good to me. I will also merge this into a path release

@NiklasMerz NiklasMerz modified the milestones: 7.0.0, 6.2.1 Apr 7, 2023
@NiklasMerz NiklasMerz merged commit e1e21cf into apache:master Apr 7, 2023
@BBosman BBosman deleted the inspectable branch April 7, 2023 14:29
gudjao added a commit to gudjao/cordova-ios that referenced this pull request Apr 7, 2023
gudjao added a commit to gudjao/cordova-ios that referenced this pull request Apr 12, 2023
spoxies added a commit to spoxies/cordova-plugin-ionic-webview that referenced this pull request Apr 13, 2023
knubie added a commit to mochi-cards/cordova-plugin-ionic-webview that referenced this pull request Apr 26, 2023
@daviesdoclc
Copy link

This is not working for me on iOS 16.4.1, MacOS 13.3.1, Safari 16.4.

I'm running as follows:
cordova run ios --device --debug

I also tried setting InspectableWebview to true in config.xml.

@breautek
Copy link
Contributor

This is not working for me on iOS 16.4.1, MacOS 13.3.1, Safari 16.4.

I'm running as follows: cordova run ios --device --debug

I also tried setting InspectableWebview to true in config.xml.

Let's create a new issue, using the issue template so that we can try to drill down and isolate the cause.

ungit added a commit to 4geo/cordova-plugin-ionic-webview that referenced this pull request May 30, 2023
spoxies added a commit to spoxies/cordova-plugin-ionic-webview that referenced this pull request Jun 2, 2023
EiyuuZack pushed a commit to OutSystems/cordova-ios that referenced this pull request Jul 4, 2023
giralte-ionic pushed a commit to ionic-team/cordova-plugin-ionic-webview that referenced this pull request Aug 29, 2023
* extension -> mime explicit mapping

* Set webView.inspectable to true for debug builds on iOS >= 16.4

Duplicate/partial implementation of apache/cordova-ios#1300

---------

Co-authored-by: Pavel Kurdyukov <kurdyukov.pavel@gmail.com>
jfougere pushed a commit to jfougere/cordova-plugin-ionic-webview that referenced this pull request Aug 31, 2023
* extension -> mime explicit mapping

* Set webView.inspectable to true for debug builds on iOS >= 16.4

Duplicate/partial implementation of apache/cordova-ios#1300

---------

Co-authored-by: Pavel Kurdyukov <kurdyukov.pavel@gmail.com>
akrcc pushed a commit to akrcc/cordova-plugin-ionic-webview that referenced this pull request Dec 12, 2023
* extension -> mime explicit mapping

* Set webView.inspectable to true for debug builds on iOS >= 16.4

Duplicate/partial implementation of apache/cordova-ios#1300

---------

Co-authored-by: Pavel Kurdyukov <kurdyukov.pavel@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mark the webview as inspectable in iOS 16.4
5 participants