{"action":"created","comment":{"url":"https://api.github.com/repos/w3c/web-platform-tests/pulls/comments/188564221","pull_request_review_id":120565610,"id":188564221,"diff_hunk":"@@ -1,80 +1,37 @@\n <!DOCTYPE html>\n-<html>\n-<body>\n <script src=\"/resources/testharness.js\"></script>\n <script src=\"/resources/testharnessreport.js\"></script>\n <script>\n-\n-var changeTest = async_test(\"Test that orientationchange event is fired when the orientation changes.\");\n-var noChangeTest = async_test(\"Test that orientationchange event is not fired when the orientation does not change.\");\n-\n-var orientations = [\n-  'portrait-primary',\n-  'portrait-secondary',\n-  'landscape-primary',\n-  'landscape-secondary'\n-];\n-\n-var currentIndex = orientations.indexOf(window.screen.orientation.type);\n-// Count the number of calls received from the EventHandler set on screen.orientation.onchange.\n-var orientationChangeEventHandlerCalls = 0;\n-// Count the number of calls received from the listener set with screen.orientation.addEventListene().\n-var orientationChangeEventListenerCalls = 0;\n-\n-var orientationChangeContinuation = null;\n-\n-function getNextIndex() {\n-  return (currentIndex + 1) % orientations.length;\n-}\n-\n-window.screen.orientation.onchange = function() {\n-  orientationChangeEventHandlerCalls++;\n-  if (orientationChangeEventContinuation) {\n-    setTimeout(orientationChangeEventContinuation);\n-    orientationChangeEventContinuation = null;\n-  }\n-};\n-\n-window.screen.orientation.addEventListener('change', function() {\n-  orientationChangeEventListenerCalls++;\n-});\n-\n-function runNoChangeTest() {\n-  screen.orientation.lock(orientations[currentIndex]).then(function() {}, function() {});\n-\n-  noChangeTest.step(function() {\n-    assert_equals(screen.orientation.type, orientations[currentIndex]);\n-    assert_equals(orientationChangeEventHandlerCalls, orientations.length);\n-    assert_equals(orientationChangeEventListenerCalls, orientations.length);\n-  });\n-\n-  noChangeTest.done();\n-}\n-\n-var i = 0;\n-function runChangeTest() {\n-  screen.orientation.lock(orientations[getNextIndex()]).then(function() {}, function() {});\n-  currentIndex = getNextIndex();\n-\n-  orientationChangeEventContinuation = function() {\n-    changeTest.step(function() {\n-      assert_equals(screen.orientation.type, orientations[currentIndex]);\n-      assert_equals(orientationChangeEventHandlerCalls, i + 1);\n-      assert_equals(orientationChangeEventListenerCalls, i + 1);\n-    });\n-\n-    ++i;\n-    if (i == orientations.length) {\n-      changeTest.done();\n-      runNoChangeTest();\n-    } else {\n-      runChangeTest();\n+promise_test(t => {\n+  const type = screen.orientation.type;\n+  // wrap onchange listener in new promise to catch unreached assertion\n+  return new Promise(async (resolve, reject) => {\n+    screen.orientation.onchange = () => { \n+      reject(new Error(\"change event should not be fired\"));\n     }\n-  };\n-}\n-\n-runChangeTest();\n+    await screen.orientation.lock(type);\n+    assert_equals(screen.orientation.type, type);\n+    setTimeout(resolve, 1000);","path":"screen-orientation/onchange-event.html","position":85,"original_position":85,"commit_id":"f92e196d8167dc4b5b18793eb4a7643d31ef5544","original_commit_id":"7d16deeaed1aa9f94580722eede02dd82b5822c2","user":{"login":"mounirlamouri","id":573590,"avatar_url":"https://avatars2.githubusercontent.com/u/573590?v=4","gravatar_id":"","url":"https://api.github.com/users/mounirlamouri","html_url":"https://github.com/mounirlamouri","followers_url":"https://api.github.com/users/mounirlamouri/followers","following_url":"https://api.github.com/users/mounirlamouri/following{/other_user}","gists_url":"https://api.github.com/users/mounirlamouri/gists{/gist_id}","starred_url":"https://api.github.com/users/mounirlamouri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mounirlamouri/subscriptions","organizations_url":"https://api.github.com/users/mounirlamouri/orgs","repos_url":"https://api.github.com/users/mounirlamouri/repos","events_url":"https://api.github.com/users/mounirlamouri/events{/privacy}","received_events_url":"https://api.github.com/users/mounirlamouri/received_events","type":"User","site_admin":false},"body":"We queue the event when we dispatch it so I guess it ends up being asynchronous while the promise may not be. It might be what the spec used to say. I can't remember :)\r\n\r\nIf this is passing in another browser, I would suggest to drop the `setTimeout()` and file a bug against Chrome. If it is not, I would suggest to change `setTimeout(resolve, 100);` to `setTimeout(resolve);` and add a test specifically for the race between event and promise and have Chrome fail it.","created_at":"2018-05-16T09:43:25Z","updated_at":"2018-05-16T09:43:31Z","html_url":"https://github.com/w3c/web-platform-tests/pull/10701#discussion_r188564221","pull_request_url":"https://api.github.com/repos/w3c/web-platform-tests/pulls/10701","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/w3c/web-platform-tests/pulls/comments/188564221"},"html":{"href":"https://github.com/w3c/web-platform-tests/pull/10701#discussion_r188564221"},"pull_request":{"href":"https://api.github.com/repos/w3c/web-platform-tests/pulls/10701"}},"in_reply_to_id":188504124},"pull_request":{"url":"https://api.github.com/repos/w3c/web-platform-tests/pulls/10701","id":184771383,"html_url":"https://github.com/w3c/web-platform-tests/pull/10701","diff_url":"https://github.com/w3c/web-platform-tests/pull/10701.diff","patch_url":"https://github.com/w3c/web-platform-tests/pull/10701.patch","issue_url":"https://api.github.com/repos/w3c/web-platform-tests/issues/10701","number":10701,"state":"open","locked":false,"title":"Add two screen-orientation tests and replace async by promise_test","user":{"login":"kaixinjxq","id":3191205,"avatar_url":"https://avatars0.githubusercontent.com/u/3191205?v=4","gravatar_id":"","url":"https://api.github.com/users/kaixinjxq","html_url":"https://github.com/kaixinjxq","followers_url":"https://api.github.com/users/kaixinjxq/followers","following_url":"https://api.github.com/users/kaixinjxq/following{/other_user}","gists_url":"https://api.github.com/users/kaixinjxq/gists{/gist_id}","starred_url":"https://api.github.com/users/kaixinjxq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaixinjxq/subscriptions","organizations_url":"https://api.github.com/users/kaixinjxq/orgs","repos_url":"https://api.github.com/users/kaixinjxq/repos","events_url":"https://api.github.com/users/kaixinjxq/events{/privacy}","received_events_url":"https://api.github.com/users/kaixinjxq/received_events","type":"User","site_admin":false},"body":"- Add test that screen.orientation.unlock() returns a void value.\r\n- Add test that screen.orientation.lock returns a promise which will be fulfilled with a void value.\r\n- Add \"\" and true types in test (screen.orientation.lock() must throw given invalid input).\r\n- Update test (Test screen.orientation default values).\r\n- Replace async by promise_test.\n\n<!-- Reviewable:start -->\n\n<!-- Reviewable:end -->\n","created_at":"2018-04-28T07:59:40Z","updated_at":"2018-05-16T09:43:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c47309dae67bf1511adcaeb35d4489ed5e1d61ab","assignee":null,"assignees":[],"requested_reviewers":[{"login":"haoxli","id":3271257,"avatar_url":"https://avatars2.githubusercontent.com/u/3271257?v=4","gravatar_id":"","url":"https://api.github.com/users/haoxli","html_url":"https://github.com/haoxli","followers_url":"https://api.github.com/users/haoxli/followers","following_url":"https://api.github.com/users/haoxli/following{/other_user}","gists_url":"https://api.github.com/users/haoxli/gists{/gist_id}","starred_url":"https://api.github.com/users/haoxli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haoxli/subscriptions","organizations_url":"https://api.github.com/users/haoxli/orgs","repos_url":"https://api.github.com/users/haoxli/repos","events_url":"https://api.github.com/users/haoxli/events{/privacy}","received_events_url":"https://api.github.com/users/haoxli/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":214581241,"url":"https://api.github.com/repos/w3c/web-platform-tests/labels/screen-orientation","name":"screen-orientation","color":"ededed","default":false},{"id":294418025,"url":"https://api.github.com/repos/w3c/web-platform-tests/labels/wg-webplatform","name":"wg-webplatform","color":"0052cc","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/w3c/web-platform-tests/pulls/10701/commits","review_comments_url":"https://api.github.com/repos/w3c/web-platform-tests/pulls/10701/comments","review_comment_url":"https://api.github.com/repos/w3c/web-platform-tests/pulls/comments{/number}","comments_url":"https://api.github.com/repos/w3c/web-platform-tests/issues/10701/comments","statuses_url":"https://api.github.com/repos/w3c/web-platform-tests/statuses/f92e196d8167dc4b5b18793eb4a7643d31ef5544","head":{"label":"kaixinjxq:screen_orientation","ref":"screen_orientation","sha":"f92e196d8167dc4b5b18793eb4a7643d31ef5544","user":{"login":"kaixinjxq","id":3191205,"avatar_url":"https://avatars0.githubusercontent.com/u/3191205?v=4","gravatar_id":"","url":"https://api.github.com/users/kaixinjxq","html_url":"https://github.com/kaixinjxq","followers_url":"https://api.github.com/users/kaixinjxq/followers","following_url":"https://api.github.com/users/kaixinjxq/following{/other_user}","gists_url":"https://api.github.com/users/kaixinjxq/gists{/gist_id}","starred_url":"https://api.github.com/users/kaixinjxq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaixinjxq/subscriptions","organizations_url":"https://api.github.com/users/kaixinjxq/orgs","repos_url":"https://api.github.com/users/kaixinjxq/repos","events_url":"https://api.github.com/users/kaixinjxq/events{/privacy}","received_events_url":"https://api.github.com/users/kaixinjxq/received_events","type":"User","site_admin":false},"repo":{"id":89561337,"name":"web-platform-tests","full_name":"kaixinjxq/web-platform-tests","owner":{"login":"kaixinjxq","id":3191205,"avatar_url":"https://avatars0.githubusercontent.com/u/3191205?v=4","gravatar_id":"","url":"https://api.github.com/users/kaixinjxq","html_url":"https://github.com/kaixinjxq","followers_url":"https://api.github.com/users/kaixinjxq/followers","following_url":"https://api.github.com/users/kaixinjxq/following{/other_user}","gists_url":"https://api.github.com/users/kaixinjxq/gists{/gist_id}","starred_url":"https://api.github.com/users/kaixinjxq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaixinjxq/subscriptions","organizations_url":"https://api.github.com/users/kaixinjxq/orgs","repos_url":"https://api.github.com/users/kaixinjxq/repos","events_url":"https://api.github.com/users/kaixinjxq/events{/privacy}","received_events_url":"https://api.github.com/users/kaixinjxq/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kaixinjxq/web-platform-tests","description":"Test suites for Web-platform specs — including WHATWG, W3C and others","fork":true,"url":"https://api.github.com/repos/kaixinjxq/web-platform-tests","forks_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/forks","keys_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/teams","hooks_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/hooks","issue_events_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/issues/events{/number}","events_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/events","assignees_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/assignees{/user}","branches_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/branches{/branch}","tags_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/tags","blobs_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/statuses/{sha}","languages_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/languages","stargazers_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/stargazers","contributors_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/contributors","subscribers_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/subscribers","subscription_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/subscription","commits_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/contents/{+path}","compare_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/merges","archive_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/downloads","issues_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/issues{/number}","pulls_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/pulls{/number}","milestones_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/milestones{/number}","notifications_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/labels{/name}","releases_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/releases{/id}","deployments_url":"https://api.github.com/repos/kaixinjxq/web-platform-tests/deployments","created_at":"2017-04-27T06:01:18Z","updated_at":"2017-04-27T06:02:23Z","pushed_at":"2018-05-16T06:04:23Z","git_url":"git://github.com/kaixinjxq/web-platform-tests.git","ssh_url":"git@github.com:kaixinjxq/web-platform-tests.git","clone_url":"https://github.com/kaixinjxq/web-platform-tests.git","svn_url":"https://github.com/kaixinjxq/web-platform-tests","homepage":"http://irc.w3.org/?channels=testing","size":274171,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"w3c:master","ref":"master","sha":"cc364d6f98b111e488aa1d88064af21566ec4184","user":{"login":"w3c","id":379216,"avatar_url":"https://avatars2.githubusercontent.com/u/379216?v=4","gravatar_id":"","url":"https://api.github.com/users/w3c","html_url":"https://github.com/w3c","followers_url":"https://api.github.com/users/w3c/followers","following_url":"https://api.github.com/users/w3c/following{/other_user}","gists_url":"https://api.github.com/users/w3c/gists{/gist_id}","starred_url":"https://api.github.com/users/w3c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/w3c/subscriptions","organizations_url":"https://api.github.com/users/w3c/orgs","repos_url":"https://api.github.com/users/w3c/repos","events_url":"https://api.github.com/users/w3c/events{/privacy}","received_events_url":"https://api.github.com/users/w3c/received_events","type":"Organization","site_admin":false},"repo":{"id":3618133,"name":"web-platform-tests","full_name":"w3c/web-platform-tests","owner":{"login":"w3c","id":379216,"avatar_url":"https://avatars2.githubusercontent.com/u/379216?v=4","gravatar_id":"","url":"https://api.github.com/users/w3c","html_url":"https://github.com/w3c","followers_url":"https://api.github.com/users/w3c/followers","following_url":"https://api.github.com/users/w3c/following{/other_user}","gists_url":"https://api.github.com/users/w3c/gists{/gist_id}","starred_url":"https://api.github.com/users/w3c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/w3c/subscriptions","organizations_url":"https://api.github.com/users/w3c/orgs","repos_url":"https://api.github.com/users/w3c/repos","events_url":"https://api.github.com/users/w3c/events{/privacy}","received_events_url":"https://api.github.com/users/w3c/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/w3c/web-platform-tests","description":"Test suites for Web-platform specs — including WHATWG, W3C, and others","fork":false,"url":"https://api.github.com/repos/w3c/web-platform-tests","forks_url":"https://api.github.com/repos/w3c/web-platform-tests/forks","keys_url":"https://api.github.com/repos/w3c/web-platform-tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/w3c/web-platform-tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/w3c/web-platform-tests/teams","hooks_url":"https://api.github.com/repos/w3c/web-platform-tests/hooks","issue_events_url":"https://api.github.com/repos/w3c/web-platform-tests/issues/events{/number}","events_url":"https://api.github.com/repos/w3c/web-platform-tests/events","assignees_url":"https://api.github.com/repos/w3c/web-platform-tests/assignees{/user}","branches_url":"https://api.github.com/repos/w3c/web-platform-tests/branches{/branch}","tags_url":"https://api.github.com/repos/w3c/web-platform-tests/tags","blobs_url":"https://api.github.com/repos/w3c/web-platform-tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/w3c/web-platform-tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/w3c/web-platform-tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/w3c/web-platform-tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/w3c/web-platform-tests/statuses/{sha}","languages_url":"https://api.github.com/repos/w3c/web-platform-tests/languages","stargazers_url":"https://api.github.com/repos/w3c/web-platform-tests/stargazers","contributors_url":"https://api.github.com/repos/w3c/web-platform-tests/contributors","subscribers_url":"https://api.github.com/repos/w3c/web-platform-tests/subscribers","subscription_url":"https://api.github.com/repos/w3c/web-platform-tests/subscription","commits_url":"https://api.github.com/repos/w3c/web-platform-tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/w3c/web-platform-tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/w3c/web-platform-tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/w3c/web-platform-tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/w3c/web-platform-tests/contents/{+path}","compare_url":"https://api.github.com/repos/w3c/web-platform-tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/w3c/web-platform-tests/merges","archive_url":"https://api.github.com/repos/w3c/web-platform-tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/w3c/web-platform-tests/downloads","issues_url":"https://api.github.com/repos/w3c/web-platform-tests/issues{/number}","pulls_url":"https://api.github.com/repos/w3c/web-platform-tests/pulls{/number}","milestones_url":"https://api.github.com/repos/w3c/web-platform-tests/milestones{/number}","notifications_url":"https://api.github.com/repos/w3c/web-platform-tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/w3c/web-platform-tests/labels{/name}","releases_url":"https://api.github.com/repos/w3c/web-platform-tests/releases{/id}","deployments_url":"https://api.github.com/repos/w3c/web-platform-tests/deployments","created_at":"2012-03-04T12:58:11Z","updated_at":"2018-05-16T07:20:46Z","pushed_at":"2018-05-16T09:04:02Z","git_url":"git://github.com/w3c/web-platform-tests.git","ssh_url":"git@github.com:w3c/web-platform-tests.git","clone_url":"https://github.com/w3c/web-platform-tests.git","svn_url":"https://github.com/w3c/web-platform-tests","homepage":"http://irc.w3.org/?channels=testing","size":292925,"stargazers_count":1596,"watchers_count":1596,"language":"HTML","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1420,"mirror_url":null,"archived":false,"open_issues_count":1258,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":1420,"open_issues":1258,"watchers":1596,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/w3c/web-platform-tests/pulls/10701"},"html":{"href":"https://github.com/w3c/web-platform-tests/pull/10701"},"issue":{"href":"https://api.github.com/repos/w3c/web-platform-tests/issues/10701"},"comments":{"href":"https://api.github.com/repos/w3c/web-platform-tests/issues/10701/comments"},"review_comments":{"href":"https://api.github.com/repos/w3c/web-platform-tests/pulls/10701/comments"},"review_comment":{"href":"https://api.github.com/repos/w3c/web-platform-tests/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/w3c/web-platform-tests/pulls/10701/commits"},"statuses":{"href":"https://api.github.com/repos/w3c/web-platform-tests/statuses/f92e196d8167dc4b5b18793eb4a7643d31ef5544"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"mounirlamouri"}}