[Webkit-unassigned] [Bug 174816] [GTK][WPE] Need a function to convert internal URI to display ("pretty") URI

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 8 05:48:04 PST 2018


https://bugs.webkit.org/show_bug.cgi?id=174816

--- Comment #18 from Michael Catanzaro <mcatanzaro at igalia.com> ---
(In reply to Carlos Garcia Campos from comment #17)
> Isn't this what WebCore::userVisibleString() does? Can't we implement that
> in WebCore instead? or even make the current objc implementation
> cross-platform?

I didn't know about this. WebCore::userVisibleString only exists in Cocoa ports. It's declared in the Objective C++ header WebCoreNSURLExtras.h. It converts an NSURL* to an NSString*. We can certainly create a new function with the same name, converting a const char* to a char* instead, and move it to the platform layer. Then it could be used in the pasteboard code, same as on Mac, if we ever decide that it'd be desirable to copy the prettified URL to the clipboard. But I'm not sure that's actually what we want to do with the pasteboard, and we can always move it down from the API layer to the platform layer in the future if we do decide to do that. So I think it's probably better where it is now.

> > Source/WebKit/UIProcess/API/glib/WebKitURIUtilities.cpp:47
> > +static const UIDNA* internationalDomainNameTranscoder()
> > +{
> > +    static UIDNA* transcoder;
> > +    static std::once_flag onceFlag;
> > +    std::call_once(onceFlag, [] {
> > +        UErrorCode error = U_ZERO_ERROR;
> > +        // These flags should be synced with URLParser::internationalDomainNameTranscoder() in URLParser.cpp.
> > +        transcoder = uidna_openUTS46(UIDNA_CHECK_BIDI | UIDNA_CHECK_CONTEXTJ | UIDNA_NONTRANSITIONAL_TO_UNICODE | UIDNA_NONTRANSITIONAL_TO_ASCII, &error);
> > +        RELEASE_ASSERT(U_SUCCESS(error));
> > +        RELEASE_ASSERT(transcoder);
> > +    });
> > +    return transcoder;
> > +}
> 
> Why are we duplicating this? Can't we just use
> URLParser::internationalDomainNameTranscoder()?

Yes, that's a good idea.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180108/e2320509/attachment.html>


More information about the webkit-unassigned mailing list