I'm seeing an error when I attempt to pass a function as a parameter, but only after the containing object has made a round trip as a lightning attribute. I've reproduced this in very few lines of code as follows:


<aura:component >
    <aura:attribute name="obj" type="object" />
    <aura:handler name="init" value="{!this}" action="{!c.init}" />

    <button onclick="{!c.go}">Click Me</button>


    init : function(component, event, helper) {
        helper.init(component, event);
    go : function(component, event, helper) {
        helper.go(component, event);


    init : function(cmp, ev) {
        var obj={method : function() {alert('In function');}};
        cmp.set('v.obj', obj);
    go : function(cmp) {
        var obj=cmp.get('v.obj');
    fireCallback : function(cb) {

The flow is:

  • The component fires the init function which creates a JavaScript object with a function named 'method' and stores this as an attribute named 'obj'
  • The user clicks the 'go' button which invokes the go method
  • The 'obj' attribute is retrieved
  • The helper method 'fireCallback' is invoked, passing the obj.method function as a parameter
  • The fireCallback executes the function it received as a parameter
  • The following exception occurs:

Something has gone wrong. Action failed: c$LockerTest$controller$go [Error: Permission denied to access property "$lsref"] Failing descriptor: {c$LockerTest$controller$go}. Please try again.

If I change the flow so that I invoke the obj.method function directly in the go function, everything works as expected, so it doesn't look like the locker service is blocking access to the function, it just seems to go bad when passed as a parameter to another method.

This also only happens when I store the object as an attribute and retrieve it again - which turns it into a SecureObject - so it looks like the issue is that I can't pass a SecureObject function as a parameter to another method in the same object which then invokes it.

  • sometimes you just see such posts and upvote it ;)
    – Mr.Frodo
    Jun 9, 2016 at 15:06

1 Answer 1


Definitely an LS issue - $lsref is a secure back ref that is a "secured method" that is part of LS's internals and it looks like LS's own code that deals with proxying and unproxying is causing this. Please open a case with Salesforce support and post the academy ID here so I can stay in the loop. I've opened a bug W-3187486 to track this that you can let our support team know I've created so they can link it to the case

  • Thanks for the info Doug - I've raised a case, #13986090. Jun 9, 2016 at 17:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .