Skip to content

Commit

Permalink
update deprecated electron getters/setters
Browse files Browse the repository at this point in the history
  • Loading branch information
flotwig committed Dec 4, 2019
1 parent bfc9005 commit 0bf8621
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/server/lib/browsers/electron.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ module.exports = {
_setUserAgent: (webContents, userAgent) ->
debug("setting user agent to:", userAgent)
## set both because why not
webContents.setUserAgent(userAgent)
webContents.userAgent = userAgent
webContents.session.setUserAgent(userAgent)

_setProxy: (webContents, proxyServer) ->
Expand Down
6 changes: 1 addition & 5 deletions packages/server/lib/gui/windows.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,12 @@ module.exports = {
})

if options.onPaint
setFrameRate = (num) ->
if win.webContents.getFrameRate() isnt num
win.webContents.setFrameRate(num)

win.webContents.on "paint", (event, dirty, image) ->
## https://github.com/cypress-io/cypress/issues/705
## if win is destroyed this will throw
try
if fr = options.recordFrameRate
setFrameRate(fr)
win.webContents.frameRate = fr

options.onPaint.apply(win, arguments)
catch err
Expand Down
3 changes: 1 addition & 2 deletions packages/server/test/unit/gui/windows_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ describe "lib/gui/windows", ->
@win.getPosition = sinon.stub().returns([3, 4])
@win.webContents = new EE()
@win.webContents.openDevTools = sinon.stub()
@win.webContents.setUserAgent = sinon.stub()
@win.webContents.getUserAgent = sinon.stub().returns(DEFAULT_USER_AGENT)
@win.webContents.userAgent = DEFAULT_USER_AGENT
@win.isDestroyed = sinon.stub().returns(false)

sinon.stub(Windows, "_newBrowserWindow").returns(@win)
Expand Down

0 comments on commit 0bf8621

Please sign in to comment.