{"action":"created","issue":{"url":"https://api.github.com/repos/w3c/encrypted-media/issues/372","repository_url":"https://api.github.com/repos/w3c/encrypted-media","labels_url":"https://api.github.com/repos/w3c/encrypted-media/issues/372/labels{/name}","comments_url":"https://api.github.com/repos/w3c/encrypted-media/issues/372/comments","events_url":"https://api.github.com/repos/w3c/encrypted-media/issues/372/events","html_url":"https://github.com/w3c/encrypted-media/issues/372","id":208612352,"number":372,"title":"setMediaKeys() step 1 and 2 should be reversed","user":{"login":"xhwang-chromium","id":10169438,"avatar_url":"https://avatars3.githubusercontent.com/u/10169438?v=3","gravatar_id":"","url":"https://api.github.com/users/xhwang-chromium","html_url":"https://github.com/xhwang-chromium","followers_url":"https://api.github.com/users/xhwang-chromium/followers","following_url":"https://api.github.com/users/xhwang-chromium/following{/other_user}","gists_url":"https://api.github.com/users/xhwang-chromium/gists{/gist_id}","starred_url":"https://api.github.com/users/xhwang-chromium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xhwang-chromium/subscriptions","organizations_url":"https://api.github.com/users/xhwang-chromium/orgs","repos_url":"https://api.github.com/users/xhwang-chromium/repos","events_url":"https://api.github.com/users/xhwang-chromium/events{/privacy}","received_events_url":"https://api.github.com/users/xhwang-chromium/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/w3c/encrypted-media/milestones/3","html_url":"https://github.com/w3c/encrypted-media/milestone/3","labels_url":"https://api.github.com/repos/w3c/encrypted-media/milestones/3/labels","id":1637384,"number":3,"title":"V1NonBlocking","description":"Those issues are editorial or substantive for V1 and may get done within the V1 timeframe. All substantive issues will be moved to V.Next after June 9th.\r\n","creator":{"login":"ddorwin","id":9738764,"avatar_url":"https://avatars3.githubusercontent.com/u/9738764?v=3","gravatar_id":"","url":"https://api.github.com/users/ddorwin","html_url":"https://github.com/ddorwin","followers_url":"https://api.github.com/users/ddorwin/followers","following_url":"https://api.github.com/users/ddorwin/following{/other_user}","gists_url":"https://api.github.com/users/ddorwin/gists{/gist_id}","starred_url":"https://api.github.com/users/ddorwin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddorwin/subscriptions","organizations_url":"https://api.github.com/users/ddorwin/orgs","repos_url":"https://api.github.com/users/ddorwin/repos","events_url":"https://api.github.com/users/ddorwin/events{/privacy}","received_events_url":"https://api.github.com/users/ddorwin/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":35,"state":"open","created_at":"2016-03-10T19:55:05Z","updated_at":"2017-03-10T20:33:44Z","due_on":"2016-06-09T07:00:00Z","closed_at":null},"comments":2,"created_at":"2017-02-18T04:42:52Z","updated_at":"2017-04-13T19:36:07Z","closed_at":null,"body":"The first two steps of [setMediaKeys()](https://w3c.github.io/encrypted-media/#dom-htmlmediaelement-setmediakeys) are as follows:\r\n\r\n> 1. If mediaKeys and the mediaKeys attribute are the same object, return a resolved promise.\r\n> 2. If this object's attaching media keys value is true, return a promise rejected with an InvalidStateError.\r\n\r\nNow imagine the application makes the following calls:\r\n```\r\nvideo.setMediaKeys(mediaKeys);\r\nvideo.setMediaKeys(null);\r\n```\r\nOn the second call, the promise of the first call could still be pending, e.g. the result is in a task waiting in a queue. So the _mediaKeys attribute_ is still null. Then according to step 1, since both the _mediaKeys_ and _mediaKeys attribute_ are null, in theory they **are** the same object, a resolved promise is returned. Then, when the task in the queue runs, the promise of the first call is also resolved.\r\n\r\nThis could confuse the application that even if the promise of the second call is resolved, the _mediaKeys attribute_ is not null.\r\n\r\nShould we switch the order of step 1 and step 2, such that we always check the _attaching media keys value_ first, and any setMediaKeys() during another pending setMediaKeys() call will always be rejected?"},"comment":{"url":"https://api.github.com/repos/w3c/encrypted-media/issues/comments/294000934","html_url":"https://github.com/w3c/encrypted-media/issues/372#issuecomment-294000934","issue_url":"https://api.github.com/repos/w3c/encrypted-media/issues/372","id":294000934,"user":{"login":"mavgit","id":4162164,"avatar_url":"https://avatars2.githubusercontent.com/u/4162164?v=3","gravatar_id":"","url":"https://api.github.com/users/mavgit","html_url":"https://github.com/mavgit","followers_url":"https://api.github.com/users/mavgit/followers","following_url":"https://api.github.com/users/mavgit/following{/other_user}","gists_url":"https://api.github.com/users/mavgit/gists{/gist_id}","starred_url":"https://api.github.com/users/mavgit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mavgit/subscriptions","organizations_url":"https://api.github.com/users/mavgit/orgs","repos_url":"https://api.github.com/users/mavgit/repos","events_url":"https://api.github.com/users/mavgit/events{/privacy}","received_events_url":"https://api.github.com/users/mavgit/received_events","type":"User","site_admin":false},"created_at":"2017-04-13T19:36:07Z","updated_at":"2017-04-13T19:36:07Z","body":"This is a complex spec and issues like this are bound to come up. If we can't change V1 (which is understandable) we could open a new V1.1 version of the spec and start making these changes. Alternatively, we could just keep a list of V1.1 desired fixes somewhere, but editing the spec seems clearer."}}
{"actor":{"display_login":"mavgit"}}