Commit ef952ffc authored by weinig@apple.com's avatar weinig@apple.com

WebCore:

2008-11-05  Sam Weinig  <sam@webkit.org>

        Reviewed by Anders Carlsson.

        Fix https://bugs.webkit.org/show_bug.cgi?id=22085
        The Plugin JS object should expose item() and namedItem() methods to match Firefox

        * bindings/js/JSPluginCustom.cpp:
        (WebCore::JSPlugin::nameGetter):
        * plugins/Plugin.cpp:
        (WebCore::Plugin::namedItem):
        * plugins/Plugin.h:
        * plugins/Plugin.idl:

LayoutTests:

2008-11-05  Sam Weinig  <sam@webkit.org>

        Reviewed by Anders Carlsson.

        Update tests for https://bugs.webkit.org/show_bug.cgi?id=22085
        The Plugin JS object should expose item() and namedItem() methods to match Firefox

        * fast/dom/Window/window-properties-expected.txt:
        * plugins/plugin-javascript-access-expected.txt:
        * plugins/plugin-javascript-access.html:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38134 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4bc12df4
2008-11-05 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
Update tests for https://bugs.webkit.org/show_bug.cgi?id=22085
The Plugin JS object should expose item() and namedItem() methods to match Firefox
* fast/dom/Window/window-properties-expected.txt:
* plugins/plugin-javascript-access-expected.txt:
* plugins/plugin-javascript-access.html:
2008-11-05 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Maciej Stachowiak.
......
......@@ -1042,6 +1042,8 @@ window.OverflowEvent.VERTICAL [number]
window.OverflowEvent.prototype [printed above as window.Event.prototype]
window.Plugin [object PluginConstructor]
window.Plugin.prototype [object PluginPrototype]
window.Plugin.prototype.item [function]
window.Plugin.prototype.namedItem [function]
window.PluginArray [object PluginArrayConstructor]
window.PluginArray.prototype [object PluginArrayPrototype]
window.PluginArray.prototype.item [function]
......
......@@ -13,6 +13,10 @@ Description: test netscape content
Suffixes: testnetscape
Plugin.item() works.
Plugin.namedItem() works.
PluginArray.item() works.
PluginArray.namedItem() works.
......
......@@ -31,6 +31,18 @@ for (var i = 0; i < navigator.plugins.length; i++) {
document.writeln("<p>Description: " + plugin[mi].description + "<\/p>");
document.writeln("<p>Suffixes: " + plugin[mi].suffixes + "<\/p>");
document.writeln("<br>");
if (plugin.item(i).type == plugin[mi].type) {
document.writeln("<p>Plugin.item() works.<\/p>");
} else {
document.writeln("<p>FAIL. Plugin.item() does not work.<\/p>");
}
if (plugin.namedItem(plugin[mi].type).type == plugin[mi].type) {
document.writeln("<p>Plugin.namedItem() works.<\/p>");
} else {
document.writeln("<p>FAIL. Plugin.namedItem() does not work.<\/p>");
}
}
if (navigator.plugins.item(i).name == plugin.name) {
......
2008-11-05 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
Fix https://bugs.webkit.org/show_bug.cgi?id=22085
The Plugin JS object should expose item() and namedItem() methods to match Firefox
* bindings/js/JSPluginCustom.cpp:
(WebCore::JSPlugin::nameGetter):
* plugins/Plugin.cpp:
(WebCore::Plugin::namedItem):
* plugins/Plugin.h:
* plugins/Plugin.idl:
2008-11-05 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Maciej Stachowiak.
......@@ -20,6 +20,7 @@
#include "JSPlugin.h"
#include "AtomicString.h"
#include "JSMimeType.h"
#include "Plugin.h"
namespace WebCore {
......@@ -34,7 +35,7 @@ bool JSPlugin::canGetItemsForName(ExecState*, Plugin* plugin, const Identifier&
JSValue* JSPlugin::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
{
JSPlugin* thisObj = static_cast<JSPlugin*>(asObject(slot.slotBase()));
return toJS(exec, thisObj->impl()->nameGetter(propertyName));
return toJS(exec, thisObj->impl()->namedItem(propertyName));
}
}
} // namespace WebCore
......@@ -79,7 +79,7 @@ bool Plugin::canGetItemsForName(const AtomicString& propertyName)
return false;
}
PassRefPtr<MimeType> Plugin::nameGetter(const AtomicString& propertyName)
PassRefPtr<MimeType> Plugin::namedItem(const AtomicString& propertyName)
{
const Vector<MimeClassInfo*>& mimes = m_pluginData->mimes();
for (unsigned i = 0; i < mimes.size(); ++i)
......
......@@ -52,7 +52,7 @@ namespace WebCore {
PassRefPtr<MimeType> item(unsigned index);
bool canGetItemsForName(const AtomicString& propertyName);
PassRefPtr<MimeType> nameGetter(const AtomicString& propertyName);
PassRefPtr<MimeType> namedItem(const AtomicString& propertyName);
private:
Plugin(PluginData*, unsigned index);
......
......@@ -29,6 +29,8 @@ module window {
readonly attribute DOMString filename;
readonly attribute DOMString description;
readonly attribute unsigned long length;
MimeType item(in unsigned long index);
MimeType namedItem(in DOMString name);
};
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment