Changeset 60583 in webkit
- Timestamp:
- Jun 2, 2010 5:27:42 PM (14 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r60577 r60583 1 2010-06-02 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 New function QScriptEngine::newObject. 6 7 The function creates a object of class Object and returns it 8 as a QScriptValue. 9 10 [Qt] QScriptEngine API should contain a newObject function 11 https://bugs.webkit.org/show_bug.cgi?id=39114 12 13 * qt/api/qscriptengine.cpp: 14 (QScriptEngine::newObject): 15 * qt/api/qscriptengine.h: 16 * qt/api/qscriptengine_p.cpp: 17 (QScriptEnginePrivate::newObject): 18 * qt/api/qscriptengine_p.h: 19 * qt/tests/qscriptengine/tst_qscriptengine.cpp: 20 (tst_QScriptEngine::newObject): 21 1 22 2010-06-02 Gabor Loki <loki@webkit.org> 2 23 -
trunk/JavaScriptCore/qt/api/qscriptengine.cpp
r59503 r60583 194 194 195 195 /*! 196 Creates a QtScript object of class Object. 197 198 The prototype of the created object will be the Object 199 prototype object. 200 201 \sa newArray(), QScriptValue::setProperty() 202 */ 203 QScriptValue QScriptEngine::newObject() 204 { 205 return QScriptValuePrivate::get(d_ptr->newObject()); 206 } 207 208 /*! 196 209 Returns this engine's Global Object. 197 210 -
trunk/JavaScriptCore/qt/api/qscriptengine.h
r59503 r60583 51 51 QScriptValue nullValue(); 52 52 QScriptValue undefinedValue(); 53 QScriptValue newObject(); 53 54 QScriptValue globalObject() const; 54 55 private: -
trunk/JavaScriptCore/qt/api/qscriptengine_p.cpp
r57637 r60583 78 78 } 79 79 80 QScriptValuePrivate* QScriptEnginePrivate::newObject() const 81 { 82 return new QScriptValuePrivate(this, JSObjectMake(context(), /* jsClass */ 0, /* userData */ 0)); 83 } 84 80 85 QScriptValuePrivate* QScriptEnginePrivate::globalObject() const 81 86 { -
trunk/JavaScriptCore/qt/api/qscriptengine_p.h
r58483 r60583 57 57 inline JSValueRef makeJSValue(QScriptValue::SpecialValue value) const; 58 58 59 QScriptValuePrivate* newObject() const; 59 60 QScriptValuePrivate* globalObject() const; 60 61 -
trunk/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp
r59503 r60583 36 36 37 37 private slots: 38 void newObject(); 38 39 void globalObject(); 39 40 void evaluate(); … … 55 56 QVERIFY2(engine.evaluate("1+1").isValid(), "the expression should be evaluated and an valid result should be returned"); 56 57 QVERIFY2(engine.evaluate("ping").isValid(), "Script throwing an unhandled exception should return an exception value"); 58 } 59 60 void tst_QScriptEngine::newObject() 61 { 62 QScriptEngine engine; 63 QScriptValue object = engine.newObject(); 64 QVERIFY(object.isObject()); 65 QVERIFY(object.engine() == &engine); 66 QVERIFY(!object.isError()); 67 QVERIFY(!object.equals(engine.newObject())); 68 QVERIFY(!object.strictlyEquals(engine.newObject())); 69 QCOMPARE(object.toString(), QString::fromAscii("[object Object]")); 57 70 } 58 71
Note: See TracChangeset
for help on using the changeset viewer.