| Index: Source/bindings/v8/V8StringResource.h
|
| diff --git a/Source/bindings/v8/V8StringResource.h b/Source/bindings/v8/V8StringResource.h
|
| index e11002e5b0492b719f3bb4e560c5610ef63c0dce..c7fbdf8a317ad4937dc6856dcdefd114d5e4c5a7 100644
|
| --- a/Source/bindings/v8/V8StringResource.h
|
| +++ b/Source/bindings/v8/V8StringResource.h
|
| @@ -176,16 +176,16 @@ public:
|
| {
|
| }
|
|
|
| - bool prepare();
|
| - operator String() const { return toString<String>(); }
|
| - operator AtomicString() const { return toString<AtomicString>(); }
|
| -
|
| -private:
|
| - bool prepareBase()
|
| + bool prepare()
|
| {
|
| if (m_v8Object.IsEmpty())
|
| return true;
|
|
|
| + if (!isValid()) {
|
| + setString(String());
|
| + return true;
|
| + }
|
| +
|
| if (LIKELY(m_v8Object->IsString()))
|
| return true;
|
|
|
| @@ -204,6 +204,11 @@ private:
|
| }
|
| return true;
|
| }
|
| + operator String() const { return toString<String>(); }
|
| + operator AtomicString() const { return toString<AtomicString>(); }
|
| +
|
| +private:
|
| + bool isValid() const;
|
|
|
| void setString(const String& string)
|
| {
|
| @@ -225,27 +230,19 @@ private:
|
| String m_string;
|
| };
|
|
|
| -template<> inline bool V8StringResource<DefaultMode>::prepare()
|
| +template<> inline bool V8StringResource<DefaultMode>::isValid() const
|
| {
|
| - return prepareBase();
|
| + return true;
|
| }
|
|
|
| -template<> inline bool V8StringResource<WithNullCheck>::prepare()
|
| +template<> inline bool V8StringResource<WithNullCheck>::isValid() const
|
| {
|
| - if (m_v8Object.IsEmpty() || m_v8Object->IsNull()) {
|
| - setString(String());
|
| - return true;
|
| - }
|
| - return prepareBase();
|
| + return !m_v8Object->IsNull();
|
| }
|
|
|
| -template<> inline bool V8StringResource<WithUndefinedOrNullCheck>::prepare()
|
| +template<> inline bool V8StringResource<WithUndefinedOrNullCheck>::isValid() const
|
| {
|
| - if (m_v8Object.IsEmpty() || m_v8Object->IsNull() || m_v8Object->IsUndefined()) {
|
| - setString(String());
|
| - return true;
|
| - }
|
| - return prepareBase();
|
| + return !m_v8Object->IsNull() && !m_v8Object->IsUndefined();
|
| }
|
|
|
| } // namespace WebCore
|
|
|