Merge from Chromium at DEPS revision 224184
This commit was generated by merge_to_master.py.
Change-Id: I6aa2623a399e683ff92335749916c23088d1fbd8
diff --git a/Source/bindings/v8/CustomElementConstructorBuilder.cpp b/Source/bindings/v8/CustomElementConstructorBuilder.cpp
index ae717e1..b404034 100644
--- a/Source/bindings/v8/CustomElementConstructorBuilder.cpp
+++ b/Source/bindings/v8/CustomElementConstructorBuilder.cpp
@@ -202,7 +202,7 @@
// property.
m_constructor->ForceSet(prototypeKey, m_prototype, v8::PropertyAttribute(v8::ReadOnly | v8::DontEnum | v8::DontDelete));
- V8HiddenPropertyName::setNamedHiddenReference(m_prototype, "customElementIsInterfacePrototypeObject", v8::True());
+ V8HiddenPropertyName::setNamedHiddenReference(m_prototype, "customElementIsInterfacePrototypeObject", v8::True(isolate));
m_prototype->ForceSet(v8String("constructor", isolate), m_constructor, v8::DontEnum);
return true;
@@ -232,7 +232,7 @@
ScriptValue CustomElementConstructorBuilder::bindingsReturnValue() const
{
- return ScriptValue(m_constructor);
+ return ScriptValue(m_constructor, m_context->GetIsolate());
}
bool CustomElementConstructorBuilder::hasValidPrototypeChainFor(WrapperTypeInfo* type) const
diff --git a/Source/bindings/v8/DOMRequestState.h b/Source/bindings/v8/DOMRequestState.h
index 2bba072..0e06ee4 100644
--- a/Source/bindings/v8/DOMRequestState.h
+++ b/Source/bindings/v8/DOMRequestState.h
@@ -39,7 +39,7 @@
explicit DOMRequestState(ScriptExecutionContext* scriptExecutionContext)
: m_scriptExecutionContext(scriptExecutionContext)
, m_world(DOMWrapperWorld::current())
- , m_isolate(getIsolateFromScriptExecutionContext(scriptExecutionContext))
+ , m_isolate(toIsolate(scriptExecutionContext))
{
}
diff --git a/Source/bindings/v8/Dictionary.cpp b/Source/bindings/v8/Dictionary.cpp
index e34d440..7ca45ec 100644
--- a/Source/bindings/v8/Dictionary.cpp
+++ b/Source/bindings/v8/Dictionary.cpp
@@ -26,7 +26,6 @@
#include "config.h"
#include "bindings/v8/Dictionary.h"
-#include "V8CSSFontFaceRule.h"
#include "V8DOMError.h"
#include "V8EventTarget.h"
#include "V8IDBKeyRange.h"
@@ -181,7 +180,7 @@
if (!getKey(key, v8Value))
return false;
- value = ScriptValue(v8Value);
+ value = ScriptValue(v8Value, m_isolate);
return true;
}
@@ -497,7 +496,7 @@
v8::Local<v8::Array> v8Array = v8::Local<v8::Array>::Cast(v8Value);
for (size_t i = 0; i < v8Array->Length(); ++i) {
- v8::Local<v8::Value> indexedValue = v8Array->Get(v8::Uint32::New(i));
+ v8::Local<v8::Value> indexedValue = v8Array->Get(v8::Uint32::New(i, m_isolate));
V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<>, stringValue, indexedValue, false);
value.append(stringValue);
}
@@ -520,23 +519,6 @@
return true;
}
-bool Dictionary::get(const String& key, RefPtr<CSSFontFaceRule>& value) const
-{
- v8::Local<v8::Value> v8Value;
- if (!getKey(key, v8Value))
- return false;
-
- CSSFontFaceRule* source = 0;
- if (v8Value->IsObject()) {
- v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value);
- v8::Handle<v8::Object> fontface = wrapper->FindInstanceInPrototypeChain(V8CSSFontFaceRule::GetTemplate(m_isolate, worldType(m_isolate)));
- if (!fontface.IsEmpty())
- source = V8CSSFontFaceRule::toNative(fontface);
- }
- value = source;
- return true;
-}
-
bool Dictionary::get(const String& key, RefPtr<DOMError>& value) const
{
v8::Local<v8::Value> v8Value;
diff --git a/Source/bindings/v8/Dictionary.h b/Source/bindings/v8/Dictionary.h
index 4a829a7..ec22291 100644
--- a/Source/bindings/v8/Dictionary.h
+++ b/Source/bindings/v8/Dictionary.h
@@ -39,7 +39,6 @@
namespace WebCore {
class ArrayValue;
-class CSSFontFaceRule;
class DOMError;
class DOMWindow;
class IDBKeyRange;
@@ -92,7 +91,6 @@
bool get(const String&, Dictionary&) const;
bool get(const String&, Vector<String>&) const;
bool get(const String&, ArrayValue&) const;
- bool get(const String&, RefPtr<CSSFontFaceRule>&) const;
bool get(const String&, RefPtr<DOMError>&) const;
bool get(const String&, RefPtr<VoidCallback>&) const;
bool get(const String&, v8::Local<v8::Value>&) const;
diff --git a/Source/bindings/v8/ExceptionMessages.cpp b/Source/bindings/v8/ExceptionMessages.cpp
index 0309f1d..f8d6a55 100644
--- a/Source/bindings/v8/ExceptionMessages.cpp
+++ b/Source/bindings/v8/ExceptionMessages.cpp
@@ -33,6 +33,11 @@
namespace WebCore {
+String ExceptionMessages::failedToConstruct(const String& type, const String& detail)
+{
+ return "Failed to construct '" + type + (!detail.isEmpty() ? String("': " + detail) : String("'"));
+}
+
String ExceptionMessages::failedToExecute(const String& method, const String& type, const String& detail)
{
return "Failed to execute '" + method + "' on '" + type + (!detail.isEmpty() ? String("': " + detail) : String("'"));
@@ -48,4 +53,9 @@
return "Failed to set the '" + property + "' property on '" + type + "': " + detail;
}
+String ExceptionMessages::notEnoughArguments(unsigned expected, unsigned provided)
+{
+ return String::number(expected) + " argument" + (expected > 1 ? "s" : "") + " required, but only " + String::number(provided) + " present.";
+}
+
} // namespace WebCore
diff --git a/Source/bindings/v8/ExceptionMessages.h b/Source/bindings/v8/ExceptionMessages.h
index 8cd532c..424754d 100644
--- a/Source/bindings/v8/ExceptionMessages.h
+++ b/Source/bindings/v8/ExceptionMessages.h
@@ -37,9 +37,12 @@
class ExceptionMessages {
public:
+ static String failedToConstruct(const String& type, const String& detail = String());
static String failedToExecute(const String& method, const String& type, const String& detail = String());
static String failedToGet(const String& property, const String& type, const String& detail);
static String failedToSet(const String& property, const String& type, const String& detail);
+
+ static String notEnoughArguments(unsigned expected, unsigned providedleastNumMandatoryParams);
};
} // namespace WebCore
diff --git a/Source/bindings/v8/ExceptionState.h b/Source/bindings/v8/ExceptionState.h
index abe2aa9..0642a0a 100644
--- a/Source/bindings/v8/ExceptionState.h
+++ b/Source/bindings/v8/ExceptionState.h
@@ -65,7 +65,7 @@
throwDOMException(m_code);
}
- V8ThrowException::throwError(m_exception.newLocal(m_isolate));
+ V8ThrowException::throwError(m_exception.newLocal(m_isolate), m_isolate);
return true;
}
diff --git a/Source/bindings/v8/IDBBindingUtilities.cpp b/Source/bindings/v8/IDBBindingUtilities.cpp
index a727a96..cf88171 100644
--- a/Source/bindings/v8/IDBBindingUtilities.cpp
+++ b/Source/bindings/v8/IDBBindingUtilities.cpp
@@ -74,12 +74,12 @@
static const size_t maximumDepth = 2000;
-static PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value> value, Vector<v8::Handle<v8::Array> >& stack)
+static PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value> value, Vector<v8::Handle<v8::Array> >& stack, v8::Isolate* isolate)
{
if (value->IsNumber() && !std::isnan(value->NumberValue()))
return IDBKey::createNumber(value->NumberValue());
if (value->IsString())
- return IDBKey::createString(toWebCoreString(value));
+ return IDBKey::createString(toWebCoreString(value.As<v8::String>()));
if (value->IsDate() && !std::isnan(value->NumberValue()))
return IDBKey::createDate(value->NumberValue());
if (value->IsArray()) {
@@ -94,8 +94,8 @@
IDBKey::KeyArray subkeys;
uint32_t length = array->Length();
for (uint32_t i = 0; i < length; ++i) {
- v8::Local<v8::Value> item = array->Get(v8::Int32::New(i));
- RefPtr<IDBKey> subkey = createIDBKeyFromValue(item, stack);
+ v8::Local<v8::Value> item = array->Get(v8::Int32::New(i, isolate));
+ RefPtr<IDBKey> subkey = createIDBKeyFromValue(item, stack, isolate);
if (!subkey)
subkeys.append(IDBKey::createInvalid());
else
@@ -108,10 +108,10 @@
return 0;
}
-PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value> value)
+static PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value> value, v8::Isolate* isolate)
{
Vector<v8::Handle<v8::Array> > stack;
- RefPtr<IDBKey> key = createIDBKeyFromValue(value, stack);
+ RefPtr<IDBKey> key = createIDBKeyFromValue(value, stack, isolate);
if (key)
return key;
return IDBKey::createInvalid();
@@ -217,7 +217,7 @@
v8::Handle<v8::Value> v8Key(getNthValueOnKeyPath(v8Value, keyPathElements, keyPathElements.size(), isolate));
if (v8Key.IsEmpty())
return 0;
- return createIDBKeyFromValue(v8Key);
+ return createIDBKeyFromValue(v8Key, isolate);
}
PassRefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(DOMRequestState* state, const ScriptValue& value, const IDBKeyPath& keyPath)
@@ -252,8 +252,8 @@
v8::HandleScope handleScope(isolate);
RefPtr<SerializedScriptValue> serializedValue = prpValue;
if (serializedValue)
- return ScriptValue(serializedValue->deserialize());
- return ScriptValue(v8::Null());
+ return ScriptValue(serializedValue->deserialize(), isolate);
+ return ScriptValue(v8::Null(isolate), isolate);
}
ScriptValue deserializeIDBValueBuffer(DOMRequestState* state, PassRefPtr<SharedBuffer> prpBuffer)
@@ -267,9 +267,9 @@
Vector<uint8_t> value;
value.append(buffer->data(), buffer->size());
RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::createFromWireBytes(value);
- return ScriptValue(serializedValue->deserialize());
+ return ScriptValue(serializedValue->deserialize(), isolate);
}
- return ScriptValue(v8::Null());
+ return ScriptValue(v8::Null(isolate), isolate);
}
bool injectIDBKeyIntoScriptValue(DOMRequestState* state, PassRefPtr<IDBKey> key, ScriptValue& value, const IDBKeyPath& keyPath)
@@ -321,7 +321,7 @@
v8::Isolate* isolate = state ? state->context()->GetIsolate() : v8::Isolate::GetCurrent();
v8::HandleScope handleScope(isolate);
v8::Handle<v8::Value> v8Value(idbKeyToV8Value(key.get(), state->context()->GetIsolate()));
- return ScriptValue(v8Value);
+ return ScriptValue(v8Value, isolate);
}
PassRefPtr<IDBKey> scriptValueToIDBKey(DOMRequestState* state, const ScriptValue& scriptValue)
@@ -330,7 +330,7 @@
v8::Isolate* isolate = state ? state->context()->GetIsolate() : v8::Isolate::GetCurrent();
v8::HandleScope handleScope(isolate);
v8::Handle<v8::Value> v8Value(scriptValue.v8Value());
- return createIDBKeyFromValue(v8Value);
+ return createIDBKeyFromValue(v8Value, isolate);
}
PassRefPtr<IDBKeyRange> scriptValueToIDBKeyRange(DOMRequestState* state, const ScriptValue& scriptValue)
diff --git a/Source/bindings/v8/IDBBindingUtilitiesTest.cpp b/Source/bindings/v8/IDBBindingUtilitiesTest.cpp
index dd84bdf..510b663 100644
--- a/Source/bindings/v8/IDBBindingUtilitiesTest.cpp
+++ b/Source/bindings/v8/IDBBindingUtilitiesTest.cpp
@@ -107,7 +107,7 @@
v8::Local<v8::Object> object = v8::Object::New();
object->Set(v8::String::New("foo"), v8::String::New("zoo"));
- ScriptValue scriptValue(object);
+ ScriptValue scriptValue(object, v8::Isolate::GetCurrent());
checkKeyPathStringValue(scriptValue, "foo", "zoo");
checkKeyPathNullValue(scriptValue, "bar");
@@ -118,7 +118,7 @@
v8::Local<v8::Object> object = v8::Object::New();
object->Set(v8::String::New("foo"), v8::Number::New(456));
- ScriptValue scriptValue(object);
+ ScriptValue scriptValue(object, v8::Isolate::GetCurrent());
checkKeyPathNumberValue(scriptValue, "foo", 456);
checkKeyPathNullValue(scriptValue, "bar");
@@ -131,7 +131,7 @@
subProperty->Set(v8::String::New("bar"), v8::String::New("zee"));
object->Set(v8::String::New("foo"), subProperty);
- ScriptValue scriptValue(object);
+ ScriptValue scriptValue(object, v8::Isolate::GetCurrent());
checkKeyPathStringValue(scriptValue, "foo.bar", "zee");
checkKeyPathNullValue(scriptValue, "bar");
@@ -145,7 +145,7 @@
v8::Local<v8::Object> object = v8::Object::New();
object->Set(v8::String::New("foo"), v8::String::New("zoo"));
- ScriptValue foozoo(object);
+ ScriptValue foozoo(object, v8::Isolate::GetCurrent());
checkInjection(IDBKey::createString("myNewKey"), foozoo, "bar");
checkInjection(IDBKey::createNumber(1234), foozoo, "bar");
@@ -159,7 +159,7 @@
subProperty->Set(v8::String::New("bar"), v8::String::New("zee"));
object->Set(v8::String::New("foo"), subProperty);
- ScriptValue scriptObject(object);
+ ScriptValue scriptObject(object, v8::Isolate::GetCurrent());
checkInjection(IDBKey::createString("myNewKey"), scriptObject, "foo.baz");
checkInjection(IDBKey::createNumber(789), scriptObject, "foo.baz");
checkInjection(IDBKey::createDate(4567), scriptObject, "foo.baz");
diff --git a/Source/bindings/v8/NPV8Object.cpp b/Source/bindings/v8/NPV8Object.cpp
index eed1b96..ef02215 100644
--- a/Source/bindings/v8/NPV8Object.cpp
+++ b/Source/bindings/v8/NPV8Object.cpp
@@ -66,7 +66,7 @@
static void freeV8NPObject(NPObject* npObject)
{
V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject);
- disposeUnderlyingV8Object(npObject);
+ disposeUnderlyingV8Object(npObject, v8::Isolate::GetCurrent());
free(v8NpObject);
}
@@ -114,7 +114,7 @@
return reinterpret_cast<NPObject*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
-NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, DOMWindow* root)
+NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, DOMWindow* root, v8::Isolate* isolate)
{
// Check to see if this object is already wrapped.
if (object->InternalFieldCount() == npObjectInternalFieldCount) {
@@ -151,7 +151,7 @@
// This is uninitialized memory, we need to clear it so that
// Persistent::Reset won't try to Dispose anything bogus.
v8npObject->v8Object.Clear();
- v8npObject->v8Object.Reset(v8::Isolate::GetCurrent(), object);
+ v8npObject->v8Object.Reset(isolate, object);
v8npObject->rootObject = root;
if (objectVector)
@@ -170,13 +170,12 @@
return v8NpObject;
}
-void disposeUnderlyingV8Object(NPObject* npObject)
+void disposeUnderlyingV8Object(NPObject* npObject, v8::Isolate* isolate)
{
ASSERT(npObject);
V8NPObject* v8NpObject = npObjectToV8NPObject(npObject);
if (!v8NpObject)
return;
- v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope scope(isolate);
v8::Handle<v8::Object> v8Object = v8::Local<v8::Object>::New(isolate, v8NpObject->v8Object);
ASSERT(!v8Object->CreationContext().IsEmpty());
@@ -265,7 +264,7 @@
if (resultObject.IsEmpty())
return false;
- convertV8ObjectToNPVariant(resultObject, npObject, result);
+ convertV8ObjectToNPVariant(resultObject, npObject, result, isolate);
return true;
}
@@ -315,7 +314,7 @@
if (resultObject.IsEmpty())
return false;
- convertV8ObjectToNPVariant(resultObject, npObject, result);
+ convertV8ObjectToNPVariant(resultObject, npObject, result, isolate);
return true;
}
@@ -336,7 +335,8 @@
if (!v8NpObject)
return false;
- v8::HandleScope handleScope(v8::Isolate::GetCurrent());
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::HandleScope handleScope(isolate);
v8::Handle<v8::Context> context = toV8Context(npp, npObject);
if (context.IsEmpty())
return false;
@@ -361,7 +361,7 @@
return false;
if (_NPN_IsAlive(npObject))
- convertV8ObjectToNPVariant(v8result, npObject, result);
+ convertV8ObjectToNPVariant(v8result, npObject, result, isolate);
return true;
}
@@ -386,7 +386,7 @@
if (v8result.IsEmpty())
return false;
- convertV8ObjectToNPVariant(v8result, npObject, result);
+ convertV8ObjectToNPVariant(v8result, npObject, result, isolate);
return true;
}
@@ -444,7 +444,7 @@
v8::Handle<v8::Object> obj = v8::Local<v8::Object>::New(isolate, object->v8Object);
// FIXME: Verify that setting to undefined is right.
- obj->Set(npIdentifierToV8Identifier(propertyName), v8::Undefined());
+ obj->Set(npIdentifierToV8Identifier(propertyName), v8::Undefined(isolate));
return true;
}
@@ -603,7 +603,7 @@
if (resultObject.IsEmpty())
return false;
- convertV8ObjectToNPVariant(resultObject, npObject, result);
+ convertV8ObjectToNPVariant(resultObject, npObject, result, isolate);
return true;
}
diff --git a/Source/bindings/v8/NPV8Object.h b/Source/bindings/v8/NPV8Object.h
index ad9ad84..0caabbe 100644
--- a/Source/bindings/v8/NPV8Object.h
+++ b/Source/bindings/v8/NPV8Object.h
@@ -64,13 +64,13 @@
bool isString;
};
-NPObject* npCreateV8ScriptObject(NPP, v8::Handle<v8::Object>, DOMWindow*);
+NPObject* npCreateV8ScriptObject(NPP, v8::Handle<v8::Object>, DOMWindow*, v8::Isolate*);
NPObject* v8ObjectToNPObject(v8::Handle<v8::Object>);
V8NPObject* npObjectToV8NPObject(NPObject*);
-void disposeUnderlyingV8Object(NPObject*);
+void disposeUnderlyingV8Object(NPObject*, v8::Isolate*);
} // namespace WebCore
diff --git a/Source/bindings/v8/ScheduledAction.cpp b/Source/bindings/v8/ScheduledAction.cpp
index 198cb87..e4780f8 100644
--- a/Source/bindings/v8/ScheduledAction.cpp
+++ b/Source/bindings/v8/ScheduledAction.cpp
@@ -46,8 +46,8 @@
namespace WebCore {
ScheduledAction::ScheduledAction(v8::Handle<v8::Context> context, v8::Handle<v8::Function> function, int argc, v8::Handle<v8::Value> argv[], v8::Isolate* isolate)
- : m_context(context)
- , m_function(function)
+ : m_context(isolate, context)
+ , m_function(isolate, function)
, m_code(String(), KURL(), TextPosition::belowRangePosition())
, m_isolate(isolate)
{
@@ -57,7 +57,7 @@
}
ScheduledAction::ScheduledAction(v8::Handle<v8::Context> context, const String& code, const KURL& url, v8::Isolate* isolate)
- : m_context(context)
+ : m_context(isolate, context)
, m_code(code, url)
, m_isolate(isolate)
{
diff --git a/Source/bindings/v8/ScopedPersistent.h b/Source/bindings/v8/ScopedPersistent.h
index faef97d..be41e87 100644
--- a/Source/bindings/v8/ScopedPersistent.h
+++ b/Source/bindings/v8/ScopedPersistent.h
@@ -42,8 +42,8 @@
public:
ScopedPersistent() { }
- explicit ScopedPersistent(v8::Handle<T> handle)
- : m_handle(v8::Isolate::GetCurrent(), handle)
+ ScopedPersistent(v8::Isolate* isolate, v8::Handle<T> handle)
+ : m_handle(isolate, handle)
{
}
diff --git a/Source/bindings/v8/ScriptCallStackFactory.cpp b/Source/bindings/v8/ScriptCallStackFactory.cpp
index 6f41872..a21bdc2 100644
--- a/Source/bindings/v8/ScriptCallStackFactory.cpp
+++ b/Source/bindings/v8/ScriptCallStackFactory.cpp
@@ -140,7 +140,7 @@
Vector<ScriptValue> arguments;
for (int i = skipArgumentCount; i < v8arguments.Length(); ++i)
- arguments.append(ScriptValue(v8arguments[i]));
+ arguments.append(ScriptValue(v8arguments[i], isolate));
return ScriptArguments::create(state, arguments);
}
diff --git a/Source/bindings/v8/ScriptController.cpp b/Source/bindings/v8/ScriptController.cpp
index db933b8..1b24a38 100644
--- a/Source/bindings/v8/ScriptController.cpp
+++ b/Source/bindings/v8/ScriptController.cpp
@@ -116,7 +116,7 @@
// to it, so that if a plugin fails to release it properly we will
// only leak the NPObject wrapper, not the object, its document, or
// anything else they reference.
- disposeUnderlyingV8Object(m_windowScriptNPObject);
+ disposeUnderlyingV8Object(m_windowScriptNPObject, m_isolate);
_NPN_ReleaseObject(m_windowScriptNPObject);
m_windowScriptNPObject = 0;
}
@@ -162,7 +162,7 @@
ScriptValue ScriptController::callFunctionEvenIfScriptDisabled(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> argv[])
{
// FIXME: This should probably perform the same isPaused check that happens in ScriptController::executeScript.
- return ScriptValue(callFunction(function, receiver, argc, argv));
+ return ScriptValue(callFunction(function, receiver, argc, argv), m_isolate);
}
static void resourceInfo(const v8::Handle<v8::Function> function, String& resourceName, int& lineNumber)
@@ -325,7 +325,7 @@
return v8::Local<v8::Context>();
if (m_frame == frame)
- return v8::Local<v8::Context>::New(context);
+ return v8::Local<v8::Context>::New(m_isolate, context);
return contextForWorld(this, isolatedWorld);
}
@@ -419,7 +419,7 @@
// Track the plugin object. We've been given a reference to the object.
m_pluginObjects.set(widget, npObject);
- return V8ScriptInstance::create(wrapper);
+ return V8ScriptInstance::create(wrapper, m_isolate);
}
void ScriptController::cleanupScriptObjectsForPlugin(Widget* nativeHandle)
@@ -467,7 +467,7 @@
v8::Handle<v8::Value> global = toV8(window, v8::Handle<v8::Object>(), v8Context->GetIsolate());
ASSERT(global->IsObject());
- return npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(global), window);
+ return npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(global), window, isolate);
}
NPObject* ScriptController::windowScriptNPObject()
@@ -506,7 +506,7 @@
if (!v8plugin->IsObject())
return createNoScriptObject();
- return npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(v8plugin), window);
+ return npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(v8plugin), window, v8Context->GetIsolate());
}
void ScriptController::clearWindowShell()
@@ -683,7 +683,7 @@
if (object.IsEmpty())
return ScriptValue();
- return ScriptValue(object);
+ return ScriptValue(object, m_isolate);
}
void ScriptController::executeScriptInIsolatedWorld(int worldID, const Vector<ScriptSourceCode>& sources, int extensionGroup, Vector<ScriptValue>* results)
@@ -707,7 +707,7 @@
for (size_t i = 0; i < sources.size(); ++i) {
v8::Local<v8::Value> evaluationResult = compileAndRunScript(sources[i]);
if (evaluationResult.IsEmpty())
- evaluationResult = v8::Local<v8::Value>::New(v8::Undefined());
+ evaluationResult = v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate));
resultArray->Set(i, evaluationResult);
}
@@ -716,7 +716,7 @@
if (results && !v8Results.IsEmpty()) {
for (size_t i = 0; i < v8Results->Length(); ++i)
- results->append(ScriptValue(v8Results->Get(i)));
+ results->append(ScriptValue(v8Results->Get(i), m_isolate));
}
}
diff --git a/Source/bindings/v8/ScriptDebugServer.cpp b/Source/bindings/v8/ScriptDebugServer.cpp
index 05e6539..7a408d7 100644
--- a/Source/bindings/v8/ScriptDebugServer.cpp
+++ b/Source/bindings/v8/ScriptDebugServer.cpp
@@ -102,7 +102,7 @@
return "";
*actualLineNumber = args->Get(v8::String::NewSymbol("lineNumber"))->Int32Value();
*actualColumnNumber = args->Get(v8::String::NewSymbol("columnNumber"))->Int32Value();
- return toWebCoreString(breakpointId->ToString());
+ return toWebCoreString(breakpointId.As<v8::String>());
}
void ScriptDebugServer::removeBreakpoint(const String& breakpointId)
@@ -161,7 +161,7 @@
v8::HandleScope scope(m_isolate);
v8::Context::Scope contextScope(v8::Debug::GetDebugContext());
- v8::Handle<v8::Value> argv[] = { v8::Int32::New(pauseOnExceptionsState) };
+ v8::Handle<v8::Value> argv[] = { v8::Int32::New(pauseOnExceptionsState, m_isolate) };
callDebuggerMethod("setPauseOnExceptionsState", 1, argv);
}
@@ -315,7 +315,7 @@
PassRefPtr<JavaScriptCallFrame> ScriptDebugServer::wrapCallFrames(v8::Handle<v8::Object> executionState, int maximumLimit)
{
- v8::Handle<v8::Value> argv[] = { executionState, v8::Integer::New(maximumLimit) };
+ v8::Handle<v8::Value> argv[] = { executionState, v8::Integer::New(maximumLimit, m_isolate) };
v8::Handle<v8::Value> currentCallFrameV8 = callDebuggerMethod("currentCallFrame", 2, argv);
ASSERT(!currentCallFrameV8.IsEmpty());
@@ -330,9 +330,9 @@
v8::HandleScope handleScope(m_isolate);
RefPtr<JavaScriptCallFrame> currentCallFrame = wrapCallFrames(m_executionState.newLocal(m_isolate), -1);
if (!currentCallFrame)
- return ScriptValue(v8::Null());
+ return ScriptValue(v8::Null(m_isolate), m_isolate);
v8::Context::Scope contextScope(m_pausedContext);
- return ScriptValue(toV8(currentCallFrame.release(), v8::Handle<v8::Object>(), m_pausedContext->GetIsolate()));
+ return ScriptValue(toV8(currentCallFrame.release(), v8::Handle<v8::Object>(), m_pausedContext->GetIsolate()), m_pausedContext->GetIsolate());
}
void ScriptDebugServer::interruptAndRun(PassOwnPtr<Task> task, v8::Isolate* isolate)
@@ -380,7 +380,7 @@
m_executionState.set(m_isolate, executionState);
ScriptState* currentCallFrameState = ScriptState::forContext(m_pausedContext);
- listener->didPause(currentCallFrameState, currentCallFrame(), ScriptValue(exception), breakpointIds);
+ listener->didPause(currentCallFrameState, currentCallFrame(), ScriptValue(exception, currentCallFrameState->isolate()), breakpointIds);
m_runningNestedMessageLoop = true;
runMessageLoopOnPause(m_pausedContext);
@@ -540,7 +540,7 @@
v8::Handle<v8::Value> argv[] = {
functionValue,
- v8::Handle<v8::Value>(v8::Integer::New(scopeNumber)),
+ v8::Handle<v8::Value>(v8::Integer::New(scopeNumber, debuggerContext->GetIsolate())),
v8String(variableName, debuggerContext->GetIsolate()),
newValue
};
@@ -574,7 +574,7 @@
return;
*scriptId = toWebCoreStringWithUndefinedOrNullCheck(script->Id());
- m_compiledScripts.set(*scriptId, adoptPtr(new ScopedPersistent<v8::Script>(script)));
+ m_compiledScripts.set(*scriptId, adoptPtr(new ScopedPersistent<v8::Script>(m_isolate, script)));
}
void ScriptDebugServer::clearCompiledScripts()
@@ -602,12 +602,13 @@
*wasThrown = false;
if (tryCatch.HasCaught()) {
*wasThrown = true;
- *result = ScriptValue(tryCatch.Exception());
+ *result = ScriptValue(tryCatch.Exception(), m_isolate);
v8::Local<v8::Message> message = tryCatch.Message();
if (!message.IsEmpty())
*exceptionMessage = toWebCoreStringWithUndefinedOrNullCheck(message->Get());
- } else
- *result = ScriptValue(value);
+ } else {
+ *result = ScriptValue(value, m_isolate);
+ }
}
PassOwnPtr<ScriptSourceCode> ScriptDebugServer::preprocess(Frame*, const ScriptSourceCode&)
diff --git a/Source/bindings/v8/ScriptEventListener.cpp b/Source/bindings/v8/ScriptEventListener.cpp
index 7d4cc36..c10cea9 100644
--- a/Source/bindings/v8/ScriptEventListener.cpp
+++ b/Source/bindings/v8/ScriptEventListener.cpp
@@ -94,11 +94,11 @@
if (listener->type() != EventListener::JSEventListenerType)
return "";
- v8::HandleScope scope(getIsolateFromScriptExecutionContext(document));
+ v8::HandleScope scope(toIsolate(document));
V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>(listener);
v8::Handle<v8::Context> context = toV8Context(document, v8Listener->world());
v8::Context::Scope contextScope(context);
- v8::Handle<v8::Object> function = v8Listener->getListenerObject(document);
+ v8::Handle<v8::Value> function = v8Listener->getListenerObject(document);
if (function.IsEmpty())
return "";
@@ -110,14 +110,15 @@
if (listener->type() != EventListener::JSEventListenerType)
return ScriptValue();
- v8::HandleScope scope(getIsolateFromScriptExecutionContext(document));
+ v8::Isolate* isolate = toIsolate(document);
+ v8::HandleScope scope(isolate);
V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>(listener);
v8::Handle<v8::Context> context = toV8Context(document, v8Listener->world());
v8::Context::Scope contextScope(context);
v8::Handle<v8::Object> function = v8Listener->getListenerObject(document);
if (function.IsEmpty())
return ScriptValue();
- return ScriptValue(function);
+ return ScriptValue(function, isolate);
}
ScriptState* eventListenerHandlerScriptState(Frame* frame, EventListener* listener)
@@ -125,7 +126,7 @@
if (listener->type() != EventListener::JSEventListenerType)
return 0;
V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>(listener);
- v8::HandleScope scope(frame->script()->isolate());
+ v8::HandleScope scope(toIsolate(frame));
v8::Handle<v8::Context> v8Context = frame->script()->windowShell(v8Listener->world())->context();
return ScriptState::forContext(v8Context);
}
@@ -135,7 +136,7 @@
if (listener->type() != EventListener::JSEventListenerType)
return false;
- v8::HandleScope scope(getIsolateFromScriptExecutionContext(document));
+ v8::HandleScope scope(toIsolate(document));
V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>(listener);
v8::Handle<v8::Context> context = toV8Context(document, v8Listener->world());
v8::Context::Scope contextScope(context);
@@ -147,8 +148,8 @@
v8::Handle<v8::Value> scriptIdValue = function->GetScriptId();
scriptId = toWebCoreStringWithUndefinedOrNullCheck(scriptIdValue);
v8::ScriptOrigin origin = function->GetScriptOrigin();
- if (origin.ResourceName()->IsString() && !origin.ResourceName().IsEmpty())
- sourceName = toWebCoreString(origin.ResourceName());
+ if (!origin.ResourceName().IsEmpty() && origin.ResourceName()->IsString())
+ sourceName = toWebCoreString(origin.ResourceName().As<v8::String>());
else
sourceName = "";
lineNumber = function->GetScriptLineNumber();
diff --git a/Source/bindings/v8/ScriptFunctionCall.cpp b/Source/bindings/v8/ScriptFunctionCall.cpp
index 9bfd279..5a3a6f6 100644
--- a/Source/bindings/v8/ScriptFunctionCall.cpp
+++ b/Source/bindings/v8/ScriptFunctionCall.cpp
@@ -61,49 +61,57 @@
void ScriptCallArgumentHandler::appendArgument(const String& argument)
{
+ v8::Isolate* isolate = m_scriptState->isolate();
ScriptScope scope(m_scriptState);
- m_arguments.append(v8String(argument, m_scriptState->isolate()));
+ m_arguments.append(ScriptValue(v8String(argument, isolate), isolate));
}
void ScriptCallArgumentHandler::appendArgument(const char* argument)
{
+ v8::Isolate* isolate = m_scriptState->isolate();
ScriptScope scope(m_scriptState);
- m_arguments.append(v8String(argument, m_scriptState->isolate()));
+ m_arguments.append(ScriptValue(v8String(argument, isolate), isolate));
}
void ScriptCallArgumentHandler::appendArgument(long argument)
{
+ v8::Isolate* isolate = m_scriptState->isolate();
ScriptScope scope(m_scriptState);
- m_arguments.append(v8::Number::New(m_scriptState->isolate(), argument));
+ m_arguments.append(ScriptValue(v8::Number::New(isolate, argument), isolate));
}
void ScriptCallArgumentHandler::appendArgument(long long argument)
{
+ v8::Isolate* isolate = m_scriptState->isolate();
ScriptScope scope(m_scriptState);
- m_arguments.append(v8::Number::New(m_scriptState->isolate(), argument));
+ m_arguments.append(ScriptValue(v8::Number::New(isolate, argument), isolate));
}
void ScriptCallArgumentHandler::appendArgument(unsigned int argument)
{
+ v8::Isolate* isolate = m_scriptState->isolate();
ScriptScope scope(m_scriptState);
- m_arguments.append(v8::Number::New(m_scriptState->isolate(), argument));
+ m_arguments.append(ScriptValue(v8::Number::New(isolate, argument), isolate));
}
void ScriptCallArgumentHandler::appendArgument(unsigned long argument)
{
+ v8::Isolate* isolate = m_scriptState->isolate();
ScriptScope scope(m_scriptState);
- m_arguments.append(v8::Number::New(m_scriptState->isolate(), argument));
+ m_arguments.append(ScriptValue(v8::Number::New(isolate, argument), isolate));
}
void ScriptCallArgumentHandler::appendArgument(int argument)
{
+ v8::Isolate* isolate = m_scriptState->isolate();
ScriptScope scope(m_scriptState);
- m_arguments.append(v8::Number::New(m_scriptState->isolate(), argument));
+ m_arguments.append(ScriptValue(v8::Number::New(isolate, argument), isolate));
}
void ScriptCallArgumentHandler::appendArgument(bool argument)
{
- m_arguments.append(v8Boolean(argument));
+ v8::Isolate* isolate = m_scriptState->isolate();
+ m_arguments.append(ScriptValue(v8Boolean(argument, isolate), isolate));
}
ScriptFunctionCall::ScriptFunctionCall(const ScriptObject& thisObject, const String& name)
@@ -139,7 +147,7 @@
return ScriptValue();
}
- return ScriptValue(result);
+ return ScriptValue(result, m_scriptState->isolate());
}
ScriptValue ScriptFunctionCall::call()
@@ -196,7 +204,7 @@
args[i] = m_arguments[i].v8Value();
v8::Handle<v8::Value> result = ScriptController::callFunctionWithInstrumentation(0, function, object, m_arguments.size(), args.get(), m_scriptState->isolate());
- return ScriptValue(result);
+ return ScriptValue(result, m_scriptState->isolate());
}
} // namespace WebCore
diff --git a/Source/bindings/v8/ScriptInstance.cpp b/Source/bindings/v8/ScriptInstance.cpp
index 961e4a9..6898d07 100644
--- a/Source/bindings/v8/ScriptInstance.cpp
+++ b/Source/bindings/v8/ScriptInstance.cpp
@@ -33,8 +33,8 @@
namespace WebCore {
-V8ScriptInstance::V8ScriptInstance(v8::Handle<v8::Object> instance)
- : m_instance(instance)
+V8ScriptInstance::V8ScriptInstance(v8::Handle<v8::Object> instance, v8::Isolate* isolate)
+ : m_instance(isolate, instance)
{
}
diff --git a/Source/bindings/v8/ScriptInstance.h b/Source/bindings/v8/ScriptInstance.h
index 0b8fc98..803e8ef 100644
--- a/Source/bindings/v8/ScriptInstance.h
+++ b/Source/bindings/v8/ScriptInstance.h
@@ -41,12 +41,12 @@
class V8ScriptInstance : public RefCounted<V8ScriptInstance> {
public:
- static PassRefPtr<V8ScriptInstance> create(v8::Handle<v8::Object> instance) { return adoptRef(new V8ScriptInstance(instance)); }
+ static PassRefPtr<V8ScriptInstance> create(v8::Handle<v8::Object> instance, v8::Isolate* isolate) { return adoptRef(new V8ScriptInstance(instance, isolate)); }
v8::Local<v8::Object> newLocal(v8::Isolate* isolate) { return m_instance.newLocal(isolate); }
private:
- explicit V8ScriptInstance(v8::Handle<v8::Object>);
+ V8ScriptInstance(v8::Handle<v8::Object>, v8::Isolate*);
ScopedPersistent<v8::Object> m_instance;
};
diff --git a/Source/bindings/v8/ScriptObject.cpp b/Source/bindings/v8/ScriptObject.cpp
index c075c86..d6064ae 100644
--- a/Source/bindings/v8/ScriptObject.cpp
+++ b/Source/bindings/v8/ScriptObject.cpp
@@ -41,7 +41,7 @@
namespace WebCore {
ScriptObject::ScriptObject(ScriptState* scriptState, v8::Handle<v8::Object> v8Object)
- : ScriptValue(v8Object)
+ : ScriptValue(v8Object, scriptState->isolate())
, m_scriptState(scriptState)
{
}
diff --git a/Source/bindings/v8/ScriptPreprocessor.cpp b/Source/bindings/v8/ScriptPreprocessor.cpp
index 390c4a2..efc2bdd 100644
--- a/Source/bindings/v8/ScriptPreprocessor.cpp
+++ b/Source/bindings/v8/ScriptPreprocessor.cpp
@@ -74,7 +74,7 @@
if (!isValid())
return sourceCode;
- return preprocessSourceCode(sourceCode, sourceName, v8::Undefined());
+ return preprocessSourceCode(sourceCode, sourceName, v8::Undefined(m_isolate));
}
String ScriptPreprocessor::preprocessSourceCode(const String& sourceCode, const String& sourceName, const String& functionName)
@@ -104,7 +104,7 @@
v8::Handle<v8::Value> resultValue = V8ScriptRunner::callAsFunction(m_preprocessorFunction.newLocal(m_isolate), m_context.newLocal(m_isolate)->Global(), WTF_ARRAY_LENGTH(argv), argv);
if (!resultValue.IsEmpty() && resultValue->IsString())
- return toWebCoreStringWithNullCheck(resultValue);
+ return toWebCoreStringWithNullCheck(resultValue.As<v8::String>());
return sourceCode;
}
diff --git a/Source/bindings/v8/ScriptPromise.h b/Source/bindings/v8/ScriptPromise.h
index 02f0a22..c4f3e5d 100644
--- a/Source/bindings/v8/ScriptPromise.h
+++ b/Source/bindings/v8/ScriptPromise.h
@@ -50,14 +50,14 @@
{
}
- explicit ScriptPromise(ScriptValue promise)
+ explicit ScriptPromise(const ScriptValue& promise)
: m_promise(promise)
{
ASSERT(!m_promise.hasNoValue());
}
- explicit ScriptPromise(v8::Handle<v8::Value> promise)
- : m_promise(promise)
+ ScriptPromise(v8::Handle<v8::Value> promise, v8::Isolate* isolate)
+ : m_promise(promise, isolate)
{
ASSERT(!m_promise.hasNoValue());
}
diff --git a/Source/bindings/v8/ScriptPromiseResolver.cpp b/Source/bindings/v8/ScriptPromiseResolver.cpp
index 8743f73..7440a41 100644
--- a/Source/bindings/v8/ScriptPromiseResolver.cpp
+++ b/Source/bindings/v8/ScriptPromiseResolver.cpp
@@ -48,7 +48,7 @@
ASSERT(RuntimeEnabledFeatures::promiseEnabled());
v8::Local<v8::Object> promise, resolver;
V8PromiseCustom::createPromise(creationContext, &promise, &resolver, isolate);
- m_promise = ScriptPromise(promise);
+ m_promise = ScriptPromise(promise, isolate);
m_resolver.set(isolate, resolver);
}
diff --git a/Source/bindings/v8/ScriptPromiseResolverTest.cpp b/Source/bindings/v8/ScriptPromiseResolverTest.cpp
index 41fdf89..0c6cdab 100644
--- a/Source/bindings/v8/ScriptPromiseResolverTest.cpp
+++ b/Source/bindings/v8/ScriptPromiseResolverTest.cpp
@@ -47,7 +47,7 @@
ScriptPromiseResolverTest()
: m_isolate(v8::Isolate::GetCurrent())
, m_handleScope(m_isolate)
- , m_context(v8::Context::New(m_isolate))
+ , m_context(m_isolate, v8::Context::New(m_isolate))
, m_contextScope(m_context.newLocal(m_isolate))
{
}
@@ -106,7 +106,7 @@
EXPECT_EQ(V8PromiseCustom::Pending, state());
EXPECT_TRUE(result()->IsUndefined());
- m_resolver->fulfill(ScriptValue(v8::Integer::New(3)));
+ m_resolver->fulfill(ScriptValue(v8::Integer::New(3, m_isolate), m_isolate));
EXPECT_FALSE(m_resolver->isPending());
EXPECT_EQ(V8PromiseCustom::Fulfilled, state());
@@ -120,7 +120,7 @@
EXPECT_EQ(V8PromiseCustom::Pending, state());
EXPECT_TRUE(result()->IsUndefined());
- m_resolver->resolve(ScriptValue(v8::Integer::New(3)));
+ m_resolver->resolve(ScriptValue(v8::Integer::New(3, m_isolate), m_isolate));
EXPECT_FALSE(m_resolver->isPending());
EXPECT_EQ(V8PromiseCustom::Fulfilled, state());
@@ -134,7 +134,7 @@
EXPECT_EQ(V8PromiseCustom::Pending, state());
EXPECT_TRUE(result()->IsUndefined());
- m_resolver->reject(ScriptValue(v8::Integer::New(3)));
+ m_resolver->reject(ScriptValue(v8::Integer::New(3, m_isolate), m_isolate));
EXPECT_FALSE(m_resolver->isPending());
EXPECT_EQ(V8PromiseCustom::Rejected, state());
@@ -148,14 +148,14 @@
EXPECT_EQ(V8PromiseCustom::Pending, state());
EXPECT_TRUE(result()->IsUndefined());
- m_resolver->fulfill(ScriptValue(v8::Integer::New(3)));
+ m_resolver->fulfill(ScriptValue(v8::Integer::New(3, m_isolate), m_isolate));
EXPECT_FALSE(m_resolver->isPending());
EXPECT_EQ(V8PromiseCustom::Fulfilled, state());
ASSERT_TRUE(result()->IsNumber());
EXPECT_EQ(3, result().As<v8::Integer>()->Value());
- m_resolver->fulfill(ScriptValue(v8::Integer::New(4)));
+ m_resolver->fulfill(ScriptValue(v8::Integer::New(4, m_isolate), m_isolate));
EXPECT_FALSE(m_resolver->isPending());
EXPECT_EQ(V8PromiseCustom::Fulfilled, state());
ASSERT_TRUE(result()->IsNumber());
@@ -168,14 +168,14 @@
EXPECT_EQ(V8PromiseCustom::Pending, state());
EXPECT_TRUE(result()->IsUndefined());
- m_resolver->fulfill(ScriptValue(v8::Integer::New(3)));
+ m_resolver->fulfill(ScriptValue(v8::Integer::New(3, m_isolate), m_isolate));
EXPECT_FALSE(m_resolver->isPending());
EXPECT_EQ(V8PromiseCustom::Fulfilled, state());
ASSERT_TRUE(result()->IsNumber());
EXPECT_EQ(3, result().As<v8::Integer>()->Value());
- m_resolver->reject(ScriptValue(v8::Integer::New(4)));
+ m_resolver->reject(ScriptValue(v8::Integer::New(4, m_isolate), m_isolate));
EXPECT_FALSE(m_resolver->isPending());
EXPECT_EQ(V8PromiseCustom::Fulfilled, state());
ASSERT_TRUE(result()->IsNumber());
diff --git a/Source/bindings/v8/ScriptState.cpp b/Source/bindings/v8/ScriptState.cpp
index e785641..d59ccf0 100644
--- a/Source/bindings/v8/ScriptState.cpp
+++ b/Source/bindings/v8/ScriptState.cpp
@@ -44,7 +44,7 @@
namespace WebCore {
ScriptState::ScriptState(v8::Handle<v8::Context> context)
- : m_context(context)
+ : m_context(context->GetIsolate(), context)
, m_isolate(context->GetIsolate())
{
m_context.makeWeak(this, &makeWeakCallback);
@@ -109,7 +109,7 @@
ScriptState* mainWorldScriptState(Frame* frame)
{
- v8::HandleScope handleScope(frame->script()->isolate());
+ v8::HandleScope handleScope(toIsolate(frame));
return ScriptState::forContext(frame->script()->mainWorldContext());
}
diff --git a/Source/bindings/v8/ScriptString.cpp b/Source/bindings/v8/ScriptString.cpp
index d97a77a..db7e510 100644
--- a/Source/bindings/v8/ScriptString.cpp
+++ b/Source/bindings/v8/ScriptString.cpp
@@ -35,20 +35,20 @@
ScriptString ScriptString::concatenateWith(const String& string)
{
- v8::Isolate* isolate = v8::Isolate::GetCurrent();
- v8::HandleScope handleScope(isolate);
- v8::Handle<v8::String> b = v8String(string, isolate);
+ v8::Isolate* nonNullIsolate = isolate();
+ v8::HandleScope handleScope(nonNullIsolate);
+ v8::Handle<v8::String> b = v8String(string, nonNullIsolate);
if (hasNoValue())
- return ScriptString(b);
+ return ScriptString(b, nonNullIsolate);
v8::Handle<v8::String> a = v8::Handle<v8::String>::Cast(v8Value());
- return ScriptString(v8::String::Concat(a, b));
+ return ScriptString(v8::String::Concat(a, b), nonNullIsolate);
}
String ScriptString::flattenToString() const
{
if (hasNoValue())
return String();
- v8::HandleScope handleScope(v8::Isolate::GetCurrent());
+ v8::HandleScope handleScope(isolate());
v8::Handle<v8::String> value = v8::Handle<v8::String>::Cast(v8Value());
return v8StringToWebCoreString<String>(value, Externalize);
}
diff --git a/Source/bindings/v8/ScriptString.h b/Source/bindings/v8/ScriptString.h
index 14467c7..ed493f8 100644
--- a/Source/bindings/v8/ScriptString.h
+++ b/Source/bindings/v8/ScriptString.h
@@ -40,7 +40,7 @@
class ScriptString : public ScriptValue {
public:
ScriptString() { }
- explicit ScriptString(v8::Handle<v8::String> value) : ScriptValue(value) { }
+ ScriptString(v8::Handle<v8::String> value, v8::Isolate* isolate) : ScriptValue(value, isolate) { }
ScriptString concatenateWith(const String&);
String flattenToString() const;
diff --git a/Source/bindings/v8/ScriptValue.cpp b/Source/bindings/v8/ScriptValue.cpp
index dd41b0d..4926ed9 100644
--- a/Source/bindings/v8/ScriptValue.cpp
+++ b/Source/bindings/v8/ScriptValue.cpp
@@ -59,23 +59,23 @@
ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptValue* value)
{
ScriptScope scope(scriptState);
- return ScriptValue(value->deserialize());
+ return ScriptValue(value->deserialize(), scriptState->isolate());
}
-bool ScriptValue::getString(String& result, v8::Isolate* isolate) const
+bool ScriptValue::getString(String& result) const
{
if (hasNoValue())
return false;
- v8::HandleScope handleScope(isolate);
+ v8::HandleScope handleScope(m_isolate);
v8::Handle<v8::Value> string = v8Value();
if (string.IsEmpty() || !string->IsString())
return false;
- result = toWebCoreString(string);
+ result = toWebCoreString(string.As<v8::String>());
return true;
}
-String ScriptValue::toString(ScriptState*) const
+String ScriptValue::toString() const
{
v8::TryCatch block;
v8::Handle<v8::String> string = v8Value()->ToString();
@@ -84,7 +84,7 @@
return v8StringToWebCoreString<String>(string, DoNotExternalize);
}
-static PassRefPtr<JSONValue> v8ToJSONValue(v8::Handle<v8::Value> value, int maxDepth)
+static PassRefPtr<JSONValue> v8ToJSONValue(v8::Handle<v8::Value> value, int maxDepth, v8::Isolate* isolate)
{
if (value.IsEmpty()) {
ASSERT_NOT_REACHED();
@@ -102,14 +102,14 @@
if (value->IsNumber())
return JSONBasicValue::create(value->NumberValue());
if (value->IsString())
- return JSONString::create(toWebCoreString(value));
+ return JSONString::create(toWebCoreString(value.As<v8::String>()));
if (value->IsArray()) {
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(value);
RefPtr<JSONArray> inspectorArray = JSONArray::create();
uint32_t length = array->Length();
for (uint32_t i = 0; i < length; i++) {
- v8::Local<v8::Value> value = array->Get(v8::Int32::New(i));
- RefPtr<JSONValue> element = v8ToJSONValue(value, maxDepth);
+ v8::Local<v8::Value> value = array->Get(v8::Int32::New(i, isolate));
+ RefPtr<JSONValue> element = v8ToJSONValue(value, maxDepth, isolate);
if (!element)
return 0;
inspectorArray->pushValue(element);
@@ -122,11 +122,11 @@
v8::Local<v8::Array> propertyNames = object->GetPropertyNames();
uint32_t length = propertyNames->Length();
for (uint32_t i = 0; i < length; i++) {
- v8::Local<v8::Value> name = propertyNames->Get(v8::Int32::New(i));
+ v8::Local<v8::Value> name = propertyNames->Get(v8::Int32::New(i, isolate));
// FIXME(yurys): v8::Object should support GetOwnPropertyNames
if (name->IsString() && !object->HasRealNamedProperty(v8::Handle<v8::String>::Cast(name)))
continue;
- RefPtr<JSONValue> propertyValue = v8ToJSONValue(object->Get(name), maxDepth);
+ RefPtr<JSONValue> propertyValue = v8ToJSONValue(object->Get(name), maxDepth, isolate);
if (!propertyValue)
return 0;
jsonObject->setValue(toWebCoreStringWithNullCheck(name), propertyValue);
@@ -142,7 +142,7 @@
v8::HandleScope handleScope(scriptState->isolate());
// v8::Object::GetPropertyNames() expects current context to be not null.
v8::Context::Scope contextScope(scriptState->context());
- return v8ToJSONValue(v8Value(), JSONValue::maxDepth);
+ return v8ToJSONValue(v8Value(), JSONValue::maxDepth, scriptState->isolate());
}
} // namespace WebCore
diff --git a/Source/bindings/v8/ScriptValue.h b/Source/bindings/v8/ScriptValue.h
index a85a23c..b2a25d9 100644
--- a/Source/bindings/v8/ScriptValue.h
+++ b/Source/bindings/v8/ScriptValue.h
@@ -57,26 +57,48 @@
class ScriptValue {
public:
- ScriptValue() { }
+ ScriptValue()
+ : m_isolate(0)
+ { }
+
virtual ~ScriptValue();
- ScriptValue(v8::Handle<v8::Value> value)
- : m_value(value.IsEmpty() ? 0 : SharedPersistent<v8::Value>::create(value))
+ ScriptValue(v8::Handle<v8::Value> value, v8::Isolate* isolate)
+ : m_isolate(isolate)
+ , m_value(value.IsEmpty() ? 0 : SharedPersistent<v8::Value>::create(value, isolate))
{
}
ScriptValue(const ScriptValue& value)
- : m_value(value.m_value)
+ : m_isolate(value.m_isolate)
+ , m_value(value.m_value)
{
}
- static ScriptValue createNull() { return ScriptValue(v8::Null()); }
- static ScriptValue createBoolean(bool b) { return ScriptValue(b ? v8::True() : v8::False()); }
+ v8::Isolate* isolate() const
+ {
+ if (!m_isolate)
+ m_isolate = v8::Isolate::GetCurrent();
+ return m_isolate;
+ }
+
+ static ScriptValue createNull()
+ {
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ return ScriptValue(v8::Null(isolate), isolate);
+ }
+ static ScriptValue createBoolean(bool b)
+ {
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ return ScriptValue(b ? v8::True(isolate) : v8::False(isolate), isolate);
+ }
ScriptValue& operator=(const ScriptValue& value)
{
- if (this != &value)
+ if (this != &value) {
m_value = value.m_value;
+ m_isolate = value.m_isolate;
+ }
return *this;
}
@@ -151,17 +173,16 @@
v8::Handle<v8::Value> v8Value() const
{
- return m_value.get() ? m_value->newLocal(v8::Isolate::GetCurrent()) : v8::Handle<v8::Value>();
+ return m_value.get() ? m_value->newLocal(m_isolate) : v8::Handle<v8::Value>();
}
- bool getString(ScriptState* scriptState, String& result) const { return getString(result, scriptState->isolate()); }
- bool getString(String& result) const { return getString(result, v8::Isolate::GetCurrent()); }
- bool getString(String& result, v8::Isolate*) const;
- String toString(ScriptState*) const;
+ bool getString(String& result) const;
+ String toString() const;
PassRefPtr<JSONValue> toJSONValue(ScriptState*) const;
private:
+ mutable v8::Isolate* m_isolate;
RefPtr<SharedPersistent<v8::Value> > m_value;
};
diff --git a/Source/bindings/v8/SerializedScriptValue.cpp b/Source/bindings/v8/SerializedScriptValue.cpp
index de2275a..46a815b 100644
--- a/Source/bindings/v8/SerializedScriptValue.cpp
+++ b/Source/bindings/v8/SerializedScriptValue.cpp
@@ -942,12 +942,12 @@
class DenseArrayState : public AbstractObjectState {
public:
- DenseArrayState(v8::Handle<v8::Array> array, v8::Handle<v8::Array> propertyNames, StateBase* next)
+ DenseArrayState(v8::Handle<v8::Array> array, v8::Handle<v8::Array> propertyNames, StateBase* next, v8::Isolate* isolate)
: AbstractObjectState(array, next)
, m_arrayIndex(0)
, m_arrayLength(array->Length())
{
- m_propertyNames = v8::Local<v8::Array>::New(propertyNames);
+ m_propertyNames = v8::Local<v8::Array>::New(isolate, propertyNames);
}
virtual StateBase* advance(Serializer& serializer)
@@ -976,10 +976,10 @@
class SparseArrayState : public AbstractObjectState {
public:
- SparseArrayState(v8::Handle<v8::Array> array, v8::Handle<v8::Array> propertyNames, StateBase* next)
+ SparseArrayState(v8::Handle<v8::Array> array, v8::Handle<v8::Array> propertyNames, StateBase* next, v8::Isolate* isolate)
: AbstractObjectState(array, next)
{
- m_propertyNames = v8::Local<v8::Array>::New(propertyNames);
+ m_propertyNames = v8::Local<v8::Array>::New(isolate, propertyNames);
}
virtual StateBase* advance(Serializer& serializer)
@@ -1199,11 +1199,11 @@
if (shouldSerializeDensely(length, propertyNames->Length())) {
m_writer.writeGenerateFreshDenseArray(length);
- return push(new DenseArrayState(array, propertyNames, next));
+ return push(new DenseArrayState(array, propertyNames, next, m_isolate));
}
m_writer.writeGenerateFreshSparseArray(length);
- return push(new SparseArrayState(array, propertyNames, next));
+ return push(new SparseArrayState(array, propertyNames, next, m_isolate));
}
StateBase* startObjectState(v8::Handle<v8::Object> object, StateBase* next)
@@ -1379,7 +1379,7 @@
case PaddingTag:
return true;
case UndefinedTag:
- *value = v8::Undefined();
+ *value = v8::Undefined(m_isolate);
break;
case NullTag:
*value = v8NullWithCheck(m_isolate);
@@ -2510,10 +2510,11 @@
ScriptValue SerializedScriptValue::deserializeForInspector(ScriptState* scriptState)
{
- v8::HandleScope handleScope(scriptState->isolate());
+ v8::Isolate* isolate = scriptState->isolate();
+ v8::HandleScope handleScope(isolate);
v8::Context::Scope contextScope(scriptState->context());
- return ScriptValue(deserialize(scriptState->isolate()));
+ return ScriptValue(deserialize(isolate), isolate);
}
void SerializedScriptValue::registerMemoryAllocatedWithCurrentScriptContext()
diff --git a/Source/bindings/v8/SharedPersistent.h b/Source/bindings/v8/SharedPersistent.h
index 52cc119..011462c 100644
--- a/Source/bindings/v8/SharedPersistent.h
+++ b/Source/bindings/v8/SharedPersistent.h
@@ -42,9 +42,9 @@
class SharedPersistent : public RefCounted<SharedPersistent<T> > {
WTF_MAKE_NONCOPYABLE(SharedPersistent);
public:
- static PassRefPtr<SharedPersistent<T> > create(v8::Handle<T> value)
+ static PassRefPtr<SharedPersistent<T> > create(v8::Handle<T> value, v8::Isolate* isolate)
{
- return adoptRef(new SharedPersistent<T>(value));
+ return adoptRef(new SharedPersistent<T>(value, isolate));
}
v8::Local<T> newLocal(v8::Isolate* isolate) const
@@ -60,7 +60,7 @@
}
private:
- explicit SharedPersistent(v8::Handle<T> value) : m_value(value) { }
+ explicit SharedPersistent(v8::Handle<T> value, v8::Isolate* isolate) : m_value(isolate, value) { }
ScopedPersistent<T> m_value;
};
diff --git a/Source/bindings/v8/V8AbstractEventListener.cpp b/Source/bindings/v8/V8AbstractEventListener.cpp
index e6937c9..678ed9f 100644
--- a/Source/bindings/v8/V8AbstractEventListener.cpp
+++ b/Source/bindings/v8/V8AbstractEventListener.cpp
@@ -142,7 +142,7 @@
// Restore the old event. This must be done for all exit paths through this method.
if (savedEvent.IsEmpty())
- v8Context->Global()->SetHiddenValue(eventSymbol, v8::Undefined());
+ v8Context->Global()->SetHiddenValue(eventSymbol, v8::Undefined(v8Context->GetIsolate()));
else
v8Context->Global()->SetHiddenValue(eventSymbol, savedEvent);
tryCatch.Reset();
@@ -156,8 +156,10 @@
if (returnValue.IsEmpty())
return;
- if (!returnValue->IsNull() && !returnValue->IsUndefined() && event->isBeforeUnloadEvent())
- toBeforeUnloadEvent(event)->setReturnValue(toWebCoreString(returnValue));
+ if (!returnValue->IsNull() && !returnValue->IsUndefined() && event->isBeforeUnloadEvent()) {
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringReturnValue, returnValue);
+ toBeforeUnloadEvent(event)->setReturnValue(stringReturnValue);
+ }
if (m_isAttribute && shouldPreventDefault(returnValue))
event->preventDefault();
@@ -181,7 +183,7 @@
v8::Handle<v8::Value> value = toV8(target, v8::Handle<v8::Object>(), isolate);
if (value.IsEmpty())
return v8::Local<v8::Object>();
- return v8::Local<v8::Object>::New(v8::Handle<v8::Object>::Cast(value));
+ return v8::Local<v8::Object>::New(isolate, v8::Handle<v8::Object>::Cast(value));
}
void V8AbstractEventListener::makeWeakCallback(v8::Isolate*, v8::Persistent<v8::Object>*, V8AbstractEventListener* listener)
diff --git a/Source/bindings/v8/V8Binding.cpp b/Source/bindings/v8/V8Binding.cpp
index fa134ca..9ae2300 100644
--- a/Source/bindings/v8/V8Binding.cpp
+++ b/Source/bindings/v8/V8Binding.cpp
@@ -82,9 +82,9 @@
return V8ThrowException::throwError(errorType, message, isolate);
}
-v8::Handle<v8::Value> throwError(v8::Handle<v8::Value> exception)
+v8::Handle<v8::Value> throwError(v8::Handle<v8::Value> exception, v8::Isolate* isolate)
{
- return V8ThrowException::throwError(exception);
+ return V8ThrowException::throwError(exception, isolate);
}
v8::Handle<v8::Value> throwTypeError(v8::Isolate* isolate)
@@ -161,7 +161,7 @@
// FIXME: Should pass in appropriate creationContext
v8::Handle<v8::Object> filterWrapper = toV8(filter, v8::Handle<v8::Object>(), isolate).As<v8::Object>();
- RefPtr<NodeFilterCondition> condition = V8NodeFilterCondition::create(callback, filterWrapper);
+ RefPtr<NodeFilterCondition> condition = V8NodeFilterCondition::create(callback, filterWrapper, isolate);
filter->setCondition(condition.release());
return filter.release();
@@ -397,7 +397,7 @@
PassRefPtr<DOMStringList> toDOMStringList(v8::Handle<v8::Value> value, v8::Isolate* isolate)
{
- v8::Local<v8::Value> v8Value(v8::Local<v8::Value>::New(value));
+ v8::Local<v8::Value> v8Value(v8::Local<v8::Value>::New(isolate, value));
if (V8DOMStringList::HasInstance(v8Value, isolate, worldType(isolate))) {
RefPtr<DOMStringList> ret = V8DOMStringList::toNative(v8::Handle<v8::Object>::Cast(v8Value));
@@ -591,7 +591,7 @@
return wrapper.IsEmpty() ? v8::Local<v8::Value>() : wrapper->GetHiddenValue(key);
}
-v8::Isolate* getIsolateFromScriptExecutionContext(ScriptExecutionContext* context)
+v8::Isolate* toIsolate(ScriptExecutionContext* context)
{
if (context && context->isDocument()) {
static v8::Isolate* mainWorldIsolate = 0;
@@ -602,4 +602,9 @@
return v8::Isolate::GetCurrent();
}
+v8::Isolate* toIsolate(Frame* frame)
+{
+ return frame->script()->isolate();
+}
+
} // namespace WebCore
diff --git a/Source/bindings/v8/V8Binding.h b/Source/bindings/v8/V8Binding.h
index 723840b..0fe7ff2 100644
--- a/Source/bindings/v8/V8Binding.h
+++ b/Source/bindings/v8/V8Binding.h
@@ -64,7 +64,7 @@
v8::Handle<v8::Value> throwError(V8ErrorType, const String&, v8::Isolate*);
// Schedule a JavaScript error to be thrown.
- v8::Handle<v8::Value> throwError(v8::Handle<v8::Value>);
+ v8::Handle<v8::Value> throwError(v8::Handle<v8::Value>, v8::Isolate*);
// A helper for throwing JavaScript TypeError.
v8::Handle<v8::Value> throwTypeError(v8::Isolate*);
@@ -163,6 +163,33 @@
V8PerIsolateData::from(isolate)->stringCache()->setReturnValueFromString(info.GetReturnValue(), string.impl());
}
+ // Convert v8::String to a WTF::String. If the V8 string is not already
+ // an external string then it is transformed into an external string at this
+ // point to avoid repeated conversions.
+ inline String toWebCoreString(v8::Handle<v8::String> value)
+ {
+ return v8StringToWebCoreString<String>(value, Externalize);
+ }
+
+ inline String toWebCoreStringWithNullCheck(v8::Handle<v8::String> value)
+ {
+ if (value.IsEmpty() || value->IsNull())
+ return String();
+ return toWebCoreString(value);
+ }
+
+ inline String toWebCoreStringWithUndefinedOrNullCheck(v8::Handle<v8::String> value)
+ {
+ if (value.IsEmpty() || value->IsNull() || value->IsUndefined())
+ return String();
+ return toWebCoreString(value);
+ }
+
+ inline AtomicString toWebCoreAtomicString(v8::Handle<v8::String> value)
+ {
+ return v8StringToWebCoreString<AtomicString>(value, Externalize);
+ }
+
// Convert v8 types to a WTF::String. If the V8 string is not already
// an external string then it is transformed into an external string at this
// point to avoid repeated conversions.
@@ -205,15 +232,6 @@
return stringResource;
}
- // FIXME: See the above comment.
- inline AtomicString toWebCoreAtomicStringWithNullCheck(v8::Handle<v8::Value> value)
- {
- V8StringResource<WithNullCheck> stringResource(value);
- if (!stringResource.prepare())
- return AtomicString();
- return stringResource;
- }
-
// Convert a string to a V8 string.
// Return a V8 external string that shares the underlying buffer with the given
// WebCore string. The reference counting mechanism is used to keep the
@@ -391,7 +409,8 @@
struct NativeValueTraits<String> {
static inline String nativeValue(const v8::Handle<v8::Value>& value)
{
- return toWebCoreString(value);
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<>, stringValue, value, String());
+ return stringValue;
}
};
@@ -635,7 +654,8 @@
v8::Local<v8::Value> getHiddenValueFromMainWorldWrapper(v8::Isolate*, ScriptWrappable*, v8::Handle<v8::String> key);
- v8::Isolate* getIsolateFromScriptExecutionContext(ScriptExecutionContext*);
+ v8::Isolate* toIsolate(ScriptExecutionContext*);
+ v8::Isolate* toIsolate(Frame*);
} // namespace WebCore
diff --git a/Source/bindings/v8/V8BindingMacros.h b/Source/bindings/v8/V8BindingMacros.h
index 9fae960..5ec307f 100644
--- a/Source/bindings/v8/V8BindingMacros.h
+++ b/Source/bindings/v8/V8BindingMacros.h
@@ -76,9 +76,6 @@
if (!var.prepare()) \
return retVal;
-#define V8TRYCATCH_FOR_V8STRINGRESOURCE(type, var, value) \
- V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(type, var, value, v8::Undefined());
-
#define V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(type, var, value) \
type var(value); \
if (!var.prepare()) \
diff --git a/Source/bindings/v8/V8Callback.cpp b/Source/bindings/v8/V8Callback.cpp
index d103c34..33ba790 100644
--- a/Source/bindings/v8/V8Callback.cpp
+++ b/Source/bindings/v8/V8Callback.cpp
@@ -48,7 +48,7 @@
v8::Local<v8::Function> callbackFunction;
if (callback->IsFunction()) {
- callbackFunction = v8::Local<v8::Function>::New(v8::Handle<v8::Function>::Cast(callback));
+ callbackFunction = v8::Local<v8::Function>::New(isolate, v8::Handle<v8::Function>::Cast(callback));
} else if (callback->IsObject()) {
v8::Local<v8::Value> handleEventFunction = callback->Get(v8::String::NewSymbol("handleEvent"));
if (handleEventFunction->IsFunction())
diff --git a/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp b/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp
index 206ce6b..93b0518 100644
--- a/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp
+++ b/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp
@@ -91,11 +91,11 @@
: CustomElementLifecycleCallbacks(flagSet(enteredView, leftView, attributeChanged))
, ActiveDOMCallback(scriptExecutionContext)
, m_world(DOMWrapperWorld::current())
- , m_prototype(prototype)
- , m_created(created)
- , m_enteredView(enteredView)
- , m_leftView(leftView)
- , m_attributeChanged(attributeChanged)
+ , m_prototype(toIsolate(scriptExecutionContext), prototype)
+ , m_created(toIsolate(scriptExecutionContext), created)
+ , m_enteredView(toIsolate(scriptExecutionContext), enteredView)
+ , m_leftView(toIsolate(scriptExecutionContext), leftView)
+ , m_attributeChanged(toIsolate(scriptExecutionContext), attributeChanged)
, m_owner(0)
{
m_prototype.makeWeak(&m_prototype, weakCallback<v8::Object>);
@@ -125,7 +125,7 @@
if (!m_owner)
return;
- v8::HandleScope handleScope(getIsolateFromScriptExecutionContext(scriptExecutionContext()));
+ v8::HandleScope handleScope(toIsolate(scriptExecutionContext()));
if (V8PerContextData* perContextData = creationContextData())
perContextData->clearCustomElementBinding(m_owner);
}
@@ -153,7 +153,7 @@
element->setCustomElementState(Element::Upgraded);
- v8::Isolate* isolate = getIsolateFromScriptExecutionContext(scriptExecutionContext());
+ v8::Isolate* isolate = toIsolate(scriptExecutionContext());
v8::HandleScope handleScope(isolate);
v8::Handle<v8::Context> context = toV8Context(scriptExecutionContext(), m_world.get());
if (context.IsEmpty())
@@ -201,7 +201,7 @@
if (!canInvokeCallback())
return;
- v8::Isolate* isolate = getIsolateFromScriptExecutionContext(scriptExecutionContext());
+ v8::Isolate* isolate = toIsolate(scriptExecutionContext());
v8::HandleScope handleScope(isolate);
v8::Handle<v8::Context> context = toV8Context(scriptExecutionContext(), m_world.get());
if (context.IsEmpty())
@@ -218,8 +218,8 @@
v8::Handle<v8::Value> argv[] = {
v8String(name, isolate),
- oldValue.isNull() ? v8::Handle<v8::Value>(v8::Null()) : v8::Handle<v8::Value>(v8String(oldValue, isolate)),
- newValue.isNull() ? v8::Handle<v8::Value>(v8::Null()) : v8::Handle<v8::Value>(v8String(newValue, isolate))
+ oldValue.isNull() ? v8::Handle<v8::Value>(v8::Null(isolate)) : v8::Handle<v8::Value>(v8String(oldValue, isolate)),
+ newValue.isNull() ? v8::Handle<v8::Value>(v8::Null(isolate)) : v8::Handle<v8::Value>(v8String(newValue, isolate))
};
v8::TryCatch exceptionCatcher;
@@ -232,7 +232,7 @@
if (!canInvokeCallback())
return;
- v8::HandleScope handleScope(getIsolateFromScriptExecutionContext(scriptExecutionContext()));
+ v8::HandleScope handleScope(toIsolate(scriptExecutionContext()));
v8::Handle<v8::Context> context = toV8Context(scriptExecutionContext(), m_world.get());
if (context.IsEmpty())
return;
diff --git a/Source/bindings/v8/V8DOMWrapper.cpp b/Source/bindings/v8/V8DOMWrapper.cpp
index b725c3d..29354fb 100644
--- a/Source/bindings/v8/V8DOMWrapper.cpp
+++ b/Source/bindings/v8/V8DOMWrapper.cpp
@@ -44,7 +44,7 @@
class V8WrapperInstantiationScope {
public:
- explicit V8WrapperInstantiationScope(v8::Handle<v8::Object> creationContext)
+ V8WrapperInstantiationScope(v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
: m_didEnterContext(false)
, m_context(v8::Context::GetCurrent())
{
@@ -58,7 +58,7 @@
// is different from the context that we are about to enter.
if (contextForWrapper == m_context)
return;
- m_context = v8::Local<v8::Context>::New(contextForWrapper);
+ m_context = v8::Local<v8::Context>::New(isolate, contextForWrapper);
m_didEnterContext = true;
m_context->Enter();
}
@@ -108,7 +108,7 @@
v8::Local<v8::Object> V8DOMWrapper::createWrapper(v8::Handle<v8::Object> creationContext, WrapperTypeInfo* type, void* impl, v8::Isolate* isolate)
{
- V8WrapperInstantiationScope scope(creationContext);
+ V8WrapperInstantiationScope scope(creationContext, isolate);
V8PerContextData* perContextData = V8PerContextData::from(scope.context());
v8::Local<v8::Object> wrapper = perContextData ? perContextData->createWrapperFromCache(type) : V8ObjectConstructor::newInstance(type->getTemplate(isolate, worldTypeInMainThread(isolate))->GetFunction());
diff --git a/Source/bindings/v8/V8Initializer.cpp b/Source/bindings/v8/V8Initializer.cpp
index e31c12f..8f00688 100644
--- a/Source/bindings/v8/V8Initializer.cpp
+++ b/Source/bindings/v8/V8Initializer.cpp
@@ -99,7 +99,7 @@
v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsString();
- String resource = shouldUseDocumentURL ? firstWindow->document()->url() : toWebCoreString(resourceName);
+ String resource = shouldUseDocumentURL ? firstWindow->document()->url() : toWebCoreString(resourceName.As<v8::String>());
AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCrossOrigin : NotSharableCrossOrigin;
RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, resource, message->GetLineNumber(), message->GetStartColumn(), DOMWrapperWorld::current());
diff --git a/Source/bindings/v8/V8LazyEventListener.cpp b/Source/bindings/v8/V8LazyEventListener.cpp
index ddb553f..f899de4 100644
--- a/Source/bindings/v8/V8LazyEventListener.cpp
+++ b/Source/bindings/v8/V8LazyEventListener.cpp
@@ -120,7 +120,7 @@
ASSERT(context->isDocument());
- v8::Isolate* isolate = getIsolateFromScriptExecutionContext(context);
+ v8::Isolate* isolate = toIsolate(context);
v8::HandleScope handleScope(isolate);
// Use the outer scope to hold context.
diff --git a/Source/bindings/v8/V8MutationCallback.cpp b/Source/bindings/v8/V8MutationCallback.cpp
index 0731691..950a959 100644
--- a/Source/bindings/v8/V8MutationCallback.cpp
+++ b/Source/bindings/v8/V8MutationCallback.cpp
@@ -38,7 +38,7 @@
V8MutationCallback::V8MutationCallback(v8::Handle<v8::Function> callback, ScriptExecutionContext* context, v8::Handle<v8::Object> owner, v8::Isolate* isolate)
: ActiveDOMCallback(context)
- , m_callback(callback)
+ , m_callback(isolate, callback)
, m_world(DOMWrapperWorld::current())
, m_isolate(isolate)
{
diff --git a/Source/bindings/v8/V8NPObject.cpp b/Source/bindings/v8/V8NPObject.cpp
index 200c407..00eaed8 100644
--- a/Source/bindings/v8/V8NPObject.cpp
+++ b/Source/bindings/v8/V8NPObject.cpp
@@ -111,7 +111,7 @@
OwnArrayPtr<NPVariant> npArgs = adoptArrayPtr(new NPVariant[numArgs]);
for (int i = 0; i < numArgs; i++)
- convertV8ObjectToNPVariant(args[i], npObject, &npArgs[i]);
+ convertV8ObjectToNPVariant(args[i], npObject, &npArgs[i], args.GetIsolate());
NPVariant result;
VOID_TO_NPVARIANT(result);
@@ -320,7 +320,7 @@
NPVariant npValue;
VOID_TO_NPVARIANT(npValue);
- convertV8ObjectToNPVariant(value, npObject, &npValue);
+ convertV8ObjectToNPVariant(value, npObject, &npValue, isolate);
bool success = npObject->_class->setProperty(npObject, identifier, &npValue);
_NPN_ReleaseVariantValue(&npValue);
if (success)
diff --git a/Source/bindings/v8/V8NPUtils.cpp b/Source/bindings/v8/V8NPUtils.cpp
index eb2e1a5..b54f747 100644
--- a/Source/bindings/v8/V8NPUtils.cpp
+++ b/Source/bindings/v8/V8NPUtils.cpp
@@ -41,7 +41,7 @@
namespace WebCore {
-void convertV8ObjectToNPVariant(v8::Local<v8::Value> object, NPObject* owner, NPVariant* result)
+void convertV8ObjectToNPVariant(v8::Local<v8::Value> object, NPObject* owner, NPVariant* result, v8::Isolate* isolate)
{
VOID_TO_NPVARIANT(*result);
@@ -61,14 +61,14 @@
else if (object->IsUndefined())
VOID_TO_NPVARIANT(*result);
else if (object->IsString()) {
- v8::Handle<v8::String> str = object->ToString();
+ v8::Handle<v8::String> str = object.As<v8::String>();
int length = str->Utf8Length() + 1;
char* utf8Chars = reinterpret_cast<char*>(malloc(length));
str->WriteUtf8(utf8Chars, length, 0, v8::String::HINT_MANY_WRITES_EXPECTED);
STRINGN_TO_NPVARIANT(utf8Chars, length-1, *result);
} else if (object->IsObject()) {
DOMWindow* window = toDOMWindow(v8::Context::GetCurrent());
- NPObject* npobject = npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(object), window);
+ NPObject* npobject = npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(object), window, isolate);
if (npobject)
_NPN_RegisterObject(npobject, owner);
OBJECT_TO_NPVARIANT(npobject, *result);
diff --git a/Source/bindings/v8/V8NPUtils.h b/Source/bindings/v8/V8NPUtils.h
index 5ed251f..7c5c53f 100644
--- a/Source/bindings/v8/V8NPUtils.h
+++ b/Source/bindings/v8/V8NPUtils.h
@@ -36,7 +36,7 @@
namespace WebCore {
// Convert a V8 Value of any type (string, bool, object, etc) to a NPVariant.
-void convertV8ObjectToNPVariant(v8::Local<v8::Value>, NPObject*, NPVariant*);
+void convertV8ObjectToNPVariant(v8::Local<v8::Value>, NPObject*, NPVariant*, v8::Isolate*);
// Convert a NPVariant (string, bool, object, etc) back to a V8 Value. The owner object is the NPObject which relates to the
// object, if the object is an Object. The created NPObject will be tied to the lifetime of the owner.
diff --git a/Source/bindings/v8/V8NodeFilterCondition.cpp b/Source/bindings/v8/V8NodeFilterCondition.cpp
index 5911953..94fe3ab 100644
--- a/Source/bindings/v8/V8NodeFilterCondition.cpp
+++ b/Source/bindings/v8/V8NodeFilterCondition.cpp
@@ -41,8 +41,8 @@
namespace WebCore {
-V8NodeFilterCondition::V8NodeFilterCondition(v8::Handle<v8::Value> filter, v8::Handle<v8::Object> owner)
- : m_filter(filter)
+V8NodeFilterCondition::V8NodeFilterCondition(v8::Handle<v8::Value> filter, v8::Handle<v8::Object> owner, v8::Isolate* isolate)
+ : m_filter(isolate, filter)
{
owner->SetHiddenValue(V8HiddenPropertyName::condition(), filter);
m_filter.makeWeak(this, &makeWeakCallback);
diff --git a/Source/bindings/v8/V8NodeFilterCondition.h b/Source/bindings/v8/V8NodeFilterCondition.h
index daaeb0f..2a52594 100644
--- a/Source/bindings/v8/V8NodeFilterCondition.h
+++ b/Source/bindings/v8/V8NodeFilterCondition.h
@@ -60,9 +60,9 @@
// (V8)
class V8NodeFilterCondition : public NodeFilterCondition {
public:
- static PassRefPtr<V8NodeFilterCondition> create(v8::Handle<v8::Value> filter, v8::Handle<v8::Object> owner)
+ static PassRefPtr<V8NodeFilterCondition> create(v8::Handle<v8::Value> filter, v8::Handle<v8::Object> owner, v8::Isolate* isolate)
{
- return adoptRef(new V8NodeFilterCondition(filter, owner));
+ return adoptRef(new V8NodeFilterCondition(filter, owner, isolate));
}
virtual ~V8NodeFilterCondition();
@@ -73,7 +73,7 @@
// As the value |filter| is maintained by V8GC, the |owner| which references
// V8NodeFilterCondition, usually a wrapper of NodeFilter, is specified here
// to hold a strong reference to |filter|.
- V8NodeFilterCondition(v8::Handle<v8::Value> filter, v8::Handle<v8::Object> owner);
+ V8NodeFilterCondition(v8::Handle<v8::Value> filter, v8::Handle<v8::Object> owner, v8::Isolate*);
static void makeWeakCallback(v8::Isolate*, v8::Persistent<v8::Value>*, V8NodeFilterCondition*);
diff --git a/Source/bindings/v8/V8PerContextData.cpp b/Source/bindings/v8/V8PerContextData.cpp
index f3ab0b8..5d0c171 100644
--- a/Source/bindings/v8/V8PerContextData.cpp
+++ b/Source/bindings/v8/V8PerContextData.cpp
@@ -167,7 +167,7 @@
}
-static v8::Handle<v8::Value> createDebugData(const char* worldName, int debugId)
+static v8::Handle<v8::Value> createDebugData(const char* worldName, int debugId, v8::Isolate* isolate)
{
char buffer[32];
unsigned wanted;
@@ -179,8 +179,8 @@
if (wanted < sizeof(buffer))
return v8::String::NewSymbol(buffer);
- return v8::Undefined();
-};
+ return v8::Undefined(isolate);
+}
static v8::Handle<v8::Value> debugData(v8::Handle<v8::Context> context)
{
@@ -199,7 +199,7 @@
if (!debugData(context)->IsUndefined())
return false;
v8::HandleScope scope(context->GetIsolate());
- v8::Handle<v8::Value> debugData = createDebugData(worldName, debugId);
+ v8::Handle<v8::Value> debugData = createDebugData(worldName, debugId, context->GetIsolate());
setDebugData(context, debugData);
return true;
}
diff --git a/Source/bindings/v8/V8PerIsolateData.cpp b/Source/bindings/v8/V8PerIsolateData.cpp
index b620a05..84691b7 100644
--- a/Source/bindings/v8/V8PerIsolateData.cpp
+++ b/Source/bindings/v8/V8PerIsolateData.cpp
@@ -74,7 +74,7 @@
v8::Persistent<v8::Value>& V8PerIsolateData::ensureLiveRoot()
{
if (m_liveRoot.isEmpty())
- m_liveRoot.set(m_isolate, v8::Null());
+ m_liveRoot.set(m_isolate, v8::Null(m_isolate));
return m_liveRoot.getUnsafe();
}
diff --git a/Source/bindings/v8/V8ScriptRunner.cpp b/Source/bindings/v8/V8ScriptRunner.cpp
index 9412ae6..713cef0 100644
--- a/Source/bindings/v8/V8ScriptRunner.cpp
+++ b/Source/bindings/v8/V8ScriptRunner.cpp
@@ -70,7 +70,7 @@
v8::Handle<v8::String> name = v8String(fileName, isolate);
v8::Handle<v8::Integer> line = v8::Integer::New(scriptStartPosition.m_line.zeroBasedInt(), isolate);
v8::Handle<v8::Integer> column = v8::Integer::New(scriptStartPosition.m_column.zeroBasedInt(), isolate);
- v8::Handle<v8::Boolean> isSharedCrossOrigin = corsStatus == SharableCrossOrigin ? v8::True() : v8::False();
+ v8::Handle<v8::Boolean> isSharedCrossOrigin = corsStatus == SharableCrossOrigin ? v8::True(isolate) : v8::False(isolate);
v8::ScriptOrigin origin(name, line, column, isSharedCrossOrigin);
return v8::Script::Compile(code, &origin, scriptData);
}
diff --git a/Source/bindings/v8/V8ThrowException.cpp b/Source/bindings/v8/V8ThrowException.cpp
index 1f303f7..35aec55 100644
--- a/Source/bindings/v8/V8ThrowException.cpp
+++ b/Source/bindings/v8/V8ThrowException.cpp
@@ -77,7 +77,7 @@
if (exception.IsEmpty())
return v8Undefined();
- return V8ThrowException::throwError(exception);
+ return V8ThrowException::throwError(exception, isolate);
}
v8::Handle<v8::Value> V8ThrowException::createError(V8ErrorType type, const String& message, v8::Isolate* isolate)
@@ -104,7 +104,7 @@
v8::Handle<v8::Value> exception = V8ThrowException::createError(type, message, isolate);
if (exception.IsEmpty())
return v8Undefined();
- return V8ThrowException::throwError(exception);
+ return V8ThrowException::throwError(exception, isolate);
}
v8::Handle<v8::Value> V8ThrowException::createTypeError(const String& message, v8::Isolate* isolate)
@@ -115,20 +115,20 @@
v8::Handle<v8::Value> V8ThrowException::throwTypeError(const String& message, v8::Isolate* isolate)
{
v8::Handle<v8::Value> exception = V8ThrowException::createTypeError(message, isolate);
- return V8ThrowException::throwError(exception);
+ return V8ThrowException::throwError(exception, isolate);
}
v8::Handle<v8::Value> V8ThrowException::throwNotEnoughArgumentsError(v8::Isolate* isolate)
{
v8::Handle<v8::Value> exception = V8ThrowException::createTypeError("Not enough arguments", isolate);
- return V8ThrowException::throwError(exception);
+ return V8ThrowException::throwError(exception, isolate);
}
-v8::Handle<v8::Value> V8ThrowException::throwError(v8::Handle<v8::Value> exception)
+v8::Handle<v8::Value> V8ThrowException::throwError(v8::Handle<v8::Value> exception, v8::Isolate* isolate)
{
if (!v8::V8::IsExecutionTerminating())
v8::ThrowException(exception);
- return v8::Undefined();
+ return v8::Undefined(isolate);
}
} // namespace WebCore
diff --git a/Source/bindings/v8/V8ThrowException.h b/Source/bindings/v8/V8ThrowException.h
index 65cb265..ac996e8 100644
--- a/Source/bindings/v8/V8ThrowException.h
+++ b/Source/bindings/v8/V8ThrowException.h
@@ -63,11 +63,12 @@
static v8::Handle<v8::Value> createError(V8ErrorType, const String&, v8::Isolate*);
static v8::Handle<v8::Value> throwError(V8ErrorType, const String&, v8::Isolate*);
- static v8::Handle<v8::Value> throwError(v8::Handle<v8::Value>);
+ static v8::Handle<v8::Value> throwError(v8::Handle<v8::Value>, v8::Isolate*);
static v8::Handle<v8::Value> createTypeError(const String&, v8::Isolate*);
static v8::Handle<v8::Value> throwTypeError(const String&, v8::Isolate*);
+ // FIXME: Kill this once we kill all the callsites, since we want to pass in useful information as a string.
static v8::Handle<v8::Value> throwNotEnoughArgumentsError(v8::Isolate*);
};
diff --git a/Source/bindings/v8/V8WindowShell.cpp b/Source/bindings/v8/V8WindowShell.cpp
index c7dd679..05221c1 100644
--- a/Source/bindings/v8/V8WindowShell.cpp
+++ b/Source/bindings/v8/V8WindowShell.cpp
@@ -244,7 +244,7 @@
SecurityOrigin* origin = m_world->isolatedWorldSecurityOrigin();
if (origin && InspectorInstrumentation::hasFrontends()) {
- ScriptState* scriptState = ScriptState::forContext(v8::Local<v8::Context>::New(context));
+ ScriptState* scriptState = ScriptState::forContext(v8::Local<v8::Context>::New(m_isolate, context));
InspectorInstrumentation::didCreateIsolatedContext(m_frame, scriptState, origin);
}
}
diff --git a/Source/bindings/v8/V8WorkerGlobalScopeEventListener.cpp b/Source/bindings/v8/V8WorkerGlobalScopeEventListener.cpp
index f2fee0d..74d5260 100644
--- a/Source/bindings/v8/V8WorkerGlobalScopeEventListener.cpp
+++ b/Source/bindings/v8/V8WorkerGlobalScopeEventListener.cpp
@@ -58,7 +58,7 @@
// See issue 889829.
RefPtr<V8AbstractEventListener> protect(this);
- v8::Isolate* isolate = getIsolateFromScriptExecutionContext(context);
+ v8::Isolate* isolate = toIsolate(context);
v8::HandleScope handleScope(isolate);
WorkerScriptController* script = toWorkerGlobalScope(context)->script();
@@ -97,7 +97,7 @@
cookie = InspectorInstrumentation::willCallFunction(context, resourceName, lineNumber);
}
- v8::Isolate* isolate = getIsolateFromScriptExecutionContext(context);
+ v8::Isolate* isolate = toIsolate(context);
v8::Handle<v8::Value> parameters[1] = { jsEvent };
v8::Local<v8::Value> result = V8ScriptRunner::callFunction(handlerFunction, context, receiver, WTF_ARRAY_LENGTH(parameters), parameters, isolate);
@@ -114,10 +114,11 @@
return listener;
EventTarget* target = event->currentTarget();
- v8::Handle<v8::Value> value = toV8(target, v8::Handle<v8::Object>(), toV8Context(context, world())->GetIsolate());
+ v8::Isolate* isolate = toIsolate(context);
+ v8::Handle<v8::Value> value = toV8(target, v8::Handle<v8::Object>(), isolate);
if (value.IsEmpty())
return v8::Local<v8::Object>();
- return v8::Local<v8::Object>::New(v8::Handle<v8::Object>::Cast(value));
+ return v8::Local<v8::Object>::New(isolate, v8::Handle<v8::Object>::Cast(value));
}
} // namespace WebCore
diff --git a/Source/bindings/v8/WorkerScriptController.cpp b/Source/bindings/v8/WorkerScriptController.cpp
index d2d151a..83ba3a7 100644
--- a/Source/bindings/v8/WorkerScriptController.cpp
+++ b/Source/bindings/v8/WorkerScriptController.cpp
@@ -168,7 +168,7 @@
state->lineNumber = message->GetLineNumber();
state->columnNumber = message->GetStartColumn();
state->sourceURL = toWebCoreString(message->GetScriptResourceName());
- state->exception = ScriptValue(block.Exception());
+ state->exception = ScriptValue(block.Exception(), m_isolate);
block.Reset();
} else
state->hadException = false;
@@ -176,7 +176,7 @@
if (result.IsEmpty() || result->IsUndefined())
return ScriptValue();
- return ScriptValue(result);
+ return ScriptValue(result, m_isolate);
}
void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr<ErrorEvent>* errorEvent)
@@ -238,7 +238,7 @@
void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtr<ErrorEvent> errorEvent)
{
m_errorEventFromImportedScript = errorEvent;
- throwError(V8ThrowException::createError(v8GeneralError, m_errorEventFromImportedScript->message(), m_isolate));
+ throwError(V8ThrowException::createError(v8GeneralError, m_errorEventFromImportedScript->message(), m_isolate), m_isolate);
}
WorkerScriptController* WorkerScriptController::controllerForContext()
diff --git a/Source/bindings/v8/custom/V8AlgorithmCustom.cpp b/Source/bindings/v8/custom/V8AlgorithmCustom.cpp
index fd55a1c..83d58bf 100644
--- a/Source/bindings/v8/custom/V8AlgorithmCustom.cpp
+++ b/Source/bindings/v8/custom/V8AlgorithmCustom.cpp
@@ -29,7 +29,7 @@
*/
#include "config.h"
-#include "modules/crypto/Algorithm.h"
+#include "V8Algorithm.h"
#include "V8AesCbcParams.h"
#include "V8AesKeyGenParams.h"
@@ -37,7 +37,6 @@
#include "V8HmacParams.h"
#include "V8RsaKeyGenParams.h"
#include "V8RsaSsaParams.h"
-#include "bindings/v8/V8Binding.h"
namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8ArrayBufferCustom.h b/Source/bindings/v8/custom/V8ArrayBufferCustom.h
index f071cfd..a4ee565 100644
--- a/Source/bindings/v8/custom/V8ArrayBufferCustom.h
+++ b/Source/bindings/v8/custom/V8ArrayBufferCustom.h
@@ -29,9 +29,7 @@
#include "bindings/v8/V8Binding.h"
#include "bindings/v8/V8DOMWrapper.h"
#include "bindings/v8/WrapperTypeInfo.h"
-
#include "wtf/ArrayBuffer.h"
-
#include <v8.h>
namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp b/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
index 1d83f4d..4f00d0d 100644
--- a/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
+++ b/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
@@ -35,7 +35,6 @@
#include "bindings/v8/custom/V8Uint32ArrayCustom.h"
#include "bindings/v8/custom/V8Uint8ArrayCustom.h"
#include "bindings/v8/custom/V8Uint8ClampedArrayCustom.h"
-
#include <v8.h>
namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h b/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h
index d39a9d2..95c87cc 100644
--- a/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h
+++ b/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h
@@ -35,7 +35,6 @@
#include "bindings/v8/V8ObjectConstructor.h"
#include "bindings/v8/custom/V8ArrayBufferCustom.h"
#include "core/dom/ExceptionCode.h"
-
#include "wtf/ArrayBuffer.h"
#include "wtf/ArrayBufferView.h"
diff --git a/Source/bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp b/Source/bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp
index b0db2bf..8f43ddb 100644
--- a/Source/bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp
+++ b/Source/bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp
@@ -23,9 +23,7 @@
*/
#include "config.h"
-
#if ENABLE(WEB_AUDIO)
-
#include "V8AudioBufferSourceNode.h"
#include "V8AudioBuffer.h"
diff --git a/Source/bindings/v8/custom/V8AudioContextCustom.cpp b/Source/bindings/v8/custom/V8AudioContextCustom.cpp
index fedc602..86e3971 100644
--- a/Source/bindings/v8/custom/V8AudioContextCustom.cpp
+++ b/Source/bindings/v8/custom/V8AudioContextCustom.cpp
@@ -23,9 +23,7 @@
*/
#include "config.h"
-
#if ENABLE(WEB_AUDIO)
-
#include "V8AudioContext.h"
#include "V8AudioBuffer.h"
diff --git a/Source/bindings/v8/custom/V8AudioNodeCustom.cpp b/Source/bindings/v8/custom/V8AudioNodeCustom.cpp
index 29dcde5..fcc9d08 100644
--- a/Source/bindings/v8/custom/V8AudioNodeCustom.cpp
+++ b/Source/bindings/v8/custom/V8AudioNodeCustom.cpp
@@ -23,9 +23,7 @@
*/
#include "config.h"
-
#if ENABLE(WEB_AUDIO)
-
#include "V8AudioNode.h"
#include "V8AnalyserNode.h"
diff --git a/Source/bindings/v8/custom/V8BiquadFilterNodeCustom.cpp b/Source/bindings/v8/custom/V8BiquadFilterNodeCustom.cpp
index d3c613f..de15369 100644
--- a/Source/bindings/v8/custom/V8BiquadFilterNodeCustom.cpp
+++ b/Source/bindings/v8/custom/V8BiquadFilterNodeCustom.cpp
@@ -23,9 +23,7 @@
*/
#include "config.h"
-
#if ENABLE(WEB_AUDIO)
-
#include "V8BiquadFilterNode.h"
#include "bindings/v8/V8Binding.h"
diff --git a/Source/bindings/v8/custom/V8BlobCustom.cpp b/Source/bindings/v8/custom/V8BlobCustom.cpp
index 6f3c0aa..2552ebd 100644
--- a/Source/bindings/v8/custom/V8BlobCustom.cpp
+++ b/Source/bindings/v8/custom/V8BlobCustom.cpp
@@ -29,9 +29,8 @@
*/
#include "config.h"
-#include "core/fileapi/Blob.h"
-
#include "V8Blob.h"
+
#include "V8File.h"
#include "bindings/v8/Dictionary.h"
#include "bindings/v8/V8Binding.h"
@@ -101,7 +100,7 @@
uint32_t length = blobParts->Length();
for (uint32_t i = 0; i < length; ++i) {
- v8::Local<v8::Value> item = blobParts->Get(v8::Uint32::New(i));
+ v8::Local<v8::Value> item = blobParts->Get(v8::Uint32::New(i, args.GetIsolate()));
ASSERT(!item.IsEmpty());
if (V8ArrayBuffer::HasInstance(item, args.GetIsolate(), worldType(args.GetIsolate()))) {
ArrayBuffer* arrayBuffer = V8ArrayBuffer::toNative(v8::Handle<v8::Object>::Cast(item));
@@ -111,13 +110,12 @@
ArrayBufferView* arrayBufferView = V8ArrayBufferView::toNative(v8::Handle<v8::Object>::Cast(item));
ASSERT(arrayBufferView);
blobBuilder.append(arrayBufferView);
- } else
- if (V8Blob::HasInstance(item, args.GetIsolate(), worldType(args.GetIsolate()))) {
+ } else if (V8Blob::HasInstance(item, args.GetIsolate(), worldType(args.GetIsolate()))) {
Blob* blob = V8Blob::toNative(v8::Handle<v8::Object>::Cast(item));
ASSERT(blob);
blobBuilder.append(blob);
} else {
- V8TRYCATCH_VOID(String, stringValue, toWebCoreString(item));
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringValue, item);
blobBuilder.append(stringValue, endings);
}
}
diff --git a/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp b/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
index 362aaca..9a6325f 100644
--- a/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
+++ b/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
@@ -78,7 +78,7 @@
{
CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder());
if (value->IsString())
- impl->setStrokeColor(toWebCoreString(value));
+ impl->setStrokeColor(toWebCoreString(value.As<v8::String>()));
else
impl->setStrokeStyle(toCanvasStyle(value, info.GetIsolate()));
}
@@ -93,7 +93,7 @@
{
CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder());
if (value->IsString())
- impl->setFillColor(toWebCoreString(value));
+ impl->setFillColor(toWebCoreString(value.As<v8::String>()));
else
impl->setFillStyle(toCanvasStyle(value, info.GetIsolate()));
}
diff --git a/Source/bindings/v8/custom/V8ClipboardCustom.cpp b/Source/bindings/v8/custom/V8ClipboardCustom.cpp
index 899debc..9a22519 100644
--- a/Source/bindings/v8/custom/V8ClipboardCustom.cpp
+++ b/Source/bindings/v8/custom/V8ClipboardCustom.cpp
@@ -32,15 +32,14 @@
#include "V8Clipboard.h"
#include "HTMLNames.h"
+#include "V8Node.h"
+#include "bindings/v8/V8Binding.h"
#include "core/dom/Clipboard.h"
#include "core/dom/Element.h"
#include "core/dom/Node.h"
#include "core/html/HTMLImageElement.h"
#include "core/platform/graphics/IntPoint.h"
-#include "V8Node.h"
-#include "bindings/v8/V8Binding.h"
-
namespace WebCore {
void V8Clipboard::typesAttributeGetterCustom(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
diff --git a/Source/bindings/v8/custom/V8CustomEventCustom.cpp b/Source/bindings/v8/custom/V8CustomEventCustom.cpp
index e07a680..5b5d0ff 100644
--- a/Source/bindings/v8/custom/V8CustomEventCustom.cpp
+++ b/Source/bindings/v8/custom/V8CustomEventCustom.cpp
@@ -31,6 +31,7 @@
#include "config.h"
#include "V8CustomEvent.h"
+#include "RuntimeEnabledFeatures.h"
#include "V8Event.h"
#include "bindings/v8/Dictionary.h"
#include "bindings/v8/ScriptState.h"
@@ -39,7 +40,6 @@
#include "bindings/v8/V8DOMWrapper.h"
#include "bindings/v8/V8HiddenPropertyName.h"
#include "core/dom/ContextFeatures.h"
-#include "RuntimeEnabledFeatures.h"
namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp b/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
index d16b206..a484851 100644
--- a/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
+++ b/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
@@ -29,7 +29,6 @@
*/
#include "config.h"
-
#include "V8SQLStatementErrorCallback.h"
#include "V8SQLError.h"
diff --git a/Source/bindings/v8/custom/V8CustomXPathNSResolver.h b/Source/bindings/v8/custom/V8CustomXPathNSResolver.h
index 3ddceae..a675e6f 100644
--- a/Source/bindings/v8/custom/V8CustomXPathNSResolver.h
+++ b/Source/bindings/v8/custom/V8CustomXPathNSResolver.h
@@ -33,9 +33,9 @@
#define V8CustomXPathNSResolver_h
#include "core/xml/XPathNSResolver.h"
-#include <v8.h>
#include "wtf/Forward.h"
#include "wtf/RefPtr.h"
+#include <v8.h>
namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8DedicatedWorkerGlobalScopeCustom.cpp b/Source/bindings/v8/custom/V8DedicatedWorkerGlobalScopeCustom.cpp
index 6f03688..ffa25a1 100644
--- a/Source/bindings/v8/custom/V8DedicatedWorkerGlobalScopeCustom.cpp
+++ b/Source/bindings/v8/custom/V8DedicatedWorkerGlobalScopeCustom.cpp
@@ -29,7 +29,6 @@
*/
#include "config.h"
-
#include "V8DedicatedWorkerGlobalScope.h"
#include "bindings/v8/ExceptionState.h"
diff --git a/Source/bindings/v8/custom/V8DeviceMotionEventCustom.cpp b/Source/bindings/v8/custom/V8DeviceMotionEventCustom.cpp
index 559e0d1..88ff30e 100644
--- a/Source/bindings/v8/custom/V8DeviceMotionEventCustom.cpp
+++ b/Source/bindings/v8/custom/V8DeviceMotionEventCustom.cpp
@@ -28,7 +28,6 @@
#include "bindings/v8/V8Binding.h"
#include "modules/device_orientation/DeviceMotionData.h"
-
#include <v8.h>
namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp b/Source/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp
index 2383f06..38929a8 100644
--- a/Source/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp
+++ b/Source/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp
@@ -28,7 +28,6 @@
#include "bindings/v8/V8Binding.h"
#include "modules/device_orientation/DeviceOrientationData.h"
-
#include <v8.h>
namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8DocumentCustom.cpp b/Source/bindings/v8/custom/V8DocumentCustom.cpp
index b6cd50e..26a117c 100644
--- a/Source/bindings/v8/custom/V8DocumentCustom.cpp
+++ b/Source/bindings/v8/custom/V8DocumentCustom.cpp
@@ -64,7 +64,7 @@
{
RefPtr<Document> document = V8Document::toNative(args.Holder());
ExceptionState es(args.GetIsolate());
- String expression = toWebCoreString(args[0]);
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, expression, args[0]);
RefPtr<Node> contextNode;
if (V8Node::HasInstance(args[1], args.GetIsolate(), worldType(args.GetIsolate())))
contextNode = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1]));
@@ -104,16 +104,4 @@
return wrapper;
}
-void V8Document::createTouchListMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
-{
- RefPtr<TouchList> touchList = TouchList::create();
-
- for (int i = 0; i < args.Length(); i++) {
- Touch* touch = V8DOMWrapper::isWrapperOfType(args[i], &V8Touch::info) ? V8Touch::toNative(args[i]->ToObject()) : 0;
- touchList->append(touch);
- }
-
- v8SetReturnValue(args, toV8(touchList.release(), args.Holder(), args.GetIsolate()));
-}
-
} // namespace WebCore
diff --git a/Source/bindings/v8/custom/V8DocumentLocationCustom.cpp b/Source/bindings/v8/custom/V8DocumentLocationCustom.cpp
index a913ba0..c9b98ef 100644
--- a/Source/bindings/v8/custom/V8DocumentLocationCustom.cpp
+++ b/Source/bindings/v8/custom/V8DocumentLocationCustom.cpp
@@ -58,8 +58,10 @@
return;
DOMWindow* window = document->domWindow();
- if (Location* location = window->location())
- location->setHref(active, first, toWebCoreString(value));
+ if (Location* location = window->location()) {
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringValue, value);
+ location->setHref(active, first, stringValue);
+ }
}
} // namespace WebCore
diff --git a/Source/bindings/v8/custom/V8ElementCustom.cpp b/Source/bindings/v8/custom/V8ElementCustom.cpp
index 355f3a8..1a345fe 100644
--- a/Source/bindings/v8/custom/V8ElementCustom.cpp
+++ b/Source/bindings/v8/custom/V8ElementCustom.cpp
@@ -29,9 +29,8 @@
*/
#include "config.h"
-#include "core/dom/Element.h"
-
#include "V8Element.h"
+
#include "V8HTMLElement.h"
#include "V8SVGElement.h"
diff --git a/Source/bindings/v8/custom/V8EntryCustom.cpp b/Source/bindings/v8/custom/V8EntryCustom.cpp
index 1ce4114..dae68e6 100644
--- a/Source/bindings/v8/custom/V8EntryCustom.cpp
+++ b/Source/bindings/v8/custom/V8EntryCustom.cpp
@@ -29,11 +29,10 @@
*/
#include "config.h"
-#include "modules/filesystem/Entry.h"
+#include "V8Entry.h"
#include "V8Attr.h"
#include "V8DirectoryEntry.h"
-#include "V8Entry.h"
#include "V8FileEntry.h"
#include "bindings/v8/V8Binding.h"
#include "wtf/RefPtr.h"
diff --git a/Source/bindings/v8/custom/V8EntrySyncCustom.cpp b/Source/bindings/v8/custom/V8EntrySyncCustom.cpp
index d09bcf4..a874d51 100644
--- a/Source/bindings/v8/custom/V8EntrySyncCustom.cpp
+++ b/Source/bindings/v8/custom/V8EntrySyncCustom.cpp
@@ -29,11 +29,10 @@
*/
#include "config.h"
-#include "modules/filesystem/EntrySync.h"
+#include "V8EntrySync.h"
#include "V8Attr.h"
#include "V8DirectoryEntrySync.h"
-#include "V8EntrySync.h"
#include "V8FileEntrySync.h"
#include "bindings/v8/V8Binding.h"
#include "wtf/RefPtr.h"
diff --git a/Source/bindings/v8/custom/V8EventTargetCustom.cpp b/Source/bindings/v8/custom/V8EventTargetCustom.cpp
index 69a4d08..8bfbfb6 100644
--- a/Source/bindings/v8/custom/V8EventTargetCustom.cpp
+++ b/Source/bindings/v8/custom/V8EventTargetCustom.cpp
@@ -29,11 +29,10 @@
*/
#include "config.h"
-#include "core/dom/EventTarget.h"
+#include "V8EventTarget.h"
#include "EventTargetHeaders.h"
#include "EventTargetInterfaces.h"
-#include "V8EventTarget.h"
namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8FileReaderCustom.cpp b/Source/bindings/v8/custom/V8FileReaderCustom.cpp
index 13924db..5b2c9b0 100644
--- a/Source/bindings/v8/custom/V8FileReaderCustom.cpp
+++ b/Source/bindings/v8/custom/V8FileReaderCustom.cpp
@@ -29,7 +29,6 @@
*/
#include "config.h"
-
#include "V8FileReader.h"
#include "bindings/v8/V8Binding.h"
diff --git a/Source/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp b/Source/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
index 7033e32..4e12f78 100644
--- a/Source/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
+++ b/Source/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
@@ -31,12 +31,11 @@
#include "config.h"
#include "V8HTMLAllCollection.h"
-#include "core/dom/NamedNodesCollection.h"
-#include "core/html/HTMLAllCollection.h"
-
#include "V8Node.h"
#include "V8NodeList.h"
#include "bindings/v8/V8Binding.h"
+#include "core/dom/NamedNodesCollection.h"
+#include "core/html/HTMLAllCollection.h"
namespace WebCore {
@@ -62,10 +61,11 @@
{
v8::Local<v8::Uint32> index = argument->ToArrayIndex();
if (index.IsEmpty()) {
- v8::Handle<v8::Value> result = getNamedItems(collection, toWebCoreString(argument->ToString()), callbackInfo);
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<>, name, argument, v8::Undefined(callbackInfo.GetIsolate()));
+ v8::Handle<v8::Value> result = getNamedItems(collection, name, callbackInfo);
if (result.IsEmpty())
- return v8::Undefined();
+ return v8::Undefined(callbackInfo.GetIsolate());
return result;
}
@@ -82,8 +82,10 @@
void V8HTMLAllCollection::namedItemMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
{
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, args[0]);
+
HTMLAllCollection* imp = V8HTMLAllCollection::toNative(args.Holder());
- v8::Handle<v8::Value> result = getNamedItems(imp, toWebCoreString(args[0]), args);
+ v8::Handle<v8::Value> result = getNamedItems(imp, name, args);
if (result.IsEmpty()) {
v8SetReturnValueNull(args);
@@ -106,7 +108,7 @@
}
// If there is a second argument it is the index of the item we want.
- String name = toWebCoreString(args[0]);
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, args[0]);
v8::Local<v8::Uint32> index = args[1]->ToArrayIndex();
if (index.IsEmpty())
return;
diff --git a/Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
index 56f9f91..eb863d7 100644
--- a/Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
+++ b/Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
@@ -51,7 +51,8 @@
{
v8::Handle<v8::Object> holder = args.Holder();
HTMLCanvasElement* imp = V8HTMLCanvasElement::toNative(holder);
- String contextId = toWebCoreString(args[0]);
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, contextIdResource, args[0]);
+ String contextId = contextIdResource;
RefPtr<CanvasContextAttributes> attributes;
if (contextId == "webgl" || contextId == "experimental-webgl" || contextId == "webkit-3d") {
RefPtr<WebGLContextAttributes> webGLAttributes = WebGLContextAttributes::create();
@@ -130,7 +131,7 @@
HTMLCanvasElement* canvas = V8HTMLCanvasElement::toNative(holder);
ExceptionState es(args.GetIsolate());
- String type = toWebCoreString(args[0]);
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, type, args[0]);
double quality;
double* qualityPtr = 0;
if (args.Length() > 1 && args[1]->IsNumber()) {
diff --git a/Source/bindings/v8/custom/V8HTMLDocumentCustom.cpp b/Source/bindings/v8/custom/V8HTMLDocumentCustom.cpp
index afeade8..5641961 100644
--- a/Source/bindings/v8/custom/V8HTMLDocumentCustom.cpp
+++ b/Source/bindings/v8/custom/V8HTMLDocumentCustom.cpp
@@ -60,8 +60,10 @@
static String writeHelperGetString(const v8::FunctionCallbackInfo<v8::Value>& args)
{
StringBuilder builder;
- for (int i = 0; i < args.Length(); ++i)
- builder.append(toWebCoreString(args[i]));
+ for (int i = 0; i < args.Length(); ++i) {
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<>, stringArgument, args[i], String());
+ builder.append(stringArgument);
+ }
return builder.toString();
}
diff --git a/Source/bindings/v8/custom/V8HTMLFormControlsCollectionCustom.cpp b/Source/bindings/v8/custom/V8HTMLFormControlsCollectionCustom.cpp
index dc48412..3c6d796 100644
--- a/Source/bindings/v8/custom/V8HTMLFormControlsCollectionCustom.cpp
+++ b/Source/bindings/v8/custom/V8HTMLFormControlsCollectionCustom.cpp
@@ -56,8 +56,9 @@
void V8HTMLFormControlsCollection::namedItemMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
{
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, args[0]);
HTMLFormControlsCollection* imp = V8HTMLFormControlsCollection::toNative(args.Holder());
- v8::Handle<v8::Value> result = getNamedItems(imp, toWebCoreString(args[0]), args);
+ v8::Handle<v8::Value> result = getNamedItems(imp, name, args);
if (result.IsEmpty()) {
v8SetReturnValueNull(args);
diff --git a/Source/bindings/v8/custom/V8HTMLImageElementConstructor.h b/Source/bindings/v8/custom/V8HTMLImageElementConstructor.h
index 5b3f756..ec3c33c 100644
--- a/Source/bindings/v8/custom/V8HTMLImageElementConstructor.h
+++ b/Source/bindings/v8/custom/V8HTMLImageElementConstructor.h
@@ -32,7 +32,6 @@
#define V8HTMLImageElementConstructor_h
#include "bindings/v8/WrapperTypeInfo.h"
-
#include <v8.h>
namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8HTMLMediaElementCustom.cpp b/Source/bindings/v8/custom/V8HTMLMediaElementCustom.cpp
index e6e69f4..0770439 100644
--- a/Source/bindings/v8/custom/V8HTMLMediaElementCustom.cpp
+++ b/Source/bindings/v8/custom/V8HTMLMediaElementCustom.cpp
@@ -24,7 +24,6 @@
*/
#include "config.h"
-
#include "V8HTMLMediaElement.h"
#include "V8MediaController.h"
diff --git a/Source/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp b/Source/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
index 2f73bff..22658c3 100644
--- a/Source/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
+++ b/Source/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
@@ -65,8 +65,9 @@
void V8HTMLOptionsCollection::namedItemMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
{
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, args[0]);
HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(args.Holder());
- getNamedItems(imp, toWebCoreString(args[0]), args);
+ getNamedItems(imp, name, args);
}
void V8HTMLOptionsCollection::addMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
diff --git a/Source/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp b/Source/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
index 2eb0188..4dd9b8c 100644
--- a/Source/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
+++ b/Source/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
@@ -29,7 +29,6 @@
*/
#include "config.h"
-#include "core/html/HTMLPlugInElement.h"
#include "V8HTMLAppletElement.h"
#include "V8HTMLEmbedElement.h"
@@ -51,7 +50,7 @@
if (!scriptInstance)
return;
- v8::Local<v8::Object> instance = scriptInstance->newLocal(v8::Isolate::GetCurrent());
+ v8::Local<v8::Object> instance = scriptInstance->newLocal(info.GetIsolate());
if (instance.IsEmpty())
return;
@@ -66,7 +65,7 @@
if (!scriptInstance)
return;
- v8::Local<v8::Object> instance = scriptInstance->newLocal(v8::Isolate::GetCurrent());
+ v8::Local<v8::Object> instance = scriptInstance->newLocal(info.GetIsolate());
if (instance.IsEmpty())
return;
@@ -126,7 +125,7 @@
if (!scriptInstance)
return;
- v8::Local<v8::Object> instance = scriptInstance->newLocal(v8::Isolate::GetCurrent());
+ v8::Local<v8::Object> instance = scriptInstance->newLocal(info.GetIsolate());
if (instance.IsEmpty())
return;
@@ -141,7 +140,7 @@
if (!scriptInstance)
return;
- v8::Local<v8::Object> instance = scriptInstance->newLocal(v8::Isolate::GetCurrent());
+ v8::Local<v8::Object> instance = scriptInstance->newLocal(info.GetIsolate());
if (instance.IsEmpty())
return;
diff --git a/Source/bindings/v8/custom/V8IDBAnyCustom.cpp b/Source/bindings/v8/custom/V8IDBAnyCustom.cpp
index da9a4e4..bd23c91 100644
--- a/Source/bindings/v8/custom/V8IDBAnyCustom.cpp
+++ b/Source/bindings/v8/custom/V8IDBAnyCustom.cpp
@@ -26,7 +26,6 @@
*/
#include "config.h"
-
#include "V8IDBAny.h"
#include "V8DOMStringList.h"
@@ -56,7 +55,7 @@
return toV8(keyPaths.release(), creationContext, isolate);
}
ASSERT_NOT_REACHED();
- return v8::Undefined();
+ return v8::Undefined(isolate);
}
v8::Handle<v8::Value> toV8(IDBAny* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
@@ -66,7 +65,7 @@
switch (impl->type()) {
case IDBAny::UndefinedType:
- return v8::Undefined();
+ return v8::Undefined(isolate);
case IDBAny::NullType:
return v8NullWithCheck(isolate);
case IDBAny::DOMStringListType:
@@ -96,7 +95,7 @@
}
ASSERT_NOT_REACHED();
- return v8::Undefined();
+ return v8::Undefined(isolate);
}
} // namespace WebCore
diff --git a/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index 202c586..51b25c9 100644
--- a/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -63,7 +63,7 @@
Node* InjectedScriptHost::scriptValueAsNode(ScriptValue value)
{
- v8::HandleScope scope(v8::Isolate::GetCurrent());
+ v8::HandleScope scope(value.isolate());
if (!value.isObject() || value.isNull())
return 0;
return V8Node::toNative(v8::Handle<v8::Object>::Cast(value.v8Value()));
@@ -71,13 +71,14 @@
ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* state, Node* node)
{
- v8::HandleScope scope(state->isolate());
+ v8::Isolate* isolate = state->isolate();
+ v8::HandleScope scope(isolate);
v8::Local<v8::Context> context = state->context();
v8::Context::Scope contextScope(context);
if (!BindingSecurity::shouldAllowAccessToNode(node))
- return ScriptValue(v8::Null());
- return ScriptValue(toV8(node, v8::Handle<v8::Object>(), state->isolate()));
+ return ScriptValue(v8::Null(isolate), isolate);
+ return ScriptValue(toV8(node, v8::Handle<v8::Object>(), isolate), isolate);
}
void V8InjectedScriptHost::inspectedObjectMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
@@ -295,8 +296,8 @@
return;
InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
- ScriptValue object(args[0]);
- ScriptValue hints(args[1]);
+ ScriptValue object(args[0], args.GetIsolate());
+ ScriptValue hints(args[1], args.GetIsolate());
host->inspectImpl(object.toJSONValue(ScriptState::current()), hints.toJSONValue(ScriptState::current()));
}
diff --git a/Source/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp b/Source/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
index 2f8d3e8..04b46fb 100644
--- a/Source/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
+++ b/Source/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
@@ -31,15 +31,14 @@
#include "config.h"
#include "V8InspectorFrontendHost.h"
+#include "V8MouseEvent.h"
+#include "bindings/v8/V8Binding.h"
#include "core/inspector/InspectorController.h"
#include "core/inspector/InspectorFrontendClient.h"
#include "core/inspector/InspectorFrontendHost.h"
#include "core/platform/HistogramSupport.h"
#include "wtf/text/WTFString.h"
-#include "V8MouseEvent.h"
-#include "bindings/v8/V8Binding.h"
-
namespace WebCore {
void V8InspectorFrontendHost::platformMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
@@ -75,7 +74,7 @@
v8::Local<v8::Value> subItems = item->Get(v8::String::NewSymbol("subItems"));
if (!type->IsString())
continue;
- String typeString = toWebCoreStringWithNullCheck(type);
+ String typeString = toWebCoreStringWithNullCheck(type.As<v8::String>());
if (typeString == "separator") {
ContextMenuItem item(ContextMenuItem(SeparatorType,
ContextMenuItemCustomTagNoAction,
diff --git a/Source/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp b/Source/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp
index 0daa85c..88ec352 100644
--- a/Source/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp
+++ b/Source/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp
@@ -31,7 +31,6 @@
#include "config.h"
#include "V8JavaScriptCallFrame.h"
-
#include "bindings/v8/V8Binding.h"
namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8MessageChannelCustom.cpp b/Source/bindings/v8/custom/V8MessageChannelCustom.cpp
index 9697cc9..9952073 100644
--- a/Source/bindings/v8/custom/V8MessageChannelCustom.cpp
+++ b/Source/bindings/v8/custom/V8MessageChannelCustom.cpp
@@ -37,7 +37,6 @@
#include "bindings/v8/V8Utilities.h"
#include "core/dom/MessageChannel.h"
#include "core/workers/WorkerGlobalScope.h"
-
#include "wtf/RefPtr.h"
namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8MessageEventCustom.cpp b/Source/bindings/v8/custom/V8MessageEventCustom.cpp
index a125ccc..24e91cc 100644
--- a/Source/bindings/v8/custom/V8MessageEventCustom.cpp
+++ b/Source/bindings/v8/custom/V8MessageEventCustom.cpp
@@ -31,15 +31,14 @@
#include "config.h"
#include "V8MessageEvent.h"
-#include "bindings/v8/SerializedScriptValue.h"
-#include "bindings/v8/V8HiddenPropertyName.h"
-#include "bindings/v8/custom/V8ArrayBufferCustom.h"
-#include "core/dom/MessageEvent.h"
-
#include "V8Blob.h"
#include "V8MessagePort.h"
#include "V8Window.h"
+#include "bindings/v8/SerializedScriptValue.h"
#include "bindings/v8/V8Binding.h"
+#include "bindings/v8/V8HiddenPropertyName.h"
+#include "bindings/v8/custom/V8ArrayBufferCustom.h"
+#include "core/dom/MessageEvent.h"
namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8MessagePortCustom.cpp b/Source/bindings/v8/custom/V8MessagePortCustom.cpp
index ef3a1f1..cedf23f 100644
--- a/Source/bindings/v8/custom/V8MessagePortCustom.cpp
+++ b/Source/bindings/v8/custom/V8MessagePortCustom.cpp
@@ -29,8 +29,8 @@
*/
#include "config.h"
-
#include "V8MessagePort.h"
+
#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/SerializedScriptValue.h"
#include "bindings/v8/V8Binding.h"
diff --git a/Source/bindings/v8/custom/V8MutationObserverCustom.cpp b/Source/bindings/v8/custom/V8MutationObserverCustom.cpp
index 6bb0cdc..596978a 100644
--- a/Source/bindings/v8/custom/V8MutationObserverCustom.cpp
+++ b/Source/bindings/v8/custom/V8MutationObserverCustom.cpp
@@ -29,7 +29,6 @@
*/
#include "config.h"
-
#include "V8MutationObserver.h"
#include "bindings/v8/V8Binding.h"
diff --git a/Source/bindings/v8/custom/V8NodeCustom.cpp b/Source/bindings/v8/custom/V8NodeCustom.cpp
index 2b844b5..23a5996 100644
--- a/Source/bindings/v8/custom/V8NodeCustom.cpp
+++ b/Source/bindings/v8/custom/V8NodeCustom.cpp
@@ -29,7 +29,7 @@
*/
#include "config.h"
-#include "core/dom/Node.h"
+#include "V8Node.h"
#include "V8Attr.h"
#include "V8CDATASection.h"
@@ -40,7 +40,6 @@
#include "V8Element.h"
#include "V8Entity.h"
#include "V8HTMLElement.h"
-#include "V8Node.h"
#include "V8Notation.h"
#include "V8ProcessingInstruction.h"
#include "V8SVGElement.h"
diff --git a/Source/bindings/v8/custom/V8NodeListCustom.cpp b/Source/bindings/v8/custom/V8NodeListCustom.cpp
index efb9208..479eadc 100644
--- a/Source/bindings/v8/custom/V8NodeListCustom.cpp
+++ b/Source/bindings/v8/custom/V8NodeListCustom.cpp
@@ -36,7 +36,6 @@
#include "bindings/v8/V8GCController.h"
#include "core/dom/LiveNodeList.h"
#include "core/dom/NodeList.h"
-
#include "wtf/RefPtr.h"
#include "wtf/StdLibExtras.h"
diff --git a/Source/bindings/v8/custom/V8OscillatorNodeCustom.cpp b/Source/bindings/v8/custom/V8OscillatorNodeCustom.cpp
index a265b3a..61e87d9 100644
--- a/Source/bindings/v8/custom/V8OscillatorNodeCustom.cpp
+++ b/Source/bindings/v8/custom/V8OscillatorNodeCustom.cpp
@@ -23,9 +23,7 @@
*/
#include "config.h"
-
#if ENABLE(WEB_AUDIO)
-
#include "V8OscillatorNode.h"
#include "bindings/v8/V8Binding.h"
diff --git a/Source/bindings/v8/custom/V8PannerNodeCustom.cpp b/Source/bindings/v8/custom/V8PannerNodeCustom.cpp
index 6488a27..9d34f4c 100644
--- a/Source/bindings/v8/custom/V8PannerNodeCustom.cpp
+++ b/Source/bindings/v8/custom/V8PannerNodeCustom.cpp
@@ -23,9 +23,7 @@
*/
#include "config.h"
-
#if ENABLE(WEB_AUDIO)
-
#include "V8PannerNode.h"
#include "bindings/v8/V8Binding.h"
diff --git a/Source/bindings/v8/custom/V8PerformanceEntryCustom.cpp b/Source/bindings/v8/custom/V8PerformanceEntryCustom.cpp
index 30dbc9c..a115da8 100644
--- a/Source/bindings/v8/custom/V8PerformanceEntryCustom.cpp
+++ b/Source/bindings/v8/custom/V8PerformanceEntryCustom.cpp
@@ -29,18 +29,15 @@
*/
#include "config.h"
-#include "core/page/PerformanceEntry.h"
+#include "V8PerformanceEntry.h"
+#include "V8PerformanceMark.h"
+#include "V8PerformanceMeasure.h"
+#include "V8PerformanceResourceTiming.h"
#include "core/page/Performance.h"
#include "core/page/PerformanceMark.h"
#include "core/page/PerformanceMeasure.h"
#include "core/page/PerformanceResourceTiming.h"
-
-#include "V8PerformanceEntry.h"
-#include "V8PerformanceMark.h"
-#include "V8PerformanceMeasure.h"
-#include "V8PerformanceResourceTiming.h"
-
#include "wtf/RefPtr.h"
namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8PromiseCustom.cpp b/Source/bindings/v8/custom/V8PromiseCustom.cpp
index 650f647..c9dbdb7 100644
--- a/Source/bindings/v8/custom/V8PromiseCustom.cpp
+++ b/Source/bindings/v8/custom/V8PromiseCustom.cpp
@@ -97,10 +97,10 @@
class PromiseTask : public ScriptExecutionContext::Task {
public:
- PromiseTask(v8::Handle<v8::Function> callback, v8::Handle<v8::Object> receiver, v8::Handle<v8::Value> result)
- : m_callback(callback)
- , m_receiver(receiver)
- , m_result(result)
+ PromiseTask(v8::Handle<v8::Function> callback, v8::Handle<v8::Object> receiver, v8::Handle<v8::Value> result, v8::Isolate* isolate)
+ : m_callback(isolate, callback)
+ , m_receiver(isolate, receiver)
+ , m_result(isolate, result)
{
ASSERT(!m_callback.isEmpty());
ASSERT(!m_receiver.isEmpty());
@@ -143,7 +143,7 @@
{
ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext();
ASSERT(scriptExecutionContext && scriptExecutionContext->isContextThread());
- scriptExecutionContext->postTask(adoptPtr(new PromiseTask(callback, receiver, value)));
+ scriptExecutionContext->postTask(adoptPtr(new PromiseTask(callback, receiver, value, isolate)));
return v8::Undefined(isolate);
}
@@ -247,7 +247,7 @@
V8PromiseCustom::resolveResolver(resolver, results, V8PromiseCustom::Synchronous, isolate);
return;
}
- countdownWrapper->SetInternalField(V8PromiseCustom::PrimitiveWrapperPrimitiveIndex, v8::Integer::New(countdown->Value() - 1));
+ countdownWrapper->SetInternalField(V8PromiseCustom::PrimitiveWrapperPrimitiveIndex, v8::Integer::New(countdown->Value() - 1, isolate));
}
void promiseSomeRejectCallback(const v8::FunctionCallbackInfo<v8::Value>& args)
@@ -272,7 +272,7 @@
V8PromiseCustom::rejectResolver(resolver, results, V8PromiseCustom::Synchronous, isolate);
return;
}
- countdownWrapper->SetInternalField(V8PromiseCustom::PrimitiveWrapperPrimitiveIndex, v8::Integer::New(countdown->Value() - 1));
+ countdownWrapper->SetInternalField(V8PromiseCustom::PrimitiveWrapperPrimitiveIndex, v8::Integer::New(countdown->Value() - 1, isolate));
}
v8::Local<v8::Object> promiseEveryEnvironment(v8::Handle<v8::Object> resolver, v8::Handle<v8::Object> countdownWrapper, int index, v8::Handle<v8::Array> results, v8::Isolate* isolate)
@@ -282,7 +282,7 @@
environment->SetInternalField(V8PromiseCustom::PromiseEveryEnvironmentPromiseResolverIndex, resolver);
environment->SetInternalField(V8PromiseCustom::PromiseEveryEnvironmentCountdownIndex, countdownWrapper);
- environment->SetInternalField(V8PromiseCustom::PromiseEveryEnvironmentIndexIndex, v8::Integer::New(index));
+ environment->SetInternalField(V8PromiseCustom::PromiseEveryEnvironmentIndexIndex, v8::Integer::New(index, isolate));
environment->SetInternalField(V8PromiseCustom::PromiseEveryEnvironmentResultsIndex, results);
return environment;
}
@@ -439,7 +439,7 @@
v8::Local<v8::ObjectTemplate> objectTemplate = primitiveWrapperObjectTemplate(isolate);
v8::Local<v8::Object> countdownWrapper = objectTemplate->NewInstance();
- countdownWrapper->SetInternalField(V8PromiseCustom::PrimitiveWrapperPrimitiveIndex, v8::Integer::New(args.Length()));
+ countdownWrapper->SetInternalField(V8PromiseCustom::PrimitiveWrapperPrimitiveIndex, v8::Integer::New(args.Length(), isolate));
v8::Local<v8::Array> results = v8::Array::New();
v8::Local<v8::Function> rejectCallback = createClosure(promiseRejectCallback, resolver);
@@ -469,7 +469,7 @@
// Promise.some also uses PromiseEveryEnvironment.
v8::Local<v8::ObjectTemplate> objectTemplate = primitiveWrapperObjectTemplate(isolate);
v8::Local<v8::Object> countdownWrapper = objectTemplate->NewInstance();
- countdownWrapper->SetInternalField(V8PromiseCustom::PrimitiveWrapperPrimitiveIndex, v8::Integer::New(args.Length()));
+ countdownWrapper->SetInternalField(V8PromiseCustom::PrimitiveWrapperPrimitiveIndex, v8::Integer::New(args.Length(), isolate));
v8::Local<v8::Array> results = v8::Array::New();
v8::Local<v8::Function> fulfillCallback = createClosure(promiseResolveCallback, resolver);
@@ -493,7 +493,7 @@
*promise = V8DOMWrapper::createWrapper(creationContext, &V8Promise::info, 0, isolate);
*resolver = V8DOMWrapper::createWrapper(creationContext, &V8PromiseResolver::info, 0, isolate);
- clearInternal(internal, V8PromiseCustom::Pending, v8::Undefined(isolate));
+ clearInternal(internal, V8PromiseCustom::Pending, v8::Undefined(isolate), isolate);
(*promise)->SetInternalField(v8DOMWrapperObjectIndex, internal);
(*resolver)->SetInternalField(v8DOMWrapperObjectIndex, internal);
@@ -506,7 +506,7 @@
v8::Local<v8::Object> internal = getInternal(resolver);
ASSERT(getState(internal) == Pending || getState(internal) == PendingWithResolvedFlagSet);
v8::Local<v8::Array> callbacks = internal->GetInternalField(V8PromiseCustom::InternalFulfillCallbackIndex).As<v8::Array>();
- clearInternal(internal, Fulfilled, result);
+ clearInternal(internal, Fulfilled, result, isolate);
detachInternal(resolver, isolate);
callCallbacks(callbacks, result, mode, isolate);
@@ -548,7 +548,7 @@
v8::Local<v8::Object> internal = getInternal(resolver);
ASSERT(getState(internal) == Pending || getState(internal) == PendingWithResolvedFlagSet);
v8::Local<v8::Array> callbacks = internal->GetInternalField(V8PromiseCustom::InternalRejectCallbackIndex).As<v8::Array>();
- clearInternal(internal, Rejected, result);
+ clearInternal(internal, Rejected, result, isolate);
detachInternal(resolver, isolate);
callCallbacks(callbacks, result, mode, isolate);
@@ -607,9 +607,9 @@
resolver->SetInternalField(v8DOMWrapperObjectIndex, v8::Undefined(isolate));
}
-void V8PromiseCustom::clearInternal(v8::Handle<v8::Object> internal, PromiseState state, v8::Handle<v8::Value> value)
+void V8PromiseCustom::clearInternal(v8::Handle<v8::Object> internal, PromiseState state, v8::Handle<v8::Value> value, v8::Isolate* isolate)
{
- setState(internal, state);
+ setState(internal, state, isolate);
internal->SetInternalField(V8PromiseCustom::InternalResultIndex, value);
internal->SetInternalField(V8PromiseCustom::InternalFulfillCallbackIndex, v8::Array::New());
internal->SetInternalField(V8PromiseCustom::InternalRejectCallbackIndex, v8::Array::New());
@@ -624,10 +624,10 @@
return static_cast<PromiseState>(number);
}
-void V8PromiseCustom::setState(v8::Handle<v8::Object> internal, PromiseState state)
+void V8PromiseCustom::setState(v8::Handle<v8::Object> internal, PromiseState state, v8::Isolate* isolate)
{
ASSERT(state == Pending || state == Fulfilled || state == Rejected || state == PendingWithResolvedFlagSet);
- internal->SetInternalField(V8PromiseCustom::InternalStateIndex, v8::Integer::New(state));
+ internal->SetInternalField(V8PromiseCustom::InternalStateIndex, v8::Integer::New(state, isolate));
}
void V8PromiseCustom::call(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, v8::Handle<v8::Value> result, SynchronousMode mode, v8::Isolate* isolate)
diff --git a/Source/bindings/v8/custom/V8PromiseCustom.h b/Source/bindings/v8/custom/V8PromiseCustom.h
index 930f3f6..8b0957c 100644
--- a/Source/bindings/v8/custom/V8PromiseCustom.h
+++ b/Source/bindings/v8/custom/V8PromiseCustom.h
@@ -100,12 +100,12 @@
// Clear the Promise / PromiseResolver internal object with the given state and result.
// This function clears callbacks in the object.
- static void clearInternal(v8::Handle<v8::Object> internal, PromiseState, v8::Handle<v8::Value> result);
+ static void clearInternal(v8::Handle<v8::Object> internal, PromiseState, v8::Handle<v8::Value> result, v8::Isolate*);
// |internal| must be an Promise / PromiseResolver internal object.
static PromiseState getState(v8::Handle<v8::Object> internal);
// |internal| must be an Promise / PromiseResolver internal object.
- static void setState(v8::Handle<v8::Object> internal, PromiseState);
+ static void setState(v8::Handle<v8::Object> internal, PromiseState, v8::Isolate*);
// Call |function| synchronously or asynchronously, depending on |mode|.
// If |function| throws an exception, this function catches it and does not rethrow.
diff --git a/Source/bindings/v8/custom/V8PromiseResolverCustom.cpp b/Source/bindings/v8/custom/V8PromiseResolverCustom.cpp
index 19c8da7..9eb858d 100644
--- a/Source/bindings/v8/custom/V8PromiseResolverCustom.cpp
+++ b/Source/bindings/v8/custom/V8PromiseResolverCustom.cpp
@@ -45,10 +45,10 @@
v8::Local<v8::Object> internal = V8PromiseCustom::getInternal(resolver);
if (V8PromiseCustom::getState(internal) != V8PromiseCustom::Pending)
return;
- V8PromiseCustom::setState(internal, V8PromiseCustom::PendingWithResolvedFlagSet);
-
v8::Isolate* isolate = args.GetIsolate();
- v8::Local<v8::Value> result = v8::Undefined();
+ V8PromiseCustom::setState(internal, V8PromiseCustom::PendingWithResolvedFlagSet, isolate);
+
+ v8::Local<v8::Value> result = v8::Undefined(isolate);
if (args.Length() > 0)
result = args[0];
V8PromiseCustom::fulfillResolver(resolver, result, V8PromiseCustom::Asynchronous, isolate);
@@ -62,10 +62,10 @@
v8::Local<v8::Object> internal = V8PromiseCustom::getInternal(resolver);
if (V8PromiseCustom::getState(internal) != V8PromiseCustom::Pending)
return;
- V8PromiseCustom::setState(internal, V8PromiseCustom::PendingWithResolvedFlagSet);
-
v8::Isolate* isolate = args.GetIsolate();
- v8::Local<v8::Value> result = v8::Undefined();
+ V8PromiseCustom::setState(internal, V8PromiseCustom::PendingWithResolvedFlagSet, isolate);
+
+ v8::Local<v8::Value> result = v8::Undefined(isolate);
if (args.Length() > 0)
result = args[0];
V8PromiseCustom::resolveResolver(resolver, result, V8PromiseCustom::Asynchronous, isolate);
@@ -79,10 +79,10 @@
v8::Local<v8::Object> internal = V8PromiseCustom::getInternal(resolver);
if (V8PromiseCustom::getState(internal) != V8PromiseCustom::Pending)
return;
- V8PromiseCustom::setState(internal, V8PromiseCustom::PendingWithResolvedFlagSet);
-
v8::Isolate* isolate = args.GetIsolate();
- v8::Local<v8::Value> result = v8::Undefined();
+ V8PromiseCustom::setState(internal, V8PromiseCustom::PendingWithResolvedFlagSet, isolate);
+
+ v8::Local<v8::Value> result = v8::Undefined(isolate);
if (args.Length() > 0)
result = args[0];
V8PromiseCustom::rejectResolver(resolver, result, V8PromiseCustom::Asynchronous, isolate);
diff --git a/Source/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp b/Source/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
index c56441e..72789b9 100644
--- a/Source/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
+++ b/Source/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
@@ -29,7 +29,6 @@
*/
#include "config.h"
-
#include "V8SQLResultSetRowList.h"
#include "bindings/v8/V8Binding.h"
diff --git a/Source/bindings/v8/custom/V8SQLTransactionCustom.cpp b/Source/bindings/v8/custom/V8SQLTransactionCustom.cpp
index 428226e..a12c38d 100644
--- a/Source/bindings/v8/custom/V8SQLTransactionCustom.cpp
+++ b/Source/bindings/v8/custom/V8SQLTransactionCustom.cpp
@@ -29,7 +29,6 @@
*/
#include "config.h"
-
#include "V8SQLTransaction.h"
#include "V8SQLStatementCallback.h"
diff --git a/Source/bindings/v8/custom/V8SVGDocumentCustom.cpp b/Source/bindings/v8/custom/V8SVGDocumentCustom.cpp
index 953e5e8..668d37b 100644
--- a/Source/bindings/v8/custom/V8SVGDocumentCustom.cpp
+++ b/Source/bindings/v8/custom/V8SVGDocumentCustom.cpp
@@ -29,7 +29,6 @@
*/
#include "config.h"
-
#include "V8SVGDocument.h"
#include "bindings/v8/ScriptController.h"
diff --git a/Source/bindings/v8/custom/V8SVGElementCustom.cpp b/Source/bindings/v8/custom/V8SVGElementCustom.cpp
index c1d12a1..c21247e 100644
--- a/Source/bindings/v8/custom/V8SVGElementCustom.cpp
+++ b/Source/bindings/v8/custom/V8SVGElementCustom.cpp
@@ -29,8 +29,8 @@
*/
#include "config.h"
-
#include "V8SVGElement.h"
+
#include "V8SVGElementWrapperFactory.h"
namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8SVGPathSegCustom.cpp b/Source/bindings/v8/custom/V8SVGPathSegCustom.cpp
index 6fe9fdf..77bf679 100644
--- a/Source/bindings/v8/custom/V8SVGPathSegCustom.cpp
+++ b/Source/bindings/v8/custom/V8SVGPathSegCustom.cpp
@@ -29,7 +29,6 @@
*/
#include "config.h"
-
#include "V8SVGPathSeg.h"
#include "V8SVGPathSegArcAbs.h"
diff --git a/Source/bindings/v8/custom/V8TrackEventCustom.cpp b/Source/bindings/v8/custom/V8TrackEventCustom.cpp
index c53afde..3d05906 100644
--- a/Source/bindings/v8/custom/V8TrackEventCustom.cpp
+++ b/Source/bindings/v8/custom/V8TrackEventCustom.cpp
@@ -29,7 +29,6 @@
*/
#include "config.h"
-
#include "V8TrackEvent.h"
#include "V8TextTrack.h"
diff --git a/Source/bindings/v8/custom/V8TypedArrayCustom.h b/Source/bindings/v8/custom/V8TypedArrayCustom.h
index e6889bc..1c92af4 100644
--- a/Source/bindings/v8/custom/V8TypedArrayCustom.h
+++ b/Source/bindings/v8/custom/V8TypedArrayCustom.h
@@ -35,9 +35,7 @@
#include "bindings/v8/V8DOMWrapper.h"
#include "bindings/v8/WrapperTypeInfo.h"
#include "bindings/v8/custom/V8ArrayBufferCustom.h"
-
#include "wtf/ArrayBuffer.h"
-
#include <v8.h>
namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
index 3baa1ea..b048ba1 100644
--- a/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
+++ b/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
@@ -74,8 +74,8 @@
#include "core/dom/ExceptionCode.h"
#include "core/html/canvas/WebGLRenderingContext.h"
#include "core/platform/NotImplemented.h"
-#include <limits>
#include "wtf/FastMalloc.h"
+#include <limits>
namespace WebCore {
@@ -167,7 +167,7 @@
return toV8(info.getWebGLVertexArrayObjectOES(), creationContext, isolate);
default:
notImplemented();
- return v8::Undefined();
+ return v8::Undefined(isolate);
}
}
diff --git a/Source/bindings/v8/custom/V8WebKitPointCustom.cpp b/Source/bindings/v8/custom/V8WebKitPointCustom.cpp
index 00d640f..782e9d9 100644
--- a/Source/bindings/v8/custom/V8WebKitPointCustom.cpp
+++ b/Source/bindings/v8/custom/V8WebKitPointCustom.cpp
@@ -34,7 +34,6 @@
#include "bindings/v8/V8Binding.h"
#include "bindings/v8/V8DOMWrapper.h"
#include "bindings/v8/WrapperTypeInfo.h"
-
#include "wtf/MathExtras.h"
namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8WindowCustom.cpp b/Source/bindings/v8/custom/V8WindowCustom.cpp
index 697bc83..92d70f1 100644
--- a/Source/bindings/v8/custom/V8WindowCustom.cpp
+++ b/Source/bindings/v8/custom/V8WindowCustom.cpp
@@ -93,7 +93,7 @@
String functionString;
if (!function->IsFunction()) {
if (function->IsString()) {
- functionString = toWebCoreString(function);
+ functionString = toWebCoreString(function.As<v8::String>());
} else {
v8::Handle<v8::Value> v8String = function->ToString();
@@ -213,8 +213,10 @@
if (!first)
return;
- if (Location* location = imp->location())
- location->setHref(active, first, toWebCoreString(value));
+ if (Location* location = imp->location()) {
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, href, value);
+ location->setHref(active, first, href);
+ }
}
void V8Window::openerAttributeSetterCustom(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
@@ -317,7 +319,7 @@
}
void dialogCreated(DOMWindow*);
- v8::Handle<v8::Value> returnValue() const;
+ v8::Handle<v8::Value> returnValue(v8::Isolate*) const;
private:
v8::Handle<v8::Value> m_dialogArguments;
@@ -335,14 +337,14 @@
m_dialogContext->Global()->Set(v8::String::NewSymbol("dialogArguments"), m_dialogArguments);
}
-inline v8::Handle<v8::Value> DialogHandler::returnValue() const
+inline v8::Handle<v8::Value> DialogHandler::returnValue(v8::Isolate* isolate) const
{
if (m_dialogContext.IsEmpty())
- return v8::Undefined();
+ return v8::Undefined(isolate);
v8::Context::Scope scope(m_dialogContext);
v8::Handle<v8::Value> returnValue = m_dialogContext->Global()->Get(v8::String::NewSymbol("returnValue"));
if (returnValue.IsEmpty())
- return v8::Undefined();
+ return v8::Undefined(isolate);
return returnValue;
}
@@ -367,7 +369,7 @@
impl->showModalDialog(urlString, dialogFeaturesString, activeDOMWindow(), firstDOMWindow(), setUpDialog, &handler);
- v8SetReturnValue(args, handler.returnValue());
+ v8SetReturnValue(args, handler.returnValue(args.GetIsolate()));
}
void V8Window::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
@@ -381,7 +383,7 @@
// FIXME: Handle exceptions properly.
String urlString = toWebCoreStringWithUndefinedOrNullCheck(args[0]);
- AtomicString frameName = (args[1]->IsUndefined() || args[1]->IsNull()) ? "_blank" : AtomicString(toWebCoreString(args[1]));
+ AtomicString frameName = (args[1]->IsUndefined() || args[1]->IsNull()) ? "_blank" : toWebCoreAtomicString(args[1]);
String windowFeaturesString = toWebCoreStringWithUndefinedOrNullCheck(args[2]);
RefPtr<DOMWindow> openedWindow = impl->open(urlString, frameName, windowFeaturesString, activeDOMWindow(), firstDOMWindow());
@@ -471,7 +473,7 @@
if (key->IsString()) {
DEFINE_STATIC_LOCAL(AtomicString, nameOfProtoProperty, ("__proto__", AtomicString::ConstructFromLiteral));
- String name = toWebCoreString(key);
+ String name = toWebCoreString(key.As<v8::String>());
Frame* childFrame = target->tree()->scopedChild(name);
// Notice that we can't call HasRealNamedProperty for ACCESS_HAS
// because that would generate infinite recursion.
@@ -480,7 +482,7 @@
// We need to explicitly compare against nameOfProtoProperty because
// V8's JSObject::LocalLookup finds __proto__ before
// interceptors and even when __proto__ isn't a "real named property".
- v8::Handle<v8::String> keyString = key->ToString();
+ v8::Handle<v8::String> keyString = key.As<v8::String>();
if (type == v8::ACCESS_GET
&& childFrame
&& !host->HasRealNamedProperty(keyString)
diff --git a/Source/bindings/v8/custom/V8WorkerCustom.cpp b/Source/bindings/v8/custom/V8WorkerCustom.cpp
index acbb730..01bcdd8 100644
--- a/Source/bindings/v8/custom/V8WorkerCustom.cpp
+++ b/Source/bindings/v8/custom/V8WorkerCustom.cpp
@@ -29,8 +29,8 @@
*/
#include "config.h"
-
#include "V8Worker.h"
+
#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/SerializedScriptValue.h"
#include "bindings/v8/V8Binding.h"
diff --git a/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp b/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp
index 79b0749..2c3dc2f 100644
--- a/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp
+++ b/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp
@@ -70,7 +70,7 @@
return;
}
}
- action = adoptPtr(new ScheduledAction(v8Context, toWebCoreString(function), workerGlobalScope->url(), args.GetIsolate()));
+ action = adoptPtr(new ScheduledAction(v8Context, toWebCoreString(function.As<v8::String>()), workerGlobalScope->url(), args.GetIsolate()));
} else if (function->IsFunction()) {
size_t paramCount = argumentCount >= 2 ? argumentCount - 2 : 0;
OwnArrayPtr<v8::Local<v8::Value> > params;
diff --git a/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
index eb0f4a1..df69492 100644
--- a/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
+++ b/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
@@ -47,7 +47,6 @@
#include "core/workers/WorkerGlobalScope.h"
#include "core/xml/XMLHttpRequest.h"
#include "wtf/ArrayBuffer.h"
-
#include <v8.h>
namespace WebCore {
@@ -172,8 +171,8 @@
XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());
- String method = toWebCoreString(args[0]);
- String urlstring = toWebCoreString(args[1]);
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, method, args[0]);
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, urlstring, args[1]);
ScriptExecutionContext* context = getScriptExecutionContext();
KURL url = context->completeURL(urlstring);
diff --git a/Source/bindings/v8/custom/V8XSLTProcessorCustom.cpp b/Source/bindings/v8/custom/V8XSLTProcessorCustom.cpp
index 46b40ff..d0ec55c 100644
--- a/Source/bindings/v8/custom/V8XSLTProcessorCustom.cpp
+++ b/Source/bindings/v8/custom/V8XSLTProcessorCustom.cpp
@@ -29,19 +29,16 @@
*/
#include "config.h"
-
#include "V8XSLTProcessor.h"
-#include "core/dom/Document.h"
-#include "core/dom/DocumentFragment.h"
-#include "core/dom/Node.h"
-
#include "V8Document.h"
#include "V8DocumentFragment.h"
#include "V8Node.h"
#include "bindings/v8/V8Binding.h"
+#include "core/dom/Document.h"
+#include "core/dom/DocumentFragment.h"
+#include "core/dom/Node.h"
#include "core/xml/XSLTProcessor.h"
-
#include "wtf/RefPtr.h"
namespace WebCore {
@@ -51,11 +48,11 @@
if (isUndefinedOrNull(args[1]) || isUndefinedOrNull(args[2]))
return;
- XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, namespaceURI, args[0]);
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, localName, args[1]);
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, value, args[2]);
- String namespaceURI = toWebCoreString(args[0]);
- String localName = toWebCoreString(args[1]);
- String value = toWebCoreString(args[2]);
+ XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
imp->setParameter(namespaceURI, localName, value);
}
@@ -64,10 +61,10 @@
if (isUndefinedOrNull(args[1]))
return;
- XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, namespaceURI, args[0]);
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, localName, args[1]);
- String namespaceURI = toWebCoreString(args[0]);
- String localName = toWebCoreString(args[1]);
+ XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
String result = imp->getParameter(namespaceURI, localName);
if (result.isNull())
return;
@@ -80,10 +77,10 @@
if (isUndefinedOrNull(args[1]))
return;
- XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, namespaceURI, args[0]);
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, localName, args[1]);
- String namespaceURI = toWebCoreString(args[0]);
- String localName = toWebCoreString(args[1]);
+ XSLTProcessor* imp = V8XSLTProcessor::toNative(args.Holder());
imp->removeParameter(namespaceURI, localName);
}