This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 148304 - Http Client Monitor: POST data lost
Summary: Http Client Monitor: POST data lost
Status: VERIFIED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Quy Nguyen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-25 00:50 UTC by _ krystyna
Modified: 2008-09-27 00:24 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ krystyna 2008-09-25 00:50:19 UTC
NetBeans IDE Dev (Build 20080923152338)
Java: 1.6.0_10-rc; Java HotSpot(TM) Client VM 11.0-b13
System: Windows XP version 5.1

1. open Debugging | Http Client Monitor
2. attach debugger, select firefox, with url:
http://www.degraeve.com/reference/simple-ajax-example.php
3. interact with data and press Go button
4. filter XHR request and select the POST
5. See the http response body below in monitor
6. View web page:
>data is missing from teh web page
7. Stop session. 

Verify interaction with web page to see data expected on page.
Comment 1 Quy Nguyen 2008-09-25 02:19:13 UTC
For xml http requests, we use the XMLHttpRequest.onreadystatechange property to wait until the response is ready before
sending the response (for both GET and POST xml http requests).  However, many pages also use the onreadystatechange
property to do essentially the same thing, so if we overwrite the property, the page's event handler is also overwritten.

Two possible fixes:

1) Don't use onreadystatechange, but send back whatever data is available from the request as soon as the mozilla
observer service notifies the extension that the response is available.  This will always work, but in many cases, the
xhr responses will not be available (either body not available, or body content at 0 bytes).

2) Call an existing onreadystatechange in the onreadystatechange function that we create.  I haven't seen any cases
where this can break a page, but it is theoretically possible, since we are modifying JavaScript objects that are used
by the monitored page.
Comment 2 Quy Nguyen 2008-09-25 04:27:05 UTC
Fixed by calling the previous value of onreadystatechange on the event handler that the NetBeans extension registers.

Changeset: a36db6f39dde
Comment 3 Quality Engineering 2008-09-25 17:51:33 UTC
Integrated into 'main-golden', will be available in build *200809251401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/a36db6f39dde
User: Quy Nguyen <quynguyen@netbeans.org>
Log: #148304 - Fix issue with XMLHttpRequest.onreadystatechange by also invoking the previous value of onreadystatechange.
Comment 4 _ krystyna 2008-09-27 00:24:28 UTC
Verified in NetBeans IDE Dev (Build 20080926114356)