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

Already on GitHub? Sign in to your account

Investigate Use of QJSEngine for PhantomJS Main Context #11304

Closed
execjosh opened this Issue May 9, 2013 · 7 comments

Comments

Projects
None yet
3 participants
Contributor

execjosh commented May 9, 2013

QJSEngine is a simple wrapper around V8, mainly for use with QtQml. Using QJSEngine for the PhantomJS main context might prove to be more malleable/customizable than the current implementation.

CC: @detro


Problems:

  • Since QJSEngine is a bare-bones ECMAScript-compatible environment, window and other taken-for-granted global objects/functions do not exist, and therefore must be implemented
  • {set,clear}{Timeout,Interval}
  • Easily implemented with QObject::startTimer and overridden QObject::timerEvent
  • console
  • Easily implemented
  • window
  • Is this really necessary for the PhantomJS main context, anyways?
  • etc.
  • Automatic property creation when using dot notation does not work with QObjects added to the QJSEngine
  • An exception is thrown
  • Cannot assign to non-existent property
  • Object.defineProperty can be used as a workaround
  • Uncaught exception within a callback for a signal from a QObject causes a segfault
  • Unsure whether or not this is a general Qt issue...
Collaborator

JamesMGreene commented May 9, 2013

  • Since QJSEngine is a bare-bones ECMAScript-compatible environment, window and other taken-for-granted global objects/functions do not exist, and therefore must be implemented
  • {set,clear}{Timeout,Interval}
  • Easily implemented with QObject::startTimer and overridden QObject::timerEvent
  • console
  • Easily implemented
  • window
  • Is this really necessary for the PhantomJS main context, anyways?
  • etc.

Agreed. Agreed. No, I don't believe we need the window object (but we do need some "global" object, obviously).

  • Automatic property creation when using dot notation does not work with QObjects added to the QJSEngine
  • An exception is thrown
  • Cannot assign to non-existent property
  • Object.defineProperty can be used as a workaround

Wow, that one is really painful for everyone. 😲

  • Uncaught exception within a callback for a signal from a QObject causes a segfault
  • Unsure whether or not this is a general Qt issue...

Hmm, interesting.

Contributor

execjosh commented May 9, 2013

There is a "global" object that QJSEngine provides :)

Collaborator

JamesMGreene commented May 9, 2013

I assumed so, much like in Node.js.

Contributor

execjosh commented May 10, 2013

I've started a repo with some examples of the issues I've encountered (I know this might have been better as a gist; but, gist is 404-ing me right now...).

Owner

ariya commented May 20, 2013

I'm still in the opinion that using another engine is not buying us anything.

My proposed solution to a new REPL (though I'm guilty of not researching further): treat it as a text-mode front-end to the awesome Web Inspector. We already support remote debugging, so it's likely a matter to connecting via the right protocol and having the console interface.

Collaborator

JamesMGreene commented Jun 3, 2013

Cross-reference: #11180

Owner

ariya commented Aug 18, 2014

QJEngine does not use v8 anymore, switching to an in-house JavaScript engine. I don't think we would be using it, just because it's another JS environment with potential surprises and gotchas.

@ariya ariya closed this Aug 18, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment