Diff
Modified: trunk/LayoutTests/ChangeLog (112532 => 112533)
--- trunk/LayoutTests/ChangeLog 2012-03-29 14:43:30 UTC (rev 112532)
+++ trunk/LayoutTests/ChangeLog 2012-03-29 15:23:51 UTC (rev 112533)
@@ -1,3 +1,13 @@
+2012-03-29 Vsevolod Vlasov <[email protected]>
+
+ Web Inspector: Existing UISourceCode should be loaded on scripts panel creation/reset.
+ https://bugs.webkit.org/show_bug.cgi?id=82614
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/debugger/scripts-panel-expected.txt:
+ * inspector/debugger/scripts-panel.html:
+
2012-03-29 Csaba Osztrogonác <[email protected]>
[Qt] Unreviewed gardening after r112514. Add Qt5 specific expected files.
Modified: trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt (112532 => 112533)
--- trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt 2012-03-29 14:43:30 UTC (rev 112532)
+++ trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt 2012-03-29 15:23:51 UTC (rev 112533)
@@ -6,17 +6,30 @@
bar.js
baz.js
foo.js
+ foobar.js
Dumping ScriptsNavigator 'Content scripts' tab:
Source requested for baz.js
Running: testInitialLoadWithComboBoxFileSelector
-Source requested for foo.js
+Source requested for foobar.js
Dump files select:
bar.js
baz.js
foo.js
+ foobar.js
Source requested for baz.js
+Running: testReset
+Source requested for baz.js
+Dumping ScriptsNavigator 'Scripts' tab:
+ bar.js
+ baz.js
+ foo.js
+Dumping ScriptsNavigator 'Content scripts' tab:
+Dumping ScriptsNavigator 'Scripts' tab:
+ bar.js
+Dumping ScriptsNavigator 'Content scripts' tab:
+
Running: testSourceReplaced
Dumping ScriptsNavigator 'Scripts' tab:
compiled.js
Modified: trunk/LayoutTests/inspector/debugger/scripts-panel.html (112532 => 112533)
--- trunk/LayoutTests/inspector/debugger/scripts-panel.html 2012-03-29 14:43:30 UTC (rev 112532)
+++ trunk/LayoutTests/inspector/debugger/scripts-panel.html 2012-03-29 15:23:51 UTC (rev 112533)
@@ -19,6 +19,26 @@
model.canEditScriptSource = function() { return true; };
uiSourceCodes = [];
model.uiSourceCodes = function() { return uiSourceCodes.slice(); };
+ model._addUISourceCode = function(uiSourceCode)
+ {
+ uiSourceCodes.push(uiSourceCode);
+ this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeAdded, uiSourceCode);
+ }
+ model._reset = function(preservedItems)
+ {
+ uiSourceCodes = preservedItems || [];
+ this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.DebuggerReset, null);
+ }
+ model._replaceUISourceCodes = function(oldUISourceCodeList, newUISourceCodeList)
+ {
+ for (var i = 0; i < oldUISourceCodeList.length; ++i)
+ uiSourceCodes.remove(oldUISourceCodeList[i]);
+ for (var i = 0; i < newUISourceCodeList.length; ++i)
+ uiSourceCodes.push(newUISourceCodeList[i]);
+ var data = { oldUISourceCodeList: oldUISourceCodeList, uiSourceCodeList: newUISourceCodeList };
+ this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeReplaced, data);
+ }
+
return model;
}
function createUISouceCode(url)
@@ -37,18 +57,24 @@
function testInitialLoad(next)
{
var model = createDebuggerPresentationModelMock();
+ var uiSourceCode = createUISouceCode("foobar.js");
+ var uiSourceCodeFoo = createUISouceCode("foo.js");
+ var uiSourceCodeBar = createUISouceCode("bar.js");
+ var uiSourceCodeBaz = createUISouceCode("baz.js");
+
+ model._addUISourceCode(uiSourceCode);
+
var panel = new WebInspector.ScriptsPanel(model);
panel.show();
- var uiSourceCodeBAZ = createUISouceCode("baz.js");
- panel._uiSourceCodeAdded({ data: createUISouceCode("foo.js") });
- panel._uiSourceCodeAdded({ data: createUISouceCode("bar.js") });
- panel._uiSourceCodeAdded({ data: uiSourceCodeBAZ });
+ model._addUISourceCode(uiSourceCodeFoo);
+ model._addUISourceCode(uiSourceCodeBar);
+ model._addUISourceCode(uiSourceCodeBaz);
InspectorTest.dumpScriptsNavigator(panel._navigator);
// Select "baz.js".
- panel._showFile(uiSourceCodeBAZ);
+ panel._showFile(uiSourceCodeBaz);
panel.detach();
next();
@@ -57,14 +83,21 @@
function testInitialLoadWithComboBoxFileSelector(next)
{
var model = createDebuggerPresentationModelMock();
+ var uiSourceCode = createUISouceCode("foobar.js");
+ var uiSourceCodeFoo = createUISouceCode("foo.js");
+ var uiSourceCodeBar = createUISouceCode("bar.js");
+ var uiSourceCodeBaz = createUISouceCode("baz.js");
+
+ model._addUISourceCode(uiSourceCode);
+
WebInspector.settings.useScriptsNavigator.set(false);
var panel = new WebInspector.ScriptsPanel(model);
WebInspector.settings.useScriptsNavigator.set(true);
panel.show();
- panel._uiSourceCodeAdded({ data: createUISouceCode("foo.js") });
- panel._uiSourceCodeAdded({ data: createUISouceCode("bar.js") });
- panel._uiSourceCodeAdded({ data: createUISouceCode("baz.js") });
+ model._addUISourceCode(uiSourceCodeFoo);
+ model._addUISourceCode(uiSourceCodeBar);
+ model._addUISourceCode(uiSourceCodeBaz);
InspectorTest.addResult("Dump files select:");
var select = panel._fileSelector._filesSelectElement;
@@ -72,8 +105,8 @@
InspectorTest.addResult(select[i].text.replace(/\u00a0/g, " "));
// Selected file should be "foo.js".
- InspectorTest.assertEquals(2, select.selectedIndex);
- InspectorTest.assertEquals("foo.js", select[2].text.replace(/\s/g, ""));
+ InspectorTest.assertEquals(3, select.selectedIndex);
+ InspectorTest.assertEquals("foobar.js", select[3].text.replace(/\s/g, ""));
// Select "baz.js".
select.selectedIndex = 1;
@@ -83,22 +116,47 @@
next();
},
+ function testReset(next)
+ {
+ var model = createDebuggerPresentationModelMock();
+ var panel = new WebInspector.ScriptsPanel(model);
+ panel.show();
+
+ var uiSourceCodeFoo = createUISouceCode("foo.js");
+ var uiSourceCodeBar = createUISouceCode("bar.js");
+ var uiSourceCodeBaz = createUISouceCode("baz.js");
+
+ model._addUISourceCode(uiSourceCodeFoo);
+ model._addUISourceCode(uiSourceCodeBar);
+ model._addUISourceCode(uiSourceCodeBaz);
+
+ InspectorTest.dumpScriptsNavigator(panel._navigator);
+
+ model._reset([uiSourceCodeBar]);
+ InspectorTest.dumpScriptsNavigator(panel._navigator);
+
+ panel.detach();
+ next();
+ },
+
+
function testSourceReplaced(next)
{
var model = createDebuggerPresentationModelMock();
var panel = new WebInspector.ScriptsPanel(model);
panel.show();
- panel._uiSourceCodeAdded({ data: createUISouceCode("foo.js") });
+ var uiSourceCodeFoo = createUISouceCode("foo.js");
+ model._addUISourceCode(uiSourceCodeFoo);
var compiledSourceCode = createUISouceCode("compiled.js");
- panel._uiSourceCodeAdded({ data: compiledSourceCode });
+ model._addUISourceCode(compiledSourceCode);
InspectorTest.dumpScriptsNavigator(panel._navigator);
// Plug compiler source mapping.
var source1SourceCode = createUISouceCode("source1.js");
var source2SourceCode = createUISouceCode("source2.js");
- panel._uiSourceCodeReplaced({ data: { oldUISourceCodeList: [compiledSourceCode], uiSourceCodeList: [source1SourceCode, source2SourceCode] }});
+ model._replaceUISourceCodes([compiledSourceCode], [source1SourceCode, source2SourceCode]);
InspectorTest.dumpScriptsNavigator(panel._navigator);
InspectorTest.showScriptSourceOnScriptsPanel(panel, "source2.js", step2);
@@ -109,7 +167,7 @@
function step3() {
// Unplug compiler source mapping.
- panel._uiSourceCodeReplaced({ data: { oldUISourceCodeList: [source1SourceCode, source2SourceCode], uiSourceCodeList: [compiledSourceCode] }});
+ model._replaceUISourceCodes([source1SourceCode, source2SourceCode], [compiledSourceCode]);
InspectorTest.dumpScriptsNavigator(panel._navigator);
panel.detach();
@@ -125,16 +183,17 @@
WebInspector.settings.useScriptsNavigator.set(true);
panel.show();
- panel._uiSourceCodeAdded({ data: createUISouceCode("foo.js") });
+ var uiSourceCodeFoo = createUISouceCode("foo.js");
+ model._addUISourceCode(uiSourceCodeFoo);
var compiledSourceCode = createUISouceCode("compiled.js");
- panel._uiSourceCodeAdded({ data: compiledSourceCode });
+ model._addUISourceCode(compiledSourceCode);
InspectorTest.dumpComboBoxFileSelector(panel._fileSelector);
// Plug compiler source mapping.
var source1SourceCode = createUISouceCode("source1.js");
var source2SourceCode = createUISouceCode("source2.js");
- panel._uiSourceCodeReplaced({ data: { oldUISourceCodeList: [compiledSourceCode], uiSourceCodeList: [source1SourceCode, source2SourceCode] }});
+ model._replaceUISourceCodes([compiledSourceCode], [source1SourceCode, source2SourceCode]);
InspectorTest.dumpComboBoxFileSelector(panel._fileSelector);
InspectorTest.showScriptSourceOnScriptsPanel(panel, "source2.js", step2);
@@ -144,7 +203,7 @@
function step3() {
// Unplug compiler source mapping.
- panel._uiSourceCodeReplaced({ data: { oldUISourceCodeList: [source1SourceCode, source2SourceCode], uiSourceCodeList: [compiledSourceCode] }});
+ model._replaceUISourceCodes([source1SourceCode, source2SourceCode], [compiledSourceCode]);
InspectorTest.dumpComboBoxFileSelector(panel._fileSelector);
panel.detach();
Modified: trunk/Source/WebCore/ChangeLog (112532 => 112533)
--- trunk/Source/WebCore/ChangeLog 2012-03-29 14:43:30 UTC (rev 112532)
+++ trunk/Source/WebCore/ChangeLog 2012-03-29 15:23:51 UTC (rev 112533)
@@ -1,3 +1,21 @@
+2012-03-29 Vsevolod Vlasov <[email protected]>
+
+ Web Inspector: Existing UISourceCode should be loaded on scripts panel creation/reset.
+ https://bugs.webkit.org/show_bug.cgi?id=82614
+
+ Reviewed by Pavel Feldman.
+
+ UISourceCode are now loaded from DebuggerPresentationModel on scripts panel creation/reset.
+ This is needed to show snippets that are loaded before scripts panel creation and are not removed on navigation.
+
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel.prototype._handleUISourceCodeAdded):
+ (WebInspector.ScriptsPanel.prototype._loadUISourceCodes):
+ (WebInspector.ScriptsPanel.prototype._uiSourceCodeAdded):
+ (WebInspector.ScriptsPanel.prototype._reset):
+ * inspector/front-end/SnippetsModel.js:
+ (WebInspector.SnippetsScriptMapping.prototype.uiSourceCodeList):
+
2012-03-29 Andrey Kosyakov <[email protected]>
Web Inspector: on a single click in Timeline overview, make a minimal selection centered around cursor
Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (112532 => 112533)
--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2012-03-29 14:43:30 UTC (rev 112532)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2012-03-29 15:23:51 UTC (rev 112533)
@@ -167,12 +167,13 @@
this._debuggerEnabled = !Capabilities.debuggerCausesRecompilation;
+ this._sourceFramesByUISourceCode = new Map();
this._reset(false);
WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasEnabled, this._debuggerWasEnabled, this);
WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasDisabled, this._debuggerWasDisabled, this);
- this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.UISourceCodeAdded, this._uiSourceCodeAdded, this)
+ this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.UISourceCodeAdded, this._handleUISourceCodeAdded, this)
this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.UISourceCodeReplaced, this._uiSourceCodeReplaced, this);
this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this);
this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.DebuggerPaused, this._debuggerPaused, this);
@@ -187,8 +188,6 @@
WebInspector.debuggerModel.enableDebugger();
WebInspector.advancedSearchController.registerSearchScope(new WebInspector.ScriptsSearchScope());
-
- this._sourceFramesByUISourceCode = new Map();
}
// Keep these in sync with WebCore::ScriptDebugServer
@@ -251,10 +250,27 @@
}
},
- _uiSourceCodeAdded: function(event)
+ /**
+ * @param {WebInspector.Event} event
+ */
+ _handleUISourceCodeAdded: function(event)
{
var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data;
+ this._uiSourceCodeAdded(uiSourceCode);
+ },
+ _loadUISourceCodes: function()
+ {
+ var uiSourceCodes = this._presentationModel.uiSourceCodes();
+ for (var i = 0; i < uiSourceCodes.length; ++i)
+ this._uiSourceCodeAdded(uiSourceCodes[i]);
+ },
+
+ /**
+ * @param {WebInspector.UISourceCode} uiSourceCode
+ */
+ _uiSourceCodeAdded: function(uiSourceCode)
+ {
var breakpoints = uiSourceCode.breakpoints();
for (var lineNumber in breakpoints)
this._uiBreakpointAdded({ data: breakpoints[lineNumber] });
@@ -430,6 +446,7 @@
this.sidebarPanes.watchExpressions.reset();
if (!preserveItems && this.sidebarPanes.workers)
this.sidebarPanes.workers.reset();
+ this._loadUISourceCodes();
},
get visibleView()
Modified: trunk/Source/WebCore/inspector/front-end/SnippetsModel.js (112532 => 112533)
--- trunk/Source/WebCore/inspector/front-end/SnippetsModel.js 2012-03-29 14:43:30 UTC (rev 112532)
+++ trunk/Source/WebCore/inspector/front-end/SnippetsModel.js 2012-03-29 15:23:51 UTC (rev 112533)
@@ -325,9 +325,7 @@
*/
uiSourceCodeList: function()
{
- var result = [];
- for (var uiSourceCode in this._uiSourceCodeForSnippet.values())
- result.push(uiSourceCode);
+ var result = this._uiSourceCodeForSnippet.values();
result = result.concat(this._releasedUISourceCodes());
return result;
},