Last modified: 2011-12-29 11:00:22 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 T33673, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 31673 - JavaScript Error: "Object expected" makes "Special Characters" section of (enhanced) toolbar of MW 1.18 unusable on IE 8
JavaScript Error: "Object expected" makes "Special Characters" section of (en...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
WikiEditor (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
https://en.wikipedia.org/w/index.php?...
: javascript, need-integration-test, patch, patch-need-review
: 32797 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-13 17:49 UTC by Helder
Modified: 2011-12-29 11:00 UTC (History)
8 users (show)

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


Attachments
make buildCharacter() more robust, and fix two other oversights (1.51 KB, patch)
2011-11-14 21:10 UTC, Lupo
Details

Description Helder 2011-10-13 17:49:25 UTC
This was reported on [[WP:VPT]][1]:
----
  Special characters is still not working with Vector XP IE8 - it just runs the loading symbol (lines round a ring) - left it running for 30 minutes - no change.
----
I confirmed this bug by opening the attached URL and clicking in the "Special characteres". IE 8 displayed the following error information:

----
Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)
Timestamp: Thu, 13 Oct 2011 17:34:04 UTC

Message: Object expected
Line: 560
Char: 10
Code: 0
URI: https://bits.wikimedia.org/w/extensions-1.18/WikiEditor/modules/jquery.wikiEditor.toolbar.js
----

The line 560 is part of the function buildCharacter and contains this:
----
} else if ( 0 in character && 1 in character ) {
----

The problem doesn't happens on Google Chrome 14.0.835.186 / Ubuntu 11.04.

[1] https://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_(technical)&oldid=455400709#Editing_.22insert.22_box_not_showing
Comment 1 Mark A. Hershberger 2011-10-15 22:03:49 UTC
tagging bugs for Marcus to look at
Comment 2 Roan Kattouw 2011-10-25 15:16:28 UTC
That's very strange. I wonder what the value of 'character' was in that case. 0 in character works fine if character is an array, and the "Object expected" error only seems to appear in cases where Firefox also throws an error.
Comment 3 Strainu 2011-11-03 20:06:19 UTC
IE8 specific. Does not reproduce on IE9.
Comment 4 Lupo 2011-11-14 13:49:47 UTC
(In reply to comment #2)
> That's very strange. I wonder what the value of 'character' was in that case. 0
> in character works fine if character is an array, and the "Object expected"
> error only seems to appear in cases where Firefox also throws an error.

It's undefined.

I think it's caused by the stray comma at the end of line 752 in jquery.wikiEditor.toolbar.config.js

That apparently makes IE8 add a 185th undefined element to the array.

I think though, besides removing that comma, the function jquery.wikiEditor.toolbar.buildCharacter() should be made more robust by returning an empty string if typeof character == 'undefined'. Possibly log the error somewhere, but don't let such misconfigurations break the whole thing.
Comment 5 Roan Kattouw 2011-11-14 13:52:52 UTC
(In reply to comment #4)
> (In reply to comment #2)
> > That's very strange. I wonder what the value of 'character' was in that case. 0
> > in character works fine if character is an array, and the "Object expected"
> > error only seems to appear in cases where Firefox also throws an error.
> 
> It's undefined.
> 
> I think it's caused by the stray comma at the end of line 752 in
> jquery.wikiEditor.toolbar.config.js
> 
Thanks for spotting that, removed in r102980. Deploying that now.

> That apparently makes IE8 add a 185th undefined element to the array.
> 
Well that's better than throwing a syntax error, which is what happens for trailing commas in object definitions :(

> I think though, besides removing that comma, the function
> jquery.wikiEditor.toolbar.buildCharacter() should be made more robust by
> returning an empty string if typeof character == 'undefined'. Possibly log the
> error somewhere, but don't let such misconfigurations break the whole thing.
There should probably be a typeof foo != 'string' check yeah.
Comment 6 Lupo 2011-11-14 21:10:18 UTC
Created attachment 9451 [details]
make buildCharacter() more robust, and fix two other oversights

Besides testing whether "character" is defined at all, this patch also makes sure that the function returns something at all in all cases, otherwise, we might possibly again end up with "undefined" in the output (c.f. bug 24208).

Also supplies a missing end tag for the table row in buildHeading().
Comment 7 Derk-Jan Hartman 2011-11-14 21:12:48 UTC
Good work Lupo. I'll apply this in it's separate functional parts.
Comment 8 Derk-Jan Hartman 2011-11-14 21:56:19 UTC
r103034

and

r103046
Comment 9 Michael M. 2011-12-05 08:48:40 UTC
*** Bug 32797 has been marked as a duplicate of this bug. ***
Comment 10 Krinkle 2011-12-29 11:00:22 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #2)
> > That apparently makes IE8 add a 185th undefined element to the array.
> > 
> Well that's better than throwing a syntax error, which is what happens for
> trailing commas in object definitions :(

I'd rather have the program throw up then silently add undefined.

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


Navigation
Links