Page MenuHomePhabricator

Add 'url' module for native URL constructor (with conditionally loaded polyfill)
Closed, ResolvedPublic

Description

https://developer.mozilla.org/en-US/docs/Web/API/URL/URL
https://url.spec.whatwg.org/
https://github.com/whatwg/url

Natively available in Firefox 26+, Chrome, Safari, Opera. Not in any version of IE yet.

Spec is still relatively new, but use of it (with conditional polyfill) may simplify our code base, speed up execution, and get us more in line with standardised interfaces and parsing algorithms. Right now we have a custom regex that works for most URLs but does have its shortcomings.

Event Timeline

Krinkle raised the priority of this task from to Needs Triage.
Krinkle updated the task description. (Show Details)
Krinkle subscribed.
Krinkle renamed this task from Evaluate using the native "URL" constructor to Add 'url' module for native URL constructor (with conditionally loaded polyfill).Apr 2 2019, 3:34 AM
Krinkle added a subscriber: StudiesWorld.
Krinkle triaged this task as Medium priority.

Change 763279 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@master] web2017-polyfills: Add WHATWG URL polyfill

https://gerrit.wikimedia.org/r/763279

Change 763279 merged by jenkins-bot:

[mediawiki/core@master] web2017-polyfills: Add WHATWG URL polyfill

https://gerrit.wikimedia.org/r/763279

By the way, replacing mw.Uri with the URL polyfill from T103379 does not fix the issue – I tested on IE 11, and the polyfill also throws an exception.

I'm working on a fix, re-opening to track the work here.

Change 771445 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@master] URL: Update 'url' polyfill to latest version containing our fixes

https://gerrit.wikimedia.org/r/771445

Change 771445 merged by jenkins-bot:

[mediawiki/core@master] web2017-polyfills: Update URL polyfill to latest version with our fixes

https://gerrit.wikimedia.org/r/771445