Diff
Modified: trunk/LayoutTests/ChangeLog (120052 => 120053)
--- trunk/LayoutTests/ChangeLog 2012-06-12 10:13:08 UTC (rev 120052)
+++ trunk/LayoutTests/ChangeLog 2012-06-12 10:38:39 UTC (rev 120053)
@@ -1,3 +1,15 @@
+2012-06-11 Hans Wennborg <h...@chromium.org>
+
+ Speech _javascript_ API: Make SpeechRecognitionError an Event
+ https://bugs.webkit.org/show_bug.cgi?id=88784
+
+ Reviewed by Adam Barth.
+
+ Add a layout test that fires a SpeechRecognitionError.
+
+ * fast/speech/scripted/speechrecognition-errors-expected.txt: Added.
+ * fast/speech/scripted/speechrecognition-errors.html: Added.
+
2012-06-12 Mario Sanchez Prada <msanc...@igalia.com>
Unreviewed gardening. Skip test failing on GTK bots after r119947.
Added: trunk/LayoutTests/fast/speech/scripted/speechrecognition-errors-expected.txt (0 => 120053)
--- trunk/LayoutTests/fast/speech/scripted/speechrecognition-errors-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/speech/scripted/speechrecognition-errors-expected.txt 2012-06-12 10:38:39 UTC (rev 120053)
@@ -0,0 +1,20 @@
+Test Speech _javascript_ API errors
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS 'webkitSpeechRecognition' in self is true
+PASS webkitSpeechRecognition == null is false
+
+notAllowedTest():
+onerror
+PASS count is 0
+PASS event.code is webkitSpeechRecognitionError.NOT_ALLOWED
+PASS event.message is "not allowed"
+PASS event.type is "error"
+onend
+PASS count is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/speech/scripted/speechrecognition-errors-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/fast/speech/scripted/speechrecognition-errors.html (0 => 120053)
--- trunk/LayoutTests/fast/speech/scripted/speechrecognition-errors.html (rev 0)
+++ trunk/LayoutTests/fast/speech/scripted/speechrecognition-errors.html 2012-06-12 10:38:39 UTC (rev 120053)
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script type="text/_javascript_">
+description('Test Speech _javascript_ API errors');
+
+function run() {
+ // Check availability of constructors.
+ shouldBeTrue("'webkitSpeechRecognition' in self");
+ shouldBeFalse("webkitSpeechRecognition == null");
+
+ notAllowedTest();
+}
+
+function setDefaultHandlers(r) {
+ for (var prop in r) {
+ if (prop.match('^on')) {
+ r[prop] = function() {
+ testFailed('unexpected ' + event.type + ' event!');
+ finishJSTest();
+ }
+ }
+ }
+}
+
+function notAllowedTest() {
+ debug('\nnotAllowedTest():');
+ var r = new webkitSpeechRecognition();
+ setDefaultHandlers(r);
+ window.count = 0;
+
+ r.start();
+ layoutTestController.setMockSpeechRecognitionError(webkitSpeechRecognitionError.NOT_ALLOWED, "not allowed");
+
+ // Check that we get an error event.
+ r._onerror_ = function() {
+ debug('onerror');
+ shouldBe('count', '0');
+ count++;
+ shouldBe('event.code', 'webkitSpeechRecognitionError.NOT_ALLOWED');
+ shouldBeEqualToString('event.message', 'not allowed');
+ shouldBeEqualToString('event.type', 'error');
+ }
+
+ // Check that we get an end event after the error event.
+ r._onend_ = function() {
+ debug('onend');
+ shouldBe('count', '1');
+ finishJSTest();
+ }
+}
+
+window._onload_ = run;
+window.jsTestIsAsync = true;
+</script>
+<script src=""
+</body>
+</html>
+
Property changes on: trunk/LayoutTests/fast/speech/scripted/speechrecognition-errors.html
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (120052 => 120053)
--- trunk/Source/WebCore/ChangeLog 2012-06-12 10:13:08 UTC (rev 120052)
+++ trunk/Source/WebCore/ChangeLog 2012-06-12 10:38:39 UTC (rev 120053)
@@ -1,3 +1,34 @@
+2012-06-11 Hans Wennborg <h...@chromium.org>
+
+ Speech _javascript_ API: Make SpeechRecognitionError an Event
+ https://bugs.webkit.org/show_bug.cgi?id=88784
+
+ Reviewed by Adam Barth.
+
+ Make SpeechRecognitionError an Event. The spec was updated to make it
+ an event in its own right, rather than an attribute of
+ SpeechRecognitionEvent.
+
+ Test: fast/speech/scripted/speechrecognition-errors.html
+
+ * Modules/speech/SpeechRecognition.cpp:
+ (WebCore::SpeechRecognition::didReceiveError):
+ * Modules/speech/SpeechRecognitionError.cpp:
+ (WebCore::SpeechRecognitionError::SpeechRecognitionError):
+ (WebCore::SpeechRecognitionError::interfaceName):
+ (WebCore):
+ * Modules/speech/SpeechRecognitionError.h:
+ (WebCore::SpeechRecognitionError::create):
+ (SpeechRecognitionError):
+ * Modules/speech/SpeechRecognitionError.idl:
+ * Modules/speech/SpeechRecognitionEvent.cpp:
+ (WebCore::SpeechRecognitionEvent::SpeechRecognitionEvent):
+ * Modules/speech/SpeechRecognitionEvent.h:
+ (SpeechRecognitionEventInit):
+ (SpeechRecognitionEvent):
+ * Modules/speech/SpeechRecognitionEvent.idl:
+ * dom/EventNames.in:
+
2012-06-12 MORITA Hajime <morr...@google.com>
REGRESSION(r118098): <content> element does not render distributed children when cloned from another document
Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognition.cpp (120052 => 120053)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognition.cpp 2012-06-12 10:13:08 UTC (rev 120052)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognition.cpp 2012-06-12 10:38:39 UTC (rev 120053)
@@ -110,7 +110,7 @@
void SpeechRecognition::didReceiveError(PassRefPtr<SpeechRecognitionError> error)
{
- dispatchEvent(SpeechRecognitionEvent::createError(error));
+ dispatchEvent(error);
}
void SpeechRecognition::didStart()
Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.cpp (120052 => 120053)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.cpp 2012-06-12 10:13:08 UTC (rev 120052)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.cpp 2012-06-12 10:38:39 UTC (rev 120053)
@@ -37,11 +37,17 @@
}
SpeechRecognitionError::SpeechRecognitionError(Code code, const String& message)
- : m_code(code)
+ : Event(eventNames().errorEvent, /*canBubble=*/false, /*cancelable=*/false) // FIXME: Spec should say whether it bubbles and is cancelable.
+ , m_code(code)
, m_message(message)
{
}
+const AtomicString& SpeechRecognitionError::interfaceName() const
+{
+ return eventNames().interfaceForSpeechRecognitionError;
+}
+
} // namespace WebCore
#endif // ENABLE(SCRIPTED_SPEECH)
Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.h (120052 => 120053)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.h 2012-06-12 10:13:08 UTC (rev 120052)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.h 2012-06-12 10:38:39 UTC (rev 120053)
@@ -28,12 +28,13 @@
#if ENABLE(SCRIPTED_SPEECH)
+#include "Event.h"
#include "PlatformString.h"
#include <wtf/RefCounted.h>
namespace WebCore {
-class SpeechRecognitionError : public RefCounted<SpeechRecognitionError> {
+class SpeechRecognitionError : public Event {
public:
enum Code {
OTHER = 0,
@@ -48,10 +49,13 @@
};
static PassRefPtr<SpeechRecognitionError> create(Code, const String&);
+ static PassRefPtr<SpeechRecognitionError> create() { return create(OTHER, emptyString()); }
Code code() { return m_code; }
const String& message() { return m_message; }
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+
private:
SpeechRecognitionError(Code, const String&);
Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.idl (120052 => 120053)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.idl 2012-06-12 10:13:08 UTC (rev 120052)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.idl 2012-06-12 10:38:39 UTC (rev 120053)
@@ -26,7 +26,7 @@
module core {
interface [
Conditional=SCRIPTED_SPEECH
- ] SpeechRecognitionError {
+ ] SpeechRecognitionError : Event {
const unsigned short OTHER = 0;
const unsigned short NO_SPEECH = 1;
const unsigned short ABORTED = 2;
Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp (120052 => 120053)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp 2012-06-12 10:13:08 UTC (rev 120052)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp 2012-06-12 10:38:39 UTC (rev 120053)
@@ -61,11 +61,6 @@
return adoptRef(new SpeechRecognitionEvent(eventNames().resultdeletedEvent, 0, resultIndex, resultHistory));
}
-PassRefPtr<SpeechRecognitionEvent> SpeechRecognitionEvent::createError(PassRefPtr<SpeechRecognitionError> error)
-{
- return adoptRef(new SpeechRecognitionEvent(error));
-}
-
const AtomicString& SpeechRecognitionEvent::interfaceName() const
{
return eventNames().interfaceForSpeechRecognitionEvent;
@@ -79,7 +74,6 @@
SpeechRecognitionEvent::SpeechRecognitionEvent(const AtomicString& eventName, const SpeechRecognitionEventInit& initializer)
: Event(eventName, initializer)
, m_result(initializer.result)
- , m_error(initializer.error)
, m_resultIndex(initializer.resultIndex)
, m_resultHistory(initializer.resultHistory)
{
@@ -88,19 +82,11 @@
SpeechRecognitionEvent::SpeechRecognitionEvent(const AtomicString& eventName, PassRefPtr<SpeechRecognitionResult> result, short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory)
: Event(eventName, /*canBubble=*/false, /*cancelable=*/false)
, m_result(result)
- , m_error(0)
, m_resultIndex(resultIndex)
, m_resultHistory(resultHistory)
{
}
-SpeechRecognitionEvent::SpeechRecognitionEvent(PassRefPtr<SpeechRecognitionError> error)
- : Event(eventNames().errorEvent, /*canBubble=*/false, /*cancelable=*/false) // FIXME: The spec should say whether these bubble or not.
- , m_error(error)
- , m_resultIndex(0)
-{
-}
-
} // namespace WebCore
#endif // ENABLE(SCRIPTED_SPEECH)
Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h (120052 => 120053)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h 2012-06-12 10:13:08 UTC (rev 120052)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.h 2012-06-12 10:38:39 UTC (rev 120053)
@@ -44,7 +44,6 @@
SpeechRecognitionEventInit();
RefPtr<SpeechRecognitionResult> result;
- RefPtr<SpeechRecognitionError> error;
short resultIndex;
RefPtr<SpeechRecognitionResultList> resultHistory;
};
@@ -57,10 +56,8 @@
static PassRefPtr<SpeechRecognitionEvent> createResult(PassRefPtr<SpeechRecognitionResult>, short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory);
static PassRefPtr<SpeechRecognitionEvent> createNoMatch(PassRefPtr<SpeechRecognitionResult>);
static PassRefPtr<SpeechRecognitionEvent> createResultDeleted(short resultIndex, PassRefPtr<SpeechRecognitionResultList> resultHistory);
- static PassRefPtr<SpeechRecognitionEvent> createError(PassRefPtr<SpeechRecognitionError>);
SpeechRecognitionResult* result() const { return m_result.get(); }
- SpeechRecognitionError* error() const { return m_error.get(); }
short resultIndex() const { return m_resultIndex; } // FIXME: Spec says this should be short, but other indices are unsigned ints.
SpeechRecognitionResultList* resultHistory() const { return m_resultHistory.get(); }
@@ -74,7 +71,6 @@
SpeechRecognitionEvent(PassRefPtr<SpeechRecognitionError>);
RefPtr<SpeechRecognitionResult> m_result;
- RefPtr<SpeechRecognitionError> m_error;
short m_resultIndex;
RefPtr<SpeechRecognitionResultList> m_resultHistory;
};
Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl (120052 => 120053)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl 2012-06-12 10:13:08 UTC (rev 120052)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl 2012-06-12 10:38:39 UTC (rev 120053)
@@ -29,7 +29,6 @@
ConstructorTemplate=Event
] SpeechRecognitionEvent : Event {
readonly attribute [InitializedByEventConstructor] SpeechRecognitionResult result;
- readonly attribute [InitializedByEventConstructor] SpeechRecognitionError error;
readonly attribute [InitializedByEventConstructor] short resultIndex;
readonly attribute [InitializedByEventConstructor] SpeechRecognitionResultList resultHistory;
};
Modified: trunk/Source/WebCore/dom/EventNames.in (120052 => 120053)
--- trunk/Source/WebCore/dom/EventNames.in 2012-06-12 10:13:08 UTC (rev 120052)
+++ trunk/Source/WebCore/dom/EventNames.in 2012-06-12 10:38:39 UTC (rev 120053)
@@ -31,6 +31,7 @@
OfflineAudioCompletionEvent conditional=WEB_AUDIO
MediaStreamEvent conditional=MEDIA_STREAM
SpeechInputEvent conditional=INPUT_SPEECH
+SpeechRecognitionError conditional=SCRIPTED_SPEECH
SpeechRecognitionEvent conditional=SCRIPTED_SPEECH
WebGLContextEvent conditional=WEBGL
StorageEvent
Modified: trunk/Tools/ChangeLog (120052 => 120053)
--- trunk/Tools/ChangeLog 2012-06-12 10:13:08 UTC (rev 120052)
+++ trunk/Tools/ChangeLog 2012-06-12 10:38:39 UTC (rev 120053)
@@ -1,3 +1,26 @@
+2012-06-11 Hans Wennborg <h...@chromium.org>
+
+ Speech _javascript_ API: Make SpeechRecognitionError an Event
+ https://bugs.webkit.org/show_bug.cgi?id=88784
+
+ Reviewed by Adam Barth.
+
+ Make it possible to have MockWebSpeechRecognizer fire error events.
+
+ * DumpRenderTree/chromium/LayoutTestController.cpp:
+ (LayoutTestController::LayoutTestController):
+ (LayoutTestController::setMockSpeechRecognitionError):
+ * DumpRenderTree/chromium/LayoutTestController.h:
+ (LayoutTestController):
+ * DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp:
+ (WebKit):
+ (ErrorTask):
+ (WebKit::ErrorTask::ErrorTask):
+ (MockWebSpeechRecognizer::addMockResult):
+ (MockWebSpeechRecognizer::setError):
+ * DumpRenderTree/chromium/MockWebSpeechRecognizer.h:
+ (MockWebSpeechRecognizer):
+
2012-06-11 Ojan Vafai <o...@chromium.org>
Don't show the ASAN builders in garden-o-matic since they don't get block WebKit rolls.
Modified: trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp (120052 => 120053)
--- trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp 2012-06-12 10:13:08 UTC (rev 120052)
+++ trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp 2012-06-12 10:38:39 UTC (rev 120053)
@@ -118,6 +118,7 @@
#endif
#if ENABLE(SCRIPTED_SPEECH)
bindMethod("addMockSpeechRecognitionResult", &LayoutTestController::addMockSpeechRecognitionResult);
+ bindMethod("setMockSpeechRecognitionError", &LayoutTestController::setMockSpeechRecognitionError);
#endif
bindMethod("addOriginAccessWhitelistEntry", &LayoutTestController::addOriginAccessWhitelistEntry);
bindMethod("addUserScript", &LayoutTestController::addUserScript);
@@ -1972,6 +1973,16 @@
if (MockWebSpeechRecognizer* recognizer = m_shell->webViewHost()->mockSpeechRecognizer())
recognizer->addMockResult(cppVariantToWebString(arguments[0]), arguments[1].toDouble());
}
+
+void LayoutTestController::setMockSpeechRecognitionError(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isString())
+ return;
+
+ if (MockWebSpeechRecognizer* recognizer = m_shell->webViewHost()->mockSpeechRecognizer())
+ recognizer->setError(arguments[0].toInt32(), cppVariantToWebString(arguments[1]));
+}
#endif
void LayoutTestController::startSpeechInput(const CppArgumentList& arguments, CppVariant* result)
Modified: trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h (120052 => 120053)
--- trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h 2012-06-12 10:13:08 UTC (rev 120052)
+++ trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h 2012-06-12 10:38:39 UTC (rev 120053)
@@ -377,6 +377,7 @@
#endif
#if ENABLE(SCRIPTED_SPEECH)
void addMockSpeechRecognitionResult(const CppArgumentList&, CppVariant*);
+ void setMockSpeechRecognitionError(const CppArgumentList&, CppVariant*);
#endif
void startSpeechInput(const CppArgumentList&, CppVariant*);
Modified: trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp (120052 => 120053)
--- trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp 2012-06-12 10:13:08 UTC (rev 120052)
+++ trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp 2012-06-12 10:38:39 UTC (rev 120053)
@@ -85,6 +85,23 @@
virtual void runIfValid() OVERRIDE { m_object->client()->didReceiveNoMatch(m_object->handle(), WebSpeechRecognitionResult()); }
};
+// Task for delivering an error event.
+class ErrorTask : public MethodTask<MockWebSpeechRecognizer> {
+public:
+ ErrorTask(MockWebSpeechRecognizer* mock, int code, const WebString& message)
+ : MethodTask<MockWebSpeechRecognizer>(mock)
+ , m_code(code)
+ , m_message(message)
+ {
+ }
+
+ virtual void runIfValid() OVERRIDE { m_object->client()->didReceiveError(m_object->handle(), m_message, static_cast<WebSpeechRecognizerClient::ErrorCode>(m_code)); }
+
+private:
+ int m_code;
+ WebString m_message;
+};
+
} // namespace
PassOwnPtr<MockWebSpeechRecognizer> MockWebSpeechRecognizer::create()
@@ -137,6 +154,19 @@
ASSERT_NOT_REACHED();
}
+void MockWebSpeechRecognizer::addMockResult(const WebString& transcript, float confidence)
+{
+ m_mockTranscripts.append(transcript);
+ m_mockConfidences.append(confidence);
+}
+
+void MockWebSpeechRecognizer::setError(int code, const WebString& message)
+{
+ m_taskList.revokeAll();
+ postTask(new ErrorTask(this, code, message));
+ postTask(new ClientCallTask(this, &WebSpeechRecognizerClient::didEnd));
+}
+
MockWebSpeechRecognizer::MockWebSpeechRecognizer()
{
}
Modified: trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h (120052 => 120053)
--- trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h 2012-06-12 10:13:08 UTC (rev 120052)
+++ trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h 2012-06-12 10:38:39 UTC (rev 120053)
@@ -51,11 +51,8 @@
virtual void abort(const WebKit::WebSpeechRecognitionHandle&, WebKit::WebSpeechRecognizerClient*) OVERRIDE;
// Methods accessed by layout tests:
- void addMockResult(const WebKit::WebString& transcript, float confidence)
- {
- m_mockTranscripts.append(transcript);
- m_mockConfidences.append(confidence);
- }
+ void addMockResult(const WebKit::WebString& transcript, float confidence);
+ void setError(int code, const WebKit::WebString& message);
TaskList* taskList() { return &m_taskList; }
WebKit::WebSpeechRecognizerClient* client() { return m_client; }