diff options
Diffstat (limited to 'WebKit/android')
| -rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 27 | ||||
| -rw-r--r-- | WebKit/android/jni/WebViewCore.h | 3 |
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); |
