check_html_unknown_elements
authorDebian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Wed, 1 Apr 2015 17:44:29 +0000 (17:44 +0000)
committerFelix Geyer <fgeyer@debian.org>
Wed, 1 Apr 2015 17:44:29 +0000 (17:44 +0000)
Gbp-Pq: Name check_html_unknown_elements.diff

Source/WebCore/dom/make_names.pl
Source/WebCore/html/HTMLAudioElement.h
Source/WebCore/html/HTMLMediaElement.cpp

index 049763ab7dbbe2a67d41baa82bc430c35de0f0bf..0eb05491e09bb5c9d9e6a5efdfb1570882e35b1d 100755 (executable)
@@ -390,6 +390,10 @@ sub printConstructorInterior
     my ($F, $tagName, $interfaceName, $constructorTagName) = @_;
 
     # Handle media elements.
+    # Note that wrapperOnlyIfMediaIsAvailable is a misnomer, because media availability
+    # does not just control the wrapper; it controls the element object that is created.
+    # FIXME: Could we instead do this entirely in the wrapper, and use custom wrappers
+    # instead of having all the support for this here in this script?
     if ($enabledTags{$tagName}{wrapperOnlyIfMediaIsAvailable}) {
         print F <<END
     Settings* settings = document->settings();
@@ -1042,14 +1046,11 @@ sub printWrapperFunctions
             print F "#if ${conditionalString}\n\n";
         }
 
-        # Hack for the media tags
-        # FIXME: This should have been done via a CustomWrapper attribute and a separate *Custom file.
         if ($enabledTags{$tagName}{wrapperOnlyIfMediaIsAvailable}) {
             print F <<END
 static JSDOMWrapper* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<$parameters{namespace}Element> element)
 {
-    Settings* settings = element->document()->settings();
-    if (!MediaPlayer::isAvailable() || (settings && !settings->mediaEnabled()))
+    if (element->isHTMLUnknownElement())
         return CREATE_DOM_WRAPPER(exec, globalObject, $parameters{namespace}Element, element.get());
     return CREATE_DOM_WRAPPER(exec, globalObject, ${JSInterfaceName}, element.get());
 }
index 07ca48dd41d4803906b4f4de12a5bf586fb58b48..0d248366814694c74305a06c43d3faad773fa486 100644 (file)
@@ -43,14 +43,19 @@ private:
     HTMLAudioElement(const QualifiedName&, Document*, bool);
 };
 
-inline bool isHTMLAudioElement(Node* node)
+inline bool isHTMLAudioElement(HTMLElement* element)
 {
-    return node->hasTagName(HTMLNames::audioTag);
+    return !element->isHTMLUnknownElement() && element->hasTagName(HTMLNames::audioTag);
 }
 
 inline bool isHTMLAudioElement(Element* element)
 {
-    return element->hasTagName(HTMLNames::audioTag);
+    return element->isHTMLElement() && isHTMLAudioElement(toHTMLElement(element));
+}
+
+inline bool isHTMLAudioElement(Node* node)
+{
+    return node->isHTMLElement() && isHTMLAudioElement(toHTMLElement(node));
 }
 
 inline HTMLAudioElement* toHTMLAudioElement(Node* node)
index 8ef0348ab2d36ec92b0da379f785d50bcccd33ac..fc8578e574ea18f455ea773c57c7af2b909c5473 100644 (file)
@@ -2379,6 +2379,13 @@ double HTMLMediaElement::duration() const
 
 bool HTMLMediaElement::paused() const
 {
+    // As of this writing, JavaScript garbage collection calls this function directly. In the past
+    // we had problems where this was called on an object after a bad cast. The assertion below
+    // made our regression test detect the problem, so we should keep it because of that. But note
+    // that the value of the assertion relies on the compiler not being smart enough to know that
+    // isHTMLUnknownElement is guaranteed to return false for an HTMLMediaElement.
+    ASSERT(!isHTMLUnknownElement());
+
     return m_paused;
 }