15 lines
721 B
JavaScript
15 lines
721 B
JavaScript
'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()&®istry.fromContents(details.webContentsId)===source;
|
|
}
|
|
return currentDocument(token);
|
|
}catch{return false;}
|
|
}
|
|
module.exports={requestSourceCurrent};
|