Changeset 103795 in webkit
- Timestamp:
- Dec 29, 2011 4:16:05 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r103780 r103795 1 2011-12-28 Pavel Podivilov <podivilov@chromium.org> 2 3 Web Inspector: add "enable source maps" checkbox setting. 4 https://bugs.webkit.org/show_bug.cgi?id=75311 5 6 Reviewed by Pavel Feldman. 7 8 * http/tests/inspector/compiler-source-mapping-debug-expected.txt: 9 * http/tests/inspector/compiler-source-mapping-debug.html: 10 * inspector/debugger/raw-source-code.html: 11 1 12 2011-12-28 Alexis Menard <alexis.menard@openbossa.org> 2 13 -
trunk/LayoutTests/http/tests/inspector/compiler-source-mapping-debug-expected.txt
r101128 r103795 6 6 7 7 Running: testSetBreakpoint 8 Page reloaded. 8 9 Script source was shown. 9 10 Script execution paused. -
trunk/LayoutTests/http/tests/inspector/compiler-source-mapping-debug.html
r103541 r103795 14 14 function test() 15 15 { 16 WebInspector.OriginalScript = WebInspector.Script; 17 WebInspector.Script = function() 18 { 19 WebInspector.OriginalScript.apply(this, arguments); 20 if (this.sourceURL.indexOf("compiled.js") !== -1) 21 this.sourceMapURL = "http://localhost:8000/inspector/resources/source-map.json"; 22 } 23 WebInspector.Script.prototype = WebInspector.OriginalScript.prototype; 24 16 25 InspectorTest.runDebuggerTestSuite([ 17 26 function testSetBreakpoint(next) 18 27 { 19 InspectorTest.showScriptSource("compiled.js", didShowCompiled); 28 WebInspector.settings.sourceMapsEnabled.set(true); 29 InspectorTest.reloadPage(pageReloaded); 20 30 21 function didShowCompiled(sourceFrame) 31 function pageReloaded() 32 { 33 InspectorTest.showScriptSource("source1.js", didShowSource); 34 } 35 36 function didShowSource(sourceFrame) 22 37 { 23 38 InspectorTest.addResult("Script source was shown."); 24 sourceFrame._uiSourceCode.sourceMapURL = "http://localhost:8000/inspector/resources/source-map.json";25 sourceFrame._model.installCompilerSourceMapping(sourceFrame._uiSourceCode);26 InspectorTest.showScriptSource("source1.js", didShowSource1);27 }28 29 function didShowSource1(sourceFrame)30 {31 39 InspectorTest.setBreakpoint(sourceFrame, 14, "", true); 32 40 InspectorTest.waitUntilPaused(paused); -
trunk/LayoutTests/inspector/debugger/raw-source-code.html
r99823 r103795 57 57 }; 58 58 59 function createRawSourceCode(script, resource, formatted )60 { 61 var rawSourceCode = new WebInspector.RawSourceCode("id", script, resource, createScriptFormatterMock(), !!formatted );59 function createRawSourceCode(script, resource, formatted, compilerSourceMapping) 60 { 61 var rawSourceCode = new WebInspector.RawSourceCode("id", script, resource, createScriptFormatterMock(), !!formatted, compilerSourceMapping); 62 62 rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, defaultSourceMappingUpdatedHandler); 63 63 return rawSourceCode; … … 360 360 var script = createScriptMock("compiled.js", 0, 0, true, "<script source>"); 361 361 var resource = createPendingResourceMock("script", "<resource content>"); 362 var rawSourceCode = createRawSourceCode(script, resource );362 var rawSourceCode = createRawSourceCode(script, resource, false, compilerSourceMappingMock); 363 363 var uiSourceCodeList; 364 364 365 waitForSourceMappingEvent(rawSourceCode, checkMapping); 366 rawSourceCode.setCompilerSourceMapping(compilerSourceMappingMock); 367 function checkMapping() 368 { 369 var sourceMapping = rawSourceCode.sourceMapping; 370 uiSourceCodeList = sourceMapping.uiSourceCodeList(); 371 var uiSourceCodeByURL = {}; 372 for (var i = 0; i < uiSourceCodeList.length; ++i) 373 uiSourceCodeByURL[uiSourceCodeList[i].url] = uiSourceCodeList[i]; 374 checkUILocation(uiSourceCodeByURL["source1.js"], 2, 4, sourceMapping.rawLocationToUILocation(createRawLocation(1, 2))); 375 checkUILocation(uiSourceCodeByURL["source2.js"], 10, 40, sourceMapping.rawLocationToUILocation(createRawLocation(15, 20))); 376 checkRawLocation(script, 1, 0, sourceMapping.uiLocationToRawLocation(uiSourceCodeByURL["source1.js"], 2, 0)); 377 checkRawLocation(script, 15, 0, sourceMapping.uiLocationToRawLocation(uiSourceCodeByURL["source2.js"], 10, 0)); 378 379 uiSourceCodeList[0].requestContent(didRequestContent1); 380 } 365 var sourceMapping = rawSourceCode.sourceMapping; 366 uiSourceCodeList = sourceMapping.uiSourceCodeList(); 367 var uiSourceCodeByURL = {}; 368 for (var i = 0; i < uiSourceCodeList.length; ++i) 369 uiSourceCodeByURL[uiSourceCodeList[i].url] = uiSourceCodeList[i]; 370 checkUILocation(uiSourceCodeByURL["source1.js"], 2, 4, sourceMapping.rawLocationToUILocation(createRawLocation(1, 2))); 371 checkUILocation(uiSourceCodeByURL["source2.js"], 10, 40, sourceMapping.rawLocationToUILocation(createRawLocation(15, 20))); 372 checkRawLocation(script, 1, 0, sourceMapping.uiLocationToRawLocation(uiSourceCodeByURL["source1.js"], 2, 0)); 373 checkRawLocation(script, 15, 0, sourceMapping.uiLocationToRawLocation(uiSourceCodeByURL["source2.js"], 10, 0)); 374 375 uiSourceCodeList[0].requestContent(didRequestContent1); 381 376 382 377 function didRequestContent1(mimeType, content) … … 400 395 401 396 var script = createScriptMock("compiled.js", 0, 0, true, "<script source>"); 402 var rawSourceCode = createRawSourceCode(script, null); 403 var uiSourceCodeList; 404 405 waitForSourceMappingEvent(rawSourceCode, checkMapping); 406 rawSourceCode.setCompilerSourceMapping(compilerSourceMappingMock); 407 408 function checkMapping() 409 { 410 InspectorTest.assertTrue(false, "Should not be reached."); 411 } 412 397 var rawSourceCode = createRawSourceCode(script, null, false, compilerSourceMappingMock); 398 399 InspectorTest.assertEquals(1, rawSourceCode.sourceMapping.uiSourceCodeList().length); 400 InspectorTest.assertEquals("compiled.js", rawSourceCode.sourceMapping.uiSourceCodeList()[0].url); 413 401 next(); 414 402 } -
trunk/Source/WebCore/ChangeLog
r103794 r103795 1 2011-12-28 Pavel Podivilov <podivilov@chromium.org> 2 3 Web Inspector: add "enable source maps" checkbox setting. 4 https://bugs.webkit.org/show_bug.cgi?id=75311 5 6 Reviewed by Pavel Feldman. 7 8 When "enable source maps" is on, all auto detected source maps are silently applied. 9 10 * English.lproj/localizedStrings.js: 11 * inspector/front-end/DebuggerPresentationModel.js: 12 * inspector/front-end/JavaScriptSourceFrame.js: 13 (WebInspector.JavaScriptSourceFrame.prototype.populateTextAreaContextMenu): 14 * inspector/front-end/RawSourceCode.js: 15 (WebInspector.RawSourceCode): 16 (WebInspector.RawSourceCode.prototype.setFormatted): 17 (WebInspector.RawSourceCode.prototype._updateSourceMapping.didCreateSourceMapping): 18 (WebInspector.RawSourceCode.prototype._updateSourceMapping): 19 (WebInspector.RawSourceCode.prototype._createUISourceCode): 20 * inspector/front-end/Settings.js: 21 (WebInspector.Settings): 22 * inspector/front-end/SettingsScreen.js: 23 (WebInspector.SettingsScreen): 24 * inspector/front-end/UISourceCode.js: 25 (WebInspector.UISourceCode): 26 * inspector/front-end/inspector.js: 27 (WebInspector._toolbarItemClicked): 28 1 29 2011-12-29 Julien Chaffraix <jchaffraix@webkit.org> 2 30 -
trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js
r103759 r103795 90 90 }, 91 91 92 /* 92 /** 93 93 * @param {DebuggerAgent.Location} rawLocation 94 94 * @return {?WebInspector.UILocation} … … 140 140 } 141 141 142 rawSourceCode = new WebInspector.RawSourceCode(script.scriptId, script, resource, this._formatter, this._formatSource); 142 var compilerSourceMapping = null; 143 if (WebInspector.settings.sourceMapsEnabled.get() && script.sourceMapURL) 144 compilerSourceMapping = new WebInspector.ClosureCompilerSourceMapping(script.sourceMapURL, script.sourceURL); 145 146 rawSourceCode = new WebInspector.RawSourceCode(script.scriptId, script, resource, this._formatter, this._formatSource, compilerSourceMapping); 143 147 this._bindScriptToRawSourceCode(script, rawSourceCode); 144 148 … … 337 341 338 342 /** 339 * @param {WebInspector.UISourceCode} uiSourceCode340 */341 installCompilerSourceMapping: function(uiSourceCode)342 {343 var sourceMapping = new WebInspector.ClosureCompilerSourceMapping(uiSourceCode.sourceMapURL, uiSourceCode.url);344 uiSourceCode.rawSourceCode.setCompilerSourceMapping(sourceMapping);345 },346 347 /**348 343 * @param {WebInspector.Event} event 349 344 */ -
trunk/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js
r103690 r103795 158 158 var evaluateLabel = WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Evaluate in console" : "Evaluate in Console"); 159 159 contextMenu.appendItem(evaluateLabel, WebInspector.evaluateInConsole.bind(WebInspector, selection.toString())); 160 contextMenu.appendSeparator(); 161 } 162 163 if (this._uiSourceCode.sourceMapURL) { 164 var installSourceMapLabel = WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Install source map" : "Install Source Map"); 165 contextMenu.appendItem(installSourceMapLabel, this._model.installCompilerSourceMapping.bind(this._model, this._uiSourceCode)); 166 } 167 160 } 168 161 }, 169 162 -
trunk/Source/WebCore/inspector/front-end/RawSourceCode.js
r103711 r103795 40 40 * @param {WebInspector.ScriptFormatter} formatter 41 41 * @param {boolean} formatted 42 */ 43 WebInspector.RawSourceCode = function(id, script, resource, formatter, formatted) 42 * @param {WebInspector.CompilerSourceMapping} compilerSourceMapping 43 */ 44 WebInspector.RawSourceCode = function(id, script, resource, formatter, formatted, compilerSourceMapping) 44 45 { 45 46 this.id = id; 46 47 this.url = script.sourceURL; 47 48 this.isContentScript = script.isContentScript; 48 this.sourceMapURL = script.sourceMapURL;49 49 this._scripts = [script]; 50 50 this._formatter = formatter; 51 51 this._formatted = formatted; 52 this._compilerSourceMapping = compilerSourceMapping; 52 53 this._resource = resource; 53 54 this.messages = []; 54 55 55 this._useTemporaryContent = this._resource && !this._resource.finished;56 this._useTemporaryContent = !this._compilerSourceMapping && this._resource && !this._resource.finished; 56 57 this._hasNewScripts = true; 57 58 if (!this._useTemporaryContent) … … 91 92 return; 92 93 this._formatted = formatted; 93 this._updateSourceMapping(); 94 }, 95 96 /** 97 * @param {WebInspector.CompilerSourceMapping} compilerSourceMapping 98 */ 99 setCompilerSourceMapping: function(compilerSourceMapping) 100 { 101 if (compilerSourceMapping) 102 this._useTemporaryContent = false; 103 this._compilerSourceMapping = compilerSourceMapping; 104 this._updateSourceMapping(); 94 if (!this._compilerSourceMapping) 95 this._updateSourceMapping(); 105 96 }, 106 97 … … 161 152 { 162 153 this._updatingSourceMapping = false; 163 if (!sourceMapping) 164 return; 165 if (!this._updateNeeded) 154 if (sourceMapping && !this._updateNeeded) 166 155 this._saveSourceMapping(sourceMapping); 167 156 else … … 245 234 var uiSourceCode = new WebInspector.UISourceCode(id, url, this, contentProvider); 246 235 uiSourceCode.isContentScript = this.isContentScript; 247 uiSourceCode.sourceMapURL = this.sourceMapURL;248 236 return uiSourceCode; 249 237 }, -
trunk/Source/WebCore/inspector/front-end/Settings.js
r103767 r103795 82 82 this.domBreakpoints = this.createSetting("domBreakpoints", []); 83 83 this.xhrBreakpoints = this.createSetting("xhrBreakpoints", []); 84 this.sourceMapsEnabled = this.createSetting("sourceMapsEnabled", false); 84 85 this.cacheDisabled = this.createSetting("cacheDisabled", false); 85 86 this.overrideUserAgent = this.createSetting("overrideUserAgent", ""); -
trunk/Source/WebCore/inspector/front-end/SettingsScreen.js
r103767 r103795 67 67 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show script folders"), WebInspector.settings.showScriptFolders)); 68 68 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Search in content scripts"), WebInspector.settings.searchInContentScripts)); 69 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Enable source maps"), WebInspector.settings.sourceMapsEnabled)); 69 70 70 71 p = this._appendSection(WebInspector.UIString("Profiler"), true); -
trunk/Source/WebCore/inspector/front-end/UISourceCode.js
r103690 r103795 44 44 this._contentProvider = contentProvider; 45 45 this.isContentScript = false; 46 this.sourceMapURL = "";47 46 /** 48 47 * @type Array.<function(string,string)> -
trunk/Source/WebCore/inspector/front-end/inspector.js
r101777 r103795 886 886 WebInspector.inspectorView.setCurrentPanel(toolbarItem.panel); 887 887 } 888 889 WebInspector.installSourceMappingForTest = function(url)890 {891 // FIXME: remove this method when it's possible to set compiler source mappings via UI.892 var sourceMapping = new WebInspector.ClosureCompilerSourceMapping(url);893 var uiSourceCode = WebInspector.panels.scripts.visibleView._uiSourceCode;894 uiSourceCode.rawSourceCode.setCompilerSourceMapping(sourceMapping);895 }
Note: See TracChangeset
for help on using the changeset viewer.