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: 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:
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 if (event.button == 0)
101 {
102 ext.devtools.panels.openResource(request.url);
103 event.preventDefault();
104 }
100 }, false); 105 }, false);
101 } 106 }
102 } 107 }
103 108
104 if (filter) 109 if (filter)
105 { 110 {
106 let filterElement = row.querySelector(".filter"); 111 let filterElement = row.querySelector(".filter");
107 let originElement = row.querySelector(".origin"); 112 let originElement = row.querySelector(".origin");
108 113
109 filterElement.textContent = filter.text; 114 filterElement.textContent = filter.text;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 break; 255 break;
251 } 256 }
252 }); 257 });
253 258
254 // 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
255 // assume the default theme is being used. 260 // assume the default theme is being used.
256 // https://bugs.chromium.org/p/chromium/issues/detail?id=608869 261 // https://bugs.chromium.org/p/chromium/issues/detail?id=608869
257 let theme = browser.devtools.panels.themeName || "default"; 262 let theme = browser.devtools.panels.themeName || "default";
258 document.body.classList.add(theme); 263 document.body.classList.add(theme);
259 }, false); 264 }, 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