summaryrefslogtreecommitdiffstats
path: root/src/script
Commit message (Collapse)AuthorAgeFilesLines
* Symbian compile fixKai Koehne2010-12-171-1/+1
| | | | | | | | armv5 complained that the call to QChar::category() was ambiguous, because there is a version taking an uint, and a version taking ushort as argument. Reviewed-by: Christiaan Janssen
* Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into qtquick11Yann Bodson2010-11-231-1/+1
|\
| * Doc: Fixing typoSergio Ahumada2010-11-161-1/+1
| |
* | Small optimization of enum detection in script.Michael Brasser2010-11-122-0/+9
|/ | | | Reviewed-by: Martin Jones
* Fix GC-related crash in QScriptValue::setData()Kent Hansen2010-11-091-0/+1
| | | | | | | | | | | | | | | Yet another missing API shim. When converting the QScriptValue to JSC, a JSCell may be allocated, which can cause the GC to trigger. If an identifier (JSC::Identifier) is then garbage collected, the destructor will try to remove itself from the currentIdentifierTable(). Because the API shim was missing, the identifier table was 0. It's difficult to create a bulletproof test for this case, but the attached test is a best effort (it crashes on my machine without the fix). Task-number: QTBUG-15144 Reviewed-by: Jedrzej Nowacki
* Don't crash if QScriptClass property getter returns an invalid valueKent Hansen2010-11-081-0/+12
| | | | | | | | | | | | | It's possible that a class claims to have a property of a given name (i.e. queryProperty() returns true), but returns an invalid value for that property. In that case we should silently convert the value to undefined, otherwise the value may wreak havoc in JS. This is a regression from Qt 4.5 (pre-JavaScriptCore-based), which had this check. Task-number: QTBUG-15079 Reviewed-by: Jedrzej Nowacki
* QScriptValue::construct(): Don't crash if function throws non-ObjectKent Hansen2010-10-281-5/+8
| | | | | | | | | | | | | If an exception occurs, we should ignore the result of JSC::construct() and return the exception value, even if the exception is not an object. This makes the behavior match the documentation: "Calling construct() can cause an exception to occur in the script engine; in that case, construct() returns the value that was thrown". Task-number: QTBUG-14801 Reviewed-by: Jedrzej Nowacki
* Fix QScriptEngine::abortEvaluation.Jedrzej Nowacki2010-09-301-2/+5
| | | | | | | | This patch reduce time in which QScriptEngine would abort an script executing multiple long-running native functions. Task-number: QTBUG-9433 Reviewed-by: Olivier Goffart
* Merge commit 'staging-1/4.7' into doc-4.7Morten Engvoldsen2010-09-033-6/+6
|\
| * Reduce memory consumption of QtScript/JSC on SymbianKent Hansen2010-09-021-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Backport of Jay's patch from https://bugs.webkit.org/show_bug.cgi?id=34349 with minor modifications. Even though the original patch was rejected upstream and has been superseded by the patches for https://bugs.webkit.org/show_bug.cgi?id=43185, those patches are more involved (affecting all platforms), hence difficult/risky to backport. Task-number: QTBUG-13361 Reviewed-by: Simon Hausmann
| * doc: Remove \internal tag from QScriptProgramKent Hansen2010-08-312-5/+2
| | | | | | | | | | | | | | | | The class has been there since 4.6 (http://labs.trolltech.com/blogs/2009/11/23/qtscript-in-46/), but we don't see a reason to hide it any longer. Task-number: QTBUG-13229 Reviewed-by: Olivier Goffart
* | Fixed spelling, broken links, and missing default values.Jerome Pasion2010-08-301-1/+1
|/ | | | | Tasks: QTBUG-13271, QTBUG-13212, QTBUG-12321 Reviewer: David Boddie
* Make qsTrId() / QT_TRID_NOOP() accessible from QtScriptKent Hansen2010-08-231-0/+28
| | | | | | | | | QScriptEngine::installTranslatorFunctions() now installs wrapper functions for qsTrId and QT_TRID_NOOP (similar to the existing ones for tr() and translate()). Task-number: QTBUG-8454 Reviewed-by: Jedrzej Nowacki
* Fix memory leak in QtScript variable objectKent Hansen2010-08-102-2/+2
| | | | | | | | | | | | | | | The d-pointer is of type JSVariableObjectData*, but JSVariableObjectData doesn't have a virtual destructor. Hence we must cast the d-pointer to our subclass when deleting. In particular, this will ensure that the destructor of the symbolTable member is called, which will deallocate the table storage. (For QScriptActivationObject this did not cause a leak in practice, because its symbolTable is always empty, and JSC's hash table uses lazy allocation.) Task-number: QTBUG-12479 Reviewed-by: Olivier Goffart
* Correcting spelling mistakes in documentation. Part of fix for QTBUG-11938.Jerome Pasion2010-08-091-1/+1
| | | | | Reviewer: David Boddie Task number: QTBUG-11938
* QScript: remove JSC::JSLockOlivier Goffart2010-07-291-4/+0
| | | | | | They are useless and cause warnings in the code. Reviewed-by: Kent Hansen
* QScript: document/obsolete things that does not work since the move to JSCOlivier Goffart2010-07-295-20/+23
| | | | Reviewed-by: Kent Hansen
* QScriptEngineAgent: recompile all the function when installing a debugger.Olivier Goffart2010-07-272-0/+3
| | | | | | | | | | | | | | Recompile all the function is necessary to ger the debug opcode that notifies us when the position changes. The change in CollectorHeapIterator.h is nessesary to get it work as Debugger::recompileAllJSFunctions uses LiveObjectIterator, LiveObjectIterator initialied m_cell to -1 and to ++(*this) in its constructor. But as m_cell is of type size_t (unsigned) then the < comparison will always fail as it is an unsigned comparison. This was already fixed upstream in r54672 Reviewed-by: Jedrzej Nowacki
* QScriptDeclarativeObject: we need to save the current stack pointer.Olivier Goffart2010-07-271-2/+2
| | | | | | | in DeclarativeObjectDelegate::put, else we cannot get a proper backtrace in the debugger. Reviewed-by: Kent Hansen
* QScriptValue::objectId(): do not assert if the value is not a cellOlivier Goffart2010-07-271-1/+1
| | | | | | JSC::JSValue::asCell asserts if it is not a cell Reviewed-by: Jedrzej Nowacki
* QScriptEngineAgent: ensure that the top of the backtrace is correct in ↵Olivier Goffart2010-07-231-0/+3
| | | | | | exceptionThrow Reviewed-by: Jedrzej Nowacki
* Add missing API shimsKent Hansen2010-07-071-0/+6
| | | | | | | | There were still a couple of functions that didn't have them. This could cause said functions to crash if multiple script engines were being used. Reviewed-by: Jedrzej Nowacki
* Fix conversion between JavaScript Date and QDateTimeKent Hansen2010-06-256-427/+53
| | | | | | | | | | Use JavaScriptCore's conversion functions rather than our own (incomplete) implementation. Specifically, this means daylight saving time is finally handled correctly on Windows. Task-number: QTBUG-9770 Reviewed-by: Olivier Goffart
* Use custom static scopes to improve QML/JavaScript performanceKent Hansen2010-06-257-9/+321
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces a new internal JS object type, QScriptStaticScopeObject, that enables the JS compiler to make more aggressive optimizations of scoped property access. QScriptStaticScopeObject registers all its properties in a symbol table that the JS compiler has access to. If the compiler finds the property in the symbol table, it will generate the fast index-based op_{get,put}_scoped_var bytecodes, rather than the dynamic (slow) op_resolve and friends. If the compiler _doesn't_ find the property in the symbol table, it infers that it's safe to skip the scope object when later resolving the property, which will also improve performance (see op_resolve_skip bytecode). QScriptStaticScopeObject is only safe to use when all relevant properties are known at JS compile time; that is, when a function that has the static scope object in its scope chain is compiled. It's up to the user of the class (e.g. QtDeclarative) to ensure that this constraint is not violated. The API for constructing QScriptStaticScopeObject instances is not public; it lives in QScriptDeclarativeClass for now, an internal class exported for the purpose of QML. The instance is returned as a QScriptValue and can be manipulated like any other JS object (e.g. by QScriptValue::setProperty()). The other part of this commit utilizes QScriptStaticScopeObject in QtDeclarative in the two major places where it's currently possible: 1) QML disallows adding properties to the Global Object. Furthermore, it's not possible for QML IDs and properties to "shadow" global variables. Hence, a QScriptStaticScopeObject can be used to hold all the standard ECMA properties, and this scope object can come _before_ the QML component in the scope chain. This enables binding expressions and scripts to have optimized (direct) access to e.g. Math.sin. 2) Imported scripts can have their properties (resulting from variable declarations ("var" statements) and function declarations) added to a static scope object. This enables functions in the script to have optimized (direct) access to the script's own properties, as well as to global properties such as Math. With this change, it's no longer possible to delete properties of the Global Object, nor delete properties of an imported script. It's a compromise we make in order to make the optimization safe. Task-number: QTBUG-8576 Reviewed-by: Aaron Kennedy Reviewed-by: Olivier Goffart Reviewed-by: Jedrzej Nowacki
* Usefully convert from QtScript object/array to QVariantKent Hansen2010-06-173-17/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For arrays, the conversion would crash if the array was cyclic. Introduce a set that keeps track of which objects are being converted, and return an empty list when a cycle is detected. For other types of objects, the object was previously attempted to be converted to a primitive, which typically meant you would get the string representation ("[object Object]"), since most (practically all) objects can be converted to a string -- not useful at all. Change the conversion so it converts the object to a QVariantMap instead. This was already done for slots that took a QVariantMap as argument, but only one level deep. Make the conversion recursive, using the same mechanism as for arrays to detect cycles. This change also means that you get a meaningful JS object => QVariant => JS object roundtrip. It also aligns the behavior with the Qt WebKit bridge. Update the documentation to describe the new behavior. The 4.7 changelog will also be updated under "important behavioral changes". This change exposed an issue with one of the QML autotests: A JS object was assigned to a QVariant property, which caused it to be converted to a string (rather than a QVariantMap) -- just shows that the previous behavior was unintuitive). Later, this variant property is compared to another object, the intention being to compare the _properties_ of the two objects; but because the variant property contained a string, this would cause the other operand (object) to be converted to a string as well ("[object Object]"), causing a meaningless test pass. Change the test to deserialize both objects using JSON.stringify, and compare the resulting strings, so that actual JS object => QVariant(Map) => JS object roundtrip is tested (the intention). Task-number: QTBUG-3511 Reviewed-by: Olivier Goffart
* Allow to build Qt in static with mingwThierry Bastian2010-06-072-4/+2
| | | | | | | | | | Some functions were marked with Q_DECL_IMPORT where they should just be Q_CORE_EXPORT. The reason is that this macro is expanded to nothing in case of static builds whereas Q_DECL_IMPORT isn't (it is a dllimport). That leads the linker to try to import it and it shouldn't. Task-number: QTBUG-10791 Reviewed-by: gabi
* Ensure that activation object has been created before popping scope of ↵Kent Hansen2010-05-271-0/+1
| | | | | | | | | | | native context One shouldn't have to call activationObject() or scopeChain() before calling popScope(); the scope chain should always have 2 items (activation and global object) before we start popping anything from the internal chain. Task-number: QTBUG-11020 Reviewed-by: Olivier Goffart
* doc: Fixed many broken links.Martin Smith2010-05-191-3/+14
|
* Merge branch 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration ↵Qt Continuous Integration System2010-04-221-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into 4.7-integration * 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration: (71 commits) Revert "Attempt at fixing compile failure introduced by 4.6 merge in qpaintengine_vg.cpp" Attempt at fixing compile failure introduced by 4.6 merge in qpaintengine_vg.cpp Fixing the wrong QUrl usage When on Symbian use smaller files. correctly position glyphs for complex languages Removed inneccessary QGlyphLayout::offsets initialization. Fix mirrored characters for RTL text in Symbian QNAM: Add a code comment related to the cache tst_QSystemSemaphore::processes fixed for WinCE tst_qsystemsemaphore: fix deployment of lackey.exe for WinCE tst_qsharedmemory: create multiple instances of lackey.exe on WinCE tst_qsharedmemory: fix deployment of lackey.exe for WinCE fix compilation of tst_sharedmemory on Windows CE QtScript: regression with instanceof operator for QMetaObject wrappers examples/widgets/stylesheet fix mainwindow.ui QStyleSheetStyle: fix memory leak on base style change QNAM HTTP: Fixed a bug when getting empty files with pipelining Fix window transparency on Symbian. Tweak the 'normalGeometry' of the widget before setting it. Use QDesktopWidget as a status pane observer on Symbian. ...
| * Merge remote branch 'origin/4.6' into qt-4.7-from-4.6Thiago Macieira2010-04-211-1/+1
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/openvg/qpaintengine_vg.cpp src/script/bridge/qscriptqobject_p.h tests/auto/bic/tst_bic.cpp
| | * QtScript: regression with instanceof operator for QMetaObject wrappersKent Hansen2010-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tell JavaScriptCore that QMetaObject wrappers can be used as the second operand to instanceof; this is done by setting the ImplementsHasInstance flag. We don't actually have to implement hasInstance() because the default implementation does the right thing. Task-number: QTBUG-8366 Reviewed-by: Olivier Goffart
* | | QScript: use JSC::NativeFunctionWrapper instead of JSC::PrototypeFunction ↵Olivier Goffart2010-04-193-8/+11
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when possible JSC::NativeFunctionWrapper is a typedef to either JSC::PrototypeFunction or JSC::JSFunction depending if we are running JIT or not. When using JIT, JSC::JSFunction is faster, as it allow JIT to do the native call dirrectly. The difference is that in that case, the JS stack is not fully set up so we have to be carefull. Unfortunately, it is not possible to make FunctionWrapper inherit from JSC::NativeFunctionWrapper, because JSFunction is slightly bigger, and we cannot fit in a Cell Reviewed-by: Kent Hansen
* | Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into ↵Qt Continuous Integration System2010-04-172-2/+19
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4.7-integration * '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (71 commits) Autotest: increase wait time to 3s on Windows to bypass 2s-granularity limitation Autotest: update to the new values for the locale do not expand variables in read()'s file name remove ability to use break() a block outside any loop don't add -unix to the qmake command line Increase the timeout for the QNAM getter test to 30 seconds Remove unstable hosts from the list qdoc: Output TOC for more class ref pages. Other fixes to the remote network stresstester Fix SSL connection problem. Make sure we don't try URLs that aren't HTTP or HTTPS Fix menu bar visibility. Add SSL remote host tests Split the remote and the local tests in two, in preparation for SSL tests Add tests for remote hosts Change the way we calculate the average transfer rates. Finish renaming Move these tests to tests/manual. Add a QNetworkAccessManager stresstest Add a non-blocking native function too ...
| * | Speed up qsTr() by caching the translation contextKent Hansen2010-04-152-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qsTr() uses QFileInfo::baseName() to determine the translation context from a URL. The problem is that creating a QFileInfo object (and thus a file engine object), as well as processing the URL to determine the base name part, is very expensive. By caching the last translation URL and context, qsTr() becomes 5x faster. Only the most recent URL is cached, because a script's text will be translated all at once (as the script is evaluated), so for scripts with multiple translated strings only the first qsTr() call will cause a cache miss. The performance could be improved even further by getting rid of the QFileInfo dependency altogether; created QTBUG-9939 for that since it's a more risky change. Task-number: QTBUG-6908 Reviewed-by: Olivier Goffart
* | | Fix mismatched import declarationsThiago Macieira2010-04-171-1/+1
| | |
* | | Merge remote branch 'origin/4.6' into qt-4.7-from-4.6Olivier Goffart2010-04-162-5/+5
|\ \ \ | |/ / |/| / | |/ | | | | | | | | | | | | | | | | | | | | Conflicts: src/3rdparty/webkit/VERSION src/3rdparty/webkit/WebCore/ChangeLog src/3rdparty/webkit/WebCore/page/FrameView.cpp src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def src/s60installs/bwins/QtCoreu.def src/s60installs/bwins/QtGuiu.def src/s60installs/bwins/QtNetworku.def src/s60installs/eabi/QtGuiu.def tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
| * Symbol visibility fixes for RVCT4 on SymbianIain2010-04-152-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | RVCT 4 is far more strict with regards to symbol visiblity that RVCT 2.2, and will hide symbols unless all references have default visibility in the object files. Update the various places in Qt code where the symbol visibility was set incorrectly for DLL-based platforms (those that use __declspec(dllimport) and (dllexport). Note: QtWebkit and other Qt modules are fixed in different commits. Task-number: QTBUG-9903 Reviewed-by: Jason Barron
| * QtScript: Fix call stack issue with qsTr() when JIT is enabledKent Hansen2010-04-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the JIT is enabled, as well as JIT_OPTIMIZE_NATIVE_CALL defined, NativeFunctionWrapper is a typedef for JSFunction. This has the consequence that the native call frame will not be fully initialized by JIT-generated code (because it shouldn't have to); in particular, ExecState::codeBlock() is not set up. qsTr() relies on codeBlock() to return a sensible value, though, so it breaks this contract. By making qsTr a PrototypeFunction, the JIT will detect that the function call needs more elaborate setup, i.e. initialize codeBlock() as well. Reviewed-by: Olivier Goffart
| * Improve test coverage of QtScript translation functionsKent Hansen2010-04-141-2/+2
| | | | | | | | And fix two silly typos in the error messages.
* | Merge remote branch 'origin/4.6' into qt-4.7-from-4.6Thiago Macieira2010-04-141-3/+13
|\ \ | |/ | | | | | | Conflicts: src/script/api/qscriptengine.cpp
| * Make qsTr work in global scopeKent Hansen2010-04-131-3/+13
| | | | | | | | | | | | | | | | | | | | | | Search up the call stack to find the first non-empty source URL. Also and add an autotest for the QtScript translator functions since there was none (their presence was checked, but not their behavior...). Task-number: QTBUG-9775 Reviewed-by: Olivier Goffart
* | Fix crash on QScriptProgram destructionAaron Kennedy2010-04-121-0/+4
| |
* | Merge remote branch 'origin/4.6' into qt-4.7-from-4.6Thiago Macieira2010-04-092-4/+17
|\ \ | |/
| * Regressions in Global Object prototype accessKent Hansen2010-04-092-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 4.5, changing the prototype of the (custom) global object used to "Just Work"(tm). In the JSC-based back-end, the built-in global object acts as a proxy if a custom global object is set, because JSC doesn't (yet, anyway) provide a way to replace the global object. To complicate this further, we also have a proxy to the original global object (that bypasses the custom global object proxying (!)). This is so that properties of the original global object can still be accessed with the QtScript C++ API when a custom global object has been set. Unfortunately, JSObject::prototype()/setPrototype() are not virtual, meaning that a change of prototype in the source object is not reflected in the proxy or vice versa. Work around this for now by syncing the prototype at the appropriate places (QScriptEngine::setGlobalObject(), QScriptValue::setPrototype()). This fixes all except the case when a prototype is set from JS, since such a write doesn't go through our public C++ API. But this case can be detected and handled by the global object's JSObject::put() reimplementation. Created a separate report for that issue: QTBUG-9737. Task-number: QTBUG-7066 Reviewed-by: Jedrzej Nowacki
* | QScript: more missing APIShimOlivier Goffart2010-04-011-0/+2
| |
* | QScript: fix compilation warningOlivier Goffart2010-04-011-1/+1
| |
* | QScript: fix APIShim usage.Olivier Goffart2010-04-011-1/+1
| | | | | | | | | | APIShim needs to be named, otherwise it is just a temporary and the destructor is called too early
* | QtScript: remove duplicated APIshim in QScriptValueIteratorOlivier Goffart2010-04-011-6/+0
| | | | | | | | | | | | | | Added by both 7a11acd536d84ad22ef98a0fdbdb4322a55efafb and 3e5745ea75d73869918889cb374c3d651bed0991 in different branches. in ~QScriptValueIterator and ~QScriptValueIteratorPrivate Only one is required.
* | Merge remote branch 'origin/4.7' into 4.7Olivier Goffart2010-04-016-6/+68
|\ \ | | | | | | | | | | | | Conflicts: src/gui/text/qstatictext.cpp
| * \ Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into ↵Qt Continuous Integration System2010-03-306-7/+71
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4.7-integration * '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (24 commits) qdoc: Added <div> elements to some html output for class references. Fix compile error on mingw. MONILITY-645 Do not override alternate background color in Plastique Fix QComboBox ignoring foreground role in some styles Fix compilation on HP-UXi: _SC_MONOTONIC_CLOCK isn't defined Fix compilation with Sun CC: Ensure that we return QPair<long,long> in all cases. Update PLATFORM(SPARC64) to CPU(SPARC64) jui files are no c++ ... scan some more file types by default Support EtchDisabledText with spin box on Windows style QNAM HTTP: Fix invoking a method when being destructed right now Fixed a typo in the QDoubleValidotor doc. Trivial fix to JavaScriptCore to fix building with MSVC 2010 Autotest: oops, fix oops: remove qguard from auto.pro Autotests: oops, remove last traces of QGuard Remove QGuard. Unskip test that used to crash QtScript: Add yet more missing API shims ...