From 27dea59284776a01c86dce43120d5b5ebea8e2ee Mon Sep 17 00:00:00 2001 From: gorhill Date: Thu, 27 Apr 2017 08:10:54 -0400 Subject: [PATCH] fix #759 --- src/_locales/en/messages.json | 6 +++++- src/js/background.js | 2 +- src/js/matrix.js | 13 ++++++------- src/js/pagestats.js | 15 ++++++--------- src/js/popup.js | 10 +++++----- src/js/traffic.js | 4 ++-- src/popup.html | 2 +- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index d1cb367..abbd7aa 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -53,10 +53,14 @@ "message": "image", "description": "HAS TO FIT IN MATRIX HEADER!" }, - "pluginPrettyName": { + "mediaPrettyName": { "message": "media", "description": "HAS TO FIT IN MATRIX HEADER!" }, + "pluginPrettyName": { + "message": "plugin", + "description": "HAS TO FIT IN MATRIX HEADER!" + }, "scriptPrettyName": { "message": "script", "description": "HAS TO FIT IN MATRIX HEADER!" diff --git a/src/js/background.js b/src/js/background.js index 54b2ea6..a9ba8fa 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -63,7 +63,7 @@ _RequestStats.prototype.reset = function() { this.script = this.css = this.image = - this.plugin = + this.media = this.xhr = this.other = this.cookie = 0; diff --git a/src/js/matrix.js b/src/js/matrix.js index 147b52c..f7b1cab 100644 --- a/src/js/matrix.js +++ b/src/js/matrix.js @@ -64,7 +64,7 @@ var typeBitOffsets = { 'cookie': 4, 'css': 6, 'image': 8, - 'plugin': 10, + 'media': 10, 'script': 12, 'xhr': 14, 'frame': 16, @@ -795,6 +795,11 @@ Matrix.prototype.fromString = function(text, append) { if ( fieldVal !== undefined ) { type = fieldVal; + // https://github.com/gorhill/uMatrix/issues/759 + // Backward compatibility. + if ( type === 'plugin' ) { + type = 'media'; + } // Unknown type: reject if ( typeBitOffsets.hasOwnProperty(type) === false ) { continue; @@ -815,12 +820,6 @@ Matrix.prototype.fromString = function(text, append) { state = 2; } - // Backward compatibility: - // `chromium-behind-the-scene` is now `behind-the-scene` - if ( srcHostname === 'chromium-behind-the-scene' ) { - srcHostname = 'behind-the-scene'; - } - matrix.setCell(srcHostname, desHostname, type, state); } diff --git a/src/js/pagestats.js b/src/js/pagestats.js index 4a0458f..98351db 100644 --- a/src/js/pagestats.js +++ b/src/js/pagestats.js @@ -1,7 +1,7 @@ /******************************************************************************* - µMatrix - a Chromium browser extension to black/white list requests. - Copyright (C) 2013 Raymond Hill + uMatrix - a Chromium browser extension to black/white list requests. + Copyright (C) 2013-2017 Raymond Hill This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,9 +19,10 @@ Home: https://github.com/gorhill/uMatrix */ -/* global chrome, µMatrix */ /* jshint bitwise: false, boss: true */ +'use strict'; + /******************************************************************************* A PageRequestStore object is used to store net requests in two ways: @@ -32,8 +33,6 @@ To record distinct net requests µMatrix.PageRequestStats = (function() { -'use strict'; - /******************************************************************************/ // Caching useful global vars @@ -51,7 +50,7 @@ var typeToCode = { 'css' : 'c', 'script': 'd', 'image' : 'e', - 'plugin': 'f', + 'media' : 'f', 'xhr' : 'g', 'other' : 'h', 'cookie': 'i' @@ -63,7 +62,7 @@ var codeToType = { 'c': 'css', 'd': 'script', 'e': 'image', - 'f': 'plugin', + 'f': 'media', 'g': 'xhr', 'h': 'other', 'i': 'cookie' @@ -303,8 +302,6 @@ return { µMatrix.PageStore = (function() { -'use strict'; - /******************************************************************************/ var µm = µMatrix; diff --git a/src/js/popup.js b/src/js/popup.js index f83029d..86eb528 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -57,7 +57,7 @@ var matrixHeaderPrettyNames = { 'cookie': '', 'css': '', 'image': '', - 'plugin': '', + 'media': '', 'script': '', 'xhr': '', 'frame': '', @@ -568,9 +568,9 @@ function renderMatrixHeaderRow() { addCellClass(cell, '*', 'image'); cell = cells.nodeAt(4); expandos = expandosFromNode(cell); - expandos.reqType = 'plugin'; + expandos.reqType = 'media'; expandos.hostname = '*'; - addCellClass(cell, '*', 'plugin'); + addCellClass(cell, '*', 'media'); cell = cells.nodeAt(5); expandos = expandosFromNode(cell); expandos.reqType = 'script'; @@ -647,7 +647,7 @@ function renderMatrixCellTypes(cells, hostname, countName) { renderMatrixCellType(cells.at(1), hostname, 'cookie', counts[countIndices.cookie]); renderMatrixCellType(cells.at(2), hostname, 'css', counts[countIndices.css]); renderMatrixCellType(cells.at(3), hostname, 'image', counts[countIndices.image]); - renderMatrixCellType(cells.at(4), hostname, 'plugin', counts[countIndices.plugin]); + renderMatrixCellType(cells.at(4), hostname, 'media', counts[countIndices.media]); renderMatrixCellType(cells.at(5), hostname, 'script', counts[countIndices.script]); renderMatrixCellType(cells.at(6), hostname, 'xhr', counts[countIndices.xhr]); renderMatrixCellType(cells.at(7), hostname, 'frame', counts[countIndices.frame]); @@ -713,7 +713,7 @@ function makeMatrixMetaRow(totals) { renderMatrixMetaCellType(cells.at(1), totals[typeOffsets.cookie]); renderMatrixMetaCellType(cells.at(2), totals[typeOffsets.css]); renderMatrixMetaCellType(cells.at(3), totals[typeOffsets.image]); - renderMatrixMetaCellType(cells.at(4), totals[typeOffsets.plugin]); + renderMatrixMetaCellType(cells.at(4), totals[typeOffsets.media]); renderMatrixMetaCellType(cells.at(5), totals[typeOffsets.script]); renderMatrixMetaCellType(cells.at(6), totals[typeOffsets.xhr]); renderMatrixMetaCellType(cells.at(7), totals[typeOffsets.frame]); diff --git a/src/js/traffic.js b/src/js/traffic.js index 1d0d6f5..189abc4 100644 --- a/src/js/traffic.js +++ b/src/js/traffic.js @@ -451,8 +451,8 @@ var requestTypeNormalizer = { 'image' : 'image', 'imageset' : 'image', 'main_frame' : 'doc', - 'media' : 'plugin', - 'object' : 'plugin', + 'media' : 'media', + 'object' : 'media', 'other' : 'other', 'ping' : 'ping', 'script' : 'script', diff --git a/src/popup.html b/src/popup.html index 42c95ee..1a905d3 100644 --- a/src/popup.html +++ b/src/popup.html @@ -53,7 +53,7 @@
- +