Bug 895616 - get{Original/Generated}Location should take object/keyword arguments instead of positional arguments; r=fitzgen

This commit is contained in:
Gabriel Luong 2013-08-23 22:41:28 -07:00
parent 9e89664f18
commit 1750b21f8a

View File

@ -692,8 +692,7 @@ ThreadActor.prototype = {
}
packet.why = aReason;
let { url, line, column } = packet.frame.where;
this.sources.getOriginalLocation(url, line, column).then(aOrigPosition => {
this.sources.getOriginalLocation(packet.frame.where).then(aOrigPosition => {
packet.frame.where = aOrigPosition;
resolve(onPacket(packet))
.then(null, error => {
@ -772,10 +771,11 @@ ThreadActor.prototype = {
// Define the JS hook functions for stepping.
let onEnterFrame = aFrame => {
let { url } = this.synchronize(this.sources.getOriginalLocation(
aFrame.script.url,
aFrame.script.getOffsetLine(aFrame.offset),
getOffsetColumn(aFrame.offset, aFrame.script)));
let { url } = this.synchronize(this.sources.getOriginalLocation({
url: aFrame.script.url,
line: aFrame.script.getOffsetLine(aFrame.offset),
column: getOffsetColumn(aFrame.offset, aFrame.script)
}));
return this.sources.isBlackBoxed(url)
? undefined
@ -787,10 +787,11 @@ ThreadActor.prototype = {
let onPop = function TA_onPop(aCompletion) {
// onPop is called with 'this' set to the current frame.
let { url } = thread.synchronize(thread.sources.getOriginalLocation(
this.script.url,
this.script.getOffsetLine(this.offset),
getOffsetColumn(this.offset, this.script)));
let { url } = thread.synchronize(thread.sources.getOriginalLocation({
url: this.script.url,
line: this.script.getOffsetLine(this.offset),
column: getOffsetColumn(this.offset, this.script)
}));
if (thread.sources.isBlackBoxed(url)) {
return undefined;
@ -818,10 +819,11 @@ ThreadActor.prototype = {
let onStep = function TA_onStep() {
// onStep is called with 'this' set to the current frame.
let { url } = thread.synchronize(thread.sources.getOriginalLocation(
this.script.url,
this.script.getOffsetLine(this.offset),
getOffsetColumn(this.offset, this.script)));
let { url } = thread.synchronize(thread.sources.getOriginalLocation({
url: this.script.url,
line: this.script.getOffsetLine(this.offset),
column: getOffsetColumn(this.offset, this.script)
}));
if (thread.sources.isBlackBoxed(url)) {
return undefined;
@ -1091,8 +1093,7 @@ ThreadActor.prototype = {
form.depth = i;
frames.push(form);
let { url, line, column } = form.where;
let promise = this.sources.getOriginalLocation(url, line, column)
let promise = this.sources.getOriginalLocation(form.where)
.then((aOrigLocation) => {
form.where = aOrigLocation;
let source = this.sources.source(form.where.url);
@ -1142,9 +1143,7 @@ ThreadActor.prototype = {
line: originalLine,
column: originalColumn } = aRequest.location;
let locationPromise = this.sources.getGeneratedLocation(originalSource,
originalLine,
originalColumn);
let locationPromise = this.sources.getGeneratedLocation(aRequest.location);
return locationPromise.then(({url, line, column}) => {
if (line == null ||
line < 0 ||
@ -1160,16 +1159,17 @@ ThreadActor.prototype = {
// If the original location of our generated location is different from
// the original location we attempted to set the breakpoint on, we will
// need to know so that we can set actualLocation on the response.
let originalLocation = this.sources.getOriginalLocation(url, line, column);
let originalLocation = this.sources.getOriginalLocation({
url: url,
line: line,
column: column
});
return all([response, originalLocation])
.then(([aResponse, {url, line}]) => {
if (aResponse.actualLocation) {
let actualOrigLocation = this.sources.getOriginalLocation(
aResponse.actualLocation.url,
aResponse.actualLocation.line,
aResponse.actualLocation.column);
return actualOrigLocation.then(function ({ url, line, column }) {
let actualOrigLocation = this.sources.getOriginalLocation(aResponse.actualLocation);
return actualOrigLocation.then(({ url, line, column }) => {
if (url !== originalSource
|| line !== originalLine
|| column !== originalColumn) {
@ -1940,10 +1940,11 @@ ThreadActor.prototype = {
onDebuggerStatement: function TA_onDebuggerStatement(aFrame) {
// Don't pause if we are currently stepping (in or over) or the frame is
// black-boxed.
let { url } = this.synchronize(this.sources.getOriginalLocation(
aFrame.script.url,
aFrame.script.getOffsetLine(aFrame.offset),
getOffsetColumn(aFrame.offset, aFrame.script)));
let { url } = this.synchronize(this.sources.getOriginalLocation({
url: aFrame.script.url,
line: aFrame.script.getOffsetLine(aFrame.offset),
column: getOffsetColumn(aFrame.offset, aFrame.script)
}));
return this.sources.isBlackBoxed(url) || aFrame.onStep
? undefined
@ -1960,10 +1961,11 @@ ThreadActor.prototype = {
* The exception that was thrown.
*/
onExceptionUnwind: function TA_onExceptionUnwind(aFrame, aValue) {
let { url } = this.synchronize(this.sources.getOriginalLocation(
aFrame.script.url,
aFrame.script.getOffsetLine(aFrame.offset),
getOffsetColumn(aFrame.offset, aFrame.script)));
let { url } = this.synchronize(this.sources.getOriginalLocation({
url: aFrame.script.url,
line: aFrame.script.getOffsetLine(aFrame.offset),
column: getOffsetColumn(aFrame.offset, aFrame.script)
}));
if (this.sources.isBlackBoxed(url)) {
return undefined;
@ -3010,10 +3012,11 @@ BreakpointActor.prototype = {
// Don't pause if we are currently stepping (in or over) or the frame is
// black-boxed.
let { url } = this.threadActor.synchronize(
this.threadActor.sources.getOriginalLocation(
this.location.url,
this.location.line,
this.location.column));
this.threadActor.sources.getOriginalLocation({
url: this.location.url,
line: this.location.line,
column: this.location.column
}));
if (this.threadActor.sources.isBlackBoxed(url) || aFrame.onStep) {
return undefined;
@ -3515,28 +3518,27 @@ ThreadSources.prototype = {
* Returns a promise of the location in the original source if the source is
* source mapped, otherwise a promise of the same location.
*/
getOriginalLocation:
function TS_getOriginalLocation(aSourceUrl, aLine, aColumn) {
if (aSourceUrl in this._sourceMapsByGeneratedSource) {
return this._sourceMapsByGeneratedSource[aSourceUrl]
.then(function (aSourceMap) {
let { source, line, column } = aSourceMap.originalPositionFor({
line: aLine,
column: aColumn
});
return {
url: source,
getOriginalLocation: function TS_getOriginalLocation({ url, line, column }) {
if (url in this._sourceMapsByGeneratedSource) {
return this._sourceMapsByGeneratedSource[url]
.then((aSourceMap) => {
let { source: aSourceURL, line: aLine, column: aColumn } = aSourceMap.originalPositionFor({
line: line,
column: column
});
return {
url: aSourceURL,
line: aLine,
column: aColumn
};
});
}
// No source map
return resolve({
url: aSourceUrl,
line: aLine,
column: aColumn
url: url,
line: line,
column: column
});
},
@ -3549,29 +3551,28 @@ ThreadSources.prototype = {
* the tables this function uses; thus, it won't know that S's original
* source URLs map to S until P is resolved.
*/
getGeneratedLocation:
function TS_getGeneratedLocation(aSourceUrl, aLine, aColumn) {
if (aSourceUrl in this._sourceMapsByOriginalSource) {
return this._sourceMapsByOriginalSource[aSourceUrl]
getGeneratedLocation: function TS_getGeneratedLocation({ url, line, column }) {
if (url in this._sourceMapsByOriginalSource) {
return this._sourceMapsByOriginalSource[url]
.then((aSourceMap) => {
let { line, column } = aSourceMap.generatedPositionFor({
source: aSourceUrl,
line: aLine,
column: aColumn == null ? Infinity : aColumn
let { line: aLine, column: aColumn } = aSourceMap.generatedPositionFor({
source: url,
line: line,
column: column == null ? Infinity : column
});
return {
url: this._generatedUrlsByOriginalUrl[aSourceUrl],
line: line,
column: column
url: this._generatedUrlsByOriginalUrl[url],
line: aLine,
column: aColumn
};
});
}
// No source map
return resolve({
url: aSourceUrl,
line: aLine,
column: aColumn
url: url,
line: line,
column: column
});
},