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

Unified Diff: messageResponder.js

Issue 29522650: Issue 5316 - Adds dynamic filter types to devtools panel (Closed)
Patch Set: move OTHER filterType to end of array Created Sept. 11, 2017, 10:36 a.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 | « devtools-panel.js ('k') | skin/devtools-panel.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: messageResponder.js
===================================================================
--- a/messageResponder.js
+++ b/messageResponder.js
@@ -37,16 +37,23 @@
const info = require("info");
const {
Subscription,
DownloadableSubscription,
SpecialSubscription
} = require("subscriptionClasses");
+ port.on("types.get", (message, sender) =>
+ {
+ let filterTypes = Array.from(require("requestBlocker").filterTypes);
+ filterTypes.push(filterTypes.splice(filterTypes.indexOf("OTHER"), 1)[0]);
Sebastian Noack 2017/09/11 16:44:14 I would rather use the rest operator here. That wa
Jon Sonesen 2017/09/12 11:42:41 Oh, nifty. Thanks for pointing that out
+ return filterTypes;
+ });
+
// Some modules doesn't exist on Firefox. Moreover,
// require() throws an exception on Firefox in that case.
// However, try/catch causes the whole function to to be
// deoptimized on V8. So we wrap it into another function.
function tryRequire(module)
{
try
{
« no previous file with comments | « devtools-panel.js ('k') | skin/devtools-panel.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld