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

Don't use the previous URL if current virtual URL is safebrowsing #10161

Merged
merged 1 commit into from
Jul 26, 2017
Merged

Don't use the previous URL if current virtual URL is safebrowsing #10161

merged 1 commit into from
Jul 26, 2017

Conversation

bsclifton
Copy link
Member

Fixes #10143

Auditors: @diracdeltas, @alexwykoff

Test Plan:

  1. open new tab
  2. navigate to downloadme.org
  3. notice that URL is properly "about:safebrowsing#downloadme.org"

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.

Reviewer Checklist:

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

@bsclifton bsclifton added this to the 0.18.x (Beta Channel) milestone Jul 26, 2017
@bsclifton bsclifton self-assigned this Jul 26, 2017
@@ -302,7 +302,8 @@ const fixDisplayURL = (navigationEntry, controller) => {
navigationEntry.virtualURL = getSourceAboutUrl(navigationEntry.virtualURL)
}

if (isIntermediateAboutPage(navigationEntry.virtualURL)) {
if (isIntermediateAboutPage(navigationEntry.virtualURL) &&
navigationEntry.virtualURL.indexOf('about:safebrowsing#') === -1) {
Copy link
Member

Choose a reason for hiding this comment

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

if this is an issue for about:safebrowsing, shouldn't it also be an issue for about:error, about:certerror, etc?

Copy link
Member

Choose a reason for hiding this comment

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

maybe not because those errors fire after the page has started loading already but about:safebrowsing fires before

Copy link
Member

Choose a reason for hiding this comment

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

i think this should do a more strict check, like !virtualUrl.startsWith...

Copy link
Member Author

@bsclifton bsclifton Jul 26, 2017

Choose a reason for hiding this comment

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

@diracdeltas I'm not sure, maybe you can help me understand

If you open a new tab and then nav to downloadme.org, filtering picks it up via https://github.com/brave/browser-laptop/blob/0.18.x/app/filtering.js#L150 and restarts the nav process with "about:safebrowsing#downloadme.org", causing the previous page to be the full chrome-extension://about-newtab.html. It's not a true interstitial anymore since there is no previous entry for http://downloadme.org

If you navigate to a site and turn off your network card while the connection is happening, I would expect the browser to have an error page... but have the proper URL in the url bar (ex: the site I'm trying to reach). I was under the impression that a redirect to about:error happens after the site is unreachable (so the previous entry would be the correct site)

Copy link
Member Author

Choose a reason for hiding this comment

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

doh- missed your previous comments 😛 (needed to refresh). Let me implement a better check 😄

@codecov-io
Copy link

codecov-io commented Jul 26, 2017

Codecov Report

Merging #10161 into master will decrease coverage by <.01%.
The diff coverage is 0%.

@@            Coverage Diff             @@
##           master   #10161      +/-   ##
==========================================
- Coverage   52.81%    52.8%   -0.01%     
==========================================
  Files         227      227              
  Lines       20195    20194       -1     
  Branches     3234     3234              
==========================================
- Hits        10665    10663       -2     
- Misses       9530     9531       +1
Flag Coverage Δ
#unittest 52.8% <0%> (-0.01%) ⬇️
Impacted Files Coverage Δ
app/browser/tabs.js 25.07% <0%> (+0.18%) ⬆️
js/stores/appStoreRenderer.js 91.17% <0%> (-8.83%) ⬇️

Fixes #10143

Auditors: @diracdeltas, @alexwykoff

Test Plan:
1. open new tab
2. navigate to downloadme.org
3. notice that URL is properly "about:safebrowsing#downloadme.org"
@bsclifton
Copy link
Member Author

@diracdeltas updated 😄

@bsclifton bsclifton merged commit b91fe38 into brave:master Jul 26, 2017
@bsclifton bsclifton deleted the fix-safebrowsing-url branch July 26, 2017 23:22
bsclifton added a commit that referenced this pull request Jul 26, 2017
Don't use the previous URL if current virtual URL is safebrowsing
bsclifton added a commit that referenced this pull request Jul 26, 2017
Don't use the previous URL if current virtual URL is safebrowsing
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants