summaryrefslogtreecommitdiff
path: root/Source/WebCore/bridge/c
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/bridge/c')
-rw-r--r--Source/WebCore/bridge/c/CRuntimeObject.cpp10
-rw-r--r--Source/WebCore/bridge/c/CRuntimeObject.h8
-rw-r--r--Source/WebCore/bridge/c/c_class.cpp28
-rw-r--r--Source/WebCore/bridge/c/c_class.h14
-rw-r--r--Source/WebCore/bridge/c/c_instance.cpp47
-rw-r--r--Source/WebCore/bridge/c/c_instance.h35
-rw-r--r--Source/WebCore/bridge/c/c_runtime.cpp13
-rw-r--r--Source/WebCore/bridge/c/c_runtime.h12
-rw-r--r--Source/WebCore/bridge/c/c_utility.cpp18
-rw-r--r--Source/WebCore/bridge/c/c_utility.h8
10 files changed, 109 insertions, 84 deletions
diff --git a/Source/WebCore/bridge/c/CRuntimeObject.cpp b/Source/WebCore/bridge/c/CRuntimeObject.cpp
index a015687b3..2a93a514d 100644
--- a/Source/WebCore/bridge/c/CRuntimeObject.cpp
+++ b/Source/WebCore/bridge/c/CRuntimeObject.cpp
@@ -13,7 +13,7 @@
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -35,17 +35,17 @@
namespace JSC {
namespace Bindings {
-const ClassInfo CRuntimeObject::s_info = { "CRuntimeObject", &RuntimeObject::s_info, 0, 0, CREATE_METHOD_TABLE(CRuntimeObject) };
+const ClassInfo CRuntimeObject::s_info = { "CRuntimeObject", &RuntimeObject::s_info, 0, CREATE_METHOD_TABLE(CRuntimeObject) };
-CRuntimeObject::CRuntimeObject(VM& vm, Structure* structure, PassRefPtr<CInstance> instance)
- : RuntimeObject(vm, structure, instance)
+CRuntimeObject::CRuntimeObject(VM& vm, Structure* structure, RefPtr<CInstance>&& instance)
+ : RuntimeObject(vm, structure, WTFMove(instance))
{
}
void CRuntimeObject::finishCreation(VM& vm)
{
Base::finishCreation(vm);
- ASSERT(inherits(info()));
+ ASSERT(inherits(vm, info()));
}
CInstance* CRuntimeObject::getInternalCInstance() const
diff --git a/Source/WebCore/bridge/c/CRuntimeObject.h b/Source/WebCore/bridge/c/CRuntimeObject.h
index f0781f92d..a0b4a24ed 100644
--- a/Source/WebCore/bridge/c/CRuntimeObject.h
+++ b/Source/WebCore/bridge/c/CRuntimeObject.h
@@ -13,7 +13,7 @@
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -44,9 +44,9 @@ class CRuntimeObject : public RuntimeObject {
public:
typedef RuntimeObject Base;
- static CRuntimeObject* create(VM& vm, Structure* structure, PassRefPtr<CInstance> instance)
+ static CRuntimeObject* create(VM& vm, Structure* structure, RefPtr<CInstance>&& instance)
{
- CRuntimeObject* object = new (NotNull, allocateCell<CRuntimeObject>(vm.heap)) CRuntimeObject(vm, structure, instance);
+ CRuntimeObject* object = new (NotNull, allocateCell<CRuntimeObject>(vm.heap)) CRuntimeObject(vm, structure, WTFMove(instance));
object->finishCreation(vm);
return object;
}
@@ -61,7 +61,7 @@ public:
}
private:
- CRuntimeObject(VM&, Structure*, PassRefPtr<CInstance>);
+ CRuntimeObject(VM&, Structure*, RefPtr<CInstance>&&);
void finishCreation(VM&);
};
diff --git a/Source/WebCore/bridge/c/c_class.cpp b/Source/WebCore/bridge/c/c_class.cpp
index e96452086..dfc0d7ac0 100644
--- a/Source/WebCore/bridge/c/c_class.cpp
+++ b/Source/WebCore/bridge/c/c_class.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2003, 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -70,6 +70,8 @@ CClass* CClass::classForIsA(NPClass* isa)
Method* CClass::methodNamed(PropertyName propertyName, Instance* instance) const
{
String name(propertyName.publicName());
+ if (name.isNull())
+ return nullptr;
if (Method* method = m_methods.get(name.impl()))
return method;
@@ -78,17 +80,20 @@ Method* CClass::methodNamed(PropertyName propertyName, Instance* instance) const
const CInstance* inst = static_cast<const CInstance*>(instance);
NPObject* obj = inst->getObject();
if (m_isa->hasMethod && m_isa->hasMethod(obj, ident)) {
- Method* method = new CMethod(ident);
- m_methods.set(name.impl(), adoptPtr(method));
- return method;
+ auto method = std::make_unique<CMethod>(ident);
+ CMethod* ret = method.get();
+ m_methods.set(name.impl(), WTFMove(method));
+ return ret;
}
- return 0;
+ return nullptr;
}
Field* CClass::fieldNamed(PropertyName propertyName, Instance* instance) const
{
String name(propertyName.publicName());
+ if (name.isNull())
+ return nullptr;
if (Field* field = m_fields.get(name.impl()))
return field;
@@ -97,12 +102,13 @@ Field* CClass::fieldNamed(PropertyName propertyName, Instance* instance) const
const CInstance* inst = static_cast<const CInstance*>(instance);
NPObject* obj = inst->getObject();
if (m_isa->hasProperty && m_isa->hasProperty(obj, ident)) {
- Field* field = new CField(ident);
- m_fields.set(name.impl(), adoptPtr(field));
- return field;
+ auto field = std::make_unique<CField>(ident);
+ CField* ret = field.get();
+ m_fields.set(name.impl(), WTFMove(field));
+ return ret;
}
- return 0;
+ return nullptr;
}
} } // namespace JSC::Bindings
diff --git a/Source/WebCore/bridge/c/c_class.h b/Source/WebCore/bridge/c/c_class.h
index 3274f7846..d4b6b0ee6 100644
--- a/Source/WebCore/bridge/c/c_class.h
+++ b/Source/WebCore/bridge/c/c_class.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2003 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -43,13 +43,13 @@ public:
static CClass* classForIsA(NPClass*);
virtual ~CClass();
- virtual Method* methodNamed(PropertyName, Instance*) const override;
- virtual Field* fieldNamed(PropertyName, Instance*) const override;
+ Method* methodNamed(PropertyName, Instance*) const override;
+ Field* fieldNamed(PropertyName, Instance*) const override;
private:
NPClass* m_isa;
- mutable HashMap<RefPtr<StringImpl>, OwnPtr<Method>> m_methods;
- mutable HashMap<RefPtr<StringImpl>, OwnPtr<Field>> m_fields;
+ mutable HashMap<RefPtr<StringImpl>, std::unique_ptr<Method>> m_methods;
+ mutable HashMap<RefPtr<StringImpl>, std::unique_ptr<Field>> m_fields;
};
} // namespace Bindings
diff --git a/Source/WebCore/bridge/c/c_instance.cpp b/Source/WebCore/bridge/c/c_instance.cpp
index 441c20ed7..e69d7a06e 100644
--- a/Source/WebCore/bridge/c/c_instance.cpp
+++ b/Source/WebCore/bridge/c/c_instance.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2003, 2006, 2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -45,6 +45,7 @@
#include <runtime/JSLock.h>
#include <runtime/PropertyNameArray.h>
#include <wtf/Assertions.h>
+#include <wtf/NeverDestroyed.h>
#include <wtf/StdLibExtras.h>
#include <wtf/StringExtras.h>
#include <wtf/Vector.h>
@@ -56,7 +57,7 @@ namespace Bindings {
static String& globalExceptionString()
{
- DEFINE_STATIC_LOCAL(String, exceptionStr, ());
+ static NeverDestroyed<String> exceptionStr;
return exceptionStr;
}
@@ -71,15 +72,17 @@ void CInstance::moveGlobalExceptionToExecState(ExecState* exec)
return;
{
- JSLockHolder lock(exec);
- exec->vm().throwException(exec, createError(exec, globalExceptionString()));
+ VM& vm = exec->vm();
+ JSLockHolder lock(vm);
+ auto scope = DECLARE_THROW_SCOPE(vm);
+ throwException(exec, scope, createError(exec, globalExceptionString()));
}
globalExceptionString() = String();
}
-CInstance::CInstance(NPObject* o, PassRefPtr<RootObject> rootObject)
- : Instance(rootObject)
+CInstance::CInstance(NPObject* o, RefPtr<RootObject>&& rootObject)
+ : Instance(WTFMove(rootObject))
{
_object = _NPN_RetainObject(o);
_class = 0;
@@ -138,12 +141,12 @@ private:
void finishCreation(VM& vm, const String& name)
{
Base::finishCreation(vm, name);
- ASSERT(inherits(info()));
+ ASSERT(inherits(vm, info()));
}
};
-const ClassInfo CRuntimeMethod::s_info = { "CRuntimeMethod", &RuntimeMethod::s_info, 0, 0, CREATE_METHOD_TABLE(CRuntimeMethod) };
+const ClassInfo CRuntimeMethod::s_info = { "CRuntimeMethod", &RuntimeMethod::s_info, 0, CREATE_METHOD_TABLE(CRuntimeMethod) };
JSValue CInstance::getMethod(ExecState* exec, PropertyName propertyName)
{
@@ -153,8 +156,11 @@ JSValue CInstance::getMethod(ExecState* exec, PropertyName propertyName)
JSValue CInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod)
{
- if (!asObject(runtimeMethod)->inherits(CRuntimeMethod::info()))
- return exec->vm().throwException(exec, createTypeError(exec, "Attempt to invoke non-plug-in method on plug-in object."));
+ VM& vm = exec->vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+
+ if (!asObject(runtimeMethod)->inherits(vm, CRuntimeMethod::info()))
+ return throwTypeError(exec, scope, ASCIILiteral("Attempt to invoke non-plug-in method on plug-in object."));
CMethod* method = static_cast<CMethod*>(runtimeMethod->method());
ASSERT(method);
@@ -183,7 +189,7 @@ JSValue CInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod)
}
if (!retval)
- exec->vm().throwException(exec, createError(exec, ASCIILiteral("Error calling method on NPObject.")));
+ throwException(exec, scope, createError(exec, ASCIILiteral("Error calling method on NPObject.")));
for (i = 0; i < count; i++)
_NPN_ReleaseVariantValue(&cArgs[i]);
@@ -196,6 +202,9 @@ JSValue CInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod)
JSValue CInstance::invokeDefaultMethod(ExecState* exec)
{
+ VM& vm = exec->vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+
if (!_object->_class->invokeDefault)
return jsUndefined();
@@ -218,7 +227,7 @@ JSValue CInstance::invokeDefaultMethod(ExecState* exec)
}
if (!retval)
- exec->vm().throwException(exec, createError(exec, ASCIILiteral("Error calling method on NPObject.")));
+ throwException(exec, scope, createError(exec, ASCIILiteral("Error calling method on NPObject.")));
for (i = 0; i < count; i++)
_NPN_ReleaseVariantValue(&cArgs[i]);
@@ -235,6 +244,9 @@ bool CInstance::supportsConstruct() const
JSValue CInstance::invokeConstruct(ExecState* exec, const ArgList& args)
{
+ VM& vm = exec->vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+
if (!_object->_class->construct)
return jsUndefined();
@@ -257,7 +269,7 @@ JSValue CInstance::invokeConstruct(ExecState* exec, const ArgList& args)
}
if (!retval)
- exec->vm().throwException(exec, createError(exec, ASCIILiteral("Error calling method on NPObject.")));
+ throwException(exec, scope, createError(exec, ASCIILiteral("Error calling method on NPObject.")));
for (i = 0; i < count; i++)
_NPN_ReleaseVariantValue(&cArgs[i]);
@@ -310,6 +322,9 @@ JSValue CInstance::valueOf(ExecState* exec) const
bool CInstance::toJSPrimitive(ExecState* exec, const char* name, JSValue& resultValue) const
{
+ VM& vm = exec->vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+
NPIdentifier ident = _NPN_GetStringIdentifier(name);
if (!_object->_class->hasMethod(_object, ident))
return false;
@@ -327,7 +342,7 @@ bool CInstance::toJSPrimitive(ExecState* exec, const char* name, JSValue& result
}
if (!retval)
- exec->vm().throwException(exec, createError(exec, ASCIILiteral("Error calling method on NPObject.")));
+ throwException(exec, scope, createError(exec, ASCIILiteral("Error calling method on NPObject.")));
resultValue = convertNPVariantToValue(exec, &resultVariant, m_rootObject.get());
_NPN_ReleaseVariantValue(&resultVariant);
diff --git a/Source/WebCore/bridge/c/c_instance.h b/Source/WebCore/bridge/c/c_instance.h
index db6335319..ee866280e 100644
--- a/Source/WebCore/bridge/c/c_instance.h
+++ b/Source/WebCore/bridge/c/c_instance.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2003 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -30,7 +30,6 @@
#include "BridgeJSC.h"
#include "runtime_root.h"
-#include <wtf/PassRefPtr.h>
#include <wtf/text/WTFString.h>
typedef struct NPObject NPObject;
@@ -43,9 +42,9 @@ class CClass;
class CInstance : public Instance {
public:
- static PassRefPtr<CInstance> create(NPObject* object, PassRefPtr<RootObject> rootObject)
+ static Ref<CInstance> create(NPObject* object, RefPtr<RootObject>&& rootObject)
{
- return adoptRef(new CInstance(object, rootObject));
+ return adoptRef(*new CInstance(object, WTFMove(rootObject)));
}
static void setGlobalException(String);
@@ -53,20 +52,20 @@ public:
virtual ~CInstance();
- virtual Class *getClass() const override;
+ Class *getClass() const override;
- virtual JSValue valueOf(ExecState*) const override;
- virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const override;
+ JSValue valueOf(ExecState*) const override;
+ JSValue defaultValue(ExecState*, PreferredPrimitiveType) const override;
- virtual JSValue getMethod(ExecState*, PropertyName) override;
- virtual JSValue invokeMethod(ExecState*, RuntimeMethod*) override;
- virtual bool supportsInvokeDefaultMethod() const override;
- virtual JSValue invokeDefaultMethod(ExecState*) override;
+ JSValue getMethod(ExecState*, PropertyName) override;
+ JSValue invokeMethod(ExecState*, RuntimeMethod*) override;
+ bool supportsInvokeDefaultMethod() const override;
+ JSValue invokeDefaultMethod(ExecState*) override;
- virtual bool supportsConstruct() const override;
- virtual JSValue invokeConstruct(ExecState*, const ArgList&) override;
+ bool supportsConstruct() const override;
+ JSValue invokeConstruct(ExecState*, const ArgList&) override;
- virtual void getPropertyNames(ExecState*, PropertyNameArray&) override;
+ void getPropertyNames(ExecState*, PropertyNameArray&) override;
JSValue stringValue(ExecState*) const;
JSValue numberValue(ExecState*) const;
@@ -75,9 +74,9 @@ public:
NPObject *getObject() const { return _object; }
private:
- CInstance(NPObject*, PassRefPtr<RootObject>);
+ CInstance(NPObject*, RefPtr<RootObject>&&);
- virtual RuntimeObject* newRuntimeObject(ExecState*) override;
+ RuntimeObject* newRuntimeObject(ExecState*) override;
bool toJSPrimitive(ExecState*, const char*, JSValue&) const;
diff --git a/Source/WebCore/bridge/c/c_runtime.cpp b/Source/WebCore/bridge/c/c_runtime.cpp
index 7aa879864..3efa71421 100644
--- a/Source/WebCore/bridge/c/c_runtime.cpp
+++ b/Source/WebCore/bridge/c/c_runtime.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2004 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -61,7 +61,7 @@ JSValue CField::valueFromInstance(ExecState* exec, const Instance* inst) const
return jsUndefined();
}
-void CField::setValueToInstance(ExecState *exec, const Instance *inst, JSValue aValue) const
+bool CField::setValueToInstance(ExecState *exec, const Instance *inst, JSValue aValue) const
{
const CInstance* instance = static_cast<const CInstance*>(inst);
NPObject* obj = instance->getObject();
@@ -69,14 +69,17 @@ void CField::setValueToInstance(ExecState *exec, const Instance *inst, JSValue a
NPVariant variant;
convertValueToNPVariant(exec, aValue, &variant);
+ bool result = false;
{
JSLock::DropAllLocks dropAllLocks(exec);
- obj->_class->setProperty(obj, _fieldIdentifier, &variant);
+ result = obj->_class->setProperty(obj, _fieldIdentifier, &variant);
CInstance::moveGlobalExceptionToExecState(exec);
}
_NPN_ReleaseVariantValue(&variant);
+ return result;
}
+ return false;
}
} }
diff --git a/Source/WebCore/bridge/c/c_runtime.h b/Source/WebCore/bridge/c/c_runtime.h
index c7f7b9ba1..219fefee4 100644
--- a/Source/WebCore/bridge/c/c_runtime.h
+++ b/Source/WebCore/bridge/c/c_runtime.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2004, 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -38,8 +38,8 @@ class CField : public Field {
public:
CField(NPIdentifier ident) : _fieldIdentifier(ident) { }
- virtual JSValue valueFromInstance(ExecState*, const Instance*) const override;
- virtual void setValueToInstance(ExecState*, const Instance*, JSValue) const override;
+ JSValue valueFromInstance(ExecState*, const Instance*) const override;
+ bool setValueToInstance(ExecState*, const Instance*, JSValue) const override;
NPIdentifier identifier() const { return _fieldIdentifier; }
@@ -54,7 +54,7 @@ public:
CMethod(NPIdentifier ident) : _methodIdentifier(ident) { }
NPIdentifier identifier() const { return _methodIdentifier; }
- virtual int numParameters() const override { return 0; }
+ int numParameters() const override { return 0; }
private:
NPIdentifier _methodIdentifier;
diff --git a/Source/WebCore/bridge/c/c_utility.cpp b/Source/WebCore/bridge/c/c_utility.cpp
index 8c5f473ba..66d1e15a1 100644
--- a/Source/WebCore/bridge/c/c_utility.cpp
+++ b/Source/WebCore/bridge/c/c_utility.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2006, 2013 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2004, 2006, 2013 Apple Inc. All rights reserved.
* Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
*
* Redistribution and use in source and binary forms, with or without
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -31,6 +31,7 @@
#include "c_utility.h"
#include "CRuntimeObject.h"
+#include "DOMWindow.h"
#include "JSDOMBinding.h"
#include "JSDOMWindow.h"
#include "NP_jsobject.h"
@@ -69,11 +70,12 @@ static String convertUTF8ToUTF16WithLatin1Fallback(const NPUTF8* UTF8Chars, int
void convertValueToNPVariant(ExecState* exec, JSValue value, NPVariant* result)
{
JSLockHolder lock(exec);
-
+ VM& vm = exec->vm();
+
VOID_TO_NPVARIANT(*result);
if (value.isString()) {
- String ustring = value.toString(exec)->value(exec);
+ String ustring = value.toWTFString(exec);
CString cstring = ustring.utf8();
NPString string = { (const NPUTF8*)cstring.data(), static_cast<uint32_t>(cstring.length()) };
NPN_InitializeVariantWithStringCopy(result, &string);
@@ -85,7 +87,7 @@ void convertValueToNPVariant(ExecState* exec, JSValue value, NPVariant* result)
NULL_TO_NPVARIANT(*result);
} else if (value.isObject()) {
JSObject* object = asObject(value);
- if (object->classInfo() == CRuntimeObject::info()) {
+ if (object->classInfo(vm) == CRuntimeObject::info()) {
CRuntimeObject* runtimeObject = static_cast<CRuntimeObject*>(object);
CInstance* instance = runtimeObject->getInternalCInstance();
if (instance) {
@@ -122,7 +124,7 @@ JSValue convertNPVariantToValue(ExecState* exec, const NPVariant* variant, RootO
if (type == NPVariantType_Double)
return jsNumber(NPVARIANT_TO_DOUBLE(*variant));
if (type == NPVariantType_String)
- return WebCore::jsStringWithCache(exec, convertNPStringToUTF16(&variant->value.stringValue));
+ return jsStringWithCache(exec, convertNPStringToUTF16(&variant->value.stringValue));
if (type == NPVariantType_Object) {
NPObject* obj = variant->value.objectValue;
@@ -144,7 +146,7 @@ String convertNPStringToUTF16(const NPString* string)
Identifier identifierFromNPIdentifier(ExecState* exec, const NPUTF8* name)
{
- return Identifier(exec, convertUTF8ToUTF16WithLatin1Fallback(name, -1));
+ return Identifier::fromString(exec, convertUTF8ToUTF16WithLatin1Fallback(name, -1));
}
} }
diff --git a/Source/WebCore/bridge/c/c_utility.h b/Source/WebCore/bridge/c/c_utility.h
index 7901d735b..fbb71d6c7 100644
--- a/Source/WebCore/bridge/c/c_utility.h
+++ b/Source/WebCore/bridge/c/c_utility.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2004 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -29,8 +29,8 @@
#if ENABLE(NETSCAPE_PLUGIN_API)
#include "npruntime_internal.h"
+#include <runtime/JSCInlines.h>
#include <runtime/JSCJSValue.h>
-#include <runtime/Operations.h>
#include <wtf/Forward.h>
namespace JSC {