{"action":"closed","issue":{"url":"https://api.github.com/repos/webrtc/apprtc/issues/368","repository_url":"https://api.github.com/repos/webrtc/apprtc","labels_url":"https://api.github.com/repos/webrtc/apprtc/issues/368/labels{/name}","comments_url":"https://api.github.com/repos/webrtc/apprtc/issues/368/comments","events_url":"https://api.github.com/repos/webrtc/apprtc/issues/368/events","html_url":"https://github.com/webrtc/apprtc/issues/368","id":176927864,"number":368,"title":"Don't send a sync XHR in onbeforeunload handler","user":{"login":"mikeconley","id":195042,"avatar_url":"https://avatars0.githubusercontent.com/u/195042?v=4","gravatar_id":"","url":"https://api.github.com/users/mikeconley","html_url":"https://github.com/mikeconley","followers_url":"https://api.github.com/users/mikeconley/followers","following_url":"https://api.github.com/users/mikeconley/following{/other_user}","gists_url":"https://api.github.com/users/mikeconley/gists{/gist_id}","starred_url":"https://api.github.com/users/mikeconley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikeconley/subscriptions","organizations_url":"https://api.github.com/users/mikeconley/orgs","repos_url":"https://api.github.com/users/mikeconley/repos","events_url":"https://api.github.com/users/mikeconley/events{/privacy}","received_events_url":"https://api.github.com/users/mikeconley/received_events","type":"User","site_admin":false},"labels":[{"id":173299598,"url":"https://api.github.com/repos/webrtc/apprtc/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-14T14:48:40Z","updated_at":"2018-03-08T11:50:59Z","closed_at":"2018-03-08T11:50:59Z","author_association":"NONE","body":"**Browsers and versions affected**\nAll\n\n**Description**\nWhen the browser tab goes away, the onbeforeunload event causes Call hangups to send a sync XHR.\n\nThis appears to be deliberate, and is explicitly called out here: https://github.com/webrtc/apprtc/blob/6a83865f0e74a5d2c1ac197eefc613827835e138/src/web_app/js/call.js#L146\n\nThis is pretty bad for performance, especially on slow networks, as the main thread for the content is blocked waiting for the XHR to complete.\n\nIt might be possible to do the same work using sendBeacon in supporting browsers: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon\n\nOr perhaps a ServiceWorker would be useful here instead.\n\n**Steps to reproduce**\nOpen a call on a bad network connection. Close the browser tab.\n\n**Expected results**\nThere shouldn't be a sync XHR in the onbeforeunload event.\n\n**Actual results**\nThere's a sync XHR.\n"}}
{"actor":{"display_login":"KaptenJansson"}}