8000 no launch app · Issue #22 · benlau/quickflux · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

no launch app #22

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

Open
rodriguez90 opened this issue Jan 4, 2019 · 5 comments
Open

no launch app #22

rodriguez90 opened this issue Jan 4, 2019 · 5 comments

Comments

@rodriguez90
Copy link

hello guys, I'm starting using this extension the flux, but no work in qt 5.12.0. My app and examples don't dispatch any signal.

thanks.

@CaseySanchez
Copy link
CaseySanchez commented Jan 14, 2019

Same here. More specifically, I get this debugger warning upon clicking "Pick Image" in the "Photo Album" example:
Warning: Using function expressions as statements in scripts is not compliant with the ECMAScript specification: "function(dispatcher) { return function() {dispatcher.dispatch(argument..." This will throw a syntax error in Qt 5.12. If you want a function expression, surround it by parentheses. jsruntime\qv4script.cpp: 96

@snowgrains
Copy link

Found the way to fix this. The Qt 5.12 has updated to Ecmascript 7 evaluating the javascript code in qfmiddlewarehook.cpp has a way that new ecma does not understand anymore:

Debugging the issue and I went to look about eval with functions in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval - where it states:
var fctStr1 = 'function a() {}'
var fctStr2 = '(function a() {})'
var fct1 = eval(fctStr1) // return undefined <<< Which is the case in current QuickFlux
var fct2 = eval(fctStr2) // return a function

So I added '(' and ')' signs to QFMiddlewaresHook::setup function's QString source string definitions, like:
QString source = "(function (middlewares, hook) {"
" function create(senderIndex) {"
" return function (type, message) {"
" hook.next(senderIndex, type , message);"
" }"
" }"
" var data = middlewares.data;"
" for (var i = 0 ; i < data.length; i++) {"
" var m = data[i];"
" m._nextCallback = create(i);"
" }"
"})";

and
source = "(function (middlewares, hook) {"
" return function invoke(receiverIndex, type , message) {"
" if (receiverIndex >= middlewares.data.length) {"
" hook.resolve(type, message);"
" return;"
" }"
" var m = middlewares.data[receiverIndex];"
" if (m.filterFunctionEnabled && m.hasOwnProperty(type) && typeof m[type] === "function") { "
" mtype;"
" } else if (m.hasOwnProperty("dispatch") && typeof m.dispatch === "function") {"
" m.dispatch(type, message);"
" } else {"
" invoke(receiverIndex + 1,type, message);"
" }"
" }"
"})";

--> And after this I got all the distpaches working!
@benlau Would you like me todo patch or do you have some other changes in pipeline?

@Buzzroid
Copy link

@snowgrains @benlau I've applied your patches and tried to run the photoalbum app.
It still does not work. Nothing happens after selecting an image file via FileDialog.
Any help?

@snowgrains
Copy link

Good finding. Seems I had older version of the quickflux or my own apps did not use the setCondition. I tested now the latest photoalbum example and got same problem. Qt compile error gave me a hint:

Warning: Using function expressions as statements in scripts is not compliant with the ECMAScript specification:
"function(dispatcher) { return function() {dispatcher.dispatch(argument..."
This will throw a syntax error in Qt 5.12. If you want a function expression, surround it by parentheses.

Which led me to way to find if there are another evaluate strings that should have parenthesis.
So to fix this add parenthesis to file qfappscriptrunnable.cpp
function QFAppScriptRunnable::setCondition(QJSValue condition).

Change QString generator to (added just parenthesis):
QString generator = "(function(dispatcher) { return function() {dispatcher.dispatch(arguments)}})";

@benlau
Copy link
Owner
benlau commented Jan 23, 2019

Hello all,

Sorry for late reply. I was too busy for the last few months..

@snowgrains Thx for the information.

I have pushed a fix for this issue and released v1.1.2 on qpm.

Please check. thx

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

5 participants
0