Bug 191141 - Forward original fragment identifier into System Preview
Summary: Forward original fragment identifier into System Preview
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Dean Jackson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-10-31 17:25 PDT by Dean Jackson
Modified: 2018-10-31 18:03 PDT (History)
2 users (show)

See Also:


Attachments
Patch (4.64 KB, patch)
2018-10-31 17:32 PDT, Dean Jackson
wenson_hsieh: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dean Jackson 2018-10-31 17:25:51 PDT
Forward original fragment identifier into System Preview
Comment 1 Radar WebKit Bug Importer 2018-10-31 17:29:41 PDT
<rdar://problem/45717542>
Comment 2 Dean Jackson 2018-10-31 17:32:25 PDT
Created attachment 353561 [details]
Patch
Comment 3 Wenson Hsieh 2018-10-31 17:45:23 PDT
Comment on attachment 353561 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=353561&action=review

r=mews

> Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:108
> +- (void)finish:(WebCore::URL)url withFragmentIdentifier:(NSString*)fragmentIdentifier

Nit - NSString *

> Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:114
> +            self.completionHandler([NSURL URLWithString:[NSString stringWithFormat:@"%@#%@", (NSString*)url.string(), (NSString*)fragmentIdentifier]], nil);

Nit - More NSString *

Instead of passing the fragment separately, would it be cleaner to just use URL::setFragmentIdentifier on the destinationURL?
Comment 4 Dean Jackson 2018-10-31 17:47:13 PDT
Comment on attachment 353561 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=353561&action=review

>> Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:114
>> +            self.completionHandler([NSURL URLWithString:[NSString stringWithFormat:@"%@#%@", (NSString*)url.string(), (NSString*)fragmentIdentifier]], nil);
> 
> Nit - More NSString *
> 
> Instead of passing the fragment separately, would it be cleaner to just use URL::setFragmentIdentifier on the destinationURL?

Yes. I forgot that I didn't have an NSURL here (which are immutable).
Comment 5 Dean Jackson 2018-10-31 17:49:32 PDT
Comment on attachment 353561 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=353561&action=review

>>> Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:114
>>> +            self.completionHandler([NSURL URLWithString:[NSString stringWithFormat:@"%@#%@", (NSString*)url.string(), (NSString*)fragmentIdentifier]], nil);
>> 
>> Nit - More NSString *
>> 
>> Instead of passing the fragment separately, would it be cleaner to just use URL::setFragmentIdentifier on the destinationURL?
> 
> Yes. I forgot that I didn't have an NSURL here (which are immutable).

Oh wait. I was right - I do get an NSURL. I then change it into a WebCore::URL, then back into an NSURL, then into another NSURL with the fragment. I can definitely clean this up.
Comment 6 Dean Jackson 2018-10-31 18:03:41 PDT
Committed r237664: <https://trac.webkit.org/changeset/237664>