{"action":"closed","number":117,"pull_request":{"url":"https://api.github.com/repos/pretenderjs/pretender/pulls/117","id":46691970,"html_url":"https://github.com/pretenderjs/pretender/pull/117","diff_url":"https://github.com/pretenderjs/pretender/pull/117.diff","patch_url":"https://github.com/pretenderjs/pretender/pull/117.patch","issue_url":"https://api.github.com/repos/pretenderjs/pretender/issues/117","number":117,"state":"closed","locked":false,"title":"test that `on`- and `addEventListener` callbacks fire on passthrough","user":{"login":"bantic","id":2023,"avatar_url":"https://avatars.githubusercontent.com/u/2023?v=3","gravatar_id":"","url":"https://api.github.com/users/bantic","html_url":"https://github.com/bantic","followers_url":"https://api.github.com/users/bantic/followers","following_url":"https://api.github.com/users/bantic/following{/other_user}","gists_url":"https://api.github.com/users/bantic/gists{/gist_id}","starred_url":"https://api.github.com/users/bantic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bantic/subscriptions","organizations_url":"https://api.github.com/users/bantic/orgs","repos_url":"https://api.github.com/users/bantic/repos","events_url":"https://api.github.com/users/bantic/events{/privacy}","received_events_url":"https://api.github.com/users/bantic/received_events","type":"User","site_admin":false},"body":"This PR changes:\r\n  * restores the native window.XMLHttpRequest correctly in \"passthrough\" tests\r\n  * fixes an incorrect call to FakeXHR#dispatch that caused event listeners added using `addEventListener` from firing on passed-through requests\r\n\r\nIn the passthrough tests, there are a few places where `pretender._nativeXMLHttpRequest` is changed in order to facilitate testing, but Pretender [sets the window's `XMLHttpRequest` to `this._nativeXMLHttpRequest`](https://github.com/pretenderjs/pretender/blob/053b865064cf09dc6a07800b7a5039880381a8df/pretender.js#L379) in `#shutdown`. This resulted in `window.XMLHttpRequest` getting incorrectly permanently changed to the stub `tesXHR` method when those tests call `pretender.shutdown` in `teardown`.\r\n\r\nFakeXMLHttpRequest's [`dispatchEvent` method](https://github.com/pretenderjs/FakeXMLHttpRequest/blob/f48f3b8087ecb6df2ffd16ef31bd0e1bed7989f7/src/fake-xml-http-request.js#L169)\r\nmust be called with the event (which must have a `type` key) instead of\r\n`(eventName, event)`. When called with the `eventName` string as the first argument, the fake XHR never locates the `addEventListener`-added listeners and so never calls them. This PR fixes the call to `dispatchEvent` to have the correct parameter and adds tests that callbacks added using both methods will be called.","created_at":"2015-10-02T23:15:53Z","updated_at":"2015-10-05T15:01:52Z","closed_at":"2015-10-05T15:01:52Z","merged_at":"2015-10-05T15:01:52Z","merge_commit_sha":"39df64b89dee593e13a6c82a511583fcaaa69d4b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pretenderjs/pretender/pulls/117/commits","review_comments_url":"https://api.github.com/repos/pretenderjs/pretender/pulls/117/comments","review_comment_url":"https://api.github.com/repos/pretenderjs/pretender/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pretenderjs/pretender/issues/117/comments","statuses_url":"https://api.github.com/repos/pretenderjs/pretender/statuses/7880b6973271d285c6fcf2ecfa938398ec16e01e","head":{"label":"bantic:fix-passthrough-event-listeners","ref":"fix-passthrough-event-listeners","sha":"7880b6973271d285c6fcf2ecfa938398ec16e01e","user":{"login":"bantic","id":2023,"avatar_url":"https://avatars.githubusercontent.com/u/2023?v=3","gravatar_id":"","url":"https://api.github.com/users/bantic","html_url":"https://github.com/bantic","followers_url":"https://api.github.com/users/bantic/followers","following_url":"https://api.github.com/users/bantic/following{/other_user}","gists_url":"https://api.github.com/users/bantic/gists{/gist_id}","starred_url":"https://api.github.com/users/bantic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bantic/subscriptions","organizations_url":"https://api.github.com/users/bantic/orgs","repos_url":"https://api.github.com/users/bantic/repos","events_url":"https://api.github.com/users/bantic/events{/privacy}","received_events_url":"https://api.github.com/users/bantic/received_events","type":"User","site_admin":false},"repo":{"id":43460229,"name":"pretender","full_name":"bantic/pretender","owner":{"login":"bantic","id":2023,"avatar_url":"https://avatars.githubusercontent.com/u/2023?v=3","gravatar_id":"","url":"https://api.github.com/users/bantic","html_url":"https://github.com/bantic","followers_url":"https://api.github.com/users/bantic/followers","following_url":"https://api.github.com/users/bantic/following{/other_user}","gists_url":"https://api.github.com/users/bantic/gists{/gist_id}","starred_url":"https://api.github.com/users/bantic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bantic/subscriptions","organizations_url":"https://api.github.com/users/bantic/orgs","repos_url":"https://api.github.com/users/bantic/repos","events_url":"https://api.github.com/users/bantic/events{/privacy}","received_events_url":"https://api.github.com/users/bantic/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bantic/pretender","description":"A mock server library with a nice routing DSL","fork":true,"url":"https://api.github.com/repos/bantic/pretender","forks_url":"https://api.github.com/repos/bantic/pretender/forks","keys_url":"https://api.github.com/repos/bantic/pretender/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bantic/pretender/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bantic/pretender/teams","hooks_url":"https://api.github.com/repos/bantic/pretender/hooks","issue_events_url":"https://api.github.com/repos/bantic/pretender/issues/events{/number}","events_url":"https://api.github.com/repos/bantic/pretender/events","assignees_url":"https://api.github.com/repos/bantic/pretender/assignees{/user}","branches_url":"https://api.github.com/repos/bantic/pretender/branches{/branch}","tags_url":"https://api.github.com/repos/bantic/pretender/tags","blobs_url":"https://api.github.com/repos/bantic/pretender/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bantic/pretender/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bantic/pretender/git/refs{/sha}","trees_url":"https://api.github.com/repos/bantic/pretender/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bantic/pretender/statuses/{sha}","languages_url":"https://api.github.com/repos/bantic/pretender/languages","stargazers_url":"https://api.github.com/repos/bantic/pretender/stargazers","contributors_url":"https://api.github.com/repos/bantic/pretender/contributors","subscribers_url":"https://api.github.com/repos/bantic/pretender/subscribers","subscription_url":"https://api.github.com/repos/bantic/pretender/subscription","commits_url":"https://api.github.com/repos/bantic/pretender/commits{/sha}","git_commits_url":"https://api.github.com/repos/bantic/pretender/git/commits{/sha}","comments_url":"https://api.github.com/repos/bantic/pretender/comments{/number}","issue_comment_url":"https://api.github.com/repos/bantic/pretender/issues/comments{/number}","contents_url":"https://api.github.com/repos/bantic/pretender/contents/{+path}","compare_url":"https://api.github.com/repos/bantic/pretender/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bantic/pretender/merges","archive_url":"https://api.github.com/repos/bantic/pretender/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bantic/pretender/downloads","issues_url":"https://api.github.com/repos/bantic/pretender/issues{/number}","pulls_url":"https://api.github.com/repos/bantic/pretender/pulls{/number}","milestones_url":"https://api.github.com/repos/bantic/pretender/milestones{/number}","notifications_url":"https://api.github.com/repos/bantic/pretender/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bantic/pretender/labels{/name}","releases_url":"https://api.github.com/repos/bantic/pretender/releases{/id}","created_at":"2015-09-30T21:27:41Z","updated_at":"2015-09-30T21:27:42Z","pushed_at":"2015-10-05T14:19:28Z","git_url":"git://github.com/bantic/pretender.git","ssh_url":"git@github.com:bantic/pretender.git","clone_url":"https://github.com/bantic/pretender.git","svn_url":"https://github.com/bantic/pretender","homepage":"","size":823,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pretenderjs:master","ref":"master","sha":"053b865064cf09dc6a07800b7a5039880381a8df","user":{"login":"pretenderjs","id":13600256,"avatar_url":"https://avatars.githubusercontent.com/u/13600256?v=3","gravatar_id":"","url":"https://api.github.com/users/pretenderjs","html_url":"https://github.com/pretenderjs","followers_url":"https://api.github.com/users/pretenderjs/followers","following_url":"https://api.github.com/users/pretenderjs/following{/other_user}","gists_url":"https://api.github.com/users/pretenderjs/gists{/gist_id}","starred_url":"https://api.github.com/users/pretenderjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pretenderjs/subscriptions","organizations_url":"https://api.github.com/users/pretenderjs/orgs","repos_url":"https://api.github.com/users/pretenderjs/repos","events_url":"https://api.github.com/users/pretenderjs/events{/privacy}","received_events_url":"https://api.github.com/users/pretenderjs/received_events","type":"Organization","site_admin":false},"repo":{"id":18736715,"name":"pretender","full_name":"pretenderjs/pretender","owner":{"login":"pretenderjs","id":13600256,"avatar_url":"https://avatars.githubusercontent.com/u/13600256?v=3","gravatar_id":"","url":"https://api.github.com/users/pretenderjs","html_url":"https://github.com/pretenderjs","followers_url":"https://api.github.com/users/pretenderjs/followers","following_url":"https://api.github.com/users/pretenderjs/following{/other_user}","gists_url":"https://api.github.com/users/pretenderjs/gists{/gist_id}","starred_url":"https://api.github.com/users/pretenderjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pretenderjs/subscriptions","organizations_url":"https://api.github.com/users/pretenderjs/orgs","repos_url":"https://api.github.com/users/pretenderjs/repos","events_url":"https://api.github.com/users/pretenderjs/events{/privacy}","received_events_url":"https://api.github.com/users/pretenderjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pretenderjs/pretender","description":"A mock server library with a nice routing DSL","fork":false,"url":"https://api.github.com/repos/pretenderjs/pretender","forks_url":"https://api.github.com/repos/pretenderjs/pretender/forks","keys_url":"https://api.github.com/repos/pretenderjs/pretender/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pretenderjs/pretender/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pretenderjs/pretender/teams","hooks_url":"https://api.github.com/repos/pretenderjs/pretender/hooks","issue_events_url":"https://api.github.com/repos/pretenderjs/pretender/issues/events{/number}","events_url":"https://api.github.com/repos/pretenderjs/pretender/events","assignees_url":"https://api.github.com/repos/pretenderjs/pretender/assignees{/user}","branches_url":"https://api.github.com/repos/pretenderjs/pretender/branches{/branch}","tags_url":"https://api.github.com/repos/pretenderjs/pretender/tags","blobs_url":"https://api.github.com/repos/pretenderjs/pretender/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pretenderjs/pretender/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pretenderjs/pretender/git/refs{/sha}","trees_url":"https://api.github.com/repos/pretenderjs/pretender/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pretenderjs/pretender/statuses/{sha}","languages_url":"https://api.github.com/repos/pretenderjs/pretender/languages","stargazers_url":"https://api.github.com/repos/pretenderjs/pretender/stargazers","contributors_url":"https://api.github.com/repos/pretenderjs/pretender/contributors","subscribers_url":"https://api.github.com/repos/pretenderjs/pretender/subscribers","subscription_url":"https://api.github.com/repos/pretenderjs/pretender/subscription","commits_url":"https://api.github.com/repos/pretenderjs/pretender/commits{/sha}","git_commits_url":"https://api.github.com/repos/pretenderjs/pretender/git/commits{/sha}","comments_url":"https://api.github.com/repos/pretenderjs/pretender/comments{/number}","issue_comment_url":"https://api.github.com/repos/pretenderjs/pretender/issues/comments{/number}","contents_url":"https://api.github.com/repos/pretenderjs/pretender/contents/{+path}","compare_url":"https://api.github.com/repos/pretenderjs/pretender/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pretenderjs/pretender/merges","archive_url":"https://api.github.com/repos/pretenderjs/pretender/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pretenderjs/pretender/downloads","issues_url":"https://api.github.com/repos/pretenderjs/pretender/issues{/number}","pulls_url":"https://api.github.com/repos/pretenderjs/pretender/pulls{/number}","milestones_url":"https://api.github.com/repos/pretenderjs/pretender/milestones{/number}","notifications_url":"https://api.github.com/repos/pretenderjs/pretender/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pretenderjs/pretender/labels{/name}","releases_url":"https://api.github.com/repos/pretenderjs/pretender/releases{/id}","created_at":"2014-04-13T18:41:21Z","updated_at":"2015-10-04T16:36:32Z","pushed_at":"2015-10-05T15:01:52Z","git_url":"git://github.com/pretenderjs/pretender.git","ssh_url":"git@github.com:pretenderjs/pretender.git","clone_url":"https://github.com/pretenderjs/pretender.git","svn_url":"https://github.com/pretenderjs/pretender","homepage":"","size":823,"stargazers_count":520,"watchers_count":520,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":58,"mirror_url":null,"open_issues_count":22,"forks":58,"open_issues":22,"watchers":520,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pretenderjs/pretender/pulls/117"},"html":{"href":"https://github.com/pretenderjs/pretender/pull/117"},"issue":{"href":"https://api.github.com/repos/pretenderjs/pretender/issues/117"},"comments":{"href":"https://api.github.com/repos/pretenderjs/pretender/issues/117/comments"},"review_comments":{"href":"https://api.github.com/repos/pretenderjs/pretender/pulls/117/comments"},"review_comment":{"href":"https://api.github.com/repos/pretenderjs/pretender/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pretenderjs/pretender/pulls/117/commits"},"statuses":{"href":"https://api.github.com/repos/pretenderjs/pretender/statuses/7880b6973271d285c6fcf2ecfa938398ec16e01e"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"trek","id":9736,"avatar_url":"https://avatars.githubusercontent.com/u/9736?v=3","gravatar_id":"","url":"https://api.github.com/users/trek","html_url":"https://github.com/trek","followers_url":"https://api.github.com/users/trek/followers","following_url":"https://api.github.com/users/trek/following{/other_user}","gists_url":"https://api.github.com/users/trek/gists{/gist_id}","starred_url":"https://api.github.com/users/trek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trek/subscriptions","organizations_url":"https://api.github.com/users/trek/orgs","repos_url":"https://api.github.com/users/trek/repos","events_url":"https://api.github.com/users/trek/events{/privacy}","received_events_url":"https://api.github.com/users/trek/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"commits":1,"additions":65,"deletions":3,"changed_files":2}}