Last modified: 2014-06-11 23:20:57 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T67643, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 65643 - Deprecation warnings in JS console
Deprecation warnings in JS console
Status: RESOLVED FIXED
Product: MobileFrontend
Classification: Unclassified
stable (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-22 17:07 UTC by Juliusz Gonera
Modified: 2014-06-11 23:20 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Juliusz Gonera 2014-05-22 17:07:32 UTC
There are two warnings in JS console because of the way we extend mw.user:

Use of "name" is deprecated. Use mw.user.getName instead.
Use of "anonymous" is deprecated. Use mw.user.isAnon instead.

They seem to be false positives, but we should get rid of them somehow anyway.
Comment 1 Bingle 2014-05-22 17:10:23 UTC
Prioritization and scheduling of this bug is tracked on Trello card https://trello.com/c/BxpqQtzw
Comment 2 Florian 2014-05-26 09:52:27 UTC
But this isn't a bg of MobileFrontend, am i right?

MobileFrontend uses getName and isAnon already. The deprecated message appears in mobileView and on desktop view, because it's generated every time mediawiki.user.js is included:
https://github.com/wikimedia/mediawiki-core/blob/9f7e79ab6ba0fd3a0e4b002ca46b600a4a880a75/resources/src/mediawiki/mediawiki.user.js#L245

I think, for now we haven't to do anything :)
Comment 3 Jon 2014-05-28 00:00:43 UTC
I think you are right here Florian...
Comment 4 Juliusz Gonera 2014-05-28 16:39:12 UTC
I can't see any deprecation warnings in desktop mode.
Comment 5 Florian 2014-05-28 16:44:54 UTC
I'm not sure, when mediawiki.user.js is loaded, but if i missed nothing i have searched all files of MobileFrontend and there is nowhere used the deprecated functions.

I have deleted the lines from file i have linked in comment #2 and the messages are away, so i'm pretty sure, that we talk about these lines, which are both in core :)
Comment 6 Jon 2014-05-28 16:49:56 UTC
I had a closer look and Juliusz is right.

Running this:
$.extend( {}, mw.user );

seems to be what causes the deprecation notices so I'm pretty sure there is nothing we can do here and this bug is a WONTFIX/INVALID or something similar
Comment 7 Florian 2014-05-28 16:51:50 UTC
Yeah, is right :) I think we missunderstand us. I meaned, that we can't do anything without change something in core :)
Comment 8 Jon 2014-05-29 18:34:19 UTC
Juliusz feel free to disagree but I can't imagine we want to do anything here.
In theory we could do the following:

	delete mw.user.name;
	delete mw.user.anonymous;
	user = $.extend( {}, mw.user, {

which suppresses the warnings - but that seems like a waste of time.
Comment 9 Juliusz Gonera 2014-06-01 13:01:47 UTC
I think we should do something about it. One option is not to extend mw.user, but have something separate instead. We could also upstream what we have there into core. Leaving those warnings is bad because we'll get used to them, start ignoring them and in future we'll miss other warnings that might appear in the console.
Comment 10 Jon 2014-06-09 17:24:24 UTC
Okay after talking to Juliusz we decided we should do some sort of shallow clone without using extend

e.g

M.define( 'user', {
 getName: mw.user.getName,
 isAnon: mw.user.isAnon
} );
Comment 11 Gerrit Notification Bot 2014-06-09 23:06:07 UTC
Change 138487 had a related patch set uploaded by Jdlrobson:
Avoid JavaScript deprecation warnings in user module

https://gerrit.wikimedia.org/r/138487
Comment 12 Gerrit Notification Bot 2014-06-11 22:59:16 UTC
Change 138487 merged by jenkins-bot:
Avoid JavaScript deprecation warnings in user module

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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links