Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Add test for window opening and closing
Browse files Browse the repository at this point in the history
address #5006

Auditors: @bridiver

Test Plan: n/a
  • Loading branch information
diracdeltas committed Oct 25, 2016
1 parent 725c6d6 commit 64bf29a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/components/windowTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,38 @@ describe('application window', function () {
})
})

describe('open and close windows with scripts', function () {
Brave.beforeAll(this)

before(function * () {
this.page1 = Brave.server.url('close.html')

yield this.app.client
.windowByUrl(Brave.browserWindowUrl)
.waitForUrl(Brave.newTabUrl)
.url(this.page1)
.waitForExist('a')
.click('a')
.waitForExist('button')
.click('button')
})

it('keeps the first window and opens a new window', function * () {
yield this.app.client
.getWindowCount().should.become(2)
})

it('can close the child window', function * () {
yield this.app.client
.windowByIndex(1)
.url(this.page1)
.waitForExist('a')
.click('a')
yield this.app.client
.getWindowCount().should.become(1)
})
})

describe('window.open of "modal" window', function () {
it('has a min width of 100 and min height of 100')
})
Expand Down
13 changes: 13 additions & 0 deletions test/fixtures/close.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<html>
<title>Brave Window Object Remote Denial of Service.</title>
<body><br><br>
<center><a href="javascript:window.close(self);">Brave Window Object DoS Test POC</a></center>

<button>test opening window</button>
<script>
document.querySelector('button').onclick = function () {
let w = window.open(window.location.href, '_blank', "width=500 height=500")
}
</script>
</body>
</html>

0 comments on commit 64bf29a

Please sign in to comment.