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

Unified 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.
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
« no previous file with comments | « devtools-panel.html ('k') | skin/devtools-panel.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: devtools-panel.js
diff --git a/devtools-panel.js b/devtools-panel.js
index 7fe190a73360b59fcee622a4a3b6f681d5995002..928263d8ee6f897d9d5b65c561fa3e7dacbf777a 100644
--- a/devtools-panel.js
+++ b/devtools-panel.js
@@ -84,19 +84,24 @@ function createRecord(request, filter, template)
row.querySelector(".domain").textContent = request.docDomain;
row.querySelector(".type").textContent = request.type;
- let urlElement = row.querySelector(".url");
+ let urlElement = row.querySelector(".resource-link");
let actionWrapper = row.querySelector(".action-wrapper");
if (request.url)
{
urlElement.textContent = request.url;
+ urlElement.setAttribute("href", request.url);
- if (request.type != "POPUP")
+ // Firefox 57 doesn't support the openResource API.
+ if (request.type != "POPUP" && "openResource" in ext.devtools.panels)
{
- urlElement.classList.add("resourceLink");
- urlElement.addEventListener("click", () =>
+ urlElement.addEventListener("click", event =>
{
- ext.devtools.panels.openResource(request.url);
+ if (event.button == 0)
+ {
+ ext.devtools.panels.openResource(request.url);
+ event.preventDefault();
+ }
}, false);
}
}
« 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