https://bugs.webkit.org/show_bug.cgi?id=74340
Reviewed by Adam Barth.
I'm preparing to unify these two methods, and starting by sharing more code between them.
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::updateWidget):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::updateWidget):
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::guardedDispatchBeforeLoadEvent):
* html/HTMLPlugInElement.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105932
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-01-25 Eric Seidel <eric@webkit.org>
+
+ Share more code between updateWidget implementations in HTMLEmbedElement and HTMLObjectElement
+ https://bugs.webkit.org/show_bug.cgi?id=74340
+
+ Reviewed by Adam Barth.
+
+ I'm preparing to unify these two methods, and starting by sharing more code between them.
+
+ * html/HTMLEmbedElement.cpp:
+ (WebCore::HTMLEmbedElement::updateWidget):
+ * html/HTMLObjectElement.cpp:
+ (WebCore::HTMLObjectElement::updateWidget):
+ * html/HTMLPlugInElement.cpp:
+ (WebCore::HTMLPlugInElement::guardedDispatchBeforeLoadEvent):
+ * html/HTMLPlugInElement.h:
+
2012-01-25 Eric Uhrhane <ericu@chromium.org>
Add full support for filesystem URLs.
Vector<String> paramValues;
parametersForPlugin(paramNames, paramValues);
- ASSERT(!m_inBeforeLoadEventHandler);
- m_inBeforeLoadEventHandler = true;
- bool beforeLoadAllowedLoad = dispatchBeforeLoadEvent(m_url);
- m_inBeforeLoadEventHandler = false;
-
+ bool beforeLoadAllowedLoad = guardedDispatchBeforeLoadEvent(m_url);
if (!beforeLoadAllowedLoad) {
if (document()->isPluginDocument()) {
// Plugins inside plugin documents load differently than other plugins. By the time
if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(url, serviceType))
return;
- ASSERT(!m_inBeforeLoadEventHandler);
- m_inBeforeLoadEventHandler = true;
- bool beforeLoadAllowedLoad = dispatchBeforeLoadEvent(url);
- m_inBeforeLoadEventHandler = false;
-
+ bool beforeLoadAllowedLoad = guardedDispatchBeforeLoadEvent(url);
// beforeload events can modify the DOM, potentially causing
// RenderWidget::destroy() to be called. Ensure we haven't been
// destroyed before continuing.
return m_instance;
}
+bool HTMLPlugInElement::guardedDispatchBeforeLoadEvent(const String& sourceURL)
+{
+ ASSERT(!m_inBeforeLoadEventHandler);
+ m_inBeforeLoadEventHandler = true;
+ // static_cast is used to avoid a compile error since dispatchBeforeLoadEvent
+ // is intentionally undefined on this class.
+ bool beforeLoadAllowedLoad = static_cast<HTMLFrameOwnerElement*>(this)->dispatchBeforeLoadEvent(sourceURL);
+ m_inBeforeLoadEventHandler = false;
+ return beforeLoadAllowedLoad;
+}
+
Widget* HTMLPlugInElement::pluginWidget()
{
if (m_inBeforeLoadEventHandler) {
virtual void parseMappedAttribute(Attribute*);
bool m_inBeforeLoadEventHandler;
+ // Subclasses should use guardedDispatchBeforeLoadEvent instead of calling dispatchBeforeLoadEvent directly.
+ bool guardedDispatchBeforeLoadEvent(const String& sourceURL);
private:
+ bool dispatchBeforeLoadEvent(const String& sourceURL); // Not implemented, generates a compile error if subclasses call this by mistake.
+
virtual void defaultEventHandler(Event*);
virtual RenderWidget* renderWidgetForJSBindings() = 0;