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

Unified Diff: lib/contentPolicy.js

Issue 29333043: Issue 3452 - Bring back $ping type option (Core changes) (Closed)
Patch Set: Created Dec. 23, 2015, 1:04 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 | « chrome/locale/en-US/global.properties ('k') | lib/filterClasses.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/contentPolicy.js
===================================================================
--- a/lib/contentPolicy.js
+++ b/lib/contentPolicy.js
@@ -38,27 +38,27 @@ let {ElemHide} = require("elemHide");
var Policy = exports.Policy =
{
/**
* Set of explicitly supported content types
* @type Set.<string>
*/
contentTypes: new Set([
"OTHER", "SCRIPT", "IMAGE", "STYLESHEET", "OBJECT", "SUBDOCUMENT", "DOCUMENT",
- "XMLHTTPREQUEST", "OBJECT_SUBREQUEST", "FONT", "MEDIA", "ELEMHIDE", "POPUP",
- "GENERICHIDE", "GENERICBLOCK"
+ "XMLHTTPREQUEST", "OBJECT_SUBREQUEST", "FONT", "MEDIA", "PING", "ELEMHIDE",
+ "POPUP", "GENERICHIDE", "GENERICBLOCK"
]),
/**
* Set of content types that aren't associated with a visual document area
* @type Set.<string>
*/
nonVisualTypes: new Set([
"SCRIPT", "STYLESHEET", "XMLHTTPREQUEST", "OBJECT_SUBREQUEST", "FONT",
- "ELEMHIDE", "POPUP", "GENERICHIDE", "GENERICBLOCK"
+ "PING", "ELEMHIDE", "POPUP", "GENERICHIDE", "GENERICBLOCK"
]),
/**
* Map containing all schemes that should be ignored by content policy.
* @type Set.<string>
*/
whitelistSchemes: new Set(),
@@ -120,16 +120,21 @@ var Policy = exports.Policy =
{
return {allow, collapse, hits};
}
// Ignore whitelisted schemes
if (!this.isBlockableScheme(location))
return response(true, false);
+ // Treat navigator.sendBeacon() the same as <a ping>, it's essentially the
+ // same concept - merely generalized.
Sebastian Noack 2015/12/23 13:34:45 I'm inclined to also add a note that we cannot dis
Wladimir Palant 2015/12/23 14:14:34 That means fairly little for Firefox - we wouldn't
Sebastian Noack 2015/12/23 14:18:18 Well, given that Chrome is our largest platform, I
+ if (contentType == "BEACON")
+ contentType = "PING";
+
// Interpret unknown types as "other"
if (!this.contentTypes.has(contentType))
contentType = "OTHER";
let wndLocation = frames[0].location;
let docDomain = getHostname(wndLocation);
let match = null;
let [sitekey, sitekeyFrame] = getSitekey(frames);
« no previous file with comments | « chrome/locale/en-US/global.properties ('k') | lib/filterClasses.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld