OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "PlatformString.h" | 34 #include "PlatformString.h" |
35 #include "ScriptState.h" | 35 #include "ScriptState.h" |
36 #include <runtime/Protect.h> | 36 #include <runtime/Protect.h> |
37 | 37 |
38 namespace WebCore { | 38 namespace WebCore { |
39 | 39 |
40 class String; | 40 class String; |
41 | 41 |
42 class ScriptValue { | 42 class ScriptValue { |
43 public: | 43 public: |
44 static ScriptValue quarantineValue(ScriptState* scriptState, const ScriptVal
ue& value); | |
45 | |
46 ScriptValue(JSC::JSValue value = JSC::JSValue()) : m_value(value) {} | 44 ScriptValue(JSC::JSValue value = JSC::JSValue()) : m_value(value) {} |
47 virtual ~ScriptValue() {} | 45 virtual ~ScriptValue() {} |
48 | 46 |
49 JSC::JSValue jsValue() const { return m_value.get(); } | 47 JSC::JSValue jsValue() const { return m_value.get(); } |
50 bool getString(ScriptState*, String& result) const; | 48 bool getString(ScriptState*, String& result) const; |
51 String toString(ScriptState* scriptState) const { return m_value.get().toStr
ing(scriptState); } | 49 String toString(ScriptState* scriptState) const { return m_value.get().toStr
ing(scriptState); } |
52 bool isEqual(ScriptState*, const ScriptValue&) const; | 50 bool isEqual(ScriptState*, const ScriptValue&) const; |
53 bool isNull() const; | 51 bool isNull() const; |
54 bool isUndefined() const; | 52 bool isUndefined() const; |
55 bool isObject() const; | 53 bool isObject() const; |
56 bool hasNoValue() const { return m_value == JSC::JSValue(); } | 54 bool hasNoValue() const { return m_value == JSC::JSValue(); } |
57 | 55 |
58 private: | 56 private: |
59 JSC::ProtectedJSValue m_value; | 57 JSC::ProtectedJSValue m_value; |
60 }; | 58 }; |
61 | 59 |
62 } // namespace WebCore | 60 } // namespace WebCore |
63 | 61 |
64 #endif // ScriptValue_h | 62 #endif // ScriptValue_h |
OLD | NEW |