Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4718

PerformanceMeter breaks zkau requests communication

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 9.5.0, 9.5.0.1
    • Fix Version/s: 9.5.1, 9.5.0.2
    • Component/s: ZK Client Engine
    • Security Level: Jimmy
    • Labels:

      Description

      Steps to Reproduce

      Create any implementation of org.zkoss.zk.ui.util.PerformanceMeter (or use performanceMonitor)

      Register in listener in zk.xml

      Current Result

      Any zkau request will fail with

      "Server unavailable, (req) is not defined (reference Error)"

      Expected Result

      No error

      Debug Information

      Cause by ZK-4175

       https://github.com/zkoss/zk/commit/b361b3ab2e72a4635b5d9148f64fcc7d558c8771#diff-d6bd5b107b7b1cf3580b23ef1a5fe3aff40cfcf41c9ae67c3bb5c449486967efL919-L921

       

      the req variable no longer exists, causing reference error when zk.perfMon is set.

      Workaround

       

      <script><![CDATA[
          zk.afterLoad("zk", function () {
              var _xzAu = {};
              console.log("zk loaded")
              zk.override(zAu, _xzAu, {
                  _onResponseReady: function (response) {
                      var reqInf = zAu.ajaxReqInf, sid;
                      try {
                          if (response && response.ok) {
                              zAu.ajaxReq = zAu.ajaxReqInf = null;
                              if (zk.pfmeter) zAu._pfrecv(reqInf.dt, zAu.pfGetIds(response));
          
                              sid = response.headers.get('ZK-SID');
          
                              var rstatus;
                              if ((rstatus = response.status) == 200) { //correct
                                  if (zAu._respSuccess(response, reqInf, sid)) return;
                              } else if ((!sid || sid == zAu.seqId) //ignore only if out-of-seq (note: 467 w/o sid)
                              && !zAu.onResponseError(response, zAu._errCode = rstatus)) {
                                  if (zAu._respFailure(response, reqInf, rstatus)) return;
                              }
                          }
                      } catch (e) {
                          if (zAu._respException(response, reqInf, e)) return;
                      }
          
                      zAu.afterResponse(sid);
                  }
               });
          });
      ]]></script> 

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Leon03 Leon03
              Reporter:
              MDuchemin MDuchemin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 2 hours
                  2h
                  Remaining:
                  Remaining Estimate - 2 hours
                  2h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified