Commit Graph

26 Commits

Author SHA1 Message Date
Kent Hansen 24bf48e3dd Remove QJSValue::toInteger() function
Rationale: This is a remnant from QtScript. A function called
toInteger() that returns a double looks strange.
Use toInt32() to convert a QJSValue to an integer.

Task-number: QTBUG-23604

Change-Id: I2829704c64b077fca264b660c46248c3f35cb5c0
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-02-01 08:37:49 +01:00
Kent Hansen 1edcf64d28 Remove QJSEngine::toObject() and QJSValue::toObject()
Rationale: There is no compelling usecase for these functions.
They are a remnant from QtScript.

Task-number: QTBUG-23604
Change-Id: I6d8b4299956dd8f6284934739c4f1a65e4deb64c
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-02-01 08:37:49 +01:00
Jason McDonald 45b14259fc Remove "All rights reserved" line from license headers.
As in the past, to avoid rewriting various autotests that contain
line-number information, an extra blank line has been inserted at the
end of the license text to ensure that this commit does not change the
total number of lines in the license header.

Change-Id: If39bd256b0fa85eba17ea30f8ab87ea27d758908
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-30 23:52:43 +01:00
Jason McDonald e6b224aa28 Update obsolete contact address.
Replace Nokia contact email address with Qt Project website.

Change-Id: I6a730abc0c396fb545a48b2d6938abedac2e3f1c
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
2012-01-23 06:28:53 +01:00
Kent Hansen 1d577f6888 Add QJSValue::callAsConstructor() function
The old name, construct(), was bad. This name is more descriptive
and consistent with the other callXXX() functions.

Task-number: QTBUG-23604
Change-Id: Ie205b0c52721782101e665f7dfedcac9051a00d0
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-01-20 23:35:18 +01:00
Kent Hansen 174ee897ed Add QJSValue::callWithInstance() function
With the deprecated call() overload, it was confusing what the first
argument was (the this-object or an actual argument passed to the
function). Introduce a dedicated function for the
"explicit this-object" case. This makes code more readable, and
eliminates the need to pass a "dummy" this-object to call() in the
quite common case where you don't care about the this-object.

Task-number: QTBUG-23604
Change-Id: I18f8be6592a848436351516bea266fc7e9195777
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-01-20 23:35:18 +01:00
Kent Hansen 95cee5d6e5 Add QJSValue::call() overload
This overload takes only an argument list, not a this-object, since
that is a very common way of calling stand-alone ("non-member")
functions. Now there is no longer a need to pass a dummy value for
the this-object.

Task-number: QTBUG-23604
Change-Id: Iae952d91fce5bcaa62a05b9978c15f32802da90a
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-01-20 23:35:18 +01:00
Kent Hansen dfad4902b7 Add QJSValue::isCallable() function
This replaces the isFunction() function. isFunction() will be
removed. It's possible that objects are callable even if they aren't
Function instances. Also, "isCallable" is consistent with call().

Task-number: QTBUG-23604
Change-Id: I42e0ab2ad9dc84e7793199254bbd89d5c9466e6a
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-01-20 23:35:18 +01:00
Kent Hansen 846b66d46a Add QJSValue::toInt() and toUInt()
These replace toInt32() and toUInt32(), which are obsolete and will
be removed.

Task-number: QTBUG-23604
Change-Id: I83c055dbbe399fa7242889cee8a177440a693d9a
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-01-20 23:35:18 +01:00
Damian Jansen 7e973ea4a8 Use QGuiApplication, not QApplication, in tests
Change-Id: I7802293e6cafb90686c103972bc036cf74184714
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
2012-01-13 05:36:11 +01:00
Simon Hausmann 30fdb6d971 Remove obsolete toBoolean() and isBoolean() QJSValue getters
We should use "toBool" and "isBool" for consistency with QVariant.

Change-Id: I266f2a36a034a5b323e614777ceacbc0d2ffec16
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-01-11 15:52:35 +01:00
Jason McDonald da0839735c Update copyright year in license headers.
Change-Id: I0a8d99909cac867dce72da70b1bbcb649989a51b
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-05 09:12:53 +01:00
Simon Hausmann a401d0756f Fix that QJSEngine cannot be used from threads other than the gui thread
Implicitly allocate & enter an isolate per thread if needed, store it in TLS and
exit it upon thread destruction. As the code that represents QObject
dependencies in the GC through implicit dependencies uses its own context,
its per-thread data is folded into the v8engine TLS to ensure that it is
destructed before the isolate is exited.

Task-number: QTBUG-23099

Change-Id: I86538b54939b2fe64db843052eac04c7fd31813e
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
2011-12-15 12:05:08 +01:00
Jason McDonald e9a0aa7dd3 Remove TESTED_CLASS/TESTED_FILES comments from tests.
These comments were mostly empty or inaccurate.  Appropriate naming of
tests and appropriate placement of tests within the directory tree
provide more reliable indicators of what is being tested.

Change-Id: If69bdb39fd162d167cb948ddcbb73503b414e791
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-12-06 05:48:52 +01:00
Friedemann Kleint 7f20428c91 QtDeclarative: Fix warnings in tests.
- Unused parameters
- Missing interfaces
- tst_QQuickListView: Fix call canvas->rootContext()->setContextProperty
  to use a QVariant (instead of implicitly converting to QObject*)
  which was apparently intended.

Change-Id: Idc95d9408051e6f5b7005a7eccd764ac218ff867
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-28 09:06:52 +01:00
Michael Brasser e9b68b62e2 Make compile and pass CI tests.
Change-Id: Ie2ec20d9e346ccaf698762d6abf0224c39fb3490
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2011-11-11 04:52:22 +01:00
Damian Jansen 4ae7aecb68 Remove Q_WS_*, symbian and maemo code in QtDeclarative
Change-Id: If64daf80f9d19973e0bc2d864b003a66be5ca61d
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
2011-10-26 09:01:28 +02:00
Jason McDonald 080a1f3ff3 Remove SkipMode from qtestlib API.
The SkipMode parameter to QSKIP has been removed in qtbase, therefore it
must also be removed here.

Task-number: QTBUG-21851, QTBUG-21652
Change-Id: I8016f8c28338b1b532bdb593c796d699b99250dc
Reviewed-by: Charles Yin <charles.yin@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-10-21 04:12:18 +02:00
Martin Jones 3f320761c3 Skip failing tests.
Possibly due to V8 update.

Task-number: QTBUG-22238
Change-Id: Ide61c6693726e7b21766cac1166716a3af97e9d5
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2011-10-20 10:18:20 +02:00
Simon Hausmann ab989615c0 Fix QJSEngine::newQObject ownership behaviour
Ensure the indestructible flag is set to false for objects wrapped through
QJSEngine::newQObject, to ensure that they get deleted upon gc when they
don't have a parent.

Re-enabled the QJSEngine::garbageCollect and ownership auto-tests that verified
this behaviour.

Change-Id: I181bff0cc44d071d650a2f73494e49cce6ad538e
Reviewed-on: http://codereview.qt-project.org/2398
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
2011-10-06 10:44:27 +02:00
Jason McDonald b1e650a889 Remove Symbian-specific code from tests.
Symbian is not a supported platform for Qt5, so this code is no longer
required.

Change-Id: I5cb6d3b41fbb9fa5fea6176ad949e4e7be7c30b5
Reviewed-on: http://codereview.qt-project.org/5767
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-09-30 10:37:05 +02:00
Jason McDonald 5efcde6517 Fix missing/outdated license headers.
Change-Id: Ib5f244a61cb65db829ee83ec9e4d5e4189319a9f
Reviewed-on: http://codereview.qt-project.org/4936
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
2011-09-16 03:48:32 +02:00
Kent Hansen 46af4afe0c Don't enumerate Function.prototype.{connect,disconnect}
QML/JS adds connect and disconnect methods to the standard
Function.prototype object.
Follow the convention of ECMA-262: Function properties should
be non-enumerable.
In particular, we don't want such built-in properties to show
up in user code "for-in" statements.

Task-number: QTBUG-21120
Change-Id: I416106badf35daddf32e16f757d37b2b09e58310
Reviewed-on: http://codereview.qt.nokia.com/3587
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2011-08-26 07:54:35 +02:00
Jedrzej Nowacki 1f0c9055da Enable tst_QJSEngine::stacktrace test.
The test can be enabled because QJSValueIterator is back.

Change-Id: I33a84b0e584137ecff0d65c2a6152ca972e863f1
Reviewed-on: http://codereview.qt.nokia.com/2440
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2011-08-02 15:25:27 +02:00
Jedrzej Nowacki dfdf7d054f Enable globalObjectProperties_enumerate test.
The test can be enabled because QJSValueIterator is back.

Change-Id: I81220ea17470663dab799eb818168480d2df1a54
Reviewed-on: http://codereview.qt.nokia.com/2439
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2011-08-02 15:25:18 +02:00
Simon Hausmann d410ad364e Merge the QJSEngine and QJSValue development branch into master.
This replaces the dependency to QtScript with two new builtin classes
QJSValue and QJSEngine.

This is still work in progress, development continues now in the master branch.

Change-Id: I7f5487feb45c972f25a22b10cc81b9218b9805de
Reviewed-on: http://codereview.qt.nokia.com/2299
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
2011-07-29 13:00:52 +02:00