Merge pull request #9468 from tonyganch/9296-history-state

Remove page url check during `history.pushState`
This commit is contained in:
Kevin Sawicki 2017-06-05 14:47:49 -07:00 committed by GitHub
commit 53b6ee0e3f
2 changed files with 28 additions and 12 deletions

View file

@ -1100,11 +1100,32 @@ describe('chromium feature', function () {
})
})
describe('window.history.go(offset)', function () {
it('throws an exception when the argumnet cannot be converted to a string', function () {
assert.throws(function () {
window.history.go({toString: null})
}, /Cannot convert object to primitive value/)
describe('window.history', function () {
describe('window.history.go(offset)', function () {
it('throws an exception when the argumnet cannot be converted to a string', function () {
assert.throws(function () {
window.history.go({toString: null})
}, /Cannot convert object to primitive value/)
})
})
describe('window.history.pushState', function () {
it('should push state after calling history.pushState() from the same url', (done) => {
w = new BrowserWindow({
show: false
})
w.webContents.once('did-finish-load', () => {
// History should have current page by now.
assert.equal(w.webContents.length(), 1)
w.webContents.executeJavaScript('window.history.pushState({}, "")', () => {
// Initial page + pushed state
assert.equal(w.webContents.length(), 2)
done()
})
})
w.loadURL('about:blank')
})
})
})
})