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

Unified Diff: chrome/content/ui/sidebar.js

Issue 29329479: Issue 3222 - Get rid of RequestEntry.typeDescr property (Closed)
Patch Set: Created Oct. 29, 2015, 1:57 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/content/ui/sendReport.js ('k') | lib/requestNotifier.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/ui/sidebar.js
===================================================================
--- a/chrome/content/ui/sidebar.js
+++ b/chrome/content/ui/sidebar.js
@@ -256,23 +256,23 @@ function fillInTooltip(e) {
E("tooltipDocDomainRow").hidden = ("tooltip" in item || !item.docDomain);
E("tooltipFilterRow").hidden = !filter;
E("tooltipFilterSourceRow").hidden = !subscriptions.length;
if ("tooltip" in item)
E("tooltipDummy").setAttribute("value", item.tooltip);
else
{
- E("tooltipAddress").parentNode.hidden = (item.typeDescr == "ELEMHIDE");
+ E("tooltipAddress").parentNode.hidden = (item.type == "ELEMHIDE");
setMultilineContent(E("tooltipAddress"), item.location);
var type = types.get(item.type);
if (filter && filter instanceof WhitelistFilter)
type += " " + E("tooltipType").getAttribute("whitelisted");
- else if (filter && item.typeDescr != "ELEMHIDE")
+ else if (filter && item.type != "ELEMHIDE")
type += " " + E("tooltipType").getAttribute("filtered");
E("tooltipType").setAttribute("value", type);
if (size)
E("tooltipSize").setAttribute("value", size.join(" x "));
E("tooltipDocDomain").setAttribute("value", item.docDomain + " " + (item.thirdParty ? docDomainThirdParty : docDomainFirstParty));
}
@@ -295,17 +295,17 @@ function fillInTooltip(e) {
while (sourceElement.firstChild)
sourceElement.removeChild(sourceElement.firstChild);
for (let i = 0; i < subscriptions.length; i++)
setMultilineContent(sourceElement, subscriptions[i].title, true);
}
}
var showPreview = Prefs.previewimages && !("tooltip" in item);
- showPreview = showPreview && item.typeDescr == "IMAGE";
+ showPreview = showPreview && item.type == "IMAGE";
showPreview = showPreview && (!item.filter || item.filter.disabled || item.filter instanceof WhitelistFilter);
E("tooltipPreviewBox").hidden = true;
if (showPreview)
{
if (!cacheStorage)
{
let {Services} = Cu.import("resource://gre/modules/Services.jsm", null);
// Cache v2 API is enabled by default starting with Gecko 32
@@ -412,22 +412,22 @@ function fillInContext(/**Event*/ e)
{
menuItem = E("contextDisableOnSite");
menuItem.setAttribute("label", menuItem.getAttribute("labeltempl").replace(/\?1\?/, domain));
menuItem.hidden = false;
}
}
}
- E("contextWhitelist").hidden = ("tooltip" in item || !item.filter || item.filter.disabled || item.filter instanceof WhitelistFilter || item.typeDescr == "ELEMHIDE");
+ E("contextWhitelist").hidden = ("tooltip" in item || !item.filter || item.filter.disabled || item.filter instanceof WhitelistFilter || item.type == "ELEMHIDE");
E("contextBlock").hidden = !E("contextWhitelist").hidden;
E("contextBlock").setAttribute("disabled", "filter" in item && item.filter && !item.filter.disabled);
E("contextEditFilter").setAttribute("disabled", !("filter" in item && item.filter));
- E("contextOpen").setAttribute("disabled", "tooltip" in item || item.typeDescr == "ELEMHIDE");
- E("contextFlash").setAttribute("disabled", "tooltip" in item || !(item.typeDescr in visual) || (item.filter && !item.filter.disabled && !(item.filter instanceof WhitelistFilter)));
+ E("contextOpen").setAttribute("disabled", "tooltip" in item || item.type == "ELEMHIDE");
+ E("contextFlash").setAttribute("disabled", "tooltip" in item || !(item.type in visual) || (item.filter && !item.filter.disabled && !(item.filter instanceof WhitelistFilter)));
E("contextCopyFilter").setAttribute("disabled", !allItems.some(function(item) {return "filter" in item && item.filter}));
return true;
}
/**
* Resets context menu data once the context menu is closed.
*/
@@ -479,24 +479,24 @@ function handleDblClick(event)
/**
* Opens the item in a new tab.
*/
function openInTab(item, /**Event*/ event)
{
let items = (item ? [item] : treeView.getAllSelectedItems());
for (let item of items)
{
- if (item && item.typeDescr != "ELEMHIDE")
+ if (item && item.type != "ELEMHIDE")
UI.loadInBrowser(item.location, mainWin, event);
}
}
function doBlock() {
var item = treeView.getSelectedItem();
- if (!item || item.typeDescr == "ELEMHIDE")
+ if (!item || item.type == "ELEMHIDE")
return;
var filter = null;
if (item.filter && !item.filter.disabled)
filter = item.filter;
if (filter && filter instanceof WhitelistFilter)
return;
@@ -1097,17 +1097,17 @@ var treeView = {
// Add new item to the list
// Store original item in orig property - reading out prototype is messed up in Gecko 1.9.2
item = {__proto__: item, orig: item, nodes: [node]};
this.allData.push(item);
this.dataMap[key] = item;
// Show disabled filters if no other filter applies
if (!item.filter)
- item.filter = disabledMatcher.matchesAny(item.location, RegExpFilter.typeMap[item.typeDescr], item.docDomain, item.thirdParty);
+ item.filter = disabledMatcher.matchesAny(item.location, RegExpFilter.typeMap[item.type], item.docDomain, item.thirdParty);
if (!this.matchesFilter(item))
return;
let index = -1;
if (this.sortProc && this.sortColumn && this.sortColumn.id == "size")
{
// Sorting by size requires accessing content document, and that's
@@ -1152,17 +1152,17 @@ var treeView = {
updateFilters: function()
{
for (let item of this.allData)
{
if (item.filter instanceof RegExpFilter && item.filter.disabled)
delete item.filter;
if (!item.filter)
- item.filter = disabledMatcher.matchesAny(item.location, RegExpFilter.typeMap[item.typeDescr], item.docDomain, item.thirdParty);
+ item.filter = disabledMatcher.matchesAny(item.location, RegExpFilter.typeMap[item.type], item.docDomain, item.thirdParty);
}
this.refilter();
},
/**
* Updates the list after a filter or sorting change.
*/
refilter: function()
@@ -1182,17 +1182,17 @@ var treeView = {
*/
matchesFilter: function(item)
{
if (!this.filter)
return true;
return (item.location.toLowerCase().indexOf(this.filter) >= 0 ||
(item.filter && item.filter.text.toLowerCase().indexOf(this.filter) >= 0) ||
- item.typeDescr.toLowerCase().indexOf(this.filter.replace(/-/g, "_")) >= 0 ||
+ item.type.toLowerCase().indexOf(this.filter.replace(/-/g, "_")) >= 0 ||
types.get(item.type).toLowerCase().indexOf(this.filter) >= 0 ||
(item.docDomain && item.docDomain.toLowerCase().indexOf(this.filter) >= 0) ||
(item.docDomain && item.thirdParty && docDomainThirdParty.toLowerCase().indexOf(this.filter) >= 0) ||
(item.docDomain && !item.thirdParty && docDomainFirstParty.toLowerCase().indexOf(this.filter) >= 0));
},
setFilter: function(filter) {
var oldRows = this.rowCount;
« no previous file with comments | « chrome/content/ui/sendReport.js ('k') | lib/requestNotifier.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld