[ 
https://issues.apache.org/jira/browse/CB-604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13472702#comment-13472702
 ] 

Walter Rumsby commented on CB-604:
----------------------------------

Looking into this, it seems like the problem is caused by the private [getTrace 
function|https://github.com/apache/incubator-cordova-weinre/blob/master/weinre.web/modules/weinre/common/StackTrace.coffee#L42]
 defined in the {{StackTrace}} module.

My guess is that when Weinre instruments the code it instruments strict mode 
code where accessing {{caller}} is illegal. Walking the call stack (to get the 
stack trace) and strict mode are [at odds with each 
other|https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Functions_and_function_scope/Strict_mode#.22Securing.22_JavaScript],
 so I'm not really sure how you could provide a strict mode compliant 
implementation without there being an endorsed way of accessing the call stack. 
Maybe a browser extension could provide a solution here (I'm speculating, I 
have no idea if that's possible)?

The current situation isn't great. I want to write my JavaScript using strict 
mode, it helps identify errors and potential problems every day saving me a 
great deal of time. I also want to use Weinre for those times I need to debug 
on a tablet, etc.

Would providing a distribution of Weinre that doesn't provide a Stack Trace be 
feasible? e.g. Folks who use strict mode would load 
{{target-script-no-stacktrace-min.js}} rather than {{target-script-min.js}}.


                
> doesn't work in strict mode
> ---------------------------
>
>                 Key: CB-604
>                 URL: https://issues.apache.org/jira/browse/CB-604
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: weinre
>         Environment: ubuntu/windows
>            Reporter: hongbo lu
>            Assignee: Patrick Mueller
>
> weinre doesn't work in strict mode ,because it trys to access "func.caller" 
> which isn't allowed in strict mode

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to