summaryrefslogtreecommitdiffstats
path: root/WebKit/android
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2010-02-22 13:00:39 -0500
committerDerek Sollenberger <djsollen@google.com>2010-02-22 13:00:39 -0500
commit1044e7fd4ebb61e6133d4f4dda69810e3af9da14 (patch)
tree85f68c5c0462303ae35f62ced09aa77bf9774f79 /WebKit/android
parent5b9b4d4efe739cfa2aa117372879c5c37443e644 (diff)
downloadexternal_webkit-1044e7fd4ebb61e6133d4f4dda69810e3af9da14.zip
external_webkit-1044e7fd4ebb61e6133d4f4dda69810e3af9da14.tar.gz
external_webkit-1044e7fd4ebb61e6133d4f4dda69810e3af9da14.tar.bz2
Fixes error where plugin is created while iterating through the list of plugins.
bug #2438492
Diffstat (limited to 'WebKit/android')
-rw-r--r--WebKit/android/jni/WebViewCore.cpp27
-rw-r--r--WebKit/android/jni/WebViewCore.h3
2 files changed, 13 insertions, 17 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 66646b9..7e3fb2c 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -1383,6 +1383,10 @@ void WebViewCore::updateFrameCacheIfLoading()
void WebViewCore::addPlugin(PluginWidgetAndroid* w)
{
// SkDebugf("----------- addPlugin %p", w);
+ /* The plugin must be appended to the end of the array. This ensures that if
+ the plugin is added while iterating through the array (e.g. sendEvent(...))
+ that the iteration process is not corrupted.
+ */
*m_plugins.append() = w;
}
@@ -1480,22 +1484,17 @@ void WebViewCore::sendPluginVisibleScreen()
}
}
-void WebViewCore::sendPluginEvent(const ANPEvent& evt, ANPEventFlag flag)
-{
- PluginWidgetAndroid** iter = m_plugins.begin();
- PluginWidgetAndroid** stop = m_plugins.end();
- for (; iter < stop; ++iter) {
- if((*iter)->isAcceptingEvent(flag))
- (*iter)->sendEvent(evt);
- }
-}
-
void WebViewCore::sendPluginEvent(const ANPEvent& evt)
{
- PluginWidgetAndroid** iter = m_plugins.begin();
- PluginWidgetAndroid** stop = m_plugins.end();
- for (; iter < stop; ++iter) {
- (*iter)->sendEvent(evt);
+ /* The list of plugins may be manipulated as we iterate through the list.
+ This implementation allows for the addition of new plugins during an
+ iteration, but may fail if a plugin is removed. Currently, there are not
+ any use cases where a plugin is deleted while processing this loop, but
+ if it does occur we will have to use an alternate data structure and/or
+ iteration mechanism.
+ */
+ for (int x = 0; x < m_plugins.count(); x++) {
+ m_plugins[x]->sendEvent(evt);
}
}
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index ee87d84..e38576b 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -366,9 +366,6 @@ namespace android {
// send this event to all of the plugins in our list
void sendPluginEvent(const ANPEvent&);
- // send this event to all of the plugins who have the given flag set
- void sendPluginEvent(const ANPEvent& evt, ANPEventFlag flag);
-
// lookup the plugin widget struct given an NPP
PluginWidgetAndroid* getPluginWidget(NPP npp);