2018-10-21

자바스크립트 사용 시 "Synchronous SMLHttpRequest..." 경고문

작업 중에 다음과 같은 노티를 발견했다. 버그는 아니라 수정할 의무는 없지만 그래도 권장 사항이므로 경고문을 읽어보기로 했다.
Synchronous XMLHttpRequest 오류 화면

[Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated becouse of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.

[Deprecation] 메인 스레드에서 동기식으로 XMLHttpRequest 객체를 사용하는 기능은 사용이 중지되었습니다. 그 이유는 사용자 경험에 안좋은 영향을 미칠 수 있기 때문입니다. 더 도움을 받으려면 이 링크를 확인하세요.

이 내용은 async 기능이 사용이 중지(deprecation) 된다는 것을 의미한다. 알려준 링크를 따라 들어가보니 XMLHttpRequest 객체에 관련된 내용이 있다. 그 중에서도 async 기능 쪽을 살펴보니 다음과 같은 언급이 있다.

Synchronous XMLHttpRequest outside of workers is in the process of being removed from the web platform as it has detrimental effects to the end user’s experience. (This is a long process that takes many years.) Developers must not pass false for the async argument when current global object is a Window object. User agents are strongly encouraged to warn about such usage in developer tools and may experiment with throwing an "InvalidAccessError" DOMException when it occurs.

동기식 XMLHttpRequest는 웹 플랫폼에서 점차 없애는 중입니다. 사용자 경험 (UX) 에 안좋은 영향을 미치기 때문입니다. 이는 몇 년에 걸쳐 오랫동안 진행됩니다. 개발자는 현재 글로벌 객체(current global object) 가 Window 객체일 경우 async 인자에 false를 전달하지 말아야 합니다. 사용자 에이전트는 개발자 도구에서 이에 대해 경고를 표시하도록 설정할 것을 강력하게 권장하며, 해당 경고가 발생했을 때 "InvalidAccessError" DOMException을 던지도록 할 수도 있습니다.

결론을 이야기하자면 async를 사용하지 않도록 코드를 작성해야 하고, 버그가 나지는 않지만 오랜 기간에 걸쳐 없어질 내용이므로 개선을 하는 것이 좋을 듯 하다.


continue reading 자바스크립트 사용 시 "Synchronous SMLHttpRequest..." 경고문
Share This:    Facebook Twitter