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

Unified Diff: lib/csp.js

Issue 29570614: Issue 5028 - Use browser namespace (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Update ensure_dependencies.py Created Oct. 16, 2017, 12:16 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 | « inject.preload.js ('k') | lib/cssInjection.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/csp.js
===================================================================
--- a/lib/csp.js
+++ b/lib/csp.js
@@ -16,25 +16,25 @@
*/
"use strict";
// The webRequest API doesn't support WebSocket connection blocking in Microsoft
// Edge and versions of Chrome before 58. Therefore for those we inject CSP
// headers below as a workaround. See https://crbug.com/129353 and
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10297376/
-if (!chrome.webRequest.ResourceType ||
- !("WEBSOCKET" in chrome.webRequest.ResourceType))
+if (!browser.webRequest.ResourceType ||
+ !("WEBSOCKET" in browser.webRequest.ResourceType))
{
const {defaultMatcher} = require("matcher");
const {BlockingFilter, RegExpFilter} = require("filterClasses");
const {getDecodedHostname} = require("url");
const {checkWhitelisted} = require("whitelisting");
- chrome.webRequest.onHeadersReceived.addListener(details =>
+ browser.webRequest.onHeadersReceived.addListener(details =>
{
let hostname = getDecodedHostname(new URL(details.url));
let match = defaultMatcher.matchesAny("", RegExpFilter.typeMap.WEBSOCKET,
hostname, false, null, true);
if (match instanceof BlockingFilter &&
!checkWhitelisted(new ext.Page({id: details.tabId}),
ext.getFrame(details.tabId, details.frameId)))
{
« no previous file with comments | « inject.preload.js ('k') | lib/cssInjection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld