Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS engine can't parse class private methods #329

Closed
Magistone opened this issue Nov 22, 2021 · 2 comments
Closed

JS engine can't parse class private methods #329

Magistone opened this issue Nov 22, 2021 · 2 comments

Comments

@Magistone
Copy link

Operating System Info

Windows 10

Other OS

No response

OBS Studio Version

27.1.3

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/2VzpKM_-cgb4287C

OBS Studio Crash Log URL

No response

Expected Behavior

Expected the JS engine to parse the js code successfully

Current Behavior

When the OBS browser JS engine tries to parse the source it logs an error in console at #privateMethod() with the error unexpected token (
Private fields nor public methods are not affected

Steps to Reproduce

  1. Use sample code from the official documentation (copy bellow)
class ClassWithPrivateField {
  #privateField;
}

class ClassWithPrivateMethod {
  #privateMethod() {
    return 'hello world';
  }
}

class ClassWithPrivateStaticField {
  static #PRIVATE_STATIC_FIELD;
}

class ClassWithPrivateStaticMethod {
  static #privateStaticMethod() {
    return 'hello world';
  }
}
  1. add include the js file with the code above to an html file as <script src="theFile.js"></script>
  2. load the created html file in OBS
  3. Open devtools in your browser, select the loaded file. In console there will be error message Uncaught SyntaxError: Unexpected token on the line with #privateMethod()

Screenshot from OBS devtools
image

Anything else we should know?

The files in the provided log are custom code, currently unavailable to the public. However, I did confirm that the example given with the copy of syntax code triggers the bug as well.

@notr1ch notr1ch transferred this issue from obsproject/obs-studio Nov 22, 2021
@notr1ch
Copy link
Member

notr1ch commented Nov 22, 2021

Per https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields#browser_compatibility, private class methods are not supported by the CEF version used in OBS. Work is underway to update CEF but it is a large undertaking.

@notr1ch notr1ch closed this as completed Nov 22, 2021
@Fenrirthviti
Copy link
Member

Status on the upgrade can be followed here: obsproject/obs-studio#3853

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants