WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 214329
REGRESSION (
r264101
): Sharing a link attaches an image instead of the URL
https://bugs.webkit.org/show_bug.cgi?id=214329
Summary
REGRESSION (r264101): Sharing a link attaches an image instead of the URL
Wenson Hsieh
Reported
2020-07-14 16:08:15 PDT
<
rdar://problem/65513607
>
Attachments
Patch
(4.72 KB, patch)
2020-07-14 16:23 PDT
,
Wenson Hsieh
thorton
: review+
Details
Formatted Diff
Diff
Patch for landing
(4.72 KB, patch)
2020-07-14 16:55 PDT
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Wenson Hsieh
Comment 1
2020-07-14 16:23:53 PDT
Created
attachment 404301
[details]
Patch
Tim Horton
Comment 2
2020-07-14 16:35:17 PDT
Might be even better to use some WTF thing, but this is fine as a quick fix
Wenson Hsieh
Comment 3
2020-07-14 16:37:59 PDT
Comment hidden (obsolete)
(In reply to Tim Horton from
comment #2
)
> Might be even better to use some WTF thing, but this is fine as a quick fix
That’s true! I could make this something like URL(element.imageURL).protocolIs(“data");
Wenson Hsieh
Comment 4
2020-07-14 16:38:39 PDT
(In reply to Tim Horton from
comment #2
)
> Might be even better to use some WTF thing, but this is fine as a quick fix
That’s true! I could make this something like URL(element.imageURL).protocolIsData();
Devin Rousso
Comment 5
2020-07-14 16:39:56 PDT
Comment on
attachment 404301
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=404301&action=review
r=me
> Source/WebKit/ChangeLog:10 > +
r264101
added logic that attempts to share an activated (i.e. long-pressed) element as an image, if the image > + URL for the element is equal to "data" (ignoring case sensitivity). However, in the case where the image URL is
NIT: it's really comparing the URL's scheme, not the entire URL itself
> Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm:831 > - if ([element.imageURL.scheme caseInsensitiveCompare:@"data"] == NSOrderedSame && element.image && [delegate respondsToSelector:@selector(actionSheetAssistant:shareElementWithImage:rect:)]) > + if ([@"data" caseInsensitiveCompare:element.imageURL.scheme] == NSOrderedSame && element.image && [delegate respondsToSelector:@selector(actionSheetAssistant:shareElementWithImage:rect:)])
Is it worth explicitly checking that `element.imageURL` is truthy so that it's explicit/obvious that this codepath expects it to be non-`nil` (i.e. have `element.image && element.imageURL` at the beginning)?
> Tools/TestWebKitAPI/Tests/ios/ShareSheetTests.mm:114 > + EXPECT_WK_STREQ("
https://www.apple.com/
", [[activityItems objectAtIndex:0] absoluteString]);
So how would this fail if the above code changed in the future? Would `absoluteString` be `nil` (and some other "form" would be set instead) or would it be the dataURL?
Wenson Hsieh
Comment 6
2020-07-14 16:44:21 PDT
Thanks for the reviews! (In reply to Devin Rousso from
comment #5
)
> Comment on
attachment 404301
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=404301&action=review
> > r=me > > > Source/WebKit/ChangeLog:10 > > +
r264101
added logic that attempts to share an activated (i.e. long-pressed) element as an image, if the image > > + URL for the element is equal to "data" (ignoring case sensitivity). However, in the case where the image URL is > > NIT: it's really comparing the URL's scheme, not the entire URL itself
Yep, I missed a word here ("scheme").
> > > Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm:831 > > - if ([element.imageURL.scheme caseInsensitiveCompare:@"data"] == NSOrderedSame && element.image && [delegate respondsToSelector:@selector(actionSheetAssistant:shareElementWithImage:rect:)]) > > + if ([@"data" caseInsensitiveCompare:element.imageURL.scheme] == NSOrderedSame && element.image && [delegate respondsToSelector:@selector(actionSheetAssistant:shareElementWithImage:rect:)]) > > Is it worth explicitly checking that `element.imageURL` is truthy so that > it's explicit/obvious that this codepath expects it to be non-`nil` (i.e. > have `element.image && element.imageURL` at the beginning)?
I don’t think there’s much benefit to doing so, but I’m changing this to URL(element.imageURL).protocolIsData() anyways.
> > > Tools/TestWebKitAPI/Tests/ios/ShareSheetTests.mm:114 > > + EXPECT_WK_STREQ("
https://www.apple.com/
", [[activityItems objectAtIndex:0] absoluteString]); > > So how would this fail if the above code changed in the future? Would > `absoluteString` be `nil` (and some other "form" would be set instead) or > would it be the dataURL?
Depending on the nature of the failure, any of the above!
Wenson Hsieh
Comment 7
2020-07-14 16:55:25 PDT
Created
attachment 404308
[details]
Patch for landing
EWS
Comment 8
2020-07-14 17:20:25 PDT
Committed
r264383
: <
https://trac.webkit.org/changeset/264383
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 404308
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug