Changeset 117600 in webkit
- Timestamp:
- May 18, 2012 9:10:34 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r117599 r117600 1 2012-05-18 Vsevolod Vlasov <vsevik@chromium.org> 2 3 Web Inspector: Add resource to UISourceCode constructor. 4 https://bugs.webkit.org/show_bug.cgi?id=86853 5 6 Reviewed by Pavel Feldman. 7 8 * inspector/debugger/breakpoint-manager.html: 9 * inspector/debugger/scripts-file-selector.html: 10 * inspector/debugger/scripts-panel.html: 11 * inspector/debugger/scripts-sorting.html: 12 * inspector/debugger/ui-source-code.html: 13 1 14 2012-05-18 Yury Semikhatsky <yurys@chromium.org> 2 15 -
trunk/LayoutTests/inspector/debugger/breakpoint-manager.html
r117269 r117600 137 137 breakpointManager._debuggerModel._addScript(url, url); 138 138 InspectorTest.addResult(" Adding UISourceCode: " + url + ")"); 139 var uiSourceCode = new WebInspector.JavaScriptSource(url, null, defaultMapping, false);139 var uiSourceCode = new WebInspector.JavaScriptSource(url, null, null, defaultMapping, false); 140 140 uiSourceCodes[url] = uiSourceCode; 141 141 breakpointManager.restoreBreakpoints(uiSourceCode); -
trunk/LayoutTests/inspector/debugger/scripts-file-selector.html
r117571 r117600 21 21 function addUISourceCode(url, isContentScript) 22 22 { 23 var uiSourceCode = new WebInspector.UISourceCode(url, contentProvider, null);23 var uiSourceCode = new WebInspector.UISourceCode(url, null, contentProvider, null); 24 24 uiSourceCode.isContentScript = isContentScript; 25 25 navigatorFileSelector.addUISourceCode(uiSourceCode); -
trunk/LayoutTests/inspector/debugger/scripts-panel.html
r117571 r117600 52 52 function createUISouceCode(url) 53 53 { 54 var uiSourceCode = new WebInspector.JavaScriptSource(url, contentProvider, null, false);54 var uiSourceCode = new WebInspector.JavaScriptSource(url, null, contentProvider, null, false); 55 55 uiSourceCode.requestContent = function(callback) 56 56 { -
trunk/LayoutTests/inspector/debugger/scripts-sorting.html
r117571 r117600 21 21 function addUISourceCode(url, isContentScript) 22 22 { 23 var uiSourceCode = new WebInspector.UISourceCode(url, contentProvider, null);23 var uiSourceCode = new WebInspector.UISourceCode(url, null, contentProvider, null); 24 24 uiSourceCode.isContentScript = isContentScript; 25 25 navigatorFileSelector.addUISourceCode(uiSourceCode); -
trunk/LayoutTests/inspector/debugger/ui-source-code.html
r116846 r117600 18 18 function testUISourceCode(next) 19 19 { 20 var uiSourceCode = new WebInspector.UISourceCode("url", contentProvider);20 var uiSourceCode = new WebInspector.UISourceCode("url", null, contentProvider); 21 21 function didRequestContent(callNumber, content, contentEncoded, mimeType) 22 22 { -
trunk/Source/WebCore/ChangeLog
r117599 r117600 1 2012-05-18 Vsevolod Vlasov <vsevik@chromium.org> 2 3 Web Inspector: Add resource to UISourceCode constructor. 4 https://bugs.webkit.org/show_bug.cgi?id=86853 5 6 Reviewed by Pavel Feldman. 7 8 This is a first step of merging resource revision support into UISourceCode. 9 10 * inspector/front-end/CompilerScriptMapping.js: 11 * inspector/front-end/DebuggerResourceBinding.js: 12 (WebInspector.DebuggerResourceBinding.setScriptSource.didEditScriptSource): 13 (WebInspector.DebuggerResourceBinding.setScriptSource): 14 * inspector/front-end/DebuggerScriptMapping.js: 15 (WebInspector.DebuggerScriptMapping.prototype._debuggerReset): 16 * inspector/front-end/JavaScriptSource.js: 17 * inspector/front-end/RawSourceCode.js: 18 (WebInspector.RawSourceCode.prototype._createUISourceCode): 19 * inspector/front-end/ResourceScriptMapping.js: 20 (WebInspector.ResourceScriptMapping.prototype.addScript): 21 * inspector/front-end/Script.js: 22 (WebInspector.Script.prototype.isAnonymousScript): 23 * inspector/front-end/ScriptSnippetModel.js: 24 (WebInspector.ScriptSnippetModel.prototype._createUISourceCodeForScript): 25 (WebInspector.SnippetJavaScriptSource): 26 * inspector/front-end/StylesPanel.js: 27 (WebInspector.StyleSource): 28 (WebInspector.StyleSourceFrame): 29 (WebInspector.StyleSourceFrame.prototype.commitEditing): 30 (WebInspector.StyleSourceFrame.prototype.afterTextChanged): 31 (WebInspector.StyleSourceFrame.prototype._contentChanged): 32 * inspector/front-end/UISourceCode.js: 33 (WebInspector.UISourceCode): 34 (WebInspector.UISourceCode.prototype.resource): 35 1 36 2012-05-18 Yury Semikhatsky <yurys@chromium.org> 2 37 -
trunk/Source/WebCore/inspector/front-end/CompilerScriptMapping.js
r117571 r117600 119 119 else 120 120 contentProvider = new WebInspector.CompilerSourceMappingContentProvider(sourceURL); 121 var uiSourceCode = new WebInspector.JavaScriptSource(sourceURL, contentProvider, this, false);121 var uiSourceCode = new WebInspector.JavaScriptSource(sourceURL, null, contentProvider, this, false); 122 122 uiSourceCode.isContentScript = script.isContentScript; 123 123 this._uiSourceCodeByURL[sourceURL] = uiSourceCode; -
trunk/Source/WebCore/inspector/front-end/DebuggerResourceBinding.js
r117585 r117600 61 61 } 62 62 63 var resource = WebInspector.resourceForURL(script.sourceURL);63 var resource = uiSourceCode.resource(); 64 64 if (resource) 65 65 resource.addRevision(newSource); … … 78 78 canSetContent: function(resource) 79 79 { 80 var uiSourceCode = this._uiSourceCodeForResource(resource);80 var uiSourceCode = WebInspector.JavaScriptSource.javaScriptSourceForResource.get(resource); 81 81 return !!uiSourceCode && uiSourceCode.isEditable(); 82 82 }, … … 93 93 return; 94 94 95 var uiSourceCode = this._uiSourceCodeForResource(resource);95 var uiSourceCode = WebInspector.JavaScriptSource.javaScriptSourceForResource.get(resource); 96 96 if (!uiSourceCode) { 97 97 userCallback("Resource is not editable"); … … 100 100 101 101 resource.requestContent(this._setContentWithInitialContent.bind(this, uiSourceCode, content, userCallback)); 102 },103 104 /**105 * @param {WebInspector.Resource} resource106 * @return {WebInspector.UISourceCode}107 */108 _uiSourceCodeForResource: function(resource)109 {110 var uiSourceCodes = this._uiSourceCodeProvider.uiSourceCodes();111 for (var i = 0; i < uiSourceCodes.length; ++i) {112 if (uiSourceCodes[i].url === resource.url)113 return uiSourceCodes[i];114 }115 return null;116 102 }, 117 103 -
trunk/Source/WebCore/inspector/front-end/DebuggerScriptMapping.js
r117302 r117600 88 88 _debuggerReset: function() 89 89 { 90 WebInspector.JavaScriptSource.javaScriptSourceForResource.clear(); 90 91 for (var i = 0; i < this._mappings.length; ++i) 91 92 this._mappings[i].reset(); -
trunk/Source/WebCore/inspector/front-end/JavaScriptSource.js
r117299 r117600 33 33 * @extends {WebInspector.UISourceCode} 34 34 * @param {string} url 35 * @param {WebInspector.Resource} resource 35 36 * @param {WebInspector.ContentProvider} contentProvider 36 37 * @param {WebInspector.SourceMapping} sourceMapping 37 38 */ 38 WebInspector.JavaScriptSource = function(url, contentProvider, sourceMapping, isEditable)39 WebInspector.JavaScriptSource = function(url, resource, contentProvider, sourceMapping, isEditable) 39 40 { 40 WebInspector.UISourceCode.call(this, url, contentProvider, sourceMapping);41 WebInspector.UISourceCode.call(this, url, resource, contentProvider, sourceMapping); 41 42 this._isEditable = isEditable; 42 43 … … 47 48 WebInspector.breakpointManager.restoreBreakpoints(this); 48 49 }.bind(this), 0); 50 if (resource) 51 WebInspector.JavaScriptSource.javaScriptSourceForResource.put(resource, this); 49 52 } 53 54 WebInspector.JavaScriptSource.javaScriptSourceForResource = new Map(); 50 55 51 56 WebInspector.JavaScriptSource.prototype = { -
trunk/Source/WebCore/inspector/front-end/RawSourceCode.js
r117269 r117600 101 101 contentProvider = new WebInspector.ConcatenatedScriptsContentProvider(this._scripts); 102 102 103 var uiSourceCode = new WebInspector.JavaScriptSource(this.url, contentProvider, this._sourceMapping, isStandaloneScript);103 var uiSourceCode = new WebInspector.JavaScriptSource(this.url, this._resource, contentProvider, this._sourceMapping, isStandaloneScript); 104 104 uiSourceCode.isContentScript = this.isContentScript; 105 105 return uiSourceCode; -
trunk/Source/WebCore/inspector/front-end/ResourceScriptMapping.js
r117277 r117600 88 88 var resource = null; 89 89 var request = null; 90 var isInlineScript = false; 91 if (script.isInlineScript()) { 92 // First lookup the resource that has already been loaded. We are only interested in Document resources. 90 if (!script.isAnonymousScript()) { 91 // First lookup the resource that has already been loaded. 93 92 resource = WebInspector.resourceForURL(script.sourceURL); 94 if (resource && resource.type !== WebInspector.resourceTypes.Document)95 resource = null;96 93 // Ignore resource in case it has not yet finished loading. 97 94 if (resource && resource.request && !resource.request.finished) 98 95 resource = null; 99 96 if (!resource) { 100 // When there is no resource, lookup in-flight requests of type Document.97 // When there is no resource, lookup in-flight requests. 101 98 request = WebInspector.networkManager.inflightRequestForURL(script.sourceURL); 102 if (request && request.type !== WebInspector.resourceTypes.Document)103 request = null;104 99 } 105 // If either of these exists, we bind script to the resource. 106 if (request || resource) { 107 isInlineScript = true; 108 var rawSourceCode = this._rawSourceCodeForDocumentURL[script.sourceURL]; 109 if (rawSourceCode) { 110 rawSourceCode.addScript(script); 111 this._bindScriptToRawSourceCode(script, rawSourceCode); 112 return; 113 } 100 } 101 console.assert(!resource || !request); 102 103 var isInlineScript = script.isInlineScript() && (request || resource); 104 // If either of these exists, we bind script to the resource. 105 if (isInlineScript) { 106 var rawSourceCode = this._rawSourceCodeForDocumentURL[script.sourceURL]; 107 if (rawSourceCode) { 108 rawSourceCode.addScript(script); 109 this._bindScriptToRawSourceCode(script, rawSourceCode); 110 return; 114 111 } 115 112 } -
trunk/Source/WebCore/inspector/front-end/Script.js
r117571 r117600 160 160 161 161 /** 162 * @return {boolean} 163 */ 164 isAnonymousScript: function() 165 { 166 return !this.sourceURL; 167 }, 168 169 /** 162 170 * @param {DebuggerAgent.Location} rawLocation 163 171 * @return {WebInspector.UILocation} -
trunk/Source/WebCore/inspector/front-end/ScriptSnippetModel.js
r117571 r117600 216 216 _createUISourceCodeForScript: function(script) 217 217 { 218 var uiSourceCode = new WebInspector.JavaScriptSource(script.sourceURL, script, this._snippetScriptMapping, false);218 var uiSourceCode = new WebInspector.JavaScriptSource(script.sourceURL, null, script, this._snippetScriptMapping, false); 219 219 uiSourceCode.isSnippetEvaluation = true; 220 220 this._uiSourceCodeForScriptId[script.scriptId] = uiSourceCode; … … 302 302 WebInspector.SnippetJavaScriptSource = function(snippetId, snippetName, contentProvider, scriptSnippetModel) 303 303 { 304 WebInspector.JavaScriptSource.call(this, snippetName, contentProvider, scriptSnippetModel.scriptMapping, true);304 WebInspector.JavaScriptSource.call(this, snippetName, null, contentProvider, scriptSnippetModel.scriptMapping, true); 305 305 this._snippetId = snippetId; 306 306 this._scriptSnippetModel = scriptSnippetModel; -
trunk/Source/WebCore/inspector/front-end/StylesPanel.js
r117571 r117600 95 95 WebInspector.StyleSource = function(resource) 96 96 { 97 WebInspector.UISourceCode.call(this, resource.url, resource); 98 this._resource = resource; 97 WebInspector.UISourceCode.call(this, resource.url, resource, resource); 99 98 } 100 99 … … 111 110 WebInspector.StyleSourceFrame = function(styleSource) 112 111 { 113 this._resource = styleSource._resource;114 112 this._styleSource = styleSource; 115 113 WebInspector.SourceFrame.call(this, this._styleSource); 116 this._ resource.addEventListener(WebInspector.Resource.Events.RevisionAdded, this._contentChanged, this);114 this._styleSource.resource().addEventListener(WebInspector.Resource.Events.RevisionAdded, this._contentChanged, this); 117 115 } 118 116 … … 131 129 commitEditing: function(text) 132 130 { 133 this._ resource.setContent(text, true, function() {});131 this._styleSource.resource().setContent(text, true, function() {}); 134 132 }, 135 133 … … 140 138 var text = this._textModel.text; 141 139 this._styleSource.setWorkingCopy(text); 142 this._ resource.setContent(text, false, function() {});140 this._styleSource.resource().setContent(text, false, function() {}); 143 141 } 144 142 const updateTimeout = 200; … … 155 153 _contentChanged: function(event) 156 154 { 157 this._styleSource.contentChanged(this._ resource.content || "");158 this.setContent(this._ resource.content, false, "text/stylesheet");155 this._styleSource.contentChanged(this._styleSource.resource().content || ""); 156 this.setContent(this._styleSource.resource().content, false, "text/stylesheet"); 159 157 } 160 158 } -
trunk/Source/WebCore/inspector/front-end/UISourceCode.js
r117571 r117600 35 35 * @implements {WebInspector.ContentProvider} 36 36 * @param {string} url 37 * @param {WebInspector.Resource} resource 37 38 * @param {WebInspector.ContentProvider} contentProvider 38 39 * @param {WebInspector.SourceMapping=} sourceMapping 39 40 */ 40 WebInspector.UISourceCode = function(url, contentProvider, sourceMapping)41 WebInspector.UISourceCode = function(url, resource, contentProvider, sourceMapping) 41 42 { 42 43 this._url = url; 44 this._resource = resource; 43 45 this._parsedURL = new WebInspector.ParsedURL(url); 44 46 this._contentProvider = contentProvider; … … 82 84 this._parsedURL = new WebInspector.ParsedURL(this._url); 83 85 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.TitleChanged, null); 86 }, 87 88 /** 89 * @return {WebInspector.Resource} 90 */ 91 resource: function() 92 { 93 return this._resource; 84 94 }, 85 95
Note: See TracChangeset
for help on using the changeset viewer.