Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #3959 (closed defect: duplicate)

Opened 2 years ago

Last modified 2 years ago

Only text/javascript content-type are evaled in ajax.js

Reported by: iharosi@wiktor.hu Assigned to: sam@conio.net
Priority: low Milestone: 1.2
Component: Prototype Version:
Severity: normal Keywords: javascript eval content-type
Cc:

Description

Dear Team,

ajax.js line 177

if ((this.header('Content-type') || '').match(/^text\/javascript/i))
 this.evalResponse();
}

I think it's not enough, because Apache uses another default content-type (application/x-javascript).

According to Anne's post (http://annevankesteren.nl/2005/02/javascript-mime-type) there is no standardized javascript content-type, and in Scripting Media Types Internet-Draft (http://www.websitedev.de/ietf/draft-hoehrmann-script-types-01.txt) there are some other content-type for (java/ecma)scripts.

      +-----------------------------------------------------+
      | text/javascript          | text/ecmascript          |
      | text/javascript1.0       | text/javascript1.1       |
      | text/javascript1.2       | text/javascript1.3       |
      | application/x-javascript | application/x-ecmascript |
      | application/javascript   | application/ecmascript   |
      +-----------------------------------------------------+

Of these types, this document defines the following:

      * text/javascript
      * text/ecmascript
      * application/javascript
      * application/ecmascript

Pff, what to do? :)

Sincerely,

Wiktor

Change History

02/27/06 23:06:55 changed by anonymous

Also, Opera produces jibberish with text/javascript content types. but works with application/x-javascript.

05/02/06 21:03:53 changed by Andrew Dupont <rubyonrails@andrewdupont.net>

Would it be satisfactory to all involved if this line simply tried to match against /(ecma|java)script/? I don't see the harm in that.

10/08/06 19:33:39 changed by mislav

I patched this today and found this ticket just now :)

See patch in #5022

10/09/06 10:02:13 changed by mislav

Forget the #5022, this ticket is now superseded by #6366 :)

10/09/06 19:21:42 changed by bitsweat

  • status changed from new to closed.
  • resolution set to duplicate.
  • milestone set to 1.2.