Bug 98216 - External scripts are executed as Javascript even if they have another type [with test case]
Summary: External scripts are executed as Javascript even if they have another type [w...
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-30 18:30 UTC by Aaron Isotton
Modified: 2006-09-28 00:06 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Isotton 2005-01-30 18:30:49 UTC
Version:            (using KDE KDE 3.3.2)
Installed from:    Debian testing/unstable Packages
OS:                Linux

If a script is loaded from an external file, as follows:

<script type="text/vbscript" lang="vbscript" src="test.vbs"></script>

then Konqueror loads it an tries executing it as *Javascript* even if both type and lang say that it is a *vbscript*. This causes the bug icon to appear on the status bar.

Inline scripts are handled correctly:

    <script type="text/vbscript" lang="vbscript">
    ' This is vbscript, and should never be parsed by Konqueror. This is
    ' handled correctly.
    </script>

I have put a test case at http://thenew.unitedvisions.tv/~aisotton/kst/

I might change that page, so here's the test case inline (two files, test.html and test.vbs):

-- test.html --

<html>
  <head>
  <title>Konqueror Script Test</title>
    <script type="text/vbscript" lang="vbscript">
    ' This is vbscript, and should never be parsed by Konqueror. This is
    ' handled correctly.
    </script>
    <script type="text/vbscript" lang="vbscript" src="test.vbs"></script>
  </head>
  <body>
    <h1>Konqueror Script Test</h1>

  </body>
</html>

-- EOF --

-- test.vbs --

' This is vbscript and should never be parsed by Konqueror.
' This is NOT handled correctly

-- EOF --
Comment 1 Thiago Macieira 2005-01-30 19:38:43 UTC
Confirmed for HEAD 20050128
Comment 2 Pupeno 2006-01-05 18:36:22 UTC
I have experienced this same bug on http://www.intocablesdelivery.com.ar/
Comment 3 Maksim Orlovich 2006-09-28 00:06:14 UTC
SVN commit 589296 by orlovich:

Don't try to run external VBScript as ECMAScript (98216)
Add a couple of symmetric mimetypes (134763)
BUG:134763
BUG:98216


 M  +3 -1      htmltokenizer.cpp  


--- branches/KDE/3.5/kdelibs/khtml/html/htmltokenizer.cpp #589295:589296
@@ -395,7 +395,7 @@
         CachedScript* cs = 0;
 
         // forget what we just got, load from src url instead
-        if ( !currentScriptSrc.isEmpty() &&
+        if ( !currentScriptSrc.isEmpty() && javascript && 
              (cs = parser->doc()->docLoader()->requestScript(currentScriptSrc, scriptSrcCharset) )) {
             cachedScript.enqueue(cs);
         }
@@ -1153,6 +1153,8 @@
                         type.compare("text/ecmascript") != 0 &&
                         type.compare("text/livescript") != 0 &&
 			type.compare("application/x-javascript") != 0 &&
+			type.compare("application/x-ecmascript") != 0 &&
+			type.compare("application/javascript") != 0 && 
 			type.compare("application/ecmascript") != 0 )
                         javascript = false;
                 } else if( a ) {