{"action":"created","issue":{"url":"https://api.github.com/repos/ampproject/amphtml/issues/4188","repository_url":"https://api.github.com/repos/ampproject/amphtml","labels_url":"https://api.github.com/repos/ampproject/amphtml/issues/4188/labels{/name}","comments_url":"https://api.github.com/repos/ampproject/amphtml/issues/4188/comments","events_url":"https://api.github.com/repos/ampproject/amphtml/issues/4188/events","html_url":"https://github.com/ampproject/amphtml/pull/4188","id":167400939,"number":4188,"title":"A4A: Only inject validated creative","user":{"login":"tdrl","id":17705064,"avatar_url":"https://avatars.githubusercontent.com/u/17705064?v=3","gravatar_id":"","url":"https://api.github.com/users/tdrl","html_url":"https://github.com/tdrl","followers_url":"https://api.github.com/users/tdrl/followers","following_url":"https://api.github.com/users/tdrl/following{/other_user}","gists_url":"https://api.github.com/users/tdrl/gists{/gist_id}","starred_url":"https://api.github.com/users/tdrl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tdrl/subscriptions","organizations_url":"https://api.github.com/users/tdrl/orgs","repos_url":"https://api.github.com/users/tdrl/repos","events_url":"https://api.github.com/users/tdrl/events{/privacy}","received_events_url":"https://api.github.com/users/tdrl/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ampproject/amphtml/labels/LGTM","name":"LGTM","color":"009800"},{"url":"https://api.github.com/repos/ampproject/amphtml/labels/Priority:%20Critical","name":"Priority: Critical","color":"e11d21"}],"state":"open","locked":false,"assignee":{"login":"jridgewell","id":112982,"avatar_url":"https://avatars.githubusercontent.com/u/112982?v=3","gravatar_id":"","url":"https://api.github.com/users/jridgewell","html_url":"https://github.com/jridgewell","followers_url":"https://api.github.com/users/jridgewell/followers","following_url":"https://api.github.com/users/jridgewell/following{/other_user}","gists_url":"https://api.github.com/users/jridgewell/gists{/gist_id}","starred_url":"https://api.github.com/users/jridgewell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jridgewell/subscriptions","organizations_url":"https://api.github.com/users/jridgewell/orgs","repos_url":"https://api.github.com/users/jridgewell/repos","events_url":"https://api.github.com/users/jridgewell/events{/privacy}","received_events_url":"https://api.github.com/users/jridgewell/received_events","type":"User","site_admin":false},"assignees":[{"login":"jridgewell","id":112982,"avatar_url":"https://avatars.githubusercontent.com/u/112982?v=3","gravatar_id":"","url":"https://api.github.com/users/jridgewell","html_url":"https://github.com/jridgewell","followers_url":"https://api.github.com/users/jridgewell/followers","following_url":"https://api.github.com/users/jridgewell/following{/other_user}","gists_url":"https://api.github.com/users/jridgewell/gists{/gist_id}","starred_url":"https://api.github.com/users/jridgewell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jridgewell/subscriptions","organizations_url":"https://api.github.com/users/jridgewell/orgs","repos_url":"https://api.github.com/users/jridgewell/repos","events_url":"https://api.github.com/users/jridgewell/events{/privacy}","received_events_url":"https://api.github.com/users/jridgewell/received_events","type":"User","site_admin":false}],"milestone":null,"comments":7,"created_at":"2016-07-25T15:53:42Z","updated_at":"2016-07-26T18:25:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ampproject/amphtml/pulls/4188","html_url":"https://github.com/ampproject/amphtml/pull/4188","diff_url":"https://github.com/ampproject/amphtml/pull/4188.diff","patch_url":"https://github.com/ampproject/amphtml/pull/4188.patch"},"body":"Fix for #4187"},"comment":{"url":"https://api.github.com/repos/ampproject/amphtml/issues/comments/235360018","html_url":"https://github.com/ampproject/amphtml/pull/4188#issuecomment-235360018","issue_url":"https://api.github.com/repos/ampproject/amphtml/issues/4188","id":235360018,"user":{"login":"tdrl","id":17705064,"avatar_url":"https://avatars.githubusercontent.com/u/17705064?v=3","gravatar_id":"","url":"https://api.github.com/users/tdrl","html_url":"https://github.com/tdrl","followers_url":"https://api.github.com/users/tdrl/followers","following_url":"https://api.github.com/users/tdrl/following{/other_user}","gists_url":"https://api.github.com/users/tdrl/gists{/gist_id}","starred_url":"https://api.github.com/users/tdrl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tdrl/subscriptions","organizations_url":"https://api.github.com/users/tdrl/orgs","repos_url":"https://api.github.com/users/tdrl/repos","events_url":"https://api.github.com/users/tdrl/events{/privacy}","received_events_url":"https://api.github.com/users/tdrl/received_events","type":"User","site_admin":false},"created_at":"2016-07-26T18:25:28Z","updated_at":"2016-07-26T18:25:28Z","body":"Ok, remaining outstanding question: I tried to restructure the promise chain to remove all instances of `#then` nested inside `#then`, but there was one case I couldn't figure out how to remove:\r\n\r\n```javascript\r\n    .then(fetchResponse => {\r\n        checkStillCurrent(promiseId);\r\n        if (!fetchResponse || !fetchResponse.arrayBuffer) {\r\n          return null;\r\n        }\r\n        // Note: Resolving a .then inside a .then because we need to capture\r\n        // two fields of fetchResponse, one of which is, itself, a promise,\r\n        // and one of which isn't.  If we just return\r\n        // fetchResponse.arrayBuffer(), the next step in the chain will\r\n        // resolve it to a concrete value, but we'll lose track of\r\n        // fetchResponse.headers.\r\n        return fetchResponse.arrayBuffer().then(bytes => {\r\n          return {\r\n            bytes: bytes,\r\n            headers: fetchResponse.headers,\r\n          };\r\n        });\r\n      })\r\n```\r\n\r\nAs the internal  comment notes, I'm not sure how to extract both the headers and the resolved value of `fetchResponse.arrayBuffer()` without resolving one `.then` inside another.  One possible way I see would be to write to an auxiliary variable, e.g., in the `a4a` instance object.  But that seems icky, and potentially dangerous, as it introduces a race against other, simultaneously active promise chains.\r\n\r\nOpen to suggestions about better ways to do this?"}}
{"actor":{"display_login":"tdrl"}}