Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: ext/background.js

Issue 29602570: Issue 6010 - Ignore requests initiated by the browser or extensions (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome
Patch Set: Created Nov. 9, 2017, 4:17 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ext/background.js
===================================================================
--- a/ext/background.js
+++ b/ext/background.js
@@ -583,16 +583,28 @@
// ws:// and wss://) with the url patterns, given below, when adding this
// listener. But unfortunately, Chrome <=57 doesn't support the WebSocket
// protocol and is causing an error if it is given.
let url = new URL(details.url);
if (url.protocol != "http:" && url.protocol != "https:" &&
url.protocol != "ws:" && url.protocol != "wss:")
return;
+ if (details.originUrl)
+ {
+ // Firefox-only currently, ignore requests initiated by the browser and
+ // extensions.
+ let originUrl = new URL(details.originUrl);
+ if (originUrl.protocol == "chrome:" ||
+ originUrl.protocol == "moz-extension:")
+ {
+ return;
+ }
+ }
+
// We are looking for the frame that contains the element which
// has triggered this request. For most requests (e.g. images) we
// can just use the request's frame ID, but for subdocument requests
// (e.g. iframes) we must instead use the request's parent frame ID.
let {frameId, type} = details;
if (type == "sub_frame")
frameId = details.parentFrameId;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld