|
1 2010-07-14 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> |
|
2 |
|
3 Reviewed by Kenneth Rohde Christiansen. |
|
4 |
|
5 Introduce QScriptOriginalGlobalObject. |
|
6 |
|
7 QtScript exposes more functionality than JSC C API. Sometimes it is |
|
8 necessary to take a shortcut in implementation. Really often we have |
|
9 to use a standard JS function. These function could be changed or |
|
10 even deleted by a script, so a backup of a reference to an object is needed. |
|
11 |
|
12 In them same time this is rather a workaround then real fix, so the code |
|
13 should be separated and changed easily in future. It is why we need |
|
14 the new internal class. |
|
15 |
|
16 The patch fixes a few crashes. |
|
17 |
|
18 [Qt] QScriptEngine should work correctly even after global object changes |
|
19 https://bugs.webkit.org/show_bug.cgi?id=41839 |
|
20 |
|
21 * api/QtScript.pro: |
|
22 * api/qscriptengine_p.cpp: |
|
23 (QScriptEnginePrivate::QScriptEnginePrivate): |
|
24 (QScriptEnginePrivate::~QScriptEnginePrivate): |
|
25 * api/qscriptengine_p.h: |
|
26 (QScriptEnginePrivate::isArray): |
|
27 (QScriptEnginePrivate::isError): |
|
28 (QScriptEnginePrivate::objectHasOwnProperty): |
|
29 (QScriptEnginePrivate::objectGetOwnPropertyNames): |
|
30 * api/qscriptoriginalglobalobject_p.h: Added. |
|
31 (QScriptOriginalGlobalObject::QScriptOriginalGlobalObject): |
|
32 (QScriptOriginalGlobalObject::initializeMember): |
|
33 (QScriptOriginalGlobalObject::~QScriptOriginalGlobalObject): |
|
34 (QScriptOriginalGlobalObject::objectHasOwnProperty): |
|
35 (QScriptOriginalGlobalObject::objectGetOwnPropertyNames): |
|
36 (QScriptOriginalGlobalObject::isArray): |
|
37 (QScriptOriginalGlobalObject::isError): |
|
38 (QScriptOriginalGlobalObject::isType): |
|
39 * api/qscriptvalue_p.h: |
|
40 (QScriptValuePrivate::isError): |
|
41 (QScriptValuePrivate::hasOwnProperty): |
|
42 * api/qscriptvalueiterator_p.h: |
|
43 (QScriptValueIteratorPrivate::QScriptValueIteratorPrivate): |
|
44 * tests/qscriptvalue/tst_qscriptvalue.cpp: |
|
45 (tst_QScriptValue::globalObjectChanges): |
|
46 * tests/qscriptvalue/tst_qscriptvalue.h: |
|
47 |
|
48 2010-07-13 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> |
|
49 |
|
50 Reviewed by Simon Hausmann. |
|
51 |
|
52 Introduce QScriptValueIterator. |
|
53 |
|
54 The QScriptValueIterator class permits to iterate over a QScriptValue's properties. |
|
55 |
|
56 [Qt] QtScript should provide an API for enumerating a JS object's properties |
|
57 https://bugs.webkit.org/show_bug.cgi?id=41680 |
|
58 |
|
59 * api/QtScript.pro: |
|
60 * api/qscriptvalueiterator.cpp: Added. |
|
61 (QScriptValueIterator::QScriptValueIterator): |
|
62 (QScriptValueIterator::~QScriptValueIterator): |
|
63 (QScriptValueIterator::hasNext): |
|
64 (QScriptValueIterator::next): |
|
65 (QScriptValueIterator::hasPrevious): |
|
66 (QScriptValueIterator::previous): |
|
67 (QScriptValueIterator::toFront): |
|
68 (QScriptValueIterator::toBack): |
|
69 (QScriptValueIterator::name): |
|
70 (QScriptValueIterator::scriptName): |
|
71 (QScriptValueIterator::value): |
|
72 (QScriptValueIterator::setValue): |
|
73 (QScriptValueIterator::remove): |
|
74 (QScriptValueIterator::flags): |
|
75 (QScriptValueIterator::operator=): |
|
76 * api/qscriptvalueiterator.h: Added. |
|
77 * api/qscriptvalueiterator_p.h: Added. |
|
78 (QScriptValueIteratorPrivate::QScriptValueIteratorPrivate): |
|
79 (QScriptValueIteratorPrivate::~QScriptValueIteratorPrivate): |
|
80 (QScriptValueIteratorPrivate::hasNext): |
|
81 (QScriptValueIteratorPrivate::next): |
|
82 (QScriptValueIteratorPrivate::hasPrevious): |
|
83 (QScriptValueIteratorPrivate::previous): |
|
84 (QScriptValueIteratorPrivate::name): |
|
85 (QScriptValueIteratorPrivate::scriptName): |
|
86 (QScriptValueIteratorPrivate::value): |
|
87 (QScriptValueIteratorPrivate::setValue): |
|
88 (QScriptValueIteratorPrivate::remove): |
|
89 (QScriptValueIteratorPrivate::toFront): |
|
90 (QScriptValueIteratorPrivate::toBack): |
|
91 (QScriptValueIteratorPrivate::flags): |
|
92 (QScriptValueIteratorPrivate::isValid): |
|
93 (QScriptValueIteratorPrivate::engine): |
|
94 * tests/qscriptvalueiterator/qscriptvalueiterator.pro: Added. |
|
95 * tests/qscriptvalueiterator/tst_qscriptvalueiterator.cpp: Added. |
|
96 (tst_QScriptValueIterator::tst_QScriptValueIterator): |
|
97 (tst_QScriptValueIterator::~tst_QScriptValueIterator): |
|
98 (tst_QScriptValueIterator::iterateForward_data): |
|
99 (tst_QScriptValueIterator::iterateForward): |
|
100 (tst_QScriptValueIterator::iterateBackward_data): |
|
101 (tst_QScriptValueIterator::iterateBackward): |
|
102 (tst_QScriptValueIterator::iterateArray_data): |
|
103 (tst_QScriptValueIterator::iterateArray): |
|
104 (tst_QScriptValueIterator::iterateBackAndForth): |
|
105 (tst_QScriptValueIterator::setValue): |
|
106 (tst_QScriptValueIterator::remove): |
|
107 (tst_QScriptValueIterator::removeMixed): |
|
108 (tst_QScriptValueIterator::removeUndeletable): |
|
109 (tst_QScriptValueIterator::iterateString): |
|
110 (tst_QScriptValueIterator::assignObjectToIterator): |
|
111 * tests/tests.pro: |
|
112 |
|
113 2010-07-09 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> |
|
114 |
|
115 Reviewed by Simon Hausmann. |
|
116 |
|
117 Implementation of the QScriptValue::propertyFlags function. |
|
118 |
|
119 The function returns the flags of a property with the given name, |
|
120 using a given mode to resolve the property. This is a simple |
|
121 implementation that is sufficient to test the QScriptValueIterator. |
|
122 |
|
123 [Qt] QScriptValue API should have a property flag accessor. |
|
124 https://bugs.webkit.org/show_bug.cgi?id=41769 |
|
125 |
|
126 * api/qscriptvalue.cpp: |
|
127 (QScriptValue::propertyFlags): |
|
128 * api/qscriptvalue.h: |
|
129 * api/qscriptvalue_p.h: |
|
130 (QScriptValuePrivate::propertyFlags): |
|
131 * tests/qscriptvalue/tst_qscriptvalue.cpp: |
|
132 (tst_QScriptValue::propertyFlag_data): |
|
133 (tst_QScriptValue::propertyFlag): |
|
134 * tests/qscriptvalue/tst_qscriptvalue.h: |
|
135 |
|
136 2010-07-07 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> |
|
137 |
|
138 Reviewed by Kenneth Rohde Christiansen. |
|
139 |
|
140 Implementation of QScriptValue::isArray() |
|
141 https://bugs.webkit.org/show_bug.cgi?id=41713 |
|
142 |
|
143 Since we don't have access to the [[Class]] internal property of |
|
144 builtins (including Array), the solution was to keep the original 'Array' |
|
145 (constructor) and 'Array.prototype' objects and use them to identify |
|
146 if a given object is an Array. |
|
147 |
|
148 Also uncomment some tests and add some tests of newArray() that |
|
149 depended on isArray(). |
|
150 |
|
151 * api/qscriptengine_p.cpp: |
|
152 (QScriptEnginePrivate::QScriptEnginePrivate): |
|
153 (QScriptEnginePrivate::~QScriptEnginePrivate): |
|
154 * api/qscriptengine_p.h: |
|
155 (QScriptEnginePrivate::isArray): |
|
156 * api/qscriptvalue.cpp: |
|
157 (QScriptValue::isArray): |
|
158 * api/qscriptvalue.h: |
|
159 * api/qscriptvalue_p.h: |
|
160 (QScriptValuePrivate::isArray): |
|
161 * tests/qscriptengine/tst_qscriptengine.cpp: |
|
162 (tst_QScriptEngine::newArray): |
|
163 |
|
164 2010-07-06 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> |
|
165 |
|
166 Reviewed by Kenneth Rohde Christiansen. |
|
167 |
|
168 Implementation of QScriptValue properties accessors. |
|
169 |
|
170 The patch contains implementation of the QScriptValue::property() and |
|
171 the QScriptValue::setProperty(). It is not full functionality, as these |
|
172 method are too complex for one patch, but it is enough to cover about |
|
173 95% of use cases. |
|
174 |
|
175 Missing functionality: |
|
176 - Few of the PropertyFlags are ignored. |
|
177 - Only a public part of the ResolveFlags can be used (ResolveLocal, |
|
178 ResolvePrototype). |
|
179 |
|
180 A lot of new test cases were added. |
|
181 |
|
182 [Qt] QScriptValue should have API for accessing object properties |
|
183 https://bugs.webkit.org/show_bug.cgi?id=40903 |
|
184 |
|
185 * api/qscriptconverter_p.h: |
|
186 (QScriptConverter::toPropertyFlags): |
|
187 * api/qscriptstring_p.h: |
|
188 (QScriptStringPrivate::operator JSStringRef): |
|
189 * api/qscriptvalue.cpp: |
|
190 (QScriptValue::property): |
|
191 (QScriptValue::setProperty): |
|
192 * api/qscriptvalue.h: |
|
193 (QScriptValue::): |
|
194 * api/qscriptvalue_p.h: |
|
195 (QScriptValuePrivate::assignEngine): |
|
196 (QScriptValuePrivate::property): |
|
197 (QScriptValuePrivate::hasOwnProperty): |
|
198 (QScriptValuePrivate::setProperty): |
|
199 (QScriptValuePrivate::deleteProperty): |
|
200 * tests/qscriptvalue/tst_qscriptvalue.cpp: |
|
201 (tst_QScriptValue::getPropertySimple_data): |
|
202 (tst_QScriptValue::getPropertySimple): |
|
203 (tst_QScriptValue::setPropertySimple): |
|
204 (tst_QScriptValue::getPropertyResolveFlag): |
|
205 (tst_QScriptValue::getSetProperty): |
|
206 (tst_QScriptValue::setProperty_data): |
|
207 (tst_QScriptValue::setProperty): |
|
208 * tests/qscriptvalue/tst_qscriptvalue.h: |
|
209 |
|
210 2010-07-02 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> |
|
211 |
|
212 Reviewed by Simon Hausmann. |
|
213 |
|
214 Compilation fix. |
|
215 |
|
216 QScriptEnginePrivate::newArray can't be const because it can |
|
217 throw an exception. |
|
218 |
|
219 [Qt] QScriptEnginePrivate compilation fix |
|
220 https://bugs.webkit.org/show_bug.cgi?id=41520 |
|
221 |
|
222 * api/qscriptengine_p.cpp: |
|
223 (QScriptEnginePrivate::newArray): |
|
224 * api/qscriptengine_p.h: |
|
225 |
|
226 2010-06-28 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> |
|
227 |
|
228 Reviewed by Simon Hausmann. |
|
229 |
|
230 Implement exception reporting in the QtScript API. |
|
231 |
|
232 The exception should be accessible through the API by the uncaughtException |
|
233 function. Functions; hasUncaughtException, clearExceptions, uncaughtExceptionLineNumber, |
|
234 uncaughtExceptionBacktrace were added to facilitate error checking and debugging. |
|
235 |
|
236 [Qt] QtScript API should be exceptions aware. |
|
237 https://bugs.webkit.org/show_bug.cgi?id=41199 |
|
238 |
|
239 * api/qscriptengine.cpp: |
|
240 (QScriptEngine::hasUncaughtException): |
|
241 (QScriptEngine::uncaughtException): |
|
242 (QScriptEngine::clearExceptions): |
|
243 (QScriptEngine::uncaughtExceptionLineNumber): |
|
244 (QScriptEngine::uncaughtExceptionBacktrace): |
|
245 * api/qscriptengine.h: |
|
246 * api/qscriptengine_p.cpp: |
|
247 (QScriptEnginePrivate::QScriptEnginePrivate): |
|
248 (QScriptEnginePrivate::~QScriptEnginePrivate): |
|
249 (QScriptEnginePrivate::uncaughtException): |
|
250 * api/qscriptengine_p.h: |
|
251 (QScriptEnginePrivate::): |
|
252 (QScriptEnginePrivate::evaluate): |
|
253 (QScriptEnginePrivate::hasUncaughtException): |
|
254 (QScriptEnginePrivate::clearExceptions): |
|
255 (QScriptEnginePrivate::setException): |
|
256 (QScriptEnginePrivate::uncaughtExceptionLineNumber): |
|
257 (QScriptEnginePrivate::uncaughtExceptionBacktrace): |
|
258 * api/qscriptvalue_p.h: |
|
259 (QScriptValuePrivate::toString): |
|
260 (QScriptValuePrivate::toNumber): |
|
261 (QScriptValuePrivate::toObject): |
|
262 (QScriptValuePrivate::equals): |
|
263 (QScriptValuePrivate::instanceOf): |
|
264 (QScriptValuePrivate::call): |
|
265 (QScriptValuePrivate::inherits): |
|
266 * tests/qscriptengine/tst_qscriptengine.cpp: |
|
267 (tst_QScriptEngine::uncaughtException): |
|
268 |