- Revision
- 116217
- Author
- [email protected]
- Date
- 2012-05-05 03:07:39 -0700 (Sat, 05 May 2012)
Log Message
Web Inspector: allow overriding the script mapping on the UI level
https://bugs.webkit.org/show_bug.cgi?id=85702
Reviewed by Yury Semikhatsky.
Source/WebCore:
This allows formatting update live locations all over the place automatically.
* inspector/front-end/Script.js:
(WebInspector.Script.prototype.rawLocationToUILocation):
(WebInspector.Script.Location):
(WebInspector.Script.Location.prototype.update):
(WebInspector.Script.Location.prototype.dispose):
* inspector/front-end/UISourceCode.js:
(WebInspector.UISourceCode):
(WebInspector.UISourceCode.prototype.addLiveLocation):
(WebInspector.UISourceCode.prototype.removeLiveLocation):
(WebInspector.UISourceCode.prototype.updateLiveLocations):
(WebInspector.UISourceCode.prototype.overrideLocation):
LayoutTests:
* inspector/debugger/breakpoint-manager.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (116216 => 116217)
--- trunk/LayoutTests/ChangeLog 2012-05-05 09:46:20 UTC (rev 116216)
+++ trunk/LayoutTests/ChangeLog 2012-05-05 10:07:39 UTC (rev 116217)
@@ -1,3 +1,12 @@
+2012-05-05 Pavel Feldman <[email protected]>
+
+ Web Inspector: allow overriding the script mapping on the UI level
+ https://bugs.webkit.org/show_bug.cgi?id=85702
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/debugger/breakpoint-manager.html:
+
2012-05-05 Zan Dobersek <[email protected]>
Unreviewed Gtk gardening, mark fullscreen/non-ancestor-iframe.html as
Modified: trunk/LayoutTests/inspector/debugger/breakpoint-manager.html (116216 => 116217)
--- trunk/LayoutTests/inspector/debugger/breakpoint-manager.html 2012-05-05 09:46:20 UTC (rev 116216)
+++ trunk/LayoutTests/inspector/debugger/breakpoint-manager.html 2012-05-05 10:07:39 UTC (rev 116217)
@@ -9,8 +9,7 @@
var defaultMapping = {
rawLocationToUILocation: function(rawLocation)
{
- var uiSourceCode = {};
- uiSourceCode.id = rawLocation.scriptId;
+ var uiSourceCode = new WebInspector.UISourceCode(rawLocation.scriptId, rawLocation.scriptId, null);
return new WebInspector.UILocation(uiSourceCode, rawLocation.lineNumber, 0);
},
@@ -23,8 +22,7 @@
var shiftingMapping = {
rawLocationToUILocation: function(rawLocation)
{
- var uiSourceCode = {};
- uiSourceCode.id = rawLocation.scriptId;
+ var uiSourceCode = new WebInspector.UISourceCode(rawLocation.scriptId, rawLocation.scriptId, null);
return new WebInspector.UILocation(uiSourceCode, rawLocation.lineNumber + 10, 0);
},
Modified: trunk/Source/WebCore/ChangeLog (116216 => 116217)
--- trunk/Source/WebCore/ChangeLog 2012-05-05 09:46:20 UTC (rev 116216)
+++ trunk/Source/WebCore/ChangeLog 2012-05-05 10:07:39 UTC (rev 116217)
@@ -1,5 +1,26 @@
2012-05-05 Pavel Feldman <[email protected]>
+ Web Inspector: allow overriding the script mapping on the UI level
+ https://bugs.webkit.org/show_bug.cgi?id=85702
+
+ Reviewed by Yury Semikhatsky.
+
+ This allows formatting update live locations all over the place automatically.
+
+ * inspector/front-end/Script.js:
+ (WebInspector.Script.prototype.rawLocationToUILocation):
+ (WebInspector.Script.Location):
+ (WebInspector.Script.Location.prototype.update):
+ (WebInspector.Script.Location.prototype.dispose):
+ * inspector/front-end/UISourceCode.js:
+ (WebInspector.UISourceCode):
+ (WebInspector.UISourceCode.prototype.addLiveLocation):
+ (WebInspector.UISourceCode.prototype.removeLiveLocation):
+ (WebInspector.UISourceCode.prototype.updateLiveLocations):
+ (WebInspector.UISourceCode.prototype.overrideLocation):
+
+2012-05-05 Pavel Feldman <[email protected]>
+
Web Inspector: simplify the _javascript_Outline dialog interaction.
https://bugs.webkit.org/show_bug.cgi?id=85701
Modified: trunk/Source/WebCore/inspector/front-end/Script.js (116216 => 116217)
--- trunk/Source/WebCore/inspector/front-end/Script.js 2012-05-05 09:46:20 UTC (rev 116216)
+++ trunk/Source/WebCore/inspector/front-end/Script.js 2012-05-05 10:07:39 UTC (rev 116217)
@@ -156,7 +156,9 @@
rawLocationToUILocation: function(rawLocation)
{
console.assert(rawLocation.scriptId === this.scriptId);
- return this._sourceMapping.rawLocationToUILocation(rawLocation);
+ var uiLocation = this._sourceMapping.rawLocationToUILocation(rawLocation);
+ // FIXME: uiLocation will never be null after the next refactoring step.
+ return uiLocation ? uiLocation.uiSourceCode.overrideLocation(uiLocation) : null;
},
/**
@@ -196,23 +198,30 @@
this._script = script;
this._rawLocation = rawLocation;
this._updateDelegate = updateDelegate;
+ this._uiSourceCodes = [];
}
WebInspector.Script.Location.prototype = {
- dispose: function()
- {
- this._script._locations.remove(this);
- },
-
update: function()
{
- if (!this._script._sourceMapping)
- return;
- var uiLocation = this._script._sourceMapping.rawLocationToUILocation(this._rawLocation);
+ var uiLocation = this._script.rawLocationToUILocation(this._rawLocation);
if (uiLocation) {
+ var uiSourceCode = uiLocation.uiSourceCode;
+ if (this._uiSourceCodes.indexOf(uiSourceCode) === -1) {
+ uiSourceCode.addLiveLocation(this);
+ this._uiSourceCodes.push(uiSourceCode);
+ }
var _oneTime_ = this._updateDelegate(uiLocation);
if (oneTime)
this.dispose();
}
+ },
+
+ dispose: function()
+ {
+ for (var i = 0; i < this._uiSourceCodes.length; ++i)
+ this._uiSourceCodes[i].removeLiveLocation(this);
+ this._uiSourceCodes = [];
+ this._script._locations.remove(this);
}
}
Modified: trunk/Source/WebCore/inspector/front-end/UISourceCode.js (116216 => 116217)
--- trunk/Source/WebCore/inspector/front-end/UISourceCode.js 2012-05-05 09:46:20 UTC (rev 116216)
+++ trunk/Source/WebCore/inspector/front-end/UISourceCode.js 2012-05-05 10:07:39 UTC (rev 116217)
@@ -48,6 +48,7 @@
* @type Array.<function(?string,boolean,string)>
*/
this._requestContentCallbacks = [];
+ this._liveLocations = [];
}
WebInspector.UISourceCode.Events = {
@@ -135,6 +136,38 @@
},
/**
+ * @param {WebInspector.LiveLocation} liveLocation
+ */
+ addLiveLocation: function(liveLocation)
+ {
+ this._liveLocations.push(liveLocation);
+ },
+
+ /**
+ * @param {WebInspector.LiveLocation} liveLocation
+ */
+ removeLiveLocation: function(liveLocation)
+ {
+ this._liveLocations.remove(liveLocation);
+ },
+
+ updateLiveLocations: function()
+ {
+ var locationsCopy = this._liveLocations.slice();
+ for (var i = 0; i < locationsCopy.length; ++i)
+ locationsCopy[i].update();
+ },
+
+ /**
+ * @param {WebInspector.UILocation} uiLocation
+ * @return {WebInspector.UILocation}
+ */
+ overrideLocation: function(uiLocation)
+ {
+ return uiLocation;
+ },
+
+ /**
* @return {Array.<WebInspector.PresentationConsoleMessage>}
*/
consoleMessages: function() {}