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

Commit

Permalink
Don't update URL bar for iframe navigation
Browse files Browse the repository at this point in the history
Fix #4191

Auditors: @bbondy

Test Plan:
Covered by automated test
  • Loading branch information
diracdeltas committed Sep 22, 2016
1 parent e599037 commit 2350448
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
6 changes: 4 additions & 2 deletions js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -938,8 +938,10 @@ class Frame extends ImmutableComponent {
}
})
this.webview.addEventListener('did-navigate-in-page', (e) => {
windowActions.setNavigated(e.url, this.props.frameKey, true)
loadEnd(true)
if (e.isMainFrame) {
windowActions.setNavigated(e.url, this.props.frameKey, true)
loadEnd(true)
}
})
this.webview.addEventListener('enter-html-full-screen', () => {
windowActions.setFullScreen(this.frame, true, true)
Expand Down
24 changes: 24 additions & 0 deletions test/components/navigationBarTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,30 @@ describe('navigationBar', function () {
})
})

describe('iframe navigation', function () {
Brave.beforeAll(this)

before(function * () {
var page1 = Brave.server.url('in_page_nav.html')
yield setup(this.app.client)
yield this.app.client
.tabByUrl(Brave.newTabUrl)
.url(page1)
.waitForUrl(page1)
})

it('location does not change', function * () {
var page1 = Brave.server.url('in_page_nav.html')
yield this.app.client
.windowByUrl(Brave.browserWindowUrl)
.waitUntil(function () {
return this.getValue(urlInput).then((val) => {
return val === page1
})
})
})
})

describe('page with a title', function () {
Brave.beforeAll(this)

Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/iframe1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<html>
<script>window.location.href = window.location.href + '#foo'</script>
</html>
4 changes: 4 additions & 0 deletions test/fixtures/in_page_nav.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<html>
<iframe src='./iframe1.html'>
</iframe>
</html>

1 comment on commit 2350448

@bbondy
Copy link
Member

@bbondy bbondy commented on 2350448 Sep 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omg, thanks for adding a test

Please sign in to comment.