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

Delta Between Two Patch Sets: ext/devtools.js

Issue 5646124035604480: Issue 154 - Added UI for devtools panel on Chrome (Closed)
Left Patch Set: Addressed Sven's comments and use an HTML template for table rows Created Jan. 13, 2015, 12:16 p.m.
Right Patch Set: Added new request types Created Jan. 28, 2016, 7:37 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « ext/content.js ('k') | skin/devtools-panel.css » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 ext.devtools = { 18 "use strict";
19 connect: function()
20 {
21 return {
22 postMessage: function() {},
23 19
24 onMessage: { 20 (function(global)
25 addListener: function(listener) 21 {
26 { 22 if (!global.ext)
27 // blocked request 23 global.ext = {};
28 listener({
29 type: "add-record",
30 request: {
31 url: "http://adserver.example.com/ad_banner.png",
32 type: "IMAGE",
33 docDomain: "example.com"
34 },
35 filter: {
36 text: "/ad_banner*$domain=example.com",
37 whitelisted: false,
38 userDefined: false,
39 subscription: "EasyList"
40 }
41 });
42 24
43 // whiletisted request 25 global.ext.devtools = {
44 listener({ 26 panels: {
45 type: "add-record", 27 openResource: function() {}
46 request: { 28 },
47 url: "http://example.com/looks_like_an_ad_but_isnt_one.html",
48 type: "SUBDOCUMENT",
49 docDomain: "example.com"
50 },
51 filter: {
52 text: "@@||example.com/looks_like_an_ad_but_isnt_one.html",
53 whitelisted: true,
54 userDefined: false,
55 subscription: "EasyList"
56 }
57 });
58 29
59 // request with long URL and no filter matches 30 inspectedWindow: {
60 listener({ 31 reload: function() {}
61 type: "add-record", 32 }
62 request: { 33 };
63 url: "https://this.url.has.a.long.domain/and_a_long_path_maybe_not _long_enough_so_i_keep_typing?there=are&a=couple&of=parameters&as=well&and=even& some=more",
64 type: "XMLHTTPREQUEST",
65 docDomain: "example.com"
66 },
67 filter: null
68 });
69 34
70 // matching element hiding filter 35 global.ext.backgroundPage._sendRawMessage({type: "devtools"});
71 listener({ 36 })(this);
72 type: "add-record",
73 request: {
74 type: "ELEMHIDE",
75 docDomain: "example.com"
76 },
77 filter: {
78 text: "example.com##.ad_banner",
79 whitelisted: false,
80 userDefined: false,
81 subscription: "EasyList"
82 }
83 });
84
85 // user-defined filter
86 listener({
87 type: "add-record",
88 request: {
89 url: "http://example.com/some-annoying-popup",
90 type: "POPUP",
91 docDomain: "example.com"
92 },
93 filter: {
94 text: "||example.com/some-annoying-popup$popup",
95 whitelisted: false,
96 userDefined: true,
97 subscription: null
98 }
99 });
100
101 }
102 }
103 };
104 },
105
106 panels: {
107 openResource: function() {}
108 },
109
110 inspectedWindow: {
111 reload: function() {}
112 }
113 }
114
LEFTRIGHT

Powered by Google App Engine
This is Rietveld