Last modified: 2013-01-26 21:19:27 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 T46063, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 44063 - this.params is undefined
this.params is undefined
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
ApiSandbox (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Bartosz Dziewoński
https://en.wikipedia.org/wiki/Special...
: javascript
: 41828 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-17 12:29 UTC by Fomafix
Modified: 2013-01-26 21:19 UTC (History)
6 users (show)

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


Attachments

Description Fomafix 2013-01-17 12:29:23 UTC
Steps to reproduce:

* Open https://en.wikipedia.org/wiki/Special:ApiSandbox?debug=true
* Select "Action" -> "watch"

In the JavaScript Console occurs:

 TypeError: this.params is undefined
 for ( i = 0, length = this.params.length; i < length; i += 1 ) {
 ext.apiSandbox.js (line 483)

In line 482 a semicolon is missing:
https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/ApiSandbox.git;a=blob;f=modules/ext.apiSandbox.js;h=7f2aca2f4c705f81a7d1d8949a17cdb60a920152;hb=HEAD#l482

And http://www.jshint.com/ finds some defined but never used variables.
Comment 1 Alex Monk 2013-01-17 14:30:31 UTC
Looks like Siebrand had started fixing some JSHint errors before: Gerrit change #39006
Comment 2 Alex Monk 2013-01-17 14:31:33 UTC
That was I978d37c0
Comment 3 Alex Monk 2013-01-17 14:36:55 UTC
Also I don't get this error. What web browser are you using?
Comment 4 Fomafix 2013-01-17 16:05:52 UTC
(In reply to comment #3)
> Also I don't get this error. What web browser are you using?

I get the error in Firefox 18.0. In Chrome and Internet Explorer I don't get an error.
Comment 5 Andre Klapper 2013-01-18 12:45:47 UTC
I can confirm getting this error in Firefox 17.0.1 on Fedora16.
Comment 6 Bartosz Dziewoński 2013-01-18 13:13:41 UTC
Works correctly in Opera as well.

This is because ApiSandbox uses 'watch' as a key in the object storing information about parameters taken by various APIs, and Firefox supports a watch() function on all object that can be used to register callback to be fired when a certain property of that object is changed.

Other browsers apparently either don't support it, or allow is to be overridden; Firefox doesn't, and thus when `new UiBuilder( $mainContainer, info, '' );` is called on line 348, "info" is a reference to this watch() function instead of the object with data that the code expects.

This will probably need to be special-cased somewhere.
Comment 7 Fomafix 2013-01-18 14:01:03 UTC
Yes, thats the reason:

var o = { 'name': 42 }
o['name']                     >> 42
o['noname']                   >> undefined
o['watch']                    >> watch()
o.hasOwnProperty( 'name' )    >> true
o.hasOwnProperty( 'noname' )  >> false
o.hasOwnProperty( 'watch' )   >> false


The solution would be to replace in line 104

  if ( !paramInfo[prop][info.name] ) {

by

  if ( !hasOwnProperty( paramInfo[prop][info.name] ) ) {
Comment 8 Bartosz Dziewoński 2013-01-18 14:28:31 UTC
Fomafix, do you have a gerrit account? You could submit the patch yourself. [See https://www.mediawiki.org/wiki/Developer_access]
Comment 9 Bartosz Dziewoński 2013-01-18 19:51:51 UTC
Submitted fixed patch as I56e1637d.
Comment 10 Andre Klapper 2013-01-19 10:31:22 UTC
[restoring priority setting which got deleted in comment 7.]
Comment 11 Bartosz Dziewoński 2013-01-26 21:18:42 UTC
Merged.
Comment 12 Bartosz Dziewoński 2013-01-26 21:19:27 UTC
*** Bug 41828 has been marked as a duplicate of this bug. ***

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


Navigation
Links