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/CachedScriptSourceProvider.h2
-rw-r--r--Source/WebCore/bindings/js/DOMWrapperWorld.h6
-rw-r--r--Source/WebCore/bindings/js/JSArrayBufferCustom.cpp5
-rw-r--r--Source/WebCore/bindings/js/JSArrayBufferViewHelper.h2
-rw-r--r--Source/WebCore/bindings/js/JSAudioConstructor.cpp4
-rw-r--r--Source/WebCore/bindings/js/JSAudioContextCustom.cpp51
-rw-r--r--Source/WebCore/bindings/js/JSBindingsAllInOne.cpp10
-rw-r--r--Source/WebCore/bindings/js/JSCanvasRenderingContextCustom.cpp4
-rw-r--r--Source/WebCore/bindings/js/JSDOMBinding.cpp18
-rw-r--r--Source/WebCore/bindings/js/JSDOMGlobalObject.cpp10
-rw-r--r--Source/WebCore/bindings/js/JSDOMGlobalObject.h10
-rw-r--r--Source/WebCore/bindings/js/JSDOMWindowCustom.cpp34
-rw-r--r--Source/WebCore/bindings/js/JSDOMWindowShell.cpp9
-rw-r--r--Source/WebCore/bindings/js/JSDOMWindowShell.h8
-rw-r--r--Source/WebCore/bindings/js/JSDataViewCustom.cpp5
-rw-r--r--Source/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp12
-rw-r--r--Source/WebCore/bindings/js/JSDocumentCustom.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSElementCustom.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSEventListener.cpp4
-rw-r--r--Source/WebCore/bindings/js/JSEventListener.h8
-rw-r--r--Source/WebCore/bindings/js/JSFloat32ArrayCustom.cpp5
-rw-r--r--Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp4
-rw-r--r--Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp4
-rw-r--r--Source/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSImageConstructor.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSImageDataCustom.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp8
-rw-r--r--Source/WebCore/bindings/js/JSInt16ArrayCustom.cpp5
-rw-r--r--Source/WebCore/bindings/js/JSInt32ArrayCustom.cpp5
-rw-r--r--Source/WebCore/bindings/js/JSInt8ArrayCustom.cpp5
-rw-r--r--Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp4
-rw-r--r--Source/WebCore/bindings/js/JSMemoryInfoCustom.cpp44
-rw-r--r--Source/WebCore/bindings/js/JSNodeCustom.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSNodeFilterCondition.cpp10
-rw-r--r--Source/WebCore/bindings/js/JSNodeFilterCondition.h2
-rw-r--r--Source/WebCore/bindings/js/JSNodeFilterCustom.cpp1
-rw-r--r--Source/WebCore/bindings/js/JSOptionConstructor.cpp4
-rw-r--r--Source/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp2
-rw-r--r--Source/WebCore/bindings/js/JSUint16ArrayCustom.cpp5
-rw-r--r--Source/WebCore/bindings/js/JSUint32ArrayCustom.cpp5
-rw-r--r--Source/WebCore/bindings/js/JSUint8ArrayCustom.cpp5
-rw-r--r--Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp12
-rw-r--r--Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp6
-rw-r--r--Source/WebCore/bindings/js/ScriptCachedFrameData.cpp2
-rw-r--r--Source/WebCore/bindings/js/ScriptController.cpp17
-rw-r--r--Source/WebCore/bindings/js/ScriptController.h16
-rw-r--r--Source/WebCore/bindings/js/ScriptDebugServer.cpp46
-rw-r--r--Source/WebCore/bindings/js/ScriptDebugServer.h11
-rw-r--r--Source/WebCore/bindings/js/ScriptEventListener.cpp11
-rw-r--r--Source/WebCore/bindings/js/ScriptGCEvent.cpp8
-rw-r--r--Source/WebCore/bindings/js/ScriptGCEvent.h2
-rw-r--r--Source/WebCore/bindings/js/ScriptObject.cpp6
-rw-r--r--Source/WebCore/bindings/js/ScriptProfiler.cpp5
-rw-r--r--Source/WebCore/bindings/js/ScriptProfiler.h12
-rw-r--r--Source/WebCore/bindings/js/SerializedScriptValue.cpp4
-rw-r--r--Source/WebCore/bindings/js/WorkerScriptController.cpp20
57 files changed, 266 insertions, 246 deletions
diff --git a/Source/WebCore/bindings/js/CachedScriptSourceProvider.h b/Source/WebCore/bindings/js/CachedScriptSourceProvider.h
index 9bae8ca..8f63a69 100644
--- a/Source/WebCore/bindings/js/CachedScriptSourceProvider.h
+++ b/Source/WebCore/bindings/js/CachedScriptSourceProvider.h
@@ -57,7 +57,7 @@ namespace WebCore {
private:
CachedScriptSourceProvider(CachedScript* cachedScript)
- : ScriptSourceProvider(stringToUString(cachedScript->url()), cachedScript->sourceProviderCache())
+ : ScriptSourceProvider(stringToUString(cachedScript->response().url()), cachedScript->sourceProviderCache())
, m_cachedScript(cachedScript)
{
m_cachedScript->addClient(this);
diff --git a/Source/WebCore/bindings/js/DOMWrapperWorld.h b/Source/WebCore/bindings/js/DOMWrapperWorld.h
index 5e7b551..9825a08 100644
--- a/Source/WebCore/bindings/js/DOMWrapperWorld.h
+++ b/Source/WebCore/bindings/js/DOMWrapperWorld.h
@@ -32,8 +32,8 @@ namespace WebCore {
class ScriptController;
-typedef JSC::WeakGCMap<void*, DOMObject*> DOMObjectWrapperMap;
-typedef JSC::WeakGCMap<StringImpl*, JSC::JSString*> JSStringCache;
+typedef JSC::WeakGCMap<void*, DOMObject> DOMObjectWrapperMap;
+typedef JSC::WeakGCMap<StringImpl*, JSC::JSString> JSStringCache;
class DOMWrapperWorld : public RefCounted<DOMWrapperWorld> {
public:
@@ -58,6 +58,8 @@ public:
bool isNormal() const { return m_isNormal; }
+ JSC::JSGlobalData* globalData() const { return m_globalData; }
+
protected:
DOMWrapperWorld(JSC::JSGlobalData*, bool isNormal);
diff --git a/Source/WebCore/bindings/js/JSArrayBufferCustom.cpp b/Source/WebCore/bindings/js/JSArrayBufferCustom.cpp
index 68edc5c..52332c9 100644
--- a/Source/WebCore/bindings/js/JSArrayBufferCustom.cpp
+++ b/Source/WebCore/bindings/js/JSArrayBufferCustom.cpp
@@ -24,9 +24,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "JSArrayBuffer.h"
#include "ArrayBuffer.h"
@@ -53,5 +50,3 @@ EncodedJSValue JSC_HOST_CALL JSArrayBufferConstructor::constructJSArrayBuffer(Ex
}
} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h b/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h
index 73229da..a7ef436 100644
--- a/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h
+++ b/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h
@@ -137,7 +137,7 @@ PassRefPtr<C> constructArrayBufferView(JSC::ExecState* exec)
// JavaScript DOM bindings can distinguish between "new
// <Type>Array()" and what occurs when a previously-constructed
// ArrayBufferView is returned to JavaScript; e.g., from
- // "array.slice()".
+ // "array.subset()".
if (exec->argumentCount() < 1)
return C::create(0);
diff --git a/Source/WebCore/bindings/js/JSAudioConstructor.cpp b/Source/WebCore/bindings/js/JSAudioConstructor.cpp
index 1ea5ae4..c19d795 100644
--- a/Source/WebCore/bindings/js/JSAudioConstructor.cpp
+++ b/Source/WebCore/bindings/js/JSAudioConstructor.cpp
@@ -42,8 +42,8 @@ const ClassInfo JSAudioConstructor::s_info = { "AudioConstructor", 0, 0, 0 };
JSAudioConstructor::JSAudioConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
: DOMConstructorWithDocument(JSAudioConstructor::createStructure(globalObject->objectPrototype()), globalObject)
{
- putDirect(exec->propertyNames().prototype, JSHTMLAudioElementPrototype::self(exec, globalObject), None);
- putDirect(exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
+ putDirect(exec->globalData(), exec->propertyNames().prototype, JSHTMLAudioElementPrototype::self(exec, globalObject), None);
+ putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
}
static EncodedJSValue JSC_HOST_CALL constructAudio(ExecState* exec)
diff --git a/Source/WebCore/bindings/js/JSAudioContextCustom.cpp b/Source/WebCore/bindings/js/JSAudioContextCustom.cpp
index 04644bc..382d0cb 100644
--- a/Source/WebCore/bindings/js/JSAudioContextCustom.cpp
+++ b/Source/WebCore/bindings/js/JSAudioContextCustom.cpp
@@ -28,12 +28,18 @@
#include "AudioContext.h"
+#include "ArrayBuffer.h"
+#include "AudioBuffer.h"
+#include "JSArrayBuffer.h"
+#include "JSAudioBuffer.h"
#include "JSAudioContext.h"
#include <runtime/Error.h>
+using namespace JSC;
+
namespace WebCore {
-JSC::EncodedJSValue JSC_HOST_CALL JSAudioContextConstructor::constructJSAudioContext(JSC::ExecState* exec)
+EncodedJSValue JSC_HOST_CALL JSAudioContextConstructor::constructJSAudioContext(ExecState* exec)
{
JSAudioContextConstructor* jsConstructor = static_cast<JSAudioContextConstructor*>(exec->callee());
if (!jsConstructor)
@@ -49,7 +55,48 @@ JSC::EncodedJSValue JSC_HOST_CALL JSAudioContextConstructor::constructJSAudioCon
Document* document = static_cast<Document*>(scriptExecutionContext);
RefPtr<AudioContext> context = AudioContext::create(document);
- return JSC::JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), context.get())));
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), context.get())));
+}
+
+JSValue JSAudioContext::createBuffer(ExecState* exec)
+{
+ if (exec->argumentCount() < 2)
+ return throwError(exec, createSyntaxError(exec, "Not enough arguments"));
+
+ AudioContext* audioContext = static_cast<AudioContext*>(impl());
+ ASSERT(audioContext);
+
+ // AudioBuffer createBuffer(in ArrayBuffer buffer, in boolean mixToMono);
+ JSValue val = exec->argument(0);
+ if (val.inherits(&JSArrayBuffer::s_info)) {
+ ArrayBuffer* arrayBuffer = toArrayBuffer(val);
+ ASSERT(arrayBuffer);
+ if (arrayBuffer) {
+ bool mixToMono = exec->argument(1).toBoolean(exec);
+
+ RefPtr<AudioBuffer> audioBuffer = audioContext->createBuffer(arrayBuffer, mixToMono);
+ if (!audioBuffer.get())
+ return throwError(exec, createSyntaxError(exec, "Error decoding audio file data"));
+
+ return toJS(exec, globalObject(), audioBuffer.get());
+ }
+
+ return jsUndefined();
+ }
+
+ // AudioBuffer createBuffer(in unsigned long numberOfChannels, in unsigned long numberOfFrames, in float sampleRate);
+ if (exec->argumentCount() < 3)
+ return throwError(exec, createSyntaxError(exec, "Not enough arguments"));
+
+ unsigned numberOfChannels = exec->argument(0).toInt32(exec);
+ unsigned numberOfFrames = exec->argument(1).toInt32(exec);
+ float sampleRate = exec->argument(2).toFloat(exec);
+
+ RefPtr<AudioBuffer> audioBuffer = audioContext->createBuffer(numberOfChannels, numberOfFrames, sampleRate);
+ if (!audioBuffer.get())
+ return throwError(exec, createSyntaxError(exec, "Error creating AudioBuffer"));
+
+ return toJS(exec, globalObject(), audioBuffer.get());
}
} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp b/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
index af74e8c..7c5edc6 100644
--- a/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
+++ b/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
@@ -28,6 +28,7 @@
#include "DOMObjectHashTableMap.cpp"
#include "DOMWrapperWorld.cpp"
#include "GCController.cpp"
+#include "JSArrayBufferCustom.cpp"
#include "JSAttrCustom.cpp"
#include "JSAudioConstructor.cpp"
#include "JSCDATASectionCustom.cpp"
@@ -65,6 +66,7 @@
#include "JSDOMWrapper.cpp"
#include "JSDataGridColumnListCustom.cpp"
#include "JSDataGridDataSource.cpp"
+#include "JSDataViewCustom.cpp"
#include "JSDebugWrapperSet.cpp"
#include "JSDedicatedWorkerContextCustom.cpp"
#include "JSDesktopNotificationsCustom.cpp"
@@ -77,6 +79,7 @@
#include "JSEventSourceCustom.cpp"
#include "JSEventTarget.cpp"
#include "JSExceptionBase.cpp"
+#include "JSFloat32ArrayCustom.cpp"
#include "JSGeolocationCustom.cpp"
#include "JSHTMLAllCollectionCustom.cpp"
#include "JSHTMLAppletElementCustom.cpp"
@@ -101,10 +104,14 @@
#include "JSImageDataCustom.cpp"
#include "JSInjectedScriptHostCustom.cpp"
#include "JSInspectorFrontendHostCustom.cpp"
+#include "JSInt16ArrayCustom.cpp"
+#include "JSInt32ArrayCustom.cpp"
+#include "JSInt8ArrayCustom.cpp"
#include "JSJavaScriptCallFrameCustom.cpp"
#include "JSLazyEventListener.cpp"
#include "JSLocationCustom.cpp"
#include "JSMainThreadExecState.cpp"
+#include "JSMemoryInfoCustom.cpp"
#include "JSMessageChannelCustom.cpp"
#include "JSMessageEventCustom.cpp"
#include "JSMessagePortCustom.cpp"
@@ -133,6 +140,9 @@
#include "JSTouchCustom.cpp"
#include "JSTouchListCustom.cpp"
#include "JSTreeWalkerCustom.cpp"
+#include "JSUint16ArrayCustom.cpp"
+#include "JSUint32ArrayCustom.cpp"
+#include "JSUint8ArrayCustom.cpp"
#include "JSWebKitCSSKeyframeRuleCustom.cpp"
#include "JSWebKitCSSKeyframesRuleCustom.cpp"
#include "JSWebKitCSSMatrixCustom.cpp"
diff --git a/Source/WebCore/bindings/js/JSCanvasRenderingContextCustom.cpp b/Source/WebCore/bindings/js/JSCanvasRenderingContextCustom.cpp
index df24eb7..cab7ba3 100644
--- a/Source/WebCore/bindings/js/JSCanvasRenderingContextCustom.cpp
+++ b/Source/WebCore/bindings/js/JSCanvasRenderingContextCustom.cpp
@@ -28,7 +28,7 @@
#include "CanvasRenderingContext2D.h"
#include "JSCanvasRenderingContext2D.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "WebGLRenderingContext.h"
#include "JSWebGLRenderingContext.h"
#endif
@@ -42,7 +42,7 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, CanvasR
if (!object)
return jsUndefined();
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
if (object->is3d())
return getDOMObjectWrapper<JSWebGLRenderingContext>(exec, globalObject, static_cast<WebGLRenderingContext*>(object));
#endif
diff --git a/Source/WebCore/bindings/js/JSDOMBinding.cpp b/Source/WebCore/bindings/js/JSDOMBinding.cpp
index e53dcfb..7de2719 100644
--- a/Source/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/Source/WebCore/bindings/js/JSDOMBinding.cpp
@@ -335,9 +335,9 @@ void markDOMNodesForDocument(MarkStack& markStack, Document* document)
JSWrapperCache::iterator nodeEnd = nodeDict->uncheckedEnd();
for (JSWrapperCache::iterator nodeIt = nodeDict->uncheckedBegin(); nodeIt != nodeEnd; ++nodeIt) {
- JSNode* jsNode = nodeIt->second;
- if (isObservableThroughDOM(jsNode, world))
- markStack.append(jsNode);
+ DeprecatedPtr<JSNode>& jsNode = nodeIt->second;
+ if (isObservableThroughDOM(jsNode.get(), world))
+ markStack.append(&jsNode);
}
}
}
@@ -416,8 +416,8 @@ void markDOMObjectWrapper(MarkStack& markStack, JSGlobalData& globalData, void*
return;
for (JSGlobalDataWorldIterator worldIter(&globalData); worldIter; ++worldIter) {
- if (DOMObject* wrapper = worldIter->m_wrappers.uncheckedGet(object))
- markStack.append(wrapper);
+ if (DeprecatedPtr<DOMObject>* wrapperSlot = worldIter->m_wrappers.uncheckedGetSlot(object))
+ markStack.append(wrapperSlot);
}
}
@@ -426,15 +426,15 @@ void markDOMNodeWrapper(MarkStack& markStack, Document* document, Node* node)
if (document) {
JSWrapperCacheMap& wrapperCacheMap = document->wrapperCacheMap();
for (JSWrapperCacheMap::iterator iter = wrapperCacheMap.begin(); iter != wrapperCacheMap.end(); ++iter) {
- if (JSNode* wrapper = iter->second->uncheckedGet(node))
- markStack.append(wrapper);
+ if (DeprecatedPtr<JSNode>* wrapperSlot = iter->second->uncheckedGetSlot(node))
+ markStack.append(wrapperSlot);
}
return;
}
for (JSGlobalDataWorldIterator worldIter(JSDOMWindow::commonJSGlobalData()); worldIter; ++worldIter) {
- if (DOMObject* wrapper = worldIter->m_wrappers.uncheckedGet(node))
- markStack.append(wrapper);
+ if (DeprecatedPtr<DOMObject>* wrapperSlot = worldIter->m_wrappers.uncheckedGetSlot(node))
+ markStack.append(wrapperSlot);
}
}
diff --git a/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp b/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
index e0b5b89..a328ee9 100644
--- a/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
+++ b/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
@@ -53,14 +53,14 @@ void JSDOMGlobalObject::markChildren(MarkStack& markStack)
JSDOMStructureMap::iterator end = structures().end();
for (JSDOMStructureMap::iterator it = structures().begin(); it != end; ++it)
- markStack.append(it->second->storedPrototype());
+ markStack.append(it->second->storedPrototypeSlot());
JSDOMConstructorMap::iterator end2 = constructors().end();
for (JSDOMConstructorMap::iterator it2 = constructors().begin(); it2 != end2; ++it2)
- markStack.append(it2->second);
+ markStack.append(&it2->second);
if (d()->m_injectedScript)
- markStack.append(d()->m_injectedScript);
+ markStack.append(&d()->m_injectedScript);
}
void JSDOMGlobalObject::setCurrentEvent(Event* evt)
@@ -75,12 +75,12 @@ Event* JSDOMGlobalObject::currentEvent() const
void JSDOMGlobalObject::setInjectedScript(JSObject* injectedScript)
{
- d()->m_injectedScript = injectedScript;
+ d()->m_injectedScript.set(globalData(), this, injectedScript);
}
JSObject* JSDOMGlobalObject::injectedScript() const
{
- return d()->m_injectedScript;
+ return d()->m_injectedScript.get();
}
void JSDOMGlobalObject::destroyJSDOMGlobalObjectData(void* jsDOMGlobalObjectData)
diff --git a/Source/WebCore/bindings/js/JSDOMGlobalObject.h b/Source/WebCore/bindings/js/JSDOMGlobalObject.h
index 8eb55c1..4dce7a5 100644
--- a/Source/WebCore/bindings/js/JSDOMGlobalObject.h
+++ b/Source/WebCore/bindings/js/JSDOMGlobalObject.h
@@ -39,7 +39,7 @@ namespace WebCore {
class ScriptExecutionContext;
typedef HashMap<const JSC::ClassInfo*, RefPtr<JSC::Structure> > JSDOMStructureMap;
- typedef HashMap<const JSC::ClassInfo*, JSC::JSObject*> JSDOMConstructorMap;
+ typedef HashMap<const JSC::ClassInfo*, JSC::WriteBarrier<JSC::JSObject> > JSDOMConstructorMap;
class JSDOMGlobalObject : public JSC::JSGlobalObject {
typedef JSC::JSGlobalObject Base;
@@ -76,7 +76,6 @@ namespace WebCore {
: JSGlobalObjectData(destructor)
, evt(0)
, m_world(world)
- , m_injectedScript(0)
{
}
@@ -85,7 +84,7 @@ namespace WebCore {
Event* evt;
RefPtr<DOMWrapperWorld> m_world;
- JSObject* m_injectedScript;
+ JSC::WriteBarrier<JSObject> m_injectedScript;
};
private:
@@ -97,11 +96,12 @@ namespace WebCore {
template<class ConstructorClass>
inline JSC::JSObject* getDOMConstructor(JSC::ExecState* exec, const JSDOMGlobalObject* globalObject)
{
- if (JSC::JSObject* constructor = globalObject->constructors().get(&ConstructorClass::s_info))
+ if (JSC::JSObject* constructor = 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));
- globalObject->constructors().set(&ConstructorClass::s_info, constructor);
+ JSC::WriteBarrier<JSC::JSObject> temp;
+ globalObject->constructors().add(&ConstructorClass::s_info, temp).first->second.set(exec->globalData(), globalObject, constructor);
return constructor;
}
diff --git a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
index c8d8db6..c12d1c4 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -24,17 +24,26 @@
#include "HTMLCollection.h"
#include "HTMLDocument.h"
#include "History.h"
+#include "JSArrayBuffer.h"
#include "JSAudioConstructor.h"
+#include "JSDataView.h"
#include "JSEvent.h"
#include "JSEventListener.h"
#include "JSEventSource.h"
+#include "JSFloat32Array.h"
#include "JSHTMLCollection.h"
#include "JSHistory.h"
#include "JSImageConstructor.h"
+#include "JSInt16Array.h"
+#include "JSInt32Array.h"
+#include "JSInt8Array.h"
#include "JSLocation.h"
#include "JSMessageChannel.h"
#include "JSMessagePortCustom.h"
#include "JSOptionConstructor.h"
+#include "JSUint16Array.h"
+#include "JSUint32Array.h"
+#include "JSUint8Array.h"
#include "JSWebKitCSSMatrix.h"
#include "JSWebKitPoint.h"
#include "JSWorker.h"
@@ -48,18 +57,6 @@
#include <runtime/JSFunction.h>
#include <runtime/PrototypeFunction.h>
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-#include "JSArrayBuffer.h"
-#include "JSDataView.h"
-#include "JSFloat32Array.h"
-#include "JSInt16Array.h"
-#include "JSInt32Array.h"
-#include "JSInt8Array.h"
-#include "JSUint16Array.h"
-#include "JSUint32Array.h"
-#include "JSUint8Array.h"
-#endif
-
#if ENABLE(SHARED_WORKERS)
#include "JSSharedWorker.h"
#endif
@@ -475,7 +472,7 @@ void JSDOMWindow::setLocation(ExecState* exec, JSValue value)
if (Settings* settings = activeFrame->settings()) {
if (settings->usesDashboardBackwardCompatibilityMode() && !activeFrame->tree()->parent()) {
if (allowsAccessFrom(exec))
- putDirect(Identifier(exec, "location"), value);
+ putDirect(exec->globalData(), Identifier(exec, "location"), value);
return;
}
}
@@ -489,11 +486,6 @@ void JSDOMWindow::setLocation(ExecState* exec, JSValue value)
impl()->setLocation(ustringToString(locationString), activeDOMWindow(exec), firstDOMWindow(exec));
}
-JSValue JSDOMWindow::crypto(ExecState*) const
-{
- return jsUndefined();
-}
-
JSValue JSDOMWindow::event(ExecState* exec) const
{
Event* event = currentEvent();
@@ -538,7 +530,6 @@ JSValue JSDOMWindow::webKitCSSMatrix(ExecState* exec) const
return getDOMConstructor<JSWebKitCSSMatrixConstructor>(exec, this);
}
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
JSValue JSDOMWindow::arrayBuffer(ExecState* exec) const
{
return getDOMConstructor<JSArrayBufferConstructor>(exec, this);
@@ -583,8 +574,7 @@ JSValue JSDOMWindow::dataView(ExecState* exec) const
{
return getDOMConstructor<JSDataViewConstructor>(exec, this);
}
-#endif
-
+
JSValue JSDOMWindow::xmlHttpRequest(ExecState* exec) const
{
return getDOMConstructor<JSXMLHttpRequestConstructor>(exec, this);
@@ -682,7 +672,7 @@ inline void DialogHandler::dialogCreated(DOMWindow* dialog)
// world if dialogArguments comes from an isolated world.
m_globalObject = toJSDOMWindow(dialog->frame(), normalWorld(m_exec->globalData()));
if (JSValue dialogArguments = m_exec->argument(1))
- m_globalObject->putDirect(Identifier(m_exec, "dialogArguments"), dialogArguments);
+ m_globalObject->putDirect(m_exec->globalData(), Identifier(m_exec, "dialogArguments"), dialogArguments);
}
inline JSValue DialogHandler::returnValue() const
diff --git a/Source/WebCore/bindings/js/JSDOMWindowShell.cpp b/Source/WebCore/bindings/js/JSDOMWindowShell.cpp
index 65096b9..40f9910 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowShell.cpp
+++ b/Source/WebCore/bindings/js/JSDOMWindowShell.cpp
@@ -45,7 +45,6 @@ const ClassInfo JSDOMWindowShell::s_info = { "JSDOMWindowShell", 0, 0, 0 };
JSDOMWindowShell::JSDOMWindowShell(PassRefPtr<DOMWindow> window, DOMWrapperWorld* world)
: Base(JSDOMWindowShell::createStructure(jsNull()))
- , m_window(0)
, m_world(world)
{
setWindow(window);
@@ -65,8 +64,8 @@ void JSDOMWindowShell::setWindow(PassRefPtr<DOMWindow> domWindow)
RefPtr<Structure> structure = JSDOMWindow::createStructure(prototype);
JSDOMWindow* jsDOMWindow = new (JSDOMWindow::commonJSGlobalData()) JSDOMWindow(structure.release(), domWindow, this);
- prototype->putAnonymousValue(0, jsDOMWindow);
- setWindow(jsDOMWindow);
+ prototype->putAnonymousValue(*JSDOMWindow::commonJSGlobalData(), 0, jsDOMWindow);
+ setWindow(*JSDOMWindow::commonJSGlobalData(), jsDOMWindow);
}
// ----
@@ -77,7 +76,7 @@ void JSDOMWindowShell::markChildren(MarkStack& markStack)
{
Base::markChildren(markStack);
if (m_window)
- markStack.append(m_window);
+ markStack.append(&m_window);
}
UString JSDOMWindowShell::className() const
@@ -147,7 +146,7 @@ JSValue JSDOMWindowShell::lookupSetter(ExecState* exec, const Identifier& proper
JSObject* JSDOMWindowShell::unwrappedObject()
{
- return m_window;
+ return m_window.get();
}
// ----
diff --git a/Source/WebCore/bindings/js/JSDOMWindowShell.h b/Source/WebCore/bindings/js/JSDOMWindowShell.h
index 888325d..d585fd4 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowShell.h
+++ b/Source/WebCore/bindings/js/JSDOMWindowShell.h
@@ -43,11 +43,11 @@ namespace WebCore {
JSDOMWindowShell(PassRefPtr<DOMWindow>, DOMWrapperWorld* world);
virtual ~JSDOMWindowShell();
- JSDOMWindow* window() const { return m_window; }
- void setWindow(JSDOMWindow* window)
+ JSDOMWindow* window() const { return m_window.get(); }
+ void setWindow(JSC::JSGlobalData& globalData, JSDOMWindow* window)
{
ASSERT_ARG(window, window);
- m_window = window;
+ m_window.set(globalData, this, window);
setPrototype(window->prototype());
}
void setWindow(PassRefPtr<DOMWindow>);
@@ -85,7 +85,7 @@ namespace WebCore {
virtual JSC::JSObject* unwrappedObject();
virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
- JSDOMWindow* m_window;
+ JSC::WriteBarrier<JSDOMWindow> m_window;
RefPtr<DOMWrapperWorld> m_world;
};
diff --git a/Source/WebCore/bindings/js/JSDataViewCustom.cpp b/Source/WebCore/bindings/js/JSDataViewCustom.cpp
index ba48374..eaf57bd 100644
--- a/Source/WebCore/bindings/js/JSDataViewCustom.cpp
+++ b/Source/WebCore/bindings/js/JSDataViewCustom.cpp
@@ -24,9 +24,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "JSDataView.h"
#include "DataView.h"
@@ -160,5 +157,3 @@ JSValue JSDataView::setUint8(ExecState* exec)
}
} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp b/Source/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp
index 38334b9..16a962c 100644
--- a/Source/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp
+++ b/Source/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp
@@ -47,7 +47,7 @@ namespace WebCore {
JSValue JSNotificationCenter::requestPermission(ExecState* exec)
{
- ScriptExecutionContext* context = impl()->context();
+ ScriptExecutionContext* context = impl()->scriptExecutionContext();
// Make sure that script execution context is valid.
if (!context) {
diff --git a/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp b/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp
index 503d64f..9142aa2 100644
--- a/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp
+++ b/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp
@@ -114,18 +114,18 @@ static PassRefPtr<DeviceMotionData::RotationRate> readRotationRateArgument(JSVal
static JSObject* createAccelerationObject(const DeviceMotionData::Acceleration* acceleration, ExecState* exec)
{
JSObject* object = constructEmptyObject(exec);
- object->putDirect(Identifier(exec, "x"), acceleration->canProvideX() ? jsNumber(acceleration->x()) : jsNull());
- object->putDirect(Identifier(exec, "y"), acceleration->canProvideY() ? jsNumber(acceleration->y()) : jsNull());
- object->putDirect(Identifier(exec, "z"), acceleration->canProvideZ() ? jsNumber(acceleration->z()) : jsNull());
+ object->putDirect(exec->globalData(), Identifier(exec, "x"), acceleration->canProvideX() ? jsNumber(acceleration->x()) : jsNull());
+ object->putDirect(exec->globalData(), Identifier(exec, "y"), acceleration->canProvideY() ? jsNumber(acceleration->y()) : jsNull());
+ object->putDirect(exec->globalData(), Identifier(exec, "z"), acceleration->canProvideZ() ? jsNumber(acceleration->z()) : jsNull());
return object;
}
static JSObject* createRotationRateObject(const DeviceMotionData::RotationRate* rotationRate, ExecState* exec)
{
JSObject* object = constructEmptyObject(exec);
- object->putDirect(Identifier(exec, "alpha"), rotationRate->canProvideAlpha() ? jsNumber(rotationRate->alpha()) : jsNull());
- object->putDirect(Identifier(exec, "beta"), rotationRate->canProvideBeta() ? jsNumber(rotationRate->beta()) : jsNull());
- object->putDirect(Identifier(exec, "gamma"), rotationRate->canProvideGamma() ? jsNumber(rotationRate->gamma()) : jsNull());
+ object->putDirect(exec->globalData(), Identifier(exec, "alpha"), rotationRate->canProvideAlpha() ? jsNumber(rotationRate->alpha()) : jsNull());
+ object->putDirect(exec->globalData(), Identifier(exec, "beta"), rotationRate->canProvideBeta() ? jsNumber(rotationRate->beta()) : jsNull());
+ object->putDirect(exec->globalData(), Identifier(exec, "gamma"), rotationRate->canProvideGamma() ? jsNumber(rotationRate->gamma()) : jsNull());
return object;
}
diff --git a/Source/WebCore/bindings/js/JSDocumentCustom.cpp b/Source/WebCore/bindings/js/JSDocumentCustom.cpp
index 4cc176c..fa2b93c 100644
--- a/Source/WebCore/bindings/js/JSDocumentCustom.cpp
+++ b/Source/WebCore/bindings/js/JSDocumentCustom.cpp
@@ -25,7 +25,7 @@
#include "FrameLoader.h"
#include "HTMLDocument.h"
#include "JSCanvasRenderingContext2D.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "JSWebGLRenderingContext.h"
#endif
#include "JSDOMWindowCustom.h"
diff --git a/Source/WebCore/bindings/js/JSElementCustom.cpp b/Source/WebCore/bindings/js/JSElementCustom.cpp
index 3bfe110..9ed3739 100644
--- a/Source/WebCore/bindings/js/JSElementCustom.cpp
+++ b/Source/WebCore/bindings/js/JSElementCustom.cpp
@@ -75,7 +75,7 @@ JSValue toJSNewlyCreated(ExecState* exec, JSDOMGlobalObject* globalObject, Eleme
JSNode* wrapper;
if (element->isHTMLElement())
- wrapper = createJSHTMLWrapper(exec, globalObject, static_cast<HTMLElement*>(element));
+ wrapper = createJSHTMLWrapper(exec, globalObject, toHTMLElement(element));
#if ENABLE(SVG)
else if (element->isSVGElement())
wrapper = createJSSVGWrapper(exec, globalObject, static_cast<SVGElement*>(element));
diff --git a/Source/WebCore/bindings/js/JSEventListener.cpp b/Source/WebCore/bindings/js/JSEventListener.cpp
index 5604374..6427683 100644
--- a/Source/WebCore/bindings/js/JSEventListener.cpp
+++ b/Source/WebCore/bindings/js/JSEventListener.cpp
@@ -34,12 +34,12 @@ namespace WebCore {
JSEventListener::JSEventListener(JSObject* function, JSObject* wrapper, bool isAttribute, DOMWrapperWorld* isolatedWorld)
: EventListener(JSEventListenerType)
- , m_jsFunction(function)
, m_isAttribute(isAttribute)
, m_isolatedWorld(isolatedWorld)
{
if (wrapper)
m_wrapper = wrapper;
+ m_jsFunction.set(*m_isolatedWorld->globalData(), wrapper, function);
}
JSEventListener::~JSEventListener()
@@ -55,7 +55,7 @@ JSObject* JSEventListener::initializeJSFunction(ScriptExecutionContext*) const
void JSEventListener::markJSFunction(MarkStack& markStack)
{
if (m_jsFunction)
- markStack.append(m_jsFunction);
+ markStack.append(&m_jsFunction);
}
void JSEventListener::handleEvent(ScriptExecutionContext* scriptExecutionContext, Event* event)
diff --git a/Source/WebCore/bindings/js/JSEventListener.h b/Source/WebCore/bindings/js/JSEventListener.h
index 83d0d2e..47ff44e 100644
--- a/Source/WebCore/bindings/js/JSEventListener.h
+++ b/Source/WebCore/bindings/js/JSEventListener.h
@@ -66,7 +66,7 @@ namespace WebCore {
virtual void handleEvent(ScriptExecutionContext*, Event*);
private:
- mutable JSC::JSObject* m_jsFunction;
+ mutable JSC::WriteBarrier<JSC::JSObject> m_jsFunction;
mutable JSC::WeakGCPtr<JSC::JSObject> m_wrapper;
bool m_isAttribute;
@@ -76,7 +76,7 @@ namespace WebCore {
inline JSC::JSObject* JSEventListener::jsFunction(ScriptExecutionContext* scriptExecutionContext) const
{
if (!m_jsFunction)
- m_jsFunction = initializeJSFunction(scriptExecutionContext);
+ m_jsFunction.set(*scriptExecutionContext->globalData(), m_wrapper.get(), initializeJSFunction(scriptExecutionContext));
// Verify that we have a valid wrapper protecting our function from
// garbage collection.
@@ -86,9 +86,9 @@ namespace WebCore {
// Try to verify that m_jsFunction wasn't recycled. (Not exact, since an
// event listener can be almost anything, but this makes test-writing easier).
- ASSERT(!m_jsFunction || static_cast<JSC::JSCell*>(m_jsFunction)->isObject());
+ ASSERT(!m_jsFunction || static_cast<JSC::JSCell*>(m_jsFunction.get())->isObject());
- return m_jsFunction;
+ return m_jsFunction.get();
}
inline void JSEventListener::invalidateJSFunction(JSC::JSObject* wrapper)
diff --git a/Source/WebCore/bindings/js/JSFloat32ArrayCustom.cpp b/Source/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
index eb4608c..5da69b4 100644
--- a/Source/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
@@ -24,9 +24,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "JSFloat32Array.h"
#include "Float32Array.h"
@@ -62,5 +59,3 @@ EncodedJSValue JSC_HOST_CALL JSFloat32ArrayConstructor::constructJSFloat32Array(
}
} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
index ae9115e..84dd72e 100644
--- a/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
+++ b/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
@@ -30,7 +30,7 @@
#include "CanvasContextAttributes.h"
#include "HTMLCanvasElement.h"
#include "JSCanvasRenderingContext2D.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "JSWebGLRenderingContext.h"
#include "WebGLContextAttributes.h"
#endif
@@ -55,7 +55,7 @@ JSValue JSHTMLCanvasElement::getContext(ExecState* exec)
HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(impl());
const UString& contextId = exec->argument(0).toString(exec);
RefPtr<CanvasContextAttributes> attrs;
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
if (contextId == "experimental-webgl" || contextId == "webkit-3d") {
attrs = WebGLContextAttributes::create();
WebGLContextAttributes* webGLAttrs = static_cast<WebGLContextAttributes*>(attrs.get());
diff --git a/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp b/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
index 0b40ef0..192ef5d 100644
--- a/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
+++ b/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
@@ -26,7 +26,6 @@
#include "config.h"
#include "JSHTMLDocument.h"
-#include "CharacterNames.h"
#include "Frame.h"
#include "HTMLAllCollection.h"
#include "HTMLBodyElement.h"
@@ -43,6 +42,7 @@
#include "DocumentParser.h"
#include <runtime/Error.h>
#include <runtime/JSCell.h>
+#include <wtf/unicode/CharacterNames.h>
using namespace JSC;
@@ -96,7 +96,7 @@ JSValue JSHTMLDocument::all(ExecState* exec) const
void JSHTMLDocument::setAll(ExecState* exec, JSValue value)
{
// Add "all" to the property map.
- putDirect(Identifier(exec, "all"), value);
+ putDirect(exec->globalData(), Identifier(exec, "all"), value);
}
// Custom functions
diff --git a/Source/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp
index 617aaff..ea4f4c0 100644
--- a/Source/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp
+++ b/Source/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp
@@ -50,7 +50,7 @@ bool JSHTMLFrameSetElement::canGetItemsForName(ExecState*, HTMLFrameSetElement*
JSValue JSHTMLFrameSetElement::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
{
JSHTMLElement* thisObj = static_cast<JSHTMLElement*>(asObject(slotBase));
- HTMLElement* element = static_cast<HTMLElement*>(thisObj->impl());
+ HTMLElement* element = toHTMLElement(thisObj->impl());
Node* frame = element->children()->namedItem(identifierToAtomicString(propertyName));
if (Document* doc = static_cast<HTMLFrameElement*>(frame)->contentDocument()) {
diff --git a/Source/WebCore/bindings/js/JSImageConstructor.cpp b/Source/WebCore/bindings/js/JSImageConstructor.cpp
index f2ad803..5192e12 100644
--- a/Source/WebCore/bindings/js/JSImageConstructor.cpp
+++ b/Source/WebCore/bindings/js/JSImageConstructor.cpp
@@ -37,7 +37,7 @@ const ClassInfo JSImageConstructor::s_info = { "ImageConstructor", 0, 0, 0 };
JSImageConstructor::JSImageConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
: DOMConstructorWithDocument(JSImageConstructor::createStructure(globalObject->objectPrototype()), globalObject)
{
- putDirect(exec->propertyNames().prototype, JSHTMLImageElementPrototype::self(exec, globalObject), None);
+ putDirect(exec->globalData(), exec->propertyNames().prototype, JSHTMLImageElementPrototype::self(exec, globalObject), None);
}
static EncodedJSValue JSC_HOST_CALL constructImage(ExecState* exec)
diff --git a/Source/WebCore/bindings/js/JSImageDataCustom.cpp b/Source/WebCore/bindings/js/JSImageDataCustom.cpp
index 61c5112..878e1de 100644
--- a/Source/WebCore/bindings/js/JSImageDataCustom.cpp
+++ b/Source/WebCore/bindings/js/JSImageDataCustom.cpp
@@ -49,7 +49,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, ImageData* imageD
Identifier dataName(exec, "data");
DEFINE_STATIC_LOCAL(RefPtr<Structure>, cpaStructure, (JSByteArray::createStructure(jsNull())));
static const ClassInfo cpaClassInfo = { "CanvasPixelArray", 0, 0, 0 };
- wrapper->putDirect(dataName, new (exec) JSByteArray(exec, cpaStructure, imageData->data()->data(), &cpaClassInfo), DontDelete | ReadOnly);
+ wrapper->putDirect(exec->globalData(), dataName, new (exec) JSByteArray(exec, cpaStructure, imageData->data()->data(), &cpaClassInfo), DontDelete | ReadOnly);
exec->heap()->reportExtraMemoryCost(imageData->data()->length());
return wrapper;
diff --git a/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
index 971098d..dd36c2e 100644
--- a/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
+++ b/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
@@ -46,7 +46,7 @@
#include "FrameLoader.h"
#include "InjectedScript.h"
#include "InjectedScriptHost.h"
-#include "InspectorController.h"
+#include "InspectorAgent.h"
#include "InspectorValues.h"
#include "JSDOMWindow.h"
#include "JSDOMWindowCustom.h"
@@ -128,8 +128,7 @@ JSValue JSInjectedScriptHost::nodeForId(ExecState* exec)
if (!node)
return jsUndefined();
- InspectorController* ic = impl()->inspectorController();
- if (!ic)
+ if (!impl()->inspectorAgent())
return jsUndefined();
JSLock lock(SilenceAssertionsOnly);
@@ -177,8 +176,7 @@ JSValue JSInjectedScriptHost::selectDOMStorage(ExecState* exec)
{
if (exec->argumentCount() < 1)
return jsUndefined();
- InspectorController* ic = impl()->inspectorController();
- if (!ic)
+ if (!impl()->inspectorAgent())
return jsUndefined();
Storage* storage = toStorage(exec->argument(0));
diff --git a/Source/WebCore/bindings/js/JSInt16ArrayCustom.cpp b/Source/WebCore/bindings/js/JSInt16ArrayCustom.cpp
index 2e56d0b..87ea6fe 100644
--- a/Source/WebCore/bindings/js/JSInt16ArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSInt16ArrayCustom.cpp
@@ -24,9 +24,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "JSInt16Array.h"
#include "Int16Array.h"
@@ -62,5 +59,3 @@ EncodedJSValue JSC_HOST_CALL JSInt16ArrayConstructor::constructJSInt16Array(Exec
}
} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/bindings/js/JSInt32ArrayCustom.cpp b/Source/WebCore/bindings/js/JSInt32ArrayCustom.cpp
index eaf474a..8b824a7 100644
--- a/Source/WebCore/bindings/js/JSInt32ArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSInt32ArrayCustom.cpp
@@ -24,9 +24,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "JSInt32Array.h"
#include "Int32Array.h"
@@ -62,5 +59,3 @@ EncodedJSValue JSC_HOST_CALL JSInt32ArrayConstructor::constructJSInt32Array(Exec
}
} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/bindings/js/JSInt8ArrayCustom.cpp b/Source/WebCore/bindings/js/JSInt8ArrayCustom.cpp
index c4bd007..dcbcc5a 100644
--- a/Source/WebCore/bindings/js/JSInt8ArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSInt8ArrayCustom.cpp
@@ -24,9 +24,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "JSInt8Array.h"
#include "Int8Array.h"
@@ -63,5 +60,3 @@ EncodedJSValue JSC_HOST_CALL JSInt8ArrayConstructor::constructJSInt8Array(ExecSt
}
} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp b/Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp
index 0f47b7b..7c00bd4 100644
--- a/Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp
+++ b/Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp
@@ -79,7 +79,7 @@ JSValue JSJavaScriptCallFrame::scopeChain(ExecState* exec) const
MarkedArgumentBuffer list;
do {
- list.append(*iter);
+ list.append(iter->get());
++iter;
} while (iter != end);
@@ -100,7 +100,7 @@ JSValue JSJavaScriptCallFrame::scopeType(ExecState* exec)
bool foundLocalScope = false;
for (ScopeChainIterator iter = scopeChain->begin(); iter != end; ++iter) {
- JSObject* scope = *iter;
+ JSC::DeprecatedPtr<JSObject> scope = *iter;
if (scope->isActivationObject()) {
if (!foundLocalScope) {
// First activation object is local scope, each successive activation object is closure.
diff --git a/Source/WebCore/bindings/js/JSMemoryInfoCustom.cpp b/Source/WebCore/bindings/js/JSMemoryInfoCustom.cpp
new file mode 100644
index 0000000..94c0e8a
--- /dev/null
+++ b/Source/WebCore/bindings/js/JSMemoryInfoCustom.cpp
@@ -0,0 +1,44 @@
+/*
+ * 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 "JSMemoryInfo.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+JSValue JSMemoryInfo::jsHeapSizeLimit(ExecState*) const
+{
+ return jsUndefined();
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/JSNodeCustom.cpp b/Source/WebCore/bindings/js/JSNodeCustom.cpp
index a0963b8..8d00447 100644
--- a/Source/WebCore/bindings/js/JSNodeCustom.cpp
+++ b/Source/WebCore/bindings/js/JSNodeCustom.cpp
@@ -169,7 +169,7 @@ static ALWAYS_INLINE JSValue createWrapperInline(ExecState* exec, JSDOMGlobalObj
switch (node->nodeType()) {
case Node::ELEMENT_NODE:
if (node->isHTMLElement())
- wrapper = createJSHTMLWrapper(exec, globalObject, static_cast<HTMLElement*>(node));
+ wrapper = createJSHTMLWrapper(exec, globalObject, toHTMLElement(node));
#if ENABLE(SVG)
else if (node->isSVGElement())
wrapper = createJSSVGWrapper(exec, globalObject, static_cast<SVGElement*>(node));
diff --git a/Source/WebCore/bindings/js/JSNodeFilterCondition.cpp b/Source/WebCore/bindings/js/JSNodeFilterCondition.cpp
index b269e5f..1cf72a5 100644
--- a/Source/WebCore/bindings/js/JSNodeFilterCondition.cpp
+++ b/Source/WebCore/bindings/js/JSNodeFilterCondition.cpp
@@ -39,14 +39,14 @@ JSNodeFilterCondition::JSNodeFilterCondition(JSValue filter)
void JSNodeFilterCondition::markAggregate(MarkStack& markStack)
{
- markStack.append(m_filter);
+ markStack.append(&m_filter);
}
short JSNodeFilterCondition::acceptNode(JSC::ExecState* exec, Node* filterNode) const
{
JSLock lock(SilenceAssertionsOnly);
- if (!m_filter.isObject())
+ if (!m_filter->isObject())
return NodeFilter::FILTER_ACCEPT;
// The exec argument here should only be null if this was called from a
@@ -58,11 +58,11 @@ short JSNodeFilterCondition::acceptNode(JSC::ExecState* exec, Node* filterNode)
if (!exec)
return NodeFilter::FILTER_REJECT;
- JSValue function = m_filter;
+ JSValue function = m_filter.get();
CallData callData;
CallType callType = getCallData(function, callData);
if (callType == CallTypeNone) {
- function = m_filter.get(exec, Identifier(exec, "acceptNode"));
+ function = m_filter->get(exec, Identifier(exec, "acceptNode"));
callType = getCallData(function, callData);
if (callType == CallTypeNone) {
throwError(exec, createTypeError(exec, "NodeFilter object does not have an acceptNode function"));
@@ -77,7 +77,7 @@ short JSNodeFilterCondition::acceptNode(JSC::ExecState* exec, Node* filterNode)
if (exec->hadException())
return NodeFilter::FILTER_REJECT;
- JSValue result = JSC::call(exec, function, callType, callData, m_filter, args);
+ JSValue result = JSC::call(exec, function, callType, callData, m_filter.get(), args);
if (exec->hadException())
return NodeFilter::FILTER_REJECT;
diff --git a/Source/WebCore/bindings/js/JSNodeFilterCondition.h b/Source/WebCore/bindings/js/JSNodeFilterCondition.h
index b96534a..14b0c1d 100644
--- a/Source/WebCore/bindings/js/JSNodeFilterCondition.h
+++ b/Source/WebCore/bindings/js/JSNodeFilterCondition.h
@@ -41,7 +41,7 @@ namespace WebCore {
virtual short acceptNode(ScriptState*, Node*) const;
virtual void markAggregate(JSC::MarkStack&);
- mutable JSC::JSValue m_filter;
+ mutable JSC::DeprecatedPtr<JSC::Unknown> m_filter;
};
} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp b/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp
index bb90c4f..bc79e99 100644
--- a/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp
+++ b/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "JSNodeFilter.h"
+#include "JSDOMWindowBase.h"
#include "JSNode.h"
#include "JSNodeFilterCondition.h"
#include "NodeFilter.h"
diff --git a/Source/WebCore/bindings/js/JSOptionConstructor.cpp b/Source/WebCore/bindings/js/JSOptionConstructor.cpp
index 4ecfe58..e14fb6d 100644
--- a/Source/WebCore/bindings/js/JSOptionConstructor.cpp
+++ b/Source/WebCore/bindings/js/JSOptionConstructor.cpp
@@ -38,8 +38,8 @@ const ClassInfo JSOptionConstructor::s_info = { "OptionConstructor", 0, 0, 0 };
JSOptionConstructor::JSOptionConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
: DOMConstructorWithDocument(JSOptionConstructor::createStructure(globalObject->objectPrototype()), globalObject)
{
- putDirect(exec->propertyNames().prototype, JSHTMLOptionElementPrototype::self(exec, globalObject), None);
- putDirect(exec->propertyNames().length, jsNumber(4), ReadOnly | DontDelete | DontEnum);
+ putDirect(exec->globalData(), exec->propertyNames().prototype, JSHTMLOptionElementPrototype::self(exec, globalObject), None);
+ putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(4), ReadOnly | DontDelete | DontEnum);
}
static EncodedJSValue JSC_HOST_CALL constructHTMLOptionElement(ExecState* exec)
diff --git a/Source/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp b/Source/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp
index 7274cd0..0fcd1ea 100644
--- a/Source/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp
+++ b/Source/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp
@@ -74,7 +74,7 @@ JSValue JSSQLResultSetRowList::item(ExecState* exec)
ASSERT_NOT_REACHED();
}
- object->putDirect(Identifier(exec, stringToUString(m_impl->columnNames()[i])), jsValue, DontDelete | ReadOnly);
+ object->putDirect(exec->globalData(), Identifier(exec, stringToUString(m_impl->columnNames()[i])), jsValue, DontDelete | ReadOnly);
}
return object;
diff --git a/Source/WebCore/bindings/js/JSUint16ArrayCustom.cpp b/Source/WebCore/bindings/js/JSUint16ArrayCustom.cpp
index 9e476f2..16f9db2 100644
--- a/Source/WebCore/bindings/js/JSUint16ArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSUint16ArrayCustom.cpp
@@ -24,9 +24,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "JSUint16Array.h"
#include "JSArrayBufferViewHelper.h"
@@ -62,5 +59,3 @@ EncodedJSValue JSC_HOST_CALL JSUint16ArrayConstructor::constructJSUint16Array(Ex
}
} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/bindings/js/JSUint32ArrayCustom.cpp b/Source/WebCore/bindings/js/JSUint32ArrayCustom.cpp
index d221c2a..1e071c9 100644
--- a/Source/WebCore/bindings/js/JSUint32ArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSUint32ArrayCustom.cpp
@@ -24,9 +24,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "JSUint32Array.h"
#include "JSArrayBufferViewHelper.h"
@@ -62,5 +59,3 @@ EncodedJSValue JSC_HOST_CALL JSUint32ArrayConstructor::constructJSUint32Array(Ex
}
} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/bindings/js/JSUint8ArrayCustom.cpp b/Source/WebCore/bindings/js/JSUint8ArrayCustom.cpp
index b37eea8..e90f8e9 100644
--- a/Source/WebCore/bindings/js/JSUint8ArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSUint8ArrayCustom.cpp
@@ -24,9 +24,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "JSUint8Array.h"
#include "JSArrayBufferViewHelper.h"
@@ -62,5 +59,3 @@ EncodedJSValue JSC_HOST_CALL JSUint8ArrayConstructor::constructJSUint8Array(Exec
}
} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp b/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
index dc32d5f..eb4f6e2 100644
--- a/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
+++ b/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "JSWebGLRenderingContext.h"
@@ -89,14 +89,14 @@ static JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, const WebG
}
case WebGLGetInfo::kTypeFloat:
return jsNumber(info.getFloat());
- case WebGLGetInfo::kTypeLong:
- return jsNumber(info.getLong());
+ case WebGLGetInfo::kTypeInt:
+ return jsNumber(info.getInt());
case WebGLGetInfo::kTypeNull:
return jsNull();
case WebGLGetInfo::kTypeString:
return jsString(exec, info.getString());
- case WebGLGetInfo::kTypeUnsignedLong:
- return jsNumber(info.getUnsignedLong());
+ case WebGLGetInfo::kTypeUnsignedInt:
+ return jsNumber(info.getUnsignedInt());
case WebGLGetInfo::kTypeWebGLBuffer:
return toJS(exec, globalObject, info.getWebGLBuffer());
case WebGLGetInfo::kTypeWebGLFloatArray:
@@ -703,4 +703,4 @@ JSC::JSValue JSWebGLRenderingContext::vertexAttrib4fv(JSC::ExecState* exec)
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
index a93db11..1d6f1cb 100644
--- a/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
+++ b/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
@@ -64,7 +64,7 @@ void JSXMLHttpRequest::markChildren(MarkStack& markStack)
if (Document* responseDocument = m_impl->optionalResponseXML())
markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), responseDocument);
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
+#if ENABLE(WEBGL) || ENABLE(BLOB)
if (ArrayBuffer* responseArrayBuffer = m_impl->optionalResponseArrayBuffer())
markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), responseArrayBuffer);
#endif
@@ -124,7 +124,7 @@ JSValue JSXMLHttpRequest::send(ExecState* exec)
impl()->send(toBlob(val), ec);
else if (val.inherits(&JSDOMFormData::s_info))
impl()->send(toDOMFormData(val), ec);
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
+#if ENABLE(WEBGL) || ENABLE(BLOB)
else if (val.inherits(&JSArrayBuffer::s_info))
impl()->send(toArrayBuffer(val), ec);
#endif
@@ -189,7 +189,7 @@ JSValue JSXMLHttpRequest::response(ExecState* exec) const
#endif
case XMLHttpRequest::ResponseTypeArrayBuffer:
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
+#if ENABLE(WEBGL) || ENABLE(BLOB)
{
ExceptionCode ec = 0;
ArrayBuffer* arrayBuffer = impl()->responseArrayBuffer(ec);
diff --git a/Source/WebCore/bindings/js/ScriptCachedFrameData.cpp b/Source/WebCore/bindings/js/ScriptCachedFrameData.cpp
index 16f18d3..d65bce2 100644
--- a/Source/WebCore/bindings/js/ScriptCachedFrameData.cpp
+++ b/Source/WebCore/bindings/js/ScriptCachedFrameData.cpp
@@ -84,7 +84,7 @@ void ScriptCachedFrameData::restore(Frame* frame)
JSDOMWindowShell* windowShell = iter->second.get();
if (JSDOMWindow* window = m_windows.get(world))
- windowShell->setWindow(window);
+ windowShell->setWindow(window->globalData(), window);
else {
windowShell->setWindow(frame->domWindow());
diff --git a/Source/WebCore/bindings/js/ScriptController.cpp b/Source/WebCore/bindings/js/ScriptController.cpp
index cf55080..e7eafd0 100644
--- a/Source/WebCore/bindings/js/ScriptController.cpp
+++ b/Source/WebCore/bindings/js/ScriptController.cpp
@@ -40,7 +40,6 @@
#include "StorageNamespace.h"
#include "UserGestureIndicator.h"
#include "WebCoreJSClientData.h"
-#include "XSSAuditor.h"
#include "npruntime_impl.h"
#include "runtime_root.h"
#include <debugger/Debugger.h>
@@ -72,7 +71,6 @@ ScriptController::ScriptController(Frame* frame)
#if PLATFORM(MAC)
, m_windowScriptObject(0)
#endif
- , m_XSSAuditor(new XSSAuditor(frame))
{
#if PLATFORM(MAC) && ENABLE(JAVA_BRIDGE)
static bool initializedJavaJSBindings;
@@ -116,16 +114,11 @@ JSDOMWindowShell* ScriptController::createWindowShell(DOMWrapperWorld* world)
return windowShell;
}
-ScriptValue ScriptController::evaluateInWorld(const ScriptSourceCode& sourceCode, DOMWrapperWorld* world, ShouldAllowXSS shouldAllowXSS)
+ScriptValue ScriptController::evaluateInWorld(const ScriptSourceCode& sourceCode, DOMWrapperWorld* world)
{
const SourceCode& jsSourceCode = sourceCode.jsSourceCode();
String sourceURL = ustringToString(jsSourceCode.provider()->url());
- if (shouldAllowXSS == DoNotAllowXSS && !m_XSSAuditor->canEvaluate(sourceCode.source())) {
- // This script is not safe to be evaluated.
- return JSValue();
- }
-
// evaluate code. Returns the JS return value or 0
// if there was none, an error occurred or the type couldn't be converted.
@@ -166,9 +159,9 @@ ScriptValue ScriptController::evaluateInWorld(const ScriptSourceCode& sourceCode
return JSValue();
}
-ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode, ShouldAllowXSS shouldAllowXSS)
+ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
{
- return evaluateInWorld(sourceCode, mainThreadNormalWorld(), shouldAllowXSS);
+ return evaluateInWorld(sourceCode, mainThreadNormalWorld());
}
PassRefPtr<DOMWrapperWorld> ScriptController::createWorld()
@@ -497,7 +490,7 @@ void ScriptController::clearScriptObjects()
#endif
}
-ScriptValue ScriptController::executeScriptInWorld(DOMWrapperWorld* world, const String& script, bool forceUserGesture, ShouldAllowXSS shouldAllowXSS)
+ScriptValue ScriptController::executeScriptInWorld(DOMWrapperWorld* world, const String& script, bool forceUserGesture)
{
ScriptSourceCode sourceCode(script, forceUserGesture ? KURL() : m_frame->document()->url());
@@ -507,7 +500,7 @@ ScriptValue ScriptController::executeScriptInWorld(DOMWrapperWorld* world, const
bool wasInExecuteScript = m_inExecuteScript;
m_inExecuteScript = true;
- ScriptValue result = evaluateInWorld(sourceCode, world, shouldAllowXSS);
+ ScriptValue result = evaluateInWorld(sourceCode, world);
if (!wasInExecuteScript) {
m_inExecuteScript = false;
diff --git a/Source/WebCore/bindings/js/ScriptController.h b/Source/WebCore/bindings/js/ScriptController.h
index 413b88a..19542af 100644
--- a/Source/WebCore/bindings/js/ScriptController.h
+++ b/Source/WebCore/bindings/js/ScriptController.h
@@ -59,7 +59,6 @@ class Node;
class ScriptSourceCode;
class ScriptValue;
class Widget;
-class XSSAuditor;
typedef HashMap<void*, RefPtr<JSC::Bindings::RootObject> > RootObjectMap;
@@ -93,9 +92,9 @@ public:
static void getAllWorlds(Vector<DOMWrapperWorld*>&);
- ScriptValue executeScript(const ScriptSourceCode&, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
- ScriptValue executeScript(const String& script, bool forceUserGesture = false, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
- ScriptValue executeScriptInWorld(DOMWrapperWorld* world, const String& script, bool forceUserGesture = false, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
+ ScriptValue executeScript(const ScriptSourceCode&);
+ ScriptValue executeScript(const String& script, bool forceUserGesture = false);
+ ScriptValue executeScriptInWorld(DOMWrapperWorld*, const String& script, bool forceUserGesture = false);
// Returns true if argument is a JavaScript URL.
bool executeIfJavaScriptURL(const KURL&, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL);
@@ -104,8 +103,8 @@ public:
// Darwin is an exception to this rule: it is OK to call this function from any thread, even reentrantly.
static void initializeThreading();
- ScriptValue evaluate(const ScriptSourceCode&, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
- ScriptValue evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld*, ShouldAllowXSS shouldAllowXSS = DoNotAllowXSS);
+ ScriptValue evaluate(const ScriptSourceCode&);
+ ScriptValue evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld*);
int eventHandlerLineNumber() const;
@@ -168,8 +167,6 @@ public:
NPObject* createScriptObjectForPluginElement(HTMLPlugInElement*);
NPObject* windowScriptNPObject();
#endif
-
- XSSAuditor* xssAuditor() { return m_XSSAuditor.get(); }
private:
JSDOMWindowShell* initScript(DOMWrapperWorld* world);
@@ -202,9 +199,6 @@ private:
#if PLATFORM(MAC)
RetainPtr<WebScriptObject> m_windowScriptObject;
#endif
-
- // The XSSAuditor associated with this ScriptController.
- OwnPtr<XSSAuditor> m_XSSAuditor;
};
} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/ScriptDebugServer.cpp b/Source/WebCore/bindings/js/ScriptDebugServer.cpp
index b516f6d..aed2ad4 100644
--- a/Source/WebCore/bindings/js/ScriptDebugServer.cpp
+++ b/Source/WebCore/bindings/js/ScriptDebugServer.cpp
@@ -117,20 +117,6 @@ void ScriptDebugServer::removeListener(ScriptDebugListener* listener, Page* page
didRemoveListener(page);
}
-void ScriptDebugServer::pageCreated(Page* page)
-{
- ASSERT_ARG(page, page);
-
- if (!hasListenersInterestedInPage(page))
- return;
- page->setDebugger(this);
-}
-
-bool ScriptDebugServer::isDebuggerAlwaysEnabled()
-{
- return false;
-}
-
bool ScriptDebugServer::hasListenersInterestedInPage(Page* page)
{
ASSERT_ARG(page, page);
@@ -138,19 +124,21 @@ bool ScriptDebugServer::hasListenersInterestedInPage(Page* page)
return m_pageListenersMap.contains(page);
}
-String ScriptDebugServer::setBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition, bool enabled, unsigned* actualLineNumber)
+String ScriptDebugServer::setBreakpoint(const String& sourceID, const ScriptBreakpoint& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber)
{
intptr_t sourceIDValue = sourceID.toIntPtr();
if (!sourceIDValue)
return "";
- BreakpointsMap::iterator it = m_breakpoints.find(sourceIDValue);
- if (it == m_breakpoints.end())
- it = m_breakpoints.set(sourceIDValue, SourceBreakpoints()).first;
- if (it->second.contains(lineNumber))
+ SourceIdToBreakpointsMap::iterator it = m_sourceIdToBreakpoints.find(sourceIDValue);
+ if (it == m_sourceIdToBreakpoints.end())
+ it = m_sourceIdToBreakpoints.set(sourceIDValue, LineToBreakpointMap()).first;
+ if (it->second.contains(scriptBreakpoint.lineNumber + 1))
return "";
- it->second.set(lineNumber, ScriptBreakpoint(enabled, condition));
- *actualLineNumber = lineNumber;
- return makeString(sourceID, ":", String::number(lineNumber));
+ it->second.set(scriptBreakpoint.lineNumber + 1, scriptBreakpoint);
+ *actualLineNumber = scriptBreakpoint.lineNumber;
+ // FIXME(WK53003): implement setting breakpoints by line:column.
+ *actualColumnNumber = 0;
+ return makeString(sourceID, ":", String::number(scriptBreakpoint.lineNumber));
}
void ScriptDebugServer::removeBreakpoint(const String& breakpointId)
@@ -166,9 +154,9 @@ void ScriptDebugServer::removeBreakpoint(const String& breakpointId)
unsigned lineNumber = tokens[1].toUInt(&success);
if (!success)
return;
- BreakpointsMap::iterator it = m_breakpoints.find(sourceIDValue);
- if (it != m_breakpoints.end())
- it->second.remove(lineNumber);
+ SourceIdToBreakpointsMap::iterator it = m_sourceIdToBreakpoints.find(sourceIDValue);
+ if (it != m_sourceIdToBreakpoints.end())
+ it->second.remove(lineNumber + 1);
}
bool ScriptDebugServer::hasBreakpoint(intptr_t sourceID, unsigned lineNumber) const
@@ -176,10 +164,10 @@ bool ScriptDebugServer::hasBreakpoint(intptr_t sourceID, unsigned lineNumber) co
if (!m_breakpointsActivated)
return false;
- BreakpointsMap::const_iterator it = m_breakpoints.find(sourceID);
- if (it == m_breakpoints.end())
+ SourceIdToBreakpointsMap::const_iterator it = m_sourceIdToBreakpoints.find(sourceID);
+ if (it == m_sourceIdToBreakpoints.end())
return false;
- SourceBreakpoints::const_iterator breakIt = it->second.find(lineNumber);
+ LineToBreakpointMap::const_iterator breakIt = it->second.find(lineNumber);
if (breakIt == it->second.end() || !breakIt->second.enabled)
return false;
@@ -198,7 +186,7 @@ bool ScriptDebugServer::hasBreakpoint(intptr_t sourceID, unsigned lineNumber) co
void ScriptDebugServer::clearBreakpoints()
{
- m_breakpoints.clear();
+ m_sourceIdToBreakpoints.clear();
}
void ScriptDebugServer::setBreakpointsActivated(bool activated)
diff --git a/Source/WebCore/bindings/js/ScriptDebugServer.h b/Source/WebCore/bindings/js/ScriptDebugServer.h
index bde4736..428b254 100644
--- a/Source/WebCore/bindings/js/ScriptDebugServer.h
+++ b/Source/WebCore/bindings/js/ScriptDebugServer.h
@@ -64,7 +64,7 @@ public:
void addListener(ScriptDebugListener*, Page*);
void removeListener(ScriptDebugListener*, Page*);
- String setBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition, bool enabled, unsigned* actualLineNumber);
+ String setBreakpoint(const String& sourceID, const ScriptBreakpoint&, int* actualLineNumber, int* actualColumnNumber);
void removeBreakpoint(const String& breakpointId);
void clearBreakpoints();
void setBreakpointsActivated(bool activated);
@@ -93,10 +93,6 @@ public:
JavaScriptCallFrame* currentCallFrame();
- void pageCreated(Page*);
-
- bool isDebuggerAlwaysEnabled();
-
private:
typedef HashSet<ScriptDebugListener*> ListenerSet;
typedef void (ScriptDebugServer::*JavaScriptExecutionCallback)(ScriptDebugListener*);
@@ -138,7 +134,8 @@ private:
void didRemoveListener(Page*);
typedef HashMap<Page*, ListenerSet*> PageListenersMap;
- typedef HashMap<intptr_t, SourceBreakpoints> BreakpointsMap;
+ typedef HashMap<long, ScriptBreakpoint> LineToBreakpointMap;
+ typedef HashMap<intptr_t, LineToBreakpointMap> SourceIdToBreakpointsMap;
PageListenersMap m_pageListenersMap;
bool m_callingListeners;
@@ -150,7 +147,7 @@ private:
bool m_breakpointsActivated;
JavaScriptCallFrame* m_pauseOnCallFrame;
RefPtr<JavaScriptCallFrame> m_currentCallFrame;
- BreakpointsMap m_breakpoints;
+ SourceIdToBreakpointsMap m_sourceIdToBreakpoints;
Timer<ScriptDebugServer> m_recompileTimer;
};
diff --git a/Source/WebCore/bindings/js/ScriptEventListener.cpp b/Source/WebCore/bindings/js/ScriptEventListener.cpp
index d2baf82..3a03f59 100644
--- a/Source/WebCore/bindings/js/ScriptEventListener.cpp
+++ b/Source/WebCore/bindings/js/ScriptEventListener.cpp
@@ -36,7 +36,6 @@
#include "EventListener.h"
#include "JSNode.h"
#include "Frame.h"
-#include "XSSAuditor.h"
#include <runtime/JSLock.h>
using namespace JSC;
@@ -66,11 +65,6 @@ PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node* node, Attribu
if (!scriptController->canExecuteScripts(AboutToExecuteScript))
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();
}
@@ -94,11 +88,6 @@ PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame* frame, Attri
if (!scriptController->canExecuteScripts(AboutToExecuteScript))
return 0;
- if (!scriptController->xssAuditor()->canCreateInlineEventListener(attr->localName().string(), attr->value())) {
- // This script is not safe to execute.
- return 0;
- }
-
lineNumber = scriptController->eventHandlerLineNumber();
sourceURL = frame->document()->url().string();
JSObject* wrapper = toJSDOMWindow(frame, mainThreadNormalWorld());
diff --git a/Source/WebCore/bindings/js/ScriptGCEvent.cpp b/Source/WebCore/bindings/js/ScriptGCEvent.cpp
index b7fc7b3..dd027b4 100644
--- a/Source/WebCore/bindings/js/ScriptGCEvent.cpp
+++ b/Source/WebCore/bindings/js/ScriptGCEvent.cpp
@@ -42,12 +42,14 @@ namespace WebCore {
using namespace JSC;
-void ScriptGCEvent::getHeapSize(size_t& usedHeapSize, size_t& totalHeapSize)
+void ScriptGCEvent::getHeapSize(size_t& usedHeapSize, size_t& totalHeapSize, size_t& heapSizeLimit)
{
JSGlobalData* globalData = JSDOMWindow::commonJSGlobalData();
- totalHeapSize = globalData->heap.size();
- usedHeapSize = totalHeapSize;
+ totalHeapSize = globalData->heap.capacity();
+ usedHeapSize = globalData->heap.size();
+ heapSizeLimit = 0;
}
+
} // namespace WebCore
#endif // !ENABLE(INSPECTOR)
diff --git a/Source/WebCore/bindings/js/ScriptGCEvent.h b/Source/WebCore/bindings/js/ScriptGCEvent.h
index 86d4f68..6614b8e 100644
--- a/Source/WebCore/bindings/js/ScriptGCEvent.h
+++ b/Source/WebCore/bindings/js/ScriptGCEvent.h
@@ -42,7 +42,7 @@ class ScriptGCEvent
public:
static void addEventListener(ScriptGCEventListener*) { }
static void removeEventListener(ScriptGCEventListener*) { }
- static void getHeapSize(size_t& usedHeapSize, size_t& totalHeapSize);
+ static void getHeapSize(size_t& usedHeapSize, size_t& totalHeapSize, size_t& heapSizeLimit);
};
} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/ScriptObject.cpp b/Source/WebCore/bindings/js/ScriptObject.cpp
index e06eccb..b5c1f01 100644
--- a/Source/WebCore/bindings/js/ScriptObject.cpp
+++ b/Source/WebCore/bindings/js/ScriptObject.cpp
@@ -62,7 +62,7 @@ static bool handleException(ScriptState* scriptState)
bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, const ScriptObject& value)
{
JSLock lock(SilenceAssertionsOnly);
- scriptState->lexicalGlobalObject()->putDirect(Identifier(scriptState, name), value.jsObject());
+ scriptState->lexicalGlobalObject()->putDirect(scriptState->globalData(), Identifier(scriptState, name), value.jsObject());
return handleException(scriptState);
}
@@ -71,7 +71,7 @@ bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, Inspect
{
JSLock lock(SilenceAssertionsOnly);
JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
- globalObject->putDirect(Identifier(scriptState, name), toJS(scriptState, globalObject, value));
+ globalObject->putDirect(scriptState->globalData(), Identifier(scriptState, name), toJS(scriptState, globalObject, value));
return handleException(scriptState);
}
@@ -79,7 +79,7 @@ bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, Injecte
{
JSLock lock(SilenceAssertionsOnly);
JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
- globalObject->putDirect(Identifier(scriptState, name), toJS(scriptState, globalObject, value));
+ globalObject->putDirect(scriptState->globalData(), Identifier(scriptState, name), toJS(scriptState, globalObject, value));
return handleException(scriptState);
}
#endif // ENABLE(INSPECTOR)
diff --git a/Source/WebCore/bindings/js/ScriptProfiler.cpp b/Source/WebCore/bindings/js/ScriptProfiler.cpp
index 62ae9ba..f372c3c 100644
--- a/Source/WebCore/bindings/js/ScriptProfiler.cpp
+++ b/Source/WebCore/bindings/js/ScriptProfiler.cpp
@@ -46,11 +46,6 @@ PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String&
return ScriptProfile::create(profile);
}
-bool ScriptProfiler::isProfilerAlwaysEnabled()
-{
- return false;
-}
-
} // namespace WebCore
#endif // ENABLE(JAVASCRIPT_DEBUGGER)
diff --git a/Source/WebCore/bindings/js/ScriptProfiler.h b/Source/WebCore/bindings/js/ScriptProfiler.h
index d4dd606..d8ad482 100644
--- a/Source/WebCore/bindings/js/ScriptProfiler.h
+++ b/Source/WebCore/bindings/js/ScriptProfiler.h
@@ -38,10 +38,18 @@ namespace WebCore {
class ScriptProfiler {
WTF_MAKE_NONCOPYABLE(ScriptProfiler);
public:
+ class HeapSnapshotProgress {
+ public:
+ virtual ~HeapSnapshotProgress() { }
+ virtual void Start(int totalWork) = 0;
+ virtual void Worked(int workDone) = 0;
+ virtual void Done() = 0;
+ virtual bool isCanceled() = 0;
+ };
+
static void start(ScriptState* state, const String& title);
static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title);
- static PassRefPtr<ScriptHeapSnapshot> takeHeapSnapshot(const String&) { return 0; }
- static bool isProfilerAlwaysEnabled();
+ static PassRefPtr<ScriptHeapSnapshot> takeHeapSnapshot(const String&, HeapSnapshotProgress*) { return 0; }
};
} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/SerializedScriptValue.cpp b/Source/WebCore/bindings/js/SerializedScriptValue.cpp
index b02a4bb..f721334 100644
--- a/Source/WebCore/bindings/js/SerializedScriptValue.cpp
+++ b/Source/WebCore/bindings/js/SerializedScriptValue.cpp
@@ -1040,14 +1040,14 @@ private:
void putProperty(JSArray* array, unsigned index, JSValue value)
{
if (array->canSetIndex(index))
- array->setIndex(index, value);
+ array->setIndex(m_exec->globalData(), index, value);
else
array->put(m_exec, index, value);
}
void putProperty(JSObject* object, const Identifier& property, JSValue value)
{
- object->putDirect(property, value);
+ object->putDirect(m_exec->globalData(), property, value);
}
bool readFile(RefPtr<File>& file)
diff --git a/Source/WebCore/bindings/js/WorkerScriptController.cpp b/Source/WebCore/bindings/js/WorkerScriptController.cpp
index 5872b2e..0c89632 100644
--- a/Source/WebCore/bindings/js/WorkerScriptController.cpp
+++ b/Source/WebCore/bindings/js/WorkerScriptController.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * 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
@@ -80,8 +81,8 @@ void WorkerScriptController::initScript()
RefPtr<Structure> structure = JSDedicatedWorkerContext::createStructure(dedicatedContextPrototype);
m_workerContextWrapper = new (m_globalData.get()) JSDedicatedWorkerContext(structure.release(), m_workerContext->toDedicatedWorkerContext());
- workerContextPrototype->putAnonymousValue(0, m_workerContextWrapper);
- dedicatedContextPrototype->putAnonymousValue(0, m_workerContextWrapper);
+ workerContextPrototype->putAnonymousValue(*m_globalData, 0, m_workerContextWrapper);
+ dedicatedContextPrototype->putAnonymousValue(*m_globalData, 0, m_workerContextWrapper);
#if ENABLE(SHARED_WORKERS)
} else {
ASSERT(m_workerContext->isSharedWorkerContext());
@@ -90,8 +91,8 @@ void WorkerScriptController::initScript()
RefPtr<Structure> structure = JSSharedWorkerContext::createStructure(sharedContextPrototype);
m_workerContextWrapper = new (m_globalData.get()) JSSharedWorkerContext(structure.release(), m_workerContext->toSharedWorkerContext());
- workerContextPrototype->putAnonymousValue(0, m_workerContextWrapper);
- sharedContextPrototype->putAnonymousValue(0, m_workerContextWrapper);
+ workerContextPrototype->putAnonymousValue(*m_globalData, 0, m_workerContextWrapper);
+ sharedContextPrototype->putAnonymousValue(*m_globalData, 0, m_workerContextWrapper);
#endif
}
}
@@ -131,8 +132,15 @@ ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode,
if (comp.complType() == Normal || comp.complType() == ReturnValue)
return comp.value();
- if (comp.complType() == Throw)
- *exception = comp.value();
+ if (comp.complType() == Throw) {
+ String errorMessage;
+ int lineNumber = 0;
+ String sourceURL = sourceCode.url().string();
+ if (m_workerContext->sanitizeScriptError(errorMessage, lineNumber, sourceURL))
+ *exception = ScriptValue(throwError(exec, createError(exec, errorMessage.impl())));
+ else
+ *exception = comp.value();
+ }
return JSValue();
}