-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[webview_flutter_wkwebview] Fixes inspectable compile-time error and crash from equal NSURL
s
#4340
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
Conversation
NSURL
s
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
@@ -201,7 +201,10 @@ - (void)setInspectableForWebViewWithIdentifier:(NSNumber *)identifier | |||
inspectable:(NSNumber *)inspectable | |||
error:(FlutterError *_Nullable *_Nonnull)error { | |||
if (@available(macOS 13.3, iOS 16.4, tvOS 16.4, *)) { | |||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130300 || __IPHONE_OS_VERSION_MAX_ALLOWED >= 160400 || \ | |||
__TV_OS_VERSION_MAX_ALLOWED >= 160400 |
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.
Let's not add tvOS checks, since we don't support tvOS, or have any plans to.
@@ -465,6 +465,8 @@ - (void)testContentInsetsSumAlwaysZeroAfterSetFrame { | |||
XCTAssertTrue(CGRectEqualToRect(webView.frame, CGRectMake(0, 0, 300, 100))); | |||
} | |||
|
|||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130300 || __IPHONE_OS_VERSION_MAX_ALLOWED >= 160400 || \ | |||
__TV_OS_VERSION_MAX_ALLOWED >= 160400 |
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.
We shouldn't need this check on tests, since most clients aren't running our native tests, and it's fine for us to require a new Xcode for development.
@cyanglaz @stuartmorgan Have you seen this error before?
Everything runs and builds locally. Is the warning the source of the build failure? |
This warning is the cause of the build failure; if you scroll up further you can find the original in context. You're passing nil in a non-nullable callback; you need to pass a no-op block instead. |
@@ -201,7 +201,9 @@ - (void)setInspectableForWebViewWithIdentifier:(NSNumber *)identifier | |||
inspectable:(NSNumber *)inspectable | |||
error:(FlutterError *_Nullable *_Nonnull)error { | |||
if (@available(macOS 13.3, iOS 16.4, tvOS 16.4, *)) { | |||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130300 || __IPHONE_OS_VERSION_MAX_ALLOWED >= 160400 |
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.
Hm, looking at this again: do @available
checks evaluate to false automatically when the compile SDK is lower than the available version? I'm not sure they do, and if they don't then this would, if compiled with an SDK < 16.4 but run on 16.4, silently no-op.
I guess that's not that big a deal for this particular case, but we should investigate before using this pattern again.
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'm not sure they do, and if they don't then this would, if compiled with an SDK < 16.4, but run on 16.4, silently no-op.
Yea, I think you're correct. This could probably use an additional #ifelse
that also returns a FlutterError
. I didn't quite understand this until after I autosubmitted.
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
Hi there, could anyone help provide an update on when this will be released? |
…ror and crash from equal `NSURL`s (flutter/packages#4340)
flutter/packages@cdae854...a03b900 2023-07-03 [email protected] [webview_flutter_wkwebview] Fixes inspectable compile-time error and crash from equal `NSURL`s (flutter/packages#4340) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Fixes flutter/flutter#128422 by using pointer equality in the
NSMapTable
. From my understanding and testing it seems that the default mode for NSMapTable is to copy objects that implementNSCopyable
. The only class we wrap that does seems to implementNSCopyable
isNSURL
so this class eventually led to a race condition where adding anNSURL
that was equivalent to an already added one would replace the original.Note that we should probably now add an error when adding an already present instance. However, a clear method needs to be added to the
InstanceManager
first so that hot reload will continue working. This is the current solution on Android.Fixes flutter/flutter#129587 by adding a compile-time check around the use of
WKWebView.inspectable
. Solution used from:https://stackoverflow.com/questions/76216183/how-to-debug-wkwebview-in-ios-16-4-1-using-xcode-14-2
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.