code review: don't remember tabless network requests in behind-the-scene scope

This commit is contained in:
Raymond Hill 2018-12-14 08:47:29 -05:00
parent 0364087e11
commit 2f1d319072
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
3 changed files with 10 additions and 3 deletions

View File

@ -95,6 +95,7 @@ NetFilteringResultCache.prototype.rememberResult = function(
result, result,
logData logData
) { ) {
if ( fctxt.tabId <= 0 ) { return; }
if ( this.results.size === 0 ) { if ( this.results.size === 0 ) {
this.pruneAsync(); this.pruneAsync();
} }
@ -113,6 +114,7 @@ NetFilteringResultCache.prototype.rememberResult = function(
/******************************************************************************/ /******************************************************************************/
NetFilteringResultCache.prototype.rememberBlock = function(fctxt) { NetFilteringResultCache.prototype.rememberBlock = function(fctxt) {
if ( fctxt.tabId <= 0 ) { return; }
if ( this.blocked.size === 0 ) { if ( this.blocked.size === 0 ) {
this.pruneAsync(); this.pruneAsync();
} }

View File

@ -283,7 +283,14 @@ const onBeforeBehindTheSceneRequest = function(fctxt) {
let result = 0; let result = 0;
// https://github.com/uBlockOrigin/uBlock-issues/issues/339
// Need to also test against `-scheme` since tabOrigin is normalized.
// Not especially elegant but for now this accomplishes the purpose of
// not dealing with network requests fired from a synthetic scope,
// that is unless advanced user mode is enabled.
if ( if (
fctxt.tabOrigin.endsWith('-scheme') === false &&
µb.URI.isNetworkURI(fctxt.tabOrigin) || µb.URI.isNetworkURI(fctxt.tabOrigin) ||
µb.userSettings.advancedUserEnabled || µb.userSettings.advancedUserEnabled ||
fctxt.type === 'csp_report' fctxt.type === 'csp_report'
@ -303,8 +310,6 @@ const onBeforeBehindTheSceneRequest = function(fctxt) {
} }
} }
pageStore.journalAddRequest(fctxt.getHostname(), result);
if ( µb.logger.enabled ) { if ( µb.logger.enabled ) {
fctxt.setRealm('net').toLogger(); fctxt.setRealm('net').toLogger();
} }

View File

@ -19,7 +19,7 @@
</select> </select>
<span id="refresh" class="button fa disabled needdom">&#xf021;</span> <span id="refresh" class="button fa disabled needdom">&#xf021;</span>
<span id="showdom" class="button fa disabled needdom">&#xf121;</span> <span id="showdom" class="button fa disabled needdom">&#xf121;</span>
<span id="showpopup" class="button disabled needscope"><img src="/img/icon_64.png"></span> <span id="showpopup" class="button disabled needdom"><img src="/img/icon_64.png"></span>
</div> </div>
</div> </div>