electron/spec/fixtures/release-notes/cache/electron-electron-commit-2955c67c4ea712fa22773ac9113709fc952bfd49

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

1 line
19 KiB
Text
Raw Normal View History

{"status":200,"url":"https://api.github.com/repos/electron/electron/commits/2955c67c4ea712fa22773ac9113709fc952bfd49/pulls","headers":{"access-control-allow-origin":"*","access-control-expose-headers":"ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset","cache-control":"private, max-age=60, s-maxage=60","connection":"close","content-encoding":"gzip","content-security-policy":"default-src 'none'","content-type":"application/json; charset=utf-8","date":"Tue, 26 May 2020 16:25:38 GMT","etag":"W/\"7be19eed3b62d434bcbc8ed63e9c6fe9\"","referrer-policy":"origin-when-cross-origin, strict-origin-when-cross-origin","server":"GitHub.com","status":"200 OK","strict-transport-security":"max-age=31536000; includeSubdomains; preload","transfer-encoding":"chunked","vary":"Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With","x-accepted-oauth-scopes":"","x-content-type-options":"nosniff","x-frame-options":"deny","x-github-media-type":"github.groot-preview; format=json","x-github-request-id":"CC2A:2EDB:AF2650:12289C2:5ECD4301","x-oauth-scopes":"repo","x-ratelimit-limit":"5000","x-ratelimit-remaining":"4975","x-ratelimit-reset":"1590510696","x-xss-protection":"1; mode=block"},"data":[{"url":"https://api.github.com/repos/electron/electron/pulls/21946","id":368254138,"node_id":"MDExOlB1bGxSZXF1ZXN0MzY4MjU0MTM4","html_url":"https://github.com/electron/electron/pull/21946","diff_url":"https://github.com/electron/electron/pull/21946.diff","patch_url":"https://github.com/electron/electron/pull/21946.patch","issue_url":"https://api.github.com/repos/electron/electron/issues/21946","number":21946,"state":"closed","locked":false,"title":"fix: prevent print crash on bad deviceName","user":{"login":"codebytere","id":2036040,"node_id":"MDQ6VXNlcjIwMzYwNDA=","avatar_url":"https://avatars2.githubusercontent.com/u/2036040?v=4","gravatar_id":"","url":"https://api.github.com/users/codebytere","html_url":"https://github.com/codebytere","followers_url":"https://api.github.com/users/codebytere/followers","following_url":"https://api.github.com/users/codebytere/following{/other_user}","gists_url":"https://api.github.com/users/codebytere/gists{/gist_id}","starred_url":"https://api.github.com/users/codebytere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codebytere/subscriptions","organizations_url":"https://api.github.com/users/codebytere/orgs","repos_url":"https://api.github.com/users/codebytere/repos","events_url":"https://api.github.com/users/codebytere/events{/privacy}","received_events_url":"https://api.github.com/users/codebytere/received_events","type":"User","site_admin":true},"body":"#### Description of Change\r\n\r\nOn [Windows](https://source.chromium.org/chromium/chromium/src/+/master:printing/printing_context_win.cc;l=157?originalUrl=https:%2F%2Fcs.chromium.org%2F) and [macOS](https://source.chromium.org/chromium/chromium/src/+/master:printing/printing_context_mac.mm;l=226?originalUrl=https:%2F%2Fcs.chromium.org%2F), Chromium's printing code will crash if a `deviceName` is provided, but is invalid on the network, i.e does not correspond to a printer that the caller machine is aware of. This bug has been present for a long time, but after playing around a bit I've determined that it's possible to catch faulty `deviceName`s by pulling out some of the printer validation code from Chromium. This PR adds that check for Windows and macOS as well as tests for the same.\r\n\r\nTested with:\r\n```js\r\nwin.webContents.on('did-finish-load', () => {\r\n win.webContents.print({deviceName: 'bad-printer-name'}, (success, reason) => {\r\n console.log(`printing ${success ? 'did' : 'did not'} succeed: ${reason}`)\r\n })\r\n})\r\n```\r\n\r\ncc @ckerr @zcbenz \r\n\r\n#### Checklist\r\n<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->\r\n\r\n- [x] PR description included and stakeholders cc'd\r\n- [x] `npm test`