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

Side by Side Diff: devtools-panel.js

Issue 29608555: Issue 6035 - Only use openResource API when it's supported (Closed)
Patch Set: Created Nov. 14, 2017, 3:13 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « devtools-panel.html ('k') | skin/devtools-panel.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 function createRecord(request, filter, template) 79 function createRecord(request, filter, template)
80 { 80 {
81 let row = document.importNode(template, true); 81 let row = document.importNode(template, true);
82 row.dataset.type = request.type; 82 row.dataset.type = request.type;
83 83
84 row.querySelector(".domain").textContent = request.docDomain; 84 row.querySelector(".domain").textContent = request.docDomain;
85 row.querySelector(".type").textContent = request.type; 85 row.querySelector(".type").textContent = request.type;
86 86
87 let urlElement = row.querySelector(".url"); 87 let urlElement = row.querySelector(".resource-link");
88 let actionWrapper = row.querySelector(".action-wrapper"); 88 let actionWrapper = row.querySelector(".action-wrapper");
89 89
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 94
94 if (request.type != "POPUP") 95 // Firefox 57 doesn't support the openResource API.
96 if (request.type != "POPUP" && "openResource" in ext.devtools.panels)
95 { 97 {
96 urlElement.classList.add("resourceLink"); 98 urlElement.addEventListener("click", event =>
97 urlElement.addEventListener("click", () =>
98 { 99 {
99 ext.devtools.panels.openResource(request.url); 100 ext.devtools.panels.openResource(request.url);
101 event.preventDefault();
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
100 }, false); 102 }, false);
101 } 103 }
102 } 104 }
103 105
104 if (filter) 106 if (filter)
105 { 107 {
106 let filterElement = row.querySelector(".filter"); 108 let filterElement = row.querySelector(".filter");
107 let originElement = row.querySelector(".origin"); 109 let originElement = row.querySelector(".origin");
108 110
109 filterElement.textContent = filter.text; 111 filterElement.textContent = filter.text;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 break; 252 break;
251 } 253 }
252 }); 254 });
253 255
254 // Since Chrome 54 the themeName is accessible, for earlier versions we must 256 // Since Chrome 54 the themeName is accessible, for earlier versions we must
255 // assume the default theme is being used. 257 // assume the default theme is being used.
256 // https://bugs.chromium.org/p/chromium/issues/detail?id=608869 258 // https://bugs.chromium.org/p/chromium/issues/detail?id=608869
257 let theme = browser.devtools.panels.themeName || "default"; 259 let theme = browser.devtools.panels.themeName || "default";
258 document.body.classList.add(theme); 260 document.body.classList.add(theme);
259 }, false); 261 }, false);
OLDNEW
« no previous file with comments | « devtools-panel.html ('k') | skin/devtools-panel.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld