RESOLVED FIXED 27515
Implement AbstractWorker::dispatchScriptErrorEvent by generating an ErrorEvent.
https://bugs.webkit.org/show_bug.cgi?id=27515
Summary Implement AbstractWorker::dispatchScriptErrorEvent by generating an ErrorEvent.
Jian Li
Reported 2009-07-21 13:49:53 PDT
Implement AbstractWorker::dispatchScriptErrorEvent by generating an ErrorEvent.
Attachments
Proposed Patch (1.63 KB, patch)
2009-07-21 14:00 PDT, Jian Li
levin: review+
Jian Li
Comment 1 2009-07-21 14:00:04 PDT
Created attachment 33211 [details] Proposed Patch
Jian Li
Comment 2 2009-07-21 14:48:13 PDT
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.
David Levin
Comment 3 2009-07-21 16:42:24 PDT
> I will have other patch that will fix the error handling flow in WorkerContext and Worker. Please file a bug for this.
David Levin
Comment 4 2009-07-21 17:25:04 PDT
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
Jian Li
Comment 5 2009-07-21 17:44:19 PDT
Sam Weinig
Comment 6 2009-07-21 18:59:18 PDT
This should really have a test case. Is there a reason this cannot be tested?
Jian Li
Comment 7 2009-07-21 20:22:32 PDT
(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.
Note You need to log in before you can comment on or make changes to this bug.