Browse Source

fix #759

pull/2/head
gorhill 8 years ago
parent
commit
27dea59284
  1. 6
      src/_locales/en/messages.json
  2. 2
      src/js/background.js
  3. 13
      src/js/matrix.js
  4. 15
      src/js/pagestats.js
  5. 10
      src/js/popup.js
  6. 4
      src/js/traffic.js
  7. 2
      src/popup.html

6
src/_locales/en/messages.json

@ -53,10 +53,14 @@
"message": "image", "message": "image",
"description": "HAS TO FIT IN MATRIX HEADER!" "description": "HAS TO FIT IN MATRIX HEADER!"
}, },
"pluginPrettyName": {
"mediaPrettyName": {
"message": "media", "message": "media",
"description": "HAS TO FIT IN MATRIX HEADER!" "description": "HAS TO FIT IN MATRIX HEADER!"
}, },
"pluginPrettyName": {
"message": "plugin",
"description": "HAS TO FIT IN MATRIX HEADER!"
},
"scriptPrettyName": { "scriptPrettyName": {
"message": "script", "message": "script",
"description": "HAS TO FIT IN MATRIX HEADER!" "description": "HAS TO FIT IN MATRIX HEADER!"

2
src/js/background.js

@ -63,7 +63,7 @@ _RequestStats.prototype.reset = function() {
this.script = this.script =
this.css = this.css =
this.image = this.image =
this.plugin =
this.media =
this.xhr = this.xhr =
this.other = this.other =
this.cookie = 0; this.cookie = 0;

13
src/js/matrix.js

@ -64,7 +64,7 @@ var typeBitOffsets = {
'cookie': 4, 'cookie': 4,
'css': 6, 'css': 6,
'image': 8, 'image': 8,
'plugin': 10,
'media': 10,
'script': 12, 'script': 12,
'xhr': 14, 'xhr': 14,
'frame': 16, 'frame': 16,
@ -795,6 +795,11 @@ Matrix.prototype.fromString = function(text, append) {
if ( fieldVal !== undefined ) { if ( fieldVal !== undefined ) {
type = fieldVal; type = fieldVal;
// https://github.com/gorhill/uMatrix/issues/759
// Backward compatibility.
if ( type === 'plugin' ) {
type = 'media';
}
// Unknown type: reject // Unknown type: reject
if ( typeBitOffsets.hasOwnProperty(type) === false ) { if ( typeBitOffsets.hasOwnProperty(type) === false ) {
continue; continue;
@ -815,12 +820,6 @@ Matrix.prototype.fromString = function(text, append) {
state = 2; 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); matrix.setCell(srcHostname, desHostname, type, state);
} }

15
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 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 it under the terms of the GNU General Public License as published by
@ -19,9 +19,10 @@
Home: https://github.com/gorhill/uMatrix Home: https://github.com/gorhill/uMatrix
*/ */
/* global chrome, µMatrix */
/* jshint bitwise: false, boss: true */ /* jshint bitwise: false, boss: true */
'use strict';
/******************************************************************************* /*******************************************************************************
A PageRequestStore object is used to store net requests in two ways: A PageRequestStore object is used to store net requests in two ways:
@ -32,8 +33,6 @@ To record distinct net requests
µMatrix.PageRequestStats = (function() { µMatrix.PageRequestStats = (function() {
'use strict';
/******************************************************************************/ /******************************************************************************/
// Caching useful global vars // Caching useful global vars
@ -51,7 +50,7 @@ var typeToCode = {
'css' : 'c', 'css' : 'c',
'script': 'd', 'script': 'd',
'image' : 'e', 'image' : 'e',
'plugin': 'f',
'media' : 'f',
'xhr' : 'g', 'xhr' : 'g',
'other' : 'h', 'other' : 'h',
'cookie': 'i' 'cookie': 'i'
@ -63,7 +62,7 @@ var codeToType = {
'c': 'css', 'c': 'css',
'd': 'script', 'd': 'script',
'e': 'image', 'e': 'image',
'f': 'plugin',
'f': 'media',
'g': 'xhr', 'g': 'xhr',
'h': 'other', 'h': 'other',
'i': 'cookie' 'i': 'cookie'
@ -303,8 +302,6 @@ return {
µMatrix.PageStore = (function() { µMatrix.PageStore = (function() {
'use strict';
/******************************************************************************/ /******************************************************************************/
var µm = µMatrix; var µm = µMatrix;

10
src/js/popup.js

@ -57,7 +57,7 @@ var matrixHeaderPrettyNames = {
'cookie': '', 'cookie': '',
'css': '', 'css': '',
'image': '', 'image': '',
'plugin': '',
'media': '',
'script': '', 'script': '',
'xhr': '', 'xhr': '',
'frame': '', 'frame': '',
@ -568,9 +568,9 @@ function renderMatrixHeaderRow() {
addCellClass(cell, '*', 'image'); addCellClass(cell, '*', 'image');
cell = cells.nodeAt(4); cell = cells.nodeAt(4);
expandos = expandosFromNode(cell); expandos = expandosFromNode(cell);
expandos.reqType = 'plugin';
expandos.reqType = 'media';
expandos.hostname = '*'; expandos.hostname = '*';
addCellClass(cell, '*', 'plugin');
addCellClass(cell, '*', 'media');
cell = cells.nodeAt(5); cell = cells.nodeAt(5);
expandos = expandosFromNode(cell); expandos = expandosFromNode(cell);
expandos.reqType = 'script'; expandos.reqType = 'script';
@ -647,7 +647,7 @@ function renderMatrixCellTypes(cells, hostname, countName) {
renderMatrixCellType(cells.at(1), hostname, 'cookie', counts[countIndices.cookie]); renderMatrixCellType(cells.at(1), hostname, 'cookie', counts[countIndices.cookie]);
renderMatrixCellType(cells.at(2), hostname, 'css', counts[countIndices.css]); renderMatrixCellType(cells.at(2), hostname, 'css', counts[countIndices.css]);
renderMatrixCellType(cells.at(3), hostname, 'image', counts[countIndices.image]); 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(5), hostname, 'script', counts[countIndices.script]);
renderMatrixCellType(cells.at(6), hostname, 'xhr', counts[countIndices.xhr]); renderMatrixCellType(cells.at(6), hostname, 'xhr', counts[countIndices.xhr]);
renderMatrixCellType(cells.at(7), hostname, 'frame', counts[countIndices.frame]); 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(1), totals[typeOffsets.cookie]);
renderMatrixMetaCellType(cells.at(2), totals[typeOffsets.css]); renderMatrixMetaCellType(cells.at(2), totals[typeOffsets.css]);
renderMatrixMetaCellType(cells.at(3), totals[typeOffsets.image]); 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(5), totals[typeOffsets.script]);
renderMatrixMetaCellType(cells.at(6), totals[typeOffsets.xhr]); renderMatrixMetaCellType(cells.at(6), totals[typeOffsets.xhr]);
renderMatrixMetaCellType(cells.at(7), totals[typeOffsets.frame]); renderMatrixMetaCellType(cells.at(7), totals[typeOffsets.frame]);

4
src/js/traffic.js

@ -451,8 +451,8 @@ var requestTypeNormalizer = {
'image' : 'image', 'image' : 'image',
'imageset' : 'image', 'imageset' : 'image',
'main_frame' : 'doc', 'main_frame' : 'doc',
'media' : 'plugin',
'object' : 'plugin',
'media' : 'media',
'object' : 'media',
'other' : 'other', 'other' : 'other',
'ping' : 'ping', 'ping' : 'ping',
'script' : 'script', 'script' : 'script',

2
src/popup.html

@ -53,7 +53,7 @@
</div> </div>
</div> </div>
<div id="matHead" class="matrix collapsible"> <div id="matHead" class="matrix collapsible">
<div class="matRow rw" style="display:none"><div class="matCell" data-req-type="all">all</div><div class="matCell" data-req-type="cookie">cookie</div><div class="matCell" data-req-type="css">css</div><div class="matCell" data-req-type="image">img</div><div class="matCell" data-req-type="plugin">plugin</div><div class="matCell" data-req-type="script">script</div><div class="matCell" data-req-type="xhr">XHR</div><div class="matCell" data-req-type="frame">frame</div><div class="matCell" data-req-type="other">other</div></div>
<div class="matRow rw" style="display:none"><div class="matCell" data-req-type="all">all</div><div class="matCell" data-req-type="cookie">cookie</div><div class="matCell" data-req-type="css">css</div><div class="matCell" data-req-type="image">img</div><div class="matCell" data-req-type="media">media</div><div class="matCell" data-req-type="script">script</div><div class="matCell" data-req-type="xhr">XHR</div><div class="matCell" data-req-type="frame">frame</div><div class="matCell" data-req-type="other">other</div></div>
</div> </div>
</div> </div>

Loading…
Cancel
Save