From 231d4e3152a9c27a73b6ac7badbe6be673aa3ddf Mon Sep 17 00:00:00 2001 From: Steve Block Date: Thu, 8 Oct 2009 17:19:54 +0100 Subject: Merge webkit.org at R49305 : Automatic merge by git. Change-Id: I8968561bc1bfd72b8923b7118d3728579c6dbcc7 --- WebCore/rendering/RenderPartObject.cpp | 85 +++++++++++++--------------------- 1 file changed, 31 insertions(+), 54 deletions(-) (limited to 'WebCore/rendering/RenderPartObject.cpp') diff --git a/WebCore/rendering/RenderPartObject.cpp b/WebCore/rendering/RenderPartObject.cpp index 72298c6..cba341b 100644 --- a/WebCore/rendering/RenderPartObject.cpp +++ b/WebCore/rendering/RenderPartObject.cpp @@ -33,8 +33,8 @@ #include "HTMLParamElement.h" #include "MIMETypeRegistry.h" #include "Page.h" -#include "PluginData.h" #include "RenderView.h" +#include "RenderWidgetProtector.h" #include "Text.h" #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) @@ -90,25 +90,12 @@ static ClassIdToTypeMap* createClassIdToTypeMap() map->add("clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA", "audio/x-pn-realaudio-plugin"); map->add("clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B", "video/quicktime"); map->add("clsid:166B1BCA-3F9C-11CF-8075-444553540000", "application/x-director"); -#if ENABLE(ACTIVEX_TYPE_CONVERSION_WMPLAYER) map->add("clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6", "application/x-mplayer2"); map->add("clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95", "application/x-mplayer2"); -#endif return map; } -static const String& activeXType() -{ - DEFINE_STATIC_LOCAL(String, activeXType, ("application/x-oleobject")); - return activeXType; -} - -static inline bool havePlugin(const PluginData* pluginData, const String& type) -{ - return pluginData && !type.isEmpty() && pluginData->supportsMimeType(type); -} - -static String serviceTypeForClassId(const String& classId, const PluginData* pluginData) +static String serviceTypeForClassId(const String& classId) { // Return early if classId is empty (since we won't do anything below). // Furthermore, if classId is null, calling get() below will crash. @@ -116,30 +103,7 @@ static String serviceTypeForClassId(const String& classId, const PluginData* plu return String(); static ClassIdToTypeMap* map = createClassIdToTypeMap(); - String type = map->get(classId); - - // If we do have a plug-in that supports generic ActiveX content and don't have a plug-in - // for the MIME type we came up with, ignore the MIME type we came up with and just use - // the ActiveX type. - if (havePlugin(pluginData, activeXType()) && !havePlugin(pluginData, type)) - return activeXType(); - - return type; -} - -static inline bool shouldUseEmbedDescendant(HTMLObjectElement* objectElement, const PluginData* pluginData) -{ -#if PLATFORM(MAC) - UNUSED_PARAM(objectElement); - UNUSED_PARAM(pluginData); - // On Mac, we always want to use the embed descendant. - return true; -#else - // If we have both an and , we always want to use the except when we have - // an ActiveX plug-in and plan to use it. - return !(havePlugin(pluginData, activeXType()) - && serviceTypeForClassId(objectElement->classId(), pluginData) == activeXType()); -#endif + return map->get(classId); } static void mapDataParamToSrc(Vector* paramNames, Vector* paramValues) @@ -168,6 +132,12 @@ void RenderPartObject::updateWidget(bool onlyCreateNonNetscapePlugins) Vector paramValues; Frame* frame = frameView()->frame(); + // The calls to FrameLoader::requestObject within this function can result in a plug-in being initialized. + // This can run cause arbitrary JavaScript to run and may result in this RenderObject being detached from + // the render tree and destroyed, causing a crash like . By extending our lifetime + // artifically to ensure that we remain alive for the duration of plug-in initialization. + RenderWidgetProtector protector(this); + if (node()->hasTagName(objectTag)) { HTMLObjectElement* o = static_cast(node()); @@ -177,17 +147,14 @@ void RenderPartObject::updateWidget(bool onlyCreateNonNetscapePlugins) // Check for a child EMBED tag. HTMLEmbedElement* embed = 0; - const PluginData* pluginData = frame->page()->pluginData(); - if (shouldUseEmbedDescendant(o, pluginData)) { - for (Node* child = o->firstChild(); child; ) { - if (child->hasTagName(embedTag)) { - embed = static_cast(child); - break; - } else if (child->hasTagName(objectTag)) - child = child->nextSibling(); // Don't descend into nested OBJECT tags - else - child = child->traverseNextNode(o); // Otherwise descend (EMBEDs may be inside COMMENT tags) - } + for (Node* child = o->firstChild(); child; ) { + if (child->hasTagName(embedTag)) { + embed = static_cast(child); + break; + } else if (child->hasTagName(objectTag)) + child = child->nextSibling(); // Don't descend into nested OBJECT tags + else + child = child->traverseNextNode(o); // Otherwise descend (EMBEDs may be inside COMMENT tags) } // Use the attributes from the EMBED tag instead of the OBJECT tag including WIDTH and HEIGHT. @@ -260,7 +227,7 @@ void RenderPartObject::updateWidget(bool onlyCreateNonNetscapePlugins) // If we still don't have a type, try to map from a specific CLASSID to a type. if (serviceType.isEmpty()) - serviceType = serviceTypeForClassId(o->classId(), pluginData); + serviceType = serviceTypeForClassId(o->classId()); if (!isURLAllowed(document(), url)) return; @@ -282,7 +249,8 @@ void RenderPartObject::updateWidget(bool onlyCreateNonNetscapePlugins) return; } - bool success = frame->loader()->requestObject(this, url, AtomicString(o->name()), serviceType, paramNames, paramValues); + bool success = o->dispatchBeforeLoadEvent(url) && + frame->loader()->requestObject(this, url, o->getAttribute(nameAttr), serviceType, paramNames, paramValues); if (!success && m_hasFallbackContent) o->renderFallbackContent(); } else if (node()->hasTagName(embedTag)) { @@ -316,7 +284,8 @@ void RenderPartObject::updateWidget(bool onlyCreateNonNetscapePlugins) } - frame->loader()->requestObject(this, url, o->getAttribute(nameAttr), serviceType, paramNames, paramValues); + if (o->dispatchBeforeLoadEvent(url)) + frame->loader()->requestObject(this, url, o->getAttribute(nameAttr), serviceType, paramNames, paramValues); } #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) else if (node()->hasTagName(videoTag) || node()->hasTagName(audioTag)) { @@ -339,7 +308,9 @@ void RenderPartObject::updateWidget(bool onlyCreateNonNetscapePlugins) } serviceType = "application/x-media-element-proxy-plugin"; - frame->loader()->requestObject(this, url, nullAtom, serviceType, paramNames, paramValues); + + if (o->dispatchBeforeLoadEvent(url)) + frame->loader()->requestObject(this, url, nullAtom, serviceType, paramNames, paramValues); } #endif } @@ -425,12 +396,18 @@ void RenderPartObject::layout() #else calcWidth(); calcHeight(); +<<<<<<< HEAD:WebCore/rendering/RenderPartObject.cpp #endif adjustOverflowForBoxShadowAndReflect(); +======= +>>>>>>> webkit.org at 49305:WebCore/rendering/RenderPartObject.cpp RenderPart::layout(); + m_overflow.clear(); + addShadowOverflow(); + if (!widget() && frameView()) frameView()->addWidgetToUpdate(this); -- cgit v1.1