Changeset 139885 in webkit
- Timestamp:
- Jan 16, 2013, 8:48:30 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
inspector/front-end/CSSStyleModel.js (modified) (3 diffs)
-
inspector/front-end/ResourceScriptMapping.js (modified) (4 diffs)
-
inspector/front-end/ResourceTreeModel.js (modified) (3 diffs)
-
inspector/front-end/ScriptSnippetModel.js (modified) (3 diffs)
-
inspector/front-end/StylesSourceMapping.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r139884 r139885 1 2013-01-16 Vsevolod Vlasov <vsevik@chromium.org> 2 3 Web Inspector: UISourceCode scriptFile / styleFile should be reset on navigation (debugger or css model reset). 4 https://bugs.webkit.org/show_bug.cgi?id=107008 5 6 Reviewed by Pavel Feldman. 7 8 ScriptFiles and styleFiles are now reset and disposed on UISourceCodes on corresponding models reset. 9 StyleSourceMapping now tries to setup mapping for newly added resource as well as for uiSourceCodes previously. 10 11 * inspector/front-end/CSSStyleModel.js: 12 (WebInspector.CSSStyleModel): 13 (WebInspector.CSSStyleModel.prototype._mainFrameCreatedOrNavigated): 14 * inspector/front-end/ResourceScriptMapping.js: 15 (WebInspector.ResourceScriptMapping): 16 (WebInspector.ResourceScriptMapping.prototype._unbindUISourceCodeFromScripts): 17 (WebInspector.ResourceScriptMapping.prototype._initialize): 18 (WebInspector.ResourceScriptMapping.prototype._debuggerReset): 19 (WebInspector.ResourceScriptFile.prototype.dispose): 20 * inspector/front-end/ResourceTreeModel.js: 21 (WebInspector.ResourceTreeModel.prototype._addFrame): 22 (WebInspector.ResourceTreeModel.prototype._frameNavigated): 23 * inspector/front-end/ScriptSnippetModel.js: 24 (WebInspector.ScriptSnippetModel): 25 (WebInspector.ScriptSnippetModel.prototype._debuggerReset): 26 * inspector/front-end/StylesSourceMapping.js: 27 (WebInspector.StylesSourceMapping): 28 (WebInspector.StylesSourceMapping.prototype._resourceAdded): 29 (WebInspector.StylesSourceMapping.prototype._uiSourceCodeAddedToWorkspace): 30 (WebInspector.StylesSourceMapping.prototype._bindUISourceCode): 31 (WebInspector.StylesSourceMapping.prototype._projectWillReset): 32 (WebInspector.StylesSourceMapping.prototype._initialize): 33 (WebInspector.StylesSourceMapping.prototype._mainFrameCreatedOrNavigated): 34 (WebInspector.StyleFile.prototype.dispose): 35 1 36 2013-01-16 Gustavo Noronha Silva <gustavo.noronha@collabora.com> 2 37 -
trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js
r139454 r139885 42 42 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoCompleted, this._undoRedoCompleted, this); 43 43 this._resourceBinding = new WebInspector.CSSStyleModelResourceBinding(); 44 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes. InspectedURLChanged, this._inspectedURLChanged, this);44 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated, this._mainFrameCreatedOrNavigated, this); 45 45 this._namedFlowCollections = {}; 46 46 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this._resetNamedFlowCollections, this); … … 59 59 return result; 60 60 } 61 61 62 62 /** 63 63 * @param {Array.<CSSAgent.RuleMatch>} matchArray … … 483 483 * @param {WebInspector.Event} event 484 484 */ 485 _ inspectedURLChanged: function(event)485 _mainFrameCreatedOrNavigated: function(event) 486 486 { 487 487 this._resetSourceMappings(); -
trunk/Source/WebCore/inspector/front-end/ResourceScriptMapping.js
r139860 r139885 40 40 41 41 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this); 42 this._ debuggerReset();42 this._initialize(); 43 43 } 44 44 … … 180 180 }, 181 181 182 _debuggerReset: function() 182 /** 183 * @param {WebInspector.UISourceCode} uiSourceCode 184 * @param {Array.<WebInspector.Script>} scripts 185 */ 186 _unbindUISourceCodeFromScripts: function(uiSourceCode, scripts) 187 { 188 console.assert(scripts.length); 189 var scriptFile = /** @type {WebInspector.ResourceScriptFile} */ (uiSourceCode.scriptFile()); 190 scriptFile.dispose(); 191 uiSourceCode.setScriptFile(null); 192 uiSourceCode.setSourceMapping(null); 193 }, 194 195 _initialize: function() 183 196 { 184 197 /** @type {!Object.<string, !Array.<!WebInspector.UISourceCode>>} */ … … 186 199 /** @type {!Object.<string, !Array.<!WebInspector.UISourceCode>>} */ 187 200 this._nonInlineScriptsForSourceURL = {}; 201 }, 202 203 _debuggerReset: function() 204 { 205 /** 206 * @param {!Object.<string, !Array.<!WebInspector.UISourceCode>>} scriptsForSourceURL 207 */ 208 function unbindUISourceCodes(scriptsForSourceURL) 209 { 210 for (var sourceURL in scriptsForSourceURL) { 211 var scripts = scriptsForSourceURL[sourceURL]; 212 if (!scripts.length) 213 continue; 214 var uiSourceCode = this._workspaceUISourceCodeForScript(scripts[0]); 215 if (!uiSourceCode) 216 continue; 217 this._unbindUISourceCodeFromScripts(uiSourceCode, scripts); 218 } 219 } 220 221 unbindUISourceCodes.call(this, this._inlineScriptsForSourceURL); 222 unbindUISourceCodes.call(this, this._nonInlineScriptsForSourceURL); 223 this._initialize(); 188 224 }, 189 225 } … … 304 340 }, 305 341 342 dispose: function() 343 { 344 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCommitted, this); 345 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._workingCopyChanged, this); 346 }, 347 306 348 __proto__: WebInspector.Object.prototype 307 349 } -
trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js
r139853 r139885 58 58 FrameDetached: "FrameDetached", 59 59 MainFrameNavigated: "MainFrameNavigated", 60 MainFrameCreatedOrNavigated: "MainFrameCreatedOrNavigated", 60 61 ResourceAdded: "ResourceAdded", 61 62 WillLoadCachedResources: "WillLoadCachedResources", … … 109 110 this.mainFrame = frame; 110 111 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameAdded, frame); 112 if (frame.isMainFrame()) 113 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated, frame); 111 114 }, 112 115 … … 138 141 139 142 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, frame); 140 if (frame.isMainFrame()) 143 if (frame.isMainFrame()) { 141 144 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, frame); 145 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated, frame); 146 } 142 147 143 148 // Fill frame with retained resources (the ones loaded using new loader). -
trunk/Source/WebCore/inspector/front-end/ScriptSnippetModel.js
r139454 r139885 37 37 { 38 38 this._workspace = workspace; 39 /** {Object.<string, WebInspector.UISourceCode>} */ 39 40 this._uiSourceCodeForScriptId = {}; 40 41 this._scriptForUISourceCode = new Map(); 42 /** {Object.<string, WebInspector.UISourceCode>} */ 41 43 this._uiSourceCodeForSnippetId = {}; 42 44 this._snippetIdForUISourceCode = new Map(); … … 48 50 workspace.addProject(WebInspector.projectNames.Snippets, this._workspaceProvider); 49 51 this.reset(); 52 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this); 50 53 } 51 54 … … 341 344 uiSourceCode.scriptFile().setIsDivergingFromVM(false); 342 345 return script.rawLocationToUILocation(0, 0).uiSourceCode; 346 }, 347 348 _debuggerReset: function() 349 { 350 for (var snippetId in this._uiSourceCodeForSnippetId) { 351 var uiSourceCode = this._uiSourceCodeForSnippetId[snippetId]; 352 this._releaseSnippetScript(uiSourceCode); 353 } 343 354 }, 344 355 -
trunk/Source/WebCore/inspector/front-end/StylesSourceMapping.js
r139860 r139885 40 40 this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._uiSourceCodeAddedToWorkspace, this); 41 41 42 this._mappedURLs = {}; 42 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated, this._mainFrameCreatedOrNavigated, this); 43 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this); 44 this._initialize(); 43 45 } 44 46 … … 67 69 }, 68 70 71 _resourceAdded: function(event) 72 { 73 var resource = /** @type {WebInspector.UISourceCode} */ (event.data); 74 if (resource.contentType() !== WebInspector.resourceTypes.Stylesheet) 75 return; 76 if (!resource.url) 77 return; 78 var uri = WebInspector.fileMapping.uriForURL(resource.url); 79 var uiSourceCode = this._workspace.uiSourceCodeForURI(uri); 80 if (!uiSourceCode) 81 return; 82 this._bindUISourceCode(uiSourceCode); 83 }, 84 69 85 _uiSourceCodeAddedToWorkspace: function(event) 70 86 { … … 74 90 if (!uiSourceCode.url || !WebInspector.resourceForURL(uiSourceCode.url)) 75 91 return; 92 this._bindUISourceCode(uiSourceCode); 93 }, 94 95 _bindUISourceCode: function(uiSourceCode) 96 { 76 97 if (this._mappedURLs[uiSourceCode.url]) 77 98 return; … … 89 110 for (var i = 0; i < uiSourceCodes; ++i) 90 111 delete this._mappedURLs[uiSourceCodes[i].url]; 112 }, 113 114 _initialize: function() 115 { 116 /** {Object.<string, boolean>} */ 117 this._mappedURLs = {}; 118 }, 119 120 /** 121 * @param {WebInspector.Event} event 122 */ 123 _mainFrameCreatedOrNavigated: function(event) 124 { 125 for (var mappedURL in this._mappedURLs) { 126 var uri = WebInspector.fileMapping.uriForURL(mappedURL); 127 var uiSourceCode = this._workspace.uiSourceCodeForURI(uri); 128 if (!uiSourceCode) 129 continue; 130 uiSourceCode.styleFile().dispose(); 131 uiSourceCode.setStyleFile(null); 132 uiSourceCode.setSourceMapping(null); 133 } 134 this._initialize(); 91 135 } 92 136 } … … 161 205 delete this._isAddingRevision; 162 206 }, 207 208 dispose: function() 209 { 210 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCommitted, this); 211 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._workingCopyChanged, this); 212 } 163 213 } 164 214
Note:
See TracChangeset
for help on using the changeset viewer.