OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 this._sourceFrameSetup = false; | 88 this._sourceFrameSetup = false; |
89 }, | 89 }, |
90 | 90 |
91 setupSourceFrameIfNeeded: function() | 91 setupSourceFrameIfNeeded: function() |
92 { | 92 { |
93 if (!this._frameNeedsSetup) | 93 if (!this._frameNeedsSetup) |
94 return; | 94 return; |
95 | 95 |
96 this.attach(); | 96 this.attach(); |
97 | 97 |
98 if (!InspectorController.addResourceSourceToFrame(this.resource.identifi
er, this.sourceFrame.element)) | |
99 return; | |
100 | |
101 delete this._frameNeedsSetup; | 98 delete this._frameNeedsSetup; |
102 | 99 this.sourceFrame.addEventListener("content loaded", this._contentLoaded,
this); |
103 if (this.resource.type === WebInspector.Resource.Type.Script) { | 100 InspectorController.addResourceSourceToFrame(this.resource.identifier, t
his.sourceFrame.element); |
| 101 }, |
| 102 |
| 103 _contentLoaded: function() |
| 104 { |
| 105 delete this._frameNeedsSetup; |
| 106 this.sourceFrame.removeEventListener("content loaded", this._contentLoad
ed, this); |
| 107 |
| 108 if (this.resource.type === WebInspector.Resource.Type.Script |
| 109 || this.resource.mimeType === 'application/json' |
| 110 || this.resource.mimeType === 'application/javascript' |
| 111 || /\.js(on)?$/.test(this.resource.lastPathComponent) ) { |
104 this.sourceFrame.addEventListener("syntax highlighting complete", th
is._syntaxHighlightingComplete, this); | 112 this.sourceFrame.addEventListener("syntax highlighting complete", th
is._syntaxHighlightingComplete, this); |
105 this.sourceFrame.syntaxHighlightJavascript(); | 113 this.sourceFrame.syntaxHighlightJavascript(); |
106 } else | 114 } else |
107 this._sourceFrameSetupFinished(); | 115 this._sourceFrameSetupFinished(); |
108 }, | 116 }, |
109 | 117 |
110 _resourceLoadingFinished: function(event) | 118 _resourceLoadingFinished: function(event) |
111 { | 119 { |
112 this._frameNeedsSetup = true; | 120 this._frameNeedsSetup = true; |
113 this._sourceFrameSetup = false; | 121 this._sourceFrameSetup = false; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 }, | 302 }, |
295 | 303 |
296 _syntaxHighlightingComplete: function(event) | 304 _syntaxHighlightingComplete: function(event) |
297 { | 305 { |
298 this._sourceFrameSetupFinished(); | 306 this._sourceFrameSetupFinished(); |
299 this.sourceFrame.removeEventListener("syntax highlighting complete", nul
l, this); | 307 this.sourceFrame.removeEventListener("syntax highlighting complete", nul
l, this); |
300 } | 308 } |
301 } | 309 } |
302 | 310 |
303 WebInspector.SourceView.prototype.__proto__ = WebInspector.ResourceView.prototyp
e; | 311 WebInspector.SourceView.prototype.__proto__ = WebInspector.ResourceView.prototyp
e; |
OLD | NEW |