LSS-Manager / LSSM-V.4

The Official Repository for LSS Manager V4
https://lss-manager.de
Other
56 stars 92 forks source link

[BUG]: window.tellParent is not affected by transpiling #52

Closed jxn-30 closed 4 years ago

jxn-30 commented 4 years ago

Describe what happens window.tellParent takes a string as parameter that is executed with eval. Problem: Code in string is not transpiled. Older browsers can be incompatible.

How to reproduce?

  1. Use a browser that does not support optional chaining
  2. native script browserTitle does not work as ?. will produce a syntax error.

Expected behavior code used in window.tellParent must be transpiled before. Solution: create a store action tellParent that accepts a function as parameter and stringifies it. Then call window.tellParent. Working example:

tellParent(`(${(() => console.log('hello world!')).toString()})()`);

possible standalone function:

const tellParent = fun => window.tellParent(`(${fun.toString()})()`);

Screenshots –– no screenshots here ––

Further notes:

Further ––– no further notes –––

jxn-30 commented 4 years ago

Provieded browser compatibility manually for browserTitle. As window.tellParent is not used anywhere else, it is currently to compley to provide a store action. Can be reopened if requried and a store action can be made easily