Reviewed by Darin.
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Jul 2006 07:39:49 +0000 (07:39 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Jul 2006 07:39:49 +0000 (07:39 +0000)
        Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=10038
        REGRESSION: Length of navigator.mimeTypes collection returns number of installed plugins, not number
        of registered mime types

        Test: fast/js/navigator-mimeTypes-length.html

        * bindings/js/kjs_navigator.cpp:
        (KJS::MimeTypes::getValueProperty): Return the length of the mime types vector, not the plugins one.
        (KJS::MimeTypes::getOwnPropertySlot): Fixed another typo, which prevented MimeTypes::getValueProperty()
        from even being called.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15573 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/js/navigator-mimeTypes-length-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/navigator-mimeTypes-length.html [new file with mode: 0644]
LayoutTests/fast/js/resources/navigator-mimeTypes-length.js [new file with mode: 0644]
WebCore/ChangeLog
WebCore/bindings/js/kjs_navigator.cpp

index b36fcadb0769bc7cde91d1ef735213184b6956e9..3477d3ca55d6725bfbe7d7ed3aee065d98abc67e 100644 (file)
@@ -1,3 +1,15 @@
+2006-07-22  Alexey Proskuryakov  <ap@nypop.com>
+
+        Reviewed by Darin.
+
+        Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=10038
+        REGRESSION: Length of navigator.mimeTypes collection returns number of installed plugins, not number 
+        of registered mime types
+
+        * fast/js/navigator-mimeTypes-length-expected.txt: Added.
+        * fast/js/navigator-mimeTypes-length.html: Added.
+        * fast/js/resources/navigator-mimeTypes-length.js: Added.
+
 2006-07-21  Adele Peterson  <adele@apple.com>
 
         Reviewed by Darin.
diff --git a/LayoutTests/fast/js/navigator-mimeTypes-length-expected.txt b/LayoutTests/fast/js/navigator-mimeTypes-length-expected.txt
new file mode 100644 (file)
index 0000000..5abb240
--- /dev/null
@@ -0,0 +1,11 @@
+Test for bug 10038: REGRESSION: Length of navigator.mimeTypes collection returns number of installed plugins, not number of registered mime types.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS navigator.mimeTypes.length > navigator.plugins.length is true
+PASS navigator.mimeTypes[navigator.mimeTypes.length+1] is undefined
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/js/navigator-mimeTypes-length.html b/LayoutTests/fast/js/navigator-mimeTypes-length.html
new file mode 100644 (file)
index 0000000..58f1fbb
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="resources/js-test-style.css">
+<script src="resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/navigator-mimeTypes-length.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/js/resources/navigator-mimeTypes-length.js b/LayoutTests/fast/js/resources/navigator-mimeTypes-length.js
new file mode 100644 (file)
index 0000000..3b34579
--- /dev/null
@@ -0,0 +1,8 @@
+description(
+"Test for bug 10038: REGRESSION: Length of navigator.mimeTypes collection returns number of installed plugins, not number of registered mime types."
+);
+
+shouldBeTrue("navigator.mimeTypes.length > navigator.plugins.length");
+shouldBe("navigator.mimeTypes[navigator.mimeTypes.length+1]", "undefined");
+
+successfullyParsed = true;
index 4be3dc1fef0ec202ada66e24c0a8b804fe74ff87..6d4414a21016371e76f5d91d53d975f7d9a49116 100644 (file)
@@ -1,3 +1,16 @@
+2006-07-22  Alexey Proskuryakov  <ap@nypop.com>
+
+        Reviewed by Darin.
+
+        Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=10038
+        REGRESSION: Length of navigator.mimeTypes collection returns number of installed plugins, not number 
+        of registered mime types
+
+        * bindings/js/kjs_navigator.cpp:
+        (KJS::MimeTypes::getValueProperty): Return the length of the mime types vector, not the plugins one.
+        (KJS::MimeTypes::getOwnPropertySlot): Fixed another typo, which prevented MimeTypes::getValueProperty()
+        from even being called.
+
 2006-07-21  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Adele and Tim Omernick.
index f432be12f5a671fcd0b9791ddbd6da7fca9c12bc..84ed5bc868ce4e89e4e96b2dfe74eba8f1922031 100644 (file)
@@ -342,7 +342,7 @@ bool Plugins::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName
 JSValue *MimeTypes::getValueProperty(ExecState *exec, int token) const
 {
   assert(token == Length);
-  return jsNumber(plugins->size());
+  return jsNumber(mimes->size());
 }
 
 JSValue *MimeTypes::indexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
@@ -366,7 +366,7 @@ bool MimeTypes::getOwnPropertySlot(ExecState *exec, const Identifier& propertyNa
 {
     const HashEntry* entry = Lookup::findEntry(&MimeTypesTable, propertyName);
     if (entry) {
-      slot.setStaticEntry(this, entry, staticValueGetter<Plugins>);
+      slot.setStaticEntry(this, entry, staticValueGetter<MimeTypes>);
       return true;
     } else {
         // mimeTypes[#]