Last modified: 2010-05-15 15:29:26 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 T2497, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 497 - javascript syntax error
javascript syntax error
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
Interface (Other open bugs)
1.3.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-09-15 14:13 UTC by ewald lieuwes
Modified: 2010-05-15 15:29 UTC (History)
1 user (show)

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


Attachments

Description ewald lieuwes 2004-09-15 14:13:02 UTC
Source file: /index.php?title=&action=raw&gen=js

second error:
The stylesheet /index.php?title=&action=raw&gen=css was not loaded because its
MIME type, "text/html", is not "text/css"

(Source of those errors is the Firefox Javascript Console, but also in Internet
Explorer this javascript error occurs.)

Changing MIME type doesn't do any good, so doesn't changing Content-Type,
changing language (i use dutch) or the character-encoding to UTF8

The function is located in the SkinPHPTal.php file and looks like this:
if($this->loggedin) {
$tpl->set( "jsvarurl", $this->makeUrl('-','action=raw&gen=js&smaxage=0') );
} else {
$tpl->set( "jsvarurl", $this->makeUrl('-','action=raw&gen=js') );
}

Those errors only occurs with not-logged in users, when logged in, no javascript
errors.
Comment 1 Brion Vibber 2004-09-15 17:55:31 UTC
Mine comes back with this header:
Content-Type: text/javascript; charset=utf-8

Can you confirm that the header is wrong (for instance using the Live HTTP Headers extension)? If so, check for PHP error messages interrupting 
output or other problems.
Comment 2 ewald lieuwes 2004-09-20 07:32:25 UTC
The Content-Type:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>

This doesn't seem wrong to me, nl.wikipedia.org got the exact same and here no
errors. I can't put up a link to my mediawiki here because its on a intranet.

(In reply to comment #1)
> Mine comes back with this header:
> Content-Type: text/javascript; charset=utf-8
> 
> Can you confirm that the header is wrong (for instance using the Live HTTP
Headers extension)? If so, check for PHP error messages interrupting 
> output or other problems.
Comment 3 Brion Vibber 2004-10-10 13:55:05 UTC
*ping*

Ewald, are you still experiencing this problem? You need to check the content
type of the *CSS* URL, not the web page. The most likely cause of the wrong
content type header being sent is either an error message being shown or too
much whitespace at the beginning or end of a PHP source file causing PHP to
begin outputting text before the headers are set.

Comment 4 Adam Edwards 2004-10-19 18:32:56 UTC
Hey all, I have the same version of MediaWiki installed as Ewald and I'm having the same problem. It happens for 
me when I set the wgWhitelistread variable.  When a user thats not logged in hits a page thats not in the white 
list it gives the same errors as ewald.  Once you login and you go to the same page, you don't get the errors.  
Here is the error out of the javascript console on mozilla:

Error: syntax error
Source File: /index.php?title=-&action=raw&gen=js
Line: 1
Source Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
Comment 5 ewald lieuwes 2004-10-21 06:29:32 UTC
the problem seems to be "fixed": i just deleted the line "<script
type="text/javascript" tal:attributes="src jsvarurl"></script>" from the
xhtml_slim.pt file in the templates folder. The javascript error is gone,
probably something else is broken now but i have no clue what this line does.
So, not really fixed, but the error is gone.
Comment 6 Adam Edwards 2004-10-21 16:25:34 UTC
I looked at the headers with LiveHTTPHeaders, and I saw that they are definately wrong for users 
that aren't logged in. for the /index.php?title=-&action=raw&gen=js script, the headers that 
content type is Content-Type: text/html; charset=utf-8, which should be text/javascript.  When the 
users are logged in, it uses the /index.php?title=-&action=raw&gen=js&smaxage=0 url to load the 
script and the content type is Content-Type: text/javascript; charset=utf-8.  I think part of the 
problem is that when your not logged in, /index.php?title=-&action=raw&gen=js doesn't actually 
retrieve a js file, it pulls back the html page your on.  When you are logged in and you type 
in /index.php?title=-&action=raw&gen=js&smaxage=0 it pulls back a js file. Any one got any ideas?
Comment 7 Brion Vibber 2004-10-21 20:30:44 UTC
If you add '-' to the whitelist, does that work? If not that, how about 'MediaWiki:Monobook.js'?
Comment 8 Adam Edwards 2004-10-21 20:48:23 UTC
Thank you!! Adding the "-" to the whitelist worked perfect.  I also had to 
add "MediaWiki:Monobook.css" to the whitelist to remove the css error.  Just "-" 
should have worked like it did for the javascript, maybe it was a cache problem. 
I'm not sure if this is the same as Ewald's problem or not.  The reason why I had 
the problem is because the only page I had in the wgWhitelistRead variable was the 
login page. 

(In reply to comment #7)
> If you add '-' to the whitelist, does that work? If not that, how 
about 'MediaWiki:Monobook.js'?


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


Navigation
Links