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",
"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!"

2
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;

13
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);
}

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
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;

10
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]);

4
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',

2
src/popup.html

@ -53,7 +53,7 @@
</div>
</div>
<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>

Loading…
Cancel
Save