From 69901724cf327f3750fe5a84afd167bc3f5a1188 Mon Sep 17 00:00:00 2001 From: "jianli@chromium.org" Date: Tue, 21 Jul 2009 22:44:41 +0000 Subject: [PATCH] 2009-07-21 Jian Li Reviewed by David Levin. Add onerror to WorkerContext. https://bugs.webkit.org/show_bug.cgi?id=27516 * bindings/js/JSWorkerContextCustom.cpp: (WebCore::JSWorkerContext::mark): * workers/WorkerContext.h: (WebCore::WorkerContext::setOnerror): (WebCore::WorkerContext::onerror): * workers/WorkerContext.idl: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@46197 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebCore/ChangeLog | 14 ++++++++++++++ WebCore/bindings/js/JSWorkerContextCustom.cpp | 1 + WebCore/workers/WorkerContext.h | 3 +++ WebCore/workers/WorkerContext.idl | 6 +++--- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 12691a7..6076735 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,17 @@ +2009-07-21 Jian Li + + Reviewed by David Levin. + + Add onerror to WorkerContext. + https://bugs.webkit.org/show_bug.cgi?id=27516 + + * bindings/js/JSWorkerContextCustom.cpp: + (WebCore::JSWorkerContext::mark): + * workers/WorkerContext.h: + (WebCore::WorkerContext::setOnerror): + (WebCore::WorkerContext::onerror): + * workers/WorkerContext.idl: + 2009-07-21 Yong Li Reviewed by George Staikos. diff --git a/WebCore/bindings/js/JSWorkerContextCustom.cpp b/WebCore/bindings/js/JSWorkerContextCustom.cpp index 06475f9..440bb7a 100644 --- a/WebCore/bindings/js/JSWorkerContextCustom.cpp +++ b/WebCore/bindings/js/JSWorkerContextCustom.cpp @@ -58,6 +58,7 @@ void JSWorkerContext::mark() markDOMObjectWrapper(globalData, impl()->optionalLocation()); markDOMObjectWrapper(globalData, impl()->optionalNavigator()); + markIfNotNull(impl()->onerror()); markIfNotNull(impl()->onmessage()); typedef WorkerContext::EventListenersMap EventListenersMap; diff --git a/WebCore/workers/WorkerContext.h b/WebCore/workers/WorkerContext.h index 16f43fd..2ee016e 100644 --- a/WebCore/workers/WorkerContext.h +++ b/WebCore/workers/WorkerContext.h @@ -84,6 +84,8 @@ namespace WebCore { WorkerContext* self() { return this; } WorkerLocation* location() const; void close(); + void setOnerror(PassRefPtr eventListener) { m_onErrorListener = eventListener; } + EventListener* onerror() const { return m_onErrorListener.get(); } // WorkerUtils void importScripts(const Vector& urls, const String& callerURL, int callerLine, ExceptionCode&); @@ -140,6 +142,7 @@ namespace WebCore { OwnPtr m_script; WorkerThread* m_thread; + RefPtr m_onErrorListener; RefPtr m_onmessageListener; EventListenersMap m_eventListeners; diff --git a/WebCore/workers/WorkerContext.idl b/WebCore/workers/WorkerContext.idl index 709410a..ab4a766 100644 --- a/WebCore/workers/WorkerContext.idl +++ b/WebCore/workers/WorkerContext.idl @@ -37,11 +37,11 @@ module threads { // WorkerGlobalScope #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - attribute [Replaceable] WorkerContext self; + attribute [Replaceable] WorkerContext self; #endif - attribute [Replaceable] WorkerLocation location; + attribute [Replaceable] WorkerLocation location; void close(); - // attribute EventListener onerror; + attribute EventListener onerror; // WorkerUtils [Custom] void importScripts(/*[Variadic] in DOMString urls */); -- 1.8.3.1