webengine/osswebengine/WebCore/loader/DocLoader.cpp
changeset 10 a359256acfc6
parent 5 10e98eab6f85
--- a/webengine/osswebengine/WebCore/loader/DocLoader.cpp	Fri Jul 03 15:54:40 2009 +0100
+++ b/webengine/osswebengine/WebCore/loader/DocLoader.cpp	Thu Aug 27 07:44:59 2009 +0300
@@ -118,9 +118,32 @@
     return cache()->requestUserCSSStyleSheet(this, url, charset);
 }
 
+/* DocLoader::requestScript
+ *
+ * If we've been given the charset, just pass it on.
+ * Otherwise, get it from the enclosing frame.
+ *
+ * Notes:
+ *
+ *   o We do this because some oddly-programmed web pages
+ *     and/or servers deliver JavaScript that doesn't bear
+ *     any obvious character set selection but the intended
+ *     character set isn't the ISO-Latin-1 that will later
+ *     be defaulted-in.
+ *
+ *   o We don't conditionalize this code for S60/Symbian
+ *     because it should be either benign or even helpful
+ *     to the other platforms as well.
+ *
+ */
+
 CachedScript* DocLoader::requestScript(const String& url, const String& charset)
 {
-    return static_cast<CachedScript*>(requestResource(CachedResource::Script, url, charset));
+
+    if (!!charset)
+        return static_cast<CachedScript*>(requestResource(CachedResource::Script, url, charset));
+    else
+        return static_cast<CachedScript*>(requestResource(CachedResource::Script, url, frame()->loader()->encoding() ));
 }
 
 #if ENABLE(XSLT)