Fix thrown exception in onHeadersReceived listener

Regression from:
- https://github.com/gorhill/uBlock/commit/ae56c4dfe855
This commit is contained in:
Raymond Hill 2019-07-19 06:54:55 -04:00
parent 8935956260
commit ecd81183b1
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 2 additions and 2 deletions

View File

@ -912,7 +912,7 @@ vAPI.tabs.registerListeners();
{
const NoPageStore = class extends µBlock.PageStore {
getNetFilteringSwitch(fctxt) {
if ( fctxt.docId === 0 ) {
if ( fctxt && fctxt.docId === 0 ) {
const docOrigin = fctxt.getDocOrigin();
if ( docOrigin ) {
return µBlock.getNetFilteringSwitch(docOrigin);

View File

@ -440,7 +440,7 @@ const onHeadersReceived = function(details) {
if ( isRootDoc === false ) { return; }
pageStore = µb.bindTabToPageStats(fctxt.tabId, 'beforeRequest');
}
if ( pageStore.getNetFilteringSwitch() === false ) { return; }
if ( pageStore.getNetFilteringSwitch(fctxt) === false ) { return; }
// Keep in mind response headers will be modified in-place if needed, so
// `details.responseHeaders` will always point to the modified response