Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-47254

not checked engine from QScriptValue::call

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.4.0
    • Qt Script
    • None

    Description

      QScriptEngine firstEngine;
      QScriptEngine twoEngine;
      firstEngine.evaluate(
          "function see(a){"
          "  print ('typeof a = '+ typeof a); "
          "  print ('typeof a.test = '+ typeof a.test); "
          "  print(' a = ' + a ); "
          "}"
      );
      {
          QScriptValue argsCall = twoEngine.newArray(1);
          argsCall.setProperty("0", 5 );
          firstEngine.globalObject().property("see").call(
              firstEngine.globalObject(),
              argsCall
          );
      }
      {
          QScriptValue argsCall = twoEngine.newArray(1);
          QScriptValue args1_obj = twoEngine.newObject();
          args1_obj.setProperty("test","1");
          argsCall.setProperty("0", args1_obj );
          firstEngine.globalObject().property("see").call(
              firstEngine.globalObject(),
              argsCall
          );
      }
      

      Result of run code :
      typeof a = number
      typeof a.test = undefined
      a = 5
      typeof a = object
      typeof a.test = undefined

      But this is code should throw some errors, because call to QScriptEngine::call arguments not belong engine for this.

      Sorry, i'm use translate.google.com (

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            laknoll Lars Knoll
            Dart_Sergius Sergey Turovsky
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes