Project

General

Profile

Actions

Bug #3229

closed

Com bool values not handled correctly

Added by S Reject over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Scripting
Target version:
Start date:
01/26/2017
Due date:
% Done:

0%

Estimated time:
Operative System:
All
Regression:
No

Description

When passing a boolean value into a comcall as an argument the mSL input value is not (correctly) converted to a boolean value. When a com result returns a boolean value, the value should be converted to either $true or $false

;; Test on adiirc 32bit without tsc.dll uninstalled

alias booltest {
  var %error
  var %js = (function(){getTrue=function(){return true};getFalse=function(){return false};input=function(input){return input}})();

  .comopen booltest MSScriptControl.ScriptControl
  if (!$com(booltest)) {
    %Error = Failed to create ScriptControl instance
  }
  elseif (!$com(booltest, language, 4, bstr, jscript) || $comerr) {
    %Error = Failed to set language
  }
  elseif (!$com(booltest, ExecuteStatement, 1, bstr, %js) || $comerr) {
    %Error = Failed to initialize js
  }
  elseif (!$com(booltest, eval, 1, bstr, this, dispatch* booltest/js) || $comerr || !$com(booltest/js)) {
    %Error = Failed to retrieve pointer to js instance
  }
  else {

    ;; retriving bool values from result  
    noop $com(booltest/js, getTrue, 1)
    echo -a This should be $true instead its: $com(booltest/js).result

    noop $com(booltest, getFalse, 1)
    echo -a This should be $false instead its: $com(booltest/js).result

    ;; passing in boolean values
    noop $com(booltest/js, input, 1, bool, $true)
    echo -a This should be $true instead its: $com(booltest/js).result

    noop $com(booltest/js, input, 1, bool, $false)
    echo -a This should be $false instead its: $com(booltest/js).result

  }
  :error
  if ($com(booltest/js)) .comclose $v1
  if ($com(booltest)) .comclose $v1
  if ($error || %Error) {
    echo -s Error: $v1
    reseterror
  }
}
Actions

Also available in: Atom PDF