Bug 36603 - [Qt] QScriptEngine doesn't give an access to global object
Summary: [Qt] QScriptEngine doesn't give an access to global object
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Jędrzej Nowacki
URL:
Keywords: Qt
Depends on:
Blocks: 31863
  Show dependency treegraph
 
Reported: 2010-03-25 08:01 PDT by Jędrzej Nowacki
Modified: 2010-03-28 03:04 PDT (History)
3 users (show)

See Also:


Attachments
Fix v1 (4.62 KB, patch)
2010-03-25 08:09 PDT, Jędrzej Nowacki
no flags Details | Formatted Diff | Diff
Fix v2 (4.62 KB, patch)
2010-03-25 08:42 PDT, Jędrzej Nowacki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jędrzej Nowacki 2010-03-25 08:01:27 PDT
The QScriptEngine should be used to retrieve a global object.
http://qt.nokia.com/doc/4.6/qscriptengine.html#globalObject
Comment 1 Jędrzej Nowacki 2010-03-25 08:09:46 PDT
Created attachment 51642 [details]
Fix v1

New API
Comment 2 WebKit Review Bot 2010-03-25 08:11:34 PDT
Attachment 51642 [details] did not pass style-queue:

Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
WARNING: File exempt from style guide. Skipping: "JavaScriptCore/qt/api/qscriptengine_p.cpp"
JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp:63:  Missing space after ,  [whitespace/comma] [3]
WARNING: File exempt from style guide. Skipping: "JavaScriptCore/qt/api/qscriptengine_p.h"
WARNING: File exempt from style guide. Skipping: "JavaScriptCore/qt/api/qscriptengine.cpp"
WARNING: File exempt from style guide. Skipping: "JavaScriptCore/qt/api/qscriptengine.h"
Total errors found: 1 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Jędrzej Nowacki 2010-03-25 08:42:47 PDT
Created attachment 51643 [details]
Fix v2

Fix the space after comma...
Comment 4 Kent Hansen 2010-03-26 02:17:27 PDT
Comment on attachment 51643 [details]
Fix v2

> +        QScriptEngine API was enriched by globalObject() method
> +        which give an access to the global object.

Grammar nitpick: "gives access to..."

> +void tst_QScriptEngine::globalObject()
> +{
> +    QScriptEngine engine;
> +    QScriptValue global = engine.globalObject();
> +    QScriptValue self = engine.evaluate("this");
> +    QVERIFY(global.isObject());
> +    QVERIFY(engine.globalObject().equals(engine.evaluate("this")));
> +    QEXPECT_FAIL("", "strictlyEquals is broken - bug 36600 in bugs.webkit.org", Continue);
> +    QVERIFY(engine.globalObject().strictlyEquals(self));
> +}

We're starting to need property() and setProperty() now; then this test could verify that global variables introduced by evaluate() are reflected by global.property(), and global.setProperty() calls are reflected by evaluate(), since that is a rather crucial feature. Remember to update this test once that API is added.
The rest of the patch looks good.
Comment 5 WebKit Commit Bot 2010-03-28 03:03:56 PDT
Comment on attachment 51643 [details]
Fix v2

Clearing flags on attachment: 51643

Committed r56686: <http://trac.webkit.org/changeset/56686>
Comment 6 WebKit Commit Bot 2010-03-28 03:04:01 PDT
All reviewed patches have been landed.  Closing bug.