bool HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk() { // This site-specific hack maintains compatibility with Mac OS X Wiki Server, // which embeds QuickTime movies using an object tag containing QuickTime's // ActiveX classid. Treat this classid as valid only if OS X Server's unique // 'generator' meta tag is present. Only apply this quirk if there is no // fallback content, which ensures the quirk will disable itself if Wiki // Server is updated to generate an alternate embed tag as fallback content. if (!document()->page() || !document()->page()->settings()->needsSiteSpecificQuirks() || hasFallbackContent() || !equalIgnoringCase(classId(), "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B")) return false; RefPtr<NodeList> metaElements = document()->getElementsByTagName(HTMLNames::metaTag.localName()); unsigned length = metaElements->length(); for (unsigned i = 0; i < length; ++i) { ASSERT(metaElements->item(i)->isHTMLElement()); HTMLMetaElement* metaElement = static_cast<HTMLMetaElement*>(metaElements->item(i)); if (equalIgnoringCase(metaElement->name(), "generator") && metaElement->content().startsWith("Mac OS X Server Web Services Server", false)) return true; } return false; }
bool HTMLPlugInElement::requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues) { if (url.isEmpty() && mimeType.isEmpty()) return false; // FIXME: None of this code should use renderers! RenderEmbeddedObject* renderer = renderEmbeddedObject(); ASSERT(renderer); if (!renderer) return false; KURL completedURL = document().completeURL(url); if (!pluginIsLoadable(completedURL, mimeType)) return false; bool useFallback; bool requireRenderer = true; if (shouldUsePlugin(completedURL, mimeType, hasFallbackContent(), useFallback)) return loadPlugin(completedURL, mimeType, paramNames, paramValues, useFallback, requireRenderer); // If the plug-in element already contains a subframe, // loadOrRedirectSubframe will re-use it. Otherwise, it will create a new // frame and set it as the RenderPart's widget, causing what was previously // in the widget to be torn down. return loadOrRedirectSubframe(completedURL, getNameAttribute(), true); }
// FIXME: This should be unified with HTMLEmbedElement::updateWidget and // moved down into HTMLPluginImageElement.cpp void HTMLObjectElement::updateWidget(PluginCreationOption pluginCreationOption) { ASSERT(!renderEmbeddedObject()->isPluginUnavailable()); ASSERT(needsWidgetUpdate()); setNeedsWidgetUpdate(false); // FIXME: This should ASSERT isFinishedParsingChildren() instead. if (!isFinishedParsingChildren()) return; // FIXME: I'm not sure it's ever possible to get into updateWidget during a // removal, but just in case we should avoid loading the frame to prevent // security bugs. if (!SubframeLoadingDisabler::canLoadFrame(*this)) return; String url = this->url(); String serviceType = this->serviceType(); // FIXME: These should be joined into a PluginParameters class. Vector<String> paramNames; Vector<String> paramValues; parametersForPlugin(paramNames, paramValues, url, serviceType); // Note: url is modified above by parametersForPlugin. if (!allowedToLoadFrameURL(url)) return; bool fallbackContent = hasFallbackContent(); renderEmbeddedObject()->setHasFallbackContent(fallbackContent); // FIXME: It's sadness that we have this special case here. // See http://trac.webkit.org/changeset/25128 and // plugins/netscape-plugin-setwindow-size.html if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(url, serviceType)) { // Ensure updateWidget() is called again during layout to create the Netscape plug-in. setNeedsWidgetUpdate(true); return; } Ref<HTMLObjectElement> protect(*this); // beforeload and plugin loading can make arbitrary DOM mutations. bool beforeLoadAllowedLoad = guardedDispatchBeforeLoadEvent(url); if (!renderer()) // Do not load the plugin if beforeload removed this element or its renderer. return; SubframeLoader& loader = document().frame()->loader().subframeLoader(); bool success = beforeLoadAllowedLoad && hasValidClassId() && loader.requestObject(this, url, getNameAttribute(), serviceType, paramNames, paramValues); if (!success && fallbackContent) renderFallbackContent(); }
// FIXME: This should be unified with HTMLEmbedElement::updateWidget and // moved down into HTMLPluginImageElement.cpp void HTMLObjectElement::updateWidget(bool onlyCreateNonNetscapePlugins) { ASSERT(!renderEmbeddedObject()->pluginCrashedOrWasMissing()); // FIXME: We should ASSERT(needsWidgetUpdate()), but currently // FrameView::updateWidget() calls updateWidget(false) without checking if // the widget actually needs updating! setNeedsWidgetUpdate(false); // FIXME: This should ASSERT isFinishedParsingChildren() instead. if (!isFinishedParsingChildren()) return; String url = this->url(); // If the object does not specify a MIME type via a type attribute, but does // contain a classid attribute, try to map the classid to a MIME type. String serviceType = this->serviceType(); if (serviceType.isEmpty()) serviceType = serviceTypeForClassId(classId()); // FIXME: These should be joined into a PluginParameters class. Vector<String> paramNames; Vector<String> paramValues; parametersForPlugin(paramNames, paramValues, url, serviceType); // Note: url is modified above by parametersForPlugin. if (!allowedToLoadFrameURL(url)) return; bool fallbackContent = hasFallbackContent(); renderEmbeddedObject()->setHasFallbackContent(fallbackContent); if (onlyCreateNonNetscapePlugins && wouldLoadAsNetscapePlugin(url, serviceType)) return; bool beforeLoadAllowedLoad = dispatchBeforeLoadEvent(url); // beforeload events can modify the DOM, potentially causing // RenderWidget::destroy() to be called. Ensure we haven't been // destroyed before continuing. // FIXME: Should this render fallback content? if (!renderer()) return; SubframeLoader* loader = document()->frame()->loader()->subframeLoader(); bool success = beforeLoadAllowedLoad && loader->requestObject(this, url, getAttribute(nameAttr), serviceType, paramNames, paramValues); if (!success && fallbackContent) renderFallbackContent(); }
// FIXME: This should be unified with HTMLEmbedElement::updateWidget and // moved down into HTMLPluginImageElement.cpp void HTMLObjectElement::updateWidget(PluginCreationOption pluginCreationOption) { ASSERT(!renderEmbeddedObject()->pluginCrashedOrWasMissing()); // FIXME: We should ASSERT(needsWidgetUpdate()), but currently // FrameView::updateWidget() calls updateWidget(false) without checking if // the widget actually needs updating! setNeedsWidgetUpdate(false); // FIXME: This should ASSERT isFinishedParsingChildren() instead. if (!isFinishedParsingChildren()) return; String url = this->url(); String serviceType = this->serviceType(); // FIXME: These should be joined into a PluginParameters class. Vector<String> paramNames; Vector<String> paramValues; parametersForPlugin(paramNames, paramValues, url, serviceType); // Note: url is modified above by parametersForPlugin. if (!allowedToLoadFrameURL(url)) return; bool fallbackContent = hasFallbackContent(); renderEmbeddedObject()->setHasFallbackContent(fallbackContent); if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(url, serviceType)) return; ASSERT(!m_inBeforeLoadEventHandler); m_inBeforeLoadEventHandler = true; bool beforeLoadAllowedLoad = dispatchBeforeLoadEvent(url); m_inBeforeLoadEventHandler = false; // beforeload events can modify the DOM, potentially causing // RenderWidget::destroy() to be called. Ensure we haven't been // destroyed before continuing. // FIXME: Should this render fallback content? if (!renderer()) return; RefPtr<HTMLObjectElement> protect(this); // Loading the plugin might remove us from the document. SubframeLoader* loader = document()->frame()->loader()->subframeLoader(); bool success = beforeLoadAllowedLoad && hasValidClassId() && loader->requestObject(this, url, getAttribute(nameAttr), serviceType, paramNames, paramValues); if (!success && fallbackContent) renderFallbackContent(); }
bool HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk() { // This site-specific hack maintains compatibility with Mac OS X Wiki Server, // which embeds QuickTime movies using an object tag containing QuickTime's // ActiveX classid. Treat this classid as valid only if OS X Server's unique // 'generator' meta tag is present. Only apply this quirk if there is no // fallback content, which ensures the quirk will disable itself if Wiki // Server is updated to generate an alternate embed tag as fallback content. if (!document().page() || !document().page()->settings().needsSiteSpecificQuirks() || hasFallbackContent() || !equalIgnoringCase(fastGetAttribute(classidAttr), "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B")) return false; for (auto& metaElement : descendantsOfType<HTMLMetaElement>(document())) { if (equalIgnoringCase(metaElement.name(), "generator") && metaElement.content().startsWith("Mac OS X Server Web Services Server", false)) return true; } return false; }