зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset c816bcb8572d (bug 1320110) for mass devtools failures. r=backout on a CLOSED TREE
This commit is contained in:
Родитель
9b3aa7d34a
Коммит
2d9a55fea4
|
@ -23,8 +23,9 @@ add_task(function* () {
|
|||
ok(request, "Page load was logged");
|
||||
|
||||
let client = hud.ui.webConsoleClient;
|
||||
const postData = yield client.getRequestPostData(request.actor);
|
||||
const responseContent = yield client.getResponseContent(request.actor);
|
||||
let args = [request.actor];
|
||||
const postData = yield getPacket(client, "getRequestPostData", args);
|
||||
const responseContent = yield getPacket(client, "getResponseContent", args);
|
||||
|
||||
is(request.request.url, TEST_NETWORK_REQUEST_URI,
|
||||
"Logged network entry is page load");
|
||||
|
|
|
@ -39,8 +39,9 @@ add_task(function* testPageLoad() {
|
|||
ok(request, "Page load was logged");
|
||||
|
||||
let client = hud.ui.webConsoleClient;
|
||||
const postData = yield client.getRequestPostData(request.actor);
|
||||
const responseContent = yield client.getResponseContent(request.actor);
|
||||
let args = [request.actor];
|
||||
const postData = yield getPacket(client, "getRequestPostData", args);
|
||||
const responseContent = yield getPacket(client, "getResponseContent", args);
|
||||
|
||||
is(request.request.url, TEST_NETWORK_REQUEST_URI,
|
||||
"Logged network entry is page load");
|
||||
|
@ -64,8 +65,9 @@ add_task(function* testXhrGet() {
|
|||
ok(request, "testXhrGet() was logged");
|
||||
|
||||
let client = hud.ui.webConsoleClient;
|
||||
const postData = yield client.getRequestPostData(request.actor);
|
||||
const responseContent = yield client.getResponseContent(request.actor);
|
||||
let args = [request.actor];
|
||||
const postData = yield getPacket(client, "getRequestPostData", args);
|
||||
const responseContent = yield getPacket(client, "getResponseContent", args);
|
||||
|
||||
is(request.request.method, "GET", "Method is correct");
|
||||
ok(!postData.postData.text, "No request body was sent");
|
||||
|
@ -87,8 +89,9 @@ add_task(function* testXhrPost() {
|
|||
ok(request, "testXhrPost() was logged");
|
||||
|
||||
let client = hud.ui.webConsoleClient;
|
||||
const postData = yield client.getRequestPostData(request.actor);
|
||||
const responseContent = yield client.getResponseContent(request.actor);
|
||||
let args = [request.actor];
|
||||
const postData = yield getPacket(client, "getRequestPostData", args);
|
||||
const responseContent = yield getPacket(client, "getResponseContent", args);
|
||||
|
||||
is(request.request.method, "POST", "Method is correct");
|
||||
is(postData.postData.text, "Hello world!", "Request body was logged");
|
||||
|
@ -117,8 +120,9 @@ add_task(function* testFormSubmission() {
|
|||
ok(request, "testFormSubmission() was logged");
|
||||
|
||||
let client = hud.ui.webConsoleClient;
|
||||
const postData = yield client.getRequestPostData(request.actor);
|
||||
const responseContent = yield client.getResponseContent(request.actor);
|
||||
let args = [request.actor];
|
||||
const postData = yield getPacket(client, "getRequestPostData", args);
|
||||
const responseContent = yield getPacket(client, "getResponseContent", args);
|
||||
|
||||
is(request.request.method, "POST", "Method is correct");
|
||||
isnot(postData.postData.text
|
||||
|
|
|
@ -1790,6 +1790,21 @@ function getSourceActor(sources, URL) {
|
|||
return item && item.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a request against an actor and resolve with the packet.
|
||||
* @param object client
|
||||
* The client to use when making the request.
|
||||
* @param function requestType
|
||||
* The client request function to run.
|
||||
* @param array args
|
||||
* The arguments to pass into the function.
|
||||
*/
|
||||
function getPacket(client, requestType, args) {
|
||||
return new Promise(resolve => {
|
||||
client[requestType](...args, packet => resolve(packet));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that clicking on a link from a popup notification message tries to
|
||||
* open the expected URL.
|
||||
|
|
|
@ -736,7 +736,6 @@ DebuggerClient.prototype = {
|
|||
request.on("json-reply", listenerJson);
|
||||
request.on("bulk-reply", listenerBulk);
|
||||
request.then = deferred.promise.then.bind(deferred.promise);
|
||||
request.catch = deferred.promise.catch.bind(deferred.promise);
|
||||
|
||||
return request;
|
||||
},
|
||||
|
|
|
@ -182,8 +182,6 @@ WebConsoleClient.prototype = {
|
|||
* this.CACHED_MESSAGES for known types.
|
||||
* @param function onResponse
|
||||
* The function invoked when the response is received.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
getCachedMessages: function (types, onResponse) {
|
||||
let packet = {
|
||||
|
@ -191,7 +189,7 @@ WebConsoleClient.prototype = {
|
|||
type: "getCachedMessages",
|
||||
messageTypes: types,
|
||||
};
|
||||
return this._client.request(packet, onResponse);
|
||||
this._client.request(packet, onResponse);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -201,15 +199,13 @@ WebConsoleClient.prototype = {
|
|||
* The WebConsoleObjectActor ID to send the request to.
|
||||
* @param function onResponse
|
||||
* The function invoked when the response is received.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
inspectObjectProperties: function (actor, onResponse) {
|
||||
let packet = {
|
||||
to: actor,
|
||||
type: "inspectProperties",
|
||||
};
|
||||
return this._client.request(packet, onResponse);
|
||||
this._client.request(packet, onResponse);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -248,8 +244,6 @@ WebConsoleClient.prototype = {
|
|||
* exists. This is used by helper functions that can
|
||||
* reference the currently selected node in the Inspector,
|
||||
* like $0.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
evaluateJS: function (string, onResponse, options = {}) {
|
||||
let packet = {
|
||||
|
@ -262,7 +256,7 @@ WebConsoleClient.prototype = {
|
|||
selectedNodeActor: options.selectedNodeActor,
|
||||
selectedObjectActor: options.selectedObjectActor,
|
||||
};
|
||||
return this._client.request(packet, onResponse);
|
||||
this._client.request(packet, onResponse);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -272,7 +266,8 @@ WebConsoleClient.prototype = {
|
|||
evaluateJSAsync: function (string, onResponse, options = {}) {
|
||||
// Pre-37 servers don't support async evaluation.
|
||||
if (!this.traits.evaluateJSAsync) {
|
||||
return this.evaluateJS(string, onResponse, options);
|
||||
this.evaluateJS(string, onResponse, options);
|
||||
return;
|
||||
}
|
||||
|
||||
let packet = {
|
||||
|
@ -286,23 +281,12 @@ WebConsoleClient.prototype = {
|
|||
selectedObjectActor: options.selectedObjectActor,
|
||||
};
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
this._client.request(packet, response => {
|
||||
// Null check this in case the client has been detached while waiting
|
||||
// for a response.
|
||||
if (this.pendingEvaluationResults) {
|
||||
this.pendingEvaluationResults.set(response.resultID, resp => {
|
||||
if (onResponse) {
|
||||
onResponse(resp);
|
||||
}
|
||||
if (resp.error) {
|
||||
reject(resp);
|
||||
} else {
|
||||
resolve(resp);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
this._client.request(packet, response => {
|
||||
// Null check this in case the client has been detached while waiting
|
||||
// for a response.
|
||||
if (this.pendingEvaluationResults) {
|
||||
this.pendingEvaluationResults.set(response.resultID, onResponse);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -342,8 +326,6 @@ WebConsoleClient.prototype = {
|
|||
* The function invoked when the response is received.
|
||||
* @param string frameActor
|
||||
* The id of the frame actor that made the call.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
autocomplete: function (string, cursor, onResponse, frameActor) {
|
||||
let packet = {
|
||||
|
@ -353,21 +335,18 @@ WebConsoleClient.prototype = {
|
|||
cursor: cursor,
|
||||
frameActor: frameActor,
|
||||
};
|
||||
return this._client.request(packet, onResponse);
|
||||
this._client.request(packet, onResponse);
|
||||
},
|
||||
|
||||
/**
|
||||
* Clear the cache of messages (page errors and console API calls).
|
||||
*
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
clearMessagesCache: function () {
|
||||
let packet = {
|
||||
to: this._actor,
|
||||
type: "clearMessagesCache",
|
||||
};
|
||||
return this._client.request(packet);
|
||||
this._client.request(packet);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -377,8 +356,6 @@ WebConsoleClient.prototype = {
|
|||
* An array with the preferences you want to retrieve.
|
||||
* @param function [onResponse]
|
||||
* Optional function to invoke when the response is received.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
getPreferences: function (preferences, onResponse) {
|
||||
let packet = {
|
||||
|
@ -386,7 +363,7 @@ WebConsoleClient.prototype = {
|
|||
type: "getPreferences",
|
||||
preferences: preferences,
|
||||
};
|
||||
return this._client.request(packet, onResponse);
|
||||
this._client.request(packet, onResponse);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -396,8 +373,6 @@ WebConsoleClient.prototype = {
|
|||
* An object with the preferences you want to change.
|
||||
* @param function [onResponse]
|
||||
* Optional function to invoke when the response is received.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
setPreferences: function (preferences, onResponse) {
|
||||
let packet = {
|
||||
|
@ -405,7 +380,7 @@ WebConsoleClient.prototype = {
|
|||
type: "setPreferences",
|
||||
preferences: preferences,
|
||||
};
|
||||
return this._client.request(packet, onResponse);
|
||||
this._client.request(packet, onResponse);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -415,15 +390,13 @@ WebConsoleClient.prototype = {
|
|||
* The NetworkEventActor ID.
|
||||
* @param function onResponse
|
||||
* The function invoked when the response is received.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
getRequestHeaders: function (actor, onResponse) {
|
||||
let packet = {
|
||||
to: actor,
|
||||
type: "getRequestHeaders",
|
||||
};
|
||||
return this._client.request(packet, onResponse);
|
||||
this._client.request(packet, onResponse);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -433,15 +406,13 @@ WebConsoleClient.prototype = {
|
|||
* The NetworkEventActor ID.
|
||||
* @param function onResponse
|
||||
* The function invoked when the response is received.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
getRequestCookies: function (actor, onResponse) {
|
||||
let packet = {
|
||||
to: actor,
|
||||
type: "getRequestCookies",
|
||||
};
|
||||
return this._client.request(packet, onResponse);
|
||||
this._client.request(packet, onResponse);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -451,15 +422,13 @@ WebConsoleClient.prototype = {
|
|||
* The NetworkEventActor ID.
|
||||
* @param function onResponse
|
||||
* The function invoked when the response is received.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
getRequestPostData: function (actor, onResponse) {
|
||||
let packet = {
|
||||
to: actor,
|
||||
type: "getRequestPostData",
|
||||
};
|
||||
return this._client.request(packet, onResponse);
|
||||
this._client.request(packet, onResponse);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -469,15 +438,13 @@ WebConsoleClient.prototype = {
|
|||
* The NetworkEventActor ID.
|
||||
* @param function onResponse
|
||||
* The function invoked when the response is received.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
getResponseHeaders: function (actor, onResponse) {
|
||||
let packet = {
|
||||
to: actor,
|
||||
type: "getResponseHeaders",
|
||||
};
|
||||
return this._client.request(packet, onResponse);
|
||||
this._client.request(packet, onResponse);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -487,15 +454,13 @@ WebConsoleClient.prototype = {
|
|||
* The NetworkEventActor ID.
|
||||
* @param function onResponse
|
||||
* The function invoked when the response is received.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
getResponseCookies: function (actor, onResponse) {
|
||||
let packet = {
|
||||
to: actor,
|
||||
type: "getResponseCookies",
|
||||
};
|
||||
return this._client.request(packet, onResponse);
|
||||
this._client.request(packet, onResponse);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -505,15 +470,13 @@ WebConsoleClient.prototype = {
|
|||
* The NetworkEventActor ID.
|
||||
* @param function onResponse
|
||||
* The function invoked when the response is received.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
getResponseContent: function (actor, onResponse) {
|
||||
let packet = {
|
||||
to: actor,
|
||||
type: "getResponseContent",
|
||||
};
|
||||
return this._client.request(packet, onResponse);
|
||||
this._client.request(packet, onResponse);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -523,15 +486,13 @@ WebConsoleClient.prototype = {
|
|||
* The NetworkEventActor ID.
|
||||
* @param function onResponse
|
||||
* The function invoked when the response is received.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
getEventTimings: function (actor, onResponse) {
|
||||
let packet = {
|
||||
to: actor,
|
||||
type: "getEventTimings",
|
||||
};
|
||||
return this._client.request(packet, onResponse);
|
||||
this._client.request(packet, onResponse);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -541,15 +502,13 @@ WebConsoleClient.prototype = {
|
|||
* The NetworkEventActor ID.
|
||||
* @param function onResponse
|
||||
* The function invoked when the response is received.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
getSecurityInfo: function (actor, onResponse) {
|
||||
let packet = {
|
||||
to: actor,
|
||||
type: "getSecurityInfo",
|
||||
};
|
||||
return this._client.request(packet, onResponse);
|
||||
this._client.request(packet, onResponse);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -559,8 +518,6 @@ WebConsoleClient.prototype = {
|
|||
* The details of the HTTP request.
|
||||
* @param function onResponse
|
||||
* The function invoked when the response is received.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
sendHTTPRequest: function (data, onResponse) {
|
||||
let packet = {
|
||||
|
@ -568,7 +525,7 @@ WebConsoleClient.prototype = {
|
|||
type: "sendHTTPRequest",
|
||||
request: data
|
||||
};
|
||||
return this._client.request(packet, onResponse);
|
||||
this._client.request(packet, onResponse);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -580,8 +537,6 @@ WebConsoleClient.prototype = {
|
|||
* known listeners.
|
||||
* @param function onResponse
|
||||
* Function to invoke when the server response is received.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
startListeners: function (listeners, onResponse) {
|
||||
let packet = {
|
||||
|
@ -589,7 +544,7 @@ WebConsoleClient.prototype = {
|
|||
type: "startListeners",
|
||||
listeners: listeners,
|
||||
};
|
||||
return this._client.request(packet, onResponse);
|
||||
this._client.request(packet, onResponse);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -601,8 +556,6 @@ WebConsoleClient.prototype = {
|
|||
* known listeners.
|
||||
* @param function onResponse
|
||||
* Function to invoke when the server response is received.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
stopListeners: function (listeners, onResponse) {
|
||||
let packet = {
|
||||
|
@ -610,7 +563,7 @@ WebConsoleClient.prototype = {
|
|||
type: "stopListeners",
|
||||
listeners: listeners,
|
||||
};
|
||||
return this._client.request(packet, onResponse);
|
||||
this._client.request(packet, onResponse);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,11 +24,13 @@ let {MAX_AUTOCOMPLETE_ATTEMPTS,MAX_AUTOCOMPLETIONS} = require("devtools/shared/w
|
|||
// evaluateJS and once with evaluateJSAsync.
|
||||
let evaluatingSync = true;
|
||||
function evaluateJS(input, options = {}) {
|
||||
if (evaluatingSync) {
|
||||
return gState.client.evaluateJS(input, null, options);
|
||||
} else {
|
||||
return gState.client.evaluateJSAsync(input, null, options);
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
if (evaluatingSync) {
|
||||
gState.client.evaluateJS(input, resolve, options);
|
||||
} else {
|
||||
gState.client.evaluateJSAsync(input, resolve, options);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function startTest()
|
||||
|
|
Загрузка…
Ссылка в новой задаче