Implement AbstractWorker::dispatchScriptErrorEvent by generating an ErrorEvent.
Created attachment 33211 [details] Proposed Patch
This is to adhere to the latest Web Worker spec (http://www.whatwg.org/specs/web-workers/current-work/#runtime-script-errors): When the user agent is to fire a worker error event at a Worker object, it must dispatch an event that uses the ErrorEvent interface, with the name error, that doesn't bubble and is cancelable, with its message, filename, and lineno attributes set appropriately. I will have other patch that will fix the error handling flow in WorkerContext and Worker.
> I will have other patch that will fix the error handling flow in WorkerContext and Worker. Please file a bug for this.
Comment on attachment 33211 [details] Proposed Patch Please do a variable name change below before landing. > +void AbstractWorker::dispatchScriptErrorEvent(const String& message, const String& sourceURL, int lineNumber) > { > + RefPtr<ErrorEvent> evt = ErrorEvent::create(message, sourceURL, static_cast<unsigned>(lineNumber)); Use full words, except in the rare case where an abbreviation would be more canonical and easier to understand. s/evt/event/ > + if (m_onErrorListener) { > + evt->setTarget(this); > + evt->setCurrentTarget(this); > + m_onErrorListener->handleEvent(evt.get(), true); > + } > + > + ExceptionCode ec = 0; > + dispatchEvent(evt.release(), ec); > + ASSERT(!ec); > } > > } // namespace WebCore
Committed as http://trac.webkit.org/changeset/46203
This should really have a test case. Is there a reason this cannot be tested?
(In reply to comment #6) > This should really have a test case. Is there a reason this cannot be tested? This is the first patch towards fixing error handling in workers. It can not be tested before completing the changes for 27525. I will add test cases in dealing with 27525.