Opened 9 years ago

Closed 7 years ago

#11866 closed defect (wontfix)

TabContainer: odd behavior in canceling in-flight XHRs

Reported by: kpkeerthi Owned by: bill
Priority: high Milestone: 1.9
Component: Dijit Version: 1.4.3
Keywords: Cc:
Blocked By: Blocking:

Description

Please see sample code attached.

What it is? It is a tabcontainer with 3 tabs and one nested tab.

What does it (the code) do? When a tab is clicked, any in-flight XHR pending with the previously selected tab is canceled. This is achieved subscribing to "<tabcontainer-widgetId>-selectChild" topic. We do this to save unnecessary hits from the tabs that are not currently selected.

What is the issue? The code cancels in-flight XHR of a tab (say t1) when a new tab t2 is clicked/selected. When the same tab t1 is selected again, dojo fires a new XHR and loads t1 with its content. This is the expected behavior. But this works only for the tabs that are not nested. Dojo cancels the inflight XHR of a nest tab n1 just fine. But when n1 is selected again, it does not fire new XHR and n1 is stuck at 'Loading...' indefinitely.

Attachments (4)

DelayedContentServlet.java (2.8 KB) - added by kpkeerthi 9 years ago.
DojoTabs.war (7.7 KB) - added by kpkeerthi 9 years ago.
inflight-xhr.html (2.3 KB) - added by kpkeerthi 9 years ago.
working.html (2.3 KB) - added by bill 7 years ago.
working test case because the manual canceling of the XHR is commented out

Download all attachments as: .zip

Change History (12)

comment:1 Changed 9 years ago by kpkeerthi

This is an issue with dojo 1.5 as well

Changed 9 years ago by kpkeerthi

Attachment: DelayedContentServlet.java added

comment:2 Changed 9 years ago by kpkeerthi

Steps to reproduce:

  1. Deploy the attached war file in Tomcat v6 and point your browser (Firefox) to http://<host>:<port>/DojoTabs?/index.html
  1. Tab-1 will begin loading. Click on Tab-2 and watch Tab-1's XHR getting canceled in Firebug.
  1. Click on Tab-1 again and wait until its content load.
  1. Now click on the tab 'Nested'. A nested tab Tab-4 will begin loading. Click on tab-3 and watch Tab-4's XHR getting canceled.
  1. Click on the tab 'Nested' again. The nested tab Tab-4 will never load again.

Changed 9 years ago by kpkeerthi

Attachment: DojoTabs.war added

comment:3 Changed 9 years ago by bill

Sounds like you are talking about dijit, not dojox?

I don't have tomcat installed. Can you attach a test case using a simple HTML file? It can access getResponse.php in dijit/tests.

comment:4 Changed 9 years ago by kpkeerthi

Tomcat is optional. All you need is change the href values of the content panes (4 instances) in the attached file inflight-xhr.html.

Save this file to your disk and change the href values and run this file off your disk directly. 'Steps to reproduce' would remain the same except for Step-1.

comment:5 Changed 9 years ago by bill

Component: DojoX WidgetsDijit
Owner: changed from dante to bill
Priority: highestnormal
severity: criticalminor
Summary: Odd behavior in canceling in-flight XHRs in TabContainerTabContainer: odd behavior in canceling in-flight XHRs

OK, then please change the URL's and reattach the test file. Then we will know we are looking at the exact same test file.

The workaround is to not call cancel().

Changed 9 years ago by kpkeerthi

Attachment: inflight-xhr.html added

comment:6 Changed 9 years ago by kpkeerthi

inflight-xhr.html modified and reattached

comment:7 Changed 7 years ago by bill

Milestone: tbd1.9

comment:8 Changed 7 years ago by bill

Resolution: wontfix
Status: newclosed

TabContainer by itself is working fine. The problem only happens when you manually cancel an in-flight XHR. Manually canceling an in-flight XHR is not supported.

In your test case, when the nested TabContainer is deselected, you are manually calling:

lastSelectedTab.cancel()

on the nested TabContainer's ContentPane. Then, you are expecting the XHR to magically reexecute when the nested TabContainer is selected again. TabContainer doesn't have code to do this. Actually, I don't remember TabContainer having any code to cancel XHR's. I'll attach my test case.

Changed 7 years ago by bill

Attachment: working.html added

working test case because the manual canceling of the XHR is commented out

Note: See TracTickets for help on using tickets.