[HOME PAGE] [STORES] [CLASSICISTRANIERI.COM] [FOTO] [YOUTUBE CHANNEL]


Bug 1877 – JavaScript error in page editing in some localizations

Last modified: 2010-05-15 15:33:20 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 1877 - JavaScript error in page editing in some localizations
JavaScript error in page editing in some localizations
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Page editing (Other open bugs)
1.4.x
All All
: Normal normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
http://ro.wikinews.org/w/index.php?ti...
:
: 2445 2465 2997 3088 3389 (view as bug list)
Depends on:
Blocks: javascript
  Show dependency treegraph
 
Reported: 2005-04-12 19:41 UTC by Brion Vibber
Modified: 2010-05-15 15:33 UTC (History)
5 users (show)

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


Attachments
patch for HEAD (708 bytes, patch)
2005-04-18 17:27 UTC, Michael Keppler
Details
patch for REL14 (744 bytes, patch)
2005-04-18 18:02 UTC, Michael Keppler
Details

Description Brion Vibber 2005-04-12 19:41:21 UTC
On the Romanian localization, going to an edit page triggers a JavaScript error "unterminated 
string literal" and the edit toolbar is not shown.

The edit toolbar code generation doesn't correctly escape JavaScript string literals. 
LanguageRo.php contains newlines in its infobox_alert text, which are  rendered as raw 
newlines in the generated code. JS doesn't allow multi-line string literals, so this fails.

Escaping should be fixed to introduce "\n" in the literal.
Comment 1 Michael Keppler 2005-04-12 20:52:40 UTC
In the HTML standard there is no such thing as a line break in alt-attributes of
image tags. By definition attribute values contain only space, but no line
breaks. Therefore any linebreak in the string shall be threatened like a space
by the parser. There is no way to force a line break, i.e. the character
sequence "a\nbreak" will be rendered as such and no good browser will replace
the "\n" by a newline.
As a consequence the function should replace all newlines by spaces before
outputting the JavaScript and the Romanians should remove their newlines from
those messages.
Comment 2 Brion Vibber 2005-04-12 20:56:29 UTC
As a general rule the system shouldn't break based on user input. Newlines may
behave as spaces, *that's fine*. They won't hurt anything if the string literal
is formatted correctly, and the string literal *should* be formatted correctly.
Comment 3 Michael Keppler 2005-04-18 17:27:57 UTC
Created attachment 426 [details]
patch for HEAD

Attached patch for HEAD replaces linebreaks in the inserted sample and in the
image tip (ALT text) by spaces.
Comment 4 Michael Keppler 2005-04-18 18:02:57 UTC
Created attachment 427 [details]
patch for REL14

attached patch for REL14 adds the same code like the HEAD patch
Comment 5 Brion Vibber 2005-04-30 08:04:54 UTC
The attached patches are wrong: they don't address the message that has the problem, 
and removing the line breaks is not necessary. (The message with the breaks is used to 
format a message alert box, not image alt text.)

Correct fix is addition and use of wfEscapeJsString() function, now checked in on 
HEAD.
Comment 6 Michael Keppler 2005-04-30 09:12:40 UTC
The fix for this exact problem case by Brion is correct. But to avoid the same
JavaScript error with the image tip for the future, we should use
wfEscapeJsString() on the image tip too.
Comment 7 Brion Vibber 2005-04-30 09:14:29 UTC
Somehow missed that one among the four other cases in that file and at least two 
elsewhere. Fixed now.
Comment 8 Brion Vibber 2005-06-18 20:17:16 UTC
*** Bug 2445 has been marked as a duplicate of this bug. ***
Comment 9 Brion Vibber 2005-06-20 17:50:49 UTC
*** Bug 2465 has been marked as a duplicate of this bug. ***
Comment 10 Brion Vibber 2005-07-29 22:03:20 UTC
*** Bug 2997 has been marked as a duplicate of this bug. ***
Comment 11 Brion Vibber 2005-08-11 06:18:58 UTC
*** Bug 3088 has been marked as a duplicate of this bug. ***
Comment 12 Brion Vibber 2005-09-07 23:20:50 UTC
*** Bug 3389 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.


Contents Listing Alphabetical by Author:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Unknown Other

Contents Listing Alphabetical by Title:
# A B C D E F G H I J K L M N O P Q R S T U V W Y Z Other

Medical Encyclopedia

Browse by first letter of topic:


A-Ag Ah-Ap Aq-Az B-Bk Bl-Bz C-Cg Ch-Co
Cp-Cz D-Di Dj-Dz E-Ep Eq-Ez F G
H-Hf Hg-Hz I-In Io-Iz J K L-Ln
Lo-Lz M-Mf Mg-Mz N O P-Pl Pm-Pz
Q R S-Sh Si-Sp Sq-Sz T-Tn To-Tz
U V W X Y Z 0-9

Biblioteca - SPANISH

Biblioteca Solidaria - SPANISH

Bugzilla

Ebooks Gratuits

Encyclopaedia Britannica 1911 - PDF

Project Gutenberg: DVD-ROM 2007

Project Gutenberg ENGLISH Selection

Project Gutenberg SPANISH Selection

Standard E-books

Wikipedia Articles Indexes

Wikipedia for Schools - ENGLISH

Wikipedia for Schools - FRENCH

Wikipedia for Schools - SPANISH

Wikipedia for Schools - PORTUGUESE

Wikipedia 2016 - FRENCH

Wikipedia HTML - CATALAN

Wikipedia Picture of the Year 2006

Wikipedia Picture of the Year 2007

Wikipedia Picture of the Year 2008

Wikipedia Picture of the Year 2009

Wikipedia Picture of the Year 2010

Wikipedia Picture of the Year 2011