Title: [136697] trunk
Revision
136697
Author
[email protected]
Date
2012-12-05 09:09:34 -0800 (Wed, 05 Dec 2012)

Log Message

[Gtk] navigator.plugins contains too many plugin entries. First one are garbages
https://bugs.webkit.org/show_bug.cgi?id=102438

Patch by Arnaud Renevier <[email protected]> on 2012-12-05
Reviewed by Xan Lopez.

Source/WebKit/gtk:

In getPluginInfo, outPlugins is resized to plugins.size and then,
plugins are appended to it. So at the end, outPlugins will be twice
too large, and first half will contain null objects. As outPlugins
size is 0 when calling getPluginInfo, we don't need to resize it.

* WebCoreSupport/PlatformStrategiesGtk.cpp:
(PlatformStrategiesGtk::getPluginInfo):

LayoutTests:

Add a test to check that navigator.plugins only contain valid plugin
objects.

* plugins/navigator-plugins-expected.txt: Added.
* plugins/navigator-plugins.html: Added.
* plugins/script-tests/navigator-plugins.js: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (136696 => 136697)


--- trunk/LayoutTests/ChangeLog	2012-12-05 17:06:27 UTC (rev 136696)
+++ trunk/LayoutTests/ChangeLog	2012-12-05 17:09:34 UTC (rev 136697)
@@ -1,3 +1,17 @@
+2012-12-05  Arnaud Renevier  <[email protected]>
+
+        [Gtk] navigator.plugins contains too many plugin entries. First one are garbages
+        https://bugs.webkit.org/show_bug.cgi?id=102438
+
+        Reviewed by Xan Lopez.
+
+        Add a test to check that navigator.plugins only contain valid plugin
+        objects.
+
+        * plugins/navigator-plugins-expected.txt: Added.
+        * plugins/navigator-plugins.html: Added.
+        * plugins/script-tests/navigator-plugins.js: Added.
+
 2012-12-05  Zan Dobersek  <[email protected]>
 
         Unreviewed GTK gardening.

Added: trunk/LayoutTests/plugins/navigator-plugins-expected.txt (0 => 136697)


--- trunk/LayoutTests/plugins/navigator-plugins-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/plugins/navigator-plugins-expected.txt	2012-12-05 17:09:34 UTC (rev 136697)
@@ -0,0 +1,10 @@
+Check that navigator.plugins does not contain empty plugin objects
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS hasInvalidPlugin is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/plugins/navigator-plugins.html (0 => 136697)


--- trunk/LayoutTests/plugins/navigator-plugins.html	                        (rev 0)
+++ trunk/LayoutTests/plugins/navigator-plugins.html	2012-12-05 17:09:34 UTC (rev 136697)
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/plugins/script-tests/navigator-plugins.js (0 => 136697)


--- trunk/LayoutTests/plugins/script-tests/navigator-plugins.js	                        (rev 0)
+++ trunk/LayoutTests/plugins/script-tests/navigator-plugins.js	2012-12-05 17:09:34 UTC (rev 136697)
@@ -0,0 +1,15 @@
+description(
+    "Check that navigator.plugins does not contain empty plugin objects"
+);
+
+var hasInvalidPlugin = false;
+for (var i = 0; i < navigator.plugins.length; ++i) {
+    var plugin = navigator.plugins[i];
+    if (!plugin.description || !plugin.name || !plugin.filename) {
+        hasInvalidPlugin = true;
+        break;
+    }
+}
+shouldBeFalse("hasInvalidPlugin");
+
+successfullyParsed = true;

Modified: trunk/Source/WebKit/gtk/ChangeLog (136696 => 136697)


--- trunk/Source/WebKit/gtk/ChangeLog	2012-12-05 17:06:27 UTC (rev 136696)
+++ trunk/Source/WebKit/gtk/ChangeLog	2012-12-05 17:09:34 UTC (rev 136697)
@@ -1,3 +1,18 @@
+2012-12-05  Arnaud Renevier  <[email protected]>
+
+        [Gtk] navigator.plugins contains too many plugin entries. First one are garbages
+        https://bugs.webkit.org/show_bug.cgi?id=102438
+
+        Reviewed by Xan Lopez.
+
+        In getPluginInfo, outPlugins is resized to plugins.size and then,
+        plugins are appended to it. So at the end, outPlugins will be twice
+        too large, and first half will contain null objects. As outPlugins
+        size is 0 when calling getPluginInfo, we don't need to resize it.
+
+        * WebCoreSupport/PlatformStrategiesGtk.cpp:
+        (PlatformStrategiesGtk::getPluginInfo):
+
 2012-12-04  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Avoid unnecessary heap allocations during drag and drop operations

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/PlatformStrategiesGtk.cpp (136696 => 136697)


--- trunk/Source/WebKit/gtk/WebCoreSupport/PlatformStrategiesGtk.cpp	2012-12-05 17:06:27 UTC (rev 136696)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/PlatformStrategiesGtk.cpp	2012-12-05 17:09:34 UTC (rev 136697)
@@ -130,7 +130,6 @@
 {
     PluginDatabase* database = PluginDatabase::installedPlugins();
     const Vector<PluginPackage*> &plugins = database->plugins();
-    outPlugins.resize(plugins.size());
 
     for (size_t i = 0; i < plugins.size(); ++i) {
         PluginPackage* package = plugins[i];
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to