OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 ASSERT(m_storageArea); | 46 ASSERT(m_storageArea); |
47 ScriptWrappable::init(this); | 47 ScriptWrappable::init(this); |
48 } | 48 } |
49 | 49 |
50 Storage::~Storage() | 50 Storage::~Storage() |
51 { | 51 { |
52 } | 52 } |
53 | 53 |
54 String Storage::anonymousIndexedGetter(unsigned index, ExceptionState& exception
State) | 54 String Storage::anonymousIndexedGetter(unsigned index, ExceptionState& exception
State) |
55 { | 55 { |
56 return anonymousNamedGetter(String::number(index), exceptionState); | 56 return anonymousNamedGetter(AtomicString::number(index), exceptionState); |
57 } | 57 } |
58 | 58 |
59 String Storage::anonymousNamedGetter(const AtomicString& name, ExceptionState& e
xceptionState) | 59 String Storage::anonymousNamedGetter(const AtomicString& name, ExceptionState& e
xceptionState) |
60 { | 60 { |
61 bool found = contains(name, exceptionState); | 61 bool found = contains(name, exceptionState); |
62 if (exceptionState.hadException() || !found) | 62 if (exceptionState.hadException() || !found) |
63 return String(); | 63 return String(); |
64 String result = getItem(name, exceptionState); | 64 String result = getItem(name, exceptionState); |
65 if (exceptionState.hadException()) | 65 if (exceptionState.hadException()) |
66 return String(); | 66 return String(); |
67 return result; | 67 return result; |
68 } | 68 } |
69 | 69 |
70 bool Storage::anonymousNamedSetter(const AtomicString& name, const AtomicString&
value, ExceptionState& exceptionState) | 70 bool Storage::anonymousNamedSetter(const AtomicString& name, const AtomicString&
value, ExceptionState& exceptionState) |
71 { | 71 { |
72 setItem(name, value, exceptionState); | 72 setItem(name, value, exceptionState); |
73 return true; | 73 return true; |
74 } | 74 } |
75 | 75 |
76 bool Storage::anonymousIndexedSetter(unsigned index, const AtomicString& value,
ExceptionState& exceptionState) | 76 bool Storage::anonymousIndexedSetter(unsigned index, const AtomicString& value,
ExceptionState& exceptionState) |
77 { | 77 { |
78 return anonymousNamedSetter(String::number(index), value, exceptionState); | 78 return anonymousNamedSetter(AtomicString::number(index), value, exceptionSta
te); |
79 } | 79 } |
80 | 80 |
81 bool Storage::anonymousNamedDeleter(const AtomicString& name, ExceptionState& ex
ceptionState) | 81 bool Storage::anonymousNamedDeleter(const AtomicString& name, ExceptionState& ex
ceptionState) |
82 { | 82 { |
83 bool found = contains(name, exceptionState); | 83 bool found = contains(name, exceptionState); |
84 if (!found || exceptionState.hadException()) | 84 if (!found || exceptionState.hadException()) |
85 return false; | 85 return false; |
86 removeItem(name, exceptionState); | 86 removeItem(name, exceptionState); |
87 if (exceptionState.hadException()) | 87 if (exceptionState.hadException()) |
88 return false; | 88 return false; |
89 return true; | 89 return true; |
90 } | 90 } |
91 | 91 |
92 bool Storage::anonymousIndexedDeleter(unsigned index, ExceptionState& exceptionS
tate) | 92 bool Storage::anonymousIndexedDeleter(unsigned index, ExceptionState& exceptionS
tate) |
93 { | 93 { |
94 return anonymousNamedDeleter(String::number(index), exceptionState); | 94 return anonymousNamedDeleter(AtomicString::number(index), exceptionState); |
95 } | 95 } |
96 | 96 |
97 void Storage::namedPropertyEnumerator(Vector<String>& names, ExceptionState& exc
eptionState) | 97 void Storage::namedPropertyEnumerator(Vector<String>& names, ExceptionState& exc
eptionState) |
98 { | 98 { |
99 unsigned length = this->length(exceptionState); | 99 unsigned length = this->length(exceptionState); |
100 if (exceptionState.hadException()) | 100 if (exceptionState.hadException()) |
101 return; | 101 return; |
102 names.resize(length); | 102 names.resize(length); |
103 for (unsigned i = 0; i < length; ++i) { | 103 for (unsigned i = 0; i < length; ++i) { |
104 String key = this->key(i, exceptionState); | 104 String key = this->key(i, exceptionState); |
(...skipping 11 matching lines...) Expand all Loading... |
116 { | 116 { |
117 if (name == "length") | 117 if (name == "length") |
118 return false; | 118 return false; |
119 bool found = contains(name, exceptionState); | 119 bool found = contains(name, exceptionState); |
120 if (exceptionState.hadException() || !found) | 120 if (exceptionState.hadException() || !found) |
121 return false; | 121 return false; |
122 return true; | 122 return true; |
123 } | 123 } |
124 | 124 |
125 } | 125 } |
OLD | NEW |