-
Notifications
You must be signed in to change notification settings - Fork 17
Web Compatibility Issue: Sugar versions v0.9 through v1.3.9 (inclusive) #37
Comments
There is a note in Sugar/CAUTION.md that indicates the override fix may be present since v1.4.0.
I think the fix was implemented in andrewplummer/Sugar@bc189b4 by setting It may be easier for consumers to update to v1.4.0 rather than v1.5.0, however there are breaking changes in either case. |
fantastic, thank you @Andrew-Cottrell -- It will depend on how wide spread this is ... but hopefully we can work with people to update and manage to keep the name. |
Another option: Can we accept string as the first argument? It's useful to simplify code [
{ name: 'a', sex: 'F' },
{ name: 'b', sex: 'M' },
{ name: 'c', sex: 'F' },
].groupBy('sex') // https://lodash.com/docs/4.17.15#groupBy
['one', 'two', 'three'].groupBy('length'); |
That alone wouldn't fix the compatibility issue, the sugarjs version also takes a second argument, a function that gets called for each group. |
We have another failure: webcompat/web-bugs#98458 |
Is this a case where dropping the preposition would help, or is It doesn't seem like |
We will have to check if there are collisions on other names -- adding new prototype methods to array often runs into this. But, yes, I am starting to think we may need a rename if we find more sites are failing. In the ideal case, we will be able to resolve them like we did with |
Not sure if it's time to start throwing out other name suggestions yet, but one idea is |
Subscribing to keep up with resolution attempts, and holding off shipping in V8 in the meantime. |
“old versions of sugar” seems like a feasible-but-large evangelism task; I’m still hopeful we’ll be able to keep the existing names. |
|
More name ideas:
|
@jridgewell does that indicate sugarjs in general, or these specific problematic versions? |
I don't know how to filter for the problematic version. This is looking for |
There's a EDIT: Seem's |
Hi, I help maintain HTTP Archive and I was curious to see if I can help after @connorjclark pinged me about
I ran with @connorjclark's suggestion and implemented it using the slightly more efficient One side note is that we're relying mostly on Wappalyzer now for technology detections, so @connorjclark if you did want to add support for Sugar, I'd recommend patching that as well. SELECT
client,
page,
url,
REGEXP_EXTRACT(body, r'\bSugar v(\d[\d.]+)') AS sugar_version
FROM
`httparchive.almanac.summary_response_bodies`
WHERE
date = '2021-07-01' AND
type IN ('html', 'script') AND
REGEXP_CONTAINS(body, r'\bSugar v(\d[\d.]+)') See the results in Google Sheets I counted the number of unique pages for each combination of version and client (desktop or mobile):
So there are no websites (that match the version regex pattern) that use a version of Sugar in the range 1.1.2-1.4. And there are only 90 of them that use it at all (79 desktop and 70 mobile, with most sites in both). We can also see how popular these 90 sites are by looking up their coarse ranking data:
Some websites are in the top 100k most popular according to CrUX, but most are in the longest part of the tail in the top 10M (there are only 8M sites in the dataset). The 4 in the top 100k are:
And they all happen to be on v2.0.4. Hope this was somewhat helpful. Let me know if there's anything else I can do. And generally speaking, I'm super interested to get more involved with web standards groups and help you make more data-driven decisions using the HTTP Archive dataset. Feel free to ping me any time! |
Hi @rviscomi and thanks for the analysis! I have two changes that I'd like to make to the queries. First, it's very common to minify JS for production, and basically all of them will remove comments unless a So something like this should get us better results: SELECT
client,
page,
url,
REGEXP_EXTRACT(body, r'\bSugar Library v(\d[\d.]+)') AS sugar_version
# ^ May be null if the comment is not found, as it may have been stripped
FROM
`httparchive.almanac.summary_response_bodies`
WHERE
date = '2021-07-01' AND
type IN ('html', 'script') AND
body LIKE "%SugarMethods%" AND
NOT REGEXP_CONTAINS(body, r"Sugar v\d\.\d") (Sorry, not at my corp computer so I don't have the ability to run queries) |
Thanks @jridgewell that explains why the results seem to start at v1.5.0 Here's the query I ran, trying to include all versions: SELECT
client,
rank,
page,
url,
REGEXP_EXTRACT(body, r'\bSugar(?: Library)? v(\d[\d.]+)') AS sugar_version
FROM
`httparchive.almanac.summary_response_bodies`
WHERE
date = '2021-07-01' AND
type IN ('html', 'script') AND
body LIKE "%SugarMethods%" Results added to a new tab in the Sheet
Several hundred pages contain the And here's the ranking breakdown:
So using this new method, more like 1,300 websites use Sugar (accounting for the ~90 or so websites on v1.5+). Here's the most popular 23 websites:
Filtering to only v0.9-v.1.3.9:
254 websites in total are known to use a problematic version. Even assuming 100% of the unknown versions are within the problematic range, that's still only a total of 660 websites. |
https://bugs.webkit.org/show_bug.cgi?id=235968 `Array#groupBy` name has web-compat issue <tc39/proposal-array-grouping#37> Reverted changeset: "[JSC] Enable Array#groupBy and Array#groupByToMap" https://bugs.webkit.org/show_bug.cgi?id=235549 https://commits.webkit.org/r288538 Canonical link: https://commits.webkit.org/246645@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=235968 `Array#groupBy` name has web-compat issue <tc39/proposal-array-grouping#37> Reverted changeset: "[JSC] Enable Array#groupBy and Array#groupByToMap" https://bugs.webkit.org/show_bug.cgi?id=235549 https://commits.webkit.org/r288538 git-svn-id: http://svn.webkit.org/repository/webkit/trunk@288901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Pagerduty has now updated to a newer version of sugar.js -- do we have a plan on how to go through contacting the rest of the potentially impacted sites? |
lol heads up for others who might visit the site described as "popular" above out of curiosity: it's probably not something you wanna visit at work |
Hi, please forgive me for resurrecting a closed thread. As someone who has been interested in Sugar for a long time but never implemented due to the age old practice of "Never monkey patch primitives", I think its a huge bummer that we are moving forward with static methods instead of instance methods because only 660 sites chose to do that. |
@DaddyWarbucks browsers are unwilling to cause that breakage, and have indicated that they are very unwilling to consider any prototype methods that may collide in the future (especially on Arrays), so there's really nothing to be done. Certainly if you can convince all of those sites to upgrade, a change could be made, but that seems untenable. |
Thanks for the response @ljharb. I appreciate the committee and browsers for not breaking the web. But, if this Sugar issue is the primary reason for using static methods, I politely encourage the committee to take on a less strict opinion.
The Sugar.js repo is unmaintained, or at least inactive. I haven't seen @andrewplummer mentioned anywhere. I also searched for Discord, Slack, Twitter but didn't find much. Perhaps they could help us out by updating the README, etc. Given the importance and ergonomics of Thanks for any consideration. |
@DaddyWarbucks Here's a good writeup of why "don't break the web" is sacrosanct. I know it's frustrating as a developer to have to use the slightly more annoying form. But our first duty is to the users of the web. And it's much more frustrating if one day everyone in Brazil wakes up and finds that their browser updated and now random government websites aren't working. Web browsers are not going to prioritize JS developers being able to use |
@bakkot Thanks for the response. I remember SmoohGate, but I was hoping this smaller footprint might be acceptable. I've got one last suggestion/question, and I'll go ahead and make it here instead of opening another new issue about a rename. I don't believe I have seen Thanks. |
Browsers have already indicated they refuse to try anything else on Array.prototype for this proposal, after |
Hi,
Unfortunately, we have found a web compat issue with the sugar.js library. Details here: https://bugzilla.mozilla.org/show_bug.cgi?id=1750812#c5
I didn't check all possible versions for breakage. For sure it is broken on 1.1.2, it looks (from reading the code) that it is fixed by 1.5.
I will add a pref on nightly to allow our users to keep working, and see how broad this issue is. Maybe if it is just a few consumers we can get around it...
The text was updated successfully, but these errors were encountered: