Blank screen is displayed on Windows after installing Brave v0.25.0. However installation is working fine on macOS and Ubuntu. Issue is only with Windows versions (win10, win 8, win7) In all these versions browser is displayed with blank screen
Actual result:
Blank screen is displayed on Windows after installing Brave v0.25.0
Expected result:
Browser should launch normally
Reproduces how often:
Always
0.25.0
about:brave info:
0.25.0
Reproducible on current live release:
No
cc @kjozwiak @LaurenWags @srirambv @btlechowski
Culprit seems to be \app\filtering.js at line 124. Changing this if state to the following seems to work fine, as well as successfully blocking the security issues its targeting.
if (details.tabId == -1) {
// This is loading in the main window, not a tab
return false
}
I have no idea how to post an official patch so I hope someone else could apply this patch 👍
Just adding some more details, this is only happening on Win:
• macOS 10.13.6 x64 - PASSED
• Win 10 x64 psychical machine - FAILED
• Win 8.1 x64 VM - FAILED
• Win 7 x64 VM - FAILED
@qabandi I think the issue is that tabId is inconsistent on Windows for some reason, since the code as-is works fine on mac. cc @bridiver
i also think we can just leave out that check in the patch entirely and it would still fix the h1 issues
@qabandi are you able to add a console.log to see what the value of details.tabId is for those request where line 126 is true?
@diracdeltas Looks like the tabid is -1 (typeof=number), I added more logs to see what's happening and here are the results.
---------------the modified function----
function shouldCancelBraveUrlRequest (details) {
const url = details.url
if (!url) {
return false
}
const isBraveUrl = url.startsWith('chrome://brave') || url.startsWith('brave://')
if (isBraveUrl) {
console.log("about to check: "+url+"|"+details.tabId +"|"+ (typeof details.tabId))
if (details.tabId !== -1) {
console.log(details.tabId +"|"+ (typeof details.tabId))
// This is loading in a tab, not the main window
return true
}
let urlPath = urlParse(url).path || ''
while (urlPath.startsWith('//')) {
console.log("inside while loop: "+urlPath)
// Trim excess leading slashes
urlPath = urlPath.slice(1)
}
const expectedPathPrefix = path.resolve(__dirname, 'extensions', 'brave') + '/'
if (!urlPath.startsWith(expectedPathPrefix)) {
console.log("!expectedPathPrefix: "+expectedPathPrefix)
// Not a whitelisted path
return true
}
}
return false
}
log output:
about to check: brave:///C:/github/browser-laptop/app/extensions/brave/index-dev.html|-1|number
inside while loop: ///C:/github/browser-laptop/app/extensions/brave/index-dev.html
inside while loop: //C:/github/browser-laptop/app/extensions/brave/index-dev.html
!expectedPathPrefix: C:\github\browser-laptop\app\extensions\brave/
about to check: chrome://brave/C:/github/browser-laptop/app/extensions/brave/index-dev.html|-1|number
!expectedPathPrefix: C:\github\browser-laptop\app\extensions\brave/
Edit:
Problem:
The expected pathprefix checker is doing the following check:
"/C:/github/browser-laptop/app/extensions/brave/index-dev.html".startswith("C:/github/browser-laptop/app/extensions/brave/index-dev.html")
which returns false thus request is blocked.
Edit2:
Also, looks like path.resolve is returning path with '\' as directory delimiter instead of '/' which explains why this is a problem with windows only.
Changing line 133 to the following seems to work:
const expectedPathPrefix = urlParse(path.resolve(__dirname, 'extensions', 'brave') + '/').path
*with the original tabId checker
@qabandi thanks, that is simpler than what i was trying to do
actually doesn't seem to work cross-platform so i'll just add some regex replacement for windows
@diracdeltas I'm pretty sure there's also something you can use to convert windows to unix paths. Can't remember what it is, but I'm pretty sure we do it somewhere
Went through verification using the following build:
0.25.2 8ea2a9ce5ca329478186e6393e07f1cf87d34a22 69.0.3497.1008.1.8Results:
Verified on Windows x64