• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
12011-03-01  Andras Becsi  <abecsi@webkit.org>
2
3        Reviewed by Csaba Osztrogonác.
4
5        [Qt] Clean up the project files and move common options to WebKit.pri.
6
7        * api/QtScript.pro: Deduplicate options.
8
92011-02-24  Andras Becsi  <abecsi@webkit.org>
10
11        Reviewed by Laszlo Gombos.
12
13        [Qt] MinGW build fails to link
14        https://bugs.webkit.org/show_bug.cgi?id=55050
15
16        Prepend the libraries of subcomponents instead of appending them
17        to fix the library order according to the dependency of the libraries
18
19        * api/QtScript.pro:
20
212010-09-29  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
22
23        Reviewed by Andreas Kling.
24
25        [Qt] QScriptEngine should have an API for creating Date objects
26        https://bugs.webkit.org/show_bug.cgi?id=41667
27
28        Implement newDate(), isDate() and toDateTime() functions. Use the
29        QDateTime::{to,set}MSecsSinceEpoch() functions to do the
30        calculations.
31
32        * api/qscriptengine.cpp:
33        (QScriptEngine::newDate):
34        * api/qscriptengine.h:
35        * api/qscriptengine_p.cpp:
36        (QScriptEnginePrivate::newDate):
37        * api/qscriptengine_p.h:
38        (QScriptEnginePrivate::isDate):
39
40        * api/qscriptoriginalglobalobject_p.h:
41        (QScriptOriginalGlobalObject::QScriptOriginalGlobalObject): need
42        to keep track of Date Constructor and Prototype.
43        (QScriptOriginalGlobalObject::~QScriptOriginalGlobalObject): ditto.
44        (QScriptOriginalGlobalObject::isDate): use the Date Constructor
45        and Prototype to identify Date values.
46
47        * api/qscriptvalue.cpp:
48        (QScriptValue::isDate):
49        (QScriptValue::toDateTime):
50        * api/qscriptvalue.h:
51        * api/qscriptvalue_p.h:
52        (QScriptValuePrivate::isDate):
53        (QScriptValuePrivate::toDateTime):
54        * tests/qscriptengine/tst_qscriptengine.cpp:
55        (tst_QScriptEngine::newDate):
56
572010-07-27  Jedrzej Nowacki  <jedrzej.nowacki@nokia.com>
58
59        Reviewed by Kenneth Rohde Christiansen.
60
61        Update the QScriptValue autotests suite.
62
63        QScriptValue generated files were updated, changes are:
64         - More tested values (for example QSE::newObject() and QSE::newArray())
65         - Tested values are recreated before each test and are not reused.
66         The change implies better code coverage and some expected result changes.
67         - A new test to check copy and assign functions.
68         - Tests are using standard QTestLib interface, without any custom macros.
69
70        [Qt] Improve test coverage for the QScriptValue
71        https://bugs.webkit.org/show_bug.cgi?id=42366
72
73        * tests/qscriptvalue/tst_qscriptvalue.cpp:
74        (tst_QScriptValue::tst_QScriptValue):
75        (tst_QScriptValue::~tst_QScriptValue):
76        (tst_QScriptValue::assignAndCopyConstruct_data):
77        (tst_QScriptValue::assignAndCopyConstruct):
78        * tests/qscriptvalue/tst_qscriptvalue.h:
79        * tests/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp:
80        (tst_QScriptValue::equals_data):
81        (tst_QScriptValue::equals):
82        (tst_QScriptValue::strictlyEquals_data):
83        (tst_QScriptValue::strictlyEquals):
84        (tst_QScriptValue::instanceOf_data):
85        (tst_QScriptValue::instanceOf):
86        * tests/qscriptvalue/tst_qscriptvalue_generated_init.cpp:
87        (tst_QScriptValue::initScriptValues):
88        * tests/qscriptvalue/tst_qscriptvalue_generated_istype.cpp:
89        (tst_QScriptValue::isValid_data):
90        (tst_QScriptValue::isValid):
91        (tst_QScriptValue::isBool_data):
92        (tst_QScriptValue::isBool):
93        (tst_QScriptValue::isBoolean_data):
94        (tst_QScriptValue::isBoolean):
95        (tst_QScriptValue::isNumber_data):
96        (tst_QScriptValue::isNumber):
97        (tst_QScriptValue::isFunction_data):
98        (tst_QScriptValue::isFunction):
99        (tst_QScriptValue::isNull_data):
100        (tst_QScriptValue::isNull):
101        (tst_QScriptValue::isString_data):
102        (tst_QScriptValue::isString):
103        (tst_QScriptValue::isUndefined_data):
104        (tst_QScriptValue::isUndefined):
105        (tst_QScriptValue::isObject_data):
106        (tst_QScriptValue::isObject):
107        (tst_QScriptValue::isArray_data):
108        (tst_QScriptValue::isArray):
109        (tst_QScriptValue::isError_data):
110        (tst_QScriptValue::isError):
111        * tests/qscriptvalue/tst_qscriptvalue_generated_totype.cpp:
112        (tst_QScriptValue::toString_data):
113        (tst_QScriptValue::toString):
114        (tst_QScriptValue::toNumber_data):
115        (tst_QScriptValue::toNumber):
116        (tst_QScriptValue::toBool_data):
117        (tst_QScriptValue::toBool):
118        (tst_QScriptValue::toBoolean_data):
119        (tst_QScriptValue::toBoolean):
120        (tst_QScriptValue::toInteger_data):
121        (tst_QScriptValue::toInteger):
122        (tst_QScriptValue::toInt32_data):
123        (tst_QScriptValue::toInt32):
124        (tst_QScriptValue::toUInt32_data):
125        (tst_QScriptValue::toUInt32):
126        (tst_QScriptValue::toUInt16_data):
127        (tst_QScriptValue::toUInt16):
128
1292010-07-27  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
130
131        Reviewed by Kenneth Rohde Christiansen.
132
133        [Qt] Implement QScriptEngine::newFunction() parts that doesn't depend on QScriptContext
134        https://bugs.webkit.org/show_bug.cgi?id=42174
135
136        Since our function can be called in Javascript both as a function
137        and as a constructor, we couldn't use the existing
138        JSObjectMakeFunctionWithCallback() and JSObjectMakeConstructor().
139
140        Instead, a JSClassRef was created, implementing the needed
141        callbacks (the callAsConstructor is not there yet because its
142        behaviour depends on QScriptContext).
143
144        For the moment, QScriptContext is defined as a void type, since we
145        still don't use it.
146
147        The variant of newFunction() that also takes an external argument
148        was also implemented. The details of implementation were added to
149        the qscriptfunction{.c,_p.h} files.
150
151        This commit also adds tests, some of them from Qt's upstream.
152
153        * api/QtScript.pro:
154        * api/qscriptengine.cpp:
155        (QScriptEngine::newFunction):
156        * api/qscriptengine.h:
157        * api/qscriptengine_p.cpp:
158        (QScriptEnginePrivate::QScriptEnginePrivate):
159        (QScriptEnginePrivate::~QScriptEnginePrivate):
160        (QScriptEnginePrivate::newFunction):
161        * api/qscriptengine_p.h:
162        * api/qscriptfunction.cpp: Added.
163        (qt_NativeFunction_finalize):
164        (qt_NativeFunction_callAsFunction):
165        (qt_NativeFunctionWithArg_finalize):
166        (qt_NativeFunctionWithArg_callAsFunction):
167        * api/qscriptfunction_p.h: Added.
168        (QNativeFunctionData::QNativeFunctionData):
169        (QNativeFunctionWithArgData::QNativeFunctionWithArgData):
170        * api/qscriptoriginalglobalobject_p.h:
171        (QScriptOriginalGlobalObject::QScriptOriginalGlobalObject):
172        (QScriptOriginalGlobalObject::~QScriptOriginalGlobalObject):
173        (QScriptOriginalGlobalObject::functionPrototype):
174        * tests/qscriptengine/tst_qscriptengine.cpp:
175        (myFunction):
176        (myFunctionWithArg):
177        (myFunctionThatReturns):
178        (myFunctionThatReturnsWithoutEngine):
179        (myFunctionThatReturnsWrongEngine):
180        (tst_QScriptEngine::newFunction):
181
1822010-07-23  Jedrzej Nowacki  <jedrzej.nowacki@nokia.com>
183
184        Reviewed by Kenneth Rohde Christiansen.
185
186        QScriptValue::equals benchmark crash fix.
187
188        Patch changes QScriptValue::equals implementation to cover
189        more edge cases.
190
191        Problem exposes an issue in our autotests (all values got
192        bound to an engine too fast - bug 42366).
193
194        [Qt] QScriptValue::equals asserts
195        https://bugs.webkit.org/show_bug.cgi?id=42363
196
197        * api/qscriptvalue_p.h:
198        (QScriptValuePrivate::equals):
199
2002010-07-14  Jedrzej Nowacki  <jedrzej.nowacki@nokia.com>
201
202        Reviewed by Kenneth Rohde Christiansen.
203
204        Introduce QScriptOriginalGlobalObject.
205
206        QtScript exposes more functionality than JSC C API. Sometimes it is
207        necessary to take a shortcut in implementation. Really often we have
208        to use a standard JS function. These function could be changed or
209        even deleted by a script, so a backup of a reference to an object is needed.
210
211        In them same time this is rather a workaround then real fix, so the code
212        should be separated and changed easily in future. It is why we need
213        the new internal class.
214
215        The patch fixes a few crashes.
216
217        [Qt] QScriptEngine should work correctly even after global object changes
218        https://bugs.webkit.org/show_bug.cgi?id=41839
219
220        * api/QtScript.pro:
221        * api/qscriptengine_p.cpp:
222        (QScriptEnginePrivate::QScriptEnginePrivate):
223        (QScriptEnginePrivate::~QScriptEnginePrivate):
224        * api/qscriptengine_p.h:
225        (QScriptEnginePrivate::isArray):
226        (QScriptEnginePrivate::isError):
227        (QScriptEnginePrivate::objectHasOwnProperty):
228        (QScriptEnginePrivate::objectGetOwnPropertyNames):
229        * api/qscriptoriginalglobalobject_p.h: Added.
230        (QScriptOriginalGlobalObject::QScriptOriginalGlobalObject):
231        (QScriptOriginalGlobalObject::initializeMember):
232        (QScriptOriginalGlobalObject::~QScriptOriginalGlobalObject):
233        (QScriptOriginalGlobalObject::objectHasOwnProperty):
234        (QScriptOriginalGlobalObject::objectGetOwnPropertyNames):
235        (QScriptOriginalGlobalObject::isArray):
236        (QScriptOriginalGlobalObject::isError):
237        (QScriptOriginalGlobalObject::isType):
238        * api/qscriptvalue_p.h:
239        (QScriptValuePrivate::isError):
240        (QScriptValuePrivate::hasOwnProperty):
241        * api/qscriptvalueiterator_p.h:
242        (QScriptValueIteratorPrivate::QScriptValueIteratorPrivate):
243        * tests/qscriptvalue/tst_qscriptvalue.cpp:
244        (tst_QScriptValue::globalObjectChanges):
245        * tests/qscriptvalue/tst_qscriptvalue.h:
246
2472010-07-13  Jedrzej Nowacki  <jedrzej.nowacki@nokia.com>
248
249        Reviewed by Simon Hausmann.
250
251        Introduce QScriptValueIterator.
252
253        The QScriptValueIterator class permits to iterate over a QScriptValue's properties.
254
255        [Qt] QtScript should provide an API for enumerating a JS object's properties
256        https://bugs.webkit.org/show_bug.cgi?id=41680
257
258        * api/QtScript.pro:
259        * api/qscriptvalueiterator.cpp: Added.
260        (QScriptValueIterator::QScriptValueIterator):
261        (QScriptValueIterator::~QScriptValueIterator):
262        (QScriptValueIterator::hasNext):
263        (QScriptValueIterator::next):
264        (QScriptValueIterator::hasPrevious):
265        (QScriptValueIterator::previous):
266        (QScriptValueIterator::toFront):
267        (QScriptValueIterator::toBack):
268        (QScriptValueIterator::name):
269        (QScriptValueIterator::scriptName):
270        (QScriptValueIterator::value):
271        (QScriptValueIterator::setValue):
272        (QScriptValueIterator::remove):
273        (QScriptValueIterator::flags):
274        (QScriptValueIterator::operator=):
275        * api/qscriptvalueiterator.h: Added.
276        * api/qscriptvalueiterator_p.h: Added.
277        (QScriptValueIteratorPrivate::QScriptValueIteratorPrivate):
278        (QScriptValueIteratorPrivate::~QScriptValueIteratorPrivate):
279        (QScriptValueIteratorPrivate::hasNext):
280        (QScriptValueIteratorPrivate::next):
281        (QScriptValueIteratorPrivate::hasPrevious):
282        (QScriptValueIteratorPrivate::previous):
283        (QScriptValueIteratorPrivate::name):
284        (QScriptValueIteratorPrivate::scriptName):
285        (QScriptValueIteratorPrivate::value):
286        (QScriptValueIteratorPrivate::setValue):
287        (QScriptValueIteratorPrivate::remove):
288        (QScriptValueIteratorPrivate::toFront):
289        (QScriptValueIteratorPrivate::toBack):
290        (QScriptValueIteratorPrivate::flags):
291        (QScriptValueIteratorPrivate::isValid):
292        (QScriptValueIteratorPrivate::engine):
293        * tests/qscriptvalueiterator/qscriptvalueiterator.pro: Added.
294        * tests/qscriptvalueiterator/tst_qscriptvalueiterator.cpp: Added.
295        (tst_QScriptValueIterator::tst_QScriptValueIterator):
296        (tst_QScriptValueIterator::~tst_QScriptValueIterator):
297        (tst_QScriptValueIterator::iterateForward_data):
298        (tst_QScriptValueIterator::iterateForward):
299        (tst_QScriptValueIterator::iterateBackward_data):
300        (tst_QScriptValueIterator::iterateBackward):
301        (tst_QScriptValueIterator::iterateArray_data):
302        (tst_QScriptValueIterator::iterateArray):
303        (tst_QScriptValueIterator::iterateBackAndForth):
304        (tst_QScriptValueIterator::setValue):
305        (tst_QScriptValueIterator::remove):
306        (tst_QScriptValueIterator::removeMixed):
307        (tst_QScriptValueIterator::removeUndeletable):
308        (tst_QScriptValueIterator::iterateString):
309        (tst_QScriptValueIterator::assignObjectToIterator):
310        * tests/tests.pro:
311
3122010-07-09  Jedrzej Nowacki  <jedrzej.nowacki@nokia.com>
313
314        Reviewed by Simon Hausmann.
315
316        Implementation of the QScriptValue::propertyFlags function.
317
318        The function returns the flags of a property with the given name,
319        using a given mode to resolve the property. This is a simple
320        implementation that is sufficient to test the QScriptValueIterator.
321
322        [Qt] QScriptValue API should have a property flag accessor.
323        https://bugs.webkit.org/show_bug.cgi?id=41769
324
325        * api/qscriptvalue.cpp:
326        (QScriptValue::propertyFlags):
327        * api/qscriptvalue.h:
328        * api/qscriptvalue_p.h:
329        (QScriptValuePrivate::propertyFlags):
330        * tests/qscriptvalue/tst_qscriptvalue.cpp:
331        (tst_QScriptValue::propertyFlag_data):
332        (tst_QScriptValue::propertyFlag):
333        * tests/qscriptvalue/tst_qscriptvalue.h:
334
3352010-07-07  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
336
337        Reviewed by Kenneth Rohde Christiansen.
338
339        Implementation of QScriptValue::isArray()
340        https://bugs.webkit.org/show_bug.cgi?id=41713
341
342        Since we don't have access to the [[Class]] internal property of
343        builtins (including Array), the solution was to keep the original 'Array'
344        (constructor) and 'Array.prototype' objects and use them to identify
345        if a given object is an Array.
346
347        Also uncomment some tests and add some tests of newArray() that
348        depended on isArray().
349
350        * api/qscriptengine_p.cpp:
351        (QScriptEnginePrivate::QScriptEnginePrivate):
352        (QScriptEnginePrivate::~QScriptEnginePrivate):
353        * api/qscriptengine_p.h:
354        (QScriptEnginePrivate::isArray):
355        * api/qscriptvalue.cpp:
356        (QScriptValue::isArray):
357        * api/qscriptvalue.h:
358        * api/qscriptvalue_p.h:
359        (QScriptValuePrivate::isArray):
360        * tests/qscriptengine/tst_qscriptengine.cpp:
361        (tst_QScriptEngine::newArray):
362
3632010-07-06  Jedrzej Nowacki  <jedrzej.nowacki@nokia.com>
364
365        Reviewed by Kenneth Rohde Christiansen.
366
367        Implementation of QScriptValue properties accessors.
368
369        The patch contains implementation of the QScriptValue::property() and
370        the QScriptValue::setProperty(). It is not full functionality, as these
371        method are too complex for one patch, but it is enough to cover about
372        95% of use cases.
373
374        Missing functionality:
375         - Few of the PropertyFlags are ignored.
376         - Only a public part of the ResolveFlags can be used (ResolveLocal,
377         ResolvePrototype).
378
379        A lot of new test cases were added.
380
381        [Qt] QScriptValue should have API for accessing object properties
382        https://bugs.webkit.org/show_bug.cgi?id=40903
383
384        * api/qscriptconverter_p.h:
385        (QScriptConverter::toPropertyFlags):
386        * api/qscriptstring_p.h:
387        (QScriptStringPrivate::operator JSStringRef):
388        * api/qscriptvalue.cpp:
389        (QScriptValue::property):
390        (QScriptValue::setProperty):
391        * api/qscriptvalue.h:
392        (QScriptValue::):
393        * api/qscriptvalue_p.h:
394        (QScriptValuePrivate::assignEngine):
395        (QScriptValuePrivate::property):
396        (QScriptValuePrivate::hasOwnProperty):
397        (QScriptValuePrivate::setProperty):
398        (QScriptValuePrivate::deleteProperty):
399        * tests/qscriptvalue/tst_qscriptvalue.cpp:
400        (tst_QScriptValue::getPropertySimple_data):
401        (tst_QScriptValue::getPropertySimple):
402        (tst_QScriptValue::setPropertySimple):
403        (tst_QScriptValue::getPropertyResolveFlag):
404        (tst_QScriptValue::getSetProperty):
405        (tst_QScriptValue::setProperty_data):
406        (tst_QScriptValue::setProperty):
407        * tests/qscriptvalue/tst_qscriptvalue.h:
408
4092010-07-02  Jedrzej Nowacki  <jedrzej.nowacki@nokia.com>
410
411        Reviewed by Simon Hausmann.
412
413        Compilation fix.
414
415        QScriptEnginePrivate::newArray can't be const because it can
416        throw an exception.
417
418        [Qt] QScriptEnginePrivate compilation fix
419        https://bugs.webkit.org/show_bug.cgi?id=41520
420
421        * api/qscriptengine_p.cpp:
422        (QScriptEnginePrivate::newArray):
423        * api/qscriptengine_p.h:
424
4252010-06-28  Jedrzej Nowacki  <jedrzej.nowacki@nokia.com>
426
427        Reviewed by Simon Hausmann.
428
429        Implement exception reporting in the QtScript API.
430
431        The exception should be accessible through the API by the uncaughtException
432        function. Functions; hasUncaughtException, clearExceptions, uncaughtExceptionLineNumber,
433        uncaughtExceptionBacktrace were added to facilitate error checking and debugging.
434
435        [Qt] QtScript API should be exceptions aware.
436        https://bugs.webkit.org/show_bug.cgi?id=41199
437
438        * api/qscriptengine.cpp:
439        (QScriptEngine::hasUncaughtException):
440        (QScriptEngine::uncaughtException):
441        (QScriptEngine::clearExceptions):
442        (QScriptEngine::uncaughtExceptionLineNumber):
443        (QScriptEngine::uncaughtExceptionBacktrace):
444        * api/qscriptengine.h:
445        * api/qscriptengine_p.cpp:
446        (QScriptEnginePrivate::QScriptEnginePrivate):
447        (QScriptEnginePrivate::~QScriptEnginePrivate):
448        (QScriptEnginePrivate::uncaughtException):
449        * api/qscriptengine_p.h:
450        (QScriptEnginePrivate::):
451        (QScriptEnginePrivate::evaluate):
452        (QScriptEnginePrivate::hasUncaughtException):
453        (QScriptEnginePrivate::clearExceptions):
454        (QScriptEnginePrivate::setException):
455        (QScriptEnginePrivate::uncaughtExceptionLineNumber):
456        (QScriptEnginePrivate::uncaughtExceptionBacktrace):
457        * api/qscriptvalue_p.h:
458        (QScriptValuePrivate::toString):
459        (QScriptValuePrivate::toNumber):
460        (QScriptValuePrivate::toObject):
461        (QScriptValuePrivate::equals):
462        (QScriptValuePrivate::instanceOf):
463        (QScriptValuePrivate::call):
464        (QScriptValuePrivate::inherits):
465        * tests/qscriptengine/tst_qscriptengine.cpp:
466        (tst_QScriptEngine::uncaughtException):
467
468