Back out 854623def9c6:a976c1645d70 (bug 917583) for Linux/Windows bc bustage

CLOSED TREE
This commit is contained in:
Phil Ringnalda 2013-11-09 23:26:47 -08:00
parent 9d5608b4f8
commit 4cd19104cf
5 changed files with 21 additions and 152 deletions

View File

@ -1398,36 +1398,12 @@ EventListeners.prototype = {
*/
scheduleEventListenersFetch: function() {
let getListeners = aCallback => gThreadClient.eventListeners(aResponse => {
if (aResponse.error) {
let msg = "Error getting event listeners: " + aResponse.message;
DevToolsUtils.reportException("scheduleEventListenersFetch", msg);
return;
}
this._onEventListeners(aResponse);
promise.all(aResponse.listeners.map(listener => {
const deferred = promise.defer();
gThreadClient.pauseGrip(listener.function).getDefinitionSite(aResponse => {
if (aResponse.error) {
const msg = "Error getting function definition site: " + aResponse.message;
DevToolsUtils.reportException("scheduleEventListenersFetch", msg);
deferred.reject(msg);
return;
}
listener.function.url = aResponse.url;
deferred.resolve(listener);
});
return deferred.promise;
})).then(listeners => {
this._onEventListeners(listeners);
// Notify that event listeners were fetched and shown in the view,
// and callback to resume the active thread if necessary.
window.emit(EVENTS.EVENT_LISTENERS_FETCHED);
aCallback && aCallback();
});
// Notify that event listeners were fetched and shown in the view,
// and callback to resume the active thread if necessary.
window.emit(EVENTS.EVENT_LISTENERS_FETCHED);
aCallback && aCallback();
});
// Make sure we're not sending a batch of closely repeated requests.
@ -1442,11 +1418,18 @@ EventListeners.prototype = {
},
/**
* Callback for a debugger's successful active thread eventListeners() call.
* Callback for the debugger's active thread eventListeners() method.
*/
_onEventListeners: function(aListeners) {
_onEventListeners: function(aResponse) {
if (aResponse.error) {
let msg = "Error getting event listeners: " + aResponse.message;
Cu.reportError(msg);
dumpn(msg);
return;
}
// Add all the listeners in the debugger view event linsteners container.
for (let listener of aListeners) {
for (let listener of aResponse.listeners) {
DebuggerView.EventListeners.addListener(listener, { staged: true });
}

View File

@ -1828,17 +1828,6 @@ ObjectClient.prototype = {
get isSealed() this._grip.sealed,
get isExtensible() this._grip.extensible,
getDefinitionSite: DebuggerClient.requester({
type: "definitionSite"
}, {
before: function (aPacket) {
if (this._grip.class != "Function") {
throw new Error("getDefinitionSite is only valid for function grips.");
}
return aPacket;
}
}),
/**
* Request the names of a function's formal parameters.
*

View File

@ -2700,6 +2700,12 @@ ObjectActor.prototype = {
// with "permission denied" errors for some functions.
dumpn(e);
}
// Add source location information.
if (this.obj.script) {
g.url = this.obj.script.url;
g.line = this.obj.script.startLine;
}
}
return g;
@ -2736,47 +2742,6 @@ ObjectActor.prototype = {
this._forcedMagicProps = true;
},
/**
* Handle a protocol request to provide the definition site of this function
* object.
*
* @param aRequest object
* The protocol request object.
*/
onDefinitionSite: function OA_onDefinitionSite(aRequest) {
if (this.obj.class != "Function") {
return {
error: "objectNotFunction",
message: this.actorID + " is not a function."
};
}
if (!this.obj.script) {
return {
from: this.actorID,
error: "noScript",
message: this.actorID + " has no Debugger.Script"
};
}
const generatedLocation = {
url: this.obj.script.url,
line: this.obj.script.startLine,
// TODO bug 901138: use Debugger.Script.prototype.startColumn.
column: 0
};
return this.threadActor.sources.getOriginalLocation(generatedLocation)
.then(({ url, line, column }) => {
return {
from: this.actorID,
url: url,
line: line,
column: column
};
});
},
/**
* Handle a protocol request to provide the names of the properties defined on
* the object and not its prototype.
@ -3109,7 +3074,6 @@ ObjectActor.prototype = {
};
ObjectActor.prototype.requestTypes = {
"definitionSite": ObjectActor.prototype.onDefinitionSite,
"parameterNames": ObjectActor.prototype.onParameterNames,
"prototypeAndProperties": ObjectActor.prototype.onPrototypeAndProperties,
"prototype": ObjectActor.prototype.onPrototype,

View File

@ -1,66 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test that ObjectClient.prototype.getDefinitionSite and the "definitionSite"
// request work properly.
var gDebuggee;
var gClient;
var gThreadClient;
function run_test()
{
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-grips");
gDebuggee.eval(function stopMe() {
debugger;
}.toString());
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient.connect(function() {
attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) {
gThreadClient = aThreadClient;
add_pause_listener();
});
});
do_test_pending();
}
function add_pause_listener()
{
gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) {
const [funcGrip, objGrip] = aPacket.frame.arguments;
const func = gThreadClient.pauseGrip(funcGrip);
const obj = gThreadClient.pauseGrip(objGrip);
test_definition_site(func, obj);
});
eval_code();
}
function eval_code() {
gDebuggee.eval([
"this.line0 = Error().lineNumber;",
"function f() {}",
"stopMe(f, {});"
].join("\n"));
}
function test_definition_site(func, obj) {
func.getDefinitionSite(({ error, url, line, column }) => {
do_check_true(!error);
do_check_eq(url, getFilePath("test_objectgrips-12.js"));
do_check_eq(line, gDebuggee.line0 + 1);
do_check_eq(column, 0);
test_bad_definition_site(obj);
});
}
function test_bad_definition_site(obj) {
try {
obj.getDefinitionSite(() => do_check_true(false));
} catch (e) {
gThreadClient.resume(() => finishClient(gClient));
}
}

View File

@ -147,7 +147,6 @@ reason = bug 820380
[test_objectgrips-09.js]
[test_objectgrips-10.js]
[test_objectgrips-11.js]
[test_objectgrips-12.js]
[test_interrupt.js]
[test_stepping-01.js]
[test_stepping-02.js]