Closed Bug 937197 Opened 11 years ago Closed 10 years ago

add a "requestTypes" RDP request

Categories

(DevTools :: Debugger, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 29

People

(Reporter: fitzgen, Assigned: rpl)

References

Details

(Whiteboard: [good first bug][mentor=nfitzgerald@mozilla.com][lang=js][debugger-docs-needed])

Attachments

(1 file, 1 obsolete file)

Every actor should accept "requestTypes" requests and return a packet of the form

  { from: actorID, requestTypes: [...] }

where requestTypes is an array of string request types.

This will help us with feature detection when dealing with slightly different versions of the protocol, and helps make our protocol a little more self documenting.

We shouldn't need to actually implement onRequestTypes for every actor, though. The server's main onPacket method could handle this for everyone: http://dxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/main.js#969
More info for any one who wants to pick up this bug:

General info on how to hack on our tools: https://wiki.mozilla.org/DevTools/Hacking

The test suite you'll be running: https://wiki.mozilla.org/DevTools/Hacking#xpcshell_Tests

You'll need to add a new xpcshell test:

1. Create a file "test_requestTypes.js" in toolkit/devtools/server/tests/unit/

2. Add it to the xpcshell.ini in the same directory

3. Do an incremental build

4. Run the tests again to see if it passes/fails
Clarification: the request packet form should be:

  { to: actorID, type "requestTypes" }

Also, you should be able to get a list of an actor's request types by doing:

  Object.keys(actor.requestTypes)
OS: Mac OS X → All
Priority: -- → P3
Hardware: x86 → All
Hello Nick, I am willing to try to fix this bug. So I pick it up.
Assignee: nobody → pylaurent1314
Great! If you have any questions, feel free to ask me either on this bug or on irc!

Here is an overview of our remote debugging protocol (RDP): https://wiki.mozilla.org/Remote_Debugging_Protocol
Thank you.
Hi Nick. Should I run the requestTypes for all acotrs? Or I just need to pick on to test?
Oh, sorry. I mean whether I should run the requestTypes test for all actors.
You don't need to test this for every actor, but you should probably test a couple different ones. Maybe the ThreadActor and the ObjectActor.
Testing an actor that uses protocol.js would be good as well. Not sure if we have any that can be tested with xpcshell tests, but chrome mochitests will work.
Hi Peiyong!

Are you still actively working on this? I only ask because there hasn't been much movement here lately and I have another contributor who expressed interest in this particular bug. If you are still working on this, a quick confirmation of that fact would be awesome. If you aren't, then I will re-assign to the other contributor.

Thanks!
Flags: needinfo?(pylaurent1314)
I am sorry. I am not working on this bug.
Assignee: pylaurent1314 → nobody
Flags: needinfo?(pylaurent1314)
(In reply to Peiyong Lin[:lpy](UTC-8) from comment #11)
> I am sorry. I am not working on this bug.

No problem :) Thanks for unassigning yourself.
Assignee: nobody → luca.greco
In this first revision of the patch:

- add "requestTypes RDP request" for any existent actor (handled in the toolkit/devtools/server/main.js module just after the check for actor existency)
- add a new xpcshell-test unit (test_requestTypes.js), currently it checks the success test-case on the chrome debugger actor
Attachment #8355820 - Flags: review?(nfitzgerald)
Comment on attachment 8355820 [details] [diff] [review]
rev0 - handle requestTypes RDP request for any existent RDP actor, added success test case (xpcshell-test unit)

Review of attachment 8355820 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM! Thanks, Luca.

r+ with small comments below addressed.

::: toolkit/devtools/server/tests/unit/test_requestTypes.js
@@ +10,5 @@
> +  var calls = [];
> +
> +  calls.push(test_existent_actor(aClient, anActor));
> +
> +  promise.all.apply(null, calls).then(() => {

Should be able to just do:

  promise.all(calls).then(...)

@@ +22,5 @@
> +{
> +  let deferred = promise.defer();
> +
> +  aClient.request({ to: anActor, type: "requestTypes" }, function (aResponse) {
> +    do_check_eq(typeof aResponse.requestTypes.length, "number");

What is the point of checking that |length| is a number? Making sure that |requestTypes| is an array? If that is what we are going for, I'd replace the check with:

  Array.isArray(aResponse.requestTypes)
Attachment #8355820 - Flags: review?(nfitzgerald) → review+
Attachment #8356169 - Attachment description: applied suggested tweaks to test_requestTypes.js xpcshell test in rev0 → rev1 - applied suggested tweaks to test_requestTypes.js xpcshell test in rev0
(In reply to Luca Greco from comment #15)
> Created attachment 8356169 [details] [diff] [review]
> rev1 - applied suggested tweaks to test_requestTypes.js xpcshell test in rev0

Thanks!

In the future, when I say "r+ with blah blah", that means you don't need to flag me for review again. You can just upload the new patch and add the "checkin-needed" keyword.
Attachment #8356169 - Flags: review?(nfitzgerald) → review+
https://hg.mozilla.org/integration/fx-team/rev/05d387f1dc78
Flags: in-testsuite+
Keywords: checkin-needed
Whiteboard: [good first bug][mentor=nfitzgerald@mozilla.com][lang=js][debugger-docs-needed] → [good first bug][mentor=nfitzgerald@mozilla.com][lang=js][debugger-docs-needed][fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/05d387f1dc78
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [good first bug][mentor=nfitzgerald@mozilla.com][lang=js][debugger-docs-needed][fixed-in-fx-team] → [good first bug][mentor=nfitzgerald@mozilla.com][lang=js][debugger-docs-needed]
Target Milestone: --- → Firefox 29
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: