Title: [135577] trunk
Revision
135577
Author
[email protected]
Date
2012-11-23 02:30:23 -0800 (Fri, 23 Nov 2012)

Log Message

[Qt] REGRESSION(r135507): It made 13 tests fail
https://bugs.webkit.org/show_bug.cgi?id=103069

Reviewed by Simon Hausmann.

Source/WebCore:

Fix regression in recognizing MHTML on some platforms.

* platform/qt/MIMETypeRegistryQt.cpp:
(ExtensionMap):
(WebCore::MIMETypeRegistry::getMIMETypeForExtension):
(WebCore::MIMETypeRegistry::getMIMETypeForPath):

LayoutTests:

Unskip fixed test and update one benign change.

* platform/qt/TestExpectations:
* platform/qt/fast/preloader/script-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (135576 => 135577)


--- trunk/LayoutTests/ChangeLog	2012-11-23 10:18:12 UTC (rev 135576)
+++ trunk/LayoutTests/ChangeLog	2012-11-23 10:30:23 UTC (rev 135577)
@@ -1,3 +1,15 @@
+2012-11-23  Allan Sandfeld Jensen  <[email protected]>
+
+        [Qt] REGRESSION(r135507): It made 13 tests fail
+        https://bugs.webkit.org/show_bug.cgi?id=103069
+
+        Reviewed by Simon Hausmann.
+
+        Unskip fixed test and update one benign change.
+
+        * platform/qt/TestExpectations:
+        * platform/qt/fast/preloader/script-expected.txt: Added.
+
 2012-11-23  Pierre Rossi  <[email protected]>
 
         [Qt] REGRESSION(r135515): 3 appcache tests still failing

Modified: trunk/LayoutTests/platform/qt/TestExpectations (135576 => 135577)


--- trunk/LayoutTests/platform/qt/TestExpectations	2012-11-23 10:18:12 UTC (rev 135576)
+++ trunk/LayoutTests/platform/qt/TestExpectations	2012-11-23 10:30:23 UTC (rev 135577)
@@ -2386,17 +2386,5 @@
 
 # [Qt] REGRESSION(r135507): It made 13 tests fail
 # https://bugs.webkit.org/show_bug.cgi?id=103069
-fast/preloader/script.html
 http/tests/navigation/reload-subframe-object.html
-mhtml/check_domain.mht
-mhtml/multi_frames_binary.mht
-mhtml/multi_frames_ie.mht
-mhtml/multi_frames_unmht.mht
-mhtml/page_with_css_and_js_ie.mht
-mhtml/page_with_css_and_js_unmht.mht
-mhtml/page_with_image_ie.mht
-mhtml/page_with_image_unmht.mht
-mhtml/shared_buffer_bug.mht
-mhtml/simple_page_ie.mht
-mhtml/simple_page_unmht.mht
 

Added: trunk/LayoutTests/platform/qt/fast/preloader/script-expected.txt (0 => 135577)


--- trunk/LayoutTests/platform/qt/fast/preloader/script-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/qt/fast/preloader/script-expected.txt	2012-11-23 10:30:23 UTC (rev 135577)
@@ -0,0 +1,5 @@
+script1.js has MIME type application/_javascript_
+This test requires DumpRenderTree to see the log of what resources are loaded.
+
+<script src=""
+

Modified: trunk/Source/WebCore/ChangeLog (135576 => 135577)


--- trunk/Source/WebCore/ChangeLog	2012-11-23 10:18:12 UTC (rev 135576)
+++ trunk/Source/WebCore/ChangeLog	2012-11-23 10:30:23 UTC (rev 135577)
@@ -1,3 +1,17 @@
+2012-11-23  Allan Sandfeld Jensen  <[email protected]>
+
+        [Qt] REGRESSION(r135507): It made 13 tests fail
+        https://bugs.webkit.org/show_bug.cgi?id=103069
+
+        Reviewed by Simon Hausmann.
+
+        Fix regression in recognizing MHTML on some platforms.
+
+        * platform/qt/MIMETypeRegistryQt.cpp:
+        (ExtensionMap):
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
+        (WebCore::MIMETypeRegistry::getMIMETypeForPath):
+
 2012-11-22  Pavel Feldman  <[email protected]>
 
         Web Inspector: ctrl+end in editor does not select the last symbol.

Modified: trunk/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp (135576 => 135577)


--- trunk/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp	2012-11-23 10:18:12 UTC (rev 135576)
+++ trunk/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp	2012-11-23 10:30:23 UTC (rev 135577)
@@ -35,24 +35,54 @@
 
 namespace WebCore {
 
+struct ExtensionMap {
+    const char* extension;
+    const char* dotExtension;
+    const char* mimeType;
+};
+
+// This is a short list of extensions not recognized by the freedesktop shared mimetype database 1.0.
+static const ExtensionMap extensionMap[] = {
+    { "mht", ".mht", "application/x-mimearchive" },
+    { "mhtml", ".mhtml", "application/x-mimearchive" },
+    { "text", ".text", "text/plain" },
+    { "wmlc", ".wmlc", "application/vnd.wap.wmlc" },
+    { 0, 0, 0 }
+};
+
 String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
 {
     // QMimeDatabase lacks the ability to query by extension alone, so we create a fake filename to lookup.
-    const QString filename = QStringLiteral("filename.") + QString(ext.lower());
+    String suffix = ext.lower();
+    const QString filename = QStringLiteral("filename.") + QString(suffix);
 
     QMimeType mimeType = QMimeDatabase().mimeTypeForFile(filename, QMimeDatabase::MatchExtension);
     if (mimeType.isValid() && !mimeType.isDefault())
         return mimeType.name();
 
+    const ExtensionMap *e = extensionMap;
+    while (e->extension) {
+        if (suffix == e->extension)
+            return e->mimeType;
+        ++e;
+    }
+
     return String();
 }
 
 String MIMETypeRegistry::getMIMETypeForPath(const String& path)
 {
     QMimeType type = QMimeDatabase().mimeTypeForFile(path, QMimeDatabase::MatchExtension);
-    if (type.isValid())
+    if (type.isValid() && !type.isDefault())
         return type.name();
 
+    const ExtensionMap *e = extensionMap;
+    while (e->extension) {
+        if (path.endsWith(e->dotExtension))
+            return e->mimeType;
+        ++e;
+    }
+
     return defaultMIMEType();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to