DWR

"dwr not defined" when refreshing/leaving a page with Reverse Ajax enabled.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0.2
  • Fix Version/s: 2.0.2
  • Component/s: Engine
  • Description:
    Hide
    When I leave/refresh a page with Reverse Ajax enabled, i frequently get this error:

    error: dwr is not defined
    in: engine.js (line 653)
    line 653: batch.req.onreadystatechange = function() { dwr.engine._stateChange(batch); };

    The error always appears 3 times consecutively when it happens.

    I'm using Reverse Ajax in Polling-only mode with 5 second poll windows.
    Show
    When I leave/refresh a page with Reverse Ajax enabled, i frequently get this error: error: dwr is not defined in: engine.js (line 653) line 653: batch.req.onreadystatechange = function() { dwr.engine._stateChange(batch); }; The error always appears 3 times consecutively when it happens. I'm using Reverse Ajax in Polling-only mode with 5 second poll windows.

Activity

Hide
Matan added a comment - 24/Jun/07 10:37 AM

I've found the root of the problem. Hopefully there is a way of fixing this with DWR.

I have "onunload" window events that use DWR remote calls without any callbacks. The calls are made successfully all the time, but it seems that because they're done during the "unload" event, the error happens as well.

Can this easily be fixed? Maybe some call parameter that changes the behavior not to expect and stateChanges so it can be used during unload?

Show
Matan added a comment - 24/Jun/07 10:37 AM I've found the root of the problem. Hopefully there is a way of fixing this with DWR. I have "onunload" window events that use DWR remote calls without any callbacks. The calls are made successfully all the time, but it seems that because they're done during the "unload" event, the error happens as well. Can this easily be fixed? Maybe some call parameter that changes the behavior not to expect and stateChanges so it can be used during unload?
Hide
Matan added a comment - 24/Jun/07 12:54 PM

I found a quick patch that seems to work great:

line 653: batch.req.onreadystatechange = function() { dwr.engine._stateChange(batch); };

should be modified to:

line 653: batch.req.onreadystatechange = function() { if ((typeof(dwr) != "undefined")) dwr.engine._stateChange(batch); };

Might want to add that for the next release.

Show
Matan added a comment - 24/Jun/07 12:54 PM I found a quick patch that seems to work great: line 653: batch.req.onreadystatechange = function() { dwr.engine._stateChange(batch); }; should be modified to: line 653: batch.req.onreadystatechange = function() { if ((typeof(dwr) != "undefined")) dwr.engine._stateChange(batch); }; Might want to add that for the next release.
Hide
Hani Suleiman added a comment - 13/Aug/07 3:06 PM

We're running into this issue as well, and it'd be great if it were committed to the official engine.js

Show
Hani Suleiman added a comment - 13/Aug/07 3:06 PM We're running into this issue as well, and it'd be great if it were committed to the official engine.js
Hide
Rob Moore added a comment - 31/Oct/07 11:35 PM

I second Hani's motion. We've had success with the suggested fix but would like to do away with our static engine.js.

Show
Rob Moore added a comment - 31/Oct/07 11:35 PM I second Hani's motion. We've had success with the suggested fix but would like to do away with our static engine.js.
Hide
Joe Walker added a comment - 01/Nov/07 2:34 PM

This has been fixed for a while in HEAD, but I've now added the fix to the 2.0 branch, and it should go out in 2.0.2

Show
Joe Walker added a comment - 01/Nov/07 2:34 PM This has been fixed for a while in HEAD, but I've now added the fix to the 2.0 branch, and it should go out in 2.0.2

People

Dates

  • Created:
    24/Jun/07 10:17 AM
    Updated:
    29/Feb/08 10:29 AM
    Resolved:
    01/Nov/07 2:34 PM