[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 14:36:04 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 53b27b5ac420e6763243fd33ddc9b2f261fcce84
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Oct 13 23:10:56 2010 +0000
2010-10-13 James Simonsen <simonjam at chromium.org>
Reviewed by Darin Adler.
Implement onreadystatechange event handler for Documents
https://bugs.webkit.org/show_bug.cgi?id=26140
* fast/dom/Document/readystate-expected.txt:
* fast/dom/Document/readystate.html:
2010-10-13 James Simonsen <simonjam at chromium.org>
Reviewed by Darin Adler.
Implement onreadystatechange event handler for Documents
https://bugs.webkit.org/show_bug.cgi?id=26140
Test: fast/dom/Document/readystate.html
* dom/Document.cpp:
(WebCore::Document::setReadyState): Fire readystatechangeevent.
(WebCore::Document::open): Clear event listeners.
* dom/Document.h: Add readystatechange event.
* dom/Document.idl: Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69710 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 3756175..88d41bb 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-10-13 James Simonsen <simonjam at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Implement onreadystatechange event handler for Documents
+ https://bugs.webkit.org/show_bug.cgi?id=26140
+
+ * fast/dom/Document/readystate-expected.txt:
+ * fast/dom/Document/readystate.html:
+
2010-10-13 Chris Fleizach <cfleizach at apple.com>
No review. Fix layout test, now that behavior is correct.
diff --git a/LayoutTests/fast/dom/Document/readystate-expected.txt b/LayoutTests/fast/dom/Document/readystate-expected.txt
index 6046063..daa8d9f 100644
--- a/LayoutTests/fast/dom/Document/readystate-expected.txt
+++ b/LayoutTests/fast/dom/Document/readystate-expected.txt
@@ -1,9 +1,24 @@
Tests that the document's readyState is set properly at various phases during load.
PASS document.readyState is "loading"
+PASS document.onreadystatechange is null
PASS document.readyState is "loading"
+PASS subdocument.readyState is "loading"
+PASS subdocument.readyState is "complete"
+PASS htmlDocument.readyState is "loading"
+PASS dynamicIframe.contentDocument.readyState is "complete"
+PASS dynamicIframe.contentDocument.onreadystatechange is null
+PASS dynamicIframe.contentDocument.readyState is "loading"
+PASS dynamicIframe.contentDocument.readyState is expectedDynamicStates[nextExpectedDynamicState]
+PASS dynamicIframe.contentDocument.readyState is expectedDynamicStates[nextExpectedDynamicState]
+PASS dynamicIframe.contentDocument.readyState is "complete"
+PASS event.target.readyState is expectedStates[nextExpectedState]
PASS document.readyState is "interactive"
+PASS readyStateChangeFired is true
PASS document.readyState is "interactive"
PASS document.readyState is "interactive"
+PASS event.target.readyState is expectedStates[nextExpectedState]
+PASS nextExpectedState is expectedStates.length
+PASS nextExpectedDynamicState is expectedDynamicStates.length
PASS document.readyState is "complete"
PASS successfullyParsed is true
diff --git a/LayoutTests/fast/dom/Document/readystate.html b/LayoutTests/fast/dom/Document/readystate.html
index 4751aa7..578858c 100644
--- a/LayoutTests/fast/dom/Document/readystate.html
+++ b/LayoutTests/fast/dom/Document/readystate.html
@@ -4,14 +4,16 @@
<link rel="stylesheet" href="../../js/resources/js-test-style.css">
<script src="../../js/resources/js-test-pre.js"></script>
</head>
-<body onload="shouldBeEqualToString('document.readyState', 'complete');finishJSTest();">
+<body onload="allDone()">
Tests that the document's readyState is set properly at various phases during load.
<div id="console"></div>
-<script defer src="data:text/javascript,shouldBeEqualToString('document.readyState', 'interactive');"></script>
+<script defer src="data:text/javascript,shouldBeEqualToString('document.readyState', 'interactive');shouldBeTrue('readyStateChangeFired');"></script>
<script src="data:text/javascript,shouldBeEqualToString('document.readyState', 'loading');"></script>
+<iframe src="does-not-exist.html"></iframe>
<script>
var jsTestIsAsync = true;
+ shouldBe("document.onreadystatechange", "null");
shouldBeEqualToString("document.readyState", "loading");
document.addEventListener("DOMContentLoaded", function() {
@@ -22,6 +24,60 @@ Tests that the document's readyState is set properly at various phases during lo
document.getElementsByTagName('head')[0].appendChild(el);
}, false);
+ var expectedStates = ["interactive", "complete"];
+ var nextExpectedState = 0;
+ var readyStateChangeFired = false;
+ document.onreadystatechange = function(event) {
+ shouldBe("event.target.readyState", "expectedStates[nextExpectedState]");
+ ++nextExpectedState;
+ readyStateChangeFired = true;
+ }
+
+ function readyStateShouldNotChange(event) {
+ testFailed("should not have been notified of subdocument state change to " + event.target.readyState);
+ }
+
+ var subdocument = document.getElementsByTagName('iframe')[0].contentDocument;
+ subdocument.onreadystatechange = readyStateShouldNotChange;
+ subdocument.open();
+ shouldBeEqualToString("subdocument.readyState", "loading");
+ subdocument.close();
+ shouldBeEqualToString("subdocument.readyState", "complete");
+
+ var htmlDocument = document.implementation.createHTMLDocument();
+ shouldBeEqualToString("htmlDocument.readyState", "loading");
+
+ var expectedDynamicStates = ["interactive", "complete"];
+ var nextExpectedDynamicState = 0;
+ var dynamicIframe = document.createElement('iframe');
+ dynamicIframe.setAttribute("src", "about:blank");
+ dynamicIframe.setAttribute("onload", "parent.dynamicIframeLoaded()");
+ subdocument.body.appendChild(dynamicIframe);
+ function dynamicIframeLoaded() {
+ shouldBeEqualToString("dynamicIframe.contentDocument.readyState", "complete");
+ dynamicIframe.contentDocument.onreadystatechange = readyStateShouldNotChange;
+ dynamicIframe.contentDocument.open();
+ shouldBe("dynamicIframe.contentDocument.onreadystatechange", "null");
+ shouldBeEqualToString("dynamicIframe.contentDocument.readyState", "loading");
+ dynamicIframe.contentDocument.onreadystatechange = function() {
+ shouldBe("dynamicIframe.contentDocument.readyState", "expectedDynamicStates[nextExpectedDynamicState]");
+ ++nextExpectedDynamicState;
+ }
+ dynamicIframe.contentDocument.close();
+ shouldBeEqualToString("dynamicIframe.contentDocument.readyState", "complete");
+
+ dynamicIframe.contentDocument.onreadystatechange = readyStateShouldNotChange;
+ subdocument.open();
+ subdocument.close();
+ }
+
+ function allDone() {
+ shouldBe("nextExpectedState", "expectedStates.length");
+ shouldBe("nextExpectedDynamicState", "expectedDynamicStates.length");
+ shouldBeEqualToString("document.readyState", "complete");
+ finishJSTest();
+ }
+
var successfullyParsed = true;
</script>
<script src="../../js/resources/js-test-post.js"></script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 13eab86..e44de87 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-10-13 James Simonsen <simonjam at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Implement onreadystatechange event handler for Documents
+ https://bugs.webkit.org/show_bug.cgi?id=26140
+
+ Test: fast/dom/Document/readystate.html
+
+ * dom/Document.cpp:
+ (WebCore::Document::setReadyState): Fire readystatechangeevent.
+ (WebCore::Document::open): Clear event listeners.
+ * dom/Document.h: Add readystatechange event.
+ * dom/Document.idl: Ditto.
+
2010-10-13 Chris Fleizach <cfleizach at apple.com>
Reviewed by Beth Dakin.
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index f23ea7b..da6a1f8 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -984,8 +984,10 @@ String Document::readyState() const
void Document::setReadyState(ReadyState readyState)
{
- // FIXME: Fire the readystatechange event on this Document.
+ if (readyState == m_readyState)
+ return;
m_readyState = readyState;
+ dispatchEvent(Event::create(eventNames().readystatechangeEvent, false, false));
}
String Document::encoding() const
@@ -1861,6 +1863,7 @@ void Document::open(Document* ownerDocument)
m_frame->loader()->stopAllLoaders();
}
+ removeAllEventListeners();
implicitOpen();
if (DOMWindow* domWindow = this->domWindow())
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index cf10b49..7e9df7c 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -256,6 +256,7 @@ public:
DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
DEFINE_ATTRIBUTE_EVENT_LISTENER(focus);
DEFINE_ATTRIBUTE_EVENT_LISTENER(load);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange);
// WebKit extensions
DEFINE_ATTRIBUTE_EVENT_LISTENER(beforecut);
diff --git a/WebCore/dom/Document.idl b/WebCore/dom/Document.idl
index e551f88..426e9cf 100644
--- a/WebCore/dom/Document.idl
+++ b/WebCore/dom/Document.idl
@@ -278,6 +278,7 @@ module core {
attribute [DontEnum] EventListener onmouseover;
attribute [DontEnum] EventListener onmouseup;
attribute [DontEnum] EventListener onmousewheel;
+ attribute [DontEnum] EventListener onreadystatechange;
attribute [DontEnum] EventListener onscroll;
attribute [DontEnum] EventListener onselect;
attribute [DontEnum] EventListener onsubmit;
@@ -297,7 +298,6 @@ module core {
// attribute [DontEnum] EventListener onplaying;
// attribute [DontEnum] EventListener onprogress;
// attribute [DontEnum] EventListener onratechange;
- // attribute [DontEnum] EventListener onreadystatechange;
// attribute [DontEnum] EventListener onseeked;
// attribute [DontEnum] EventListener onseeking;
// attribute [DontEnum] EventListener onshow;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list