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

Delta Between Two Patch Sets: devtools-panel.js

Issue 29608555: Issue 6035 - Only use openResource API when it's supported (Closed)
Left Patch Set: Created Nov. 14, 2017, 3:13 p.m.
Right Patch Set: Only listen for left click events Created Nov. 14, 2017, 3:31 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 | « devtools-panel.html ('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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present 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
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 if (request.url) 90 if (request.url)
91 { 91 {
92 urlElement.textContent = request.url; 92 urlElement.textContent = request.url;
93 urlElement.setAttribute("href", request.url); 93 urlElement.setAttribute("href", request.url);
94 94
95 // Firefox 57 doesn't support the openResource API. 95 // Firefox 57 doesn't support the openResource API.
96 if (request.type != "POPUP" && "openResource" in ext.devtools.panels) 96 if (request.type != "POPUP" && "openResource" in ext.devtools.panels)
97 { 97 {
98 urlElement.addEventListener("click", event => 98 urlElement.addEventListener("click", event =>
99 { 99 {
100 ext.devtools.panels.openResource(request.url); 100 if (event.button == 0)
101 event.preventDefault(); 101 {
Wladimir Palant 2017/11/14 15:22:40 Wait, won't this handle middle-clicks as well in C
kzar 2017/11/14 15:33:43 Well I just tested that and our event only fires f
102 ext.devtools.panels.openResource(request.url);
103 event.preventDefault();
104 }
102 }, false); 105 }, false);
103 } 106 }
104 } 107 }
105 108
106 if (filter) 109 if (filter)
107 { 110 {
108 let filterElement = row.querySelector(".filter"); 111 let filterElement = row.querySelector(".filter");
109 let originElement = row.querySelector(".origin"); 112 let originElement = row.querySelector(".origin");
110 113
111 filterElement.textContent = filter.text; 114 filterElement.textContent = filter.text;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 break; 255 break;
253 } 256 }
254 }); 257 });
255 258
256 // Since Chrome 54 the themeName is accessible, for earlier versions we must 259 // Since Chrome 54 the themeName is accessible, for earlier versions we must
257 // assume the default theme is being used. 260 // assume the default theme is being used.
258 // https://bugs.chromium.org/p/chromium/issues/detail?id=608869 261 // https://bugs.chromium.org/p/chromium/issues/detail?id=608869
259 let theme = browser.devtools.panels.themeName || "default"; 262 let theme = browser.devtools.panels.themeName || "default";
260 document.body.classList.add(theme); 263 document.body.classList.add(theme);
261 }, false); 264 }, false);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld