summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/bindings/js
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/bindings/js')
-rw-r--r--Source/WebCore/bindings/js/JSAudioConstructor.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSAudioConstructor.h4
-rw-r--r--Source/WebCore/bindings/js/JSBindingsAllInOne.cpp5
-rw-r--r--Source/WebCore/bindings/js/JSDOMBinding.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSDOMBinding.h10
-rw-r--r--Source/WebCore/bindings/js/JSDOMGlobalObject.cpp25
-rw-r--r--Source/WebCore/bindings/js/JSDOMGlobalObject.h44
-rw-r--r--Source/WebCore/bindings/js/JSDOMWindowBase.cpp28
-rw-r--r--Source/WebCore/bindings/js/JSDOMWindowBase.h18
-rw-r--r--Source/WebCore/bindings/js/JSDOMWindowCustom.h2
-rw-r--r--Source/WebCore/bindings/js/JSDOMWindowShell.cpp6
-rw-r--r--Source/WebCore/bindings/js/JSDOMWindowShell.h4
-rw-r--r--Source/WebCore/bindings/js/JSDOMWrapper.cpp6
-rw-r--r--Source/WebCore/bindings/js/JSDOMWrapper.h2
-rw-r--r--Source/WebCore/bindings/js/JSErrorHandler.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSEventListener.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp3
-rw-r--r--Source/WebCore/bindings/js/JSImageConstructor.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSImageConstructor.h4
-rw-r--r--Source/WebCore/bindings/js/JSImageDataCustom.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp84
-rw-r--r--Source/WebCore/bindings/js/JSInjectedScriptManager.cpp111
-rw-r--r--Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSLazyEventListener.cpp26
-rw-r--r--Source/WebCore/bindings/js/JSMainThreadExecState.h2
-rw-r--r--Source/WebCore/bindings/js/JSOptionConstructor.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSOptionConstructor.h4
-rw-r--r--Source/WebCore/bindings/js/JSWebKitAnimationCustom.cpp44
-rw-r--r--Source/WebCore/bindings/js/JSWebKitAnimationListCustom.cpp47
-rw-r--r--Source/WebCore/bindings/js/JSWorkerContextBase.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSWorkerContextBase.h4
-rwxr-xr-xSource/WebCore/bindings/js/PageScriptDebugServer.cpp215
-rwxr-xr-xSource/WebCore/bindings/js/PageScriptDebugServer.h81
-rw-r--r--Source/WebCore/bindings/js/ScheduledAction.h2
-rw-r--r--Source/WebCore/bindings/js/ScriptDebugServer.cpp206
-rw-r--r--Source/WebCore/bindings/js/ScriptDebugServer.h35
-rw-r--r--Source/WebCore/bindings/js/ScriptHeapSnapshot.h1
-rw-r--r--Source/WebCore/bindings/js/ScriptProfiler.cpp6
-rw-r--r--Source/WebCore/bindings/js/ScriptProfiler.h1
-rw-r--r--Source/WebCore/bindings/js/SerializedScriptValue.cpp92
-rw-r--r--Source/WebCore/bindings/js/WorkerScriptController.cpp10
-rwxr-xr-xSource/WebCore/bindings/js/WorkerScriptDebugServer.cpp55
-rwxr-xr-xSource/WebCore/bindings/js/WorkerScriptDebugServer.h62
43 files changed, 794 insertions, 473 deletions
diff --git a/Source/WebCore/bindings/js/JSAudioConstructor.cpp b/Source/WebCore/bindings/js/JSAudioConstructor.cpp
index f0040fa..9ac797b 100644
--- a/Source/WebCore/bindings/js/JSAudioConstructor.cpp
+++ b/Source/WebCore/bindings/js/JSAudioConstructor.cpp
@@ -40,7 +40,7 @@ namespace WebCore {
const ClassInfo JSAudioConstructor::s_info = { "AudioConstructor", &DOMConstructorWithDocument::s_info, 0, 0 };
JSAudioConstructor::JSAudioConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
- : DOMConstructorWithDocument(JSAudioConstructor::createStructure(globalObject->objectPrototype()), globalObject)
+ : DOMConstructorWithDocument(JSAudioConstructor::createStructure(globalObject->globalData(), globalObject->objectPrototype()), globalObject)
{
ASSERT(inherits(&s_info));
putDirect(exec->globalData(), exec->propertyNames().prototype, JSHTMLAudioElementPrototype::self(exec, globalObject), None);
diff --git a/Source/WebCore/bindings/js/JSAudioConstructor.h b/Source/WebCore/bindings/js/JSAudioConstructor.h
index c90abbf..be0b800 100644
--- a/Source/WebCore/bindings/js/JSAudioConstructor.h
+++ b/Source/WebCore/bindings/js/JSAudioConstructor.h
@@ -38,9 +38,9 @@ namespace WebCore {
public:
JSAudioConstructor(JSC::ExecState*, JSDOMGlobalObject*);
- static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ static PassRefPtr<JSC::Structure> createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
{
- return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
static const JSC::ClassInfo s_info;
diff --git a/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp b/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
index b53d950..d5c9135 100644
--- a/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
+++ b/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
@@ -103,6 +103,7 @@
#include "JSImageConstructor.cpp"
#include "JSImageDataCustom.cpp"
#include "JSInjectedScriptHostCustom.cpp"
+#include "JSInjectedScriptManager.cpp"
#include "JSInspectorFrontendHostCustom.cpp"
#include "JSInt16ArrayCustom.cpp"
#include "JSInt32ArrayCustom.cpp"
@@ -143,6 +144,8 @@
#include "JSUint16ArrayCustom.cpp"
#include "JSUint32ArrayCustom.cpp"
#include "JSUint8ArrayCustom.cpp"
+#include "JSWebKitAnimationCustom.cpp"
+#include "JSWebKitAnimationListCustom.cpp"
#include "JSWebKitCSSKeyframeRuleCustom.cpp"
#include "JSWebKitCSSKeyframesRuleCustom.cpp"
#include "JSWebKitCSSMatrixCustom.cpp"
@@ -156,6 +159,7 @@
#include "JSXSLTProcessorCustom.cpp"
#include "JavaScriptCallFrame.cpp"
#include "MemoryInfo.cpp"
+#include "PageScriptDebugServer.cpp"
#include "ScheduledAction.cpp"
#include "ScriptCachedFrameData.cpp"
#include "ScriptCallStackFactory.cpp"
@@ -169,4 +173,5 @@
#include "ScriptState.cpp"
#include "SerializedScriptValue.cpp"
#include "WorkerScriptController.cpp"
+#include "WorkerScriptDebugServer.cpp"
diff --git a/Source/WebCore/bindings/js/JSDOMBinding.cpp b/Source/WebCore/bindings/js/JSDOMBinding.cpp
index 4d18a4e..8501eb9 100644
--- a/Source/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/Source/WebCore/bindings/js/JSDOMBinding.cpp
@@ -483,7 +483,7 @@ JSValue jsDateOrNull(ExecState* exec, double value)
{
if (!isfinite(value))
return jsNull();
- return new (exec) DateInstance(exec, value);
+ return new (exec) DateInstance(exec, exec->lexicalGlobalObject()->dateStructure(), value);
}
double valueToDate(ExecState* exec, JSValue value)
diff --git a/Source/WebCore/bindings/js/JSDOMBinding.h b/Source/WebCore/bindings/js/JSDOMBinding.h
index 4fe3d16..934d9b3 100644
--- a/Source/WebCore/bindings/js/JSDOMBinding.h
+++ b/Source/WebCore/bindings/js/JSDOMBinding.h
@@ -64,9 +64,9 @@ namespace WebCore {
return globalObject()->scriptExecutionContext();
}
- static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ static PassRefPtr<JSC::Structure> createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
{
- return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
protected:
@@ -83,9 +83,9 @@ namespace WebCore {
// Base class for all constructor objects in the JSC bindings.
class DOMConstructorObject : public DOMObjectWithGlobalPointer {
public:
- static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ static PassRefPtr<JSC::Structure> createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
{
- return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
protected:
@@ -143,7 +143,7 @@ namespace WebCore {
{
if (JSC::Structure* structure = getCachedDOMStructure(globalObject, &WrapperClass::s_info))
return structure;
- return cacheDOMStructure(globalObject, WrapperClass::createStructure(WrapperClass::createPrototype(exec, globalObject)), &WrapperClass::s_info);
+ return cacheDOMStructure(globalObject, WrapperClass::createStructure(exec->globalData(), WrapperClass::createPrototype(exec, globalObject)), &WrapperClass::s_info);
}
template<class WrapperClass> inline JSC::Structure* deprecatedGetDOMStructure(JSC::ExecState* exec)
{
diff --git a/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp b/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
index efd0ae0..8183b6e 100644
--- a/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
+++ b/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
@@ -42,8 +42,10 @@ namespace WebCore {
const ClassInfo JSDOMGlobalObject::s_info = { "DOMGlobalObject", &JSGlobalObject::s_info, 0, 0 };
-JSDOMGlobalObject::JSDOMGlobalObject(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject::JSDOMGlobalObjectData* data, JSObject* thisValue)
- : JSGlobalObject(structure, data, thisValue)
+JSDOMGlobalObject::JSDOMGlobalObject(NonNullPassRefPtr<Structure> structure, PassRefPtr<DOMWrapperWorld> world, JSObject* thisValue)
+ : JSGlobalObject(structure, thisValue)
+ , m_currentEvent(0)
+ , m_world(world)
{
ASSERT(inherits(&s_info));
}
@@ -60,33 +62,28 @@ void JSDOMGlobalObject::markChildren(MarkStack& markStack)
for (JSDOMConstructorMap::iterator it2 = constructors().begin(); it2 != end2; ++it2)
markStack.append(&it2->second);
- if (d()->m_injectedScript)
- markStack.append(&d()->m_injectedScript);
+ if (m_injectedScript)
+ markStack.append(&m_injectedScript);
}
-void JSDOMGlobalObject::setCurrentEvent(Event* evt)
+void JSDOMGlobalObject::setCurrentEvent(Event* currentEvent)
{
- d()->evt = evt;
+ m_currentEvent = currentEvent;
}
Event* JSDOMGlobalObject::currentEvent() const
{
- return d()->evt;
+ return m_currentEvent;
}
void JSDOMGlobalObject::setInjectedScript(JSObject* injectedScript)
{
- d()->m_injectedScript.set(globalData(), this, injectedScript);
+ m_injectedScript.set(globalData(), this, injectedScript);
}
JSObject* JSDOMGlobalObject::injectedScript() const
{
- return d()->m_injectedScript.get();
-}
-
-void JSDOMGlobalObject::destroyJSDOMGlobalObjectData(void* jsDOMGlobalObjectData)
-{
- delete static_cast<JSDOMGlobalObjectData*>(jsDOMGlobalObjectData);
+ return m_injectedScript.get();
}
JSDOMGlobalObject* toJSDOMGlobalObject(Document* document, JSC::ExecState* exec)
diff --git a/Source/WebCore/bindings/js/JSDOMGlobalObject.h b/Source/WebCore/bindings/js/JSDOMGlobalObject.h
index ac07969..1e992c5 100644
--- a/Source/WebCore/bindings/js/JSDOMGlobalObject.h
+++ b/Source/WebCore/bindings/js/JSDOMGlobalObject.h
@@ -46,11 +46,11 @@ namespace WebCore {
protected:
struct JSDOMGlobalObjectData;
- JSDOMGlobalObject(NonNullPassRefPtr<JSC::Structure>, JSDOMGlobalObjectData*, JSC::JSObject* thisValue);
+ JSDOMGlobalObject(NonNullPassRefPtr<JSC::Structure>, PassRefPtr<DOMWrapperWorld>, JSC::JSObject* thisValue);
public:
- JSDOMStructureMap& structures() { return d()->structures; }
- JSDOMConstructorMap& constructors() const { return d()->constructors; }
+ JSDOMStructureMap& structures() { return m_structures; }
+ JSDOMConstructorMap& constructors() { return m_constructors; }
virtual ScriptExecutionContext* scriptExecutionContext() const = 0;
@@ -65,47 +65,33 @@ namespace WebCore {
virtual void markChildren(JSC::MarkStack&);
- DOMWrapperWorld* world() { return d()->m_world.get(); }
+ DOMWrapperWorld* world() { return m_world.get(); }
static const JSC::ClassInfo s_info;
- static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ static PassRefPtr<JSC::Structure> createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
{
- return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
protected:
- struct JSDOMGlobalObjectData : public JSC::JSGlobalObject::JSGlobalObjectData {
- JSDOMGlobalObjectData(DOMWrapperWorld* world, Destructor destructor = destroyJSDOMGlobalObjectData)
- : JSGlobalObjectData(destructor)
- , evt(0)
- , m_world(world)
- {
- }
-
- JSDOMStructureMap structures;
- JSDOMConstructorMap constructors;
-
- Event* evt;
- RefPtr<DOMWrapperWorld> m_world;
- JSC::WriteBarrier<JSObject> m_injectedScript;
- };
-
- private:
- static void destroyJSDOMGlobalObjectData(void*);
-
- JSDOMGlobalObjectData* d() const { return static_cast<JSDOMGlobalObjectData*>(JSC::JSVariableObject::d); }
+ JSDOMStructureMap m_structures;
+ JSDOMConstructorMap m_constructors;
+
+ Event* m_currentEvent;
+ RefPtr<DOMWrapperWorld> m_world;
+ JSC::WriteBarrier<JSObject> m_injectedScript;
};
template<class ConstructorClass>
inline JSC::JSObject* getDOMConstructor(JSC::ExecState* exec, const JSDOMGlobalObject* globalObject)
{
- if (JSC::JSObject* constructor = globalObject->constructors().get(&ConstructorClass::s_info).get())
+ if (JSC::JSObject* constructor = const_cast<JSDOMGlobalObject*>(globalObject)->constructors().get(&ConstructorClass::s_info).get())
return constructor;
JSC::JSObject* constructor = new (exec) ConstructorClass(exec, const_cast<JSDOMGlobalObject*>(globalObject));
- ASSERT(!globalObject->constructors().contains(&ConstructorClass::s_info));
+ ASSERT(!const_cast<JSDOMGlobalObject*>(globalObject)->constructors().contains(&ConstructorClass::s_info));
JSC::WriteBarrier<JSC::JSObject> temp;
- globalObject->constructors().add(&ConstructorClass::s_info, temp).first->second.set(exec->globalData(), globalObject, constructor);
+ const_cast<JSDOMGlobalObject*>(globalObject)->constructors().add(&ConstructorClass::s_info, temp).first->second.set(exec->globalData(), globalObject, constructor);
return constructor;
}
diff --git a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
index df01f77..584f610 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
+++ b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
@@ -45,21 +45,16 @@ namespace WebCore {
const ClassInfo JSDOMWindowBase::s_info = { "Window", &JSDOMGlobalObject::s_info, 0, 0 };
-JSDOMWindowBase::JSDOMWindowBaseData::JSDOMWindowBaseData(PassRefPtr<DOMWindow> window, JSDOMWindowShell* shell)
- : JSDOMGlobalObjectData(shell->world(), destroyJSDOMWindowBaseData)
- , impl(window)
- , shell(shell)
-{
-}
-
JSDOMWindowBase::JSDOMWindowBase(NonNullPassRefPtr<Structure> structure, PassRefPtr<DOMWindow> window, JSDOMWindowShell* shell)
- : JSDOMGlobalObject(structure, new JSDOMWindowBaseData(window, shell), shell)
+ : JSDOMGlobalObject(structure, shell->world(), shell)
+ , m_impl(window)
+ , m_shell(shell)
{
ASSERT(inherits(&s_info));
GlobalPropertyInfo staticGlobals[] = {
GlobalPropertyInfo(Identifier(globalExec(), "document"), jsNull(), DontDelete | ReadOnly),
- GlobalPropertyInfo(Identifier(globalExec(), "window"), d()->shell, DontDelete | ReadOnly)
+ GlobalPropertyInfo(Identifier(globalExec(), "window"), m_shell, DontDelete | ReadOnly)
};
addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals));
@@ -67,19 +62,19 @@ JSDOMWindowBase::JSDOMWindowBase(NonNullPassRefPtr<Structure> structure, PassRef
void JSDOMWindowBase::updateDocument()
{
- ASSERT(d()->impl->document());
+ ASSERT(m_impl->document());
ExecState* exec = globalExec();
- symbolTablePutWithAttributes(exec->globalData(), Identifier(exec, "document"), toJS(exec, this, d()->impl->document()), DontDelete | ReadOnly);
+ symbolTablePutWithAttributes(exec->globalData(), Identifier(exec, "document"), toJS(exec, this, m_impl->document()), DontDelete | ReadOnly);
}
ScriptExecutionContext* JSDOMWindowBase::scriptExecutionContext() const
{
- return d()->impl->document();
+ return m_impl->document();
}
String JSDOMWindowBase::crossDomainAccessErrorMessage(const JSGlobalObject* other) const
{
- return d()->shell->window()->impl()->crossDomainAccessErrorMessage(asJSDOMWindow(other)->impl());
+ return m_shell->window()->impl()->crossDomainAccessErrorMessage(asJSDOMWindow(other)->impl());
}
void JSDOMWindowBase::printErrorMessage(const String& message) const
@@ -170,7 +165,7 @@ JSValue JSDOMWindowBase::toStrictThisObject(ExecState*) const
JSDOMWindowShell* JSDOMWindowBase::shell() const
{
- return d()->shell;
+ return m_shell;
}
JSGlobalData* JSDOMWindowBase::commonJSGlobalData()
@@ -190,11 +185,6 @@ JSGlobalData* JSDOMWindowBase::commonJSGlobalData()
return globalData;
}
-void JSDOMWindowBase::destroyJSDOMWindowBaseData(void* jsDOMWindowBaseData)
-{
- delete static_cast<JSDOMWindowBaseData*>(jsDOMWindowBaseData);
-}
-
// JSDOMGlobalObject* is ignored, accessing a window in any context will
// use that DOMWindow's prototype chain.
JSValue toJS(ExecState* exec, JSDOMGlobalObject*, DOMWindow* domWindow)
diff --git a/Source/WebCore/bindings/js/JSDOMWindowBase.h b/Source/WebCore/bindings/js/JSDOMWindowBase.h
index 91b4f42..bfec31c 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowBase.h
+++ b/Source/WebCore/bindings/js/JSDOMWindowBase.h
@@ -49,7 +49,7 @@ namespace WebCore {
public:
void updateDocument();
- DOMWindow* impl() const { return d()->impl.get(); }
+ DOMWindow* impl() const { return m_impl.get(); }
virtual ScriptExecutionContext* scriptExecutionContext() const;
// Called just before removing this window from the JSDOMWindowShell.
@@ -57,9 +57,9 @@ namespace WebCore {
static const JSC::ClassInfo s_info;
- static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ static PassRefPtr<JSC::Structure> createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
{
- return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
virtual JSC::ExecState* globalExec();
@@ -82,19 +82,11 @@ namespace WebCore {
static JSC::JSGlobalData* commonJSGlobalData();
private:
- struct JSDOMWindowBaseData : public JSDOMGlobalObjectData {
- JSDOMWindowBaseData(PassRefPtr<DOMWindow> window, JSDOMWindowShell* shell);
-
- RefPtr<DOMWindow> impl;
- JSDOMWindowShell* shell;
- };
+ RefPtr<DOMWindow> m_impl;
+ JSDOMWindowShell* m_shell;
bool allowsAccessFromPrivate(const JSC::JSGlobalObject*) const;
String crossDomainAccessErrorMessage(const JSC::JSGlobalObject*) const;
-
- static void destroyJSDOMWindowBaseData(void*);
-
- JSDOMWindowBaseData* d() const { return static_cast<JSDOMWindowBaseData*>(JSC::JSVariableObject::d); }
};
// Returns a JSDOMWindow or jsNull()
diff --git a/Source/WebCore/bindings/js/JSDOMWindowCustom.h b/Source/WebCore/bindings/js/JSDOMWindowCustom.h
index a0e1b8f..a8d5a91 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowCustom.h
+++ b/Source/WebCore/bindings/js/JSDOMWindowCustom.h
@@ -67,7 +67,7 @@ inline bool JSDOMWindowBase::allowsAccessFrom(JSC::ExecState* exec, String& mess
ALWAYS_INLINE bool JSDOMWindowBase::allowsAccessFromPrivate(const JSGlobalObject* other) const
{
const JSDOMWindow* originWindow = asJSDOMWindow(other);
- const JSDOMWindow* targetWindow = d()->shell->window();
+ const JSDOMWindow* targetWindow = m_shell->window();
if (originWindow == targetWindow)
return true;
diff --git a/Source/WebCore/bindings/js/JSDOMWindowShell.cpp b/Source/WebCore/bindings/js/JSDOMWindowShell.cpp
index a4cc777..817e9c0 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowShell.cpp
+++ b/Source/WebCore/bindings/js/JSDOMWindowShell.cpp
@@ -44,7 +44,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSDOMWindowShell);
const ClassInfo JSDOMWindowShell::s_info = { "JSDOMWindowShell", &Base::s_info, 0, 0 };
JSDOMWindowShell::JSDOMWindowShell(PassRefPtr<DOMWindow> window, DOMWrapperWorld* world)
- : Base(JSDOMWindowShell::createStructure(jsNull()))
+ : Base(JSDOMWindowShell::createStructure(*world->globalData(), jsNull()))
, m_world(world)
{
ASSERT(inherits(&s_info));
@@ -60,10 +60,10 @@ void JSDOMWindowShell::setWindow(PassRefPtr<DOMWindow> domWindow)
// Explicitly protect the global object's prototype so it isn't collected
// when we allocate the global object. (Once the global object is fully
// constructed, it can mark its own prototype.)
- RefPtr<Structure> prototypeStructure = JSDOMWindowPrototype::createStructure(jsNull());
+ RefPtr<Structure> prototypeStructure = JSDOMWindowPrototype::createStructure(*JSDOMWindow::commonJSGlobalData(), jsNull());
Global<JSDOMWindowPrototype> prototype(*JSDOMWindow::commonJSGlobalData(), new JSDOMWindowPrototype(0, prototypeStructure.release()));
- RefPtr<Structure> structure = JSDOMWindow::createStructure(prototype.get());
+ RefPtr<Structure> structure = JSDOMWindow::createStructure(*JSDOMWindow::commonJSGlobalData(), prototype.get());
JSDOMWindow* jsDOMWindow = new (JSDOMWindow::commonJSGlobalData()) JSDOMWindow(structure.release(), domWindow, this);
prototype->putAnonymousValue(*JSDOMWindow::commonJSGlobalData(), 0, jsDOMWindow);
setWindow(*JSDOMWindow::commonJSGlobalData(), jsDOMWindow);
diff --git a/Source/WebCore/bindings/js/JSDOMWindowShell.h b/Source/WebCore/bindings/js/JSDOMWindowShell.h
index 06dd1ff..4307c1c 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowShell.h
+++ b/Source/WebCore/bindings/js/JSDOMWindowShell.h
@@ -58,9 +58,9 @@ namespace WebCore {
void* operator new(size_t);
- static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ static PassRefPtr<JSC::Structure> createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
{
- return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
DOMWrapperWorld* world() { return m_world.get(); }
diff --git a/Source/WebCore/bindings/js/JSDOMWrapper.cpp b/Source/WebCore/bindings/js/JSDOMWrapper.cpp
index 794f039..c91230b 100644
--- a/Source/WebCore/bindings/js/JSDOMWrapper.cpp
+++ b/Source/WebCore/bindings/js/JSDOMWrapper.cpp
@@ -40,10 +40,4 @@ DOMObject::~DOMObject()
#endif
-bool DOMObject::defineOwnProperty(ExecState* exec, const Identifier&, PropertyDescriptor&, bool)
-{
- throwError(exec, createTypeError(exec, "defineProperty is not supported on DOM Objects"));
- return false;
-}
-
} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/JSDOMWrapper.h b/Source/WebCore/bindings/js/JSDOMWrapper.h
index 2d09f01..0f8031c 100644
--- a/Source/WebCore/bindings/js/JSDOMWrapper.h
+++ b/Source/WebCore/bindings/js/JSDOMWrapper.h
@@ -34,8 +34,6 @@ protected:
{
}
- virtual bool defineOwnProperty(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&, bool);
-
#ifndef NDEBUG
virtual ~DOMObject();
#endif
diff --git a/Source/WebCore/bindings/js/JSErrorHandler.cpp b/Source/WebCore/bindings/js/JSErrorHandler.cpp
index ae8e363..3d916e6 100644
--- a/Source/WebCore/bindings/js/JSErrorHandler.cpp
+++ b/Source/WebCore/bindings/js/JSErrorHandler.cpp
@@ -88,7 +88,7 @@ void JSErrorHandler::handleEvent(ScriptExecutionContext* scriptExecutionContext,
args.append(jsNumber(errorEvent->lineno()));
JSGlobalData& globalData = globalObject->globalData();
- DynamicGlobalObjectScope globalObjectScope(exec, globalData.dynamicGlobalObject ? globalData.dynamicGlobalObject : globalObject);
+ DynamicGlobalObjectScope globalObjectScope(globalData, globalData.dynamicGlobalObject ? globalData.dynamicGlobalObject : globalObject);
JSValue thisValue = globalObject->toThisObject(exec);
diff --git a/Source/WebCore/bindings/js/JSEventListener.cpp b/Source/WebCore/bindings/js/JSEventListener.cpp
index 90a164b..e444d88 100644
--- a/Source/WebCore/bindings/js/JSEventListener.cpp
+++ b/Source/WebCore/bindings/js/JSEventListener.cpp
@@ -108,7 +108,7 @@ void JSEventListener::handleEvent(ScriptExecutionContext* scriptExecutionContext
globalObject->setCurrentEvent(event);
JSGlobalData& globalData = globalObject->globalData();
- DynamicGlobalObjectScope globalObjectScope(exec, globalData.dynamicGlobalObject ? globalData.dynamicGlobalObject : globalObject);
+ DynamicGlobalObjectScope globalObjectScope(globalData, globalData.dynamicGlobalObject ? globalData.dynamicGlobalObject : globalObject);
globalData.timeoutChecker.start();
JSValue retval;
diff --git a/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
index 84dd72e..72aec4b 100644
--- a/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
+++ b/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
@@ -76,6 +76,9 @@ JSValue JSHTMLCanvasElement::getContext(ExecState* exec)
Identifier premultipliedAlpha(exec, "premultipliedAlpha");
if (jsAttrs->hasProperty(exec, premultipliedAlpha))
webGLAttrs->setPremultipliedAlpha(jsAttrs->get(exec, premultipliedAlpha).toBoolean(exec));
+ Identifier preserveDrawingBuffer(exec, "preserveDrawingBuffer");
+ if (jsAttrs->hasProperty(exec, preserveDrawingBuffer))
+ webGLAttrs->setPreserveDrawingBuffer(jsAttrs->get(exec, preserveDrawingBuffer).toBoolean(exec));
}
}
#endif
diff --git a/Source/WebCore/bindings/js/JSImageConstructor.cpp b/Source/WebCore/bindings/js/JSImageConstructor.cpp
index 1ddf136..be75af0 100644
--- a/Source/WebCore/bindings/js/JSImageConstructor.cpp
+++ b/Source/WebCore/bindings/js/JSImageConstructor.cpp
@@ -35,7 +35,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSImageConstructor);
const ClassInfo JSImageConstructor::s_info = { "ImageConstructor", &DOMConstructorWithDocument::s_info, 0, 0 };
JSImageConstructor::JSImageConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
- : DOMConstructorWithDocument(JSImageConstructor::createStructure(globalObject->objectPrototype()), globalObject)
+ : DOMConstructorWithDocument(JSImageConstructor::createStructure(globalObject->globalData(), globalObject->objectPrototype()), globalObject)
{
ASSERT(inherits(&s_info));
putDirect(exec->globalData(), exec->propertyNames().prototype, JSHTMLImageElementPrototype::self(exec, globalObject), None);
diff --git a/Source/WebCore/bindings/js/JSImageConstructor.h b/Source/WebCore/bindings/js/JSImageConstructor.h
index 73293c7..654e223 100644
--- a/Source/WebCore/bindings/js/JSImageConstructor.h
+++ b/Source/WebCore/bindings/js/JSImageConstructor.h
@@ -29,9 +29,9 @@ namespace WebCore {
public:
JSImageConstructor(JSC::ExecState*, JSDOMGlobalObject*);
- static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ static PassRefPtr<JSC::Structure> createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
{
- return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
static const JSC::ClassInfo s_info;
diff --git a/Source/WebCore/bindings/js/JSImageDataCustom.cpp b/Source/WebCore/bindings/js/JSImageDataCustom.cpp
index b5592d8..a92ed47 100644
--- a/Source/WebCore/bindings/js/JSImageDataCustom.cpp
+++ b/Source/WebCore/bindings/js/JSImageDataCustom.cpp
@@ -48,7 +48,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, ImageData* imageD
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, ImageData, imageData);
Identifier dataName(exec, "data");
static const ClassInfo cpaClassInfo = { "CanvasPixelArray", &JSByteArray::Base::s_info, 0, 0 };
- DEFINE_STATIC_LOCAL(RefPtr<Structure>, cpaStructure, (JSByteArray::createStructure(jsNull(), &cpaClassInfo)));
+ DEFINE_STATIC_LOCAL(RefPtr<Structure>, cpaStructure, (JSByteArray::createStructure(exec->globalData(), jsNull(), &cpaClassInfo)));
wrapper->putDirect(exec->globalData(), dataName, new (exec) JSByteArray(exec, cpaStructure, imageData->data()->data()), DontDelete | ReadOnly);
exec->heap()->reportExtraMemoryCost(imageData->data()->length());
diff --git a/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
index bc1d877..d56251f 100644
--- a/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
+++ b/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2010-2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -35,37 +35,21 @@
#if ENABLE(INSPECTOR)
-#include "Console.h"
-#include "JSMainThreadExecState.h"
#if ENABLE(DATABASE)
#include "Database.h"
#include "JSDatabase.h"
#endif
#include "ExceptionCode.h"
-#include "Frame.h"
-#include "FrameLoader.h"
-#include "InjectedScript.h"
#include "InjectedScriptHost.h"
-#include "InspectorAgent.h"
+#include "InspectorDebuggerAgent.h"
#include "InspectorValues.h"
-#include "JSDOMWindow.h"
-#include "JSDOMWindowCustom.h"
#include "JSNode.h"
-#include "JSRange.h"
-#include "Node.h"
-#include "Page.h"
#include "ScriptValue.h"
#if ENABLE(DOM_STORAGE)
#include "Storage.h"
#include "JSStorage.h"
#endif
-#include "TextIterator.h"
-#include "VisiblePosition.h"
-#include <parser/SourceCode.h>
-#include <runtime/JSArray.h>
#include <runtime/JSLock.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
#if ENABLE(JAVASCRIPT_DEBUGGER)
#include "JavaScriptCallFrame.h"
@@ -89,41 +73,10 @@ ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* state, Node* node
return ScriptValue(state->globalData(), toJS(state, node));
}
-ScriptObject InjectedScriptHost::createInjectedScript(const String& source, ScriptState* scriptState, long id)
-{
- SourceCode sourceCode = makeSource(stringToUString(source));
- JSLock lock(SilenceAssertionsOnly);
- JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
- JSValue globalThisValue = scriptState->globalThisValue();
- Completion comp = JSMainThreadExecState::evaluate(scriptState, globalObject->globalScopeChain(), sourceCode, globalThisValue);
- if (comp.complType() != JSC::Normal && comp.complType() != JSC::ReturnValue)
- return ScriptObject();
- JSValue functionValue = comp.value();
- CallData callData;
- CallType callType = getCallData(functionValue, callData);
- if (callType == CallTypeNone)
- return ScriptObject();
-
- MarkedArgumentBuffer args;
- args.append(toJS(scriptState, globalObject, this));
- args.append(globalThisValue);
- args.append(jsNumber(id));
- JSValue result = JSC::call(scriptState, functionValue, callType, callData, globalThisValue, args);
- if (result.isObject())
- return ScriptObject(scriptState, result.getObject());
- return ScriptObject();
-}
-
-void InjectedScriptHost::discardInjectedScript(ScriptState* scriptState)
-{
- JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
- globalObject->setInjectedScript(0);
-}
-
JSValue JSInjectedScriptHost::currentCallFrame(ExecState* exec)
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
- JavaScriptCallFrame* callFrame = ScriptDebugServer::shared().currentCallFrame();
+ JavaScriptCallFrame* callFrame = impl()->debuggerAgent()->scriptDebugServer().currentCallFrame();
if (!callFrame || !callFrame->isValid())
return jsUndefined();
@@ -160,9 +113,9 @@ JSValue JSInjectedScriptHost::internalConstructorName(ExecState* exec)
JSValue JSInjectedScriptHost::inspect(ExecState* exec)
{
if (exec->argumentCount() >= 2) {
- ScriptValue objectId(exec->globalData(), exec->argument(0));
+ ScriptValue object(exec->globalData(), exec->argument(0));
ScriptValue hints(exec->globalData(), exec->argument(1));
- impl()->inspectImpl(objectId.toInspectorValue(exec), hints.toInspectorValue(exec));
+ impl()->inspectImpl(object.toInspectorValue(exec), hints.toInspectorValue(exec));
}
return jsUndefined();
}
@@ -191,33 +144,6 @@ JSValue JSInjectedScriptHost::storageId(ExecState* exec)
return jsUndefined();
}
-InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState* scriptState)
-{
- JSLock lock(SilenceAssertionsOnly);
- JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
- JSObject* injectedScript = globalObject->injectedScript();
- if (injectedScript)
- return InjectedScript(ScriptObject(scriptState, injectedScript));
-
- if (!canAccessInspectedWindow(scriptState))
- return InjectedScript();
-
- pair<long, ScriptObject> injectedScriptObject = injectScript(injectedScriptSource(), scriptState);
- globalObject->setInjectedScript(injectedScriptObject.second.jsObject());
- InjectedScript result(injectedScriptObject.second);
- m_idToInjectedScript.set(injectedScriptObject.first, result);
- return result;
-}
-
-bool InjectedScriptHost::canAccessInspectedWindow(ScriptState* scriptState)
-{
- JSLock lock(SilenceAssertionsOnly);
- JSDOMWindow* inspectedWindow = toJSDOMWindow(scriptState->lexicalGlobalObject());
- if (!inspectedWindow)
- return false;
- return inspectedWindow->allowsAccessFromNoErrorMessage(scriptState);
-}
-
} // namespace WebCore
#endif // ENABLE(INSPECTOR)
diff --git a/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp b/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp
new file mode 100644
index 0000000..1843cd2
--- /dev/null
+++ b/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
+ * Copyright (C) 2010-2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InjectedScriptManager.h"
+
+#if ENABLE(INSPECTOR)
+
+#include "ExceptionCode.h"
+#include "InjectedScript.h"
+#include "JSDOMWindow.h"
+#include "JSDOMWindowCustom.h"
+#include "JSInjectedScriptHost.h"
+#include "JSMainThreadExecState.h"
+#include <parser/SourceCode.h>
+#include <runtime/JSLock.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+ScriptObject InjectedScriptManager::createInjectedScript(const String& source, ScriptState* scriptState, long id)
+{
+ SourceCode sourceCode = makeSource(stringToUString(source));
+ JSLock lock(SilenceAssertionsOnly);
+ JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
+ JSValue globalThisValue = scriptState->globalThisValue();
+ Completion comp = JSMainThreadExecState::evaluate(scriptState, globalObject->globalScopeChain(), sourceCode, globalThisValue);
+ if (comp.complType() != JSC::Normal && comp.complType() != JSC::ReturnValue)
+ return ScriptObject();
+ JSValue functionValue = comp.value();
+ CallData callData;
+ CallType callType = getCallData(functionValue, callData);
+ if (callType == CallTypeNone)
+ return ScriptObject();
+
+ MarkedArgumentBuffer args;
+ args.append(toJS(scriptState, globalObject, m_injectedScriptHost.get()));
+ args.append(globalThisValue);
+ args.append(jsNumber(id));
+ JSValue result = JSC::call(scriptState, functionValue, callType, callData, globalThisValue, args);
+ if (result.isObject())
+ return ScriptObject(scriptState, result.getObject());
+ return ScriptObject();
+}
+
+void InjectedScriptManager::discardInjectedScript(ScriptState* scriptState)
+{
+ JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
+ globalObject->setInjectedScript(0);
+}
+
+InjectedScript InjectedScriptManager::injectedScriptFor(ScriptState* scriptState)
+{
+ JSLock lock(SilenceAssertionsOnly);
+ JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
+ JSObject* injectedScript = globalObject->injectedScript();
+ if (injectedScript)
+ return InjectedScript(ScriptObject(scriptState, injectedScript));
+
+ if (!canAccessInspectedWindow(scriptState))
+ return InjectedScript();
+
+ pair<long, ScriptObject> injectedScriptObject = injectScript(injectedScriptSource(), scriptState);
+ globalObject->setInjectedScript(injectedScriptObject.second.jsObject());
+ InjectedScript result(injectedScriptObject.second);
+ m_idToInjectedScript.set(injectedScriptObject.first, result);
+ return result;
+}
+
+bool InjectedScriptManager::canAccessInspectedWindow(ScriptState* scriptState)
+{
+ JSLock lock(SilenceAssertionsOnly);
+ JSDOMWindow* inspectedWindow = toJSDOMWindow(scriptState->lexicalGlobalObject());
+ if (!inspectedWindow)
+ return false;
+ return inspectedWindow->allowsAccessFromNoErrorMessage(scriptState);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR)
diff --git a/Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp b/Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp
index e493508..e477a50 100644
--- a/Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp
+++ b/Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp
@@ -49,7 +49,7 @@ JSValue JSJavaScriptCallFrame::evaluate(ExecState* exec)
JSValue JSJavaScriptCallFrame::thisObject(ExecState*) const
{
- return impl()->thisObject() ? impl()->thisObject() : jsNull();
+ return impl()->thisObject() ? JSValue(impl()->thisObject()) : jsNull();
}
JSValue JSJavaScriptCallFrame::type(ExecState* exec) const
diff --git a/Source/WebCore/bindings/js/JSLazyEventListener.cpp b/Source/WebCore/bindings/js/JSLazyEventListener.cpp
index 98db97a..5b17727 100644
--- a/Source/WebCore/bindings/js/JSLazyEventListener.cpp
+++ b/Source/WebCore/bindings/js/JSLazyEventListener.cpp
@@ -20,6 +20,7 @@
#include "config.h"
#include "JSLazyEventListener.h"
+#include "ContentSecurityPolicy.h"
#include "Frame.h"
#include "JSNode.h"
#include <runtime/FunctionConstructor.h>
@@ -74,36 +75,29 @@ JSObject* JSLazyEventListener::initializeJSFunction(ScriptExecutionContext* exec
if (!executionContext)
return 0;
- Frame* frame = static_cast<Document*>(executionContext)->frame();
- if (!frame)
+ Document* document = static_cast<Document*>(executionContext);
+
+ if (!document->frame())
+ return 0;
+
+ if (!document->contentSecurityPolicy()->allowInlineEventHandlers())
return 0;
- ScriptController* scriptController = frame->script();
- if (!scriptController->canExecuteScripts(AboutToExecuteScript))
+ ScriptController* script = document->frame()->script();
+ if (!script->canExecuteScripts(AboutToExecuteScript) || script->isPaused())
return 0;
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(executionContext, isolatedWorld());
if (!globalObject)
return 0;
- if (executionContext->isDocument()) {
- JSDOMWindow* window = static_cast<JSDOMWindow*>(globalObject);
- Frame* frame = window->impl()->frame();
- if (!frame)
- return 0;
- // FIXME: Is this check needed for non-Document contexts?
- ScriptController* script = frame->script();
- if (!script->canExecuteScripts(AboutToExecuteScript) || script->isPaused())
- return 0;
- }
-
ExecState* exec = globalObject->globalExec();
MarkedArgumentBuffer args;
args.append(jsNontrivialString(exec, stringToUString(m_eventParameterName)));
args.append(jsString(exec, m_code));
- JSObject* jsFunction = constructFunction(exec, args, Identifier(exec, stringToUString(m_functionName)), stringToUString(m_sourceURL), m_lineNumber); // FIXME: is globalExec ok?
+ JSObject* jsFunction = constructFunction(exec, exec->lexicalGlobalObject(), args, Identifier(exec, stringToUString(m_functionName)), stringToUString(m_sourceURL), m_lineNumber); // FIXME: is globalExec ok?
if (exec->hadException()) {
exec->clearException();
return 0;
diff --git a/Source/WebCore/bindings/js/JSMainThreadExecState.h b/Source/WebCore/bindings/js/JSMainThreadExecState.h
index fb01000..436de5e 100644
--- a/Source/WebCore/bindings/js/JSMainThreadExecState.h
+++ b/Source/WebCore/bindings/js/JSMainThreadExecState.h
@@ -26,7 +26,7 @@
#ifndef JSMainThreadExecState_h
#define JSMainThreadExecState_h
-#include <JSDOMBinding.h>
+#include "JSDOMBinding.h"
#ifndef NDEBUG
#include <wtf/MainThread.h>
#endif
diff --git a/Source/WebCore/bindings/js/JSOptionConstructor.cpp b/Source/WebCore/bindings/js/JSOptionConstructor.cpp
index a3c9aab..59e0b6a 100644
--- a/Source/WebCore/bindings/js/JSOptionConstructor.cpp
+++ b/Source/WebCore/bindings/js/JSOptionConstructor.cpp
@@ -36,7 +36,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSOptionConstructor);
const ClassInfo JSOptionConstructor::s_info = { "OptionConstructor", &DOMConstructorWithDocument::s_info, 0, 0 };
JSOptionConstructor::JSOptionConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
- : DOMConstructorWithDocument(JSOptionConstructor::createStructure(globalObject->objectPrototype()), globalObject)
+ : DOMConstructorWithDocument(JSOptionConstructor::createStructure(globalObject->globalData(), globalObject->objectPrototype()), globalObject)
{
ASSERT(inherits(&s_info));
putDirect(exec->globalData(), exec->propertyNames().prototype, JSHTMLOptionElementPrototype::self(exec, globalObject), None);
diff --git a/Source/WebCore/bindings/js/JSOptionConstructor.h b/Source/WebCore/bindings/js/JSOptionConstructor.h
index 03633c7..8a18007 100644
--- a/Source/WebCore/bindings/js/JSOptionConstructor.h
+++ b/Source/WebCore/bindings/js/JSOptionConstructor.h
@@ -30,9 +30,9 @@ namespace WebCore {
public:
JSOptionConstructor(JSC::ExecState*, JSDOMGlobalObject*);
- static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ static PassRefPtr<JSC::Structure> createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
{
- return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
static const JSC::ClassInfo s_info;
diff --git a/Source/WebCore/bindings/js/JSWebKitAnimationCustom.cpp b/Source/WebCore/bindings/js/JSWebKitAnimationCustom.cpp
new file mode 100644
index 0000000..8425c4c
--- /dev/null
+++ b/Source/WebCore/bindings/js/JSWebKitAnimationCustom.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All right reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSWebKitAnimation.h"
+
+#include "WebKitAnimation.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+JSValue JSWebKitAnimation::iterationCount(ExecState*) const
+{
+ WebKitAnimation* imp = impl();
+ int count = imp->iterationCount();
+ if (count == Animation::IterationCountInfinite)
+ return jsNumber(std::numeric_limits<float>::infinity());
+ return jsNumber(count);
+}
+
+}
diff --git a/Source/WebCore/bindings/js/JSWebKitAnimationListCustom.cpp b/Source/WebCore/bindings/js/JSWebKitAnimationListCustom.cpp
new file mode 100644
index 0000000..eaf77cf
--- /dev/null
+++ b/Source/WebCore/bindings/js/JSWebKitAnimationListCustom.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All right reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSWebKitAnimationList.h"
+
+#include "WebKitAnimationList.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSWebKitAnimationList::markChildren(MarkStack& markStack)
+{
+ Base::markChildren(markStack);
+
+ WebKitAnimationList* list = impl();
+ JSGlobalData& globalData = *Heap::heap(this)->globalData();
+
+ unsigned length = list->length();
+ for (unsigned i = 0; i < length; ++i)
+ markDOMObjectWrapper(markStack, globalData, list->item(i));
+}
+
+}
diff --git a/Source/WebCore/bindings/js/JSWorkerContextBase.cpp b/Source/WebCore/bindings/js/JSWorkerContextBase.cpp
index 88fa43f..c6f86b5 100644
--- a/Source/WebCore/bindings/js/JSWorkerContextBase.cpp
+++ b/Source/WebCore/bindings/js/JSWorkerContextBase.cpp
@@ -45,7 +45,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSWorkerContextBase);
const ClassInfo JSWorkerContextBase::s_info = { "WorkerContext", &JSDOMGlobalObject::s_info, 0, 0 };
JSWorkerContextBase::JSWorkerContextBase(NonNullPassRefPtr<JSC::Structure> structure, PassRefPtr<WorkerContext> impl)
- : JSDOMGlobalObject(structure, new JSDOMGlobalObjectData(normalWorld(*impl->script()->globalData())), this)
+ : JSDOMGlobalObject(structure, normalWorld(*impl->script()->globalData()), this)
, m_impl(impl)
{
ASSERT(inherits(&s_info));
diff --git a/Source/WebCore/bindings/js/JSWorkerContextBase.h b/Source/WebCore/bindings/js/JSWorkerContextBase.h
index 99948b7..b9c234a 100644
--- a/Source/WebCore/bindings/js/JSWorkerContextBase.h
+++ b/Source/WebCore/bindings/js/JSWorkerContextBase.h
@@ -49,9 +49,9 @@ namespace WebCore {
WorkerContext* impl() const { return m_impl.get(); }
virtual ScriptExecutionContext* scriptExecutionContext() const;
- static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ static PassRefPtr<JSC::Structure> createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
{
- return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
private:
diff --git a/Source/WebCore/bindings/js/PageScriptDebugServer.cpp b/Source/WebCore/bindings/js/PageScriptDebugServer.cpp
new file mode 100755
index 0000000..3d9cb9d
--- /dev/null
+++ b/Source/WebCore/bindings/js/PageScriptDebugServer.cpp
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PageScriptDebugServer.h"
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+
+#include "Frame.h"
+#include "FrameView.h"
+#include "JSDOMWindowCustom.h"
+#include "Page.h"
+#include "PageGroup.h"
+#include "PluginView.h"
+#include "ScriptDebugListener.h"
+#include "Widget.h"
+#include <runtime/JSLock.h>
+#include <wtf/MainThread.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/StdLibExtras.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+static Page* toPage(JSGlobalObject* globalObject)
+{
+ ASSERT_ARG(globalObject, globalObject);
+
+ JSDOMWindow* window = asJSDOMWindow(globalObject);
+ Frame* frame = window->impl()->frame();
+ return frame ? frame->page() : 0;
+}
+
+PageScriptDebugServer& PageScriptDebugServer::shared()
+{
+ DEFINE_STATIC_LOCAL(PageScriptDebugServer, server, ());
+ return server;
+}
+
+PageScriptDebugServer::PageScriptDebugServer()
+ : ScriptDebugServer()
+{
+}
+
+PageScriptDebugServer::~PageScriptDebugServer()
+{
+ deleteAllValues(m_pageListenersMap);
+}
+
+void PageScriptDebugServer::addListener(ScriptDebugListener* listener, Page* page)
+{
+ ASSERT_ARG(listener, listener);
+ ASSERT_ARG(page, page);
+
+ pair<PageListenersMap::iterator, bool> result = m_pageListenersMap.add(page, 0);
+ if (result.second)
+ result.first->second = new ListenerSet;
+
+ ListenerSet* listeners = result.first->second;
+ listeners->add(listener);
+
+ recompileAllJSFunctionsSoon();
+ page->setDebugger(this);
+}
+
+void PageScriptDebugServer::removeListener(ScriptDebugListener* listener, Page* page)
+{
+ ASSERT_ARG(listener, listener);
+ ASSERT_ARG(page, page);
+
+ PageListenersMap::iterator it = m_pageListenersMap.find(page);
+ if (it == m_pageListenersMap.end())
+ return;
+
+ ListenerSet* listeners = it->second;
+ listeners->remove(listener);
+ if (listeners->isEmpty()) {
+ m_pageListenersMap.remove(it);
+ delete listeners;
+ didRemoveLastListener(page);
+ }
+}
+
+void PageScriptDebugServer::recompileAllJSFunctions(Timer<ScriptDebugServer>*)
+{
+ JSLock lock(SilenceAssertionsOnly);
+ // If JavaScript stack is not empty postpone recompilation.
+ if (JSDOMWindow::commonJSGlobalData()->dynamicGlobalObject)
+ recompileAllJSFunctionsSoon();
+ else
+ Debugger::recompileAllJSFunctions(JSDOMWindow::commonJSGlobalData());
+}
+
+ScriptDebugServer::ListenerSet* PageScriptDebugServer::getListenersForGlobalObject(JSGlobalObject* globalObject)
+{
+ Page* page = toPage(globalObject);
+ if (!page)
+ return 0;
+ return m_pageListenersMap.get(page);
+}
+
+void PageScriptDebugServer::didPause(JSC::JSGlobalObject* globalObject)
+{
+ Page* page = toPage(globalObject);
+ m_pausedPage = page;
+ setJavaScriptPaused(page->group(), true);
+}
+
+void PageScriptDebugServer::didContinue(JSC::JSGlobalObject* globalObject)
+{
+ Page* page = toPage(globalObject);
+ m_pausedPage = 0;
+ setJavaScriptPaused(page->group(), false);
+}
+
+void PageScriptDebugServer::didRemoveLastListener(Page* page)
+{
+ if (m_pausedPage == page)
+ m_doneProcessingDebuggerEvents = true;
+
+ recompileAllJSFunctionsSoon();
+ page->setDebugger(0);
+}
+
+void PageScriptDebugServer::setJavaScriptPaused(const PageGroup& pageGroup, bool paused)
+{
+ setMainThreadCallbacksPaused(paused);
+
+ const HashSet<Page*>& pages = pageGroup.pages();
+
+ HashSet<Page*>::const_iterator end = pages.end();
+ for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it)
+ setJavaScriptPaused(*it, paused);
+}
+
+void PageScriptDebugServer::setJavaScriptPaused(Page* page, bool paused)
+{
+ ASSERT_ARG(page, page);
+
+ page->setDefersLoading(paused);
+
+ for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
+ setJavaScriptPaused(frame, paused);
+}
+
+void PageScriptDebugServer::setJavaScriptPaused(Frame* frame, bool paused)
+{
+ ASSERT_ARG(frame, frame);
+
+ if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript))
+ return;
+
+ frame->script()->setPaused(paused);
+
+ Document* document = frame->document();
+ if (paused) {
+ document->suspendScriptedAnimationControllerCallbacks();
+ document->suspendActiveDOMObjects(ActiveDOMObject::JavaScriptDebuggerPaused);
+ } else {
+ document->resumeActiveDOMObjects();
+ document->resumeScriptedAnimationControllerCallbacks();
+ }
+
+ setJavaScriptPaused(frame->view(), paused);
+}
+
+void PageScriptDebugServer::setJavaScriptPaused(FrameView* view, bool paused)
+{
+ if (!view)
+ return;
+
+ const HashSet<RefPtr<Widget> >* children = view->children();
+ ASSERT(children);
+
+ HashSet<RefPtr<Widget> >::const_iterator end = children->end();
+ for (HashSet<RefPtr<Widget> >::const_iterator it = children->begin(); it != end; ++it) {
+ Widget* widget = (*it).get();
+ if (!widget->isPluginView())
+ continue;
+ static_cast<PluginView*>(widget)->setJavaScriptPaused(paused);
+ }
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER)
diff --git a/Source/WebCore/bindings/js/PageScriptDebugServer.h b/Source/WebCore/bindings/js/PageScriptDebugServer.h
new file mode 100755
index 0000000..5563e26
--- /dev/null
+++ b/Source/WebCore/bindings/js/PageScriptDebugServer.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PageScriptDebugServer_h
+#define PageScriptDebugServer_h
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+
+#include "ScriptDebugServer.h"
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class Frame;
+class FrameView;
+class Page;
+class PageGroup;
+
+class PageScriptDebugServer : public ScriptDebugServer {
+ WTF_MAKE_NONCOPYABLE(PageScriptDebugServer);
+public:
+ static PageScriptDebugServer& shared();
+
+ void addListener(ScriptDebugListener*, Page*);
+ void removeListener(ScriptDebugListener*, Page*);
+
+ virtual void recompileAllJSFunctions(Timer<ScriptDebugServer>*);
+
+private:
+ typedef HashMap<Page*, ListenerSet*> PageListenersMap;
+
+ PageScriptDebugServer();
+ virtual ~PageScriptDebugServer();
+
+ virtual ListenerSet* getListenersForGlobalObject(JSC::JSGlobalObject*);
+ virtual void didPause(JSC::JSGlobalObject*);
+ virtual void didContinue(JSC::JSGlobalObject*);
+
+ void didRemoveLastListener(Page*);
+
+ void setJavaScriptPaused(const PageGroup&, bool paused);
+ void setJavaScriptPaused(Page*, bool paused);
+ void setJavaScriptPaused(Frame*, bool paused);
+ void setJavaScriptPaused(FrameView*, bool paused);
+
+ PageListenersMap m_pageListenersMap;
+ Page* m_pausedPage;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER)
+
+#endif // PageScriptDebugServer_h
diff --git a/Source/WebCore/bindings/js/ScheduledAction.h b/Source/WebCore/bindings/js/ScheduledAction.h
index c4b3edf..3adc185 100644
--- a/Source/WebCore/bindings/js/ScheduledAction.h
+++ b/Source/WebCore/bindings/js/ScheduledAction.h
@@ -20,8 +20,8 @@
#ifndef ScheduledAction_h
#define ScheduledAction_h
+#include "JSDOMBinding.h"
#include "PlatformString.h"
-#include <JSDOMBinding.h>
#include <collector/handles/Global.h>
#include <runtime/JSCell.h>
#include <wtf/PassOwnPtr.h>
diff --git a/Source/WebCore/bindings/js/ScriptDebugServer.cpp b/Source/WebCore/bindings/js/ScriptDebugServer.cpp
index 32a3b2d..05c0f2c 100644
--- a/Source/WebCore/bindings/js/ScriptDebugServer.cpp
+++ b/Source/WebCore/bindings/js/ScriptDebugServer.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2010-2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,45 +32,27 @@
#if ENABLE(JAVASCRIPT_DEBUGGER)
-#include "DOMWindow.h"
#include "EventLoop.h"
#include "Frame.h"
-#include "FrameTree.h"
-#include "FrameView.h"
-#include "JSDOMWindowCustom.h"
#include "JavaScriptCallFrame.h"
-#include "Page.h"
-#include "PageGroup.h"
-#include "PluginView.h"
#include "ScriptBreakpoint.h"
#include "ScriptController.h"
#include "ScriptDebugListener.h"
-#include "ScrollView.h"
-#include "Widget.h"
#include <debugger/DebuggerCallFrame.h>
#include <parser/SourceProvider.h>
#include <runtime/JSLock.h>
#include <wtf/text/StringConcatenate.h>
#include <wtf/MainThread.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/UnusedParam.h>
using namespace JSC;
namespace WebCore {
-ScriptDebugServer& ScriptDebugServer::shared()
-{
- DEFINE_STATIC_LOCAL(ScriptDebugServer, server, ());
- return server;
-}
-
ScriptDebugServer::ScriptDebugServer()
: m_callingListeners(false)
, m_pauseOnExceptionsState(DontPauseOnExceptions)
, m_pauseOnNextStatement(false)
, m_paused(false)
- , m_pausedPage(0)
, m_doneProcessingDebuggerEvents(true)
, m_breakpointsActivated(true)
, m_pauseOnCallFrame(0)
@@ -83,47 +65,6 @@ ScriptDebugServer::~ScriptDebugServer()
deleteAllValues(m_pageListenersMap);
}
-void ScriptDebugServer::addListener(ScriptDebugListener* listener, Page* page)
-{
- ASSERT_ARG(listener, listener);
- ASSERT_ARG(page, page);
-
- pair<PageListenersMap::iterator, bool> result = m_pageListenersMap.add(page, 0);
- if (result.second)
- result.first->second = new ListenerSet;
-
- ListenerSet* listeners = result.first->second;
- listeners->add(listener);
-
- didAddListener(page);
-}
-
-void ScriptDebugServer::removeListener(ScriptDebugListener* listener, Page* page)
-{
- ASSERT_ARG(listener, listener);
- ASSERT_ARG(page, page);
-
- PageListenersMap::iterator it = m_pageListenersMap.find(page);
- if (it == m_pageListenersMap.end())
- return;
-
- ListenerSet* listeners = it->second;
- listeners->remove(listener);
- if (listeners->isEmpty()) {
- m_pageListenersMap.remove(it);
- delete listeners;
- }
-
- didRemoveListener(page);
-}
-
-bool ScriptDebugServer::hasListenersInterestedInPage(Page* page)
-{
- ASSERT_ARG(page, page);
-
- return m_pageListenersMap.contains(page);
-}
-
String ScriptDebugServer::setBreakpoint(const String& sourceID, const ScriptBreakpoint& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber)
{
intptr_t sourceIDValue = sourceID.toIntPtr();
@@ -299,15 +240,6 @@ void ScriptDebugServer::dispatchFailedToParseSource(const ListenerSet& listeners
copy[i]->failedToParseSource(url, data, firstLine, errorLine, errorMessage);
}
-static Page* toPage(JSGlobalObject* globalObject)
-{
- ASSERT_ARG(globalObject, globalObject);
-
- JSDOMWindow* window = asJSDOMWindow(globalObject);
- Frame* frame = window->impl()->frame();
- return frame ? frame->page() : 0;
-}
-
static ScriptWorldType currentWorldType(ExecState* exec)
{
if (currentWorld(exec) == mainThreadNormalWorld())
@@ -333,22 +265,19 @@ void ScriptDebugServer::sourceParsed(ExecState* exec, SourceProvider* sourceProv
if (m_callingListeners)
return;
- Page* page = toPage(exec->lexicalGlobalObject());
- if (!page)
+ ListenerSet* listeners = getListenersForGlobalObject(exec->lexicalGlobalObject());
+ if (!listeners)
return;
-
- ScriptWorldType worldType = currentWorldType(exec);
+ ASSERT(!listeners->isEmpty());
m_callingListeners = true;
bool isError = errorLine != -1;
-
- if (ListenerSet* pageListeners = m_pageListenersMap.get(page)) {
- ASSERT(!pageListeners->isEmpty());
- if (isError)
- dispatchFailedToParseSource(*pageListeners, sourceProvider, errorLine, ustringToString(errorMessage));
- else
- dispatchDidParseSource(*pageListeners, sourceProvider, worldType);
+ if (isError)
+ dispatchFailedToParseSource(*listeners, sourceProvider, errorLine, ustringToString(errorMessage));
+ else {
+ ScriptWorldType worldType = currentWorldType(exec);
+ dispatchDidParseSource(*listeners, sourceProvider, worldType);
}
m_callingListeners = false;
@@ -362,85 +291,26 @@ void ScriptDebugServer::dispatchFunctionToListeners(const ListenerSet& listeners
(this->*callback)(copy[i]);
}
-void ScriptDebugServer::dispatchFunctionToListeners(JavaScriptExecutionCallback callback, Page* page)
+void ScriptDebugServer::dispatchFunctionToListeners(JavaScriptExecutionCallback callback, JSGlobalObject* globalObject)
{
if (m_callingListeners)
return;
m_callingListeners = true;
- if (ListenerSet* pageListeners = m_pageListenersMap.get(page)) {
- ASSERT(!pageListeners->isEmpty());
- dispatchFunctionToListeners(*pageListeners, callback);
+ if (ListenerSet* listeners = getListenersForGlobalObject(globalObject)) {
+ ASSERT(!listeners->isEmpty());
+ dispatchFunctionToListeners(*listeners, callback);
}
m_callingListeners = false;
}
-void ScriptDebugServer::setJavaScriptPaused(const PageGroup& pageGroup, bool paused)
-{
- setMainThreadCallbacksPaused(paused);
-
- const HashSet<Page*>& pages = pageGroup.pages();
-
- HashSet<Page*>::const_iterator end = pages.end();
- for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it)
- setJavaScriptPaused(*it, paused);
-}
-
-void ScriptDebugServer::setJavaScriptPaused(Page* page, bool paused)
-{
- ASSERT_ARG(page, page);
-
- page->setDefersLoading(paused);
-
- for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
- setJavaScriptPaused(frame, paused);
-}
-
-void ScriptDebugServer::setJavaScriptPaused(Frame* frame, bool paused)
-{
- ASSERT_ARG(frame, frame);
-
- if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript))
- return;
-
- frame->script()->setPaused(paused);
-
- Document* document = frame->document();
- if (paused) {
- document->suspendScriptedAnimationControllerCallbacks();
- document->suspendActiveDOMObjects(ActiveDOMObject::JavaScriptDebuggerPaused);
- } else {
- document->resumeActiveDOMObjects();
- document->resumeScriptedAnimationControllerCallbacks();
- }
-
- setJavaScriptPaused(frame->view(), paused);
-}
-
-void ScriptDebugServer::setJavaScriptPaused(FrameView* view, bool paused)
-{
- if (!view)
- return;
-
- const HashSet<RefPtr<Widget> >* children = view->children();
- ASSERT(children);
-
- HashSet<RefPtr<Widget> >::const_iterator end = children->end();
- for (HashSet<RefPtr<Widget> >::const_iterator it = children->begin(); it != end; ++it) {
- Widget* widget = (*it).get();
- if (!widget->isPluginView())
- continue;
- static_cast<PluginView*>(widget)->setJavaScriptPaused(paused);
- }
-}
-
void ScriptDebugServer::createCallFrameAndPauseIfNeeded(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
{
TextPosition0 textPosition(WTF::OneBasedNumber::fromOneBasedInt(lineNumber).convertToZeroBased(), WTF::ZeroBasedNumber::base());
m_currentCallFrame = JavaScriptCallFrame::create(debuggerCallFrame, m_currentCallFrame, sourceID, textPosition);
- pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
+ pauseIfNeeded(debuggerCallFrame.dynamicGlobalObject());
}
void ScriptDebugServer::updateCallFrameAndPauseIfNeeded(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
@@ -451,15 +321,15 @@ void ScriptDebugServer::updateCallFrameAndPauseIfNeeded(const DebuggerCallFrame&
TextPosition0 textPosition(WTF::OneBasedNumber::fromOneBasedInt(lineNumber).convertToZeroBased(), WTF::ZeroBasedNumber::base());
m_currentCallFrame->update(debuggerCallFrame, sourceID, textPosition);
- pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject()));
+ pauseIfNeeded(debuggerCallFrame.dynamicGlobalObject());
}
-void ScriptDebugServer::pauseIfNeeded(Page* page)
+void ScriptDebugServer::pauseIfNeeded(JSGlobalObject* dynamicGlobalObject)
{
if (m_paused)
return;
-
- if (!page || !hasListenersInterestedInPage(page))
+
+ if (!getListenersForGlobalObject(dynamicGlobalObject))
return;
bool pauseNow = m_pauseOnNextStatement;
@@ -471,11 +341,9 @@ void ScriptDebugServer::pauseIfNeeded(Page* page)
m_pauseOnCallFrame = 0;
m_pauseOnNextStatement = false;
m_paused = true;
- m_pausedPage = page;
- dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidPause, page);
-
- setJavaScriptPaused(page->group(), true);
+ dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidPause, dynamicGlobalObject);
+ didPause(dynamicGlobalObject);
TimerBase::fireTimersInNestedEventLoop();
@@ -484,12 +352,10 @@ void ScriptDebugServer::pauseIfNeeded(Page* page)
while (!m_doneProcessingDebuggerEvents && !loop.ended())
loop.cycle();
- setJavaScriptPaused(page->group(), false);
+ didContinue(dynamicGlobalObject);
+ dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue, dynamicGlobalObject);
m_paused = false;
- m_pausedPage = 0;
-
- dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue, page);
}
void ScriptDebugServer::callEvent(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber)
@@ -565,34 +431,6 @@ void ScriptDebugServer::recompileAllJSFunctionsSoon()
m_recompileTimer.startOneShot(0);
}
-void ScriptDebugServer::recompileAllJSFunctions(Timer<ScriptDebugServer>*)
-{
- JSLock lock(SilenceAssertionsOnly);
- // If JavaScript stack is not empty postpone recompilation.
- if (JSDOMWindow::commonJSGlobalData()->dynamicGlobalObject)
- recompileAllJSFunctionsSoon();
- else
- Debugger::recompileAllJSFunctions(JSDOMWindow::commonJSGlobalData());
-}
-
-void ScriptDebugServer::didAddListener(Page* page)
-{
- recompileAllJSFunctionsSoon();
- page->setDebugger(this);
-}
-
-void ScriptDebugServer::didRemoveListener(Page* page)
-{
- if (hasListenersInterestedInPage(page))
- return;
-
- if (m_pausedPage == page)
- m_doneProcessingDebuggerEvents = true;
-
- recompileAllJSFunctionsSoon();
- page->setDebugger(0);
-}
-
} // namespace WebCore
#endif // ENABLE(JAVASCRIPT_DEBUGGER)
diff --git a/Source/WebCore/bindings/js/ScriptDebugServer.h b/Source/WebCore/bindings/js/ScriptDebugServer.h
index e7e8502..e53cb4d 100644
--- a/Source/WebCore/bindings/js/ScriptDebugServer.h
+++ b/Source/WebCore/bindings/js/ScriptDebugServer.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2010-2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -50,21 +50,12 @@ class JSGlobalObject;
}
namespace WebCore {
-class Frame;
-class FrameView;
-class Page;
-class PageGroup;
class ScriptDebugListener;
class JavaScriptCallFrame;
-class ScriptDebugServer : JSC::Debugger {
+class ScriptDebugServer : protected JSC::Debugger {
WTF_MAKE_NONCOPYABLE(ScriptDebugServer); WTF_MAKE_FAST_ALLOCATED;
public:
- static ScriptDebugServer& shared();
-
- void addListener(ScriptDebugListener*, Page*);
- void removeListener(ScriptDebugListener*, Page*);
-
String setBreakpoint(const String& sourceID, const ScriptBreakpoint&, int* actualLineNumber, int* actualColumnNumber);
void removeBreakpoint(const String& breakpointId);
void clearBreakpoints();
@@ -90,26 +81,24 @@ public:
bool editScriptSource(const String& sourceID, const String& newContent, String& newSourceOrErrorMessage);
void recompileAllJSFunctionsSoon();
- void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0);
+ virtual void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0) = 0;
JavaScriptCallFrame* currentCallFrame();
-private:
+protected:
typedef HashSet<ScriptDebugListener*> ListenerSet;
typedef void (ScriptDebugServer::*JavaScriptExecutionCallback)(ScriptDebugListener*);
ScriptDebugServer();
~ScriptDebugServer();
- bool hasBreakpoint(intptr_t sourceID, const TextPosition0& position) const;
- bool hasListenersInterestedInPage(Page*);
+ virtual ListenerSet* getListenersForGlobalObject(JSC::JSGlobalObject*) = 0;
+ virtual void didPause(JSC::JSGlobalObject*) = 0;
+ virtual void didContinue(JSC::JSGlobalObject*) = 0;
- void setJavaScriptPaused(const PageGroup&, bool paused);
- void setJavaScriptPaused(Page*, bool paused);
- void setJavaScriptPaused(Frame*, bool paused);
- void setJavaScriptPaused(FrameView*, bool paused);
+ bool hasBreakpoint(intptr_t sourceID, const TextPosition0&) const;
- void dispatchFunctionToListeners(JavaScriptExecutionCallback, Page*);
+ void dispatchFunctionToListeners(JavaScriptExecutionCallback, JSC::JSGlobalObject*);
void dispatchFunctionToListeners(const ListenerSet& listeners, JavaScriptExecutionCallback callback);
void dispatchDidPause(ScriptDebugListener*);
void dispatchDidContinue(ScriptDebugListener*);
@@ -118,7 +107,7 @@ private:
void createCallFrameAndPauseIfNeeded(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
void updateCallFrameAndPauseIfNeeded(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
- void pauseIfNeeded(Page*);
+ void pauseIfNeeded(JSC::JSGlobalObject* dynamicGlobalObject);
virtual void detach(JSC::JSGlobalObject*);
@@ -131,9 +120,6 @@ private:
virtual void didExecuteProgram(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno);
virtual void didReachBreakpoint(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno);
- void didAddListener(Page*);
- void didRemoveListener(Page*);
-
typedef HashMap<Page*, ListenerSet*> PageListenersMap;
typedef HashMap<long, ScriptBreakpoint> LineToBreakpointMap;
typedef HashMap<intptr_t, LineToBreakpointMap> SourceIdToBreakpointsMap;
@@ -143,7 +129,6 @@ private:
PauseOnExceptionsState m_pauseOnExceptionsState;
bool m_pauseOnNextStatement;
bool m_paused;
- Page* m_pausedPage;
bool m_doneProcessingDebuggerEvents;
bool m_breakpointsActivated;
JavaScriptCallFrame* m_pauseOnCallFrame;
diff --git a/Source/WebCore/bindings/js/ScriptHeapSnapshot.h b/Source/WebCore/bindings/js/ScriptHeapSnapshot.h
index 6b40e20..a341ddc 100644
--- a/Source/WebCore/bindings/js/ScriptHeapSnapshot.h
+++ b/Source/WebCore/bindings/js/ScriptHeapSnapshot.h
@@ -50,7 +50,6 @@ public:
unsigned int uid() const { return 0; }
void writeJSON(OutputStream*) { }
- int exactRetainedSize(uint64_t) { return -1; }
private:
ScriptHeapSnapshot() { }
diff --git a/Source/WebCore/bindings/js/ScriptProfiler.cpp b/Source/WebCore/bindings/js/ScriptProfiler.cpp
index f372c3c..3468ae3 100644
--- a/Source/WebCore/bindings/js/ScriptProfiler.cpp
+++ b/Source/WebCore/bindings/js/ScriptProfiler.cpp
@@ -30,11 +30,17 @@
#include "ScriptProfiler.h"
+#include "GCController.h"
#include "JSDOMBinding.h"
#include <profiler/Profiler.h>
namespace WebCore {
+void ScriptProfiler::collectGarbage()
+{
+ gcController().garbageCollectNow();
+}
+
void ScriptProfiler::start(ScriptState* state, const String& title)
{
JSC::Profiler::profiler()->startProfiling(state, stringToUString(title));
diff --git a/Source/WebCore/bindings/js/ScriptProfiler.h b/Source/WebCore/bindings/js/ScriptProfiler.h
index d8ad482..05d5e92 100644
--- a/Source/WebCore/bindings/js/ScriptProfiler.h
+++ b/Source/WebCore/bindings/js/ScriptProfiler.h
@@ -47,6 +47,7 @@ public:
virtual bool isCanceled() = 0;
};
+ static void collectGarbage();
static void start(ScriptState* state, const String& title);
static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title);
static PassRefPtr<ScriptHeapSnapshot> takeHeapSnapshot(const String&, HeapSnapshotProgress*) { return 0; }
diff --git a/Source/WebCore/bindings/js/SerializedScriptValue.cpp b/Source/WebCore/bindings/js/SerializedScriptValue.cpp
index b3d07ca..a9c1b24 100644
--- a/Source/WebCore/bindings/js/SerializedScriptValue.cpp
+++ b/Source/WebCore/bindings/js/SerializedScriptValue.cpp
@@ -206,6 +206,45 @@ protected:
MarkedArgumentBuffer m_gcBuffer;
};
+#if ASSUME_LITTLE_ENDIAN
+template <typename T> static void writeLittleEndian(Vector<uint8_t>& buffer, T value)
+{
+ buffer.append(reinterpret_cast<uint8_t*>(&value), sizeof(value));
+}
+#else
+template <typename T> static void writeLittleEndian(Vector<uint8_t>& buffer, T value)
+{
+ for (unsigned i = 0; i < sizeof(T); i++) {
+ buffer.append(value & 0xFF);
+ value >>= 8;
+ }
+}
+#endif
+
+template <> void writeLittleEndian<uint8_t>(Vector<uint8_t>& buffer, uint8_t value)
+{
+ buffer.append(value);
+}
+
+template <typename T> static bool writeLittleEndian(Vector<uint8_t>& buffer, const T* values, uint32_t length)
+{
+ if (length > numeric_limits<uint32_t>::max() / sizeof(T))
+ return false;
+
+#if ASSUME_LITTLE_ENDIAN
+ buffer.append(reinterpret_cast<const uint8_t*>(values), length * sizeof(T));
+#else
+ for (unsigned i = 0; i < length; i++) {
+ T value = values[i];
+ for (unsigned j = 0; j < sizeof(T); j++) {
+ buffer.append(static_cast<uint8_t>(value & 0xFF));
+ value >>= 8;
+ }
+ }
+#endif
+ return true;
+}
+
class CloneSerializer : CloneBase {
public:
static bool serialize(ExecState* exec, JSValue value, Vector<uint8_t>& out)
@@ -444,43 +483,6 @@ private:
writeLittleEndian(m_buffer, c);
}
-#if ASSUME_LITTLE_ENDIAN
- template <typename T> static void writeLittleEndian(Vector<uint8_t>& buffer, T value)
- {
- if (sizeof(T) == 1)
- buffer.append(value);
- else
- buffer.append(reinterpret_cast<uint8_t*>(&value), sizeof(value));
- }
-#else
- template <typename T> static void writeLittleEndian(Vector<uint8_t>& buffer, T value)
- {
- for (unsigned i = 0; i < sizeof(T); i++) {
- buffer.append(value & 0xFF);
- value >>= 8;
- }
- }
-#endif
-
- template <typename T> static bool writeLittleEndian(Vector<uint8_t>& buffer, const T* values, uint32_t length)
- {
- if (length > numeric_limits<uint32_t>::max() / sizeof(T))
- return false;
-
-#if ASSUME_LITTLE_ENDIAN
- buffer.append(reinterpret_cast<const uint8_t*>(values), length * sizeof(T));
-#else
- for (unsigned i = 0; i < length; i++) {
- T value = values[i];
- for (unsigned j = 0; j < sizeof(T); j++) {
- buffer.append(static_cast<uint8_t>(value & 0xFF));
- value >>= 8;
- }
- }
-#endif
- return true;
- }
-
void write(uint32_t i)
{
writeLittleEndian(m_buffer, i);
@@ -870,12 +872,7 @@ private:
if (sizeof(T) == 1)
value = *ptr++;
else {
-#if CPU(ARMV5_OR_LOWER)
- // To protect misaligned memory access.
- memcpy(&value, ptr, sizeof(T));
-#else
value = *reinterpret_cast<const T*>(ptr);
-#endif
ptr += sizeof(T);
}
return true;
@@ -968,14 +965,7 @@ private:
return false;
#if ASSUME_LITTLE_ENDIAN
-#if CPU(ARMV5_OR_LOWER)
- // To protect misaligned memory access.
- Vector<UChar> alignedBuffer(length);
- memcpy(alignedBuffer.data(), ptr, length * sizeof(UChar));
- str = UString::adopt(alignedBuffer);
-#else
str = UString(reinterpret_cast<const UChar*>(ptr), length);
-#endif
ptr += length * sizeof(UChar);
#else
Vector<UChar> buffer;
@@ -1176,7 +1166,9 @@ private:
CachedStringRef flags;
if (!readStringData(flags))
return JSValue();
- RefPtr<RegExp> regExp = RegExp::create(&m_exec->globalData(), pattern->ustring(), flags->ustring());
+ RegExpFlags reFlags = regExpFlags(flags->ustring());
+ ASSERT(reFlags != InvalidFlags);
+ RefPtr<RegExp> regExp = RegExp::create(&m_exec->globalData(), pattern->ustring(), reFlags);
return new (m_exec) RegExpObject(m_exec->lexicalGlobalObject(), m_globalObject->regExpStructure(), regExp);
}
case ObjectReferenceTag: {
diff --git a/Source/WebCore/bindings/js/WorkerScriptController.cpp b/Source/WebCore/bindings/js/WorkerScriptController.cpp
index d392281..67b0441 100644
--- a/Source/WebCore/bindings/js/WorkerScriptController.cpp
+++ b/Source/WebCore/bindings/js/WorkerScriptController.cpp
@@ -73,13 +73,13 @@ void WorkerScriptController::initScript()
// Explicitly protect the global object's prototype so it isn't collected
// when we allocate the global object. (Once the global object is fully
// constructed, it can mark its own prototype.)
- RefPtr<Structure> workerContextPrototypeStructure = JSWorkerContextPrototype::createStructure(jsNull());
+ RefPtr<Structure> workerContextPrototypeStructure = JSWorkerContextPrototype::createStructure(*m_globalData, jsNull());
Global<JSWorkerContextPrototype> workerContextPrototype(*m_globalData, new (m_globalData.get()) JSWorkerContextPrototype(0, workerContextPrototypeStructure.release()));
if (m_workerContext->isDedicatedWorkerContext()) {
- RefPtr<Structure> dedicatedContextPrototypeStructure = JSDedicatedWorkerContextPrototype::createStructure(workerContextPrototype.get());
+ RefPtr<Structure> dedicatedContextPrototypeStructure = JSDedicatedWorkerContextPrototype::createStructure(*m_globalData, workerContextPrototype.get());
Global<JSDedicatedWorkerContextPrototype> dedicatedContextPrototype(*m_globalData, new (m_globalData.get()) JSDedicatedWorkerContextPrototype(0, dedicatedContextPrototypeStructure.release()));
- RefPtr<Structure> structure = JSDedicatedWorkerContext::createStructure(dedicatedContextPrototype.get());
+ RefPtr<Structure> structure = JSDedicatedWorkerContext::createStructure(*m_globalData, dedicatedContextPrototype.get());
m_workerContextWrapper.set(*m_globalData, new (m_globalData.get()) JSDedicatedWorkerContext(structure.release(), m_workerContext->toDedicatedWorkerContext()));
workerContextPrototype->putAnonymousValue(*m_globalData, 0, m_workerContextWrapper.get());
@@ -87,9 +87,9 @@ void WorkerScriptController::initScript()
#if ENABLE(SHARED_WORKERS)
} else {
ASSERT(m_workerContext->isSharedWorkerContext());
- RefPtr<Structure> sharedContextPrototypeStructure = JSSharedWorkerContextPrototype::createStructure(workerContextPrototype.get());
+ RefPtr<Structure> sharedContextPrototypeStructure = JSSharedWorkerContextPrototype::createStructure(*m_globalData, workerContextPrototype.get());
Global<JSSharedWorkerContextPrototype> sharedContextPrototype(*m_globalData, new (m_globalData.get()) JSSharedWorkerContextPrototype(0, sharedContextPrototypeStructure.release()));
- RefPtr<Structure> structure = JSSharedWorkerContext::createStructure(sharedContextPrototype.get());
+ RefPtr<Structure> structure = JSSharedWorkerContext::createStructure(*m_globalData, sharedContextPrototype.get());
m_workerContextWrapper.set(*m_globalData, new (m_globalData.get()) JSSharedWorkerContext(structure.release(), m_workerContext->toSharedWorkerContext()));
workerContextPrototype->putAnonymousValue(*m_globalData, 0, m_workerContextWrapper.get());
diff --git a/Source/WebCore/bindings/js/WorkerScriptDebugServer.cpp b/Source/WebCore/bindings/js/WorkerScriptDebugServer.cpp
new file mode 100755
index 0000000..5e2acd2
--- /dev/null
+++ b/Source/WebCore/bindings/js/WorkerScriptDebugServer.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WorkerScriptDebugServer.h"
+
+#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(WORKERS)
+
+#include "WorkerContext.h"
+
+namespace WebCore {
+
+WorkerScriptDebugServer::WorkerScriptDebugServer()
+ : ScriptDebugServer()
+{
+}
+
+void WorkerScriptDebugServer::addListener(ScriptDebugListener*, WorkerContext*)
+{
+}
+
+void WorkerScriptDebugServer::removeListener(ScriptDebugListener*, WorkerContext*)
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(WORKERS)
diff --git a/Source/WebCore/bindings/js/WorkerScriptDebugServer.h b/Source/WebCore/bindings/js/WorkerScriptDebugServer.h
new file mode 100755
index 0000000..4062435
--- /dev/null
+++ b/Source/WebCore/bindings/js/WorkerScriptDebugServer.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WorkerScriptDebugServer_h
+#define WorkerScriptDebugServer_h
+
+#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(WORKERS)
+
+#include "ScriptDebugServer.h"
+
+namespace WebCore {
+
+class WorkerContext;
+
+class WorkerScriptDebugServer : public ScriptDebugServer {
+ WTF_MAKE_NONCOPYABLE(WorkerScriptDebugServer);
+public:
+ WorkerScriptDebugServer();
+ ~WorkerScriptDebugServer() { }
+
+ void addListener(ScriptDebugListener*, WorkerContext*);
+ void removeListener(ScriptDebugListener*, WorkerContext*);
+
+private:
+ virtual void recompileAllJSFunctions(Timer<ScriptDebugServer>*) { }
+ virtual ListenerSet* getListenersForGlobalObject(JSC::JSGlobalObject*) { return 0; }
+ virtual void didPause(JSC::JSGlobalObject*) { }
+ virtual void didContinue(JSC::JSGlobalObject*) { }
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(WORKERS)
+
+#endif // WorkerScriptDebugServer_h