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

Unified Diff: chrome/ext/background.js

Issue 29350213: Issue 4364 - Drop support for Chrome 29-40 and remove legacy code (Closed)
Patch Set: Remove legacy check from composer.postload.js Created Aug. 26, 2016, 12:57 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 | composer.postload.js » ('j') | include.preload.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/ext/background.js
===================================================================
--- a/chrome/ext/background.js
+++ b/chrome/ext/background.js
@@ -469,50 +469,40 @@
chrome.webRequest.onBeforeRequest.addListener(function(details)
{
- // the high-level code isn't interested in requests that aren't related
- // to a tab and since those can only be handled in Chrome, we ignore
- // them here instead of in the browser independent high-level code.
- if (details.tabId == -1)
+ // the high-level code isn't interested in requests that aren't
+ // related to a tab or requests loading a top-level document,
+ // those should never be blocked
+ if (details.tabId == -1 || details.type == "main_frame")
return;
- var isMainFrame = details.type == "main_frame" || (
- // assume that the first request belongs to the top frame. Chrome 29
- // may give the top frame the type "object" instead of "main_frame".
- // https://code.google.com/p/chromium/issues/detail?id=281711
- details.frameId == 0 && !(details.tabId in framesOfTabs)
- );
+ // we are looking for the frame that contains the element that
kzar 2016/08/30 13:14:09 Mind making this comment a bit clearer (or removin
Sebastian Noack 2016/09/09 14:39:50 Well, this comment isn't new and it makes sense to
kzar 2016/09/13 12:30:01 Fair enough, well how about this? "We are looking
Sebastian Noack 2016/09/13 15:21:30 Done.
kzar 2016/09/13 17:08:58 Looks great, thanks.
+ // is about to load, however if a frame is loading the surrounding
+ // frame is indicated by parentFrameId instead of frameId
+ var frameId;
+ var requestType;
+ if (details.type == "sub_frame")
+ {
+ frameId = details.parentFrameId;
+ requestType = "SUBDOCUMENT";
+ }
+ else
+ {
+ frameId = details.frameId;
+ requestType = details.type.toUpperCase();
+ }
- if (!isMainFrame)
+ var frame = ext.getFrame(details.tabId, frameId);
+ if (frame)
{
- // we are looking for the frame that contains the element that
- // is about to load, however if a frame is loading the surrounding
- // frame is indicated by parentFrameId instead of frameId
- var frameId;
- var requestType;
- if (details.type == "sub_frame")
- {
- frameId = details.parentFrameId;
- requestType = "SUBDOCUMENT";
- }
- else
- {
- frameId = details.frameId;
- requestType = details.type.toUpperCase();
- }
+ var results = ext.webRequest.onBeforeRequest._dispatch(
+ new URL(details.url),
+ requestType,
+ new Page({id: details.tabId}),
+ frame
+ );
- var frame = ext.getFrame(details.tabId, frameId);
- if (frame)
- {
- var results = ext.webRequest.onBeforeRequest._dispatch(
- new URL(details.url),
- requestType,
- new Page({id: details.tabId}),
- frame
- );
-
- if (results.indexOf(false) != -1)
- return {cancel: true};
- }
+ if (results.indexOf(false) != -1)
+ return {cancel: true};
}
}, {urls: ["http://*/*", "https://*/*"]}, ["blocking"]);
« no previous file with comments | « no previous file | composer.postload.js » ('j') | include.preload.js » ('J')

Powered by Google App Engine
This is Rietveld