This discussion is archived
12 Replies Latest reply: Jan 24, 2012 1:46 PM by 735285 RSS

Corruption of non-HTML files with oracle_smp_chronos.js script element

560761 Newbie
Currently Being Moderated
When serving a JavaScript file through the portal, the server always appends:

<SCRIPT SRC="/oracle_smp_chronos/oracle_smp_chronos.js"></SCRIPT>

which causes a JavaScript syntax error in the browser.

Why does it append this HTML element to a JS file ?
How can I stop it ?

Mik
  • 1. Re: Corruption of non-HTML files with oracle_smp_chronos.js script element
    560761 Newbie
    Currently Being Moderated
    It appears that Oracle end-user performance monitoring framework is the culprit for appending the oracle_smp_chronos.js SCRIPT element. So I suppose one 'workaround' is to turn off performance monitoring.

    Note that just slapping a SCRIPT element at the end of everything will even make an HTML page not-well-formed, because it will come after the closing </html> tag.
    What the hack !

    Mik
  • 2. Re: Corruption of non-HTML files with oracle_smp_chronos.js script element
    560761 Newbie
    Currently Being Moderated
    The first things I checked were that the JavaScript file was being served with a .js filetype URL and a text/javascript MIME type response, so that if the Oracle performance monitoring system had any sensible non-brain-dead policy, it wouldn't attach the HTML element to a non-HTML file. But no such luck, it slapped it on the end anyway.

    So, I bypassed the offending portal server, and fetched the files directly from the portlet container web app (aka cross-server scripting !). This worked around the original problem: the JavaScript was now getting into the browser uncorrupted.

    But, the portlet HTML content was still going through the portal server, so the whole page was still getting the chronos SCRIPT element - actually each portlet HTML fragment was getting a SCRIPT element, so there were multiple copies in the page ! Either there is a bug in the chronos script, or the multiple inclusion causes a problem, because there is now a JS error in the page:

    if (evt.target.orig_onS5qb812) !"£$%^&* evt has no properties

    What the hack ?
    Mik
  • 3. Re: Corruption of non-HTML files with oracle_smp_chronos.js script element
    560761 Newbie
    Currently Being Moderated
    I prevented multiple occurrences of the chronos SCRIPT in the page,
    and it appears to be a bug in the chronos script itself,
    so a shallow fix would be something like:

    if ((evt != undefined) &&
    (evt.target != undefined) &&
    (evt.target.orig_onS5qb812 != undefined))
    return evt.target.orig_onS5qb812(evt);

    What the hack,
    Mik
  • 4. Re: Corruption of non-HTML files with oracle_smp_chronos.js script element
    508509 Newbie
    Currently Being Moderated
    FYI:
    I was running into a similar problem with the js file always appending to ajax requests. After much trial and error, I found that changing the content type to text/plain prevented the js file from appending. I didn't try it, but I imaging setting it to xml would work too.

    response.setContentType("text/plain");

    Hope this helps someone out there.
  • 5. Re: Corruption of non-HTML files with oracle_smp_chronos.js script element
    494190 Newbie
    Currently Being Moderated
    If you are using an application process for AJAX functionality just add this code after 'BEGIN' in you process and this will take care of the problem.


    OWA_UTIL.mime_header ('text/xml', FALSE);
    HTP.p ('Cache-Control: no-cache');
    HTP.p ('Pragma: no-cache');
    OWA_UTIL.http_header_close;

    I hope this helps
  • 6. Re: Corruption of non-HTML files with oracle_smp_chronos.js script element
    447510 Newbie
    Currently Being Moderated
    Even we have a similar problem.

    Not sure where to add this piece of code? On chronos.js file?. Could someone provide more insight into this?

    f ((evt != undefined) &&
    (evt.target != undefined) &&
    (evt.target.orig_onS5qb812 != undefined))
    return evt.target.orig_onS5qb812(evt);
  • 7. Re: Corruption of non-HTML files with oracle_smp_chronos.js script element
    447510 Newbie
    Currently Being Moderated
    I tried adding the script in the oracle_smp_chronos.js file, however it did not resolve the issue.

    Perhaps I am missing something very obvious?

    Any other work around for this?

    Thanks
  • 8. Re: Corruption of non-HTML files with oracle_smp_chronos.js script element
    621225 Newbie
    Currently Being Moderated
    i am facing a similar issue...though i am not sure where should one add the script. I tried adding the same in my .js files and it didnt work.

    Can some one provide any help on this...its pretty urgent.
  • 9. Re: Corruption of non-HTML files with oracle_smp_chronos.js script element
    447510 Newbie
    Currently Being Moderated
    In our envirnoment this was happening as a result of enabling the 'End User perfomance Monitoring' . If you disable this under Web Cache, this issue could be resolved.

    There is another way to solve is to create exception rules for .js and .csv files. So these files will not be monitored.
  • 10. Re: Corruption of non-HTML files with oracle_smp_chronos.js script element
    447510 Newbie
    Currently Being Moderated
    Besides I guess there is a bug in the chronos script, that's why all js files are having this issue.
  • 11. Re: Corruption of non-HTML files with oracle_smp_chronos.js script element
    643747 Newbie
    Currently Being Moderated
    The script only uses the event to find the HTMLEntity where the handler was originally called - it then uses this reference to locate the original handler which it replaced - and calls it.

    Things really start to get messy when you use a LINK to submit a form....the original javascript probably does something like this:

    if ((!form.onsubmit) || form.onsubmit()) form.submit();

    Chances are, the original onclick handler did not pass the event, and the event does not get passed to form.onsubmit(). Even if it did that just pushes the error further down - because oracle_smp_chronos.js replaces the onsubmit for forms too. So what happens is:

    user clicks link, this calls Oracles handler
    Oracles Handler does its thing, then identifies the link from the event and calls the original handler
    Original Handler calls form.onsubmit, passing on the event
    but since the onsubmit method has been replaced, its actually calling Oracle's handler again, which does its thing again, then sees that the event references the LINK (not the form) so it calls the backed up Original handler
    Original Handler calls form.onsubmit()

    ...and so on until the stack overflows.

    In the version I've got, this only happens where oracle_smp_chronos thinks the browser is Netscape Navigator or one of its descendants. There is a seperate branch of code for MSIE - it uses 'this' to track back to the original code, ignoring the event. Ironicaly, the MSIE code runs fine in Mozilla 5, and any version of Firefox (I don't have a copy of Navigator v4 to test) so a better solution would be to change the browser identification code to treat everything as MSIE

    HTH

    C.
  • 12. Re: Corruption of non-HTML files with oracle_smp_chronos.js script element
    735285 Newbie
    Currently Being Moderated
    Hi,

    For me to get this issue solve, what I did was modify the file oracle_smp_chronos.js

    if (m_f.onsubmit)
    if (m_f.onsubmit.toString() !=
    m_f.orig_onS5qb812 = m_f.onsubmit;
    m_f.onsubmit = null;

    I changed the m_f.onsubmit = oem_onS5qb812; to m_f.onsubmit = null; and now the submit is working fine.