Skip to content
Permalink
Browse files
2009-04-05 Geoffrey Garen <ggaren@apple.com>
        [Originally] Reviewed by Sam Weinig.

        Rolled back in r42214 with crashes fixed.

        [Removed irrelevant ExecState* parameter from event handler registration code.]

        [No change in behavior.]

        * bindings/js/JSDOMApplicationCacheCustom.cpp:
        (WebCore::JSDOMApplicationCache::addEventListener):
        (WebCore::JSDOMApplicationCache::removeEventListener):
        * bindings/js/JSDOMGlobalObject.cpp:
        (WebCore::JSDOMGlobalObject::findOrCreateJSProtectedEventListener):
        (WebCore::JSDOMGlobalObject::findJSEventListener):
        (WebCore::JSDOMGlobalObject::findOrCreateJSEventListener):
        * bindings/js/JSDOMGlobalObject.h:
        * bindings/js/JSDOMWindowCustom.cpp:
        (WebCore::JSDOMWindow::addEventListener):
        * bindings/js/JSMessagePortCustom.cpp:
        (WebCore::JSMessagePort::addEventListener):
        (WebCore::JSMessagePort::removeEventListener):
        * bindings/js/JSNodeCustom.cpp:
        (WebCore::JSNode::addEventListener):
        * bindings/js/JSSVGElementInstanceCustom.cpp:
        (WebCore::JSSVGElementInstance::addEventListener):
        * bindings/js/JSWorkerContextCustom.cpp:
        (WebCore::JSWorkerContext::addEventListener):
        (WebCore::JSWorkerContext::removeEventListener):
        * bindings/js/JSWorkerCustom.cpp:
        (WebCore::JSWorker::addEventListener):
        (WebCore::JSWorker::removeEventListener):
        * bindings/js/JSXMLHttpRequestCustom.cpp:
        (WebCore::JSXMLHttpRequest::addEventListener):
        (WebCore::JSXMLHttpRequest::removeEventListener):
        * bindings/js/JSXMLHttpRequestUploadCustom.cpp:
        (WebCore::JSXMLHttpRequestUpload::addEventListener):
        (WebCore::JSXMLHttpRequestUpload::removeEventListener):
        * bindings/scripts/CodeGeneratorJS.pm:



Canonical link: https://commits.webkit.org/34290@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@42235 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
geoffreygaren committed Apr 5, 2009
1 parent dd0002c commit 4c544bc831e33b11a3ea9e9ed0805a19a1360213
Showing 13 changed files with 65 additions and 23 deletions.
@@ -1,3 +1,44 @@
2009-04-05 Geoffrey Garen <ggaren@apple.com>

[Originally] Reviewed by Sam Weinig.

Rolled back in r42214 with crashes fixed.

[Removed irrelevant ExecState* parameter from event handler registration code.]

[No change in behavior.]

* bindings/js/JSDOMApplicationCacheCustom.cpp:
(WebCore::JSDOMApplicationCache::addEventListener):
(WebCore::JSDOMApplicationCache::removeEventListener):
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::findOrCreateJSProtectedEventListener):
(WebCore::JSDOMGlobalObject::findJSEventListener):
(WebCore::JSDOMGlobalObject::findOrCreateJSEventListener):
* bindings/js/JSDOMGlobalObject.h:
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::addEventListener):
* bindings/js/JSMessagePortCustom.cpp:
(WebCore::JSMessagePort::addEventListener):
(WebCore::JSMessagePort::removeEventListener):
* bindings/js/JSNodeCustom.cpp:
(WebCore::JSNode::addEventListener):
* bindings/js/JSSVGElementInstanceCustom.cpp:
(WebCore::JSSVGElementInstance::addEventListener):
* bindings/js/JSWorkerContextCustom.cpp:
(WebCore::JSWorkerContext::addEventListener):
(WebCore::JSWorkerContext::removeEventListener):
* bindings/js/JSWorkerCustom.cpp:
(WebCore::JSWorker::addEventListener):
(WebCore::JSWorker::removeEventListener):
* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::JSXMLHttpRequest::addEventListener):
(WebCore::JSXMLHttpRequest::removeEventListener):
* bindings/js/JSXMLHttpRequestUploadCustom.cpp:
(WebCore::JSXMLHttpRequestUpload::addEventListener):
(WebCore::JSXMLHttpRequestUpload::removeEventListener):
* bindings/scripts/CodeGeneratorJS.pm:

2009-04-05 Erik L. Bunce <elbunce@xendom.com>

Reviewed by Simon Hausmann.
@@ -112,7 +112,7 @@ JSValuePtr JSDOMApplicationCache::addEventListener(ExecState* exec, const ArgLis
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
if (!globalObject)
return jsUndefined();
RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(exec, args.at(exec, 1));
RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(args.at(exec, 1));
if (!listener)
return jsUndefined();
impl()->addEventListener(args.at(exec, 0).toString(exec), listener.release(), args.at(exec, 2).toBoolean(exec));
@@ -124,7 +124,7 @@ JSValuePtr JSDOMApplicationCache::removeEventListener(ExecState* exec, const Arg
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
if (!globalObject)
return jsUndefined();
JSEventListener* listener = globalObject->findJSEventListener(exec, args.at(exec, 1));
JSEventListener* listener = globalObject->findJSEventListener(args.at(exec, 1));
if (!listener)
return jsUndefined();
impl()->removeEventListener(args.at(exec, 0).toString(exec), listener, args.at(exec, 2).toBoolean(exec));
@@ -95,7 +95,7 @@ JSProtectedEventListener* JSDOMGlobalObject::findJSProtectedEventListener(JSValu
return listeners.get(object);
}

PassRefPtr<JSProtectedEventListener> JSDOMGlobalObject::findOrCreateJSProtectedEventListener(ExecState*, JSValuePtr val, bool isInline)
PassRefPtr<JSProtectedEventListener> JSDOMGlobalObject::findOrCreateJSProtectedEventListener(JSValuePtr val, bool isInline)
{
if (JSProtectedEventListener* listener = findJSProtectedEventListener(val, isInline))
return listener;
@@ -107,7 +107,7 @@ PassRefPtr<JSProtectedEventListener> JSDOMGlobalObject::findOrCreateJSProtectedE
return JSProtectedEventListener::create(asObject(val), this, isInline).get();
}

JSEventListener* JSDOMGlobalObject::findJSEventListener(ExecState*, JSValuePtr val, bool isInline)
JSEventListener* JSDOMGlobalObject::findJSEventListener(JSValuePtr val, bool isInline)
{
if (!val.isObject())
return 0;
@@ -116,9 +116,9 @@ JSEventListener* JSDOMGlobalObject::findJSEventListener(ExecState*, JSValuePtr v
return listeners.get(asObject(val));
}

PassRefPtr<JSEventListener> JSDOMGlobalObject::findOrCreateJSEventListener(ExecState* exec, JSValuePtr val, bool isInline)
PassRefPtr<JSEventListener> JSDOMGlobalObject::findOrCreateJSEventListener(JSValuePtr val, bool isInline)
{
if (JSEventListener* listener = findJSEventListener(exec, val, isInline))
if (JSEventListener* listener = findJSEventListener(val, isInline))
return listener;

if (!val.isObject())
@@ -57,13 +57,13 @@ namespace WebCore {
JSProtectedEventListener* findJSProtectedEventListener(JSC::JSValuePtr, bool isInline = false);

// Finds or creates a wrapper of a JS EventListener. JS EventListener object is GC-protected.
PassRefPtr<JSProtectedEventListener> findOrCreateJSProtectedEventListener(JSC::ExecState*, JSC::JSValuePtr, bool isInline = false);
PassRefPtr<JSProtectedEventListener> findOrCreateJSProtectedEventListener(JSC::JSValuePtr, bool isInline = false);

// Finds a wrapper of a GC-unprotected JS EventListener, returns 0 if no existing one.
JSEventListener* findJSEventListener(JSC::ExecState*, JSC::JSValuePtr, bool isInline = false);
JSEventListener* findJSEventListener(JSC::JSValuePtr, bool isInline = false);

// Finds or creates a wrapper of a JS EventListener. JS EventListener object is *NOT* GC-protected.
PassRefPtr<JSEventListener> findOrCreateJSEventListener(JSC::ExecState*, JSC::JSValuePtr, bool isInline = false);
PassRefPtr<JSEventListener> findOrCreateJSEventListener(JSC::JSValuePtr, bool isInline = false);

typedef HashMap<JSC::JSObject*, JSProtectedEventListener*> ProtectedListenersMap;
typedef HashMap<JSC::JSObject*, JSEventListener*> JSListenersMap;
@@ -299,7 +299,7 @@ JSValuePtr JSDOMWindow::addEventListener(ExecState* exec, const ArgList& args)
if (!frame)
return jsUndefined();

if (RefPtr<JSProtectedEventListener> listener = findOrCreateJSProtectedEventListener(exec, args.at(exec, 1)))
if (RefPtr<JSProtectedEventListener> listener = findOrCreateJSProtectedEventListener(args.at(exec, 1)))
frame->document()->addWindowEventListener(AtomicString(args.at(exec, 0).toString(exec)), listener.release(), args.at(exec, 2).toBoolean(exec));

return jsUndefined();
@@ -73,7 +73,7 @@ JSValuePtr JSMessagePort::addEventListener(ExecState* exec, const ArgList& args)
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
if (!globalObject)
return jsUndefined();
RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(exec, args.at(exec, 1));
RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(args.at(exec, 1));
if (!listener)
return jsUndefined();
impl()->addEventListener(args.at(exec, 0).toString(exec), listener.release(), args.at(exec, 2).toBoolean(exec));
@@ -85,7 +85,7 @@ JSValuePtr JSMessagePort::removeEventListener(ExecState* exec, const ArgList& ar
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
if (!globalObject)
return jsUndefined();
JSEventListener* listener = globalObject->findJSEventListener(exec, args.at(exec, 1));
JSEventListener* listener = globalObject->findJSEventListener(args.at(exec, 1));
if (!listener)
return jsUndefined();
impl()->removeEventListener(args.at(exec, 0).toString(exec), listener, args.at(exec, 2).toBoolean(exec));
@@ -113,7 +113,7 @@ JSValuePtr JSNode::addEventListener(ExecState* exec, const ArgList& args)
if (!globalObject)
return jsUndefined();

if (RefPtr<JSProtectedEventListener> listener = globalObject->findOrCreateJSProtectedEventListener(exec, args.at(exec, 1)))
if (RefPtr<JSProtectedEventListener> listener = globalObject->findOrCreateJSProtectedEventListener(args.at(exec, 1)))
impl()->addEventListener(args.at(exec, 0).toString(exec), listener.release(), args.at(exec, 2).toBoolean(exec));

return jsUndefined();
@@ -42,7 +42,7 @@ JSValuePtr JSSVGElementInstance::addEventListener(ExecState* exec, const ArgList
if (!globalObject)
return jsUndefined();

if (RefPtr<JSProtectedEventListener> listener = globalObject->findOrCreateJSProtectedEventListener(exec, args.at(exec, 1)))
if (RefPtr<JSProtectedEventListener> listener = globalObject->findOrCreateJSProtectedEventListener(args.at(exec, 1)))
impl()->addEventListener(args.at(exec, 0).toString(exec), listener.release(), args.at(exec, 2).toBoolean(exec));

return jsUndefined();
@@ -99,7 +99,7 @@ JSValuePtr JSWorkerContext::importScripts(ExecState* exec, const ArgList& args)

JSValuePtr JSWorkerContext::addEventListener(ExecState* exec, const ArgList& args)
{
RefPtr<JSEventListener> listener = findOrCreateJSEventListener(exec, args.at(exec, 1));
RefPtr<JSEventListener> listener = findOrCreateJSEventListener(args.at(exec, 1));
if (!listener)
return jsUndefined();
impl()->addEventListener(args.at(exec, 0).toString(exec), listener.release(), args.at(exec, 2).toBoolean(exec));
@@ -108,7 +108,7 @@ JSValuePtr JSWorkerContext::addEventListener(ExecState* exec, const ArgList& arg

JSValuePtr JSWorkerContext::removeEventListener(ExecState* exec, const ArgList& args)
{
JSEventListener* listener = findJSEventListener(exec, args.at(exec, 1));
JSEventListener* listener = findJSEventListener(args.at(exec, 1));
if (!listener)
return jsUndefined();
impl()->removeEventListener(args.at(exec, 0).toString(exec), listener, args.at(exec, 2).toBoolean(exec));
@@ -58,7 +58,7 @@ JSValuePtr JSWorker::addEventListener(ExecState* exec, const ArgList& args)
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
if (!globalObject)
return jsUndefined();
RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(exec, args.at(exec, 1));
RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(args.at(exec, 1));
if (!listener)
return jsUndefined();
impl()->addEventListener(args.at(exec, 0).toString(exec), listener.release(), args.at(exec, 2).toBoolean(exec));
@@ -70,7 +70,7 @@ JSValuePtr JSWorker::removeEventListener(ExecState* exec, const ArgList& args)
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
if (!globalObject)
return jsUndefined();
JSEventListener* listener = globalObject->findJSEventListener(exec, args.at(exec, 1));
JSEventListener* listener = globalObject->findJSEventListener(args.at(exec, 1));
if (!listener)
return jsUndefined();
impl()->removeEventListener(args.at(exec, 0).toString(exec), listener, args.at(exec, 2).toBoolean(exec));
@@ -168,7 +168,7 @@ JSValuePtr JSXMLHttpRequest::addEventListener(ExecState* exec, const ArgList& ar
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
if (!globalObject)
return jsUndefined();
RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(exec, args.at(exec, 1));
RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(args.at(exec, 1));
if (!listener)
return jsUndefined();
impl()->addEventListener(args.at(exec, 0).toString(exec), listener.release(), args.at(exec, 2).toBoolean(exec));
@@ -180,7 +180,7 @@ JSValuePtr JSXMLHttpRequest::removeEventListener(ExecState* exec, const ArgList&
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
if (!globalObject)
return jsUndefined();
JSEventListener* listener = globalObject->findJSEventListener(exec, args.at(exec, 1));
JSEventListener* listener = globalObject->findJSEventListener(args.at(exec, 1));
if (!listener)
return jsUndefined();
impl()->removeEventListener(args.at(exec, 0).toString(exec), listener, args.at(exec, 2).toBoolean(exec));
@@ -71,7 +71,7 @@ JSValuePtr JSXMLHttpRequestUpload::addEventListener(ExecState* exec, const ArgLi
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
if (!globalObject)
return jsUndefined();
RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(exec, args.at(exec, 1));
RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(args.at(exec, 1));
if (!listener)
return jsUndefined();
impl()->addEventListener(args.at(exec, 0).toString(exec), listener.release(), args.at(exec, 2).toBoolean(exec));
@@ -83,7 +83,7 @@ JSValuePtr JSXMLHttpRequestUpload::removeEventListener(ExecState* exec, const Ar
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
if (!globalObject)
return jsUndefined();
JSEventListener* listener = globalObject->findJSEventListener(exec, args.at(exec, 1));
JSEventListener* listener = globalObject->findJSEventListener(args.at(exec, 1));
if (!listener)
return jsUndefined();
impl()->removeEventListener(args.at(exec, 0).toString(exec), listener, args.at(exec, 2).toBoolean(exec));
@@ -1239,6 +1239,7 @@ sub GenerateImplementation
push(@implContent, " static_cast<$className*>(thisObject)->set$implSetterFunctionName(exec, value);\n");
} elsif ($type eq "EventListener") {
$implIncludes{"JSEventListener.h"} = 1;
push(@implContent, " UNUSED_PARAM(exec);\n");
push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(thisObject)->impl());\n");
my $listenerType;
if ($attribute->signature->extendedAttributes->{"ProtectedListener"}) {
@@ -1255,7 +1256,7 @@ sub GenerateImplementation
push(@implContent, " if (!globalObject)\n");
push(@implContent, " return;\n");
}
push(@implContent, " imp->set$implSetterFunctionName(globalObject->findOrCreate${listenerType}(exec, value, true));\n");
push(@implContent, " imp->set$implSetterFunctionName(globalObject->findOrCreate${listenerType}(value, true));\n");
} elsif ($attribute->signature->type =~ /Constructor$/) {
my $constructorType = $attribute->signature->type;
$constructorType =~ s/Constructor$//;

0 comments on commit 4c544bc

Please sign in to comment.