Re: nsIURI API changes - punycode domain names

2017-08-10 Thread Anne van Kesteren
On Wed, Aug 9, 2017 at 8:37 PM, Boris Zbarsky  wrote:
> On 8/9/17 1:43 PM, Daniel Veditz wrote:
>>
>> What do web pages do if they want to reflect a pretty URL into their page?
>
> Cry, basically.

I have a proposal: https://github.com/whatwg/url/pull/288.

There's two issues:

1) Ryan Sleevi is opposed and nobody else from Google seems to care
enough to convince him. (We could potentially try to convince them by
shipping something in Firefox and Safari (Apple has shown interest).)

2) What is the exact algorithm that it should use. In particular,
should it use the same heuristics as the browser for whether it
becomes Punycode or Unicode, should those heuristics be standardized,
or should it always go to Unicode if possible, even if the browser
wouldn't (e.g., in case of mixed scripts).


> This is the fundamental reason I was opposed to this behavior change, but
> apparently no other browsers care about this issue and we were getting
> compat problems.  :(

Well, we also didn't use an algorithm that was standardized anywhere
so other browsers sticking with Punycode seems fairly reasonable in
light of that.


-- 
https://annevankesteren.nl/
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: nsIURI API changes - punycode domain names

2017-08-09 Thread Boris Zbarsky

On 8/9/17 1:43 PM, Daniel Veditz wrote:

​What do web pages do if they want to reflect a pretty URL into their page?


Cry, basically.

This is the fundamental reason I was opposed to this behavior change, 
but apparently no other browsers care about this issue and we were 
getting compat problems.  :(


-Boris
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: nsIURI API changes - punycode domain names

2017-08-09 Thread Valentin Gosu
On 9 August 2017 at 19:43, Daniel Veditz  wrote:

> On Wed, Aug 9, 2017 at 9:57 AM, Valentin Gosu 
> wrote:
>
>> This is a definite improvement in terms of web-compat. document.origin,
>> location.href, etc will from now on return punycode.
>>
>
> ​What do web pages do if they want to reflect a pretty URL into their
> page? Will everyone have to include script like https://stackoverflow.com/
> questions/183485/converting-punycode-with-dash-character-
> to-unicode#answer-301287 ?​
>
> ​Should decodeURI() do it automatically? Or with a new parameter? Some new
> function?
>

I don't know if changing decodeURI is the best course of action.
The URL spec used to have methods for domainToUnicode and domainToASCII,
but these were removed [1]. Perhaps it's time to revisit that decision.

[1]
https://github.com/whatwg/url/commit/2bd0f59b98024921ab90e628b7a526cca5abcb5f
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: nsIURI API changes - punycode domain names

2017-08-09 Thread Daniel Veditz
On Wed, Aug 9, 2017 at 9:57 AM, Valentin Gosu 
wrote:

> This is a definite improvement in terms of web-compat. document.origin,
> location.href, etc will from now on return punycode.
>

​What do web pages do if they want to reflect a pretty URL into their page?
Will everyone have to include script like
https://stackoverflow.com/questions/183485/converting-punycode-with-dash-character-to-unicode#answer-301287
?​

​Should decodeURI() do it automatically? Or with a new parameter? Some new
function?

-Dan Veditz
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


nsIURI API changes - punycode domain names

2017-08-09 Thread Valentin Gosu
TL;DR: we have made some changes to the nsIURI API that affect IDN domain
names

Before:
ASCII - GetAsciiSpec, GetAsciiHost, GetAsciiHostPort
UTF-8 - GetSpec, GetPrePath, GetHost, GetHostPort

Now:
UTF-8 - GetDisplaySpec, GetDisplayPrePath, GetDisplayHost,
GetDisplayHostPort
ASCII - GetAsciiSpec, GetAsciiHost, GetAsciiHostPort
ASCII (but preffable) - GetSpec, GetPrePath, GetHost, GetHostPort
pref is network.standard-url.punycode-host defaults to true

Bug 945240 changed the internal representation of nsStandardURL, and added
the pref to also reflect this change via the nsIURI API. Bug 1380617 flips
the pref, and also fixes the unit tests and several places in the UI that
relied on GetHost* returning UTF-8 strings.
This is a definite improvement in terms of web-compat. document.origin,
location.href, etc will from now on return punycode.
There are still places in the UI which need to be fixed, such as the
devtools (bug 1380932). If you come across something that should show the
unicode hostname, but instead shows punycode, please file a bug blocking
bug 1380617.
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform