Skip to content

Commit

Permalink
Fix URL-with-fragment support
Browse files Browse the repository at this point in the history
  • Loading branch information
James-E-A committed Sep 25, 2020
1 parent 2a1c8cb commit 2c35664
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ browser.tabs.onUpdated.addListener(
function onTabUpdatedStatusListener(tabId,changeInfo,tabInfo){
let securityInfo,secType,certChain,browserActionSpec,extraCmds=[];
try {
securityInfo=cachedSecurityInfosByTabIdAndURL[tabId][tabInfo.url];
let url=removeFragment(tabInfo.url);
securityInfo=cachedSecurityInfosByTabIdAndURL[tabId][url];
if(changeInfo.status=='complete' && securityInfo) extraCmds={enable:tabId};
secType=identifySecType(securityInfo);
certChain=securityInfo.certificates;
Expand Down
7 changes: 7 additions & 0 deletions src/js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ function getAsset(path){
return xhr.response;
}

function removeFragment(url){
//Removes the fragment from a URL
let u=new URL(url);
u.hash='';
return u.toString();
}

function intDiv(a,b=100){
//Functions as e.g. Python's integer division
//Divides then casts directly to integer
Expand Down

0 comments on commit 2c35664

Please sign in to comment.