[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.22-985-g3c00f00
pfeldman at chromium.org
pfeldman at chromium.org
Wed Mar 17 17:59:11 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 4233f76b20aab9f7fc1469af31964df050d5a8d4
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Feb 25 13:45:27 2010 +0000
2010-02-23 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Timothy Hatcher.
Web Inspector: Scripts panel shows blank source when stopping on a breakpoint on refresh.
https://bugs.webkit.org/show_bug.cgi?id=35232
* inspector/front-end/Panel.js:
(WebInspector.Panel.prototype.canShowSourceLine):
(WebInspector.Panel.prototype.showSourceLine):
* inspector/front-end/ResourcesPanel.js:
(WebInspector.ResourcesPanel.prototype.canShowSourceLine):
(WebInspector.ResourcesPanel.prototype.showSourceLine):
* inspector/front-end/Script.js:
(WebInspector.Script):
* inspector/front-end/ScriptView.js:
(WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype.show):
(WebInspector.ScriptsPanel.prototype.get searchableViews):
(WebInspector.ScriptsPanel.prototype.addScript):
(WebInspector.ScriptsPanel.prototype._resourceLoadingFinished):
(WebInspector.ScriptsPanel.prototype.addBreakpoint):
(WebInspector.ScriptsPanel.prototype.removeBreakpoint):
(WebInspector.ScriptsPanel.prototype.reset):
(WebInspector.ScriptsPanel.prototype.canShowSourceLine):
(WebInspector.ScriptsPanel.prototype.showSourceLine):
(WebInspector.ScriptsPanel.prototype._scriptOrResourceForURLAndLine):
(WebInspector.ScriptsPanel.prototype.showView):
(WebInspector.ScriptsPanel.prototype._sourceFrameForScriptOrResource):
(WebInspector.ScriptsPanel.prototype._showScriptOrResource):
(WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu.optionCompare):
(WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu):
* inspector/front-end/SourceView.js:
(WebInspector.SourceView.prototype._addBreakpoint):
* inspector/front-end/inspector.js:
(WebInspector.documentClick.followLink):
(WebInspector.documentClick):
(WebInspector._choosePanelToShowSourceLine):
(WebInspector.canShowSourceLine):
(WebInspector.showSourceLine):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 57f72a8..08ea6dd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,46 @@
+2010-02-25 Pavel Feldman <pfeldman at chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Web Inspector: Scripts panel shows blank source when stopping on a breakpoint on refresh.
+
+ https://bugs.webkit.org/show_bug.cgi?id=35232
+
+ * inspector/front-end/Panel.js:
+ (WebInspector.Panel.prototype.canShowSourceLine):
+ (WebInspector.Panel.prototype.showSourceLine):
+ * inspector/front-end/ResourcesPanel.js:
+ (WebInspector.ResourcesPanel.prototype.canShowSourceLine):
+ (WebInspector.ResourcesPanel.prototype.showSourceLine):
+ * inspector/front-end/Script.js:
+ (WebInspector.Script):
+ * inspector/front-end/ScriptView.js:
+ (WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded):
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel.prototype.show):
+ (WebInspector.ScriptsPanel.prototype.get searchableViews):
+ (WebInspector.ScriptsPanel.prototype.addScript):
+ (WebInspector.ScriptsPanel.prototype._resourceLoadingFinished):
+ (WebInspector.ScriptsPanel.prototype.addBreakpoint):
+ (WebInspector.ScriptsPanel.prototype.removeBreakpoint):
+ (WebInspector.ScriptsPanel.prototype.reset):
+ (WebInspector.ScriptsPanel.prototype.canShowSourceLine):
+ (WebInspector.ScriptsPanel.prototype.showSourceLine):
+ (WebInspector.ScriptsPanel.prototype._scriptOrResourceForURLAndLine):
+ (WebInspector.ScriptsPanel.prototype.showView):
+ (WebInspector.ScriptsPanel.prototype._sourceFrameForScriptOrResource):
+ (WebInspector.ScriptsPanel.prototype._showScriptOrResource):
+ (WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu.optionCompare):
+ (WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu):
+ * inspector/front-end/SourceView.js:
+ (WebInspector.SourceView.prototype._addBreakpoint):
+ * inspector/front-end/inspector.js:
+ (WebInspector.documentClick.followLink):
+ (WebInspector.documentClick):
+ (WebInspector._choosePanelToShowSourceLine):
+ (WebInspector.canShowSourceLine):
+ (WebInspector.showSourceLine):
+
2010-02-25 Ben Murdoch <benm at google.com>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/inspector/front-end/Panel.js b/WebCore/inspector/front-end/Panel.js
index 5b01191..b916708 100644
--- a/WebCore/inspector/front-end/Panel.js
+++ b/WebCore/inspector/front-end/Panel.js
@@ -373,12 +373,12 @@ WebInspector.Panel.prototype = {
visibleView.resize();
},
- canShowSourceLineForURL: function(url)
+ canShowSourceLine: function(url, line)
{
return false;
},
- showSourceLineForURL: function(url, line)
+ showSourceLine: function(url, line)
{
return false;
},
diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js
index 9a44c57..774ed64 100644
--- a/WebCore/inspector/front-end/ResourcesPanel.js
+++ b/WebCore/inspector/front-end/ResourcesPanel.js
@@ -454,12 +454,12 @@ WebInspector.ResourcesPanel.prototype = {
WebInspector.panels.scripts.viewRecreated(oldView, newView);
},
- canShowSourceLineForURL: function(url)
+ canShowSourceLine: function(url, line)
{
return !!WebInspector.resourceForURL(url);
},
- showSourceLineForURL: function(url, line)
+ showSourceLine: function(url, line)
{
this.showResource(WebInspector.resourceForURL(url), line);
},
diff --git a/WebCore/inspector/front-end/Script.js b/WebCore/inspector/front-end/Script.js
index e6413a9..58268d9 100644
--- a/WebCore/inspector/front-end/Script.js
+++ b/WebCore/inspector/front-end/Script.js
@@ -32,6 +32,13 @@ WebInspector.Script = function(sourceID, sourceURL, source, startingLine, errorL
this.errorLine = errorLine;
this.errorMessage = errorMessage;
+ this.linesCount = 0;
+ var lastIndex = source.indexOf("\n");
+ while (lastIndex !== -1) {
+ lastIndex = source.indexOf("\n", lastIndex + 1)
+ this.linesCount++;
+ }
+
// if no URL, look for "//@ sourceURL=" decorator
// note that this sourceURL comment decorator is behavior that FireBug added
// in it's 1.1 release as noted in the release notes:
diff --git a/WebCore/inspector/front-end/ScriptView.js b/WebCore/inspector/front-end/ScriptView.js
index c5a8b81..eeceaea 100644
--- a/WebCore/inspector/front-end/ScriptView.js
+++ b/WebCore/inspector/front-end/ScriptView.js
@@ -52,7 +52,11 @@ WebInspector.ScriptView.prototype = {
this.attach();
- this.sourceFrame.setContent("text/javascript", this.script.source);
+ var prefix = "";
+ for (var i = 0; i < this.script.startingLine - 1; ++i)
+ prefix += "\n";
+
+ this.sourceFrame.setContent("text/javascript", prefix + this.script.source);
this._sourceFrameSetup = true;
delete this._frameNeedsSetup;
},
diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js
index 7e9cb9b..1ef709d 100644
--- a/WebCore/inspector/front-end/ScriptsPanel.js
+++ b/WebCore/inspector/front-end/ScriptsPanel.js
@@ -238,16 +238,6 @@ WebInspector.ScriptsPanel.prototype = {
this.visibleView.headersVisible = false;
this.visibleView.show(this.viewsContainerElement);
}
- // Hide any views that are visible that are not this panel's current visible view.
- // This can happen when a ResourceView is visible in the Resources panel then switched
- // to the this panel.
- for (var sourceID in this._sourceIDMap) {
- var scriptOrResource = this._sourceIDMap[sourceID];
- var view = this._sourceViewForScriptOrResource(scriptOrResource);
- if (!view || view === this.visibleView)
- continue;
- view.visible = false;
- }
if (this._attachDebuggerWhenShown) {
InspectorBackend.enableDebugger(false);
delete this._attachDebuggerWhenShown;
@@ -256,28 +246,7 @@ WebInspector.ScriptsPanel.prototype = {
get searchableViews()
{
- var views = [];
-
- const visibleView = this.visibleView;
- if (visibleView && visibleView.performSearch) {
- visibleView.alreadySearching = true;
- views.push(visibleView);
- }
-
- for (var sourceID in this._sourceIDMap) {
- var scriptOrResource = this._sourceIDMap[sourceID];
- var view = this._sourceViewForScriptOrResource(scriptOrResource);
- if (!view || !view.performSearch || view.alreadySearching)
- continue;
-
- view.alreadySearching = true;
- views.push(view);
- }
-
- for (var i = 0; i < views.length; ++i)
- delete views[i].alreadySearching;
-
- return views;
+ return [ this.visibleView ];
},
get breakpointsActivated()
@@ -288,27 +257,50 @@ WebInspector.ScriptsPanel.prototype = {
addScript: function(sourceID, sourceURL, source, startingLine, errorLine, errorMessage)
{
var script = new WebInspector.Script(sourceID, sourceURL, source, startingLine, errorLine, errorMessage);
-
- if (sourceURL in WebInspector.resourceURLMap) {
- var resource = WebInspector.resourceURLMap[sourceURL];
- resource.addScript(script);
+ this._sourceIDMap[sourceID] = script;
+
+ var resource = WebInspector.resourceURLMap[sourceURL];
+ if (resource) {
+ if (resource.finished) {
+ // Resource is finished, bind the script right away.
+ resource.addScript(script);
+ this._sourceIDMap[sourceID] = resource;
+ } else {
+ // Resource is not finished, bind the script later.
+ if (!resource._scriptsPendingResourceLoad) {
+ resource._scriptsPendingResourceLoad = [];
+ resource.addEventListener("finished", this._resourceLoadingFinished, this);
+ }
+ resource._scriptsPendingResourceLoad.push(script);
+ }
}
-
- sourceURL = script.sourceURL;
-
- if (sourceID)
- this._sourceIDMap[sourceID] = (resource || script);
this._addScriptToFilesMenu(script);
},
- scriptOrResourceForID: function(id)
- {
- return this._sourceIDMap[id];
- },
-
- scriptForURL: function(url)
+ _resourceLoadingFinished: function(e)
{
- return this._scriptsForURLsInFilesSelect[url];
+ var resource = e.target;
+ for (var i = 0; i < resource._scriptsPendingResourceLoad.length; ++i) {
+ // Bind script to resource.
+ var script = resource._scriptsPendingResourceLoad[i];
+ resource.addScript(script);
+ this._sourceIDMap[script.sourceID] = resource;
+
+ // Remove script from the files list.
+ script.filesSelectOption.parentElement.removeChild(script.filesSelectOption);
+
+ // Move breakpoints to the resource's frame.
+ if (script._scriptView) {
+ var sourceFrame = script._scriptView.sourceFrame;
+ for (var j = 0; j < sourceFrame.breakpoints; ++j) {
+ var resourceFrame = this._sourceFrameForScriptOrResource(resource);
+ resourceFrame.addBreakpoint(sourceFrame.breakpoints[j]);
+ }
+ }
+ }
+ // Adding first script will add resource.
+ this._addScriptToFilesMenu(resource._scriptsPendingResourceLoad[0]);
+ delete resource._scriptsPendingResourceLoad;
},
addBreakpoint: function(breakpoint)
@@ -320,10 +312,9 @@ WebInspector.ScriptsPanel.prototype = {
var sourceFrame;
if (breakpoint.url) {
- if (breakpoint.url in WebInspector.resourceURLMap) {
- var resource = WebInspector.resourceURLMap[breakpoint.url];
+ var resource = WebInspector.resourceURLMap[breakpoint.url];
+ if (resource && resource.finished)
sourceFrame = this._sourceFrameForScriptOrResource(resource);
- }
}
if (breakpoint.sourceID && !sourceFrame) {
@@ -340,9 +331,10 @@ WebInspector.ScriptsPanel.prototype = {
this.sidebarPanes.breakpoints.removeBreakpoint(breakpoint);
var sourceFrame;
- if (breakpoint.url && breakpoint.url in WebInspector.resourceURLMap) {
+ if (breakpoint.url) {
var resource = WebInspector.resourceURLMap[breakpoint.url];
- sourceFrame = this._sourceFrameForScriptOrResource(resource);
+ if (resource && resource.finished)
+ sourceFrame = this._sourceFrameForScriptOrResource(resource);
}
if (breakpoint.sourceID && !sourceFrame) {
@@ -453,7 +445,7 @@ WebInspector.ScriptsPanel.prototype = {
this._currentBackForwardIndex = -1;
this._updateBackAndForwardButtons();
- this._scriptsForURLsInFilesSelect = {};
+ this._resourceForURLInFilesSelect = {};
this.filesSelectElement.removeChildren();
this.functionsSelectElement.removeChildren();
this.viewsContainerElement.removeChildren();
@@ -497,36 +489,41 @@ WebInspector.ScriptsPanel.prototype = {
this._visibleView = newView;
},
- canShowSourceLineForURL: function(url)
+ canShowSourceLine: function(url, line)
{
- return InspectorBackend.debuggerEnabled() &&
- !!(WebInspector.resourceForURL(url) || this.scriptForURL(url));
+ if (!InspectorBackend.debuggerEnabled())
+ return false;
+ return !!this._scriptOrResourceForURLAndLine(url, line);
},
- showSourceLineForURL: function(url, line)
+ showSourceLine: function(url, line)
{
- var resource = WebInspector.resourceForURL(url);
- if (resource)
- this.showResource(resource, line);
- else
- this.showScript(this.scriptForURL(url), line);
+ var scriptOrResource = this._scriptOrResourceForURLAndLine(url, line);
+ this._showScriptOrResource(scriptOrResource, {line: line, shouldHighlightLine: true});
},
- showScript: function(script, line)
+ _scriptOrResourceForURLAndLine: function(url, line)
{
- this._showScriptOrResource(script, {line: line, shouldHighlightLine: true});
- },
-
- showResource: function(resource, line)
- {
- this._showScriptOrResource(resource, {line: line, shouldHighlightLine: true});
+ for (var sourceID in this._sourceIDMap) {
+ var scriptOrResource = this._sourceIDMap[sourceID];
+ if (scriptOrResource instanceof WebInspector.Script) {
+ var script = scriptOrResource;
+ if (script.startingLine <= line && script.startingLine + script.linesCount > line)
+ return script;
+ } else {
+ var resource = scriptOrResource;
+ if (resource.url === url)
+ return resource;
+ }
+ }
+ return null;
},
showView: function(view)
{
if (!view)
return;
- this._showScriptOrResource((view.resource || view.script));
+ this._showScriptOrResource(view.resource || view.script);
},
handleShortcut: function(event)
@@ -576,11 +573,8 @@ WebInspector.ScriptsPanel.prototype = {
_sourceFrameForScriptOrResource: function(scriptOrResource)
{
- if (scriptOrResource instanceof WebInspector.Resource) {
- if (!WebInspector.panels.resources)
- return null;
+ if (scriptOrResource instanceof WebInspector.Resource)
return WebInspector.panels.resources.sourceFrameForResource(scriptOrResource);
- }
if (scriptOrResource instanceof WebInspector.Script)
return this.sourceFrameForScript(scriptOrResource);
},
@@ -653,55 +647,50 @@ WebInspector.ScriptsPanel.prototype = {
// hasn't been added yet - happens for stepping in evals,
// so use the force option to force the script into the menu.
if (!option) {
- this._addScriptToFilesMenu(scriptOrResource, {force: true});
+ this._addScriptToFilesMenu(scriptOrResource, true);
option = scriptOrResource.filesSelectOption;
}
console.assert(option);
- } else {
- var script = this.scriptForURL(url);
- if (script)
- option = script.filesSelectOption;
- }
+ } else
+ option = scriptOrResource.filesSelectOption;
if (option)
this.filesSelectElement.selectedIndex = option.index;
},
- _addScriptToFilesMenu: function(script, options)
+ _addScriptToFilesMenu: function(script, force)
{
- var force = options && options.force;
-
if (!script.sourceURL && !force)
return;
- if (script.resource && this._scriptsForURLsInFilesSelect[script.sourceURL])
- return;
-
- this._scriptsForURLsInFilesSelect[script.sourceURL] = script;
+ if (script.resource) {
+ if (this._resourceForURLInFilesSelect[script.resource.url])
+ return;
+ this._resourceForURLInFilesSelect[script.resource.url] = script.resource;
+ }
+
+ var displayName = script.sourceURL ? WebInspector.displayNameForURL(script.sourceURL) : WebInspector.UIString("(program)");
var select = this.filesSelectElement;
-
var option = document.createElement("option");
- option.representedObject = (script.resource || script);
- option.text = (script.sourceURL ? WebInspector.displayNameForURL(script.sourceURL) : WebInspector.UIString("(program)"));
+ option.representedObject = script.resource || script;
+ option.url = displayName;
+ option.startingLine = script.startingLine;
+ option.text = script.resource ? displayName : String.sprintf("%s (%d - %d)", displayName, script.startingLine, script.startingLine + script.linesCount);
function optionCompare(a, b)
{
- var aTitle = a.text.toLowerCase();
- var bTitle = b.text.toLowerCase();
- if (aTitle < bTitle)
+ if (a.url < b.url)
return -1;
- else if (aTitle > bTitle)
+ else if (a.url > b.url)
return 1;
- var aSourceID = a.representedObject.sourceID;
- var bSourceID = b.representedObject.sourceID;
- if (aSourceID < bSourceID)
+ if (typeof a.startingLine !== "number")
return -1;
- else if (aSourceID > bSourceID)
- return 1;
- return 0;
+ if (typeof b.startingLine !== "number")
+ return -1;
+ return a.startingLine - b.startingLine;
}
var insertionIndex = insertionIndexForObjectInListSortedByFunction(option, select.childNodes, optionCompare);
@@ -710,7 +699,10 @@ WebInspector.ScriptsPanel.prototype = {
else
select.insertBefore(option, select.childNodes.item(insertionIndex));
- script.filesSelectOption = option;
+ if (script.resource)
+ script.resource.filesSelectOption = option;
+ else
+ script.filesSelectOption = option;
// Call _showScriptOrResource if the option we just appended ended up being selected.
// This will happen for the first item added to the menu.
diff --git a/WebCore/inspector/front-end/SourceView.js b/WebCore/inspector/front-end/SourceView.js
index b401c12..382d840 100644
--- a/WebCore/inspector/front-end/SourceView.js
+++ b/WebCore/inspector/front-end/SourceView.js
@@ -92,13 +92,12 @@ WebInspector.SourceView.prototype = {
_addBreakpoint: function(line)
{
var sourceID = null;
- var closestStartingLine = 0;
var scripts = this.resource.scripts;
for (var i = 0; i < scripts.length; ++i) {
var script = scripts[i];
- if (script.startingLine <= line && script.startingLine >= closestStartingLine) {
- closestStartingLine = script.startingLine;
+ if (script.startingLine <= line && script.startingLine + script.linesCount > line) {
sourceID = script.sourceID;
+ break;
}
}
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index 8a036da..9b36cd3 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -622,17 +622,17 @@ WebInspector.documentClick = function(event)
function followLink()
{
// FIXME: support webkit-html-external-link links here.
- if (WebInspector.canShowSourceLineForURL(anchor.href, anchor.preferredPanel)) {
+ if (WebInspector.canShowSourceLine(anchor.href, anchor.lineNumber, anchor.preferredPanel)) {
if (anchor.hasStyleClass("webkit-html-external-link")) {
anchor.removeStyleClass("webkit-html-external-link");
anchor.addStyleClass("webkit-html-resource-link");
}
- WebInspector.showSourceLineForURL(anchor.href, anchor.lineNumber, anchor.preferredPanel);
+ WebInspector.showSourceLine(anchor.href, anchor.lineNumber, anchor.preferredPanel);
} else {
var profileString = WebInspector.ProfileType.URLRegExp.exec(anchor.href);
if (profileString)
- WebInspector.showProfileForURL(anchor.href);
+ WebInspector.showProfile(anchor.href, anchor.lineNumber);
}
}
@@ -1465,27 +1465,27 @@ WebInspector.resourceForURL = function(url)
return null;
}
-WebInspector._choosePanelToShowSourceLineForURL = function(url, preferredPanel)
+WebInspector._choosePanelToShowSourceLine = function(url, line, preferredPanel)
{
preferredPanel = preferredPanel || "resources";
var panel = this.panels[preferredPanel];
- if (panel && panel.canShowSourceLineForURL(url))
+ if (panel && panel.canShowSourceLine(url, line))
return panel;
panel = this.panels.resources;
- return panel.canShowSourceLineForURL(url) ? panel : null;
+ return panel.canShowSourceLine(url, line) ? panel : null;
}
-WebInspector.canShowSourceLineForURL = function(url, preferredPanel)
+WebInspector.canShowSourceLine = function(url, line, preferredPanel)
{
- return !!this._choosePanelToShowSourceLineForURL(url, preferredPanel);
+ return !!this._choosePanelToShowSourceLine(url, line, preferredPanel);
}
-WebInspector.showSourceLineForURL = function(url, line, preferredPanel)
+WebInspector.showSourceLine = function(url, line, preferredPanel)
{
- this.currentPanel = this._choosePanelToShowSourceLineForURL(url, preferredPanel);
+ this.currentPanel = this._choosePanelToShowSourceLine(url, line, preferredPanel);
if (!this.currentPanel)
return false;
- this.currentPanel.showSourceLineForURL(url, line);
+ this.currentPanel.showSourceLine(url, line);
return true;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list