~ubuntu-branches/ubuntu/vivid/unity-webapps-qml/vivid

« back to all changes in this revision

Viewing changes to tests/integration/autopilot/qml/message-server.js

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Alexandre Abreu
  • Date: 2014-07-09 20:05:56 UTC
  • mfrom: (1.1.34)
  • Revision ID: package-import@ubuntu.com-20140709200556-9jn0dwr8grb7364a
Tags: 0.1+14.10.20140709-0ubuntu1
[ Alexandre Abreu ]
Fix issue with qmlplugindump using 100% cpu Fix and expanded AP
tests to properly test the installed webapps case (LP: #1300957)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2014 Canonical Ltd.
 
2
 
 
3
// This library is free software; you can redistribute it and/or
 
4
// modify it under the terms of the GNU Lesser General Public
 
5
// License as published by the Free Software Foundation; either
 
6
// version 2.1 of the License, or (at your option) any later version.
 
7
 
 
8
// This library is distributed in the hope that it will be useful,
 
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
// Lesser General Public License for more details.
 
12
 
 
13
// You should have received a copy of the GNU Lesser General Public
 
14
// License along with this library; if not, write to the Free Software
 
15
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
16
 
 
17
oxide.addMessageHandler("EVALUATE-CODE", function(msg) {
 
18
    var code = msg.args.code;
 
19
    if (msg.args.wrap) {
 
20
        code = "(function() {" + code + "})()";
 
21
    }
 
22
    try {
 
23
        var result = eval(code);
 
24
        msg.reply({result: result});
 
25
    } catch(e) {
 
26
        msg.error("Code threw exception: \"" + e + "\"");
 
27
    }
 
28
});
 
29