TAILIEUCHUNG - Phát triển Javascript - part 31

Tham khảo tài liệu 'phát triển javascript - part 31', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Using the Ajax API 273 requestComplete transport options null . Adding these two lines makes the tests pass again. Re-running the massive request integration test in Internet Explorer confirms that the memory leak is now gone. Local Requests The last issue with the current implementation is that it is unable to make local requests. Doing so results in no errors yet nothing happens. The reason for this is that the local file system has no concept of HTTP status codes so the status code is 0 when readyState is 4. Currently our implementation only accepts status code 200 which is insufficient in any case. We will add support for local requests by checking if the script is running locally and that the status code is not set as the test in Listing shows. Listing Making sure the success handler is called for local requests test should call success handler for local requests function 4 0 var success stubFn stubFn true success success assert The test assumes a helper method to check if the script is running locally. Because we are stubbing it a reference to it is saved in the setup allowing it to be restored in tearDown as we did before. Download from 274 Abstracting Browser Differences Ajax To pass the test we will call the success callback whenever the request is for a local file and the status code is not set. Listing shows the updated ready state change handler. Listing Allow local requests to succeed function requestComplete transport options var status if status 200 status if typeof function transport The implementation passes the test. In order to have this working in a browser as well we need to implement the helper that determines if the script is running locally as seen in

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.