| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 if (url.startsWith(baseURL)) | 77 if (url.startsWith(baseURL)) |
| 78 return url.substring(index); | 78 return url.substring(index); |
| 79 } | 79 } |
| 80 | 80 |
| 81 if (!parsedURL) | 81 if (!parsedURL) |
| 82 return url; | 82 return url; |
| 83 | 83 |
| 84 var displayName = url.trimURL(parsedURL.host); | 84 var displayName = url.trimURL(parsedURL.host); |
| 85 return displayName === '/' ? parsedURL.host + '/' : displayName; | 85 return displayName === '/' ? parsedURL.host + '/' : displayName; |
| 86 }; | 86 }; |
| 87 |
| 88 /** |
| 89 * @param {?SDK.Resource} resource |
| 90 * @return {?Workspace.UISourceCodeMetadata} |
| 91 */ |
| 92 Bindings.resourceMetadata = function(resource) { |
| 93 if (!resource || (typeof resource.contentSize() !== 'number' && !resource.last
Modified())) |
| 94 return null; |
| 95 return new Workspace.UISourceCodeMetadata(resource.lastModified(), resource.co
ntentSize()); |
| 96 }; |
| 97 |
| 98 /** |
| 99 * @param {!SDK.Script} script |
| 100 * @return {string} |
| 101 */ |
| 102 Bindings.frameIdForScript = function(script) { |
| 103 var executionContext = script.executionContext(); |
| 104 if (executionContext) |
| 105 return executionContext.frameId || ''; |
| 106 // This is to overcome compilation cache which doesn't get reset. |
| 107 var resourceTreeModel = script.debuggerModel.target().model(SDK.ResourceTreeMo
del); |
| 108 if (!resourceTreeModel || !resourceTreeModel.mainFrame) |
| 109 return ''; |
| 110 return resourceTreeModel.mainFrame.id; |
| 111 }; |
| OLD | NEW |