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

Unified Diff: ext/devtools.js

Issue 5646124035604480: Issue 154 - Added UI for devtools panel on Chrome (Closed)
Patch Set: Created Jan. 7, 2015, 1:36 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
Index: ext/devtools.js
===================================================================
new file mode 100644
--- /dev/null
+++ b/ext/devtools.js
@@ -0,0 +1,114 @@
+/*
+ * This file is part of Adblock Plus <http://adblockplus.org/>,
+ * Copyright (C) 2006-2015 Eyeo GmbH
+ *
+ * Adblock Plus is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Adblock Plus is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ext.devtools = {
+ connect: function()
+ {
+ return {
+ postMessage: function() {},
+
+ onMessage: {
+ addListener: function(listener)
Wladimir Palant 2015/01/10 08:33:29 Quite frankly, I don't like the idea of having a d
Sebastian Noack 2015/01/10 08:53:45 Yes, it will be fairly complicated. Ports are very
Thomas Greiner 2015/01/12 10:37:54 Right, the existing abstraction layer would probab
Wladimir Palant 2015/01/13 07:28:04 I see, that's making things too complicated indeed
Sebastian Noack 2015/02/04 14:17:29 As discussed some weeks ago, we can actually use r
+ {
+ // blocked request
+ listener({
+ type: "add-record",
+ request: {
+ url: "http://adserver.example.com/ad_banner.png",
+ type: "IMAGE",
+ docDomain: "example.com"
+ },
+ filter: {
+ text: "/ad_banner*$domain=example.com",
+ whitelisted: false,
+ userDefined: false,
+ subscription: "EasyList"
+ }
+ });
+
+ // whiletisted request
+ listener({
+ type: "add-record",
+ request: {
+ url: "http://example.com/looks_like_an_ad_but_isnt_one.html",
+ type: "SUBDOCUMENT",
+ docDomain: "example.com"
+ },
+ filter: {
+ text: "@@||example.com/looks_like_an_ad_but_isnt_one.html",
+ whitelisted: true,
+ userDefined: false,
+ subscription: "EasyList"
+ }
+ });
+
+ // request with long URL and no filter matches
+ listener({
+ type: "add-record",
+ request: {
+ 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",
+ type: "XMLHTTPREQUEST",
+ docDomain: "example.com"
+ },
+ filter: null
+ });
+
+ // matching element hiding filter
+ listener({
+ type: "add-record",
+ request: {
+ type: "ELEMHIDE",
+ docDomain: "example.com"
+ },
+ filter: {
+ text: "example.com##.ad_banner",
+ whitelisted: false,
+ userDefined: false,
+ subscription: "EasyList"
+ }
+ });
+
+ // user-defined filter
+ listener({
+ type: "add-record",
+ request: {
+ url: "http://example.com/some-annoying-popup",
+ type: "POPUP",
+ docDomain: "example.com"
+ },
+ filter: {
+ text: "||example.com/some-annoying-popup$popup",
+ whitelisted: false,
+ userDefined: true,
+ subscription: null
+ }
+ });
Wladimir Palant 2015/01/10 08:33:29 I'd rather have proper message exchange simulated,
Sebastian Noack 2015/01/10 08:53:45 This would makes things significantly more complex
Thomas Greiner 2015/01/12 10:37:54 More complex because we're using two different met
Sebastian Noack 2015/01/12 11:55:07 What Wladimir is suggesting is to inject an iframe
Wladimir Palant 2015/01/13 07:28:04 Yes, this is just us testing that thing properly a
Sebastian Noack 2015/02/04 14:17:29 Yep, done, see above.
+
+ }
+ }
+ };
+ },
+
+ panels: {
+ openResource: function() {}
+ },
+
+ inspectedWindow: {
+ reload: function() {}
+ }
+}
+

Powered by Google App Engine
This is Rietveld