Page MenuHomePhabricator

JS testing for WebAuthn
Closed, ResolvedPublic

Description

It was noticed after enabling translatewiki (and then the first export - https://github.com/wikimedia/mediawiki-extensions-WebAuthn/commit/2121d652f445f54d7847ccec0137659ff07f9e01 ) on the WebAuthn extension that were a few message key issues, and as such, some were removed incorrectly due to typos

So then Niklas questioned why banana wasn't being run in the extension, which was due to no JS testing really being done on the extension

I've added the testing in https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/WebAuthn/+/545851/ but there's quite a few things to be fixed up, which is being done in https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/WebAuthn/+/545855/

Details

Related Gerrit Patches:
mediawiki/extensions/WebAuthn : masterRemove ES6 features

Event Timeline

Reedy created this task.Oct 24 2019, 1:55 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 24 2019, 1:55 PM
Reedy updated the task description. (Show Details)Oct 24 2019, 2:05 PM
Reedy added a comment.Oct 24 2019, 2:58 PM

From James F on https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/WebAuthn/+/545855/

These files are still written in ES6(!) so won't work in MW, but it's a start.

@ItSpiderman you might want to look at correcting that :)

@Reedy Can you please clarify what exactly needs to be done? The statement "still written in ES6(!) so won't work in MW" is confusing me. The code was developed against the MediaWiki codebase that has been deployed to Wikipedia at the time when this extension was written. So why would it not work anymore?

I also believe the cleanup introduced an error: https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/WebAuthn/+/545855/7/resources/login.js
jQuery, mediaWiki were removed from the call of the IIFE, but $, mw were kept in the signature. Therefore $ is undefined.

@Reedy Can you please clarify what exactly needs to be done? The statement "still written in ES6(!) so won't work in MW" is confusing me. The code was developed against the MediaWiki codebase that has been deployed to Wikipedia at the time when this extension was written. So why would it not work anymore?

I guess whether it "works" is more dependant on the browser version you use. However, browsers we support for "modern" don't necessarily support ES6 - this includes (but isn't limited to) IE, older versions of Safari, Opera... I'm suspecting you tested on (like I did) FF/Chrome (and recent versions at that), which MW supports with JS functionality

There's been discussions about transpiling ES6 back to ES5, but they have been declined for various reasons

I also believe the cleanup introduced an error: https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/WebAuthn/+/545855/7/resources/login.js
jQuery, mediaWiki were removed from the call of the IIFE, but $, mw were kept in the signature. Therefore $ is undefined.

Wonder why the testing didn't pick up on that one

Okay, thanks. So avoiding ES6 features as listed in your reference would be sufficient?

Okay, thanks. So avoiding ES6 features as listed in your reference would be sufficient?

Indeed. I think (but I'm no JS expert) the only code that's really problematic in WebAuthn is the stuff like c => c.charCodeAt( 0 ) and maybe one use of const

Change 546179 had a related patch set uploaded (by ItSpiderman; owner: ItSpiderman):
[mediawiki/extensions/WebAuthn@master] Remove ES6 features

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

Removed all (hopefully) ES6 features. However, any browser that supports WebAuthn is likely to support ES6 as well

Is this code only executed after checking for webauthn-capabilities?

Yes, support check is done very early, before any of the fancy code gets executed

Okay. In that case it's actually not really required to fix this. But hey, now it's done 😀

Change 546179 merged by jenkins-bot:
[mediawiki/extensions/WebAuthn@master] Remove ES6 features

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

I've added the testing in https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/WebAuthn/+/545851/ but there's quite a few things to be fixed up, which is being done in https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/WebAuthn/+/545855/

@Reedy: https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/WebAuthn/+/545855/ has been merged. Is there more to do here, or can this task be resolved?

Reedy closed this task as Resolved.Dec 18 2019, 2:49 AM
Reedy assigned this task to Jdforrester-WMF.