Commit 7e79edd1 authored by sigbjornf@opera.com's avatar sigbjornf@opera.com

Make SpeechSynthesis gracefully handle ExecutionContext-less operation.

The SpeechSynthesis may lose its observed execution context and still
be accessed by the platform. Check if present before accessing the
context.

R=haraken@chromium.org
BUG=345061

Review URL: https://codereview.chromium.org/330603002

git-svn-id: svn://svn.chromium.org/blink/trunk@176018 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 6c3af3ae
......@@ -60,7 +60,7 @@ ExecutionContext* SpeechSynthesis::executionContext() const
void SpeechSynthesis::voicesDidChange()
{
m_voiceList.clear();
if (!executionContext()->activeDOMObjectsAreStopped())
if (executionContext() && !executionContext()->activeDOMObjectsAreStopped())
dispatchEvent(Event::create(EventTypeNames::voiceschanged));
}
......@@ -145,7 +145,7 @@ void SpeechSynthesis::resume()
void SpeechSynthesis::fireEvent(const AtomicString& type, SpeechSynthesisUtterance* utterance, unsigned long charIndex, const String& name)
{
if (!executionContext()->activeDOMObjectsAreStopped())
if (executionContext() && !executionContext()->activeDOMObjectsAreStopped())
utterance->dispatchEvent(SpeechSynthesisEvent::create(type, charIndex, (currentTime() - utterance->startTime()), name));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment