Closed Bug 1171408 Opened 8 years ago Closed 8 years ago

Move NetworkEventsHandler.getString into WebConsoleClient

Categories

(DevTools :: Console, defect)

defect
Not set
normal

Tracking

(firefox41 fixed)

RESOLVED FIXED
Firefox 41
Tracking Status
firefox41 --- fixed

People

(Reporter: Honza, Assigned: Honza)

Details

Attachments

(1 file, 1 obsolete file)

NetworkEventsHandler.getString() is a helper that should be sharable by other modules, so let's move it into WebConsoleClient object.

Honza
Attached patch bug1171408-1.patch (obsolete) — Splinter Review
Try push:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=73a46c0a4b2d

Honza
Assignee: nobody → odvarko
Status: NEW → ASSIGNED
Comment on attachment 8615268 [details] [diff] [review]
bug1171408-1.patch

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

r=me with comments addressed.

::: toolkit/devtools/webconsole/client.js
@@ +8,5 @@
>  
>  const {Cc, Ci, Cu} = require("chrome");
>  const DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
>  const EventEmitter = require("devtools/toolkit/event-emitter");
> +const promise = Cu.import("resource://gre/modules/Promise.jsm", {}).Promise;

We are trying to convert all imports to require() and the devtools loader already provides a require("promise") that can be used here.

@@ +627,5 @@
> +   * @return object Promise
> +   *         A promise that is resolved when the full string contents
> +   *         are available, or rejected if something goes wrong.
> +   */
> +  getString: function(aStringGrip) {

Since this is a new method and the file is already inconsistent, let's avoid using the deprecated "aFoo" style for arguments and use the simpler "foo".

@@ +644,5 @@
> +    let longStringClient = this.longString(aStringGrip);
> +
> +    longStringClient.substring(initial.length, length, aResponse => {
> +      if (aResponse.error) {
> +        Cu.reportError(aResponse.error + ": " + aResponse.message);

Since this is now in toolkit, better use DevToolsUtils.reportException(), like we do elsewhere in this file, so that other embeddings can work properly.
Attachment #8615268 - Flags: review?(past) → review+
All comments fixed.

Thanks for the review Panos!

Honza
Attachment #8615268 - Attachment is obsolete: true
Attachment #8623681 - Flags: review+
Attachment #8623681 - Flags: review+ → review?(past)
Attachment #8623681 - Flags: review?(past) → review+
In the future, please make sure your patch includes proper commit information when requesting checkin.
(In reply to Ryan VanderMeulen [:RyanVM UTC-4] from comment #5)
> In the future, please make sure your patch includes proper commit
> information when requesting checkin.
Oops, forgot to remove try info.
Thanks for fixing!

Honza
https://hg.mozilla.org/mozilla-central/rev/0859b5b72ea5
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 41
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.