Files
safetynet/apps/browser/request-source.cjs
T

14 lines
721 B
JavaScript
Raw Normal View History

'use strict';
// A new top-level GET belongs to the live native tab, not the document it leaves.
// Data-bearing requests still belong to the exact original document generation.
function requestSourceCurrent({details,source,token,registry,currentDocument}){
try{
if(!token)return !(details.webContentsId>0);
if(details.resourceType==='mainFrame'&&details.method==='GET'&&!(details.uploadData?.length)){
const contents=token.webContents;
return !!source&&source.guarded===true&&source.view.webContents===contents&&!contents.isDestroyed()&&registry.fromContents(details.webContentsId)===source;
}
return currentDocument(token);
}catch{return false;}
}
module.exports={requestSourceCurrent};