[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e
inferno at chromium.org
inferno at chromium.org
Fri Jan 21 14:47:44 UTC 2011
The following commit has been merged in the debian/experimental branch:
commit 90bec5dabf3781f26e89605990745c83173ff382
Author: inferno at chromium.org <inferno at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Dec 30 08:02:08 2010 +0000
2010-12-30 Abhishek Arya <inferno at chromium.org>
Reviewed by Eric Seidel.
Create a helper function for finding descendent video elements for a node.
https://bugs.webkit.org/show_bug.cgi?id=51696
Test: media/video-element-other-namespace-crash.html
* html/MediaDocument.cpp:
(WebCore::descendentVideoElement): helper function.
(WebCore::MediaDocument::defaultEventHandler): use the new helper function. fix code repetitions.
(WebCore::MediaDocument::replaceMediaElementTimerFired): use the new helper function.
2010-12-30 Abhishek Arya <inferno at chromium.org>
Reviewed by Eric Seidel.
Tests that we do not crash when trying to find video elements in the media document.
https://bugs.webkit.org/show_bug.cgi?id=51696
* media/video-element-other-namespace-crash-expected.txt: Added.
* media/video-element-other-namespace-crash.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74787 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 1c839b2..f6a1de7 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-12-30 Abhishek Arya <inferno at chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Tests that we do not crash when trying to find video elements in the media document.
+ https://bugs.webkit.org/show_bug.cgi?id=51696
+
+ * media/video-element-other-namespace-crash-expected.txt: Added.
+ * media/video-element-other-namespace-crash.html: Added.
+
2010-12-29 Abhishek Arya <inferno at chromium.org>
Unreviewed.
diff --git a/LayoutTests/media/video-element-other-namespace-crash-expected.txt b/LayoutTests/media/video-element-other-namespace-crash-expected.txt
new file mode 100644
index 0000000..6cd4722
--- /dev/null
+++ b/LayoutTests/media/video-element-other-namespace-crash-expected.txt
@@ -0,0 +1 @@
+PASS, did not crash.
diff --git a/LayoutTests/media/video-element-other-namespace-crash.html b/LayoutTests/media/video-element-other-namespace-crash.html
new file mode 100644
index 0000000..e2e0d08
--- /dev/null
+++ b/LayoutTests/media/video-element-other-namespace-crash.html
@@ -0,0 +1,29 @@
+<html>
+<script>
+if (window.layoutTestController)
+{
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function runTest()
+{
+ frame = document.body.appendChild(document.createElement('iframe'));
+ frame.onload = function() {
+ frame.onload = null;
+ container = frame.contentDocument.body.appendChild(frame.contentDocument.createElement('div'));
+ otherVideo = container.appendChild(frame.contentDocument.createElementNS('other', 'video'));
+ event = frame.contentDocument.createEvent('KeyboardEvents');
+ event.initKeyboardEvent('keydown', 1, 1, frame.contentWindow, 'U+0020');
+ container.dispatchEvent(event);
+
+ document.body.appendChild(document.createTextNode('PASS, did not crash.'));
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+
+ frame.src = 'content/test.mp4';
+}
+</script>
+<body onload="runTest()"/>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 95302be..8279906 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-12-30 Abhishek Arya <inferno at chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Create a helper function for finding descendent video elements for a node.
+ https://bugs.webkit.org/show_bug.cgi?id=51696
+
+ Test: media/video-element-other-namespace-crash.html
+
+ * html/MediaDocument.cpp:
+ (WebCore::descendentVideoElement): helper function.
+ (WebCore::MediaDocument::defaultEventHandler): use the new helper function. fix code repetitions.
+ (WebCore::MediaDocument::replaceMediaElementTimerFired): use the new helper function.
+
2010-12-29 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Yury Semikhatsky.
diff --git a/WebCore/html/MediaDocument.cpp b/WebCore/html/MediaDocument.cpp
index af66795..d6fe6dd 100644
--- a/WebCore/html/MediaDocument.cpp
+++ b/WebCore/html/MediaDocument.cpp
@@ -131,47 +131,52 @@ PassRefPtr<DocumentParser> MediaDocument::createParser()
return MediaDocumentParser::create(this);
}
+static inline HTMLVideoElement* descendentVideoElement(Node* node)
+{
+ ASSERT(node);
+
+ if (node->hasTagName(videoTag))
+ return static_cast<HTMLVideoElement*>(node);
+
+ RefPtr<NodeList> nodeList = node->getElementsByTagNameNS(videoTag.namespaceURI(), videoTag.localName());
+
+ if (nodeList.get()->length() > 0)
+ return static_cast<HTMLVideoElement*>(nodeList.get()->item(0));
+
+ return 0;
+}
+
void MediaDocument::defaultEventHandler(Event* event)
{
// Match the default Quicktime plugin behavior to allow
// clicking and double-clicking to pause and play the media.
Node* targetNode = event->target()->toNode();
- if (targetNode && targetNode->hasTagName(videoTag)) {
- HTMLVideoElement* video = static_cast<HTMLVideoElement*>(targetNode);
- if (event->type() == eventNames().clickEvent) {
- if (!video->canPlay()) {
- video->pause(event->fromUserGesture());
- event->setDefaultHandled();
- }
- } else if (event->type() == eventNames().dblclickEvent) {
- if (video->canPlay()) {
- video->play(event->fromUserGesture());
- event->setDefaultHandled();
- }
- }
- }
+ if (!targetNode)
+ return;
+
+ HTMLVideoElement* video = descendentVideoElement(targetNode);
+ if (!video)
+ return;
- if (event->type() == eventNames().keydownEvent && event->isKeyboardEvent()) {
- HTMLVideoElement* video = 0;
- if (targetNode) {
- if (targetNode->hasTagName(videoTag))
- video = static_cast<HTMLVideoElement*>(targetNode);
- else {
- RefPtr<NodeList> nodeList = targetNode->getElementsByTagName("video");
- if (nodeList.get()->length() > 0)
- video = static_cast<HTMLVideoElement*>(nodeList.get()->item(0));
- }
+ if (event->type() == eventNames().clickEvent) {
+ if (!video->canPlay()) {
+ video->pause(event->fromUserGesture());
+ event->setDefaultHandled();
}
- if (video) {
- KeyboardEvent* keyboardEvent = static_cast<KeyboardEvent*>(event);
- if (keyboardEvent->keyIdentifier() == "U+0020") { // space
- if (video->paused()) {
- if (video->canPlay())
- video->play(event->fromUserGesture());
- } else
- video->pause(event->fromUserGesture());
- event->setDefaultHandled();
- }
+ } else if (event->type() == eventNames().dblclickEvent) {
+ if (video->canPlay()) {
+ video->play(event->fromUserGesture());
+ event->setDefaultHandled();
+ }
+ } else if (event->type() == eventNames().keydownEvent && event->isKeyboardEvent()) {
+ KeyboardEvent* keyboardEvent = static_cast<KeyboardEvent*>(event);
+ if (keyboardEvent->keyIdentifier() == "U+0020") { // space
+ if (video->paused()) {
+ if (video->canPlay())
+ video->play(event->fromUserGesture());
+ } else
+ video->pause(event->fromUserGesture());
+ event->setDefaultHandled();
}
}
}
@@ -196,11 +201,7 @@ void MediaDocument::replaceMediaElementTimerFired(Timer<MediaDocument>*)
htmlBody->setAttribute(marginwidthAttr, "0");
htmlBody->setAttribute(marginheightAttr, "0");
- RefPtr<NodeList> nodeList = htmlBody->getElementsByTagName("video");
-
- if (nodeList.get()->length() > 0) {
- HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(nodeList.get()->item(0));
-
+ if (HTMLVideoElement* videoElement = descendentVideoElement(htmlBody)) {
RefPtr<Element> element = Document::createElement(embedTag, false);
HTMLEmbedElement* embedElement = static_cast<HTMLEmbedElement*>(element.get());
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list