summaryrefslogtreecommitdiff
path: root/Source/WebCore/bridge/c/c_class.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/bridge/c/c_class.cpp')
-rw-r--r--Source/WebCore/bridge/c/c_class.cpp28
1 files changed, 17 insertions, 11 deletions
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