diff options
author | Grace Kloba <klobag@google.com> | 2010-04-01 09:49:56 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-04-01 09:49:56 -0700 |
commit | 4535cd9bbf6839dfeab97e7d826d401b523fedec (patch) | |
tree | 9a71665efa4eb7979fddf30d9f02998ee440ce9d /WebCore | |
parent | 0e519b9227fdf50b333a2bd89f2914e437a21595 (diff) | |
parent | 72dc094b5140ab6a3cd9e4984d566b8c788f5e1f (diff) | |
download | external_webkit-4535cd9bbf6839dfeab97e7d826d401b523fedec.zip external_webkit-4535cd9bbf6839dfeab97e7d826d401b523fedec.tar.gz external_webkit-4535cd9bbf6839dfeab97e7d826d401b523fedec.tar.bz2 |
Merge "If "widget" is already existed in the HashMap when createScriptInstanceForWidget(widget) is called, we need to release the reference of the matching npObject to avoid leak." into froyo
Diffstat (limited to 'WebCore')
-rw-r--r-- | WebCore/bindings/v8/ScriptController.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp index e2b886d..4e8ba5e 100644 --- a/WebCore/bindings/v8/ScriptController.cpp +++ b/WebCore/bindings/v8/ScriptController.cpp @@ -334,6 +334,19 @@ PassScriptInstance ScriptController::createScriptInstanceForWidget(Widget* widge v8::Local<v8::Object> wrapper = createV8ObjectForNPObject(npObject, 0); +#ifdef ANDROID_FIX + // TODO: this should be up streamed. + // HTMLEmbedElement::getInstance() will call this function with its closest + // ancestor who has the objectTag. So this "widget" may be already in the + // HashMap. If it does, even m_pluginObjects.set() is a no-op, we do need to + // call _NPN_ReleaseObject on the npObject to balance the reference count. + PluginObjectMap::iterator it = m_pluginObjects.find(widget); + if (it != m_pluginObjects.end()) { + ASSERT(it->second == npObject); + _NPN_ReleaseObject(it->second); + } +#endif + // Track the plugin object. We've been given a reference to the object. m_pluginObjects.set(widget, npObject); |