Diff
Modified: trunk/LayoutTests/ChangeLog (88807 => 88808)
--- trunk/LayoutTests/ChangeLog 2011-06-14 16:25:04 UTC (rev 88807)
+++ trunk/LayoutTests/ChangeLog 2011-06-14 16:25:29 UTC (rev 88808)
@@ -1,3 +1,13 @@
+2011-06-14 Pavel Podivilov <[email protected]>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: add tooltip to file select options in scripts panel.
+ https://bugs.webkit.org/show_bug.cgi?id=62537
+
+ * inspector/debugger/scripts-panel-expected.txt:
+ * inspector/debugger/scripts-panel.html:
+
2011-06-14 Ademar de Souza Reis Jr. <[email protected]>
Unreviewed: unskip test rebasedlined by r88772
Modified: trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt (88807 => 88808)
--- trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt 2011-06-14 16:25:04 UTC (rev 88807)
+++ trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt 2011-06-14 16:25:29 UTC (rev 88808)
@@ -8,5 +8,15 @@
Running: testSourceFramesCount
Page reloaded.
+
+Running: testFilesSelect
+text: script.js, tooltip: ...foo/bar/script.js
+text: script.js, tooltip: ...foo/bar/script.js?a=1
+text: script.js, tooltip: ...foo/bar/script.js?a=2
+text: script.js, tooltip: ...foo/baz/script.js
+text: Content scripts, tooltip: ...
+text: contentScript.js, tooltip: ...foo/bar/contentScript.js?a=1
+text: contentScript.js, tooltip: ...foo/bar/contentScript.js?a=2
+text: contentScript2.js, tooltip: ...foo/bar/contentScript2.js?a=1
Debugger was disabled.
Modified: trunk/LayoutTests/inspector/debugger/scripts-panel.html (88807 => 88808)
--- trunk/LayoutTests/inspector/debugger/scripts-panel.html 2011-06-14 16:25:04 UTC (rev 88807)
+++ trunk/LayoutTests/inspector/debugger/scripts-panel.html 2011-06-14 16:25:29 UTC (rev 88808)
@@ -122,6 +122,39 @@
InspectorTest.assertEquals(true, sourceFrameCount <= 2, "too many source frames created after page reload");
next();
}
+ },
+
+ function testFilesSelect(next)
+ {
+ var panel = new WebInspector.ScriptsPanel();
+ var rootURL = WebInspector.mainResource.url.substring(0, WebInspector.mainResource.url.lastIndexOf("/") + 1);
+ var nextId = 0;
+
+ function addOption(url, isContentScript)
+ {
+ var displayName = url;
+ var indexOfQuery = displayName.indexOf("?");
+ if (indexOfQuery !== -1)
+ displayName = displayName.substring(0, indexOfQuery);
+ var lastSlashIndex = displayName.lastIndexOf("/");
+ if (lastSlashIndex !== -1)
+ displayName = displayName.substring(lastSlashIndex + 1);
+ panel._addOptionToFilesSelect({ id: nextId++, url: rootURL + url, displayName: displayName, isContentScript: isContentScript });
+ }
+ addOption("foo/bar/script.js", false);
+ addOption("foo/bar/contentScript2.js?a=1", true);
+ addOption("foo/bar/script.js?a=2", false);
+ addOption("foo/bar/contentScript.js?a=2", true);
+ addOption("foo/bar/script.js?a=1", false);
+ addOption("foo/baz/script.js", false);
+ addOption("foo/bar/contentScript.js?a=1", true);
+ var select = panel._filesSelectElement;
+ for (var i = 0; i < select.length; ++i) {
+ var option = select[i];
+ var tooltip = "..." + option.title.substring(rootURL.length);
+ InspectorTest.addResult("text: " + option.text + ", tooltip: " + tooltip);
+ }
+ next();
}
]);
};
Modified: trunk/Source/WebCore/ChangeLog (88807 => 88808)
--- trunk/Source/WebCore/ChangeLog 2011-06-14 16:25:04 UTC (rev 88807)
+++ trunk/Source/WebCore/ChangeLog 2011-06-14 16:25:29 UTC (rev 88808)
@@ -1,3 +1,18 @@
+2011-06-14 Pavel Podivilov <[email protected]>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: add tooltip to file select options in scripts panel.
+ https://bugs.webkit.org/show_bug.cgi?id=62537
+
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel):
+ (WebInspector.ScriptsPanel.prototype._sourceFileAdded):
+ (WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect.compare):
+ (WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect):
+ (WebInspector.ScriptsPanel.prototype._callFrameSelected.didGetSourceLocation):
+ (WebInspector.ScriptsPanel.prototype._callFrameSelected):
+
2011-06-14 Luke Macpherson <[email protected]>
Reviewed by Eric Seidel.
Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (88807 => 88808)
--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2011-06-14 16:25:04 UTC (rev 88807)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2011-06-14 16:25:29 UTC (rev 88808)
@@ -118,9 +118,9 @@
this.sidebarPanes.scopechain.expanded = true;
this.sidebarPanes.jsBreakpoints.expanded = true;
-
+
var helpSection = WebInspector.shortcutsHelp.section(WebInspector.UIString("Scripts Panel"));
- this.sidebarPanes.callstack.registerShortcuts(helpSection, this.registerShortcut.bind(this));
+ this.sidebarPanes.callstack.registerShortcuts(helpSection, this.registerShortcut.bind(this));
var panelEnablerHeading = WebInspector.UIString("You need to enable debugging before you can use the Scripts panel.");
var panelEnablerDisclaimer = WebInspector.UIString("Enabling debugging will make scripts run slower.");
@@ -234,7 +234,7 @@
return;
}
- this._addOptionToFilesSelect(sourceFile.id);
+ this._addOptionToFilesSelect(sourceFile);
var lastViewedURL = WebInspector.settings.lastViewedScriptFile;
if (this._filesSelectElement.length === 1) {
@@ -248,15 +248,19 @@
this._showSourceFrameAndAddToHistory(sourceFile.id);
},
- _addOptionToFilesSelect: function(sourceFileId)
+ _addOptionToFilesSelect: function(sourceFile)
{
- var sourceFile = this._presentationModel.sourceFile(sourceFileId);
var select = this._filesSelectElement;
var option = document.createElement("option");
option.text = sourceFile.displayName;
+ option.title = sourceFile.url;
option.isContentScript = sourceFile.isContentScript;
if (sourceFile.isContentScript)
option.addStyleClass("extension-script");
+ function compare(a, b)
+ {
+ return a < b ? -1 : (a > b ? 1 : 0);
+ }
function optionCompare(a, b)
{
if (a === select.contentScriptSection)
@@ -269,9 +273,7 @@
if (!a.isContentScript && b.isContentScript)
return -1;
- if (a.text === b.text)
- return 0;
- return a.text < b.text ? -1 : 1;
+ return compare(a.text, b.text) || compare(a.title, b.title);
}
var insertionIndex = insertionIndexForObjectInListSortedByFunction(option, select.childNodes, optionCompare);
@@ -286,8 +288,8 @@
var insertionIndex = insertionIndexForObjectInListSortedByFunction(contentScriptSection, select.childNodes, optionCompare);
select.insertBefore(contentScriptSection, insertionIndex < 0 ? null : select.childNodes.item(insertionIndex));
}
- option._sourceFileId = sourceFileId;
- this._sourceFileIdToFilesSelectOption[sourceFileId] = option;
+ option._sourceFileId = sourceFile.id;
+ this._sourceFileIdToFilesSelectOption[sourceFile.id] = option;
},
setScriptSourceIsBeingEdited: function(sourceFileId, inEditMode)
@@ -648,7 +650,8 @@
if (!(sourceFileId in this._sourceFileIdToFilesSelectOption)) {
// Anonymous scripts are not added to files select by default.
- this._addOptionToFilesSelect(sourceFileId);
+ var sourceFile = this._presentationModel.sourceFile(sourceFileId);
+ this._addOptionToFilesSelect(sourceFile);
}
var sourceFrame = this._showSourceFrameAndAddToHistory(sourceFileId);
sourceFrame.setExecutionLine(lineNumber);