| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 _appendHrefItems: function(contextMenu, target) | 169 _appendHrefItems: function(contextMenu, target) |
| 170 { | 170 { |
| 171 if (!(target instanceof Node)) | 171 if (!(target instanceof Node)) |
| 172 return; | 172 return; |
| 173 var targetNode = /** @type {!Node} */ (target); | 173 var targetNode = /** @type {!Node} */ (target); |
| 174 | 174 |
| 175 var anchorElement = targetNode.enclosingNodeOrSelfWithClass("webkit-html
-resource-link") || targetNode.enclosingNodeOrSelfWithClass("webkit-html-externa
l-link"); | 175 var anchorElement = targetNode.enclosingNodeOrSelfWithClass("webkit-html
-resource-link") || targetNode.enclosingNodeOrSelfWithClass("webkit-html-externa
l-link"); |
| 176 if (!anchorElement) | 176 if (!anchorElement) |
| 177 return; | 177 return; |
| 178 | 178 |
| 179 var resourceURL = anchorElement.href; | 179 var uiLocation = WebInspector.Linkifier.uiLocationByAnchor(anchorElement
); |
| 180 if (!resourceURL) | 180 var resourceURL = uiLocation ? uiLocation.uiSourceCode.contentURL() : an
chorElement.href; |
| 181 return; | 181 var uiSourceCode = uiLocation ? uiLocation.uiSourceCode : (resourceURL ?
WebInspector.networkMapping.uiSourceCodeForURLForAnyTarget(resourceURL) : null)
; |
| 182 | |
| 183 var uiSourceCode = WebInspector.networkMapping.uiSourceCodeForURLForAnyT
arget(resourceURL); | |
| 184 function open() | 182 function open() |
| 185 { | 183 { |
| 186 WebInspector.Revealer.reveal(uiSourceCode); | 184 WebInspector.Revealer.reveal(uiSourceCode); |
| 187 } | 185 } |
| 188 if (uiSourceCode) | 186 if (uiSourceCode) |
| 189 contextMenu.appendItem("Open", open); | 187 contextMenu.appendItem("Open", open); |
| 190 | 188 |
| 189 if (!resourceURL) |
| 190 return; |
| 191 // Add resource-related actions. | 191 // Add resource-related actions. |
| 192 contextMenu.appendItem(WebInspector.openLinkExternallyLabel(), this._ope
nInNewTab.bind(this, resourceURL)); | 192 contextMenu.appendItem(WebInspector.openLinkExternallyLabel(), this._ope
nInNewTab.bind(this, resourceURL)); |
| 193 | 193 |
| 194 /** | 194 /** |
| 195 * @param {string} resourceURL | 195 * @param {string} resourceURL |
| 196 */ | 196 */ |
| 197 function openInResourcesPanel(resourceURL) | 197 function openInResourcesPanel(resourceURL) |
| 198 { | 198 { |
| 199 var resource = WebInspector.resourceForURL(resourceURL); | 199 var resource = WebInspector.resourceForURL(resourceURL); |
| 200 if (resource) | 200 if (resource) |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 316 |
| 317 var handlerSelector = new WebInspector.HandlerSelector(WebInspector.open
AnchorLocationRegistry); | 317 var handlerSelector = new WebInspector.HandlerSelector(WebInspector.open
AnchorLocationRegistry); |
| 318 return WebInspector.SettingsUI.createCustomSetting(WebInspector.UIString
("Open links in"), handlerSelector.element); | 318 return WebInspector.SettingsUI.createCustomSetting(WebInspector.UIString
("Open links in"), handlerSelector.element); |
| 319 } | 319 } |
| 320 } | 320 } |
| 321 | 321 |
| 322 /** | 322 /** |
| 323 * @type {!WebInspector.HandlerRegistry} | 323 * @type {!WebInspector.HandlerRegistry} |
| 324 */ | 324 */ |
| 325 WebInspector.openAnchorLocationRegistry; | 325 WebInspector.openAnchorLocationRegistry; |
| OLD | NEW |