summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/bindings
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/bindings')
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/DOMObjectWithSVGContext.h2
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h12
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.cpp14
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.h10
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.h2
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp12
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.cpp26
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.h13
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSEventSourceCustom.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAllCollection.h2
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSInspectedObjectWrapper.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSInspectedObjectWrapper.h2
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSInspectorCallbackWrapper.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSInspectorCallbackWrapper.h2
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.cpp49
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.h11
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSMessagePortCustom.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSNodeCustom.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.h2
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextBase.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextBase.h2
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp57
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.h3
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorCOM.pm3
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm22
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm8
35 files changed, 177 insertions, 127 deletions
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/DOMObjectWithSVGContext.h b/src/3rdparty/webkit/WebCore/bindings/js/DOMObjectWithSVGContext.h
index 570548d..3d435cb 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/DOMObjectWithSVGContext.h
+++ b/src/3rdparty/webkit/WebCore/bindings/js/DOMObjectWithSVGContext.h
@@ -40,7 +40,7 @@ namespace WebCore {
SVGElement* context() const { return m_context.get(); }
protected:
- DOMObjectWithSVGContext(PassRefPtr<JSC::Structure> structure, JSDOMGlobalObject*, SVGElement* context)
+ DOMObjectWithSVGContext(NonNullPassRefPtr<JSC::Structure> structure, JSDOMGlobalObject*, SVGElement* context)
: DOMObject(structure)
, m_context(context)
{
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp
index aac1c63..9411ad8 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSAbstractWorkerCustom.cpp
@@ -54,7 +54,7 @@ JSValue JSAbstractWorker::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), globalObject, false), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -68,7 +68,7 @@ JSValue JSAbstractWorker::removeEventListener(ExecState* exec, const ArgList& ar
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), globalObject, false).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp
index 5855026..49ef5e3 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp
@@ -95,7 +95,7 @@ JSValue JSDOMApplicationCache::addEventListener(ExecState* exec, const ArgList&
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), globalObject, false), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -109,7 +109,7 @@ JSValue JSDOMApplicationCache::removeEventListener(ExecState* exec, const ArgLis
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), globalObject, false).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp
index 1899797..515c088 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.cpp
@@ -600,7 +600,7 @@ Structure* getCachedDOMStructure(JSDOMGlobalObject* globalObject, const ClassInf
return structures.get(classInfo).get();
}
-Structure* cacheDOMStructure(JSDOMGlobalObject* globalObject, PassRefPtr<Structure> structure, const ClassInfo* classInfo)
+Structure* cacheDOMStructure(JSDOMGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, const ClassInfo* classInfo)
{
JSDOMStructureMap& structures = globalObject->structures();
ASSERT(!structures.contains(classInfo));
@@ -612,7 +612,7 @@ Structure* getCachedDOMStructure(ExecState* exec, const ClassInfo* classInfo)
return getCachedDOMStructure(static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), classInfo);
}
-Structure* cacheDOMStructure(ExecState* exec, PassRefPtr<Structure> structure, const ClassInfo* classInfo)
+Structure* cacheDOMStructure(ExecState* exec, NonNullPassRefPtr<Structure> structure, const ClassInfo* classInfo)
{
return cacheDOMStructure(static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), structure, classInfo);
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h
index c46513c..9c0ad7e 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h
@@ -50,7 +50,7 @@ namespace WebCore {
// Base class for all objects in this binding except Window.
class DOMObject : public JSC::JSObject {
protected:
- explicit DOMObject(PassRefPtr<JSC::Structure> structure)
+ explicit DOMObject(NonNullPassRefPtr<JSC::Structure> structure)
: JSObject(structure)
{
}
@@ -80,7 +80,7 @@ namespace WebCore {
}
protected:
- DOMObjectWithGlobalPointer(PassRefPtr<JSC::Structure> structure, JSDOMGlobalObject* globalObject)
+ DOMObjectWithGlobalPointer(NonNullPassRefPtr<JSC::Structure> structure, JSDOMGlobalObject* globalObject)
: DOMObject(structure)
, m_globalObject(globalObject)
{
@@ -110,7 +110,7 @@ namespace WebCore {
}
protected:
- DOMConstructorObject(PassRefPtr<JSC::Structure> structure, JSDOMGlobalObject* globalObject)
+ DOMConstructorObject(NonNullPassRefPtr<JSC::Structure> structure, JSDOMGlobalObject* globalObject)
: DOMObjectWithGlobalPointer(structure, globalObject)
{
}
@@ -126,7 +126,7 @@ namespace WebCore {
}
protected:
- DOMConstructorWithDocument(PassRefPtr<JSC::Structure> structure, JSDOMGlobalObject* globalObject)
+ DOMConstructorWithDocument(NonNullPassRefPtr<JSC::Structure> structure, JSDOMGlobalObject* globalObject)
: DOMConstructorObject(structure, globalObject)
{
ASSERT(globalObject->scriptExecutionContext()->isDocument());
@@ -147,9 +147,9 @@ namespace WebCore {
void markDOMObjectWrapper(JSC::MarkStack&, JSC::JSGlobalData& globalData, void* object);
JSC::Structure* getCachedDOMStructure(JSDOMGlobalObject*, const JSC::ClassInfo*);
- JSC::Structure* cacheDOMStructure(JSDOMGlobalObject*, PassRefPtr<JSC::Structure>, const JSC::ClassInfo*);
+ JSC::Structure* cacheDOMStructure(JSDOMGlobalObject*, NonNullPassRefPtr<JSC::Structure>, const JSC::ClassInfo*);
JSC::Structure* getCachedDOMStructure(JSC::ExecState*, const JSC::ClassInfo*);
- JSC::Structure* cacheDOMStructure(JSC::ExecState*, PassRefPtr<JSC::Structure>, const JSC::ClassInfo*);
+ JSC::Structure* cacheDOMStructure(JSC::ExecState*, NonNullPassRefPtr<JSC::Structure>, const JSC::ClassInfo*);
JSC::JSObject* getCachedDOMConstructor(JSC::ExecState*, const JSC::ClassInfo*);
void cacheDOMConstructor(JSC::ExecState*, const JSC::ClassInfo*, JSC::JSObject* constructor);
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.cpp
index 240a56c..372684c 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.cpp
@@ -40,12 +40,7 @@ using namespace JSC;
namespace WebCore {
-JSDOMGlobalObject::JSDOMGlobalObjectData::JSDOMGlobalObjectData()
- : evt(0)
-{
-}
-
-JSDOMGlobalObject::JSDOMGlobalObject(PassRefPtr<Structure> structure, JSDOMGlobalObject::JSDOMGlobalObjectData* data, JSObject* thisValue)
+JSDOMGlobalObject::JSDOMGlobalObject(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject::JSDOMGlobalObjectData* data, JSObject* thisValue)
: JSGlobalObject(structure, data, thisValue)
{
}
@@ -68,7 +63,7 @@ PassRefPtr<JSEventListener> JSDOMGlobalObject::createJSAttributeEventListener(JS
if (!val.isObject())
return 0;
- return JSEventListener::create(asObject(val), this, true).get();
+ return JSEventListener::create(asObject(val), true).get();
}
void JSDOMGlobalObject::setCurrentEvent(Event* evt)
@@ -81,6 +76,11 @@ Event* JSDOMGlobalObject::currentEvent() const
return d()->evt;
}
+void JSDOMGlobalObject::destroyJSDOMGlobalObjectData(void* jsDOMGlobalObjectData)
+{
+ delete static_cast<JSDOMGlobalObjectData*>(jsDOMGlobalObjectData);
+}
+
JSDOMGlobalObject* toJSDOMGlobalObject(Document* document)
{
return toJSDOMWindow(document->frame());
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.h b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.h
index 996e155..00c3bbf 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.h
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.h
@@ -45,7 +45,7 @@ namespace WebCore {
protected:
struct JSDOMGlobalObjectData;
- JSDOMGlobalObject(PassRefPtr<JSC::Structure>, JSDOMGlobalObjectData*, JSC::JSObject* thisValue);
+ JSDOMGlobalObject(NonNullPassRefPtr<JSC::Structure>, JSDOMGlobalObjectData*, JSC::JSObject* thisValue);
public:
JSDOMStructureMap& structures() { return d()->structures; }
@@ -67,7 +67,11 @@ namespace WebCore {
protected:
struct JSDOMGlobalObjectData : public JSC::JSGlobalObject::JSGlobalObjectData {
- JSDOMGlobalObjectData();
+ JSDOMGlobalObjectData()
+ : JSGlobalObjectData(destroyJSDOMGlobalObjectData)
+ , evt(0)
+ {
+ }
JSDOMStructureMap structures;
JSDOMConstructorMap constructors;
@@ -76,6 +80,8 @@ namespace WebCore {
};
private:
+ static void destroyJSDOMGlobalObjectData(void*);
+
JSDOMGlobalObjectData* d() const { return static_cast<JSDOMGlobalObjectData*>(JSC::JSVariableObject::d); }
};
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp
index 6eca3e7..fe4d59c 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.cpp
@@ -48,7 +48,7 @@ JSDOMWindowBase::JSDOMWindowBaseData::JSDOMWindowBaseData(PassRefPtr<DOMWindow>
{
}
-JSDOMWindowBase::JSDOMWindowBase(PassRefPtr<Structure> structure, PassRefPtr<DOMWindow> window, JSDOMWindowShell* shell)
+JSDOMWindowBase::JSDOMWindowBase(NonNullPassRefPtr<Structure> structure, PassRefPtr<DOMWindow> window, JSDOMWindowShell* shell)
: JSDOMGlobalObject(structure, new JSDOMWindowBaseData(window, shell), shell)
{
GlobalPropertyInfo staticGlobals[] = {
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.h b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.h
index 84cc81f..09fe4bc 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.h
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowBase.h
@@ -43,7 +43,7 @@ namespace WebCore {
class JSDOMWindowBase : public JSDOMGlobalObject {
typedef JSDOMGlobalObject Base;
protected:
- JSDOMWindowBase(PassRefPtr<JSC::Structure>, PassRefPtr<DOMWindow>, JSDOMWindowShell*);
+ JSDOMWindowBase(NonNullPassRefPtr<JSC::Structure>, PassRefPtr<DOMWindow>, JSDOMWindowShell*);
public:
void updateDocument();
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp
index 08c7144..7410107 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -720,6 +720,14 @@ JSValue JSDOMWindow::sharedWorker(ExecState* exec) const
#if ENABLE(WEB_SOCKETS)
JSValue JSDOMWindow::webSocket(ExecState* exec) const
{
+ Frame* frame = impl()->frame();
+ if (!frame)
+ return jsUndefined();
+ Settings* settings = frame->settings();
+ if (!settings)
+ return jsUndefined();
+ if (!settings->experimentalWebSocketsEnabled())
+ return jsUndefined();
return getDOMConstructor<JSWebSocketConstructor>(exec, this);
}
#endif
@@ -1034,7 +1042,7 @@ JSValue JSDOMWindow::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -1048,7 +1056,7 @@ JSValue JSDOMWindow::removeEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.cpp
index 48ae014..4f273fe 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.cpp
@@ -31,20 +31,18 @@ using namespace JSC;
namespace WebCore {
-JSEventListener::JSEventListener(JSObject* function, JSDOMGlobalObject* globalObject, bool isAttribute)
+JSEventListener::JSEventListener(JSObject* function, bool isAttribute)
: EventListener(JSEventListenerType)
, m_jsFunction(function)
- , m_globalObject(globalObject)
, m_isAttribute(isAttribute)
{
- ASSERT(m_globalObject);
}
JSEventListener::~JSEventListener()
{
}
-JSObject* JSEventListener::jsFunction() const
+JSObject* JSEventListener::jsFunction(ScriptExecutionContext*) const
{
return m_jsFunction;
}
@@ -53,20 +51,22 @@ void JSEventListener::markJSFunction(MarkStack& markStack)
{
if (m_jsFunction)
markStack.append(m_jsFunction);
- markStack.append(m_globalObject);
}
-void JSEventListener::handleEvent(Event* event)
+void JSEventListener::handleEvent(ScriptExecutionContext* scriptExecutionContext, Event* event)
{
+ ASSERT(scriptExecutionContext);
+ if (!scriptExecutionContext)
+ return;
+
JSLock lock(SilenceAssertionsOnly);
- JSObject* jsFunction = this->jsFunction();
+ JSObject* jsFunction = this->jsFunction(scriptExecutionContext);
if (!jsFunction)
return;
- JSDOMGlobalObject* globalObject = m_globalObject;
- ScriptExecutionContext* scriptExecutionContext = globalObject->scriptExecutionContext();
- if (!scriptExecutionContext)
+ JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(scriptExecutionContext);
+ if (!globalObject)
return;
if (scriptExecutionContext->isDocument()) {
@@ -132,15 +132,15 @@ void JSEventListener::handleEvent(Event* event)
}
}
-bool JSEventListener::reportError(const String& message, const String& url, int lineNumber)
+bool JSEventListener::reportError(ScriptExecutionContext* context, const String& message, const String& url, int lineNumber)
{
JSLock lock(SilenceAssertionsOnly);
- JSObject* jsFunction = this->jsFunction();
+ JSObject* jsFunction = this->jsFunction(context);
if (!jsFunction)
return false;
- JSDOMGlobalObject* globalObject = m_globalObject;
+ JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context);
ExecState* exec = globalObject->globalExec();
CallData callData;
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.h b/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.h
index 91ceff7..285a9c4 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.h
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSEventListener.h
@@ -30,9 +30,9 @@ namespace WebCore {
class JSEventListener : public EventListener {
public:
- static PassRefPtr<JSEventListener> create(JSC::JSObject* listener, JSDOMGlobalObject* globalObject, bool isAttribute)
+ static PassRefPtr<JSEventListener> create(JSC::JSObject* listener, bool isAttribute)
{
- return adoptRef(new JSEventListener(listener, globalObject, isAttribute));
+ return adoptRef(new JSEventListener(listener, isAttribute));
}
static const JSEventListener* cast(const EventListener* listener)
@@ -49,20 +49,19 @@ namespace WebCore {
// Returns true if this event listener was created for an event handler attribute, like "onload" or "onclick".
bool isAttribute() const { return m_isAttribute; }
- virtual JSC::JSObject* jsFunction() const;
+ virtual JSC::JSObject* jsFunction(ScriptExecutionContext*) const;
private:
virtual void markJSFunction(JSC::MarkStack&);
- virtual void handleEvent(Event*);
- virtual bool reportError(const String& message, const String& url, int lineNumber);
+ virtual void handleEvent(ScriptExecutionContext*, Event*);
+ virtual bool reportError(ScriptExecutionContext*, const String& message, const String& url, int lineNumber);
virtual bool virtualisAttribute() const;
void clearJSFunctionInline();
protected:
- JSEventListener(JSC::JSObject* function, JSDOMGlobalObject*, bool isAttribute);
+ JSEventListener(JSC::JSObject* function, bool isAttribute);
mutable JSC::JSObject* m_jsFunction;
- JSDOMGlobalObject* m_globalObject;
bool m_isAttribute;
};
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSEventSourceCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSEventSourceCustom.cpp
index d757ef6..404bf11 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSEventSourceCustom.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSEventSourceCustom.cpp
@@ -53,7 +53,7 @@ JSValue JSEventSource::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), globalObject, false).get(), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -67,7 +67,7 @@ JSValue JSEventSource::removeEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), globalObject, false).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAllCollection.h b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAllCollection.h
index 7363e5c..e6fe7f5 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAllCollection.h
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSHTMLAllCollection.h
@@ -35,7 +35,7 @@ namespace WebCore {
class JSHTMLAllCollection : public JSHTMLCollection {
public:
- JSHTMLAllCollection(PassRefPtr<JSC::Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<HTMLCollection> collection)
+ JSHTMLAllCollection(NonNullPassRefPtr<JSC::Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<HTMLCollection> collection)
: JSHTMLCollection(structure, globalObject, collection)
{
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSInspectedObjectWrapper.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSInspectedObjectWrapper.cpp
index 7daeec7..ed79427 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSInspectedObjectWrapper.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSInspectedObjectWrapper.cpp
@@ -71,7 +71,7 @@ JSValue JSInspectedObjectWrapper::wrap(ExecState* unwrappedExec, JSValue unwrapp
return new (unwrappedExec) JSInspectedObjectWrapper(unwrappedExec, unwrappedObject, JSQuarantinedObjectWrapper::createStructure(asObject(wrap(unwrappedExec, prototype))));
}
-JSInspectedObjectWrapper::JSInspectedObjectWrapper(ExecState* unwrappedExec, JSObject* unwrappedObject, PassRefPtr<Structure> structure)
+JSInspectedObjectWrapper::JSInspectedObjectWrapper(ExecState* unwrappedExec, JSObject* unwrappedObject, NonNullPassRefPtr<Structure> structure)
: JSQuarantinedObjectWrapper(unwrappedExec, unwrappedObject, structure)
{
WrapperMap* wrapperMap = wrappers().get(unwrappedGlobalObject());
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSInspectedObjectWrapper.h b/src/3rdparty/webkit/WebCore/bindings/js/JSInspectedObjectWrapper.h
index 201feb6..ad97035 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSInspectedObjectWrapper.h
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSInspectedObjectWrapper.h
@@ -38,7 +38,7 @@ namespace WebCore {
static const JSC::ClassInfo s_info;
private:
- JSInspectedObjectWrapper(JSC::ExecState* unwrappedExec, JSC::JSObject* unwrappedObject, PassRefPtr<JSC::Structure>);
+ JSInspectedObjectWrapper(JSC::ExecState* unwrappedExec, JSC::JSObject* unwrappedObject, NonNullPassRefPtr<JSC::Structure>);
virtual bool allowsGetProperty() const { return true; }
virtual bool allowsSetProperty() const { return true; }
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSInspectorCallbackWrapper.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSInspectorCallbackWrapper.cpp
index e7d3f51..9c4330d 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSInspectorCallbackWrapper.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSInspectorCallbackWrapper.cpp
@@ -78,7 +78,7 @@ JSValue JSInspectorCallbackWrapper::wrap(ExecState* unwrappedExec, JSValue unwra
return new (unwrappedExec) JSInspectorCallbackWrapper(unwrappedExec, unwrappedObject, createStructure(wrap(unwrappedExec, prototype)));
}
-JSInspectorCallbackWrapper::JSInspectorCallbackWrapper(ExecState* unwrappedExec, JSObject* unwrappedObject, PassRefPtr<Structure> structure)
+JSInspectorCallbackWrapper::JSInspectorCallbackWrapper(ExecState* unwrappedExec, JSObject* unwrappedObject, NonNullPassRefPtr<Structure> structure)
: JSQuarantinedObjectWrapper(unwrappedExec, unwrappedObject, structure)
{
ASSERT(!wrappers().contains(unwrappedObject));
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSInspectorCallbackWrapper.h b/src/3rdparty/webkit/WebCore/bindings/js/JSInspectorCallbackWrapper.h
index cfc2fb6..be28063 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSInspectorCallbackWrapper.h
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSInspectorCallbackWrapper.h
@@ -40,7 +40,7 @@ namespace WebCore {
static const JSC::ClassInfo s_info;
protected:
- JSInspectorCallbackWrapper(JSC::ExecState* unwrappedExec, JSC::JSObject* unwrappedObject, PassRefPtr<JSC::Structure>);
+ JSInspectorCallbackWrapper(JSC::ExecState* unwrappedExec, JSC::JSObject* unwrappedObject, NonNullPassRefPtr<JSC::Structure>);
virtual bool allowsCallAsFunction() const { return true; }
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.cpp
index cf0ed44..0d6cb57 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.cpp
@@ -35,12 +35,13 @@ namespace WebCore {
static WTF::RefCountedLeakCounter eventListenerCounter("JSLazyEventListener");
#endif
-JSLazyEventListener::JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, JSDOMGlobalObject* globalObject, Node* node, int lineNumber)
- : JSEventListener(0, globalObject, true)
+JSLazyEventListener::JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, Node* node, const String& sourceURL, int lineNumber)
+ : JSEventListener(0, true)
, m_functionName(functionName)
, m_eventParameterName(eventParameterName)
, m_code(code)
, m_parsed(false)
+ , m_sourceURL(sourceURL)
, m_lineNumber(lineNumber)
, m_originalNode(node)
{
@@ -67,23 +68,43 @@ JSLazyEventListener::~JSLazyEventListener()
#endif
}
-JSObject* JSLazyEventListener::jsFunction() const
+JSObject* JSLazyEventListener::jsFunction(ScriptExecutionContext* executionContext) const
{
- parseCode();
+ parseCode(executionContext);
return m_jsFunction;
}
-void JSLazyEventListener::parseCode() const
+void JSLazyEventListener::parseCode(ScriptExecutionContext* executionContext) const
{
+ ASSERT(executionContext);
+ ASSERT(executionContext->isDocument());
+ if (!executionContext)
+ return;
+
if (m_parsed)
return;
- ScriptExecutionContext* executionContext = m_globalObject->scriptExecutionContext();
- ASSERT(executionContext);
- if (!executionContext)
+ Frame* frame = static_cast<Document*>(executionContext)->frame();
+ if (!frame)
return;
+
+ ScriptController* scriptController = frame->script();
+ if (!scriptController->isEnabled())
+ return;
+
+ JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(executionContext);
+ if (!globalObject)
+ return;
+
+ // Ensure that 'node' has a JavaScript wrapper to mark the event listener we're creating.
+ if (m_originalNode) {
+ JSLock lock(SilenceAssertionsOnly);
+ // FIXME: Should pass the global object associated with the node
+ toJS(globalObject->globalExec(), globalObject, m_originalNode);
+ }
+
if (executionContext->isDocument()) {
- JSDOMWindow* window = static_cast<JSDOMWindow*>(m_globalObject);
+ JSDOMWindow* window = static_cast<JSDOMWindow*>(globalObject);
Frame* frame = window->impl()->frame();
if (!frame)
return;
@@ -95,16 +116,13 @@ void JSLazyEventListener::parseCode() const
m_parsed = true;
- ExecState* exec = m_globalObject->globalExec();
+ ExecState* exec = globalObject->globalExec();
MarkedArgumentBuffer args;
- UString sourceURL(executionContext->url().string());
args.append(jsNontrivialString(exec, m_eventParameterName));
args.append(jsString(exec, m_code));
- // FIXME: Passing the document's URL to construct is not always correct, since this event listener might
- // have been added with setAttribute from a script, and we should pass String() in that case.
- m_jsFunction = constructFunction(exec, args, Identifier(exec, m_functionName), sourceURL, m_lineNumber); // FIXME: is globalExec ok?
+ m_jsFunction = constructFunction(exec, args, Identifier(exec, m_functionName), m_sourceURL, m_lineNumber); // FIXME: is globalExec ok?
JSFunction* listenerAsFunction = static_cast<JSFunction*>(m_jsFunction);
@@ -118,7 +136,7 @@ void JSLazyEventListener::parseCode() const
// (and the document, and the form - see JSHTMLElement::eventHandlerScope)
ScopeChain scope = listenerAsFunction->scope();
- JSValue thisObj = toJS(exec, m_globalObject, m_originalNode);
+ JSValue thisObj = toJS(exec, globalObject, m_originalNode);
if (thisObj.isObject()) {
static_cast<JSNode*>(asObject(thisObj))->pushEventHandlerScope(exec, scope);
listenerAsFunction->setScope(scope);
@@ -129,6 +147,7 @@ void JSLazyEventListener::parseCode() const
m_functionName = String();
m_code = String();
m_eventParameterName = String();
+ m_sourceURL = String();
}
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.h b/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.h
index a5304cf..e3137b8 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.h
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSLazyEventListener.h
@@ -29,24 +29,25 @@ namespace WebCore {
class JSLazyEventListener : public JSEventListener {
public:
- static PassRefPtr<JSLazyEventListener> create(const String& functionName, const String& eventParameterName, const String& code, JSDOMGlobalObject* globalObject, Node* node, int lineNumber)
+ static PassRefPtr<JSLazyEventListener> create(const String& functionName, const String& eventParameterName, const String& code, Node* node, const String& sourceURL, int lineNumber)
{
- return adoptRef(new JSLazyEventListener(functionName, eventParameterName, code, globalObject, node, lineNumber));
+ return adoptRef(new JSLazyEventListener(functionName, eventParameterName, code, node, sourceURL, lineNumber));
}
virtual ~JSLazyEventListener();
private:
- JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, JSDOMGlobalObject*, Node*, int lineNumber);
+ JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, Node*, const String& sourceURL, int lineNumber);
- virtual JSC::JSObject* jsFunction() const;
+ virtual JSC::JSObject* jsFunction(ScriptExecutionContext*) const;
virtual bool wasCreatedFromMarkup() const { return true; }
- void parseCode() const;
+ void parseCode(ScriptExecutionContext*) const;
mutable String m_functionName;
mutable String m_eventParameterName;
mutable String m_code;
mutable bool m_parsed;
+ mutable String m_sourceURL;
int m_lineNumber;
Node* m_originalNode;
};
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSMessagePortCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSMessagePortCustom.cpp
index 2084905..210c93e 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSMessagePortCustom.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSMessagePortCustom.cpp
@@ -65,7 +65,7 @@ JSValue JSMessagePort::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), globalObject, false).get(), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -79,7 +79,7 @@ JSValue JSMessagePort::removeEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), globalObject, false).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSNodeCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSNodeCustom.cpp
index 025a8fa..52f21e7 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSNodeCustom.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSNodeCustom.cpp
@@ -122,7 +122,7 @@ JSValue JSNode::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), globalObject, false), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -140,7 +140,7 @@ JSValue JSNode::removeEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), globalObject, false).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp
index 30acf9b..a0551a1 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp
@@ -56,7 +56,7 @@ JSValue JSQuarantinedObjectWrapper::cachedValueGetter(ExecState*, const Identifi
return v;
}
-JSQuarantinedObjectWrapper::JSQuarantinedObjectWrapper(ExecState* unwrappedExec, JSObject* unwrappedObject, PassRefPtr<Structure> structure)
+JSQuarantinedObjectWrapper::JSQuarantinedObjectWrapper(ExecState* unwrappedExec, JSObject* unwrappedObject, NonNullPassRefPtr<Structure> structure)
: JSObject(structure)
, m_unwrappedGlobalObject(unwrappedExec->lexicalGlobalObject())
, m_unwrappedObject(unwrappedObject)
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.h b/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.h
index 2bc6633..94a92bd 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.h
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.h
@@ -51,7 +51,7 @@ namespace WebCore {
}
protected:
- JSQuarantinedObjectWrapper(JSC::ExecState* unwrappedExec, JSC::JSObject* unwrappedObject, PassRefPtr<JSC::Structure>);
+ JSQuarantinedObjectWrapper(JSC::ExecState* unwrappedExec, JSC::JSObject* unwrappedObject, NonNullPassRefPtr<JSC::Structure>);
virtual void markChildren(JSC::MarkStack&);
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp
index e8001de..571e302 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp
@@ -58,7 +58,7 @@ JSValue JSSVGElementInstance::addEventListener(ExecState* exec, const ArgList& a
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), globalObject, false), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -72,7 +72,7 @@ JSValue JSSVGElementInstance::removeEventListener(ExecState* exec, const ArgList
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), globalObject, false).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextBase.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextBase.cpp
index 1e4df42..741a269 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextBase.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextBase.cpp
@@ -44,7 +44,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSWorkerContextBase);
const ClassInfo JSWorkerContextBase::s_info = { "WorkerContext", 0, 0, 0 };
-JSWorkerContextBase::JSWorkerContextBase(PassRefPtr<JSC::Structure> structure, PassRefPtr<WorkerContext> impl)
+JSWorkerContextBase::JSWorkerContextBase(NonNullPassRefPtr<JSC::Structure> structure, PassRefPtr<WorkerContext> impl)
: JSDOMGlobalObject(structure, new JSDOMGlobalObjectData, this)
, m_impl(impl)
{
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextBase.h b/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextBase.h
index a9a6e63..45238f1 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextBase.h
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextBase.h
@@ -41,7 +41,7 @@ namespace WebCore {
class JSWorkerContextBase : public JSDOMGlobalObject {
typedef JSDOMGlobalObject Base;
public:
- JSWorkerContextBase(PassRefPtr<JSC::Structure>, PassRefPtr<WorkerContext>);
+ JSWorkerContextBase(NonNullPassRefPtr<JSC::Structure>, PassRefPtr<WorkerContext>);
virtual ~JSWorkerContextBase();
virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp
index 1b78264..e1c8a8c 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSWorkerContextCustom.cpp
@@ -122,7 +122,7 @@ JSValue JSWorkerContext::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -132,7 +132,7 @@ JSValue JSWorkerContext::removeEventListener(ExecState* exec, const ArgList& arg
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
index 6d0ce57..4b44db2 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
@@ -160,7 +160,7 @@ JSValue JSXMLHttpRequest::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), globalObject, false), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -174,7 +174,7 @@ JSValue JSXMLHttpRequest::removeEventListener(ExecState* exec, const ArgList& ar
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), globalObject, false).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp
index c0f0c39..dab0a3e 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp
@@ -64,7 +64,7 @@ JSValue JSXMLHttpRequestUpload::addEventListener(ExecState* exec, const ArgList&
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), globalObject, false), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -78,7 +78,7 @@ JSValue JSXMLHttpRequestUpload::removeEventListener(ExecState* exec, const ArgLi
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), globalObject, false).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp
index 878c535..0b0047b 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp
+++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp
@@ -33,12 +33,11 @@
#include "Attribute.h"
#include "Document.h"
+#include "EventListener.h"
#include "JSNode.h"
#include "Frame.h"
#include "XSSAuditor.h"
-#include <runtime/JSLock.h>
-
using namespace JSC;
namespace WebCore {
@@ -54,29 +53,25 @@ PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node* node, Attribu
{
ASSERT(node);
- Frame* frame = node->document()->frame();
- if (!frame)
- return 0;
-
- ScriptController* scriptController = frame->script();
- if (!scriptController->isEnabled())
- return 0;
-
- if (!scriptController->xssAuditor()->canCreateInlineEventListener(attr->localName().string(), attr->value())) {
- // This script is not safe to execute.
- return 0;
- }
+ int lineNumber = 1;
+ String sourceURL;
- JSDOMWindow* globalObject = scriptController->globalObject();
-
- // Ensure that 'node' has a JavaScript wrapper to mark the event listener we're creating.
- {
- JSLock lock(SilenceAssertionsOnly);
- // FIXME: Should pass the global object associated with the node
- toJS(globalObject->globalExec(), globalObject, node);
+ // FIXME: We should be able to provide accurate source information for frameless documents, too (e.g. for importing nodes from XMLHttpRequest.responseXML).
+ if (Frame* frame = node->document()->frame()) {
+ ScriptController* scriptController = frame->script();
+ if (!scriptController->isEnabled())
+ return 0;
+
+ if (!scriptController->xssAuditor()->canCreateInlineEventListener(attr->localName().string(), attr->value())) {
+ // This script is not safe to execute.
+ return 0;
+ }
+
+ lineNumber = scriptController->eventHandlerLineNumber();
+ sourceURL = node->document()->url().string();
}
- return JSLazyEventListener::create(attr->localName().string(), eventParameterName(node->isSVGElement()), attr->value(), globalObject, node, scriptController->eventHandlerLineNumber());
+ return JSLazyEventListener::create(attr->localName().string(), eventParameterName(node->isSVGElement()), attr->value(), node, sourceURL, lineNumber);
}
PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame* frame, Attribute* attr)
@@ -84,19 +79,29 @@ PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame* frame, Attri
if (!frame)
return 0;
+ int lineNumber = 1;
+ String sourceURL;
+
ScriptController* scriptController = frame->script();
if (!scriptController->isEnabled())
return 0;
-
+
if (!scriptController->xssAuditor()->canCreateInlineEventListener(attr->localName().string(), attr->value())) {
// This script is not safe to execute.
return 0;
}
- // 'globalObject' is the JavaScript wrapper that will mark the event listener we're creating.
- JSDOMWindow* globalObject = scriptController->globalObject();
+ lineNumber = scriptController->eventHandlerLineNumber();
+ sourceURL = frame->document()->url().string();
+ return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), 0, sourceURL, lineNumber);
+}
- return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), globalObject, 0, scriptController->eventHandlerLineNumber());
+String getEventListenerHandlerBody(ScriptExecutionContext* context, ScriptState* scriptState, EventListener* eventListener)
+{
+ JSC::JSObject* functionObject = eventListener->jsFunction(context);
+ if (!functionObject)
+ return "";
+ return functionObject->toString(scriptState);
}
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.h
index 8299d29..3396541 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.h
+++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.h
@@ -32,17 +32,20 @@
#define ScriptEventListener_h
#include "JSLazyEventListener.h"
+#include "ScriptState.h"
#include <wtf/PassRefPtr.h>
namespace WebCore {
class Attribute;
+ class EventListener;
class Frame;
class Node;
PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node*, Attribute*);
PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame*, Attribute*);
+ String getEventListenerHandlerBody(ScriptExecutionContext*, ScriptState*, EventListener*);
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorCOM.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorCOM.pm
index 6641305..4d5cb96 100644
--- a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorCOM.pm
+++ b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorCOM.pm
@@ -326,9 +326,8 @@ sub AddIncludesForTypeInCPPImplementation
sub GetAdditionalInterfaces
{
+ # This function does nothing, but it stays here for future multiple inheritance support.
my $type = $codeGenerator->StripModule(shift);
-
- return ("EventTarget") if $type eq "Node";
return ();
}
diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm
index 3523b43..d552aa0 100644
--- a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -540,13 +540,13 @@ sub GenerateHeader
# Constructor
if ($interfaceName eq "DOMWindow") {
- push(@headerContent, " $className(PassRefPtr<JSC::Structure>, PassRefPtr<$implType>, JSDOMWindowShell*);\n");
+ push(@headerContent, " $className(NonNullPassRefPtr<JSC::Structure>, PassRefPtr<$implType>, JSDOMWindowShell*);\n");
} elsif ($dataNode->extendedAttributes->{"IsWorkerContext"}) {
- push(@headerContent, " $className(PassRefPtr<JSC::Structure>, PassRefPtr<$implType>);\n");
+ push(@headerContent, " $className(NonNullPassRefPtr<JSC::Structure>, PassRefPtr<$implType>);\n");
} elsif (IsSVGTypeNeedingContextParameter($implClassName)) {
- push(@headerContent, " $className(PassRefPtr<JSC::Structure>, JSDOMGlobalObject*, PassRefPtr<$implType>, SVGElement* context);\n");
+ push(@headerContent, " $className(NonNullPassRefPtr<JSC::Structure>, JSDOMGlobalObject*, PassRefPtr<$implType>, SVGElement* context);\n");
} else {
- push(@headerContent, " $className(PassRefPtr<JSC::Structure>, JSDOMGlobalObject*, PassRefPtr<$implType>);\n");
+ push(@headerContent, " $className(NonNullPassRefPtr<JSC::Structure>, JSDOMGlobalObject*, PassRefPtr<$implType>);\n");
}
# Destructor
@@ -808,7 +808,7 @@ sub GenerateHeader
# Custom defineGetter function
push(@headerContent, " virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes);\n") if $dataNode->extendedAttributes->{"CustomPrototypeDefineGetter"};
- push(@headerContent, " ${className}Prototype(PassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { }\n");
+ push(@headerContent, " ${className}Prototype(NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { }\n");
push(@headerContent, "};\n\n");
@@ -1137,15 +1137,15 @@ sub GenerateImplementation
# Constructor
if ($interfaceName eq "DOMWindow") {
AddIncludesForType("JSDOMWindowShell");
- push(@implContent, "${className}::$className(PassRefPtr<Structure> structure, PassRefPtr<$implType> impl, JSDOMWindowShell* shell)\n");
+ push(@implContent, "${className}::$className(NonNullPassRefPtr<Structure> structure, PassRefPtr<$implType> impl, JSDOMWindowShell* shell)\n");
push(@implContent, " : $parentClassName(structure, impl, shell)\n");
} elsif ($dataNode->extendedAttributes->{"IsWorkerContext"}) {
AddIncludesForType($interfaceName);
- push(@implContent, "${className}::$className(PassRefPtr<Structure> structure, PassRefPtr<$implType> impl)\n");
+ push(@implContent, "${className}::$className(NonNullPassRefPtr<Structure> structure, PassRefPtr<$implType> impl)\n");
push(@implContent, " : $parentClassName(structure, impl)\n");
} else {
my $contextArg = $needsSVGContext ? ", SVGElement* context" : "";
- push(@implContent, "${className}::$className(PassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<$implType> impl$contextArg)\n");
+ push(@implContent, "${className}::$className(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<$implType> impl$contextArg)\n");
if ($hasParent) {
push(@implContent, " : $parentClassName(structure, globalObject, impl" . ($parentNeedsSVGContext ? ", context" : "") . ")\n");
} else {
@@ -1294,7 +1294,11 @@ sub GenerateImplementation
push(@implContent, " UNUSED_PARAM(exec);\n");
push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(castedThis->impl());\n");
push(@implContent, " if (EventListener* listener = imp->$implGetterFunctionName()) {\n");
- push(@implContent, " if (JSObject* jsFunction = listener->jsFunction())\n");
+ if ($implClassName eq "Document" || $implClassName eq "WorkerContext" || $implClassName eq "SharedWorkerContext" || $implClassName eq "DedicatedWorkerContext") {
+ push(@implContent, " if (JSObject* jsFunction = listener->jsFunction(imp))\n");
+ } else {
+ push(@implContent, " if (JSObject* jsFunction = listener->jsFunction(imp->scriptExecutionContext()))\n");
+ }
push(@implContent, " return jsFunction;\n");
push(@implContent, " }\n");
push(@implContent, " return jsNull();\n");
diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm
index 1cbe8d2..7f1508b 100644
--- a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -1589,6 +1589,11 @@ sub GetNativeTypeFromSignature
my $type = GetTypeFromSignature($signature);
+ if ($type eq "unsigned long" and $signature->extendedAttributes->{"IsIndex"}) {
+ # Special-case index arguments because we need to check that they aren't < 0.
+ return "int";
+ }
+
return GetNativeType($type, $isParameter);
}
@@ -1711,7 +1716,8 @@ sub GetNativeType
return "int" if $type eq "int";
return "int" if $type eq "short" or $type eq "unsigned short";
- return "int" if $type eq "long" or $type eq "unsigned long";
+ return "unsigned" if $type eq "unsigned long";
+ return "int" if $type eq "long";
return "unsigned long long" if $type eq "unsigned long long";
return "bool" if $type eq "boolean";
return "String" if $type eq "DOMString";