cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1802
Views
5
Helpful
1
Replies

CAXL Library - jabberwerx.js code is setting Date.prototype.toJSON()

EU UC Support
Level 4
Level 4

We have an application built on the same lines as non-gadget finesse application using jabberwerx.js which is part of Cisco CAXL library released as part of CUP (CAXL version: v2014.04) and noticed that jabberwerx.js has following as part of its code:

    function toIntegersAtLease(n) 
    // Format integers to have at least two digits.
    {    
        return n < 10 ? '0' + n : n;
    }

    Date.prototype.toJSON = function(date)
    // Yes, it polutes the Date namespace, but we'll allow it here, as
    // it's damned usefull.
    {
        return this.getUTCFullYear()   + '-' +
             toIntegersAtLease(this.getUTCMonth()) + '-' +
             toIntegersAtLease(this.getUTCDate());
    };

Now this code not just pollutes the Date namespace but is actually overriding the standard toJSON() implementation and inturn breaks lot javascript frameworks that rely on the standard definition.

 

Now, the questions really are:

  • does the library itself relies on this modified toJSON() definition, if so what all are the dependencies on these? If in case it does rely on this updated definition, the library should have used a custom function with this definition instead of doing something that breaks standard implementation.
  • if library doesn't rely on this non-standard implementation, can this part of code be removed/commented/overridden by application without Cisco support implications.
  • If Cisco can release a patch/fix with this fixed (code removed/updated) and if yes, how soon?

 

A prompt response on this will be much appreciated as this has an important business case which is being discussed in parallel via a separate SR.

 

PS - The code snippet included in this discussion is not sensitive/confidential information as this is published by cisco as part of debug version of CAXL release  [Reference Link: CAXL Downloads]. 

 

1 Accepted Solution

Accepted Solutions

npetrele
Cisco Employee
Cisco Employee

You can safely comment out that snippet of code. It's actually part of jQuery, which is included in the jabberwerx.js file. As far as I can tell, it's never actually used in the Jabber IM Web SDK.

View solution in original post

1 Reply 1

npetrele
Cisco Employee
Cisco Employee

You can safely comment out that snippet of code. It's actually part of jQuery, which is included in the jabberwerx.js file. As far as I can tell, it's never actually used in the Jabber IM Web SDK.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: